summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
diff options
context:
space:
mode:
authorAndré de la Rocha <andre.rocha@qt.io>2022-03-25 19:54:01 -0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-04-01 04:37:57 +0000
commitac8467286ac19c30ed16a83bf1bc4c49a7f899f6 (patch)
tree8229083dfb0b93fb1cf863fc4a41f0a3e940371b /src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
parentacfcb0b5f43254d6ad27bc09b1884603c1aedf2e (diff)
Windows QPA: Avoid slowdown with UI Automation name change notification
A previous fix for QTBUG-70621, which allowed changes in the state of a Quick combo box control to be detected by accessibility clients has reportedly caused significant slowdowns under some difficult to reproduce circumstances, probably associated with a large number of accessible objects. This patch restricts the name change notification to combo boxes, which seem to be the only kind of control requiring them for accessibility, instead of sending it for all control types. Fixes: QTBUG-97103 Change-Id: I18c0067478df5a80f7365195d3559b3f04faa815 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> (cherry picked from commit bcd0a3220348778c0d72faac202efb97f4d6dd07) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp')
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
index 809a7a9a8f..63bf6bc87c 100644
--- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
@@ -206,12 +206,16 @@ void QWindowsUiaMainProvider::notifyValueChange(QAccessibleValueChangeEvent *eve
void QWindowsUiaMainProvider::notifyNameChange(QAccessibleEvent *event)
{
if (QAccessibleInterface *accessible = event->accessibleInterface()) {
- if (QWindowsUiaMainProvider *provider = providerForAccessible(accessible)) {
- VARIANT oldVal, newVal;
- clearVariant(&oldVal);
- setVariantString(accessible->text(QAccessible::Name), &newVal);
- QWindowsUiaWrapper::instance()->raiseAutomationPropertyChangedEvent(provider, UIA_NamePropertyId, oldVal, newVal);
- ::SysFreeString(newVal.bstrVal);
+ // Restrict notification to combo boxes, which need it for accessibility,
+ // in order to avoid slowdowns with unnecessary notifications.
+ if (accessible->role() == QAccessible::ComboBox) {
+ if (QWindowsUiaMainProvider *provider = providerForAccessible(accessible)) {
+ VARIANT oldVal, newVal;
+ clearVariant(&oldVal);
+ setVariantString(accessible->text(QAccessible::Name), &newVal);
+ QWindowsUiaWrapper::instance()->raiseAutomationPropertyChangedEvent(provider, UIA_NamePropertyId, oldVal, newVal);
+ ::SysFreeString(newVal.bstrVal);
+ }
}
}
}