summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qtreeview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/itemviews/qtreeview.cpp')
-rw-r--r--src/widgets/itemviews/qtreeview.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 792b75ac69..fc0d639483 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -3888,6 +3888,14 @@ void QTreeViewPrivate::_q_sortIndicatorChanged(int column, Qt::SortOrder order)
model->sort(column, order);
}
+int QTreeViewPrivate::accessibleTree2Index(const QModelIndex &index) const
+{
+ Q_Q(const QTreeView);
+
+ // Note that this will include the header, even if its hidden.
+ return (q->visualIndex(index) + (q->header() ? 1 : 0)) * index.model()->columnCount() + index.column();
+}
+
/*!
\reimp
*/
@@ -3911,8 +3919,10 @@ void QTreeView::currentChanged(const QModelIndex &current, const QModelIndex &pr
}
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive() && current.isValid()) {
+ Q_D(QTreeView);
+
QAccessibleEvent event(this, QAccessible::Focus);
- event.setChild(accessibleTree2Index(current));
+ event.setChild(d->accessibleTree2Index(current));
QAccessible::updateAccessibility(&event);
}
#endif
@@ -3927,10 +3937,12 @@ void QTreeView::selectionChanged(const QItemSelection &selected,
QAbstractItemView::selectionChanged(selected, deselected);
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) {
+ Q_D(QTreeView);
+
// ### does not work properly for selection ranges.
QModelIndex sel = selected.indexes().value(0);
if (sel.isValid()) {
- int entry = accessibleTree2Index(sel);
+ int entry = d->accessibleTree2Index(sel);
Q_ASSERT(entry >= 0);
QAccessibleEvent event(this, QAccessible::Selection);
event.setChild(entry);
@@ -3938,7 +3950,7 @@ void QTreeView::selectionChanged(const QItemSelection &selected,
}
QModelIndex desel = deselected.indexes().value(0);
if (desel.isValid()) {
- int entry = accessibleTree2Index(desel);
+ int entry = d->accessibleTree2Index(desel);
Q_ASSERT(entry >= 0);
QAccessibleEvent event(this, QAccessible::SelectionRemove);
event.setChild(entry);
@@ -3955,13 +3967,6 @@ int QTreeView::visualIndex(const QModelIndex &index) const
return d->viewIndex(index);
}
-int QTreeView::accessibleTree2Index(const QModelIndex &index) const
-{
- // Note that this will include the header, even if its hidden.
- return (visualIndex(index) + (header() ? 1 : 0)) * index.model()->columnCount() + index.column();
-}
-
-
QT_END_NAMESPACE
#include "moc_qtreeview.cpp"