Respond with a sound for certain message boxes on windows

This was a regression (it worked in 4.8) that was probably introduced
by the refactoring of the accessibility framework in Qt 5.

Now, QPlatformAccessibility::notifyAccessibilityUpdate() is called
regardless of isActive(), so its the responsibility of each
implementation of notifyAccessibilityUpdate() to check for isActive()
where it matters.

Task-number: QTBUG-33303
Change-Id: I0d18f8c1890ef679460408b05e704712b886bf7c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
bb10
Jan Arve Saether 2015-12-03 10:53:06 +01:00 committed by Jan Arve Sæther
parent dc0c68262e
commit 753ebd5ba0
5 changed files with 16 additions and 13 deletions

View File

@ -852,18 +852,17 @@ void QAccessible::updateAccessibility(QAccessibleEvent *event)
// during construction of widgets. If you see cases where the
// cache seems wrong, this call is "to blame", but the code that
// caches dynamic data should be updated to handle change events.
if (!isActive() || !event->accessibleInterface())
return;
QAccessibleInterface *iface = event->accessibleInterface();
if (isActive() && iface) {
if (event->type() == QAccessible::TableModelChanged) {
if (iface->tableInterface())
iface->tableInterface()->modelChange(static_cast<QAccessibleTableModelChangeEvent*>(event));
}
if (event->type() == QAccessible::TableModelChanged) {
QAccessibleInterface *iface = event->accessibleInterface();
if (iface && iface->tableInterface())
iface->tableInterface()->modelChange(static_cast<QAccessibleTableModelChangeEvent*>(event));
}
if (updateHandler) {
updateHandler(event);
return;
if (updateHandler) {
updateHandler(event);
return;
}
}
if (QPlatformAccessibility *pfAccessibility = platformAccessibility())

View File

@ -99,7 +99,7 @@ void QSpiAccessibleBridge::notifyAccessibilityUpdate(QAccessibleEvent *event)
{
if (!dbusAdaptor)
return;
if (isActive())
if (isActive() && event->accessibleInterface())
dbusAdaptor->notify(event);
}

View File

@ -51,6 +51,8 @@ QCocoaAccessibility::~QCocoaAccessibility()
void QCocoaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
{
if (!isActive() || !event->accessibleInterface())
return;
QMacAccessibilityElement *element = [QMacAccessibilityElement elementWithId: event->uniqueId()];
if (!element) {
qWarning() << "QCocoaAccessibility::notifyAccessibilityUpdate: invalid element";

View File

@ -66,6 +66,8 @@ void invalidateCache(QAccessibleInterface *iface)
void QIOSPlatformAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
{
if (!isActive() || !event->accessibleInterface())
return;
switch (event->type()) {
case QAccessible::ObjectCreated:
case QAccessible::ObjectShow:

View File

@ -151,7 +151,7 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
// An event has to be associated with a window,
// so find the first parent that is a widget and that has a WId
QAccessibleInterface *iface = event->accessibleInterface();
if (!iface || !iface->isValid())
if (!isActive() || !iface || !iface->isValid())
return;
QWindow *window = QWindowsAccessibility::windowHelper(iface);