QtBase  v6.3.1
qplatformaccessibility.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 #include "qplatformaccessibility.h"
40 #include <private/qfactoryloader_p.h>
41 #include "qaccessibleplugin.h"
42 #include "qaccessibleobject.h"
43 #include "qaccessiblebridge.h"
44 #include <QtGui/QGuiApplication>
45 
46 #include <QDebug>
47 
49 
50 #ifndef QT_NO_ACCESSIBILITY
51 
52 /* accessiblebridge plugin discovery stuff */
55 
57 
72  : m_active(false)
73 {
74 }
75 
77 {
78 }
79 
81 {
82  initialize();
83 
84  if (!bridges() || bridges()->isEmpty())
85  return;
86 
87  for (int i = 0; i < bridges()->count(); ++i)
88  bridges()->at(i)->notifyAccessibilityUpdate(event);
89 }
90 
92 {
93  initialize();
94  if (bridges()->isEmpty())
95  return;
96 
97  if (!o)
98  return;
99 
100  for (int i = 0; i < bridges()->count(); ++i) {
102  bridges()->at(i)->setRootObject(iface);
103  }
104 }
105 
107 {
108  static bool isInit = false;
109  if (isInit)
110  return;
111  isInit = true; // ### not atomic
112 
113  typedef QMultiMap<int, QString> PluginKeyMap;
115 
116  const PluginKeyMap keyMap = bridgeloader()->keyMap();
117  QAccessibleBridgePlugin *factory = nullptr;
118  int i = -1;
119  const PluginKeyMapConstIterator cend = keyMap.constEnd();
120  for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) {
121  if (it.key() != i) {
122  i = it.key();
123  factory = qobject_cast<QAccessibleBridgePlugin*>(bridgeloader()->instance(i));
124  }
125  if (factory)
126  if (QAccessibleBridge *bridge = factory->create(it.value()))
127  bridges()->append(bridge);
128  }
129 }
130 
132 {
133  qDeleteAll(*bridges());
134 }
135 
137 {
138  m_active = active;
139  QAccessible::setActive(active);
140 }
141 
142 #endif // QT_NO_ACCESSIBILITY
143 
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
The QAccessibleBridge class is the base class for accessibility back-ends.
The QAccessibleBridgePlugin class provides an abstract base for accessibility bridge plugins.
The QAccessibleEvent class is the base class for accessibility notifications.
Definition: qaccessible.h:680
static void setActive(bool active)
static QAccessibleInterface * queryAccessibleInterface(QObject *)
The QAccessibleInterface class defines an interface that exposes information about accessible objects...
Definition: qaccessible.h:459
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
Definition: qstring.h:84
Definition: qlist.h:108
The QObject class is the base class of all Qt objects.
Definition: qobject.h:125
virtual void notifyAccessibilityUpdate(QAccessibleEvent *event)
virtual void setRootObject(QObject *o)
qDeleteAll(list.begin(), list.end())
typename C::const_iterator const_iterator
PluginKeyMap::const_iterator PluginKeyMapConstIterator
const PluginKeyMapConstIterator cend
#define QAccessibleBridgeFactoryInterface_iid
#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
struct _cl_event * event
Definition: qopenglext.h:2998
QItemEditorFactory * factory
QStringList::Iterator it