diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-05-23 13:53:11 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-06-16 16:44:37 +0200 |
commit | 261e34fdffcf10ba7ec67325b50a8df4fe1d81f5 (patch) | |
tree | e3acdbc8a730ef08872b1b4f20a4156f17bddf59 /src/quick/items/qquickaccessibleattached.cpp | |
parent | 7fde8a8d20da7fa00d974286fa903b3fee76d466 (diff) |
Introduce Accessible.ignored
Task-number: QTBUG-39163
Change-Id: Ic09573408c460c64503cf1c4d6fff3754e92a223
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'src/quick/items/qquickaccessibleattached.cpp')
-rw-r--r-- | src/quick/items/qquickaccessibleattached.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp index 16f684ce77..94b2ae533f 100644 --- a/src/quick/items/qquickaccessibleattached.cpp +++ b/src/quick/items/qquickaccessibleattached.cpp @@ -187,6 +187,33 @@ QT_BEGIN_NAMESPACE By default this property is \c false. */ +/*! \qmlproperty bool QtQuick::Accessible::ignored + \brief This property holds whether this item should be ignored by the accessibility framework. + + Sometimes an item is part of a group of items that should be treated as one. For example two labels might be + visually placed next to each other, but separate items. For accessibility purposes they should be treated as one + and thus they are represented by a third invisible item with the right geometry. + + For example a speed display adds "m/s" as a smaller label: + \qml + Row { + Label { + id: speedLabel + text: "Speed: 5" + Accessible.ignored: true + } + Label { + text: qsTr("m/s") + Accessible.ignored: true + } + Accessible.role: Accessible.StaticText + Accessible.name: speedLabel.text + " meters per second" + } + \endqml + + \since 5.4 + By default this property is \c false. +*/ /*! \qmlproperty bool QtQuick::Accessible::multiLine \brief This property holds whether this item has multiple text lines. @@ -268,6 +295,19 @@ QQuickAccessibleAttached *QQuickAccessibleAttached::qmlAttachedProperties(QObjec return new QQuickAccessibleAttached(obj); } +bool QQuickAccessibleAttached::ignored() const +{ + return !item()->d_func()->isAccessible; +} + +void QQuickAccessibleAttached::setIgnored(bool ignored) +{ + if (m_ignored != ignored) { + item()->d_func()->isAccessible = !ignored; + emit ignoredChanged(); + } +} + QT_END_NAMESPACE #endif |