diff options
author | Michael Weghorn <[email protected]> | 2024-09-28 22:01:54 +0200 |
---|---|---|
committer | Michael Weghorn <[email protected]> | 2024-10-10 23:44:17 +0200 |
commit | d13de6afbefb3c9306561216ea9a0efc0c11374b (patch) | |
tree | d0d62f65c56cbb999415588f67c7246b9d9e14ac | |
parent | efdb5d16df6f7f400b30596f5ec70f1c5a39fb2d (diff) |
a11y: Report QMessageBox accessible ID
Commit b8b7c58402740204da72e1b1f4ea7321b7bfa540 introduced
QWidget::setAccessibleIdentifier for setting the accessible
ID of a widget.
When calling that on a QMessageBox, the ID set this way would
however not get reported on the platform level, e.g.
AT-SPI2 on Linux.
This is because QAccessibleMessageBox overrides
the default implementation of QAccessibleWidget::text
and so far didn't explicitly handle QAccessible::Identifier,
but returned an empty string for the default case instead.
Call the base class implementation for the default
case to make this work and also handle other currently
unhandled cases (Accelerator, DebugDescription), and
potential QAccessible::Text enum values that might
get added in the future.
While at it, unify to call the base class implementation
for QAccessible::Description as well instead of manually
calling QWidget::accessibleDescription. That is what the
base class implementation does as well, and it includes
an additional fallback to use the tooltip if no accessible
description is explicitly set.
Change-Id: I0f3c53624b1c71ca666f836ba353f1bb1da9a8bc
Reviewed-by: Jan Arve Sæther <[email protected]>
-rw-r--r-- | src/widgets/accessible/simplewidgets.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index fbbbab857d1..c762a8d0689 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -978,9 +978,6 @@ QString QAccessibleMessageBox::text(QAccessible::Text t) const if (str.isEmpty()) // implies no title text is set str = messageBox()->text(); break; - case QAccessible::Description: - str = widget()->accessibleDescription(); - break; case QAccessible::Value: str = messageBox()->text(); break; @@ -988,6 +985,7 @@ QString QAccessibleMessageBox::text(QAccessible::Text t) const str = messageBox()->informativeText(); break; default: + str = QAccessibleWidget::text(t); break; } |