diff options
author | André de la Rocha <andre.rocha@qt.io> | 2022-08-10 03:00:26 +0200 |
---|---|---|
committer | André de la Rocha <andre.rocha@qt.io> | 2022-08-22 02:43:13 +0200 |
commit | 62d957f6aab38f60f22c7e045a9710484f58ae4e (patch) | |
tree | 008d032434e2001cd6d6abb341fbb4610bd9a8f0 | |
parent | 1ecfc4101cf41b1d3947ed938bb76c52919f360b (diff) |
Windows QPA: fix tree item discovery through UI Automation
This change reverts a workaround for a compatibility issue with
a Windows utility, which is no longer necessary with Qt6 and was
in some cases preventing accessibility tools from discovering
tree items.
This reverts commit 1c55a6caf1fc2b8a73a9a756bcf6894c5d4e4398.
Fixes: QTBUG-105814
Pick-to: 6.4 6.3 6.2
Change-Id: Id464da49704b6953affca2fa40acc03f1ffd05ac
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r-- | src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp index 2d5d91a7ea..e75f9a3839 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp @@ -699,26 +699,18 @@ HRESULT QWindowsUiaMainProvider::ElementProviderFromPoint(double x, double y, IR QPoint point; nativeUiaPointToPoint(uiaPoint, window, &point); - if (auto targetacc = accessible->childAt(point.x(), point.y())) { - auto acc = accessible->childAt(point.x(), point.y()); - // Reject the cases where childAt() returns a different instance in each call for the same - // element (e.g., QAccessibleTree), as it causes an endless loop with Youdao Dictionary installed. - if (targetacc == acc) { - // Controls can be embedded within grouping elements. By default returns the innermost control. - while (acc) { - targetacc = acc; - // For accessibility tools it may be better to return the text element instead of its subcomponents. - if (targetacc->textInterface()) break; - acc = targetacc->childAt(point.x(), point.y()); - if (acc != targetacc->childAt(point.x(), point.y())) { - qCDebug(lcQpaUiAutomation) << "Non-unique childAt() for" << targetacc; - break; - } - } - *pRetVal = providerForAccessible(targetacc); - } else { - qCDebug(lcQpaUiAutomation) << "Non-unique childAt() for" << accessible; + QAccessibleInterface *targetacc = accessible->childAt(point.x(), point.y()); + + if (targetacc) { + QAccessibleInterface *acc = targetacc; + // Controls can be embedded within grouping elements. By default returns the innermost control. + while (acc) { + targetacc = acc; + // For accessibility tools it may be better to return the text element instead of its subcomponents. + if (targetacc->textInterface()) break; + acc = acc->childAt(point.x(), point.y()); } + *pRetVal = providerForAccessible(targetacc); } return S_OK; } |