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:
parent
0d9489e7aa
commit
03520d7fde
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user