OpenCoverage

qaccessiblequickitem.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/accessible/qaccessiblequickitem.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7QAccessibleQuickItem::QAccessibleQuickItem(QQuickItem *item)-
8 : QAccessibleObject(item), m_doc(textDocument())-
9{-
10}
executed 84 times by 2 tests: end of block
Executed by:
  • tst_qquickaccessible
  • tst_qquickitem2
84
11-
12QWindow *QAccessibleQuickItem::window() const-
13{-
14 return
never executed: return item()->window();
item()->window();
never executed: return item()->window();
0
15}-
16-
17int QAccessibleQuickItem::childCount() const-
18{-
19 return
executed 28 times by 1 test: return childItems().count();
Executed by:
  • tst_qquickaccessible
childItems().count();
executed 28 times by 1 test: return childItems().count();
Executed by:
  • tst_qquickaccessible
28
20}-
21-
22QRect QAccessibleQuickItem::rect() const-
23{-
24 const QRect r = itemScreenRect(item());-
25 return
executed 164 times by 1 test: return r;
Executed by:
  • tst_qquickaccessible
r;
executed 164 times by 1 test: return r;
Executed by:
  • tst_qquickaccessible
164
26}-
27-
28QRect QAccessibleQuickItem::viewRect() const-
29{-
30-
31 if (!item()->window()
!item()->window()Description
TRUEnever evaluated
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquickaccessible
) {
0-80
32 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
33 }-
34-
35 QQuickWindow *window = item()->window();-
36 QPoint screenPos = window->mapToGlobal(QPoint(0,0));-
37 return
executed 80 times by 1 test: return QRect(screenPos, window->size());
Executed by:
  • tst_qquickaccessible
QRect(screenPos, window->size());
executed 80 times by 1 test: return QRect(screenPos, window->size());
Executed by:
  • tst_qquickaccessible
80
38}-
39-
40-
41bool QAccessibleQuickItem::clipsChildren() const-
42{-
43 return
never executed: return static_cast<QQuickItem *>(item())->clip();
static_cast<QQuickItem *>(item())->clip();
never executed: return static_cast<QQuickItem *>(item())->clip();
0
44}-
45-
46QAccessibleInterface *QAccessibleQuickItem::childAt(int x, int y) const-
47{-
48 if (item()->clip()
item()->clip()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickaccessible
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_qquickaccessible
) {
8-52
49 if (!rect().contains(x, y)
!rect().contains(x, y)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickaccessible
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickaccessible
)
2-6
50 return
executed 2 times by 1 test: return nullptr;
Executed by:
  • tst_qquickaccessible
nullptr;
executed 2 times by 1 test: return nullptr;
Executed by:
  • tst_qquickaccessible
2
51 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickaccessible
6
52-
53 const QList<QQuickItem*> kids = accessibleUnignoredChildren(item(), true);-
54 for (int i = kids.count() - 1; i >= 0
i >= 0Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_qquickaccessible
FALSEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquickaccessible
; --i) {
46-48
55 QAccessibleInterface *childIface = QAccessible::queryAccessibleInterface(kids.at(i));-
56 if (QAccessibleInterface *childChild = childIface->childAt(x, y)
QAccessibleInt...>childAt(x, y)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickaccessible
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickaccessible
)
4-44
57 return
executed 4 times by 1 test: return childChild;
Executed by:
  • tst_qquickaccessible
childChild;
executed 4 times by 1 test: return childChild;
Executed by:
  • tst_qquickaccessible
4
58 if (childIface
childIfaceDescription
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickaccessible
FALSEnever evaluated
&& !childIface->state().invisible
!childIface->state().invisibleDescription
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickaccessible
FALSEnever evaluated
) {
0-44
59 if (childIface->rect().contains(x, y)
childIface->re...contains(x, y)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickaccessible
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_qquickaccessible
)
8-36
60 return
executed 8 times by 1 test: return childIface;
Executed by:
  • tst_qquickaccessible
childIface;
executed 8 times by 1 test: return childIface;
Executed by:
  • tst_qquickaccessible
8
61 }
executed 36 times by 1 test: end of block
Executed by:
  • tst_qquickaccessible
36
62 }
executed 36 times by 1 test: end of block
Executed by:
  • tst_qquickaccessible
36
63-
64 return
executed 46 times by 1 test: return nullptr;
Executed by:
  • tst_qquickaccessible
nullptr;
executed 46 times by 1 test: return nullptr;
Executed by:
  • tst_qquickaccessible
46
65}-
66-
67QAccessibleInterface *QAccessibleQuickItem::parent() const-
68{-
69 QQuickItem *parent = item()->parentItem();-
70 QQuickWindow *window = item()->window();-
71 QQuickItem *ci = window
windowDescription
TRUEnever evaluated
FALSEnever evaluated
? window->contentItem() : nullptr;
0
72 while (parent
parentDescription
TRUEnever evaluated
FALSEnever evaluated
&& !QQuickItemPrivate::get(parent)->isAccessible
!QQuickItemPri...->isAccessibleDescription
TRUEnever evaluated
FALSEnever evaluated
&& parent != ci
parent != ciDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
73 parent = parent->parentItem();
never executed: parent = parent->parentItem();
0
74-
75 if (parent
parentDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
76 if (parent == ci
parent == ciDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
77-
78-
79-
80-
81-
82 return
never executed: return QAccessible::queryAccessibleInterface(window);
QAccessible::queryAccessibleInterface(window);
never executed: return QAccessible::queryAccessibleInterface(window);
0
83 } else {-
84 while (parent
parentDescription
TRUEnever evaluated
FALSEnever evaluated
&& !parent->d_func()->isAccessible
!parent->d_fun...->isAccessibleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
85 parent = parent->parentItem();
never executed: parent = parent->parentItem();
0
86 return
never executed: return QAccessible::queryAccessibleInterface(parent);
QAccessible::queryAccessibleInterface(parent);
never executed: return QAccessible::queryAccessibleInterface(parent);
0
87 }-
88 }-
89 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
90}-
91-
92QAccessibleInterface *QAccessibleQuickItem::child(int index) const-
93{-
94 QList<QQuickItem *> children = childItems();-
95-
96 if (index < 0
index < 0Description
TRUEnever evaluated
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_qquickaccessible
|| index >= children.count()
index >= children.count()Description
TRUEnever evaluated
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_qquickaccessible
)
0-34
97 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
98-
99 QQuickItem *child = children.at(index);-
100 return
executed 34 times by 1 test: return QAccessible::queryAccessibleInterface(child);
Executed by:
  • tst_qquickaccessible
QAccessible::queryAccessibleInterface(child);
executed 34 times by 1 test: return QAccessible::queryAccessibleInterface(child);
Executed by:
  • tst_qquickaccessible
34
101}-
102-
103int QAccessibleQuickItem::indexOfChild(const QAccessibleInterface *iface) const-
104{-
105 QList<QQuickItem*> kids = childItems();-
106 return
executed 6 times by 1 test: return kids.indexOf(static_cast<QQuickItem*>(iface->object()));
Executed by:
  • tst_qquickaccessible
kids.indexOf(static_cast<QQuickItem*>(iface->object()));
executed 6 times by 1 test: return kids.indexOf(static_cast<QQuickItem*>(iface->object()));
Executed by:
  • tst_qquickaccessible
6
107}-
108-
109static void unignoredChildren(QQuickItem *item, QList<QQuickItem *> *items, bool paintOrder)-
110{-
111 const QList<QQuickItem*> childItems = paintOrder
paintOrderDescription
TRUEevaluated 140 times by 1 test
Evaluated by:
  • tst_qquickaccessible
FALSEevaluated 214 times by 1 test
Evaluated by:
  • tst_qquickaccessible
? QQuickItemPrivate::get(item)->paintOrderChildItems()
140-214
112 : item->childItems();-
113 for (QQuickItem *child : childItems) {-
114 if (QQuickItemPrivate::get(child)->isAccessible
QQuickItemPriv...->isAccessibleDescription
TRUEevaluated 356 times by 1 test
Evaluated by:
  • tst_qquickaccessible
FALSEevaluated 206 times by 1 test
Evaluated by:
  • tst_qquickaccessible
) {
206-356
115 items->append(child);-
116 }
executed 356 times by 1 test: end of block
Executed by:
  • tst_qquickaccessible
else {
356
117 unignoredChildren(child, items, paintOrder);-
118 }
executed 206 times by 1 test: end of block
Executed by:
  • tst_qquickaccessible
206
119 }-
120}
executed 354 times by 1 test: end of block
Executed by:
  • tst_qquickaccessible
354
121-
122QList<QQuickItem *> accessibleUnignoredChildren(QQuickItem *item, bool paintOrder)-
123{-
124 QList<QQuickItem *> items;-
125 unignoredChildren(item, &items, paintOrder);-
126 return
executed 148 times by 1 test: return items;
Executed by:
  • tst_qquickaccessible
items;
executed 148 times by 1 test: return items;
Executed by:
  • tst_qquickaccessible
148
127}-
128-
129QList<QQuickItem *> QAccessibleQuickItem::childItems() const-
130{-
131 return
executed 68 times by 1 test: return accessibleUnignoredChildren(item());
Executed by:
  • tst_qquickaccessible
accessibleUnignoredChildren(item());
executed 68 times by 1 test: return accessibleUnignoredChildren(item());
Executed by:
  • tst_qquickaccessible
68
132}-
133-
134QAccessible::State QAccessibleQuickItem::state() const-
135{-
136 QQuickAccessibleAttached *attached = QQuickAccessibleAttached::attachedProperties(item());-
137 if (!attached
!attachedDescription
TRUEnever evaluated
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquickaccessible
)
0-80
138 return
never executed: return QAccessible::State();
QAccessible::State();
never executed: return QAccessible::State();
0
139-
140 QAccessible::State state = attached->state();-
141-
142 QRect viewRect_ = viewRect();-
143 QRect itemRect = rect();-
144-
145 if (viewRect_.isNull()
viewRect_.isNull()Description
TRUEnever evaluated
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquickaccessible
|| itemRect.isNull()
itemRect.isNull()Description
TRUEnever evaluated
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquickaccessible
|| !item()->window()
!item()->window()Description
TRUEnever evaluated
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquickaccessible
|| !item()->window()->isVisible()
!item()->window()->isVisible()Description
TRUEnever evaluated
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquickaccessible
||!item()->isVisible()
!item()->isVisible()Description
TRUEnever evaluated
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquickaccessible
|| qFuzzyIsNull(item()->opacity())
qFuzzyIsNull(i...()->opacity())Description
TRUEnever evaluated
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquickaccessible
)
0-80
146 state.invisible = true;
never executed: state.invisible = true;
0
147 if (!viewRect_.intersects(itemRect)
!viewRect_.int...ects(itemRect)Description
TRUEnever evaluated
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquickaccessible
)
0-80
148 state.offscreen = true;
never executed: state.offscreen = true;
0
149 if ((role() == QAccessible::CheckBox
role() == QAcc...ible::CheckBoxDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickaccessible
FALSEevaluated 68 times by 1 test
Evaluated by:
  • tst_qquickaccessible
|| role() == QAccessible::RadioButton
role() == QAcc...e::RadioButtonDescription
TRUEnever evaluated
FALSEevaluated 68 times by 1 test
Evaluated by:
  • tst_qquickaccessible
) && object()->property("checked").toBool()
object()->prop...ked").toBool()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickaccessible
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickaccessible
)
0-68
150 state.checked = true;
executed 6 times by 1 test: state.checked = true;
Executed by:
  • tst_qquickaccessible
6
151 if (item()->activeFocusOnTab()
item()->activeFocusOnTab()Description
TRUEnever evaluated
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquickaccessible
|| role() == QAccessible::EditableText
role() == QAcc...::EditableTextDescription
TRUEnever evaluated
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquickaccessible
)
0-80
152 state.focusable = true;
never executed: state.focusable = true;
0
153 if (item()->hasActiveFocus()
item()->hasActiveFocus()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickaccessible
FALSEevaluated 76 times by 1 test
Evaluated by:
  • tst_qquickaccessible
)
4-76
154 state.focused = true;
executed 4 times by 1 test: state.focused = true;
Executed by:
  • tst_qquickaccessible
4
155 return
executed 80 times by 1 test: return state;
Executed by:
  • tst_qquickaccessible
state;
executed 80 times by 1 test: return state;
Executed by:
  • tst_qquickaccessible
80
156}-
157-
158QAccessible::Role QAccessibleQuickItem::role() const-
159{-
160-
161-
162-
163 if (qobject_cast<QQuickText*>(const_cast<QQuickItem *>(item()))
qobject_cast<Q...em *>(item()))Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickaccessible
FALSEevaluated 236 times by 1 test
Evaluated by:
  • tst_qquickaccessible
)
4-236
164 return
executed 4 times by 1 test: return QAccessible::StaticText;
Executed by:
  • tst_qquickaccessible
QAccessible::StaticText;
executed 4 times by 1 test: return QAccessible::StaticText;
Executed by:
  • tst_qquickaccessible
4
165-
166 QAccessible::Role role = QAccessible::NoRole;-
167 if (item()
item()Description
TRUEevaluated 236 times by 1 test
Evaluated by:
  • tst_qquickaccessible
FALSEnever evaluated
)
0-236
168 role = QQuickItemPrivate::get(item())->accessibleRole();
executed 236 times by 1 test: role = QQuickItemPrivate::get(item())->accessibleRole();
Executed by:
  • tst_qquickaccessible
236
169 if (role == QAccessible::NoRole
role == QAccessible::NoRoleDescription
TRUEnever evaluated
FALSEevaluated 236 times by 1 test
Evaluated by:
  • tst_qquickaccessible
)
0-236
170 role = QAccessible::Client;
never executed: role = QAccessible::Client;
0
171-
172 return
executed 236 times by 1 test: return role;
Executed by:
  • tst_qquickaccessible
role;
executed 236 times by 1 test: return role;
Executed by:
  • tst_qquickaccessible
236
173}-
174-
175bool QAccessibleQuickItem::isAccessible() const-
176{-
177 return
never executed: return item()->d_func()->isAccessible;
item()->d_func()->isAccessible;
never executed: return item()->d_func()->isAccessible;
0
178}-
179-
180QStringList QAccessibleQuickItem::actionNames() const-
181{-
182 QStringList actions;-
183 switch (role()) {-
184 case
never executed: case QAccessible::PushButton:
QAccessible::PushButton:
never executed: case QAccessible::PushButton:
0
185 actions << QAccessibleActionInterface::pressAction();-
186 break;
never executed: break;
0
187 case
never executed: case QAccessible::RadioButton:
QAccessible::RadioButton:
never executed: case QAccessible::RadioButton:
0
188 case
never executed: case QAccessible::CheckBox:
QAccessible::CheckBox:
never executed: case QAccessible::CheckBox:
0
189 actions << QAccessibleActionInterface::toggleAction()-
190 << QAccessibleActionInterface::pressAction();-
191 break;
never executed: break;
0
192 case
never executed: case QAccessible::Slider:
QAccessible::Slider:
never executed: case QAccessible::Slider:
0
193 case
never executed: case QAccessible::SpinBox:
QAccessible::SpinBox:
never executed: case QAccessible::SpinBox:
0
194 case
never executed: case QAccessible::ScrollBar:
QAccessible::ScrollBar:
never executed: case QAccessible::ScrollBar:
0
195 actions << QAccessibleActionInterface::increaseAction()-
196 << QAccessibleActionInterface::decreaseAction();-
197 break;
never executed: break;
0
198 default
never executed: default:
:
never executed: default:
0
199 break;
never executed: break;
0
200 }-
201 if (state().focusable
state().focusableDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
202 actions.append(QAccessibleActionInterface::setFocusAction());
never executed: actions.append(QAccessibleActionInterface::setFocusAction());
0
203-
204-
205 if (QQuickAccessibleAttached *attached = QQuickAccessibleAttached::attachedProperties(item())
QQuickAccessib...erties(item())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
206 attached->availableActions(&actions);
never executed: attached->availableActions(&actions);
0
207 return
never executed: return actions;
actions;
never executed: return actions;
0
208}-
209-
210void QAccessibleQuickItem::doAction(const QString &actionName)-
211{-
212 bool accepted = false;-
213 if (actionName == QAccessibleActionInterface::setFocusAction()
actionName == ...tFocusAction()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
214 item()->forceActiveFocus();-
215 accepted = true;-
216 }
never executed: end of block
0
217 if (QQuickAccessibleAttached *attached = QQuickAccessibleAttached::attachedProperties(item())
QQuickAccessib...erties(item())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
218 accepted = attached->doAction(actionName);
never executed: accepted = attached->doAction(actionName);
0
219-
220 if (accepted
acceptedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
221 return;
never executed: return;
0
222-
223-
224 const QByteArray functionName = "accessible" + actionName.toLatin1() + "Action";-
225 if (object()->metaObject()->indexOfMethod(QByteArray(functionName + "()")) != -1
object()->meta...+ "()")) != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
226 QMetaObject::invokeMethod(object(), functionName);-
227 return;
never executed: return;
0
228 }-
229-
230-
231-
232-
233-
234-
235 switch (role()) {-
236 case
never executed: case QAccessible::RadioButton:
QAccessible::RadioButton:
never executed: case QAccessible::RadioButton:
0
237 case
never executed: case QAccessible::CheckBox:
QAccessible::CheckBox:
never executed: case QAccessible::CheckBox:
{
0
238 QVariant checked = object()->property("checked");-
239 if (checked.
checked.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
isValid()
checked.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
240 if (actionName == QAccessibleActionInterface::toggleAction()
actionName == ...toggleAction()Description
TRUEnever evaluated
FALSEnever evaluated
||
0
241 actionName == QAccessibleActionInterface::pressAction()
actionName == ...:pressAction()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
242-
243 object()->setProperty("checked", QVariant(!checked.toBool()));-
244 }
never executed: end of block
0
245 }
never executed: end of block
0
246 break;
never executed: break;
0
247 }-
248 case
never executed: case QAccessible::Slider:
QAccessible::Slider:
never executed: case QAccessible::Slider:
0
249 case
never executed: case QAccessible::SpinBox:
QAccessible::SpinBox:
never executed: case QAccessible::SpinBox:
0
250 case
never executed: case QAccessible::Dial:
QAccessible::Dial:
never executed: case QAccessible::Dial:
0
251 case
never executed: case QAccessible::ScrollBar:
QAccessible::ScrollBar:
never executed: case QAccessible::ScrollBar:
{
0
252 if (actionName != QAccessibleActionInterface::increaseAction()
actionName != ...creaseAction()Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
253 actionName != QAccessibleActionInterface::decreaseAction()
actionName != ...creaseAction()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
254 break;
never executed: break;
0
255-
256-
257-
258-
259 if (QAccessibleValueInterface *valueIface = valueInterface()
QAccessibleVal...lueInterface()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
260 QVariant valueV = valueIface->currentValue();-
261 qreal newValue = valueV.toReal();-
262-
263 QVariant stepSizeV = object()->property("stepSize");-
264 qreal stepSize = stepSizeV.isValid()
stepSizeV.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
? stepSizeV.toReal() : qreal(1.0);
0
265 if (actionName == QAccessibleActionInterface::increaseAction()
actionName == ...creaseAction()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
266 newValue += stepSize;-
267 }
never executed: end of block
else {
0
268 newValue -= stepSize;-
269 }
never executed: end of block
0
270-
271 QVariant minimumValueV = valueIface->minimumValue();-
272 if (minimumValueV.isValid()
minimumValueV.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
273 newValue = qMax(newValue, minimumValueV.toReal());-
274 }
never executed: end of block
0
275 QVariant maximumValueV = valueIface->maximumValue();-
276 if (maximumValueV.isValid()
maximumValueV.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
277 newValue = qMin(newValue, maximumValueV.toReal());-
278 }
never executed: end of block
0
279-
280 valueIface->setCurrentValue(QVariant(newValue));-
281 }
never executed: end of block
0
282 break;
never executed: break;
0
283 }-
284 default
never executed: default:
:
never executed: default:
0
285 break;
never executed: break;
0
286 }-
287}-
288-
289QStringList QAccessibleQuickItem::keyBindingsForAction(const QString &actionName) const-
290{-
291 (void)actionName;-
292 return
never executed: return QStringList();
QStringList();
never executed: return QStringList();
0
293}-
294-
295QString QAccessibleQuickItem::text(QAccessible::Text textType) const-
296{-
297-
298 switch (textType) {-
299 case
executed 34 times by 1 test: case QAccessible::Name:
Executed by:
  • tst_qquickaccessible
QAccessible::Name:
executed 34 times by 1 test: case QAccessible::Name:
Executed by:
  • tst_qquickaccessible
{
34
300 QVariant accessibleName = QQuickAccessibleAttached::property(object(), "name");-
301 if (!accessibleName.isNull()
!accessibleName.isNull()Description
TRUEevaluated 34 times by 1 test
Evaluated by:
  • tst_qquickaccessible
FALSEnever evaluated
)
0-34
302 return
executed 34 times by 1 test: return accessibleName.toString();
Executed by:
  • tst_qquickaccessible
accessibleName.toString();
executed 34 times by 1 test: return accessibleName.toString();
Executed by:
  • tst_qquickaccessible
34
303 break;
never executed: break;
}
0
304 case
never executed: case QAccessible::Description:
QAccessible::Description:
never executed: case QAccessible::Description:
{
0
305 QVariant accessibleDecription = QQuickAccessibleAttached::property(object(), "description");-
306 if (!accessibleDecription.isNull()
!accessibleDecription.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
307 return
never executed: return accessibleDecription.toString();
accessibleDecription.toString();
never executed: return accessibleDecription.toString();
0
308 break;
never executed: break;
}
0
309 case
never executed: case QAccessible::Value:
QAccessible::Value:
never executed: case QAccessible::Value:
0
310 case
never executed: case QAccessible::Help:
QAccessible::Help:
never executed: case QAccessible::Help:
0
311 case
never executed: case QAccessible::Accelerator:
QAccessible::Accelerator:
never executed: case QAccessible::Accelerator:
0
312 default
never executed: default:
:
never executed: default:
0
313 break;
never executed: break;
0
314 }-
315-
316-
317 if (role() == QAccessible::EditableText
role() == QAcc...::EditableTextDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
318 if (textType == QAccessible::Value
textType == QAccessible::ValueDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
319 if (QTextDocument *doc = textDocument()
QTextDocument ...textDocument()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
320 return
never executed: return doc->toPlainText();
doc->toPlainText();
never executed: return doc->toPlainText();
0
321 }-
322 QVariant text = object()->property("text");-
323 return
never executed: return text.toString();
text.toString();
never executed: return text.toString();
0
324 }-
325 }
never executed: end of block
0
326-
327 return
never executed: return QString();
QString();
never executed: return QString();
0
328}-
329-
330void *QAccessibleQuickItem::interface_cast(QAccessible::InterfaceType t)-
331{-
332 QAccessible::Role r = role();-
333 if (t == QAccessible::ActionInterface
t == QAccessib...ctionInterfaceDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
334 return
never executed: return static_cast<QAccessibleActionInterface*>(this);
static_cast<QAccessibleActionInterface*>(this);
never executed: return static_cast<QAccessibleActionInterface*>(this);
0
335 if (t == QAccessible::ValueInterface
t == QAccessib...ValueInterfaceDescription
TRUEnever evaluated
FALSEnever evaluated
&&
0
336 (r == QAccessible::Slider
r == QAccessible::SliderDescription
TRUEnever evaluated
FALSEnever evaluated
||
0
337 r == QAccessible::SpinBox
r == QAccessible::SpinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
||
0
338 r == QAccessible::Dial
r == QAccessible::DialDescription
TRUEnever evaluated
FALSEnever evaluated
||
0
339 r == QAccessible::ScrollBar
r == QAccessible::ScrollBarDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
340 return
never executed: return static_cast<QAccessibleValueInterface*>(this);
static_cast<QAccessibleValueInterface*>(this);
never executed: return static_cast<QAccessibleValueInterface*>(this);
0
341-
342 if (t == QAccessible::TextInterface
t == QAccessib...:TextInterfaceDescription
TRUEnever evaluated
FALSEnever evaluated
&&
0
343 (
(r == QAccessi...:EditableText)Description
TRUEnever evaluated
FALSEnever evaluated
r == QAccessible::EditableText)
(r == QAccessi...:EditableText)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
344 return
never executed: return static_cast<QAccessibleTextInterface*>(this);
static_cast<QAccessibleTextInterface*>(this);
never executed: return static_cast<QAccessibleTextInterface*>(this);
0
345-
346 return
never executed: return QAccessibleObject::interface_cast(t);
QAccessibleObject::interface_cast(t);
never executed: return QAccessibleObject::interface_cast(t);
0
347}-
348-
349QVariant QAccessibleQuickItem::currentValue() const-
350{-
351 return
never executed: return item()->property("value");
item()->property("value");
never executed: return item()->property("value");
0
352}-
353-
354void QAccessibleQuickItem::setCurrentValue(const QVariant &value)-
355{-
356 item()->setProperty("value", value);-
357}
never executed: end of block
0
358-
359QVariant QAccessibleQuickItem::maximumValue() const-
360{-
361 return
never executed: return item()->property("maximumValue");
item()->property("maximumValue");
never executed: return item()->property("maximumValue");
0
362}-
363-
364QVariant QAccessibleQuickItem::minimumValue() const-
365{-
366 return
never executed: return item()->property("minimumValue");
item()->property("minimumValue");
never executed: return item()->property("minimumValue");
0
367}-
368-
369QVariant QAccessibleQuickItem::minimumStepSize() const-
370{-
371 return
never executed: return item()->property("stepSize");
item()->property("stepSize");
never executed: return item()->property("stepSize");
0
372}-
373-
374-
375-
376-
377-
378QRect itemScreenRect(QQuickItem *item)-
379{-
380-
381-
382 if (!item->window()
!item->window()Description
TRUEnever evaluated
FALSEevaluated 164 times by 1 test
Evaluated by:
  • tst_qquickaccessible
||!item->isVisible()
!item->isVisible()Description
TRUEnever evaluated
FALSEevaluated 164 times by 1 test
Evaluated by:
  • tst_qquickaccessible
|| qFuzzyIsNull(item->opacity())
qFuzzyIsNull(item->opacity())Description
TRUEnever evaluated
FALSEevaluated 164 times by 1 test
Evaluated by:
  • tst_qquickaccessible
) {
0-164
383 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
384 }-
385-
386 QSize itemSize((int)item->width(), (int)item->height());-
387-
388-
389 if (itemSize.isEmpty()
itemSize.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 164 times by 1 test
Evaluated by:
  • tst_qquickaccessible
) {
0-164
390 itemSize = QSize((int)item->implicitWidth(), (int)item->implicitHeight());-
391 if (itemSize.isEmpty()
itemSize.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& item->parentItem()
item->parentItem()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
392-
393 itemSize = QSize((int)item->parentItem()->width(), (int)item->parentItem()->height());
never executed: itemSize = QSize((int)item->parentItem()->width(), (int)item->parentItem()->height());
0
394 }
never executed: end of block
0
395-
396 QPointF scenePoint = item->mapToScene(QPointF(0, 0));-
397 QPoint screenPos = item->window()->mapToGlobal(scenePoint.toPoint());-
398 return
executed 164 times by 1 test: return QRect(screenPos, itemSize);
Executed by:
  • tst_qquickaccessible
QRect(screenPos, itemSize);
executed 164 times by 1 test: return QRect(screenPos, itemSize);
Executed by:
  • tst_qquickaccessible
164
399}-
400-
401QTextDocument *QAccessibleQuickItem::textDocument() const-
402{-
403 QVariant docVariant = item()->property("textDocument");-
404 if (docVariant.canConvert<QQuickTextDocument*>()
docVariant.can...xtDocument*>()Description
TRUEnever evaluated
FALSEevaluated 84 times by 2 tests
Evaluated by:
  • tst_qquickaccessible
  • tst_qquickitem2
) {
0-84
405 QQuickTextDocument *qqdoc = docVariant.value<QQuickTextDocument*>();-
406 return
never executed: return qqdoc->textDocument();
qqdoc->textDocument();
never executed: return qqdoc->textDocument();
0
407 }-
408 return
executed 84 times by 2 tests: return nullptr;
Executed by:
  • tst_qquickaccessible
  • tst_qquickitem2
nullptr;
executed 84 times by 2 tests: return nullptr;
Executed by:
  • tst_qquickaccessible
  • tst_qquickitem2
84
409}-
410-
411int QAccessibleQuickItem::characterCount() const-
412{-
413 if (m_doc
m_docDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
414 QTextCursor cursor = QTextCursor(m_doc);-
415 cursor.movePosition(QTextCursor::End);-
416 return
never executed: return cursor.position();
cursor.position();
never executed: return cursor.position();
0
417 }-
418 return
never executed: return text(QAccessible::Value).size();
text(QAccessible::Value).size();
never executed: return text(QAccessible::Value).size();
0
419}-
420-
421int QAccessibleQuickItem::cursorPosition() const-
422{-
423 QVariant pos = item()->property("cursorPosition");-
424 return
never executed: return pos.toInt();
pos.toInt();
never executed: return pos.toInt();
0
425}-
426-
427void QAccessibleQuickItem::setCursorPosition(int position)-
428{-
429 item()->setProperty("cursorPosition", position);-
430}
never executed: end of block
0
431-
432QString QAccessibleQuickItem::text(int startOffset, int endOffset) const-
433{-
434 if (m_doc
m_docDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
435 QTextCursor cursor = QTextCursor(m_doc);-
436 cursor.setPosition(startOffset);-
437 cursor.setPosition(endOffset, QTextCursor::KeepAnchor);-
438 return
never executed: return cursor.selectedText();
cursor.selectedText();
never executed: return cursor.selectedText();
0
439 }-
440 return
never executed: return text(QAccessible::Value).mid(startOffset, endOffset - startOffset);
text(QAccessible::Value).mid(startOffset, endOffset - startOffset);
never executed: return text(QAccessible::Value).mid(startOffset, endOffset - startOffset);
0
441}-
442-
443QString QAccessibleQuickItem::textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType,-
444 int *startOffset, int *endOffset) const-
445{-
446 ((startOffset) ? static_cast<void>(0) : qt_assert("startOffset", __FILE__, 499));-
447 ((endOffset) ? static_cast<void>(0) : qt_assert("endOffset", __FILE__, 500));-
448-
449 if (m_doc
m_docDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
450 QTextCursor cursor = QTextCursor(m_doc);-
451 cursor.setPosition(offset);-
452 QPair<int, int> boundaries = QAccessible::qAccessibleTextBoundaryHelper(cursor, boundaryType);-
453 cursor.setPosition(boundaries.first - 1);-
454 boundaries = QAccessible::qAccessibleTextBoundaryHelper(cursor, boundaryType);-
455-
456 *startOffset = boundaries.first;-
457 *endOffset = boundaries.second;-
458-
459 return
never executed: return text(boundaries.first, boundaries.second);
text(boundaries.first, boundaries.second);
never executed: return text(boundaries.first, boundaries.second);
0
460 } else {-
461 return
never executed: return QAccessibleTextInterface::textBeforeOffset(offset, boundaryType, startOffset, endOffset);
QAccessibleTextInterface::textBeforeOffset(offset, boundaryType, startOffset, endOffset);
never executed: return QAccessibleTextInterface::textBeforeOffset(offset, boundaryType, startOffset, endOffset);
0
462 }-
463}-
464-
465QString QAccessibleQuickItem::textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType,-
466 int *startOffset, int *endOffset) const-
467{-
468 ((startOffset) ? static_cast<void>(0) : qt_assert("startOffset", __FILE__, 521));-
469 ((endOffset) ? static_cast<void>(0) : qt_assert("endOffset", __FILE__, 522));-
470-
471 if (m_doc
m_docDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
472 QTextCursor cursor = QTextCursor(m_doc);-
473 cursor.setPosition(offset);-
474 QPair<int, int> boundaries = QAccessible::qAccessibleTextBoundaryHelper(cursor, boundaryType);-
475 cursor.setPosition(boundaries.second);-
476 boundaries = QAccessible::qAccessibleTextBoundaryHelper(cursor, boundaryType);-
477-
478 *startOffset = boundaries.first;-
479 *endOffset = boundaries.second;-
480-
481 return
never executed: return text(boundaries.first, boundaries.second);
text(boundaries.first, boundaries.second);
never executed: return text(boundaries.first, boundaries.second);
0
482 } else {-
483 return
never executed: return QAccessibleTextInterface::textAfterOffset(offset, boundaryType, startOffset, endOffset);
QAccessibleTextInterface::textAfterOffset(offset, boundaryType, startOffset, endOffset);
never executed: return QAccessibleTextInterface::textAfterOffset(offset, boundaryType, startOffset, endOffset);
0
484 }-
485}-
486-
487QString QAccessibleQuickItem::textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType,-
488 int *startOffset, int *endOffset) const-
489{-
490 ((startOffset) ? static_cast<void>(0) : qt_assert("startOffset", __FILE__, 543));-
491 ((endOffset) ? static_cast<void>(0) : qt_assert("endOffset", __FILE__, 544));-
492-
493 if (m_doc
m_docDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
494 QTextCursor cursor = QTextCursor(m_doc);-
495 cursor.setPosition(offset);-
496 QPair<int, int> boundaries = QAccessible::qAccessibleTextBoundaryHelper(cursor, boundaryType);-
497-
498 *startOffset = boundaries.first;-
499 *endOffset = boundaries.second;-
500 return
never executed: return text(boundaries.first, boundaries.second);
text(boundaries.first, boundaries.second);
never executed: return text(boundaries.first, boundaries.second);
0
501 } else {-
502 return
never executed: return QAccessibleTextInterface::textAtOffset(offset, boundaryType, startOffset, endOffset);
QAccessibleTextInterface::textAtOffset(offset, boundaryType, startOffset, endOffset);
never executed: return QAccessibleTextInterface::textAtOffset(offset, boundaryType, startOffset, endOffset);
0
503 }-
504}-
505-
506void QAccessibleQuickItem::selection(int selectionIndex, int *startOffset, int *endOffset) const-
507{-
508 if (selectionIndex == 0
selectionIndex == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
509 *startOffset = item()->property("selectionStart").toInt();-
510 *endOffset = item()->property("selectionEnd").toInt();-
511 }
never executed: end of block
else {
0
512 *startOffset = 0;-
513 *endOffset = 0;-
514 }
never executed: end of block
0
515}-
516-
517int QAccessibleQuickItem::selectionCount() const-
518{-
519 if (item()->property("selectionStart").toInt() != item()->property("selectionEnd").toInt()
item()->proper...nEnd").toInt()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
520 return
never executed: return 1;
1;
never executed: return 1;
0
521 return
never executed: return 0;
0;
never executed: return 0;
0
522}-
523-
524void QAccessibleQuickItem::addSelection(int , int )-
525{-
526-
527}-
528void QAccessibleQuickItem::removeSelection(int )-
529{-
530-
531}-
532void QAccessibleQuickItem::setSelection(int , int , int )-
533{-
534-
535}-
536-
537-
538-
539-
540-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0