Move QTreeView::accessibleTree2Index to the private class

It's not needed to expose that symbol.

Change-Id: I65b752a41d80eb0779969fa3887c081b4c2c88db
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
This commit is contained in:
Giuseppe D'Angelo 2013-11-08 12:41:20 +01:00 committed by The Qt Project
parent 5f5c879832
commit 5dc8ab409f
3 changed files with 17 additions and 11 deletions

View File

@ -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"

View File

@ -224,7 +224,6 @@ private:
friend class QAccessibleTree;
friend class QAccessibleTableCell;
int visualIndex(const QModelIndex &index) const;
int accessibleTree2Index(const QModelIndex &index) const;
Q_DECLARE_PRIVATE(QTreeView)
Q_DISABLE_COPY(QTreeView)

View File

@ -239,6 +239,8 @@ public:
return (viewIndex(index) + (header ? 1 : 0)) * model->columnCount()+index.column();
}
int accessibleTree2Index(const QModelIndex &index) const;
// used for spanning rows
QVector<QPersistentModelIndex> spanningIndexes;