aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2018-10-09 09:12:07 +0200
committerAndy Shaw <andy.shaw@qt.io>2018-10-19 13:29:24 +0000
commit4a886753a75c7c4d66f1fa9cab5a6c5a03240df3 (patch)
tree5fa8616ff1b8ac1297d5791a1e70e97860950c62 /src
parent0f0ed2070333d61a2603cf3e9bc0cb15439e1177 (diff)
Accessible: Return StaticText if there is no explicit role set
Before, it would assume that StaticText was the role if the item could be cast to a QQuickText. It should only do this if the role is not explicitly set, in case it is not really StaticText in the attached property. Change-Id: I800810f1347fc9aa412c4ca5d180f78d27a89b38 Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quick/accessible/qaccessiblequickitem.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp
index 87e581384b..98e7663c96 100644
--- a/src/quick/accessible/qaccessiblequickitem.cpp
+++ b/src/quick/accessible/qaccessiblequickitem.cpp
@@ -205,14 +205,16 @@ QAccessible::Role QAccessibleQuickItem::role() const
// Workaround for setAccessibleRole() not working for
// Text items. Text items are special since they are defined
// entirely from C++ (setting the role from QML works.)
- if (qobject_cast<QQuickText*>(const_cast<QQuickItem *>(item())))
- return QAccessible::StaticText;
QAccessible::Role role = QAccessible::NoRole;
if (item())
role = QQuickItemPrivate::get(item())->accessibleRole();
- if (role == QAccessible::NoRole)
- role = QAccessible::Client;
+ if (role == QAccessible::NoRole) {
+ if (qobject_cast<QQuickText*>(const_cast<QQuickItem *>(item())))
+ role = QAccessible::StaticText;
+ else
+ role = QAccessible::Client;
+ }
return role;
}