Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qiosplatformaccessibility.mm
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
6#if QT_CONFIG(accessibility)
7
8#include <QtGui/QtGui>
9#include "qioswindow.h"
10
11QIOSPlatformAccessibility::QIOSPlatformAccessibility()
12{}
13
14QIOSPlatformAccessibility::~QIOSPlatformAccessibility()
15{}
16
17
18void invalidateCache(QAccessibleInterface *iface)
19{
20 if (!iface || !iface->isValid()) {
21 qWarning() << "invalid accessible interface: " << iface;
22 return;
23 }
24
25 // This will invalidate everything regardless of what window the
26 // interface belonged to. We might want to revisit this strategy later.
27 // (Therefore this function still takes the interface as argument)
29 if (win && win->handle()) {
31 window->clearAccessibleCache();
32 }
33 }
34}
35
36
37void QIOSPlatformAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
38{
39 auto *accessibleInterface = event->accessibleInterface();
40 if (!isActive() || !accessibleInterface)
41 return;
42 switch (event->type()) {
43 case QAccessible::ObjectCreated:
44 case QAccessible::ObjectShow:
45 case QAccessible::ObjectHide:
46 case QAccessible::ObjectDestroyed:
47 invalidateCache(accessibleInterface);
48 switch (accessibleInterface->role()) {
49 case QAccessible::Window:
50 case QAccessible::Dialog:
51 // Bigger changes to the UI require a full reset of VoiceOver
52 UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, nil);
53 break;
54 default:
55 // While smaller changes can be handled by re-reading the layout
56 UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil);
57 }
58 break;
59 default:
60 break;
61 }
62}
63
64#endif
bool isActive
static QWindowList topLevelWindows()
Returns a list of the top-level windows in the application.
\inmodule QtGui
Definition qwindow.h:63
constexpr QBindableInterface iface
Definition qproperty.h:664
#define qWarning
Definition qlogging.h:162
struct _cl_event * event
QT_END_NAMESPACE typedef QT_PREPEND_NAMESPACE(quintptr) WId
QWidget * win
Definition settings.cpp:6
aWidget window() -> setWindowTitle("New Window Title")
[2]