summaryrefslogtreecommitdiffstats
path: root/src/gui/accessible/qaccessiblecache_p.h
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-03-20 16:38:36 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-09 10:46:02 +0200
commitccdfe354a64d145fc457d123c5d9b0bf15575738 (patch)
treed4fb1a3ba601797d56de49e3fb54e52a608f0f88 /src/gui/accessible/qaccessiblecache_p.h
parent7537a4605ad65a039f5e9812939a13fbf7656e29 (diff)
Accessibility Mac: Cache Accessible Elements and Notify about changes
The big change is that we now keep the id objects representing accessibles around so that they are persistent for ATs. This improves performance of Mac accessibility significantly. This is required for notifications which are now sent so that many things work much better, for example the VoiceOver focus follows the keyboard focus. The parent element in QCocoaAccessibleElement was removed, we can dynamically access it more reliably. Change-Id: I686d212f40d28b392dcc22f16f3c3430f08bdc98 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/gui/accessible/qaccessiblecache_p.h')
-rw-r--r--src/gui/accessible/qaccessiblecache_p.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/gui/accessible/qaccessiblecache_p.h b/src/gui/accessible/qaccessiblecache_p.h
index 32f9c443ba..30b023cfbd 100644
--- a/src/gui/accessible/qaccessiblecache_p.h
+++ b/src/gui/accessible/qaccessiblecache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -42,24 +42,42 @@
#ifndef QACCESSIBLECACHE_P
#define QACCESSIBLECACHE_P
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qhash.h>
#include "qaccessible.h"
-QT_BEGIN_NAMESPACE
+Q_FORWARD_DECLARE_OBJC_CLASS(QCocoaAccessibleElement);
+QT_BEGIN_NAMESPACE
-class QAccessibleCache :public QObject
+class Q_GUI_EXPORT QAccessibleCache :public QObject
{
Q_OBJECT
public:
+ static QAccessibleCache *instance();
QAccessibleInterface *interfaceForId(QAccessible::Id id) const;
QAccessible::Id insert(QObject *object, QAccessibleInterface *iface) const;
void deleteInterface(QAccessible::Id id, QObject *obj = 0);
+#ifdef Q_OS_OSX
+ QCocoaAccessibleElement *elementForId(QAccessible::Id axid) const;
+ void insertElement(QAccessible::Id axid, QCocoaAccessibleElement *element) const;
+#endif
+
private Q_SLOTS:
void objectDestroyed(QObject *obj);
@@ -69,6 +87,11 @@ private:
mutable QHash<QAccessible::Id, QAccessibleInterface *> idToInterface;
mutable QHash<QObject *, QAccessible::Id> objectToId;
+#ifdef Q_OS_OSX
+ void removeCocoaElement(QAccessible::Id axid);
+ mutable QHash<QAccessible::Id, QCocoaAccessibleElement *> cocoaElements;
+#endif
+
friend class QAccessible;
friend class QAccessibleInterface;
};