summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);