Fix off by one in updateAccessibility.

Now that indexOfChild is 0-based, the update notifications should follow.

Change-Id: I5e0303516d503d5e23061df5894b2428c00da2ce
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
This commit is contained in:
Frederik Gladhorn 2012-03-05 16:56:55 +01:00 committed by Qt by Nokia
parent 53bbea2328
commit 1c438f1048
4 changed files with 9 additions and 12 deletions

View File

@ -844,14 +844,12 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accChild(VARIANT varChildID, I
QPair<QObject*, int> ref = qAccessibleRecentSentEvents()->value(entry);
if (ref.first) {
acc = QAccessible::queryAccessibleInterface(ref.first);
if (acc && ref.second) {
if (ref.second) {
QAccessibleInterface *res = acc->child(ref.second - 1);
delete acc;
if (!res)
return E_INVALIDARG;
acc = res;
}
if (acc && ref.second >= 0) {
QAccessibleInterface *res = acc->child(ref.second);
delete acc;
if (!res)
return E_INVALIDARG;
acc = res;
}
}
} else {

View File

@ -1075,7 +1075,7 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e
if (action_e == QAction::Hover) {
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) {
int actionIndex = indexOf(action) + 1;
int actionIndex = indexOf(action);
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, q, actionIndex));
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, q, actionIndex));
}

View File

@ -531,7 +531,6 @@ void QMenuBarPrivate::_q_actionHovered()
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) {
int actionIndex = actions.indexOf(action);
++actionIndex;
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, q, actionIndex));
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, q, actionIndex));
}

View File

@ -1183,8 +1183,8 @@ void QTabBar::setCurrentIndex(int index)
d->layoutTab(index);
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) {
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, index + 1));
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, index + 1));
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, index));
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, index));
}
#endif
emit currentChanged(index);