summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@digia.com>2013-04-25 15:11:47 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-25 17:56:26 +0200
commitb9db3e4785d965905549d2033e0707922c8b74b5 (patch)
treee787bc557213820f1c50156d0b70bdf029318db6
parent2e0575ce89809ad782440b7b868fbf2a8ad6852a (diff)
Do not include the treeview header if its hidden
Previously, accessibleTree->child(0) would return an interface for the header even if it was hidden. Also, the assertion was wrong since the index would be 0 if both row and column were 0. The assertion was actually found while using the project explorer of Qt Creator (2.7) Change-Id: I9f3cc2c13b6887569d10c4e062a64552f898231a Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
-rw-r--r--src/plugins/accessible/widgets/itemviews.cpp3
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp6
2 files changed, 8 insertions, 1 deletions
diff --git a/src/plugins/accessible/widgets/itemviews.cpp b/src/plugins/accessible/widgets/itemviews.cpp
index 4ddd39f7ea..d460ec2c98 100644
--- a/src/plugins/accessible/widgets/itemviews.cpp
+++ b/src/plugins/accessible/widgets/itemviews.cpp
@@ -120,6 +120,8 @@ QHeaderView *QAccessibleTable::horizontalHeader() const
#ifndef QT_NO_TREEVIEW
} else if (const QTreeView *tv = qobject_cast<const QTreeView*>(view())) {
header = tv->header();
+ if (header && header->isHidden())
+ header = 0;
#endif
}
return header;
@@ -766,7 +768,6 @@ int QAccessibleTree::indexOfChild(const QAccessibleInterface *iface) const
int column = cell->m_index.column();
int index = row * view()->model()->columnCount() + column;
- Q_ASSERT(index >= treeView->model()->columnCount());
return index;
} else if (iface->role() == QAccessible::ColumnHeader){
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index af8e4472ed..557189f4e2 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -2600,6 +2600,12 @@ void tst_QAccessibility::treeTest()
QCOMPARE(iface->indexOfChild(child2), 4);
QCOMPARE(child2->text(QAccessible::Name), QString("Austria"));
+ treeView->setHeaderHidden(true);
+ QAccessibleInterface *accSpain = iface->child(0);
+ QCOMPARE(accSpain->role(), QAccessible::TreeItem);
+ QCOMPARE(iface->indexOfChild(accSpain), 0);
+ treeView->setHeaderHidden(false);
+
QTestAccessibility::clearEvents();
// table 2