diff options
author | Piotr Mikolajczyk <piotr.mikolajczyk@qt.io> | 2020-11-20 15:07:59 +0100 |
---|---|---|
committer | Piotr Mikolajczyk <piotr.mikolajczyk@qt.io> | 2020-12-08 10:02:34 +0100 |
commit | fd20bc2277f98b86bddbd3f8a0ca92457a8c7c70 (patch) | |
tree | 69939f53963fb5a8ca42c85dac20dbdc28f89fa9 /src/widgets | |
parent | 4a85160e0bcfef04ed186d3fe264566d6313727c (diff) |
Android: Qml accessibility fixes
- Accessibility focus can follow the position of the widget
(for example when swiping on a scrollview)
- controls are clickable directly after appearing on the screen after
scroll (previously you had to click somewhere else on the screen,
and after that you could focus the newly appeared control)
- checkbox and switch react correctly on click action
- fixed combobox behavior with accessibility enabled
Task-number: QTBUG-79611
Pick-to: 6.0 5.15
Change-Id: If36914ab0165f33593e68fd7ecf168693f8538a7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/accessible/complexwidgets.cpp | 15 | ||||
-rw-r--r-- | src/widgets/accessible/itemviews.cpp | 17 |
2 files changed, 30 insertions, 2 deletions
diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index 42074b63fb..ab543a79df 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -400,9 +400,24 @@ void QAccessibleComboBox::doAction(const QString &actionName) { if (actionName == showMenuAction() || actionName == pressAction()) { if (comboBox()->view()->isVisible()) { +#if defined(Q_OS_ANDROID) + const auto list = child(0)->tableInterface(); + if (list && list->selectedRowCount() > 0) { + comboBox()->setCurrentIndex(list->selectedRows().at(0)); + } + comboBox()->setFocus(); +#endif comboBox()->hidePopup(); } else { comboBox()->showPopup(); +#if defined(Q_OS_ANDROID) + const auto list = child(0)->tableInterface(); + if (list && list->selectedRowCount() > 0) { + auto selectedCells = list->selectedCells(); + QAccessibleEvent ev(selectedCells.at(0),QAccessible::Focus); + QAccessible::updateAccessibility(&ev); + } +#endif } } } diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp index 677e56806a..a7b536ae54 100644 --- a/src/widgets/accessible/itemviews.cpp +++ b/src/widgets/accessible/itemviews.cpp @@ -934,10 +934,23 @@ QStringList QAccessibleTableCell::actionNames() const void QAccessibleTableCell::doAction(const QString& actionName) { if (actionName == toggleAction()) { - if (isSelected()) +#if defined(Q_OS_ANDROID) + QAccessibleInterface *parentInterface = parent(); + while (parentInterface){ + if (parentInterface->role() == QAccessible::ComboBox) { + selectCell(); + parentInterface->actionInterface()->doAction(pressAction()); + return; + } else { + parentInterface = parentInterface->parent(); + } + } +#endif + if (isSelected()) { unselectCell(); - else + } else { selectCell(); + } } } |