aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@qt.io>2019-06-13 11:56:45 +0200
committerFrederik Gladhorn <frederik.gladhorn@qt.io>2019-06-13 12:18:41 +0200
commit761df2ced0081905b4238c66783bb276f504cf3d (patch)
tree36ac08aec5beb02d46457cad6c05c27b8b0eb6c5
parent335314146dece4fa86c661a4094a2f73e5e81a43 (diff)
Accessibility: Switch should have checkbox as role
Fixes: QTBUG-76356 Change-Id: I8f8e8331adbe741be2c893f2140d793d1b901434 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp4
-rw-r--r--tests/auto/accessibility/tst_accessibility.cpp2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index a2992191..0aa8ec28 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -1157,6 +1157,10 @@ void QQuickAbstractButton::accessibilityActiveChanged(bool active)
QAccessible::Role QQuickAbstractButton::accessibleRole() const
{
+ Q_D(const QQuickAbstractButton);
+ if (d->checkable) {
+ return QAccessible::CheckBox;
+ }
return QAccessible::Button;
}
#endif
diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp
index 0224f020..868b4413 100644
--- a/tests/auto/accessibility/tst_accessibility.cpp
+++ b/tests/auto/accessibility/tst_accessibility.cpp
@@ -100,7 +100,7 @@ void tst_accessibility::a11y_data()
QTest::newRow("StackView") << "stackview" << QAccessible::LayeredPane << "";
QTest::newRow("SwipeDelegate") << "swipedelegate" << QAccessible::ListItem << "SwipeDelegate";
QTest::newRow("SwipeView") << "swipeview" << QAccessible::PageTabList << "";
- QTest::newRow("Switch") << "switch" << QAccessible::Button << "Switch";
+ QTest::newRow("Switch") << "switch" << QAccessible::CheckBox << "Switch";
QTest::newRow("SwitchDelegate") << "switchdelegate" << QAccessible::ListItem << "SwitchDelegate";
QTest::newRow("TabBar") << "tabbar" << QAccessible::PageTabList << "";
QTest::newRow("TabButton") << "tabbutton" << QAccessible::PageTab << "TabButton";