Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
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 Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/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 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | #include "qaccessiblewidget.h" | - |
43 | | - |
44 | #ifndef QT_NO_ACCESSIBILITY | - |
45 | | - |
46 | #include "qaction.h" | - |
47 | #include "qapplication.h" | - |
48 | #include "qgroupbox.h" | - |
49 | #include "qlabel.h" | - |
50 | #include "qtooltip.h" | - |
51 | #include "qwhatsthis.h" | - |
52 | #include "qwidget.h" | - |
53 | #include "qdebug.h" | - |
54 | #include <qmath.h> | - |
55 | #include <QRubberBand> | - |
56 | #include <QFocusFrame> | - |
57 | #include <QMenu> | - |
58 | | - |
59 | QT_BEGIN_NAMESPACE | - |
60 | | - |
61 | static QList<QWidget*> childWidgets(const QWidget *widget) | - |
62 | { | - |
63 | QList<QObject*> list = widget->children(); executed (the execution status of this line is deduced): QList<QObject*> list = widget->children(); | - |
64 | QList<QWidget*> widgets; executed (the execution status of this line is deduced): QList<QWidget*> widgets; | - |
65 | for (int i = 0; i < list.size(); ++i) { evaluated: i < list.size() yes Evaluation Count:300 | yes Evaluation Count:85 |
| 85-300 |
66 | QWidget *w = qobject_cast<QWidget *>(list.at(i)); executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget *>(list.at(i)); | - |
67 | if (w && !w->isWindow() evaluated: w yes Evaluation Count:243 | yes Evaluation Count:57 |
partially evaluated: !w->isWindow() yes Evaluation Count:243 | no Evaluation Count:0 |
| 0-243 |
68 | && !qobject_cast<QFocusFrame*>(w) partially evaluated: !qobject_cast<QFocusFrame*>(w) yes Evaluation Count:243 | no Evaluation Count:0 |
| 0-243 |
69 | #if !defined(QT_NO_MENU) executed (the execution status of this line is deduced):
| - |
70 | && !qobject_cast<QMenu*>(w) partially evaluated: !qobject_cast<QMenu*>(w) yes Evaluation Count:243 | no Evaluation Count:0 |
| 0-243 |
71 | #endif executed (the execution status of this line is deduced):
| - |
72 | && w->objectName() != QLatin1String("qt_rubberband")) partially evaluated: w->objectName() != QLatin1String("qt_rubberband") yes Evaluation Count:243 | no Evaluation Count:0 |
| 0-243 |
73 | widgets.append(w); executed: widgets.append(w); Execution Count:243 | 243 |
74 | } executed: } Execution Count:300 | 300 |
75 | return widgets; executed: return widgets; Execution Count:85 | 85 |
76 | } | - |
77 | | - |
78 | static QString buddyString(const QWidget *widget) | - |
79 | { | - |
80 | if (!widget) partially evaluated: !widget no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
81 | return QString(); never executed: return QString(); | 0 |
82 | QWidget *parent = widget->parentWidget(); executed (the execution status of this line is deduced): QWidget *parent = widget->parentWidget(); | - |
83 | if (!parent) partially evaluated: !parent no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
84 | return QString(); never executed: return QString(); | 0 |
85 | #ifndef QT_NO_SHORTCUT | - |
86 | QObjectList ol = parent->children(); executed (the execution status of this line is deduced): QObjectList ol = parent->children(); | - |
87 | for (int i = 0; i < ol.size(); ++i) { partially evaluated: i < ol.size() yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
88 | QLabel *label = qobject_cast<QLabel*>(ol.at(i)); executed (the execution status of this line is deduced): QLabel *label = qobject_cast<QLabel*>(ol.at(i)); | - |
89 | if (label && label->buddy() == widget) evaluated: label yes Evaluation Count:8 | yes Evaluation Count:8 |
partially evaluated: label->buddy() == widget yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
90 | return label->text(); executed: return label->text(); Execution Count:8 | 8 |
91 | } executed: } Execution Count:8 | 8 |
92 | #endif | - |
93 | | - |
94 | #ifndef QT_NO_GROUPBOX | - |
95 | QGroupBox *groupbox = qobject_cast<QGroupBox*>(parent); never executed (the execution status of this line is deduced): QGroupBox *groupbox = qobject_cast<QGroupBox*>(parent); | - |
96 | if (groupbox) never evaluated: groupbox | 0 |
97 | return groupbox->title(); never executed: return groupbox->title(); | 0 |
98 | #endif | - |
99 | | - |
100 | return QString(); never executed: return QString(); | 0 |
101 | } | - |
102 | | - |
103 | /* This function will return the offset of the '&' in the text that would be | - |
104 | preceding the accelerator character. | - |
105 | If this text does not have an accelerator, -1 will be returned. */ | - |
106 | static int qt_accAmpIndex(const QString &text) | - |
107 | { | - |
108 | #ifndef QT_NO_SHORTCUT | - |
109 | if (text.isEmpty()) evaluated: text.isEmpty() yes Evaluation Count:9 | yes Evaluation Count:55 |
| 9-55 |
110 | return -1; executed: return -1; Execution Count:9 | 9 |
111 | | - |
112 | int fa = 0; executed (the execution status of this line is deduced): int fa = 0; | - |
113 | QChar ac; executed (the execution status of this line is deduced): QChar ac; | - |
114 | while ((fa = text.indexOf(QLatin1Char('&'), fa)) != -1) { evaluated: (fa = text.indexOf(QLatin1Char('&'), fa)) != -1 yes Evaluation Count:17 | yes Evaluation Count:43 |
| 17-43 |
115 | ++fa; executed (the execution status of this line is deduced): ++fa; | - |
116 | if (fa < text.length()) { evaluated: fa < text.length() yes Evaluation Count:16 | yes Evaluation Count:1 |
| 1-16 |
117 | // ignore "&&" | - |
118 | if (text.at(fa) == QLatin1Char('&')) { evaluated: text.at(fa) == QLatin1Char('&') yes Evaluation Count:4 | yes Evaluation Count:12 |
| 4-12 |
119 | | - |
120 | ++fa; executed (the execution status of this line is deduced): ++fa; | - |
121 | continue; executed: continue; Execution Count:4 | 4 |
122 | } else { | - |
123 | return fa - 1; executed: return fa - 1; Execution Count:12 | 12 |
124 | break; | - |
125 | } | - |
126 | } | - |
127 | } executed: } Execution Count:1 | 1 |
128 | | - |
129 | return -1; executed: return -1; Execution Count:43 | 43 |
130 | #else | - |
131 | Q_UNUSED(text); | - |
132 | return -1; | - |
133 | #endif | - |
134 | } | - |
135 | | - |
136 | QString Q_WIDGETS_EXPORT qt_accStripAmp(const QString &text) | - |
137 | { | - |
138 | QString newText(text); executed (the execution status of this line is deduced): QString newText(text); | - |
139 | int ampIndex = qt_accAmpIndex(newText); executed (the execution status of this line is deduced): int ampIndex = qt_accAmpIndex(newText); | - |
140 | if (ampIndex != -1) evaluated: ampIndex != -1 yes Evaluation Count:5 | yes Evaluation Count:46 |
| 5-46 |
141 | newText.remove(ampIndex, 1); executed: newText.remove(ampIndex, 1); Execution Count:5 | 5 |
142 | | - |
143 | return newText.replace(QLatin1String("&&"), QLatin1String("&")); executed: return newText.replace(QLatin1String("&&"), QLatin1String("&")); Execution Count:51 | 51 |
144 | } | - |
145 | | - |
146 | QString Q_WIDGETS_EXPORT qt_accHotKey(const QString &text) | - |
147 | { | - |
148 | int ampIndex = qt_accAmpIndex(text); executed (the execution status of this line is deduced): int ampIndex = qt_accAmpIndex(text); | - |
149 | if (ampIndex != -1) evaluated: ampIndex != -1 yes Evaluation Count:7 | yes Evaluation Count:6 |
| 6-7 |
150 | return QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + text.at(ampIndex + 1); executed: return QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + text.at(ampIndex + 1); Execution Count:7 | 7 |
151 | | - |
152 | return QString(); executed: return QString(); Execution Count:6 | 6 |
153 | } | - |
154 | | - |
155 | class QAccessibleWidgetPrivate | - |
156 | { | - |
157 | public: | - |
158 | QAccessibleWidgetPrivate() | - |
159 | :role(QAccessible::Client) | - |
160 | {} executed: } Execution Count:203 | 203 |
161 | | - |
162 | QAccessible::Role role; | - |
163 | QString name; | - |
164 | QStringList primarySignals; | - |
165 | }; | - |
166 | | - |
167 | /*! | - |
168 | \class QAccessibleWidget | - |
169 | \brief The QAccessibleWidget class implements the QAccessibleInterface for QWidgets. | - |
170 | \internal | - |
171 | | - |
172 | \ingroup accessibility | - |
173 | \inmodule QtWidgets | - |
174 | | - |
175 | This class is part of \l {Accessibility for QWidget Applications}. | - |
176 | | - |
177 | This class is convenient to use as a base class for custom | - |
178 | implementations of QAccessibleInterfaces that provide information | - |
179 | about widget objects. | - |
180 | | - |
181 | The class provides functions to retrieve the parentObject() (the | - |
182 | widget's parent widget), and the associated widget(). Controlling | - |
183 | signals can be added with addControllingSignal(), and setters are | - |
184 | provided for various aspects of the interface implementation, for | - |
185 | example setValue(), setDescription(), setAccelerator(), and | - |
186 | setHelp(). | - |
187 | | - |
188 | \sa QAccessible, QAccessibleObject | - |
189 | */ | - |
190 | | - |
191 | /*! | - |
192 | Creates a QAccessibleWidget object for widget \a w. | - |
193 | \a role and \a name are optional parameters that set the object's | - |
194 | role and name properties. | - |
195 | */ | - |
196 | QAccessibleWidget::QAccessibleWidget(QWidget *w, QAccessible::Role role, const QString &name) | - |
197 | : QAccessibleObject(w) | - |
198 | { | - |
199 | Q_ASSERT(widget()); executed (the execution status of this line is deduced): qt_noop(); | - |
200 | d = new QAccessibleWidgetPrivate(); executed (the execution status of this line is deduced): d = new QAccessibleWidgetPrivate(); | - |
201 | d->role = role; executed (the execution status of this line is deduced): d->role = role; | - |
202 | d->name = name; executed (the execution status of this line is deduced): d->name = name; | - |
203 | } executed: } Execution Count:203 | 203 |
204 | | - |
205 | /*! \reimp */ | - |
206 | QWindow *QAccessibleWidget::window() const | - |
207 | { | - |
208 | return widget()->windowHandle(); never executed: return widget()->windowHandle(); | 0 |
209 | } | - |
210 | | - |
211 | /*! | - |
212 | Destroys this object. | - |
213 | */ | - |
214 | QAccessibleWidget::~QAccessibleWidget() | - |
215 | { | - |
216 | delete d; executed (the execution status of this line is deduced): delete d; | - |
217 | } executed: } Execution Count:156 | 156 |
218 | | - |
219 | /*! | - |
220 | Returns the associated widget. | - |
221 | */ | - |
222 | QWidget *QAccessibleWidget::widget() const | - |
223 | { | - |
224 | return qobject_cast<QWidget*>(object()); executed: return qobject_cast<QWidget*>(object()); Execution Count:533 | 533 |
225 | } | - |
226 | | - |
227 | /*! | - |
228 | Returns the associated widget's parent object, which is either the | - |
229 | parent widget, or qApp for top-level widgets. | - |
230 | */ | - |
231 | QObject *QAccessibleWidget::parentObject() const | - |
232 | { | - |
233 | QObject *parent = object()->parent(); never executed (the execution status of this line is deduced): QObject *parent = object()->parent(); | - |
234 | if (!parent) | 0 |
235 | parent = qApp; never executed: parent = (static_cast<QApplication *>(QCoreApplication::instance())); | 0 |
236 | return parent; never executed: return parent; | 0 |
237 | } | - |
238 | | - |
239 | /*! \reimp */ | - |
240 | QRect QAccessibleWidget::rect() const | - |
241 | { | - |
242 | QWidget *w = widget(); executed (the execution status of this line is deduced): QWidget *w = widget(); | - |
243 | if (!w->isVisible()) evaluated: !w->isVisible() yes Evaluation Count:7 | yes Evaluation Count:37 |
| 7-37 |
244 | return QRect(); executed: return QRect(); Execution Count:7 | 7 |
245 | QPoint wpos = w->mapToGlobal(QPoint(0, 0)); executed (the execution status of this line is deduced): QPoint wpos = w->mapToGlobal(QPoint(0, 0)); | - |
246 | | - |
247 | return QRect(wpos.x(), wpos.y(), w->width(), w->height()); executed: return QRect(wpos.x(), wpos.y(), w->width(), w->height()); Execution Count:37 | 37 |
248 | } | - |
249 | | - |
250 | QT_BEGIN_INCLUDE_NAMESPACE | - |
251 | #include <private/qobject_p.h> | - |
252 | QT_END_INCLUDE_NAMESPACE | - |
253 | | - |
254 | class QACConnectionObject : public QObject | - |
255 | { | - |
256 | Q_DECLARE_PRIVATE(QObject) never executed: return reinterpret_cast<QObjectPrivate *>(qGetPtrHelper(d_ptr)); executed: return reinterpret_cast<const QObjectPrivate *>(qGetPtrHelper(d_ptr)); Execution Count:1 | 0-1 |
257 | public: | - |
258 | inline bool isSender(const QObject *receiver, const char *signal) const | - |
259 | { return d_func()->isSender(receiver, signal); } never executed: return d_func()->isSender(receiver, signal); | 0 |
260 | inline QObjectList receiverList(const char *signal) const | - |
261 | { return d_func()->receiverList(signal); } executed: return d_func()->receiverList(signal); Execution Count:1 | 1 |
262 | inline QObjectList senderList() const | - |
263 | { return d_func()->senderList(); } never executed: return d_func()->senderList(); | 0 |
264 | }; | - |
265 | | - |
266 | /*! | - |
267 | Registers \a signal as a controlling signal. | - |
268 | | - |
269 | An object is a Controller to any other object connected to a | - |
270 | controlling signal. | - |
271 | */ | - |
272 | void QAccessibleWidget::addControllingSignal(const QString &signal) | - |
273 | { | - |
274 | QByteArray s = QMetaObject::normalizedSignature(signal.toLatin1()); executed (the execution status of this line is deduced): QByteArray s = QMetaObject::normalizedSignature(signal.toLatin1()); | - |
275 | if (object()->metaObject()->indexOfSignal(s) < 0) partially evaluated: object()->metaObject()->indexOfSignal(s) < 0 no Evaluation Count:0 | yes Evaluation Count:62 |
| 0-62 |
276 | qWarning("Signal %s unknown in %s", s.constData(), object()->metaObject()->className()); never executed: QMessageLogger("accessible/qaccessiblewidget.cpp", 276, __PRETTY_FUNCTION__).warning("Signal %s unknown in %s", s.constData(), object()->metaObject()->className()); | 0 |
277 | d->primarySignals << QLatin1String(s); executed (the execution status of this line is deduced): d->primarySignals << QLatin1String(s); | - |
278 | } executed: } Execution Count:62 | 62 |
279 | | - |
280 | static inline bool isAncestor(const QObject *obj, const QObject *child) | - |
281 | { | - |
282 | while (child) { | 0 |
283 | if (child == obj) never evaluated: child == obj | 0 |
284 | return true; never executed: return true; | 0 |
285 | child = child->parent(); never executed (the execution status of this line is deduced): child = child->parent(); | - |
286 | } | 0 |
287 | return false; never executed: return false; | 0 |
288 | } | - |
289 | | - |
290 | /*! \reimp */ | - |
291 | QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > | - |
292 | QAccessibleWidget::relations(QAccessible::Relation match /*= QAccessible::AllRelations*/) const | - |
293 | { | - |
294 | QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > rels; executed (the execution status of this line is deduced): QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > rels; | - |
295 | if (match & QAccessible::Label) { partially evaluated: match & QAccessible::Label yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
296 | const QAccessible::Relation rel = QAccessible::Label; executed (the execution status of this line is deduced): const QAccessible::Relation rel = QAccessible::Label; | - |
297 | if (QWidget *parent = widget()->parentWidget()) { partially evaluated: QWidget *parent = widget()->parentWidget() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
298 | #ifndef QT_NO_SHORTCUT | - |
299 | // first check for all siblings that are labels to us | - |
300 | // ideally we would go through all objects and check, but that | - |
301 | // will be too expensive | - |
302 | const QList<QWidget*> kids = childWidgets(parent); executed (the execution status of this line is deduced): const QList<QWidget*> kids = childWidgets(parent); | - |
303 | for (int i = 0; i < kids.count(); ++i) { evaluated: i < kids.count() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
304 | if (QLabel *labelSibling = qobject_cast<QLabel*>(kids.at(i))) { partially evaluated: QLabel *labelSibling = qobject_cast<QLabel*>(kids.at(i)) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
305 | if (labelSibling->buddy() == widget()) { never evaluated: labelSibling->buddy() == widget() | 0 |
306 | QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(labelSibling); never executed (the execution status of this line is deduced): QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(labelSibling); | - |
307 | rels.append(qMakePair(iface, rel)); never executed (the execution status of this line is deduced): rels.append(qMakePair(iface, rel)); | - |
308 | } | 0 |
309 | } | 0 |
310 | } executed: } Execution Count:1 | 1 |
311 | #endif | - |
312 | #ifndef QT_NO_GROUPBOX | - |
313 | QGroupBox *groupbox = qobject_cast<QGroupBox*>(parent); executed (the execution status of this line is deduced): QGroupBox *groupbox = qobject_cast<QGroupBox*>(parent); | - |
314 | if (groupbox && !groupbox->title().isEmpty()) { partially evaluated: groupbox yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: !groupbox->title().isEmpty() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
315 | QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(groupbox); executed (the execution status of this line is deduced): QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(groupbox); | - |
316 | rels.append(qMakePair(iface, rel)); executed (the execution status of this line is deduced): rels.append(qMakePair(iface, rel)); | - |
317 | } executed: } Execution Count:1 | 1 |
318 | #endif | - |
319 | } executed: } Execution Count:1 | 1 |
320 | } executed: } Execution Count:1 | 1 |
321 | | - |
322 | if (match & QAccessible::Controlled) { partially evaluated: match & QAccessible::Controlled yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
323 | QObjectList allReceivers; executed (the execution status of this line is deduced): QObjectList allReceivers; | - |
324 | QACConnectionObject *connectionObject = (QACConnectionObject*)object(); executed (the execution status of this line is deduced): QACConnectionObject *connectionObject = (QACConnectionObject*)object(); | - |
325 | for (int sig = 0; sig < d->primarySignals.count(); ++sig) { evaluated: sig < d->primarySignals.count() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
326 | const QObjectList receivers = connectionObject->receiverList(d->primarySignals.at(sig).toLatin1()); executed (the execution status of this line is deduced): const QObjectList receivers = connectionObject->receiverList(d->primarySignals.at(sig).toLatin1()); | - |
327 | allReceivers += receivers; executed (the execution status of this line is deduced): allReceivers += receivers; | - |
328 | } executed: } Execution Count:1 | 1 |
329 | | - |
330 | allReceivers.removeAll(object()); //### The object might connect to itself internally executed (the execution status of this line is deduced): allReceivers.removeAll(object()); | - |
331 | | - |
332 | for (int i = 0; i < allReceivers.count(); ++i) { partially evaluated: i < allReceivers.count() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
333 | const QAccessible::Relation rel = QAccessible::Controlled; never executed (the execution status of this line is deduced): const QAccessible::Relation rel = QAccessible::Controlled; | - |
334 | QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(allReceivers.at(i)); never executed (the execution status of this line is deduced): QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(allReceivers.at(i)); | - |
335 | if (iface) | 0 |
336 | rels.append(qMakePair(iface, rel)); never executed: rels.append(qMakePair(iface, rel)); | 0 |
337 | } | 0 |
338 | } executed: } Execution Count:1 | 1 |
339 | | - |
340 | return rels; executed: return rels; Execution Count:1 | 1 |
341 | } | - |
342 | | - |
343 | /*! \reimp */ | - |
344 | QAccessibleInterface *QAccessibleWidget::parent() const | - |
345 | { | - |
346 | QObject *parentWidget= widget()->parentWidget(); executed (the execution status of this line is deduced): QObject *parentWidget= widget()->parentWidget(); | - |
347 | if (!parentWidget) evaluated: !parentWidget yes Evaluation Count:1 | yes Evaluation Count:20 |
| 1-20 |
348 | parentWidget = qApp; executed: parentWidget = (static_cast<QApplication *>(QCoreApplication::instance())); Execution Count:1 | 1 |
349 | return QAccessible::queryAccessibleInterface(parentWidget); executed: return QAccessible::queryAccessibleInterface(parentWidget); Execution Count:21 | 21 |
350 | } | - |
351 | | - |
352 | /*! \reimp */ | - |
353 | QAccessibleInterface *QAccessibleWidget::child(int index) const | - |
354 | { | - |
355 | QWidgetList childList = childWidgets(widget()); executed (the execution status of this line is deduced): QWidgetList childList = childWidgets(widget()); | - |
356 | if (index >= 0 && index < childList.size()) evaluated: index >= 0 yes Evaluation Count:29 | yes Evaluation Count:1 |
evaluated: index < childList.size() yes Evaluation Count:27 | yes Evaluation Count:2 |
| 1-29 |
357 | return QAccessible::queryAccessibleInterface(childList.at(index)); executed: return QAccessible::queryAccessibleInterface(childList.at(index)); Execution Count:27 | 27 |
358 | return 0; executed: return 0; Execution Count:3 | 3 |
359 | } | - |
360 | | - |
361 | /*! \reimp */ | - |
362 | QAccessibleInterface *QAccessibleWidget::focusChild() const | - |
363 | { | - |
364 | if (widget()->hasFocus()) never evaluated: widget()->hasFocus() | 0 |
365 | return QAccessible::queryAccessibleInterface(object()); never executed: return QAccessible::queryAccessibleInterface(object()); | 0 |
366 | | - |
367 | QWidget *fw = widget()->focusWidget(); never executed (the execution status of this line is deduced): QWidget *fw = widget()->focusWidget(); | - |
368 | if (!fw) | 0 |
369 | return 0; never executed: return 0; | 0 |
370 | | - |
371 | if (isAncestor(widget(), fw) || fw == widget()) never evaluated: isAncestor(widget(), fw) never evaluated: fw == widget() | 0 |
372 | return QAccessible::queryAccessibleInterface(fw); never executed: return QAccessible::queryAccessibleInterface(fw); | 0 |
373 | return 0; never executed: return 0; | 0 |
374 | } | - |
375 | | - |
376 | /*! \reimp */ | - |
377 | int QAccessibleWidget::childCount() const | - |
378 | { | - |
379 | QWidgetList cl = childWidgets(widget()); executed (the execution status of this line is deduced): QWidgetList cl = childWidgets(widget()); | - |
380 | return cl.size(); executed: return cl.size(); Execution Count:44 | 44 |
381 | } | - |
382 | | - |
383 | /*! \reimp */ | - |
384 | int QAccessibleWidget::indexOfChild(const QAccessibleInterface *child) const | - |
385 | { | - |
386 | QWidgetList cl = childWidgets(widget()); executed (the execution status of this line is deduced): QWidgetList cl = childWidgets(widget()); | - |
387 | return cl.indexOf(qobject_cast<QWidget *>(child->object())); executed: return cl.indexOf(qobject_cast<QWidget *>(child->object())); Execution Count:10 | 10 |
388 | } | - |
389 | | - |
390 | // from qwidget.cpp | - |
391 | extern QString qt_setWindowTitle_helperHelper(const QString &, const QWidget*); | - |
392 | | - |
393 | /*! \reimp */ | - |
394 | QString QAccessibleWidget::text(QAccessible::Text t) const | - |
395 | { | - |
396 | QString str; executed (the execution status of this line is deduced): QString str; | - |
397 | | - |
398 | switch (t) { | - |
399 | case QAccessible::Name: | - |
400 | if (!d->name.isEmpty()) { partially evaluated: !d->name.isEmpty() no Evaluation Count:0 | yes Evaluation Count:19 |
| 0-19 |
401 | str = d->name; never executed (the execution status of this line is deduced): str = d->name; | - |
402 | } else if (!widget()->accessibleName().isEmpty()) { never executed: } evaluated: !widget()->accessibleName().isEmpty() yes Evaluation Count:17 | yes Evaluation Count:2 |
| 0-17 |
403 | str = widget()->accessibleName(); executed (the execution status of this line is deduced): str = widget()->accessibleName(); | - |
404 | } else if (widget()->isWindow()) { executed: } Execution Count:17 partially evaluated: widget()->isWindow() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-17 |
405 | if (widget()->isMinimized()) partially evaluated: widget()->isMinimized() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
406 | str = qt_setWindowTitle_helperHelper(widget()->windowIconText(), widget()); never executed: str = qt_setWindowTitle_helperHelper(widget()->windowIconText(), widget()); | 0 |
407 | else | - |
408 | str = qt_setWindowTitle_helperHelper(widget()->windowTitle(), widget()); executed: str = qt_setWindowTitle_helperHelper(widget()->windowTitle(), widget()); Execution Count:2 | 2 |
409 | } else { | - |
410 | str = qt_accStripAmp(buddyString(widget())); never executed (the execution status of this line is deduced): str = qt_accStripAmp(buddyString(widget())); | - |
411 | } | 0 |
412 | break; executed: break; Execution Count:19 | 19 |
413 | case QAccessible::Description: | - |
414 | if (!widget()->accessibleDescription().isEmpty()) evaluated: !widget()->accessibleDescription().isEmpty() yes Evaluation Count:24 | yes Evaluation Count:1 |
| 1-24 |
415 | str = widget()->accessibleDescription(); executed: str = widget()->accessibleDescription(); Execution Count:24 | 24 |
416 | #ifndef QT_NO_TOOLTIP | - |
417 | else | - |
418 | str = widget()->toolTip(); executed: str = widget()->toolTip(); Execution Count:1 | 1 |
419 | #endif | - |
420 | break; executed: break; Execution Count:25 | 25 |
421 | case QAccessible::Help: | - |
422 | #ifndef QT_NO_WHATSTHIS | - |
423 | str = widget()->whatsThis(); never executed (the execution status of this line is deduced): str = widget()->whatsThis(); | - |
424 | #endif | - |
425 | break; | 0 |
426 | case QAccessible::Accelerator: | - |
427 | str = qt_accHotKey(buddyString(widget())); executed (the execution status of this line is deduced): str = qt_accHotKey(buddyString(widget())); | - |
428 | break; executed: break; Execution Count:8 | 8 |
429 | case QAccessible::Value: | - |
430 | break; executed: break; Execution Count:3 | 3 |
431 | default: | - |
432 | break; | 0 |
433 | } | - |
434 | return str; executed: return str; Execution Count:55 | 55 |
435 | } | - |
436 | | - |
437 | /*! \reimp */ | - |
438 | QStringList QAccessibleWidget::actionNames() const | - |
439 | { | - |
440 | QStringList names; executed (the execution status of this line is deduced): QStringList names; | - |
441 | if (widget()->isEnabled()) { partially evaluated: widget()->isEnabled() yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
442 | if (widget()->focusPolicy() != Qt::NoFocus) evaluated: widget()->focusPolicy() != Qt::NoFocus yes Evaluation Count:12 | yes Evaluation Count:2 |
| 2-12 |
443 | names << setFocusAction(); executed: names << setFocusAction(); Execution Count:12 | 12 |
444 | } executed: } Execution Count:14 | 14 |
445 | return names; executed: return names; Execution Count:14 | 14 |
446 | } | - |
447 | | - |
448 | /*! \reimp */ | - |
449 | void QAccessibleWidget::doAction(const QString &actionName) | - |
450 | { | - |
451 | if (!widget()->isEnabled()) partially evaluated: !widget()->isEnabled() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
452 | return; | 0 |
453 | | - |
454 | if (actionName == setFocusAction()) { partially evaluated: actionName == setFocusAction() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
455 | if (widget()->isWindow()) partially evaluated: widget()->isWindow() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
456 | widget()->activateWindow(); executed: widget()->activateWindow(); Execution Count:1 | 1 |
457 | widget()->setFocus(); executed (the execution status of this line is deduced): widget()->setFocus(); | - |
458 | } executed: } Execution Count:1 | 1 |
459 | } executed: } Execution Count:1 | 1 |
460 | | - |
461 | /*! \reimp */ | - |
462 | QStringList QAccessibleWidget::keyBindingsForAction(const QString & /* actionName */) const | - |
463 | { | - |
464 | return QStringList(); never executed: return QStringList(); | 0 |
465 | } | - |
466 | | - |
467 | /*! \reimp */ | - |
468 | QAccessible::Role QAccessibleWidget::role() const | - |
469 | { | - |
470 | return d->role; executed: return d->role; Execution Count:43 | 43 |
471 | } | - |
472 | | - |
473 | /*! \reimp */ | - |
474 | QAccessible::State QAccessibleWidget::state() const | - |
475 | { | - |
476 | QAccessible::State state; executed (the execution status of this line is deduced): QAccessible::State state; | - |
477 | | - |
478 | QWidget *w = widget(); executed (the execution status of this line is deduced): QWidget *w = widget(); | - |
479 | if (w->testAttribute(Qt::WA_WState_Visible) == false) evaluated: w->testAttribute(Qt::WA_WState_Visible) == false yes Evaluation Count:17 | yes Evaluation Count:23 |
| 17-23 |
480 | state.invisible = true; executed: state.invisible = true; Execution Count:17 | 17 |
481 | if (w->focusPolicy() != Qt::NoFocus) evaluated: w->focusPolicy() != Qt::NoFocus yes Evaluation Count:29 | yes Evaluation Count:11 |
| 11-29 |
482 | state.focusable = true; executed: state.focusable = true; Execution Count:29 | 29 |
483 | if (w->hasFocus()) partially evaluated: w->hasFocus() no Evaluation Count:0 | yes Evaluation Count:40 |
| 0-40 |
484 | state.focused = true; never executed: state.focused = true; | 0 |
485 | if (!w->isEnabled()) partially evaluated: !w->isEnabled() no Evaluation Count:0 | yes Evaluation Count:40 |
| 0-40 |
486 | state.disabled = true; never executed: state.disabled = true; | 0 |
487 | if (w->isWindow()) { evaluated: w->isWindow() yes Evaluation Count:24 | yes Evaluation Count:16 |
| 16-24 |
488 | if (w->windowFlags() & Qt::WindowSystemMenuHint) evaluated: w->windowFlags() & Qt::WindowSystemMenuHint yes Evaluation Count:21 | yes Evaluation Count:3 |
| 3-21 |
489 | state.movable = true; executed: state.movable = true; Execution Count:21 | 21 |
490 | if (w->minimumSize() != w->maximumSize()) partially evaluated: w->minimumSize() != w->maximumSize() yes Evaluation Count:24 | no Evaluation Count:0 |
| 0-24 |
491 | state.sizeable = true; executed: state.sizeable = true; Execution Count:24 | 24 |
492 | if (w->isActiveWindow()) evaluated: w->isActiveWindow() yes Evaluation Count:1 | yes Evaluation Count:23 |
| 1-23 |
493 | state.active = true; executed: state.active = true; Execution Count:1 | 1 |
494 | } executed: } Execution Count:24 | 24 |
495 | | - |
496 | return state; executed: return state; Execution Count:40 | 40 |
497 | } | - |
498 | | - |
499 | /*! \reimp */ | - |
500 | QColor QAccessibleWidget::foregroundColor() const | - |
501 | { | - |
502 | return widget()->palette().color(widget()->foregroundRole()); never executed: return widget()->palette().color(widget()->foregroundRole()); | 0 |
503 | } | - |
504 | | - |
505 | /*! \reimp */ | - |
506 | QColor QAccessibleWidget::backgroundColor() const | - |
507 | { | - |
508 | return widget()->palette().color(widget()->backgroundRole()); never executed: return widget()->palette().color(widget()->backgroundRole()); | 0 |
509 | } | - |
510 | | - |
511 | /*! \reimp */ | - |
512 | void *QAccessibleWidget::interface_cast(QAccessible::InterfaceType t) | - |
513 | { | - |
514 | if (t == QAccessible::ActionInterface) partially evaluated: t == QAccessible::ActionInterface yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
515 | return static_cast<QAccessibleActionInterface*>(this); executed: return static_cast<QAccessibleActionInterface*>(this); Execution Count:13 | 13 |
516 | return 0; never executed: return 0; | 0 |
517 | } | - |
518 | | - |
519 | QT_END_NAMESPACE | - |
520 | | - |
521 | #endif //QT_NO_ACCESSIBILITY | - |
522 | | - |
| | |