From ee9c5f72d3f48e2d2d3829f39d7accc3513110ab Mon Sep 17 00:00:00 2001 From: Jan-Arve Saether Date: Mon, 30 Jan 2012 14:57:22 +0100 Subject: [PATCH] Remove QAccessible::FocusChild, add focusChild() Change-Id: Idc96d91ec31630b4240fe473ed3b4bf0a4753618 Reviewed-by: Frederik Gladhorn --- .../qtquick1/qaccessibledeclarativeitem.cpp | 39 +++++++++------------- .../qtquick1/qaccessibledeclarativeitem.h | 2 ++ 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp b/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp index 82bc017..6748e26 100644 --- a/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp +++ b/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp @@ -119,37 +119,30 @@ QAccessibleInterface *QAccessibleDeclarativeItem::child(int index) const int QAccessibleDeclarativeItem::navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const { - //qDebug() << "QAccessibleDeclarativeItem navigate" << rel << entry; - Q_ASSERT(entry >= 0); - + Q_UNUSED(rel); + Q_UNUSED(entry); *target = 0; - if (entry == 0) { - *target = new QAccessibleDeclarativeItem(m_item->toGraphicsObject(), m_view); - return 0; - } + return -1; +} - switch (rel) { - case QAccessible::FocusChild: { - QGraphicsObject *focusObject = 0; - if (m_item->hasFocus()) { - focusObject = m_item->toGraphicsObject(); - } else { - if (QGraphicsItem *focusItem = m_view->scene()->focusItem()) { +/*! \reimp */ +QAccessibleInterface *QAccessibleDeclarativeItem::focusChild() const +{ + QGraphicsObject *focusObject = 0; + if (m_item->hasFocus()) { + focusObject = m_item->toGraphicsObject(); + } else { + if (QGraphicsScene *scene = m_view->scene()) { + if (QGraphicsItem *focusItem = scene->focusItem()) { if (m_item->isAncestorOf(focusItem)) { focusObject = focusItem->toGraphicsObject(); } } } - //qDebug() << "QAccessibleDeclarativeItem navigate QAccessible::FocusChild" << rel << entry; - if (focusObject) { - *target = new QAccessibleDeclarativeItem(focusObject, m_view); - return 0; - } - } - default: break; } - - return -1; + if (focusObject) + return new QAccessibleDeclarativeItem(focusObject, m_view); //###queryAccessibleInterface? + return 0; } int QAccessibleDeclarativeItem::indexOfChild(const QAccessibleInterface *iface) const diff --git a/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.h b/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.h index 99536d6..45bf6f9 100644 --- a/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.h +++ b/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.h @@ -59,6 +59,8 @@ public: bool clipsChildren() const; + QAccessibleInterface *focusChild() const; + QAccessibleInterface *parent() const; QAccessibleInterface *child(int index) const; int childCount() const; -- 2.7.4