Remove all references to QAccessible:: {Child|Ancestor|Sibling}
authorJan-Arve Saether <jan-arve.saether@nokia.com>
Thu, 5 Jan 2012 13:37:29 +0000 (14:37 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 5 Jan 2012 15:31:56 +0000 (16:31 +0100)
These are deprecated in favor of
QAccessibleInterface::child() and QAccessibleInterface::parent()

QAccessible::Sibling can be done with a combination of those two.
This is handled by the bridge

Change-Id: Ie63d74314189d9e0f24f1152a2f0030d9e865b75
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp
src/plugins/accessible/qtquick1/qaccessibledeclarativeview.cpp
src/plugins/accessible/qtquick1/qaccessibledeclarativeview.h
src/plugins/accessible/quick/qaccessiblequickitem.cpp
src/plugins/accessible/quick/qaccessiblequickview.cpp

index 2d4572a..6e4f27a 100644 (file)
@@ -129,50 +129,6 @@ int QAccessibleDeclarativeItem::navigate(QAccessible::RelationFlag rel, int entr
     }
 
     switch (rel) {
-    case QAccessible::Child: {
-        QList<QGraphicsItem *> children = m_item->childItems();
-        const int childIndex = entry - 1;
-
-        if (childIndex >= children.count())
-            return -1;
-
-        QGraphicsItem *child = children.at(childIndex);
-        QGraphicsObject *childObject = qobject_cast<QGraphicsObject *>(child);
-        if (!childObject)
-            return -1;
-
-        *target = new QAccessibleDeclarativeItem(childObject, m_view);
-        return 0;
-        break;}
-    case QAccessible::Ancestor: {
-        Q_ASSERT(entry >= 1);
-        QGraphicsItem *parent = m_item->parentItem();
-        QGraphicsObject *parentObj = parent ? parent->toGraphicsObject() : 0;
-        if (parent && !parentObj)
-            qWarning("Can not make QGraphicsItems accessible");
-        QAccessibleInterface *ancestor = (parentObj
-                 ? new QAccessibleDeclarativeItem(parentObj, m_view)
-                 : QAccessible::queryAccessibleInterface(m_view));
-        if (entry == 1) {
-            *target = ancestor;
-            return 0;
-        } else if (entry > 1) {
-            int ret = ancestor->navigate(QAccessible::Ancestor, entry - 1, target);
-            delete ancestor;
-            return ret;
-        }
-        break;}
-    case QAccessible::Sibling: {
-        QAccessibleInterface *iface = 0;
-        if (navigate(QAccessible::Ancestor, 1, &iface) == 0) {
-            if (iface) {
-                int ret = iface->navigate(QAccessible::Child, entry, target);
-                delete iface;
-                return ret;
-            }
-        }
-        return -1;
-        break;}
     case QAccessible::FocusChild: {
         QGraphicsObject *focusObject = 0;
         if (m_item->hasFocus()) {
@@ -194,7 +150,6 @@ int QAccessibleDeclarativeItem::navigate(QAccessible::RelationFlag rel, int entr
     }
 
     return -1;
-
 }
 
 int QAccessibleDeclarativeItem::indexOfChild(const QAccessibleInterface *iface) const
index 50e7271..25034a2 100644 (file)
@@ -68,17 +68,10 @@ QAccessibleInterface *QAccessibleDeclarativeView::child(int index) const
     return 0;
 }
 
-int QAccessibleDeclarativeView::navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const
-{
-    if (rel == QAccessible::Child) {
-        *target = child(entry - 1);
-        return *target ? 0 : -1;
-    }
-    return QAccessibleWidget::navigate(rel, entry, target);
-}
-
 QAccessibleInterface *QAccessibleDeclarativeView::childAt(int x, int y) const
 {
+    Q_UNUSED(x);
+    Q_UNUSED(y);
     return child(0); // return the top-level QML item
 }
 
index e230784..a77a49d 100644 (file)
@@ -60,7 +60,6 @@ public:
 
     QAccessibleInterface *child(int index) const;
     int childCount() const;
-    int navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const;
     QAccessibleInterface *childAt(int x, int y) const;
     int indexOfChild(const QAccessibleInterface *iface) const;
 
index c502a8a..49b51f2 100644 (file)
@@ -141,55 +141,14 @@ QAccessibleInterface *QAccessibleQuickItem::child(int index) const
 
 int QAccessibleQuickItem::navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const
 {
+    Q_UNUSED(rel);
+    Q_UNUSED(entry);
+    Q_UNUSED(target);
     *target = 0;
     if (entry == 0) {
         *target = new QAccessibleQuickItem(m_item);
         return 0;
     }
-
-    switch (rel) {
-    case QAccessible::Child: { // FIMXE
-        QList<QQuickItem *> children = childItems();
-        const int childIndex = entry - 1;
-
-        if (childIndex >= children.count())
-            return -1;
-
-        QQuickItem *child = children.at(childIndex);
-        if (!child)
-            return -1;
-
-        *target = new QAccessibleQuickItem(child);
-        return 0;
-        break;}
-    case QAccessible::Ancestor: { // FIMXE
-        QQuickItem *parent = m_item->parentItem();
-        if (parent) {
-            QDeclarativeAccessible *ancestor = new QAccessibleQuickItem(parent);
-            if (entry == 1) {
-                QQuickCanvas *canvas = m_item->canvas();
-                // Jump out to the scene widget if the parent is the root item.
-                // There are two root items, QQuickCanvas::rootItem and
-                // QQuickView::declarativeRoot. The former is the true root item,
-                // but is not a part of the accessibility tree. Check if we hit
-                // it here and return an interface for the scene instead.
-                if (parent == canvas->rootItem()) {
-                    *target = QAccessible::queryAccessibleInterface(canvas);
-                } else {
-                    *target = ancestor;
-                }
-                return 0;
-            } else if (entry > 1) {
-                int ret = ancestor->navigate(QAccessible::Ancestor, entry - 1, target);
-                delete ancestor;
-                return ret;
-            }
-        }
-        return -1;
-    break;}
-    default: break;
-    }
-
     return -1;
 }
 
index 55943c9..65e7e18 100644 (file)
@@ -93,15 +93,10 @@ QRect QAccessibleQuickView::rect() const
 
 int QAccessibleQuickView::navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const
 {
-    switch (rel) {
-    case QAccessible::Child:
-        *target = child(entry - 1);
-    case QAccessible::Ancestor:
-        *target = parent();
-    default:
-        *target = 0;
-    }
-    return *target ? 0 : -1;
+    Q_UNUSED(rel);
+    Q_UNUSED(entry);
+    Q_UNUSED(target);
+    return -1;
 }
 
 QString QAccessibleQuickView::text(QAccessible::Text text) const