From: Jan-Arve Saether Date: Thu, 5 Jan 2012 13:37:29 +0000 (+0100) Subject: Remove all references to QAccessible:: {Child|Ancestor|Sibling} X-Git-Tag: qt-v5.0.0-alpha1~741 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c831c9f5166982d86f6cd82ed438df7cc9b3f8e3;p=profile%2Fivi%2Fqtdeclarative.git Remove all references to QAccessible:: {Child|Ancestor|Sibling} 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 --- diff --git a/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp b/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp index 2d4572a..6e4f27a 100644 --- a/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp +++ b/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp @@ -129,50 +129,6 @@ int QAccessibleDeclarativeItem::navigate(QAccessible::RelationFlag rel, int entr } switch (rel) { - case QAccessible::Child: { - QList children = m_item->childItems(); - const int childIndex = entry - 1; - - if (childIndex >= children.count()) - return -1; - - QGraphicsItem *child = children.at(childIndex); - QGraphicsObject *childObject = qobject_cast(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 diff --git a/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.cpp b/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.cpp index 50e7271..25034a2 100644 --- a/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.cpp +++ b/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.cpp @@ -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 } diff --git a/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.h b/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.h index e230784..a77a49d 100644 --- a/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.h +++ b/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.h @@ -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; diff --git a/src/plugins/accessible/quick/qaccessiblequickitem.cpp b/src/plugins/accessible/quick/qaccessiblequickitem.cpp index c502a8a..49b51f2 100644 --- a/src/plugins/accessible/quick/qaccessiblequickitem.cpp +++ b/src/plugins/accessible/quick/qaccessiblequickitem.cpp @@ -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 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; } diff --git a/src/plugins/accessible/quick/qaccessiblequickview.cpp b/src/plugins/accessible/quick/qaccessiblequickview.cpp index 55943c9..65e7e18 100644 --- a/src/plugins/accessible/quick/qaccessiblequickview.cpp +++ b/src/plugins/accessible/quick/qaccessiblequickview.cpp @@ -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