summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-02-10 12:38:29 +0100
committerIvan Solovev <ivan.solovev@qt.io>2022-02-22 15:49:08 +0100
commite007d2f373d40899816661ee75e3dd6217e0527a (patch)
tree1679c454a85b1e319eeedb0f3d29a01cffa5ddb5 /src/plugins/platforms/android
parentf546e3e7c98f1aced03ebf1f467ac1a04c579824 (diff)
Android A11Y: Announce value together with element name when focused
Before this patch when we focus a new element, only its description was announced. For elements like Slider that means that if it had no accessible name or description, its value would be announced (all is fine here). But if the slider is defined like that: Slider { Accessible.name: "int slider" value: 5 from: 0 to: 20 stepSize: 1 } only the name ("int slider") will be announced, but not the actual value. This patch fixes the logic of content description generation. If the element has value, then it is added to the description and announced as well. Task-number: QTBUG-93396 Change-Id: Ia8667149ebd867945c5f57d951fd6ade0f382598 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit a374d59abc415eee1866322176b7762158f48abd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/plugins/platforms/android')
-rw-r--r--src/plugins/platforms/android/androidjniaccessibility.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp
index c306390a08..92160974e5 100644
--- a/src/plugins/platforms/android/androidjniaccessibility.cpp
+++ b/src/plugins/platforms/android/androidjniaccessibility.cpp
@@ -383,14 +383,18 @@ if (!clazz) { \
{
QString desc;
if (iface && iface->isValid()) {
+ bool hasValue = false;
desc = iface->text(QAccessible::Name);
if (desc.isEmpty())
desc = iface->text(QAccessible::Description);
if (desc.isEmpty()) {
desc = iface->text(QAccessible::Value);
- if (desc.isEmpty()) {
- desc = textFromValue(iface);
- }
+ hasValue = !desc.isEmpty();
+ }
+ if (!hasValue) {
+ if (!desc.isEmpty())
+ desc.append(QChar(QChar::Space));
+ desc.append(textFromValue(iface));
}
}
return desc;