summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/androidjniaccessibility.cpp
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-04-20 13:59:16 +0200
committerIvan Solovev <ivan.solovev@qt.io>2022-04-21 22:25:13 +0200
commit37746d2f710957923427b25c028910d12860e008 (patch)
tree1d8237c86c8c70a3d65f10ffb845931fa07a7293 /src/plugins/platforms/android/androidjniaccessibility.cpp
parent9eb090d6835e436627c7a6b00e2ee97933847345 (diff)
Android: fix A11Y object description
This patch amends a374d59abc415eee1866322176b7762158f48abd. That commit introduced refactoring of A11Y object description announcements that also took a value into account. However for the elements without values (like QPushButton), an unused space is added at the end of the description. This patch fixes the issue by explicitly checking that the value interface exists and that the value string is not empty. Fixes: QTBUG-102744 Pick-to: 6.3 6.2 5.15 Change-Id: Ic1ba50859fb91c871c242189967dcce35723a0b2 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Diffstat (limited to 'src/plugins/platforms/android/androidjniaccessibility.cpp')
-rw-r--r--src/plugins/platforms/android/androidjniaccessibility.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp
index e00db7b8ef..db40aaa54c 100644
--- a/src/plugins/platforms/android/androidjniaccessibility.cpp
+++ b/src/plugins/platforms/android/androidjniaccessibility.cpp
@@ -433,10 +433,13 @@ if (!clazz) { \
desc = iface->text(QAccessible::Value);
hasValue = !desc.isEmpty();
}
- if (!hasValue) {
- if (!desc.isEmpty())
- desc.append(QChar(QChar::Space));
- desc.append(textFromValue(iface));
+ if (!hasValue && iface->valueInterface()) {
+ const QString valueStr = textFromValue(iface);
+ if (!valueStr.isEmpty()) {
+ if (!desc.isEmpty())
+ desc.append(QChar(QChar::Space));
+ desc.append(valueStr);
+ }
}
}
return desc;