qaccessibleobject.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/accessible/qaccessibleobject.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtGui module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
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 http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://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 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include "qaccessibleobject.h"-
35-
36#ifndef QT_NO_ACCESSIBILITY-
37-
38#include <QtGui/QGuiApplication>-
39#include <QtGui/QWindow>-
40-
41#include "qpointer.h"-
42#include "qmetaobject.h"-
43-
44QT_BEGIN_NAMESPACE-
45-
46class QAccessibleObjectPrivate-
47{-
48public:-
49 QPointer<QObject> object;-
50};-
51-
52/*!-
53 \class QAccessibleObject-
54 \brief The QAccessibleObject class implements parts of the-
55 QAccessibleInterface for QObjects.-
56-
57 \ingroup accessibility-
58 \inmodule QtGui-
59-
60 This class is part of \l {Accessibility for QWidget Applications}.-
61-
62 This class is mainly provided for convenience. All subclasses of-
63 the QAccessibleInterface that provide implementations of non-widget objects-
64 should use this class as their base class.-
65-
66 \sa QAccessible, QAccessibleWidget-
67*/-
68-
69/*!-
70 Creates a QAccessibleObject for \a object.-
71*/-
72QAccessibleObject::QAccessibleObject(QObject *object)-
73{-
74 d = new QAccessibleObjectPrivate;-
75 d->object = object;-
76}
never executed: end of block
0
77-
78/*!-
79 Destroys the QAccessibleObject.-
80-
81 This only happens when a call to release() decrements the internal-
82 reference counter to zero.-
83*/-
84QAccessibleObject::~QAccessibleObject()-
85{-
86 delete d;-
87}
never executed: end of block
0
88-
89/*!-
90 \reimp-
91*/-
92QObject *QAccessibleObject::object() const-
93{-
94 return d->object;
never executed: return d->object;
0
95}-
96-
97/*!-
98 \reimp-
99*/-
100bool QAccessibleObject::isValid() const-
101{-
102 return !d->object.isNull();
never executed: return !d->object.isNull();
0
103}-
104-
105/*! \reimp */-
106QRect QAccessibleObject::rect() const-
107{-
108 return QRect();
never executed: return QRect();
0
109}-
110-
111/*! \reimp */-
112void QAccessibleObject::setText(QAccessible::Text, const QString &)-
113{-
114}-
115-
116/*! \reimp */-
117QAccessibleInterface *QAccessibleObject::childAt(int x, int y) const-
118{-
119 for (int i = 0; i < childCount(); ++i) {
i < childCount()Description
TRUEnever evaluated
FALSEnever evaluated
0
120 QAccessibleInterface *childIface = child(i);-
121 Q_ASSERT(childIface);-
122 if (childIface->rect().contains(x,y))
childIface->re....contains(x,y)Description
TRUEnever evaluated
FALSEnever evaluated
0
123 return childIface;
never executed: return childIface;
0
124 }
never executed: end of block
0
125 return 0;
never executed: return 0;
0
126}-
127-
128/*!-
129 \class QAccessibleApplication-
130 \brief The QAccessibleApplication class implements the QAccessibleInterface for QApplication.-
131-
132 \internal-
133-
134 \ingroup accessibility-
135*/-
136-
137/*!-
138 Creates a QAccessibleApplication for the QApplication object referenced by qApp.-
139*/-
140QAccessibleApplication::QAccessibleApplication()-
141: QAccessibleObject(qApp)-
142{-
143}
never executed: end of block
0
144-
145QWindow *QAccessibleApplication::window() const-
146{-
147 // an application can have several windows, and AFAIK we don't need-
148 // to notify about changes on the application.-
149 return 0;
never executed: return 0;
0
150}-
151-
152// all toplevel windows except popups and the desktop-
153static QObjectList topLevelObjects()-
154{-
155 QObjectList list;-
156 const QWindowList tlw(QGuiApplication::topLevelWindows());-
157 for (int i = 0; i < tlw.count(); ++i) {
i < tlw.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
158 QWindow *w = tlw.at(i);-
159 if (w->type() != Qt::Popup && w->type() != Qt::Desktop) {
w->type() != Qt::PopupDescription
TRUEnever evaluated
FALSEnever evaluated
w->type() != Qt::DesktopDescription
TRUEnever evaluated
FALSEnever evaluated
0
160 if (QAccessibleInterface *root = w->accessibleRoot()) {
QAccessibleInt...cessibleRoot()Description
TRUEnever evaluated
FALSEnever evaluated
0
161 if (root->object())
root->object()Description
TRUEnever evaluated
FALSEnever evaluated
0
162 list.append(root->object());
never executed: list.append(root->object());
0
163 }
never executed: end of block
0
164 }
never executed: end of block
0
165 }
never executed: end of block
0
166-
167 return list;
never executed: return list;
0
168}-
169-
170/*! \reimp */-
171int QAccessibleApplication::childCount() const-
172{-
173 return topLevelObjects().count();
never executed: return topLevelObjects().count();
0
174}-
175-
176/*! \reimp */-
177int QAccessibleApplication::indexOfChild(const QAccessibleInterface *child) const-
178{-
179 if (!child)
!childDescription
TRUEnever evaluated
FALSEnever evaluated
0
180 return -1;
never executed: return -1;
0
181 const QObjectList tlw(topLevelObjects());-
182 return tlw.indexOf(child->object());
never executed: return tlw.indexOf(child->object());
0
183}-
184-
185QAccessibleInterface *QAccessibleApplication::parent() const-
186{-
187 return 0;
never executed: return 0;
0
188}-
189-
190QAccessibleInterface *QAccessibleApplication::child(int index) const-
191{-
192 const QObjectList tlo(topLevelObjects());-
193 if (index >= 0 && index < tlo.count())
index >= 0Description
TRUEnever evaluated
FALSEnever evaluated
index < tlo.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
194 return QAccessible::queryAccessibleInterface(tlo.at(index));
never executed: return QAccessible::queryAccessibleInterface(tlo.at(index));
0
195 return 0;
never executed: return 0;
0
196}-
197-
198-
199/*! \reimp */-
200QAccessibleInterface *QAccessibleApplication::focusChild() const-
201{-
202 if (QWindow *window = QGuiApplication::focusWindow())
QWindow *windo...:focusWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
203 return window->accessibleRoot();
never executed: return window->accessibleRoot();
0
204 return 0;
never executed: return 0;
0
205}-
206-
207/*! \reimp */-
208QString QAccessibleApplication::text(QAccessible::Text t) const-
209{-
210 switch (t) {-
211 case QAccessible::Name:
never executed: case QAccessible::Name:
0
212 return QGuiApplication::applicationName();
never executed: return QGuiApplication::applicationName();
0
213 case QAccessible::Description:
never executed: case QAccessible::Description:
0
214 return QGuiApplication::applicationFilePath();
never executed: return QGuiApplication::applicationFilePath();
0
215 default:
never executed: default:
0
216 break;
never executed: break;
0
217 }-
218 return QString();
never executed: return QString();
0
219}-
220-
221/*! \reimp */-
222QAccessible::Role QAccessibleApplication::role() const-
223{-
224 return QAccessible::Application;
never executed: return QAccessible::Application;
0
225}-
226-
227/*! \reimp */-
228QAccessible::State QAccessibleApplication::state() const-
229{-
230 return QAccessible::State();
never executed: return QAccessible::State();
0
231}-
232-
233-
234QT_END_NAMESPACE-
235-
236#endif //QT_NO_ACCESSIBILITY-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9