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>
This commit is contained in:
Jan Arve Saether 2013-09-20 10:54:59 +02:00 committed by The Qt Project
parent 0d9489e7aa
commit 03520d7fde
2 changed files with 11 additions and 2 deletions

View File

@ -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;
}

View File

@ -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);