summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@digia.com>2013-09-20 10:54:59 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-20 21:54:44 +0200
commit03520d7fde2f6dced73c69744ab0bc1d3b166862 (patch)
treeb9b4d033980a7de99e8c814cb7b9a1f2dabec52b
parent0d9489e7aa01641d6b76e1b8b769ccdcb3bb81a0 (diff)
Add missing implementation in QAccessibleTabBar::indexOfChild
This avoids the assertion in iaccessible2.cpp(510) Change-Id: I1a4c007ffcbcda70f0e37ef3cf55a303683b58c1 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
-rw-r--r--src/plugins/accessible/widgets/complexwidgets.cpp12
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp1
2 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/accessible/widgets/complexwidgets.cpp b/src/plugins/accessible/widgets/complexwidgets.cpp
index 819ef6923f..9988e73da1 100644
--- a/src/plugins/accessible/widgets/complexwidgets.cpp
+++ b/src/plugins/accessible/widgets/complexwidgets.cpp
@@ -138,9 +138,12 @@ public:
return QStringList();
}
+ int index() const { return m_index; }
+
private:
QPointer<QTabBar> m_parent;
int m_index;
+
};
/*!
@@ -190,12 +193,17 @@ QAccessibleInterface* QAccessibleTabBar::child(int index) const
int QAccessibleTabBar::indexOfChild(const QAccessibleInterface *child) const
{
- // FIXME this looks broken
-
if (child->object() && child->object() == tabBar()->d_func()->leftB)
return tabBar()->count();
if (child->object() && child->object() == tabBar()->d_func()->rightB)
return tabBar()->count() + 1;
+ if (child->role() == QAccessible::PageTab) {
+ QAccessibleInterface *parent = child->parent();
+ if (parent == this) {
+ const QAccessibleTabButton *tabButton = static_cast<const QAccessibleTabButton *>(child);
+ return tabButton->index();
+ }
+ }
return -1;
}
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index bd95f89e88..b03aafcf0d 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -1243,6 +1243,7 @@ void tst_QAccessibility::tabWidgetTest()
QAccessibleInterface* tabBarInterface = 0;
// there is no special logic to sort the children, so the contents will be 1, the tab bar 2
tabBarInterface = interface->child(1);
+ QCOMPARE(verifyHierarchy(tabBarInterface), 0);
QVERIFY(tabBarInterface);
QCOMPARE(tabBarInterface->childCount(), 4);
QCOMPARE(tabBarInterface->role(), QAccessible::PageTabList);