1- diff --git a/qtbase/src/gui/accessible/qaccessible .h b/qtbase/src/gui/accessible/qaccessible .h
2- index 521cfb855b..0f5a8ad128 100644
3- --- a/qtbase/src/gui/accessible/qaccessible .h
4- +++ b/qtbase/src/gui/accessible/qaccessible .h
5- @@ -138 ,14 +138 ,15 @@ public:
1+ diff --git a/qtbase/src/gui/accessible/qaccessible_base .h b/qtbase/src/gui/accessible/qaccessible_base .h
2+ index ac50c2626e..ea8b86bfe9 100644
3+ --- a/qtbase/src/gui/accessible/qaccessible_base .h
4+ +++ b/qtbase/src/gui/accessible/qaccessible_base .h
5+ @@ -97 ,14 +97 ,15 @@ public:
66 NameChanged = 0x800C,
77 DescriptionChanged = 0x800D,
88 ValueChanged = 0x800E,
@@ -18,7 +18,7 @@ index 521cfb855b..0f5a8ad128 100644
1818
1919 // 64 bit enums seem hard on some platforms (windows...)
2020 // which makes using a bit field a sensible alternative
21- @@ -360 ,14 +361 ,15 @@ public:
21+ @@ -319 ,14 +320 ,15 @@ public:
2222 enum Text {
2323 Name = 0,
2424 Description,
@@ -35,10 +35,10 @@ index 521cfb855b..0f5a8ad128 100644
3535 Labelled = 0x00000002,
3636 Controller = 0x00000004,
3737diff --git a/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp b/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp
38- index 0903f5a618..fe99d01240 100644
38+ index 001cb8505b..212bd0e202 100644
3939--- a/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp
4040+++ b/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp
41- @@ -166 ,14 +166 ,17 @@ void QWindowsUiaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event
41+ @@ -137 ,14 +137 ,17 @@ void QWindowsUiaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event
4242 break;
4343 case QAccessible::ValueChanged:
4444 QWindowsUiaMainProvider::notifyValueChange(static_cast<QAccessibleValueChangeEvent *>(event));
@@ -57,13 +57,13 @@ index 0903f5a618..fe99d01240 100644
5757 case QAccessible::TextInserted:
5858 case QAccessible::TextRemoved:
5959diff --git a/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
60- index 171a3c268b..77e96b8d60 100644
60+ index cd92cd18a0..e93d73c21d 100644
6161--- a/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
6262+++ b/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
63- @@ -220 ,14 +220 ,27 @@ void QWindowsUiaMainProvider::notifyNameChange(QAccessibleEvent *event)
64- setVariantString(accessible->text(QAccessible::Name), & newVal);
65- QWindowsUiaWrapper::instance()->raiseAutomationPropertyChangedEvent(provider, UIA_NamePropertyId, oldVal, newVal);
66- ::SysFreeString(newVal.bstrVal);
63+ @@ -169 ,14 +169 ,27 @@ void QWindowsUiaMainProvider::notifyNameChange(QAccessibleEvent *event)
64+ QWindowsUiaWrapper::instance()->raiseAutomationPropertyChangedEvent(provider, UIA_NamePropertyId, oldVal, newVal);
65+ ::SysFreeString( newVal.bstrVal );
66+ }
6767 }
6868 }
6969 }
@@ -88,28 +88,41 @@ index 171a3c268b..77e96b8d60 100644
8888 QWindowsUiaWrapper::instance()->raiseAutomationEvent(provider, UIA_SelectionItem_ElementSelectedEventId);
8989 }
9090 }
91- @@ -416,15 +429,15 @@ HRESULT QWindowsUiaMainProvider::GetPropertyValue(PROPERTYID idProp, VARIANT *pR
92- break;
93- case UIA_AccessKeyPropertyId:
94- // Accelerator key.
95- setVariantString(accessible->text(QAccessible::Accelerator), pRetVal);
96- break;
97- case UIA_AutomationIdPropertyId:
98- // Automation ID, which can be used by tools to select a specific control in the UI.
99- - setVariantString(automationIdForAccessible(accessible), pRetVal);
100- + setVariantString(accessible->text(QAccessible::AutomationId), pRetVal);
101- break;
102- case UIA_ClassNamePropertyId:
103- // Class name.
104- if (QObject *o = accessible->object()) {
105- QString className = QLatin1String(o->metaObject()->className());
106- setVariantString(className, pRetVal);
107- }
91+ @@ -467,28 +480,15 @@ HRESULT QWindowsUiaMainProvider::GetPropertyValue(PROPERTYID idProp, VARIANT *pR
92+ }
93+ return S_OK;
94+ }
95+
96+ // Generates an ID based on the name of the controls and their parents.
97+ QString QWindowsUiaMainProvider::automationIdForAccessible(const QAccessibleInterface *accessible)
98+ {
99+ - QString result;
100+ - if (accessible) {
101+ - QObject *obj = accessible->object();
102+ - while (obj) {
103+ - QString name = obj->objectName();
104+ - if (name.isEmpty())
105+ - return result;
106+ - if (!result.isEmpty())
107+ - result.prepend(u'.');
108+ - result.prepend(name);
109+ - obj = obj->parent();
110+ - }
111+ - }
112+ - return result;
113+ + return accessible->text(QAccessible::AutomationId);
114+ }
115+
116+ HRESULT QWindowsUiaMainProvider::get_HostRawElementProvider(IRawElementProviderSimple **pRetVal)
117+ {
118+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
119+
120+ if (!pRetVal)
108121diff --git a/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h b/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h
109- index f7320388f7..e3de692172 100644
122+ index 5659a28e35..a912368ca0 100644
110123--- a/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h
111124+++ b/qtbase/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h
112- @@ -65 ,14 +65 ,15 @@ public:
125+ @@ -29 ,14 +29 ,15 @@ public:
113126 static QWindowsUiaMainProvider *providerForAccessible(QAccessibleInterface *accessible);
114127 explicit QWindowsUiaMainProvider(QAccessibleInterface *a, int initialRefCount = 1);
115128 virtual ~QWindowsUiaMainProvider();
@@ -126,10 +139,10 @@ index f7320388f7..e3de692172 100644
126139 ULONG STDMETHODCALLTYPE AddRef() override;
127140 ULONG STDMETHODCALLTYPE Release() override;
128141diff --git a/qtbase/src/widgets/accessible/qaccessiblewidget.cpp b/qtbase/src/widgets/accessible/qaccessiblewidget.cpp
129- index ae545a5ce2..57d4962f46 100644
142+ index b0bb12ea86..bbac328e76 100644
130143--- a/qtbase/src/widgets/accessible/qaccessiblewidget.cpp
131144+++ b/qtbase/src/widgets/accessible/qaccessiblewidget.cpp
132- @@ -438 ,14 +438 ,16 @@ QString QAccessibleWidget::text(QAccessible::Text t) const
145+ @@ -389 ,14 +389 ,16 @@ QString QAccessibleWidget::text(QAccessible::Text t) const
133146 #endif
134147 break;
135148 case QAccessible::Accelerator:
@@ -147,10 +160,10 @@ index ae545a5ce2..57d4962f46 100644
147160
148161 /*! \reimp */
149162diff --git a/qtbase/src/widgets/kernel/qwidget.cpp b/qtbase/src/widgets/kernel/qwidget.cpp
150- index cfc3f6a7d5..93caf2d5f1 100644
163+ index 83e072a941..01a9f86ab6 100644
151164--- a/qtbase/src/widgets/kernel/qwidget.cpp
152165+++ b/qtbase/src/widgets/kernel/qwidget.cpp
153- @@ -11449 ,14 +11449 ,28 @@ void QWidget::setAccessibleDescription(const QString &description)
166+ @@ -11723 ,14 +11723 ,28 @@ void QWidget::setAccessibleDescription(const QString &description)
154167 }
155168
156169 QString QWidget::accessibleDescription() const
@@ -172,21 +185,37 @@ index cfc3f6a7d5..93caf2d5f1 100644
172185+ Q_D(const QWidget);
173186+ return d->automationId;
174187+ }
175- #endif // QT_NO_ACCESSIBILITY
188+ #endif // QT_CONFIG(accessibility)
176189
177190 #ifndef QT_NO_SHORTCUT
178191 /*!
179192 Adds a shortcut to Qt's shortcut system that watches for the given
180193 \a key sequence in the given \a context. If the \a context is
181194 Qt::ApplicationShortcut, the shortcut applies to the application as a
182195diff --git a/qtbase/src/widgets/kernel/qwidget.h b/qtbase/src/widgets/kernel/qwidget.h
183- index c1c679c026..e7893ba3e7 100644
196+ index d2b20c6e6a..787be4e7c9 100644
184197--- a/qtbase/src/widgets/kernel/qwidget.h
185198+++ b/qtbase/src/widgets/kernel/qwidget.h
186- @@ -410,14 +410,16 @@ public:
199+ @@ -162,14 +162,15 @@ class Q_WIDGETS_EXPORT QWidget : public QObject, public QPaintDevice
200+ #endif
201+ #if QT_CONFIG(whatsthis)
202+ Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis)
203+ #endif
204+ #if QT_CONFIG(accessibility)
205+ Q_PROPERTY(QString accessibleName READ accessibleName WRITE setAccessibleName)
206+ Q_PROPERTY(QString accessibleDescription READ accessibleDescription WRITE setAccessibleDescription)
207+ + Q_PROPERTY(QString automationId READ automationId WRITE setAutomationId)
208+ #endif
209+ Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection)
210+ QDOC_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags)
211+ Q_PROPERTY(bool autoFillBackground READ autoFillBackground WRITE setAutoFillBackground)
212+ #ifndef QT_NO_STYLE_STYLESHEET
213+ Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
214+ #endif
215+ @@ -402,14 +403,16 @@ public:
187216 QString whatsThis() const;
188217 #endif
189- #ifndef QT_NO_ACCESSIBILITY
218+ #if QT_CONFIG(accessibility)
190219 QString accessibleName() const;
191220 void setAccessibleName(const QString &name);
192221 QString accessibleDescription() const;
@@ -201,15 +230,15 @@ index c1c679c026..e7893ba3e7 100644
201230
202231 void setLocale(const QLocale &locale);
203232diff --git a/qtbase/src/widgets/kernel/qwidget_p.h b/qtbase/src/widgets/kernel/qwidget_p.h
204- index f79acb0912..9c05098eb1 100644
233+ index cf0618bca6..8ed431ee7c 100644
205234--- a/qtbase/src/widgets/kernel/qwidget_p.h
206235+++ b/qtbase/src/widgets/kernel/qwidget_p.h
207- @@ -708 ,14 +708 ,15 @@ public:
236+ @@ -670 ,14 +670 ,15 @@ public:
208237 #endif
209238 #if QT_CONFIG(whatsthis)
210239 QString whatsThis;
211240 #endif
212- #ifndef QT_NO_ACCESSIBILITY
241+ #if QT_CONFIG(accessibility)
213242 QString accessibleName;
214243 QString accessibleDescription;
215244+ QString automationId;
0 commit comments