aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/accessible/qaccessiblequickitem.cpp16
-rw-r--r--src/quick/accessible/qaccessiblequickitem_p.h1
-rw-r--r--src/quick/items/qquickaccessibleattached_p.h8
3 files changed, 24 insertions, 1 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();
diff --git a/src/quick/accessible/qaccessiblequickitem_p.h b/src/quick/accessible/qaccessiblequickitem_p.h
index 5375d37bf0..931e995f0f 100644
--- a/src/quick/accessible/qaccessiblequickitem_p.h
+++ b/src/quick/accessible/qaccessiblequickitem_p.h
@@ -83,6 +83,7 @@ public:
QAccessible::State state() const override;
QAccessible::Role role() const override;
QString text(QAccessible::Text) const override;
+ void setText(QAccessible::Text, const QString &text) override;
bool isAccessible() const;
diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h
index 215a1e5db6..e292c280df 100644
--- a/src/quick/items/qquickaccessibleattached_p.h
+++ b/src/quick/items/qquickaccessibleattached_p.h
@@ -128,13 +128,19 @@ public:
case QAccessible::Button:
case QAccessible::MenuItem:
case QAccessible::PageTab:
- case QAccessible::EditableText:
case QAccessible::SpinBox:
case QAccessible::ComboBox:
case QAccessible::Terminal:
case QAccessible::ScrollBar:
m_state.focusable = true;
break;
+ case QAccessible::EditableText:
+ m_state.editable = true;
+ m_state.focusable = true;
+ break;
+ case QAccessible::StaticText:
+ m_state.readOnly = true;
+ break;
default:
break;
}