From adfd0914e3fe9a15f818b0979936d5f0ff545f32 Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Wed, 12 Feb 2020 19:30:26 +0100 Subject: [PATCH] Windows QPA: Add support to IsDialog UIA property Adding support to the IsDialog property within the UI Automation code. This property allows dialog windows to be identified as such, which may be used by screen readers to better describe them. Fixes: QTBUG-82019 Change-Id: I6f5478dd30f63f152cba75886a9e0eb38772037a Reviewed-by: Friedemann Kleint --- src/platformsupport/windowsuiautomation/uiapropertyids_p.h | 1 + .../windows/uiautomation/qwindowsuiamainprovider.cpp | 4 ++++ .../platforms/windows/uiautomation/qwindowsuiautils.cpp | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/platformsupport/windowsuiautomation/uiapropertyids_p.h b/src/platformsupport/windowsuiautomation/uiapropertyids_p.h index 74e84147f6..9c14a35271 100644 --- a/src/platformsupport/windowsuiautomation/uiapropertyids_p.h +++ b/src/platformsupport/windowsuiautomation/uiapropertyids_p.h @@ -219,5 +219,6 @@ #define UIA_CenterPointPropertyId 30165 #define UIA_RotationPropertyId 30166 #define UIA_SizePropertyId 30167 +#define UIA_IsDialogPropertyId 30174 #endif diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp index 5f564f81c2..93cfd095e4 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp @@ -448,6 +448,10 @@ HRESULT QWindowsUiaMainProvider::GetPropertyValue(PROPERTYID idProp, VARIANT *pR setVariantBool(wt == Qt::Popup || wt == Qt::ToolTip || wt == Qt::SplashScreen, pRetVal); } break; + case UIA_IsDialogPropertyId: + setVariantBool(accessible->role() == QAccessible::Dialog + || accessible->role() == QAccessible::AlertMessage, pRetVal); + break; case UIA_FullDescriptionPropertyId: setVariantString(accessible->text(QAccessible::Description), pRetVal); break; diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp index ab04384616..682b8c19c0 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp @@ -161,7 +161,7 @@ long roleToControlTypeId(QAccessible::Role role) {QAccessible::Sound, UIA_CustomControlTypeId}, {QAccessible::Cursor, UIA_CustomControlTypeId}, {QAccessible::Caret, UIA_CustomControlTypeId}, - {QAccessible::AlertMessage, UIA_CustomControlTypeId}, + {QAccessible::AlertMessage, UIA_WindowControlTypeId}, {QAccessible::Window, UIA_WindowControlTypeId}, {QAccessible::Client, UIA_GroupControlTypeId}, {QAccessible::PopupMenu, UIA_MenuControlTypeId},