[neon/qt/qtquickcontrols2/Neon/unstable] debian: Add 0009-Accessibility-respect-value-in-attached-Accessible-i.patch from KDE.

Dmitry Shachnev null at kde.org
Mon Apr 29 17:44:21 BST 2024


Git commit 1f1757ad030020420c73457c4c83f4da1aec03d4 by Dmitry Shachnev.
Committed on 10/06/2023 at 18:18.
Pushed by jriddell into branch 'Neon/unstable'.

Add 0009-Accessibility-respect-value-in-attached-Accessible-i.patch from KDE.

M  +2    -0    debian/changelog
A  +150  -0    debian/patches/0009-Accessibility-respect-value-in-attached-Accessible-i.patch
M  +1    -0    debian/patches/series

https://invent.kde.org/neon/qt/qtquickcontrols2/-/commit/1f1757ad030020420c73457c4c83f4da1aec03d4

diff --git a/debian/changelog b/debian/changelog
index c1c6d47..b275e1a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ qtquickcontrols2-opensource-src (5.15.10+dfsg-1) UNRELEASED; urgency=medium
   * New upstream release.
   * Bump Qt build-dependencies to 5.15.10.
   * Refresh 0006-Fix-scroll-bars-not-showing-up-when-binding-to-stand.patch.
+  * Add one more patch from KDE’s collection: respect value in attached
+    Accessible in controls.
 
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Sat, 10 Jun 2023 20:46:09 +0300
 
diff --git a/debian/patches/0009-Accessibility-respect-value-in-attached-Accessible-i.patch b/debian/patches/0009-Accessibility-respect-value-in-attached-Accessible-i.patch
new file mode 100644
index 0000000..46f57df
--- /dev/null
+++ b/debian/patches/0009-Accessibility-respect-value-in-attached-Accessible-i.patch
@@ -0,0 +1,150 @@
+From 68a48018e34322edaf611639710b3edbe389e8c2 Mon Sep 17 00:00:00 2001
+From: Volker Hilsheimer <volker.hilsheimer at qt.io>
+Date: Tue, 18 Apr 2023 22:05:36 +0200
+Subject: [PATCH] Accessibility: respect value in attached Accessible in
+ controls
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+QQuickItemPrivate::accessibleRole is virtual and called by the framework
+to determine the role of an item. The default implementation checks and
+respects a possible Accessible attached object. However, subclasses that
+override the virtual don't, so the attached properties are ignored, and
+the class-specific implementation wins. This makes it impossible to
+change the role of e.g. a checkable button.
+
+To fix that, move the code respecting the attached object into a non-
+virtual function that the framework calls instead, and only call the
+virtual member if there is no attached object, or if that object is not
+initialized with a role. Replace calls to the virtual from the
+framework with calls to the non-virtual wrapper.
+
+Do this for both QQuickItem and for QQuickPopup, and adjust the logic
+in QQuickControl types that create an attached object and initialize
+it's role when accessibility becomes active. Use the non-overridable
+effective role value for that as well.
+
+Add a test case, and to avoid any new framework calls to the virtual,
+make it private.
+
+Fixes: QTBUG-110114
+Pick-to: 6.5 6.2
+Change-Id: Ia709cecbd181b6d8ee3297a4af60c1e7db9a2c51
+Reviewed-by: Qt CI Bot <qt_ci_bot at qt-project.org>
+Reviewed-by: Jan Arve Sæther <jan-arve.saether at qt.io>
+(cherry picked from commit 3c08d08ae2bbd449cc0579a1b3cb499383c7a60c)
+---
+ src/quicktemplates2/qquickcontrol.cpp   |  3 ++-
+ src/quicktemplates2/qquicklabel.cpp     |  2 +-
+ src/quicktemplates2/qquickpopup.cpp     | 14 ++++++++++++++
+ src/quicktemplates2/qquickpopup_p.h     |  3 +++
+ src/quicktemplates2/qquickpopupitem.cpp |  2 +-
+ src/quicktemplates2/qquicktextarea.cpp  |  2 +-
+ src/quicktemplates2/qquicktextfield.cpp |  2 +-
+ 7 files changed, 23 insertions(+), 5 deletions(-)
+
+--- a/src/quicktemplates2/qquickcontrol.cpp
++++ b/src/quicktemplates2/qquickcontrol.cpp
+@@ -2327,12 +2327,13 @@ QAccessible::Role QQuickControl::accessibleRole() const
+ 
+ void QQuickControl::accessibilityActiveChanged(bool active)
+ {
++    Q_D(QQuickControl);
+     if (!active)
+         return;
+ 
+     QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(this, true));
+     Q_ASSERT(accessibleAttached);
+-    accessibleAttached->setRole(accessibleRole());
++    accessibleAttached->setRole(d->effectiveAccessibleRole());
+ }
+ #endif
+ 
+--- a/src/quicktemplates2/qquicklabel.cpp
++++ b/src/quicktemplates2/qquicklabel.cpp
+@@ -263,7 +263,7 @@ void QQuickLabelPrivate::accessibilityActiveChanged(bool active)
+     Q_Q(QQuickLabel);
+     QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
+     Q_ASSERT(accessibleAttached);
+-    accessibleAttached->setRole(accessibleRole());
++    accessibleAttached->setRole(effectiveAccessibleRole());
+     maybeSetAccessibleName(text);
+ }
+ 
+--- a/src/quicktemplates2/qquickpopup.cpp
++++ b/src/quicktemplates2/qquickpopup.cpp
+@@ -46,6 +46,7 @@
+ 
+ #include <QtQml/qqmlinfo.h>
+ #include <QtQuick/qquickitem.h>
++#include <QtQuick/private/qquickaccessibleattached_p.h>
+ #include <QtQuick/private/qquicktransition_p.h>
+ #include <QtQuick/private/qquickitem_p.h>
+ 
+@@ -2720,6 +2721,19 @@ QPalette QQuickPopup::defaultPalette() const
+ }
+ 
+ #if QT_CONFIG(accessibility)
++QAccessible::Role QQuickPopup::effectiveAccessibleRole() const
++{
++    auto *attached = qmlAttachedPropertiesObject<QQuickAccessibleAttached>(this, false);
++
++    auto role = QAccessible::NoRole;
++    if (auto *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(attached))
++        role = accessibleAttached->role();
++    if (role == QAccessible::NoRole)
++        role = accessibleRole();
++
++    return role;
++}
++
+ QAccessible::Role QQuickPopup::accessibleRole() const
+ {
+     return QAccessible::Dialog;
+--- a/src/quicktemplates2/qquickpopup_p.h
++++ b/src/quicktemplates2/qquickpopup_p.h
+@@ -454,7 +454,10 @@ protected:
+     virtual QPalette defaultPalette() const;
+ 
+ #if QT_CONFIG(accessibility)
++    QAccessible::Role effectiveAccessibleRole() const;
++private:
+     virtual QAccessible::Role accessibleRole() const;
++protected:
+     virtual void accessibilityActiveChanged(bool active);
+ #endif
+ 
+--- a/src/quicktemplates2/qquickpopupitem.cpp
++++ b/src/quicktemplates2/qquickpopupitem.cpp
+@@ -404,7 +404,7 @@ QPalette QQuickPopupItem::defaultPalette() const
+ QAccessible::Role QQuickPopupItem::accessibleRole() const
+ {
+     Q_D(const QQuickPopupItem);
+-    return d->popup->accessibleRole();
++    return d->popup->effectiveAccessibleRole();
+ }
+ 
+ void QQuickPopupItem::accessibilityActiveChanged(bool active)
+--- a/src/quicktemplates2/qquicktextarea.cpp
++++ b/src/quicktemplates2/qquicktextarea.cpp
+@@ -512,7 +512,7 @@ void QQuickTextAreaPrivate::accessibilityActiveChanged(bool active)
+     Q_Q(QQuickTextArea);
+     QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
+     Q_ASSERT(accessibleAttached);
+-    accessibleAttached->setRole(accessibleRole());
++    accessibleAttached->setRole(effectiveAccessibleRole());
+     accessibleAttached->set_readOnly(q->isReadOnly());
+     accessibleAttached->setDescription(placeholder);
+ }
+--- a/src/quicktemplates2/qquicktextfield.cpp
++++ b/src/quicktemplates2/qquicktextfield.cpp
+@@ -359,7 +359,7 @@ void QQuickTextFieldPrivate::accessibilityActiveChanged(bool active)
+     Q_Q(QQuickTextField);
+     QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
+     Q_ASSERT(accessibleAttached);
+-    accessibleAttached->setRole(accessibleRole());
++    accessibleAttached->setRole(effectiveAccessibleRole());
+     accessibleAttached->set_readOnly(m_readOnly);
+     accessibleAttached->set_passwordEdit((m_echoMode == QQuickTextField::Password || m_echoMode == QQuickTextField::PasswordEchoOnEdit) ? true : false);
+     accessibleAttached->setDescription(placeholder);
diff --git a/debian/patches/series b/debian/patches/series
index dae04a5..2b9b7e7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,4 +3,5 @@
 0006-Fix-scroll-bars-not-showing-up-when-binding-to-stand.patch
 0007-implement-a11y-pressing-of-qquickabstractbutton.patch
 0008-Fix-the-popup-position-of-a-Menu.patch
+0009-Accessibility-respect-value-in-attached-Accessible-i.patch
 disable_fontless_examples_build.patch



More information about the Neon-commits mailing list