Accessibility: childAt_helper descends too far.
authorMorten Johan Sorvig <morten.sorvig@nokia.com>
Thu, 19 Jan 2012 07:02:09 +0000 (08:02 +0100)
committerQt by Nokia <qt-info@nokia.com>
Mon, 12 Mar 2012 20:20:31 +0000 (21:20 +0100)
Recursive hit-testing using childAt_helper must stop
when it hits a leaf accessibility item. This leaf item
might not be a leaf item in Qt Quick - a button contains
text and mouse area items not visible to the accessibility
system for example.

Get the accessible interface and check if it has
children before recursing to the child items.

Change-Id: I2cc286cde4bce6b4ca340e8a1819edc5f84006a5
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
src/plugins/accessible/quick/qaccessiblequickview.cpp

index 042d8dc..1823dfe 100644 (file)
@@ -119,6 +119,11 @@ static QQuickItem *childAt_helper(QQuickItem *item, int x, int y)
             return 0;
     }
 
+    QScopedPointer<QAccessibleInterface> accessibleInterface(QAccessible::queryAccessibleInterface(item));
+    if (accessibleInterface->childCount() == 0) {
+        return (itemScreenRect(item).contains(x, y)) ? item : 0;
+    }
+
     QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
 
     QList<QQuickItem *> children = itemPrivate->paintOrderChildItems();