Always invalidate the iOS accessibility cache

This was observed in the weather app, where sometimes we could not find
an items window. This could only be observed in the search results of
the cities. (while VKB was visible).

The old code traversed up to the QQuickListView and then it could not
traversed further up in the parent hierarchy. Because of this it
could also not find the associated window handle.
The reason for this is unknown, but maybe it could be related to the
fact that QQuickListView is a Component.

Regardless of this, invalidate the cache should invalidate everything.
We also traverse through all top level windows, but on iOS there should
not be too many top level windows...

Change-Id: I56a496435bb529a53d5ece8446cd2eeff502af84
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
This commit is contained in:
Jan Arve Sæther 2014-10-30 16:05:46 +01:00
parent 3b86bd5406
commit 8cbbdae24c

View File

@ -58,18 +58,18 @@ void invalidateCache(QAccessibleInterface *iface)
return;
}
QWindow *win = 0;
QAccessibleInterface *parent = iface;
do {
win = parent->window();
parent = parent->parent();
} while (!win && parent);
// This will invalidate everything regardless of what window the
// interface belonged to. We might want to revisit this strategy later.
// (Therefore this function still takes the interface as argument)
// It is also responsible for the bug that focus gets temporary lost
// when items get added or removed from the screen
foreach (QWindow *win, QGuiApplication::topLevelWindows()) {
if (win && win->handle()) {
QIOSWindow *window = static_cast<QIOSWindow*>(win->handle());
window->clearAccessibleCache();
}
}
}
void QIOSPlatformAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)