diff options
author | Jan Arve Sæther <jan-arve.saether@qt.io> | 2019-05-07 14:58:29 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2019-05-09 06:56:35 +0000 |
commit | d12cc4f6b58ecb5f44458002fe9b74d0c84f10ae (patch) | |
tree | 51fa3c077c26c2aad1571673c8d24365d5336e16 /src/quick/items/qquickaccessibleattached_p.h | |
parent | 4a4842118d2303a8d851d1d8b85fe182d3fe492a (diff) |
Don't overwrite states if role is assigned after a state
We therefore need to keep track of which states have been explicitly set
or not in order to know which ones should get initialized with their
defaults.
Change-Id: I49fdae82288f04ea4f50d45735a93434ac02abec
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'src/quick/items/qquickaccessibleattached_p.h')
-rw-r--r-- | src/quick/items/qquickaccessibleattached_p.h | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h index e292c280df..f4194ef13d 100644 --- a/src/quick/items/qquickaccessibleattached_p.h +++ b/src/quick/items/qquickaccessibleattached_p.h @@ -69,6 +69,7 @@ QT_BEGIN_NAMESPACE bool P() const { return m_state.P ; } \ void set_ ## P(bool arg) \ { \ + m_stateExplicitlySet.P = true; \ if (m_state.P == arg) \ return; \ m_state.P = arg; \ @@ -111,41 +112,7 @@ public: ~QQuickAccessibleAttached(); QAccessible::Role role() const { return m_role; } - void setRole(QAccessible::Role role) - { - if (role != m_role) { - m_role = role; - Q_EMIT roleChanged(); - // There is no way to signify role changes at the moment. - // QAccessible::updateAccessibility(parent(), 0, QAccessible::); - - switch (role) { - case QAccessible::CheckBox: - case QAccessible::RadioButton: - m_state.focusable = true; - m_state.checkable = true; - break; - case QAccessible::Button: - case QAccessible::MenuItem: - case QAccessible::PageTab: - 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; - } - } - } + void setRole(QAccessible::Role role); QString name() const { if (m_state.passwordEdit) return QString(); @@ -247,6 +214,7 @@ private: QAccessible::Role m_role; QAccessible::State m_state; + QAccessible::State m_stateExplicitlySet; QString m_name; QString m_description; |