diff options
author | Jan Arve Saether <jan-arve.saether@digia.com> | 2014-09-25 11:41:44 +0200 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@theqtcompany.com> | 2014-10-21 20:32:52 +0200 |
commit | f28755240b9d72eb748c2f9469a58601bffdecf1 (patch) | |
tree | 6833b7e166be3480662e31ebe3da0f3e9daaa13d /src/quick/accessible | |
parent | dbbb514a084440c05d17e44c7992726d94b26750 (diff) |
Support Accessible.ignored on non-leaf items
Ignoring items with children will make the children appear as children of
the parent of the ignored item.
Since setAccessibleFlagAndListener now only sets the flag we also rename
the function to just setAccessible
Change-Id: I79fc311509a3e454b4698274c63ad0e879fb93e3
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Diffstat (limited to 'src/quick/accessible')
-rw-r--r-- | src/quick/accessible/qaccessiblequickitem.cpp | 21 | ||||
-rw-r--r-- | src/quick/accessible/qaccessiblequickitem_p.h | 1 |
2 files changed, 15 insertions, 7 deletions
diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp index fe01326bbc..3f023ae621 100644 --- a/src/quick/accessible/qaccessiblequickitem.cpp +++ b/src/quick/accessible/qaccessiblequickitem.cpp @@ -108,7 +108,7 @@ QAccessibleInterface *QAccessibleQuickItem::parent() const QQuickItem *parent = item()->parentItem(); QQuickWindow *window = item()->window(); QQuickItem *ci = window ? window->contentItem() : 0; - while (parent && parent != ci) + while (parent && !QQuickItemPrivate::get(parent)->isAccessible && parent != ci) parent = parent->parentItem(); if (parent) { @@ -120,6 +120,8 @@ QAccessibleInterface *QAccessibleQuickItem::parent() const // it here and return an interface for the scene instead. return QAccessible::queryAccessibleInterface(window); } else { + while (parent && !parent->d_func()->isAccessible) + parent = parent->parentItem(); return QAccessible::queryAccessibleInterface(parent); } } @@ -146,16 +148,23 @@ int QAccessibleQuickItem::indexOfChild(const QAccessibleInterface *iface) const return kids.indexOf(static_cast<QQuickItem*>(iface->object())); } -QList<QQuickItem *> accessibleUnignoredChildren(QQuickItem *item, bool paintOrder) +static void unignoredChildren(QQuickItem *item, QList<QQuickItem *> *items, bool paintOrder) { - QList<QQuickItem *> items; QList<QQuickItem*> childItems = paintOrder ? QQuickItemPrivate::get(item)->paintOrderChildItems() : item->childItems(); Q_FOREACH (QQuickItem *child, childItems) { - QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(child); - if (itemPrivate->isAccessible) - items.append(child); + if (QQuickItemPrivate::get(child)->isAccessible) { + items->append(child); + } else { + unignoredChildren(child, items, paintOrder); + } } +} + +QList<QQuickItem *> accessibleUnignoredChildren(QQuickItem *item, bool paintOrder) +{ + QList<QQuickItem *> items; + unignoredChildren(item, &items, paintOrder); return items; } diff --git a/src/quick/accessible/qaccessiblequickitem_p.h b/src/quick/accessible/qaccessiblequickitem_p.h index 84e82fff86..e8486721f3 100644 --- a/src/quick/accessible/qaccessiblequickitem_p.h +++ b/src/quick/accessible/qaccessiblequickitem_p.h @@ -121,7 +121,6 @@ private: QRect itemScreenRect(QQuickItem *item); QList<QQuickItem *> accessibleUnignoredChildren(QQuickItem *item, bool paintOrder = false); - #endif // QT_NO_ACCESSIBILITY QT_END_NAMESPACE |