summaryrefslogtreecommitdiffstats
path: root/src/plugins/accessible
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@digia.com>2013-09-11 11:09:40 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-18 11:28:22 +0200
commite39d629ebe9044b505ac35eaae3ab9c214d452a2 (patch)
tree0e7ba800a55ccb29f791ad7e9653370a739bb306 /src/plugins/accessible
parentaf61b7312e2701bc89bdb78d6a8d8984c59c673f (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')
-rw-r--r--src/plugins/accessible/widgets/itemviews.cpp29
-rw-r--r--src/plugins/accessible/widgets/itemviews.h2
2 files changed, 28 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
diff --git a/src/plugins/accessible/widgets/itemviews.h b/src/plugins/accessible/widgets/itemviews.h
index 72b2339dd3..7692ce0e77 100644
--- a/src/plugins/accessible/widgets/itemviews.h
+++ b/src/plugins/accessible/widgets/itemviews.h
@@ -239,6 +239,8 @@ public:
QAccessibleInterface *child(int index) const;
private:
+ QHeaderView *headerView() const;
+
QPointer<QAbstractItemView> view;
int index;
Qt::Orientation orientation;