Use queryAccessibleInterface instead of new QAccessibleQuickItem
authorJan-Arve Saether <jan-arve.saether@nokia.com>
Thu, 19 Jan 2012 11:01:55 +0000 (12:01 +0100)
committerQt by Nokia <qt-info@nokia.com>
Fri, 20 Jan 2012 10:04:17 +0000 (11:04 +0100)
In some cases this could prevent us from actually returning the
expected QAccessibleQuickItemValueInterface.
This is also more future-proof in case we add more QAI subclasses.

Change-Id: Id66dc21418671a3045d93c0a44dc74aa0aff30af
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
src/plugins/accessible/quick/qaccessiblequickitem.cpp

index fd087c4..b2c1098 100644 (file)
@@ -98,8 +98,7 @@ QAccessibleInterface *QAccessibleQuickItem::parent() const
         if (parent == canvas->rootItem()) {
             return QAccessible::queryAccessibleInterface(canvas);
         } else {
-            QDeclarativeAccessible *ancestor = new QAccessibleQuickItem(parent);
-            return ancestor;
+            return QAccessible::queryAccessibleInterface(parent);
         }
     }
     return 0;
@@ -116,7 +115,7 @@ QAccessibleInterface *QAccessibleQuickItem::child(int index) const
     if (!child) // FIXME can this happen?
         return 0;
 
-    return new QAccessibleQuickItem(child);
+    return QAccessible::queryAccessibleInterface(child);
 }
 
 int QAccessibleQuickItem::navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const
@@ -125,10 +124,6 @@ int QAccessibleQuickItem::navigate(QAccessible::RelationFlag rel, int entry, QAc
     Q_UNUSED(entry);
     Q_UNUSED(target);
     *target = 0;
-    if (entry == 0) {
-        *target = new QAccessibleQuickItem(item());
-        return 0;
-    }
     return -1;
 }