summaryrefslogtreecommitdiffstats
path: root/src/gui/accessible
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-10-13 16:07:49 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2023-11-15 01:17:00 +0200
commit56476947cfdc1b869b3a9bf1095c8665c35f7d4b (patch)
tree1799789d4dfc70bc10bc65cbcbc5a1646a8d3c81 /src/gui/accessible
parent6259f4e7b473eb091700cb91e66c6fcc5b4f01c1 (diff)
a11y atspi: Bridge IA2 strikeout text attrs to AT-SPI
When the text attributes an accessible interface reports include one of the various "text-line-through-*" IAccessible2 text attributes with a value that indicates that strikethrough is applied [1], bridge that to the AT-SPI layer via the "strikethrough" attribute with a value of "true". See also the ATK documentation [2] for the `ATK_TEXT_ATTR_STRIKETHROUGH` text attribute. This will not only be used by an upcoming change that implements reporting that for Qt's own text widgets, but is also needed for third-party applications. Change for LibreOffice that makes use of this: [3] [1] https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes [2] https://gnome.pages.gitlab.gnome.org/atk/AtkText.html#AtkTextAttribute [3] https://gerrit.libreoffice.org/c/core/+/157939 Task-number: QTBUG-118106 Change-Id: Ieb98584a3c6270d8db508d59994f9ba244e2bc64 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/gui/accessible')
-rw-r--r--src/gui/accessible/linux/atspiadaptor.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp
index 996523ccf4..6b4c80cf60 100644
--- a/src/gui/accessible/linux/atspiadaptor.cpp
+++ b/src/gui/accessible/linux/atspiadaptor.cpp
@@ -2222,6 +2222,13 @@ namespace
// (on which it produces traceback and fails to read any following text attributes),
// but that is the default value, so omit it anyway
value = QString();
+ } else if (((ia2Name == "text-line-through-style"_L1 || ia2Name == "text-line-through-type"_L1) && (ia2Value != "none"_L1))
+ || (ia2Name == "text-line-through-text"_L1 && !ia2Value.isEmpty())) {
+ // if any of the above is set, set "strikethrough" to true, but don't explicitly set
+ // to false otherwise, since any of the others might still be set to indicate strikethrough
+ // and no strikethrough is assumed anyway when nothing is explicitly set
+ name = QStringLiteral("strikethrough");
+ value = QStringLiteral("true");
} else if (ia2Name == "text-position"_L1) {
name = QStringLiteral("vertical-align");
if (value != "baseline"_L1 && value != "super"_L1 && value != "sub"_L1) {