aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/accessible/qaccessiblequickitem.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@qt.io>2019-05-06 16:03:37 +0200
committerJan Arve Sæther <jan-arve.saether@qt.io>2019-05-07 12:53:25 +0000
commit4a4842118d2303a8d851d1d8b85fe182d3fe492a (patch)
treed6730afb592bd109ee63e112e120c5f82d10bce6 /src/quick/accessible/qaccessiblequickitem.cpp
parent3df85008591dffc64427095b022421469cb9a866 (diff)
Accessibility: Make sure StaticText is marked read-only
Test more of the text properties. This is still very incomplete, but a small step forward. Also make sure that editable text reports the editable state. Fixes: QTBUG-75002 Change-Id: I9e43c980d8fa91671acb4e40e5d9162854884ee7 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/accessible/qaccessiblequickitem.cpp')
-rw-r--r--src/quick/accessible/qaccessiblequickitem.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp
index 98e7663c96..b87203c3ef 100644
--- a/src/quick/accessible/qaccessiblequickitem.cpp
+++ b/src/quick/accessible/qaccessiblequickitem.cpp
@@ -382,6 +382,22 @@ QString QAccessibleQuickItem::text(QAccessible::Text textType) const
return QString();
}
+void QAccessibleQuickItem::setText(QAccessible::Text textType, const QString &text)
+{
+ if (role() != QAccessible::EditableText)
+ return;
+ if (textType != QAccessible::Value)
+ return;
+
+ if (QTextDocument *doc = textDocument()) {
+ doc->setPlainText(text);
+ return;
+ }
+ auto textPropertyName = "text";
+ if (object()->metaObject()->indexOfProperty(textPropertyName) >= 0)
+ object()->setProperty(textPropertyName, text);
+}
+
void *QAccessibleQuickItem::interface_cast(QAccessible::InterfaceType t)
{
QAccessible::Role r = role();