diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index cb89fccc2d..59794a5a06 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -648,9 +648,8 @@ void QAccessible::setRootObject(QObject *object) void QAccessible::updateAccessibility(QObject *object, int child, Event reason) { Q_ASSERT(object); - - QAccessibleEvent event = QAccessibleEvent(reason, object, child); - updateAccessibility(event); + QAccessibleEvent ev(reason, object, child); + updateAccessibility(&ev); } /*! @@ -672,7 +671,7 @@ void QAccessible::updateAccessibility(QObject *object, int child, Event reason) the parameters of the call is expensive you can test isActive() to avoid unnecessary computations. */ -void QAccessible::updateAccessibility(const QAccessibleEvent &event) +void QAccessible::updateAccessibility(QAccessibleEvent *event) { if (updateHandler) { updateHandler(event); diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index e8a5cf8bad..ffdd3fe7ce 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -327,7 +327,7 @@ public: }; typedef QAccessibleInterface*(*InterfaceFactory)(const QString &key, QObject*); - typedef void(*UpdateHandler)(const QAccessibleEvent &event); + typedef void(*UpdateHandler)(QAccessibleEvent *event); typedef void(*RootObjectHandler)(QObject*); static void installFactory(InterfaceFactory); @@ -338,7 +338,7 @@ public: static QAccessibleInterface *queryAccessibleInterface(QObject *); QT_DEPRECATED static void updateAccessibility(QObject *object, int child, Event reason); - static void updateAccessibility(const QAccessibleEvent &event); + static void updateAccessibility(QAccessibleEvent *event); static bool isActive(); static void setRootObject(QObject *object); diff --git a/src/gui/accessible/qaccessiblebridge.h b/src/gui/accessible/qaccessiblebridge.h index 147bf30bd0..80830bd01c 100644 --- a/src/gui/accessible/qaccessiblebridge.h +++ b/src/gui/accessible/qaccessiblebridge.h @@ -60,7 +60,7 @@ class QAccessibleBridge public: virtual ~QAccessibleBridge() {} virtual void setRootObject(QAccessibleInterface *) = 0; - virtual void notifyAccessibilityUpdate(const QAccessibleEvent &event) = 0; + virtual void notifyAccessibilityUpdate(QAccessibleEvent *event) = 0; }; struct Q_GUI_EXPORT QAccessibleBridgeFactoryInterface : public QFactoryInterface diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp index e587ad077c..d3344c3a3a 100644 --- a/src/gui/accessible/qaccessibleobject.cpp +++ b/src/gui/accessible/qaccessibleobject.cpp @@ -162,6 +162,7 @@ QAccessibleInterface *QAccessibleObject::childAt(int x, int y) const { for (int i = 0; i < childCount(); ++i) { QAccessibleInterface *childIface = child(i); + Q_ASSERT(childIface); if (childIface->rect().contains(x,y)) { return childIface; } diff --git a/src/gui/accessible/qplatformaccessibility_qpa.cpp b/src/gui/accessible/qplatformaccessibility_qpa.cpp index 9de11e7c1f..057d43add3 100644 --- a/src/gui/accessible/qplatformaccessibility_qpa.cpp +++ b/src/gui/accessible/qplatformaccessibility_qpa.cpp @@ -75,7 +75,7 @@ QPlatformAccessibility::~QPlatformAccessibility() { } -void QPlatformAccessibility::notifyAccessibilityUpdate(const QAccessibleEvent &event) +void QPlatformAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) { initialize(); diff --git a/src/gui/accessible/qplatformaccessibility_qpa.h b/src/gui/accessible/qplatformaccessibility_qpa.h index 364f87b0c9..3bd6316d01 100644 --- a/src/gui/accessible/qplatformaccessibility_qpa.h +++ b/src/gui/accessible/qplatformaccessibility_qpa.h @@ -57,7 +57,7 @@ public: QPlatformAccessibility(); virtual ~QPlatformAccessibility(); - virtual void notifyAccessibilityUpdate(const QAccessibleEvent &event); + virtual void notifyAccessibilityUpdate(QAccessibleEvent *event); virtual void setRootObject(QObject *o); virtual void initialize(); virtual void cleanup(); diff --git a/src/testlib/qtestaccessible.h b/src/testlib/qtestaccessible.h index 048e048789..807cc2f846 100644 --- a/src/testlib/qtestaccessible.h +++ b/src/testlib/qtestaccessible.h @@ -140,17 +140,16 @@ private: } } - static void updateHandler(const QAccessibleEvent &event) + static void updateHandler(QAccessibleEvent *event) { eventList().append(copyEvent(event)); } - - static QAccessibleEvent *copyEvent(const QAccessibleEvent &event) + static QAccessibleEvent *copyEvent(QAccessibleEvent *event) { - if (event.type() == QAccessible::StateChanged) - return new QAccessibleStateChangeEvent(static_cast(&event)->changedStates(), - event.object(), event.child()); - return new QAccessibleEvent(event.type(), event.object(), event.child()); + if (event->type() == QAccessible::StateChanged) + return new QAccessibleStateChangeEvent(static_cast(event)->changedStates(), + event->object(), event->child()); + return new QAccessibleEvent(event->type(), event->object(), event->child()); } static EventList &eventList() diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index f1a6a294d2..5d36bc07e8 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -754,7 +754,8 @@ void QDialog::setVisible(bool visible) } #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DialogStart, this)); + QAccessibleEvent event(QAccessible::DialogStart, this); + QAccessible::updateAccessibility(&event); #endif } else { @@ -762,8 +763,10 @@ void QDialog::setVisible(bool visible) return; #ifndef QT_NO_ACCESSIBILITY - if (isVisible()) - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DialogEnd, this)); + if (isVisible()) { + QAccessibleEvent event(QAccessible::DialogEnd, this); + QAccessible::updateAccessibility(&event); + } #endif // Reimplemented to exit a modal event loop when the dialog is hidden. diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index e1b134ee48..040f61dfc5 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1463,7 +1463,8 @@ void QMessageBox::showEvent(QShowEvent *e) d->updateSize(); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Alert, this)); + QAccessibleEvent event(QAccessible::Alert, this); + QAccessible::updateAccessibility(&event); #endif #ifdef Q_OS_WIN if (const HMENU systemMenu = qt_getWindowsSystemMenu(this)) { diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 830853094a..752542c1ee 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -843,7 +843,8 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, #ifndef QT_NO_ACCESSIBILITY if (focusItem) { if (QGraphicsObject *focusObj = focusItem->toGraphicsObject()) { - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, focusObj)); + QAccessibleEvent event(QAccessible::Focus, focusObj); + QAccessible::updateAccessibility(&event); } } #endif diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 8530e2c23e..8992a3bdfe 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -1112,7 +1112,8 @@ void QAbstractItemView::reset() #ifdef Q_WS_X11 if (QAccessible::isActive()) { QAccessible::queryAccessibleInterface(this)->table2Interface()->modelReset(); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, this, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, this, 0); + QAccessible::updateAccessibility(&event); } #endif #endif @@ -3342,7 +3343,8 @@ void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &index, int star #ifdef Q_WS_X11 if (QAccessible::isActive()) { QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsRemoved(index, start, end); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); + QAccessible::updateAccessibility(&event); } #endif #endif @@ -3422,7 +3424,8 @@ void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &index, int s #ifdef Q_WS_X11 if (QAccessible::isActive()) { QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsRemoved(index, start, end); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); + QAccessible::updateAccessibility(&event); } #endif #endif @@ -3445,7 +3448,8 @@ void QAbstractItemViewPrivate::_q_rowsInserted(const QModelIndex &index, int sta Q_Q(QAbstractItemView); if (QAccessible::isActive()) { QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsInserted(index, start, end); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); + QAccessible::updateAccessibility(&event); } #endif #endif @@ -3469,7 +3473,8 @@ void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &index, int #ifdef Q_WS_X11 if (QAccessible::isActive()) { QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsInserted(index, start, end); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); + QAccessible::updateAccessibility(&event); } #endif #endif @@ -3497,7 +3502,8 @@ void QAbstractItemViewPrivate::_q_layoutChanged() Q_Q(QAbstractItemView); if (QAccessible::isActive()) { QAccessible::queryAccessibleInterface(q)->table2Interface()->modelReset(); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); + QAccessible::updateAccessibility(&event); } #endif #endif diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index b00b1073a3..872798a8e9 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -3169,7 +3169,8 @@ void QListView::currentChanged(const QModelIndex ¤t, const QModelIndex &pr if (QAccessible::isActive()) { if (current.isValid()) { int entry = visualIndex(current) + 1; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, entry)); + QAccessibleEvent event(QAccessible::Focus, this, entry); + QAccessible::updateAccessibility(&event); } } #endif @@ -3188,12 +3189,14 @@ void QListView::selectionChanged(const QItemSelection &selected, QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { int entry = visualIndex(sel) + 1; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, entry)); + QAccessibleEvent event(QAccessible::Selection, this, entry); + QAccessible::updateAccessibility(&event); } QModelIndex desel = deselected.indexes().value(0); if (desel.isValid()) { int entry = visualIndex(desel) + 1; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, this, entry)); + QAccessibleEvent event(QAccessible::SelectionRemove, this, entry); + QAccessible::updateAccessibility(&event); } } #endif diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index a5e03ca9e4..55cf18d78c 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -3180,16 +3180,10 @@ void QTableView::currentChanged(const QModelIndex ¤t, const QModelIndex &p #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { if (current.isValid()) { -#ifdef Q_OS_UNIX Q_D(QTableView); int entry = d->accessibleTable2Index(current); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, entry)); -#else - int entry = visualIndex(current) + 1; - if (horizontalHeader()) - ++entry; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, viewport(), entry)); -#endif + QAccessibleEvent event(QAccessible::Focus, this, entry); + QAccessible::updateAccessibility(&event); } } #endif @@ -3209,27 +3203,15 @@ void QTableView::selectionChanged(const QItemSelection &selected, // ### does not work properly for selection ranges. QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { -#ifdef Q_OS_UNIX int entry = d->accessibleTable2Index(sel); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, entry)); -#else - int entry = visualIndex(sel); - if (horizontalHeader()) - ++entry; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, viewport(), entry)); -#endif + QAccessibleEvent event(QAccessible::Selection, this, entry); + QAccessible::updateAccessibility(&event); } QModelIndex desel = deselected.indexes().value(0); if (desel.isValid()) { -#ifdef Q_OS_UNIX int entry = d->accessibleTable2Index(desel); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, this, entry)); -#else - int entry = visualIndex(sel); - if (horizontalHeader()) - ++entry; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, viewport(), entry)); -#endif + QAccessibleEvent event(QAccessible::SelectionRemove, this, entry); + QAccessible::updateAccessibility(&event); } } #endif diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index e2be4990d9..6166823754 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -2937,7 +2937,8 @@ void QTreeViewPrivate::insertViewItems(int pos, int count, const QTreeViewItem & #ifndef QT_NO_ACCESSIBILITY #ifdef Q_OS_UNIX if (QAccessible::isActive()) { - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); + QAccessible::updateAccessibility(&event); } #endif #endif @@ -2955,7 +2956,8 @@ void QTreeViewPrivate::removeViewItems(int pos, int count) #ifndef QT_NO_ACCESSIBILITY #ifdef Q_OS_UNIX if (QAccessible::isActive()) { - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); + QAccessible::updateAccessibility(&event); } #endif #endif @@ -3769,7 +3771,8 @@ void QTreeView::currentChanged(const QModelIndex ¤t, const QModelIndex &pr if (QAccessible::isActive() && current.isValid()) { #ifdef Q_OS_UNIX int entry = (visualIndex(current) + (header()?1:0))*current.model()->columnCount()+current.column() + 1; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, entry)); + QAccessibleEvent event(QAccessible::Focus, this, entry); + QAccessible::updateAccessibility(&event); #else int entry = visualIndex(current) + 1; if (header()) @@ -3794,13 +3797,15 @@ void QTreeView::selectionChanged(const QItemSelection &selected, if (sel.isValid()) { int entry = (visualIndex(sel) + (header()?1:0))*sel.model()->columnCount()+sel.column() + 1; Q_ASSERT(entry > 0); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, entry)); + QAccessibleEvent event(QAccessible::Selection, this, 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); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, this, entry)); + QAccessibleEvent event(QAccessible::SelectionRemove, this, entry); + QAccessible::updateAccessibility(&event); } } #endif diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index 1c20b98139..114cde59e9 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -412,7 +412,8 @@ QWhatsThisPrivate::QWhatsThisPrivate() #endif } #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ContextHelpStart, this)); + QAccessibleEvent event(QAccessible::ContextHelpStart, this); + QAccessible::updateAccessibility(&event); #endif } @@ -424,7 +425,8 @@ QWhatsThisPrivate::~QWhatsThisPrivate() QApplication::restoreOverrideCursor(); #endif #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ContextHelpEnd, this)); + QAccessibleEvent event(QAccessible::ContextHelpEnd, this); + QAccessible::updateAccessibility(&event); #endif instance = 0; } diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index be1782bc4d..a4bb205b76 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5965,7 +5965,10 @@ 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)); + { + QAccessibleEvent event(QAccessible::Focus, f); + QAccessible::updateAccessibility(&event); + } #endif #ifndef QT_NO_GRAPHICSVIEW if (QWExtra *topData = window()->d_func()->extra) { @@ -6045,7 +6048,8 @@ void QWidget::clearFocus() #endif { #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this)); + QAccessibleEvent event(QAccessible::Focus, this); + QAccessible::updateAccessibility(&event); #endif } } @@ -7051,8 +7055,10 @@ void QWidgetPrivate::show_helper() qApp->d_func()->openPopup(q); #ifndef QT_NO_ACCESSIBILITY - if (q->windowType() != Qt::ToolTip) // Tooltips are read aloud twice in MS narrator. - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectShow, q)); + if (q->windowType() != Qt::ToolTip) { // Tooltips are read aloud twice in MS narrator. + QAccessibleEvent event(QAccessible::ObjectShow, q); + QAccessible::updateAccessibility(&event); + } #endif if (QApplicationPrivate::hidden_focus_widget == q) { @@ -7142,8 +7148,10 @@ void QWidgetPrivate::hide_helper() bs->removeDirtyWidget(q); #ifndef QT_NO_ACCESSIBILITY - if (wasVisible) - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectHide, q)); + if (wasVisible) { + QAccessibleEvent event(QAccessible::ObjectHide, q); + QAccessible::updateAccessibility(&event); + } #endif } @@ -7374,8 +7382,10 @@ void QWidgetPrivate::hideChildren(bool spontaneous) } qApp->d_func()->sendSyntheticEnterLeave(widget); #ifndef QT_NO_ACCESSIBILITY - if (!spontaneous) - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectHide, widget)); + if (!spontaneous) { + QAccessibleEvent event(QAccessible::ObjectHide, widget); + QAccessible::updateAccessibility(&event); + } #endif } } @@ -8250,7 +8260,8 @@ void QWidget::changeEvent(QEvent * event) #ifndef QT_NO_ACCESSIBILITY QAccessible::State s; s.disabled = true; - QAccessible::updateAccessibility(QAccessibleStateChangeEvent(s, this)); + QAccessibleStateChangeEvent event(s, this); + QAccessible::updateAccessibility(&event); #endif break; } @@ -10391,7 +10402,8 @@ void QWidget::setAccessibleName(const QString &name) { Q_D(QWidget); d->accessibleName = name; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this)); + QAccessibleEvent event(QAccessible::NameChanged, this); + QAccessible::updateAccessibility(&event); } QString QWidget::accessibleName() const @@ -10413,7 +10425,8 @@ void QWidget::setAccessibleDescription(const QString &description) { Q_D(QWidget); d->accessibleDescription = description; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DescriptionChanged, this)); + QAccessibleEvent event(QAccessible::DescriptionChanged, this); + QAccessible::updateAccessibility(&event); } QString QWidget::accessibleDescription() const diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index aebef8ddc9..0b24799a56 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -644,7 +644,8 @@ void QAbstractButton::setText(const QString &text) update(); updateGeometry(); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this)); + QAccessibleEvent event(QAccessible::NameChanged, this); + QAccessible::updateAccessibility(&event); #endif } @@ -769,7 +770,8 @@ void QAbstractButton::setChecked(bool checked) #ifndef QT_NO_ACCESSIBILITY QAccessible::State s; s.checked = true; - QAccessible::updateAccessibility(QAccessibleStateChangeEvent(s, this)); + QAccessibleStateChangeEvent event(s, this); + QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp index b0216e5277..2d3f79e43d 100644 --- a/src/widgets/widgets/qabstractslider.cpp +++ b/src/widgets/widgets/qabstractslider.cpp @@ -538,7 +538,8 @@ void QAbstractSlider::setValue(int value) emit sliderMoved((d->position = value)); } #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, this)); + QAccessibleEvent event(QAccessible::ValueChanged, this); + QAccessible::updateAccessibility(&event); #endif sliderChange(SliderValueChange); emit valueChanged(value); diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index c083369136..7b55b0fa8c 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -976,7 +976,8 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) } } #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, this)); + QAccessibleEvent event(QAccessible::ValueChanged, this); + QAccessible::updateAccessibility(&event); #endif return; } @@ -1595,7 +1596,8 @@ 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)); + QAccessibleEvent event(QAccessible::ValueChanged, q); + QAccessible::updateAccessibility(&event); #endif } } diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 8d40d17fb1..88c17ca704 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -983,7 +983,8 @@ void QComboBoxPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIn q->update(); } #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, q, 0)); + QAccessibleEvent event(QAccessible::NameChanged, q, 0); + QAccessible::updateAccessibility(&event); #endif } @@ -1239,7 +1240,8 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index) emit q->currentIndexChanged(index.row()); emit q->currentIndexChanged(itemText(index)); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, q, 0)); + QAccessibleEvent event(QAccessible::NameChanged, q, 0); + QAccessible::updateAccessibility(&event); #endif } @@ -2587,7 +2589,8 @@ void QComboBox::clear() Q_D(QComboBox); d->model->removeRows(0, d->model->rowCount(d->root), d->root); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0)); + QAccessibleEvent event(QAccessible::NameChanged, this, 0); + QAccessible::updateAccessibility(&event); #endif } @@ -2606,7 +2609,8 @@ void QComboBox::clearEditText() if (d->lineEdit) d->lineEdit->clear(); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0)); + QAccessibleEvent event(QAccessible::NameChanged, this, 0); + QAccessible::updateAccessibility(&event); #endif } @@ -2619,7 +2623,8 @@ void QComboBox::setEditText(const QString &text) if (d->lineEdit) d->lineEdit->setText(text); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0)); + QAccessibleEvent event(QAccessible::NameChanged, this, 0); + QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp index cf3e14871f..7186ddfccc 100644 --- a/src/widgets/widgets/qgroupbox.cpp +++ b/src/widgets/widgets/qgroupbox.cpp @@ -249,7 +249,8 @@ void QGroupBox::setTitle(const QString &title) update(); updateGeometry(); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0)); + QAccessibleEvent event(QAccessible::NameChanged, this, 0); + QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index 82e56f3354..f36dea52dd 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -315,8 +315,10 @@ void QLabel::setText(const QString &text) d->updateLabel(); #ifndef QT_NO_ACCESSIBILITY - if (accessibleName().isEmpty()) - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0)); + if (accessibleName().isEmpty()) { + QAccessibleEvent event(QAccessible::NameChanged, this, 0); + QAccessible::updateAccessibility(&event); + } #endif } diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index d06e98e31a..37e956c27f 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -144,7 +144,8 @@ void QLineEditPrivate::_q_selectionChanged() emit q->selectionChanged(); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextSelectionChanged, q)); + QAccessibleEvent event(QAccessible::TextSelectionChanged, q); + QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index af4a87e282..7d4f7151a4 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1076,8 +1076,10 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { int actionIndex = indexOf(action); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, q, actionIndex)); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, q, actionIndex)); + QAccessibleEvent focusEvent(QAccessible::Focus, q, actionIndex); + QAccessible::updateAccessibility(&focusEvent); + QAccessibleEvent selectionEvent(QAccessible::Selection, q, actionIndex); + QAccessible::updateAccessibility(&selectionEvent); } #endif action->showStatusText(topCausedWidget()); @@ -1970,7 +1972,8 @@ void QMenu::popup(const QPoint &p, QAction *atAction) } #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::PopupMenuStart, this ,0)); + QAccessibleEvent event(QAccessible::PopupMenuStart, this ,0); + QAccessible::updateAccessibility(&event); #endif } @@ -2091,7 +2094,8 @@ void QMenu::hideEvent(QHideEvent *) d->eventLoop->exit(); d->setCurrentAction(0); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::PopupMenuEnd, this)); + QAccessibleEvent event(QAccessible::PopupMenuEnd, this); + QAccessible::updateAccessibility(&event); #endif #ifndef QT_NO_MENUBAR if (QMenuBar *mb = qobject_cast(d->causedPopup.widget)) diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 0efa6caebc..2712839103 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -531,8 +531,10 @@ void QMenuBarPrivate::_q_actionHovered() #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { int actionIndex = actions.indexOf(action); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, q, actionIndex)); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, q, actionIndex)); + QAccessibleEvent focusEvent(QAccessible::Focus, q, actionIndex); + QAccessible::updateAccessibility(&focusEvent); + QAccessibleEvent selectionEvent(QAccessible::Selection, q, actionIndex); + QAccessible::updateAccessibility(&selectionEvent); } #endif //QT_NO_ACCESSIBILITY } diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp index c1a34bfb7a..0439caeb88 100644 --- a/src/widgets/widgets/qprogressbar.cpp +++ b/src/widgets/widgets/qprogressbar.cpp @@ -314,7 +314,8 @@ void QProgressBar::setValue(int value) d->value = value; emit valueChanged(value); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, this)); + QAccessibleEvent event(QAccessible::ValueChanged, this); + QAccessible::updateAccessibility(&event); #endif if (d->repaintRequired()) repaint(); diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index 059b0f801c..5dae4e0b34 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -378,7 +378,8 @@ void QPushButton::setDefault(bool enable) #ifndef QT_NO_ACCESSIBILITY QAccessible::State s; s.defaultButton = true; - QAccessible::updateAccessibility(QAccessibleStateChangeEvent(s, this)); + QAccessibleStateChangeEvent event(s, this); + QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index ce25a22847..af360701fa 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -1183,8 +1183,10 @@ void QTabBar::setCurrentIndex(int index) d->layoutTab(index); #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, index)); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, index)); + QAccessibleEvent focusEvent(QAccessible::Focus, this, index); + QAccessible::updateAccessibility(&focusEvent); + QAccessibleEvent selectionEvent(QAccessible::Selection, this, index); + QAccessible::updateAccessibility(&selectionEvent); } #endif emit currentChanged(index); diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index a04339f864..7c659ebb64 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -767,8 +767,10 @@ void QWidgetLineControl::internalSetText(const QString &txt, int pos, bool edite bool changed = finishChange(-1, true, edited); #ifndef QT_NO_ACCESSIBILITY - if (changed) - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextUpdated, parent())); + if (changed) { + QAccessibleEvent event(QAccessible::TextUpdated, parent()); + QAccessible::updateAccessibility(&event); + } #endif } @@ -1367,7 +1369,8 @@ void QWidgetLineControl::emitCursorPositionChanged() m_lastCursorPos = m_cursor; cursorPositionChanged(oldLast, m_cursor); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextCaretMoved, parent())); + QAccessibleEvent event(QAccessible::TextCaretMoved, parent()); + QAccessible::updateAccessibility(&event); #endif } }