From bee83b7a5c21fe636e8446e18d8d42eca5e4aec9 Mon Sep 17 00:00:00 2001 From: Hernan Martinez Date: Sun, 3 Nov 2024 10:41:08 -0700 Subject: [PATCH] Update qtbase patch for 6.5.x --- Patches/qt-ui-automation-id-qtbase.patch | 115 ++++++++++++++--------- 1 file changed, 72 insertions(+), 43 deletions(-) diff --git a/Patches/qt-ui-automation-id-qtbase.patch b/Patches/qt-ui-automation-id-qtbase.patch index a7fb48b..b8897b8 100644 --- a/Patches/qt-ui-automation-id-qtbase.patch +++ b/Patches/qt-ui-automation-id-qtbase.patch @@ -1,8 +1,8 @@ -diff --git a/qtbase/src/gui/accessible/qaccessible.h b/qtbase/src/gui/accessible/qaccessible.h -index 521cfb855b..0f5a8ad128 100644 ---- a/qtbase/src/gui/accessible/qaccessible.h -+++ b/qtbase/src/gui/accessible/qaccessible.h -@@ -138,14 +138,15 @@ public: +diff --git a/qtbase/src/gui/accessible/qaccessible_base.h b/qtbase/src/gui/accessible/qaccessible_base.h +index ac50c2626e..ea8b86bfe9 100644 +--- a/qtbase/src/gui/accessible/qaccessible_base.h ++++ b/qtbase/src/gui/accessible/qaccessible_base.h +@@ -97,14 +97,15 @@ public: NameChanged = 0x800C, DescriptionChanged = 0x800D, ValueChanged = 0x800E, @@ -18,7 +18,7 @@ index 521cfb855b..0f5a8ad128 100644 // 64 bit enums seem hard on some platforms (windows...) // which makes using a bit field a sensible alternative -@@ -360,14 +361,15 @@ public: +@@ -319,14 +320,15 @@ public: enum Text { Name = 0, Description, @@ -35,10 +35,10 @@ index 521cfb855b..0f5a8ad128 100644 Labelled = 0x00000002, Controller = 0x00000004, diff --git a/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp b/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp -index 0903f5a618..fe99d01240 100644 +index 001cb8505b..212bd0e202 100644 --- a/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp +++ b/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp -@@ -166,14 +166,17 @@ void QWindowsUiaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event +@@ -137,14 +137,17 @@ void QWindowsUiaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event break; case QAccessible::ValueChanged: QWindowsUiaMainProvider::notifyValueChange(static_cast(event)); @@ -57,13 +57,13 @@ index 0903f5a618..fe99d01240 100644 case QAccessible::TextInserted: case QAccessible::TextRemoved: diff --git a/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp -index 171a3c268b..77e96b8d60 100644 +index cd92cd18a0..e93d73c21d 100644 --- a/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp +++ b/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp -@@ -220,14 +220,27 @@ void QWindowsUiaMainProvider::notifyNameChange(QAccessibleEvent *event) - setVariantString(accessible->text(QAccessible::Name), &newVal); - QWindowsUiaWrapper::instance()->raiseAutomationPropertyChangedEvent(provider, UIA_NamePropertyId, oldVal, newVal); - ::SysFreeString(newVal.bstrVal); +@@ -169,14 +169,27 @@ void QWindowsUiaMainProvider::notifyNameChange(QAccessibleEvent *event) + QWindowsUiaWrapper::instance()->raiseAutomationPropertyChangedEvent(provider, UIA_NamePropertyId, oldVal, newVal); + ::SysFreeString(newVal.bstrVal); + } } } } @@ -88,28 +88,41 @@ index 171a3c268b..77e96b8d60 100644 QWindowsUiaWrapper::instance()->raiseAutomationEvent(provider, UIA_SelectionItem_ElementSelectedEventId); } } -@@ -416,15 +429,15 @@ HRESULT QWindowsUiaMainProvider::GetPropertyValue(PROPERTYID idProp, VARIANT *pR - break; - case UIA_AccessKeyPropertyId: - // Accelerator key. - setVariantString(accessible->text(QAccessible::Accelerator), pRetVal); - break; - case UIA_AutomationIdPropertyId: - // Automation ID, which can be used by tools to select a specific control in the UI. -- setVariantString(automationIdForAccessible(accessible), pRetVal); -+ setVariantString(accessible->text(QAccessible::AutomationId), pRetVal); - break; - case UIA_ClassNamePropertyId: - // Class name. - if (QObject *o = accessible->object()) { - QString className = QLatin1String(o->metaObject()->className()); - setVariantString(className, pRetVal); - } +@@ -467,28 +480,15 @@ HRESULT QWindowsUiaMainProvider::GetPropertyValue(PROPERTYID idProp, VARIANT *pR + } + return S_OK; + } + + // Generates an ID based on the name of the controls and their parents. + QString QWindowsUiaMainProvider::automationIdForAccessible(const QAccessibleInterface *accessible) + { +- QString result; +- if (accessible) { +- QObject *obj = accessible->object(); +- while (obj) { +- QString name = obj->objectName(); +- if (name.isEmpty()) +- return result; +- if (!result.isEmpty()) +- result.prepend(u'.'); +- result.prepend(name); +- obj = obj->parent(); +- } +- } +- return result; ++ return accessible->text(QAccessible::AutomationId); + } + + HRESULT QWindowsUiaMainProvider::get_HostRawElementProvider(IRawElementProviderSimple **pRetVal) + { + qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this; + + if (!pRetVal) diff --git a/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h b/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h -index f7320388f7..e3de692172 100644 +index 5659a28e35..a912368ca0 100644 --- a/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h +++ b/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h -@@ -65,14 +65,15 @@ public: +@@ -29,14 +29,15 @@ public: static QWindowsUiaMainProvider *providerForAccessible(QAccessibleInterface *accessible); explicit QWindowsUiaMainProvider(QAccessibleInterface *a, int initialRefCount = 1); virtual ~QWindowsUiaMainProvider(); @@ -126,10 +139,10 @@ index f7320388f7..e3de692172 100644 ULONG STDMETHODCALLTYPE AddRef() override; ULONG STDMETHODCALLTYPE Release() override; diff --git a/qtbase/src/widgets/accessible/qaccessiblewidget.cpp b/qtbase/src/widgets/accessible/qaccessiblewidget.cpp -index ae545a5ce2..57d4962f46 100644 +index b0bb12ea86..bbac328e76 100644 --- a/qtbase/src/widgets/accessible/qaccessiblewidget.cpp +++ b/qtbase/src/widgets/accessible/qaccessiblewidget.cpp -@@ -438,14 +438,16 @@ QString QAccessibleWidget::text(QAccessible::Text t) const +@@ -389,14 +389,16 @@ QString QAccessibleWidget::text(QAccessible::Text t) const #endif break; case QAccessible::Accelerator: @@ -147,10 +160,10 @@ index ae545a5ce2..57d4962f46 100644 /*! \reimp */ diff --git a/qtbase/src/widgets/kernel/qwidget.cpp b/qtbase/src/widgets/kernel/qwidget.cpp -index cfc3f6a7d5..93caf2d5f1 100644 +index 83e072a941..01a9f86ab6 100644 --- a/qtbase/src/widgets/kernel/qwidget.cpp +++ b/qtbase/src/widgets/kernel/qwidget.cpp -@@ -11449,14 +11449,28 @@ void QWidget::setAccessibleDescription(const QString &description) +@@ -11723,14 +11723,28 @@ void QWidget::setAccessibleDescription(const QString &description) } QString QWidget::accessibleDescription() const @@ -172,7 +185,7 @@ index cfc3f6a7d5..93caf2d5f1 100644 + Q_D(const QWidget); + return d->automationId; +} - #endif // QT_NO_ACCESSIBILITY + #endif // QT_CONFIG(accessibility) #ifndef QT_NO_SHORTCUT /*! @@ -180,13 +193,29 @@ index cfc3f6a7d5..93caf2d5f1 100644 \a key sequence in the given \a context. If the \a context is Qt::ApplicationShortcut, the shortcut applies to the application as a diff --git a/qtbase/src/widgets/kernel/qwidget.h b/qtbase/src/widgets/kernel/qwidget.h -index c1c679c026..e7893ba3e7 100644 +index d2b20c6e6a..787be4e7c9 100644 --- a/qtbase/src/widgets/kernel/qwidget.h +++ b/qtbase/src/widgets/kernel/qwidget.h -@@ -410,14 +410,16 @@ public: +@@ -162,14 +162,15 @@ class Q_WIDGETS_EXPORT QWidget : public QObject, public QPaintDevice + #endif + #if QT_CONFIG(whatsthis) + Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis) + #endif + #if QT_CONFIG(accessibility) + Q_PROPERTY(QString accessibleName READ accessibleName WRITE setAccessibleName) + Q_PROPERTY(QString accessibleDescription READ accessibleDescription WRITE setAccessibleDescription) ++ Q_PROPERTY(QString automationId READ automationId WRITE setAutomationId) + #endif + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection) + QDOC_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags) + Q_PROPERTY(bool autoFillBackground READ autoFillBackground WRITE setAutoFillBackground) + #ifndef QT_NO_STYLE_STYLESHEET + Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet) + #endif +@@ -402,14 +403,16 @@ public: QString whatsThis() const; #endif - #ifndef QT_NO_ACCESSIBILITY + #if QT_CONFIG(accessibility) QString accessibleName() const; void setAccessibleName(const QString &name); QString accessibleDescription() const; @@ -201,15 +230,15 @@ index c1c679c026..e7893ba3e7 100644 void setLocale(const QLocale &locale); diff --git a/qtbase/src/widgets/kernel/qwidget_p.h b/qtbase/src/widgets/kernel/qwidget_p.h -index f79acb0912..9c05098eb1 100644 +index cf0618bca6..8ed431ee7c 100644 --- a/qtbase/src/widgets/kernel/qwidget_p.h +++ b/qtbase/src/widgets/kernel/qwidget_p.h -@@ -708,14 +708,15 @@ public: +@@ -670,14 +670,15 @@ public: #endif #if QT_CONFIG(whatsthis) QString whatsThis; #endif - #ifndef QT_NO_ACCESSIBILITY + #if QT_CONFIG(accessibility) QString accessibleName; QString accessibleDescription; + QString automationId;