Use pointers for QAccessibleEvent.

At least on mac g++ badly wants to copy the event and
cannot use the copy ctor. The sensible solution is thus
to use pointers. This is in line with QCoreApplication::sendEvent.

Change-Id: Icb58852be351ab04ffa17069989d7a07d4b377da
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
This commit is contained in:
Frederik Gladhorn 2012-03-08 16:10:10 +01:00 committed by Qt by Nokia
parent 8cec8a4f68
commit a17907829e
29 changed files with 141 additions and 99 deletions

View File

@ -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);

View File

@ -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);

View File

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

View File

@ -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;
}

View File

@ -75,7 +75,7 @@ QPlatformAccessibility::~QPlatformAccessibility()
{
}
void QPlatformAccessibility::notifyAccessibilityUpdate(const QAccessibleEvent &event)
void QPlatformAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
{
initialize();

View File

@ -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();

View File

@ -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<const QAccessibleStateChangeEvent*>(&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<const QAccessibleStateChangeEvent*>(event)->changedStates(),
event->object(), event->child());
return new QAccessibleEvent(event->type(), event->object(), event->child());
}
static EventList &eventList()

View File

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

View File

@ -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)) {

View File

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

View File

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

View File

@ -3169,7 +3169,8 @@ void QListView::currentChanged(const QModelIndex &current, 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

View File

@ -3180,16 +3180,10 @@ void QTableView::currentChanged(const QModelIndex &current, 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

View File

@ -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 &current, 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

View File

@ -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;
}

View File

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

View File

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

View File

@ -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);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<QMenuBar*>(d->causedPopup.widget))

View File

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

View File

@ -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();

View File

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

View File

@ -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);

View File

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