Call updateAccessibility with the right index.
In Qt 4 index 0 was the widget itself. With the cleanup of child index this now changed. The default constructor uses -1 as parameter to signify that the widget is the cause, not a child. Change-Id: I329a1cc91bf2d1d1d8534739acbddfe107f40364 Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
This commit is contained in:
parent
316b050324
commit
b55ed97e79
@ -754,7 +754,7 @@ void QDialog::setVisible(bool visible)
|
||||
}
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DialogStart, this, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DialogStart, this));
|
||||
#endif
|
||||
|
||||
} else {
|
||||
@ -763,7 +763,7 @@ void QDialog::setVisible(bool visible)
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
if (isVisible())
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DialogEnd, this, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DialogEnd, this));
|
||||
#endif
|
||||
|
||||
// Reimplemented to exit a modal event loop when the dialog is hidden.
|
||||
|
@ -1463,7 +1463,7 @@ void QMessageBox::showEvent(QShowEvent *e)
|
||||
d->updateSize();
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Alert, this, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Alert, this));
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
if (const HMENU systemMenu = qt_getWindowsSystemMenu(this)) {
|
||||
|
@ -843,7 +843,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
if (focusItem) {
|
||||
if (QGraphicsObject *focusObj = focusItem->toGraphicsObject()) {
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, focusObj, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, focusObj));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -412,7 +412,7 @@ QWhatsThisPrivate::QWhatsThisPrivate()
|
||||
#endif
|
||||
}
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ContextHelpStart, this, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ContextHelpStart, this));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -424,7 +424,7 @@ QWhatsThisPrivate::~QWhatsThisPrivate()
|
||||
QApplication::restoreOverrideCursor();
|
||||
#endif
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ContextHelpEnd, this, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ContextHelpEnd, this));
|
||||
#endif
|
||||
instance = 0;
|
||||
}
|
||||
|
@ -5965,7 +5965,7 @@ void QWidget::setFocus(Qt::FocusReason reason)
|
||||
// menus update the focus manually and this would create bogus events
|
||||
if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem")))
|
||||
# endif
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, f, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, f));
|
||||
#endif
|
||||
#ifndef QT_NO_GRAPHICSVIEW
|
||||
if (QWExtra *topData = window()->d_func()->extra) {
|
||||
@ -6045,7 +6045,7 @@ void QWidget::clearFocus()
|
||||
#endif
|
||||
{
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -7052,7 +7052,7 @@ void QWidgetPrivate::show_helper()
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
if (q->windowType() != Qt::ToolTip) // Tooltips are read aloud twice in MS narrator.
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectShow, q, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectShow, q));
|
||||
#endif
|
||||
|
||||
if (QApplicationPrivate::hidden_focus_widget == q) {
|
||||
@ -7143,7 +7143,7 @@ void QWidgetPrivate::hide_helper()
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
if (wasVisible)
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectHide, q, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectHide, q));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -7375,7 +7375,7 @@ void QWidgetPrivate::hideChildren(bool spontaneous)
|
||||
qApp->d_func()->sendSyntheticEnterLeave(widget);
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
if (!spontaneous)
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectHide, widget, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectHide, widget));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -10386,7 +10386,7 @@ void QWidget::setAccessibleName(const QString &name)
|
||||
{
|
||||
Q_D(QWidget);
|
||||
d->accessibleName = name;
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this));
|
||||
}
|
||||
|
||||
QString QWidget::accessibleName() const
|
||||
@ -10408,7 +10408,7 @@ void QWidget::setAccessibleDescription(const QString &description)
|
||||
{
|
||||
Q_D(QWidget);
|
||||
d->accessibleDescription = description;
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DescriptionChanged, this, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DescriptionChanged, this));
|
||||
}
|
||||
|
||||
QString QWidget::accessibleDescription() const
|
||||
|
@ -647,7 +647,7 @@ void QAbstractButton::setText(const QString &text)
|
||||
update();
|
||||
updateGeometry();
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -538,7 +538,7 @@ void QAbstractSlider::setValue(int value)
|
||||
emit sliderMoved((d->position = value));
|
||||
}
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, this, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, this));
|
||||
#endif
|
||||
sliderChange(SliderValueChange);
|
||||
emit valueChanged(value);
|
||||
|
@ -976,7 +976,7 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
|
||||
}
|
||||
}
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, this, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, this));
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@ -1595,7 +1595,7 @@ void QAbstractSpinBoxPrivate::updateState(bool up, bool fromKeyboard /* = false
|
||||
buttonState = (up ? Up : Down) | (fromKeyboard ? Keyboard : Mouse);
|
||||
q->stepBy(up ? 1 : -1);
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, q, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, q));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ void QLineEditPrivate::_q_selectionChanged()
|
||||
|
||||
emit q->selectionChanged();
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextSelectionChanged, q, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextSelectionChanged, q));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2091,7 +2091,7 @@ void QMenu::hideEvent(QHideEvent *)
|
||||
d->eventLoop->exit();
|
||||
d->setCurrentAction(0);
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::PopupMenuEnd, this, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::PopupMenuEnd, this));
|
||||
#endif
|
||||
#ifndef QT_NO_MENUBAR
|
||||
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget))
|
||||
|
@ -314,7 +314,7 @@ void QProgressBar::setValue(int value)
|
||||
d->value = value;
|
||||
emit valueChanged(value);
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, this, 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, this));
|
||||
#endif
|
||||
if (d->repaintRequired())
|
||||
repaint();
|
||||
|
@ -768,7 +768,7 @@ void QWidgetLineControl::internalSetText(const QString &txt, int pos, bool edite
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
if (changed)
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextUpdated, parent(), 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextUpdated, parent()));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1367,7 +1367,7 @@ void QWidgetLineControl::emitCursorPositionChanged()
|
||||
m_lastCursorPos = m_cursor;
|
||||
cursorPositionChanged(oldLast, m_cursor);
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextCaretMoved, parent(), 0));
|
||||
QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextCaretMoved, parent()));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ void tst_QAccessibility::eventTest()
|
||||
button->setObjectName(QString("Olaf"));
|
||||
|
||||
button->show();
|
||||
QVERIFY_EVENT(button, 0, QAccessible::ObjectShow);
|
||||
QVERIFY_EVENT(button, -1, QAccessible::ObjectShow);
|
||||
button->setFocus(Qt::MouseFocusReason);
|
||||
QTestAccessibility::clearEvents();
|
||||
QTest::mouseClick(button, Qt::LeftButton, 0);
|
||||
@ -423,12 +423,12 @@ void tst_QAccessibility::eventTest()
|
||||
QVERIFY_EVENT(button, 0, QAccessible::StateChanged);
|
||||
|
||||
button->setAccessibleName("Olaf the second");
|
||||
QVERIFY_EVENT(button, 0, QAccessible::NameChanged);
|
||||
QVERIFY_EVENT(button, -1, QAccessible::NameChanged);
|
||||
button->setAccessibleDescription("This is a button labeled Olaf");
|
||||
QVERIFY_EVENT(button, 0, QAccessible::DescriptionChanged);
|
||||
QVERIFY_EVENT(button, -1, QAccessible::DescriptionChanged);
|
||||
|
||||
button->hide();
|
||||
QVERIFY_EVENT(button, 0, QAccessible::ObjectHide);
|
||||
QVERIFY_EVENT(button, -1, QAccessible::ObjectHide);
|
||||
|
||||
delete button;
|
||||
}
|
||||
@ -732,16 +732,16 @@ void tst_QAccessibility::hideShowTest()
|
||||
window->show();
|
||||
QVERIFY(!state(window).invisible);
|
||||
QVERIFY(!state(child).invisible);
|
||||
QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(window, 0, QAccessible::ObjectShow)));
|
||||
QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(child, 0, QAccessible::ObjectShow)));
|
||||
QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(window, -1, QAccessible::ObjectShow)));
|
||||
QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(child, -1, QAccessible::ObjectShow)));
|
||||
QTestAccessibility::clearEvents();
|
||||
|
||||
// hide() and veryfy that both window and child are invisible and get ObjectHide events.
|
||||
window->hide();
|
||||
QVERIFY(state(window).invisible);
|
||||
QVERIFY(state(child).invisible);
|
||||
QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(window, 0, QAccessible::ObjectHide)));
|
||||
QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(child, 0, QAccessible::ObjectHide)));
|
||||
QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(window, -1, QAccessible::ObjectHide)));
|
||||
QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(child, -1, QAccessible::ObjectHide)));
|
||||
QTestAccessibility::clearEvents();
|
||||
|
||||
delete window;
|
||||
@ -822,7 +822,7 @@ void tst_QAccessibility::mainWindowTest()
|
||||
QLatin1String name = QLatin1String("I am the main window");
|
||||
mw->setWindowTitle(name);
|
||||
QTest::qWaitForWindowShown(mw);
|
||||
QVERIFY_EVENT(mw, 0, QAccessible::ObjectShow);
|
||||
QVERIFY_EVENT(mw, -1, QAccessible::ObjectShow);
|
||||
|
||||
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(mw);
|
||||
QCOMPARE(interface->text(QAccessible::Name), name);
|
||||
@ -1052,12 +1052,12 @@ void tst_QAccessibility::scrollBarTest()
|
||||
scrollBar->resize(200, 50);
|
||||
scrollBar->show();
|
||||
QVERIFY(!scrollBarInterface->state().invisible);
|
||||
QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(scrollBar, 0, QAccessible::ObjectShow)));
|
||||
QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(scrollBar, -1, QAccessible::ObjectShow)));
|
||||
QTestAccessibility::clearEvents();
|
||||
|
||||
scrollBar->hide();
|
||||
QVERIFY(scrollBarInterface->state().invisible);
|
||||
QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(scrollBar, 0, QAccessible::ObjectHide)));
|
||||
QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(scrollBar, -1, QAccessible::ObjectHide)));
|
||||
QTestAccessibility::clearEvents();
|
||||
|
||||
// Test that the left/right subcontrols are set to unavailable when the scrollBar is at the minimum/maximum.
|
||||
@ -1498,7 +1498,7 @@ void tst_QAccessibility::spinBoxTest()
|
||||
QTest::keyPress(spinBox, Qt::Key_Up);
|
||||
QTest::qWait(200);
|
||||
EventList events = QTestAccessibility::events();
|
||||
QTestAccessibilityEvent expectedEvent(spinBox, 0, (int)QAccessible::ValueChanged);
|
||||
QTestAccessibilityEvent expectedEvent(spinBox, -1, (int)QAccessible::ValueChanged);
|
||||
QVERIFY(events.contains(expectedEvent));
|
||||
delete spinBox;
|
||||
QTestAccessibility::clearEvents();
|
||||
@ -1769,7 +1769,7 @@ void tst_QAccessibility::lineEditTest()
|
||||
le->setFocus(Qt::TabFocusReason);
|
||||
QTestAccessibility::clearEvents();
|
||||
le2->setFocus(Qt::TabFocusReason);
|
||||
QTRY_VERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(le2, 0, QAccessible::Focus)));
|
||||
QTRY_VERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(le2, -1, QAccessible::Focus)));
|
||||
|
||||
le->setText(QLatin1String("500"));
|
||||
le->setValidator(new QIntValidator());
|
||||
@ -1789,7 +1789,7 @@ void tst_QAccessibility::lineEditTest()
|
||||
le3->deselect();
|
||||
le3->setCursorPosition(3);
|
||||
QCOMPARE(textIface->cursorPosition(), 3);
|
||||
QTRY_VERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(le3, 0, QAccessible::TextCaretMoved)));
|
||||
QTRY_VERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(le3, -1, QAccessible::TextCaretMoved)));
|
||||
QCOMPARE(textIface->selectionCount(), 0);
|
||||
QTestAccessibility::clearEvents();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user