Accessibility indexes are no longer 1-based.

The updates for focus/selection in QTreeView
were still adding +1 as it was required in Qt 4.

Task-number: QTBUG-28174

Change-Id: Ib9fea7e20d431a0ef0db18494e7bdda06a0646b0
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
Frederik Gladhorn 2012-12-17 14:52:33 +01:00 committed by The Qt Project
parent cdff53cda8
commit 01f1ef1185

View File

@ -3743,7 +3743,7 @@ void QTreeView::currentChanged(const QModelIndex &current, const QModelIndex &pr
}
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive() && current.isValid()) {
int entry = (visualIndex(current) + (header()?1:0))*current.model()->columnCount()+current.column() + 1;
int entry = (visualIndex(current) + (header()?1:0))*current.model()->columnCount()+current.column();
QAccessibleEvent event(this, QAccessible::Focus);
event.setChild(entry);
QAccessible::updateAccessibility(&event);
@ -3763,16 +3763,16 @@ void QTreeView::selectionChanged(const QItemSelection &selected,
// ### does not work properly for selection ranges.
QModelIndex sel = selected.indexes().value(0);
if (sel.isValid()) {
int entry = (visualIndex(sel) + (header()?1:0))*sel.model()->columnCount()+sel.column() + 1;
Q_ASSERT(entry > 0);
int entry = (visualIndex(sel) + (header()?1:0))*sel.model()->columnCount()+sel.column();
Q_ASSERT(entry >= 0);
QAccessibleEvent event(this, QAccessible::Selection);
event.setChild(entry);
QAccessible::updateAccessibility(&event);
}
QModelIndex desel = deselected.indexes().value(0);
if (desel.isValid()) {
int entry = (visualIndex(desel) + (header()?1:0))*desel.model()->columnCount()+desel.column() + 1;
Q_ASSERT(entry > 0);
int entry = (visualIndex(desel) + (header()?1:0))*desel.model()->columnCount()+desel.column();
Q_ASSERT(entry >= 0);
QAccessibleEvent event(this, QAccessible::SelectionRemove);
event.setChild(entry);
QAccessible::updateAccessibility(&event);