diff options
author | Jan Arve Saether <jan-arve.saether@digia.com> | 2013-09-11 11:09:40 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-18 11:28:22 +0200 |
commit | e39d629ebe9044b505ac35eaae3ab9c214d452a2 (patch) | |
tree | 0e7ba800a55ccb29f791ad7e9653370a739bb306 /src/plugins/accessible/widgets/itemviews.cpp | |
parent | af61b7312e2701bc89bdb78d6a8d8984c59c673f (diff) |
Include hidden headers in trees and tables consistently
There was a disagreement between the a11y plugin and QTreeView
whether the horizontal header should have been exposed or not.
When the header was hidden, this resulted in that we sent an event
with a child id that was wrong, or in worst case higher than
QAI::childrenCount(). This was the reason we got the warning
output as described in the task.
With this commit, we consistently *expose* hidden headers both for
QTreeView and QTableView, but ensure that their state().invisible is
set to true instead.
This makes it consistent with how hidden cells are exposed.
This also fixes a bug in QTableViewPrivate::accessibleTable2Index
where we always added 1 to the index, which was spotted while
writing the test.
Task-number: QTBUG-33247
Change-Id: Ifd1f83d56296dd071424fdb81fce7628bc24fe0a
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'src/plugins/accessible/widgets/itemviews.cpp')
-rw-r--r-- | src/plugins/accessible/widgets/itemviews.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/plugins/accessible/widgets/itemviews.cpp b/src/plugins/accessible/widgets/itemviews.cpp index 86c7812553..9dcf815cce 100644 --- a/src/plugins/accessible/widgets/itemviews.cpp +++ b/src/plugins/accessible/widgets/itemviews.cpp @@ -120,8 +120,6 @@ 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; @@ -1123,7 +1121,12 @@ QAccessible::Role QAccessibleTableHeaderCell::role() const QAccessible::State QAccessibleTableHeaderCell::state() const { - return QAccessible::State(); + QAccessible::State s; + if (QHeaderView *h = headerView()) { + s.invisible = !h->testAttribute(Qt::WA_WState_Visible); + s.disabled = !h->isEnabled(); + } + return s; } QRect QAccessibleTableHeaderCell::rect() const @@ -1194,6 +1197,26 @@ QAccessibleInterface *QAccessibleTableHeaderCell::child(int) const return 0; } +QHeaderView *QAccessibleTableHeaderCell::headerView() const +{ + QHeaderView *header = 0; + if (false) { +#ifndef QT_NO_TABLEVIEW + } else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) { + if (orientation == Qt::Horizontal) { + header = tv->horizontalHeader(); + } else { + header = tv->verticalHeader(); + } +#endif +#ifndef QT_NO_TREEVIEW + } else if (const QTreeView *tv = qobject_cast<const QTreeView*>(view)) { + header = tv->header(); +#endif + } + return header; +} + #endif // QT_NO_ITEMVIEWS QT_END_NAMESPACE |