graphicsview/qgraphicsitem.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9 -
10 -
11static inline void _q_adjustRect(QRect *rect) -
12{ -
13 qt_noop(); -
14 if (!rect->width())
never evaluated: !rect->width()
0
15 rect->adjust(0, 0, 1, 0);
never executed: rect->adjust(0, 0, 1, 0);
0
16 if (!rect->height())
never evaluated: !rect->height()
0
17 rect->adjust(0, 0, 0, 1);
never executed: rect->adjust(0, 0, 0, 1);
0
18}
never executed: }
0
19 -
20 -
21 -
22 -
23class QGraphicsItemCustomDataStore -
24{ -
25public: -
26 QHash<const QGraphicsItem *, QMap<int, QVariant> > data; -
27}; -
28static QGraphicsItemCustomDataStore *qt_dataStore() { static QGlobalStatic<QGraphicsItemCustomDataStore > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QGraphicsItemCustomDataStore *x = new QGraphicsItemCustomDataStore; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QGraphicsItemCustomDataStore > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:1752
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:1764
0-1764
29 -
30 -
31 -
32 -
33 -
34 -
35 -
36static QPainterPath qt_graphicsItem_shapeFromPath(const QPainterPath &path, const QPen &pen) -
37{ -
38 -
39 -
40 const qreal penWidthZero = qreal(0.00000001); -
41 -
42 if (path == QPainterPath())
evaluated: path == QPainterPath()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1889
5-1889
43 return path;
executed: return path;
Execution Count:5
5
44 QPainterPathStroker ps; -
45 ps.setCapStyle(pen.capStyle()); -
46 if (pen.widthF() <= 0.0)
partially evaluated: pen.widthF() <= 0.0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1889
0-1889
47 ps.setWidth(penWidthZero);
never executed: ps.setWidth(penWidthZero);
0
48 else -
49 ps.setWidth(pen.widthF());
executed: ps.setWidth(pen.widthF());
Execution Count:1889
1889
50 ps.setJoinStyle(pen.joinStyle()); -
51 ps.setMiterLimit(pen.miterLimit()); -
52 QPainterPath p = ps.createStroke(path); -
53 p.addPath(path); -
54 return p;
executed: return p;
Execution Count:1889
1889
55} -
56void QGraphicsItemPrivate::updateAncestorFlag(QGraphicsItem::GraphicsItemFlag childFlag, -
57 AncestorFlag flag, bool enabled, bool root) -
58{ -
59 QGraphicsItem * const q = q_func(); -
60 if (root) {
evaluated: root
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:9
9-17
61 -
62 -
63 switch (int(childFlag)) { -
64 case -2: -
65 flag = AncestorFiltersChildEvents; -
66 enabled = q->filtersChildEvents(); -
67 break;
never executed: break;
0
68 case -1: -
69 flag = AncestorHandlesChildEvents; -
70 enabled = q->handlesChildEvents(); -
71 break;
never executed: break;
0
72 case QGraphicsItem::ItemClipsChildrenToShape: -
73 flag = AncestorClipsChildren; -
74 enabled = flags & QGraphicsItem::ItemClipsChildrenToShape; -
75 break;
executed: break;
Execution Count:13
13
76 case QGraphicsItem::ItemIgnoresTransformations: -
77 flag = AncestorIgnoresTransformations; -
78 enabled = flags & QGraphicsItem::ItemIgnoresTransformations; -
79 break;
executed: break;
Execution Count:4
4
80 default: -
81 return;
never executed: return;
0
82 } -
83 -
84 if (parent) {
evaluated: parent
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:10
7-10
85 -
86 if ((parent->d_ptr->ancestorFlags & flag)
partially evaluated: (parent->d_ptr->ancestorFlags & flag)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
87 || (int(parent->d_ptr->flags & childFlag) == childFlag)
evaluated: (int(parent->d_ptr->flags & childFlag) == childFlag)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:6
1-6
88 || (childFlag == -1 && parent->d_ptr->handlesChildEvents)
partially evaluated: childFlag == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
never evaluated: parent->d_ptr->handlesChildEvents
0-6
89 || (childFlag == -2 && parent->d_ptr->filtersDescendantEvents)) {
partially evaluated: childFlag == -2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
never evaluated: parent->d_ptr->filtersDescendantEvents
0-6
90 enabled = true; -
91 ancestorFlags |= flag; -
92 } else {
executed: }
Execution Count:1
1
93 ancestorFlags &= ~flag; -
94 }
executed: }
Execution Count:6
6
95 } else { -
96 -
97 -
98 ancestorFlags = 0; -
99 }
executed: }
Execution Count:10
10
100 } else { -
101 -
102 if (((ancestorFlags & flag) && enabled) || (!(ancestorFlags & flag) && !enabled))
evaluated: (ancestorFlags & flag)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:6
partially evaluated: enabled
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
evaluated: !(ancestorFlags & flag)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3
partially evaluated: !enabled
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
103 return;
never executed: return;
0
104 -
105 -
106 if (enabled)
evaluated: enabled
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3
3-6
107 ancestorFlags |= flag;
executed: ancestorFlags |= flag;
Execution Count:6
6
108 else -
109 ancestorFlags &= ~flag;
executed: ancestorFlags &= ~flag;
Execution Count:3
3
110 -
111 -
112 if ((childFlag != -1 && int(flags & childFlag) == childFlag)
partially evaluated: childFlag != -1
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
partially evaluated: int(flags & childFlag) == childFlag
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
113 || (int(childFlag) == -1 && handlesChildEvents)
partially evaluated: int(childFlag) == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
never evaluated: handlesChildEvents
0-9
114 || (int(childFlag) == -2 && filtersDescendantEvents))
partially evaluated: int(childFlag) == -2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
never evaluated: filtersDescendantEvents
0-9
115 return;
never executed: return;
0
116 }
executed: }
Execution Count:9
9
117 -
118 for (int i = 0; i < children.size(); ++i)
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:26
9-26
119 children.at(i)->d_ptr->updateAncestorFlag(childFlag, flag, enabled, false);
executed: children.at(i)->d_ptr->updateAncestorFlag(childFlag, flag, enabled, false);
Execution Count:9
9
120}
executed: }
Execution Count:26
26
121 -
122void QGraphicsItemPrivate::updateAncestorFlags() -
123{ -
124 int flags = 0; -
125 if (parent) {
evaluated: parent
TRUEFALSE
yes
Evaluation Count:804
yes
Evaluation Count:756
756-804
126 -
127 QGraphicsItemPrivate *pd = parent->d_ptr.data(); -
128 flags = pd->ancestorFlags; -
129 -
130 -
131 if (pd->filtersDescendantEvents)
partially evaluated: pd->filtersDescendantEvents
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:804
0-804
132 flags |= AncestorFiltersChildEvents;
never executed: flags |= AncestorFiltersChildEvents;
0
133 if (pd->handlesChildEvents)
partially evaluated: pd->handlesChildEvents
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:804
0-804
134 flags |= AncestorHandlesChildEvents;
never executed: flags |= AncestorHandlesChildEvents;
0
135 if (pd->flags & QGraphicsItem::ItemClipsChildrenToShape)
evaluated: pd->flags & QGraphicsItem::ItemClipsChildrenToShape
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:799
5-799
136 flags |= AncestorClipsChildren;
executed: flags |= AncestorClipsChildren;
Execution Count:5
5
137 if (pd->flags & QGraphicsItem::ItemIgnoresTransformations)
partially evaluated: pd->flags & QGraphicsItem::ItemIgnoresTransformations
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:804
0-804
138 flags |= AncestorIgnoresTransformations;
never executed: flags |= AncestorIgnoresTransformations;
0
139 }
executed: }
Execution Count:804
804
140 -
141 if (ancestorFlags == flags)
evaluated: ancestorFlags == flags
TRUEFALSE
yes
Evaluation Count:1548
yes
Evaluation Count:12
12-1548
142 return;
executed: return;
Execution Count:1548
1548
143 ancestorFlags = flags; -
144 -
145 -
146 for (int i = 0; i < children.size(); ++i)
partially evaluated: i < children.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
147 children.at(i)->d_ptr->updateAncestorFlags();
never executed: children.at(i)->d_ptr->updateAncestorFlags();
0
148}
executed: }
Execution Count:12
12
149 -
150 -
151 -
152 -
153 -
154 -
155void QGraphicsItemPrivate::setIsMemberOfGroup(bool enabled) -
156{ -
157 QGraphicsItem * const q = q_func(); -
158 isMemberOfGroup = enabled; -
159 if (!qgraphicsitem_cast<QGraphicsItemGroup *>(q)) {
never evaluated: !qgraphicsitem_cast<QGraphicsItemGroup *>(q)
0
160 for (QForeachContainer<__typeof__(children)> _container_(children); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *child = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
161 child->d_func()->setIsMemberOfGroup(enabled);
never executed: child->d_func()->setIsMemberOfGroup(enabled);
0
162 }
never executed: }
0
163}
never executed: }
0
164 -
165 -
166 -
167 -
168 -
169 -
170void QGraphicsItemPrivate::remapItemPos(QEvent *event, QGraphicsItem *item) -
171{ -
172 QGraphicsItem * const q = q_func(); -
173 switch (event->type()) { -
174 case QEvent::GraphicsSceneMouseMove: -
175 case QEvent::GraphicsSceneMousePress: -
176 case QEvent::GraphicsSceneMouseRelease: -
177 case QEvent::GraphicsSceneMouseDoubleClick: { -
178 QGraphicsSceneMouseEvent *mouseEvent = static_cast<QGraphicsSceneMouseEvent *>(event); -
179 mouseEvent->setPos(item->mapFromItem(q, mouseEvent->pos())); -
180 mouseEvent->setLastPos(item->mapFromItem(q, mouseEvent->pos())); -
181 for (int i = 0x1; i <= 0x10; i <<= 1) {
never evaluated: i <= 0x10
0
182 if (mouseEvent->buttons() & i) {
never evaluated: mouseEvent->buttons() & i
0
183 Qt::MouseButton button = Qt::MouseButton(i); -
184 mouseEvent->setButtonDownPos(button, item->mapFromItem(q, mouseEvent->buttonDownPos(button))); -
185 }
never executed: }
0
186 }
never executed: }
0
187 break;
never executed: break;
0
188 } -
189 case QEvent::GraphicsSceneWheel: { -
190 QGraphicsSceneWheelEvent *wheelEvent = static_cast<QGraphicsSceneWheelEvent *>(event); -
191 wheelEvent->setPos(item->mapFromItem(q, wheelEvent->pos())); -
192 break;
never executed: break;
0
193 } -
194 case QEvent::GraphicsSceneContextMenu: { -
195 QGraphicsSceneContextMenuEvent *contextEvent = static_cast<QGraphicsSceneContextMenuEvent *>(event); -
196 contextEvent->setPos(item->mapFromItem(q, contextEvent->pos())); -
197 break;
never executed: break;
0
198 } -
199 case QEvent::GraphicsSceneHoverMove: { -
200 QGraphicsSceneHoverEvent *hoverEvent = static_cast<QGraphicsSceneHoverEvent *>(event); -
201 hoverEvent->setPos(item->mapFromItem(q, hoverEvent->pos())); -
202 break;
never executed: break;
0
203 } -
204 default: -
205 break;
never executed: break;
0
206 } -
207}
never executed: }
0
208QPointF QGraphicsItemPrivate::genericMapFromScene(const QPointF &pos, -
209 const QWidget *viewport) const -
210{ -
211 const QGraphicsItem * const q = q_func(); -
212 if (!itemIsUntransformable())
partially evaluated: !itemIsUntransformable()
TRUEFALSE
yes
Evaluation Count:1581
no
Evaluation Count:0
0-1581
213 return q->mapFromScene(pos);
executed: return q->mapFromScene(pos);
Execution Count:1581
1581
214 QGraphicsView *view = 0; -
215 if (viewport)
never evaluated: viewport
0
216 view = qobject_cast<QGraphicsView *>(viewport->parentWidget());
never executed: view = qobject_cast<QGraphicsView *>(viewport->parentWidget());
0
217 if (!view)
never evaluated: !view
0
218 return q->mapFromScene(pos);
never executed: return q->mapFromScene(pos);
0
219 -
220 return q->deviceTransform(view->viewportTransform()).inverted().map(view->mapFromScene(pos));
never executed: return q->deviceTransform(view->viewportTransform()).inverted().map(view->mapFromScene(pos));
0
221} -
222void QGraphicsItemPrivate::combineTransformToParent(QTransform *x, const QTransform *viewTransform) const -
223{ -
224 -
225 if (viewTransform && itemIsUntransformable()) {
never evaluated: viewTransform
never evaluated: itemIsUntransformable()
0
226 *x = q_ptr->deviceTransform(*viewTransform); -
227 } else {
never executed: }
0
228 if (transformData)
never evaluated: transformData
0
229 *x *= transformData->computedFullTransform();
never executed: *x *= transformData->computedFullTransform();
0
230 if (!pos.isNull())
never evaluated: !pos.isNull()
0
231 *x *= QTransform::fromTranslate(pos.x(), pos.y());
never executed: *x *= QTransform::fromTranslate(pos.x(), pos.y());
0
232 }
never executed: }
0
233} -
234void QGraphicsItemPrivate::combineTransformFromParent(QTransform *x, const QTransform *viewTransform) const -
235{ -
236 -
237 if (viewTransform && itemIsUntransformable()) {
partially evaluated: viewTransform
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20
never evaluated: itemIsUntransformable()
0-20
238 *x = q_ptr->deviceTransform(*viewTransform); -
239 } else {
never executed: }
0
240 x->translate(pos.x(), pos.y()); -
241 if (transformData)
partially evaluated: transformData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20
0-20
242 *x = transformData->computedFullTransform(x);
never executed: *x = transformData->computedFullTransform(x);
0
243 }
executed: }
Execution Count:20
20
244} -
245 -
246void QGraphicsItemPrivate::updateSceneTransformFromParent() -
247{ -
248 if (parent) {
evaluated: parent
TRUEFALSE
yes
Evaluation Count:142
yes
Evaluation Count:549
142-549
249 qt_noop(); -
250 if (parent->d_ptr->sceneTransformTranslateOnly) {
partially evaluated: parent->d_ptr->sceneTransformTranslateOnly
TRUEFALSE
yes
Evaluation Count:142
no
Evaluation Count:0
0-142
251 sceneTransform = QTransform::fromTranslate(parent->d_ptr->sceneTransform.dx() + pos.x(), -
252 parent->d_ptr->sceneTransform.dy() + pos.y()); -
253 } else {
executed: }
Execution Count:142
142
254 sceneTransform = parent->d_ptr->sceneTransform; -
255 sceneTransform.translate(pos.x(), pos.y()); -
256 }
never executed: }
0
257 if (transformData) {
partially evaluated: transformData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:142
0-142
258 sceneTransform = transformData->computedFullTransform(&sceneTransform); -
259 sceneTransformTranslateOnly = (sceneTransform.type() <= QTransform::TxTranslate); -
260 } else {
never executed: }
0
261 sceneTransformTranslateOnly = parent->d_ptr->sceneTransformTranslateOnly; -
262 }
executed: }
Execution Count:142
142
263 } else if (!transformData) {
evaluated: !transformData
TRUEFALSE
yes
Evaluation Count:526
yes
Evaluation Count:23
23-526
264 sceneTransform = QTransform::fromTranslate(pos.x(), pos.y()); -
265 sceneTransformTranslateOnly = 1; -
266 } else if (transformData->onlyTransform) {
partially evaluated: transformData->onlyTransform
TRUEFALSE
yes
Evaluation Count:23
no
Evaluation Count:0
executed: }
Execution Count:526
0-526
267 sceneTransform = transformData->transform; -
268 if (!pos.isNull())
evaluated: !pos.isNull()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:19
4-19
269 sceneTransform *= QTransform::fromTranslate(pos.x(), pos.y());
executed: sceneTransform *= QTransform::fromTranslate(pos.x(), pos.y());
Execution Count:4
4
270 sceneTransformTranslateOnly = (sceneTransform.type() <= QTransform::TxTranslate); -
271 } else if (pos.isNull()) {
never evaluated: pos.isNull()
executed: }
Execution Count:23
0-23
272 sceneTransform = transformData->computedFullTransform(); -
273 sceneTransformTranslateOnly = (sceneTransform.type() <= QTransform::TxTranslate); -
274 } else {
never executed: }
0
275 sceneTransform = QTransform::fromTranslate(pos.x(), pos.y()); -
276 sceneTransform = transformData->computedFullTransform(&sceneTransform); -
277 sceneTransformTranslateOnly = (sceneTransform.type() <= QTransform::TxTranslate); -
278 }
never executed: }
0
279 dirtySceneTransform = 0; -
280}
executed: }
Execution Count:691
691
281void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const QVariant *newParentVariant, -
282 const QVariant *thisPointerVariant) -
283{ -
284 QGraphicsItem * const q = q_func(); -
285 if (newParent == parent)
partially evaluated: newParent == parent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1560
0-1560
286 return;
never executed: return;
0
287 -
288 if (isWidget)
evaluated: isWidget
TRUEFALSE
yes
Evaluation Count:1507
yes
Evaluation Count:53
53-1507
289 static_cast<QGraphicsWidgetPrivate *>(this)->fixFocusChainBeforeReparenting((newParent && 1507
290 newParent->isWidget()) ? static_cast<QGraphicsWidget *>(newParent) : 0, 1507
291 scene);
executed: static_cast<QGraphicsWidgetPrivate *>(this)->fixFocusChainBeforeReparenting((newParent && newParent->isWidget()) ? static_cast<QGraphicsWidget *>(newParent) : 0, scene);
Execution Count:1507
1507
292 if (scene) {
evaluated: scene
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1545
15-1545
293 -
294 if (scene->d_func()->indexMethod != QGraphicsScene::NoIndex)
partially evaluated: scene->d_func()->indexMethod != QGraphicsScene::NoIndex
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
0-15
295 scene->d_func()->index->itemChange(q, QGraphicsItem::ItemParentChange, newParent);
executed: scene->d_func()->index->itemChange(q, QGraphicsItem::ItemParentChange, newParent);
Execution Count:15
15
296 -
297 -
298 if (scenePosDescendants || (flags & QGraphicsItem::ItemSendsScenePositionChanges))
partially evaluated: scenePosDescendants
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
partially evaluated: (flags & QGraphicsItem::ItemSendsScenePositionChanges)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
299 scene->d_func()->setScenePosItemEnabled(q, false);
never executed: scene->d_func()->setScenePosItemEnabled(q, false);
0
300 }
executed: }
Execution Count:15
15
301 -
302 if (subFocusItem && parent) {
partially evaluated: subFocusItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1560
never evaluated: parent
0-1560
303 -
304 subFocusItem->d_ptr->clearSubFocus(parent); -
305 }
never executed: }
0
306 -
307 -
308 -
309 -
310 if (!inDestructor)
evaluated: !inDestructor
TRUEFALSE
yes
Evaluation Count:804
yes
Evaluation Count:756
756-804
311 q_ptr->prepareGeometryChange();
executed: q_ptr->prepareGeometryChange();
Execution Count:804
804
312 -
313 if (parent) {
evaluated: parent
TRUEFALSE
yes
Evaluation Count:759
yes
Evaluation Count:801
759-801
314 -
315 parent->d_ptr->removeChild(q); -
316 if (thisPointerVariant)
partially evaluated: thisPointerVariant
TRUEFALSE
yes
Evaluation Count:759
no
Evaluation Count:0
0-759
317 parent->itemChange(QGraphicsItem::ItemChildRemovedChange, *thisPointerVariant);
executed: parent->itemChange(QGraphicsItem::ItemChildRemovedChange, *thisPointerVariant);
Execution Count:759
759
318 }
executed: }
Execution Count:759
759
319 -
320 -
321 -
322 if (scene && !inDestructor) {
evaluated: scene
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1545
partially evaluated: !inDestructor
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
0-1545
323 if (parent && !newParent) {
evaluated: parent
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:12
partially evaluated: !newParent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-12
324 scene->d_func()->registerTopLevelItem(q); -
325 } else if (!parent && newParent) {
evaluated: !parent
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:3
partially evaluated: newParent
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
never executed: }
0-12
326 scene->d_func()->unregisterTopLevelItem(q); -
327 }
executed: }
Execution Count:12
12
328 } -
329 -
330 -
331 -
332 QGraphicsItem *p = parent; -
333 QGraphicsItem *parentFocusScopeItem = 0; -
334 while (p) {
evaluated: p
TRUEFALSE
yes
Evaluation Count:767
yes
Evaluation Count:1560
767-1560
335 if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) {
partially evaluated: p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:767
0-767
336 -
337 -
338 QGraphicsItem *fsi = p->d_ptr->focusScopeItem; -
339 if (q_ptr == fsi || q_ptr->isAncestorOf(fsi)) {
never evaluated: q_ptr == fsi
never evaluated: q_ptr->isAncestorOf(fsi)
0
340 parentFocusScopeItem = fsi; -
341 p->d_ptr->focusScopeItem = 0; -
342 fsi->d_ptr->focusScopeItemChange(false); -
343 }
never executed: }
0
344 break;
never executed: break;
0
345 } -
346 p = p->d_ptr->parent; -
347 }
executed: }
Execution Count:767
767
348 -
349 -
350 if (newParent && (graphicsEffect || mayHaveChildWithGraphicsEffect))
evaluated: newParent
TRUEFALSE
yes
Evaluation Count:804
yes
Evaluation Count:756
partially evaluated: graphicsEffect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:804
partially evaluated: mayHaveChildWithGraphicsEffect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:804
0-804
351 newParent->d_ptr->updateChildWithGraphicsEffectFlagRecursively();
never executed: newParent->d_ptr->updateChildWithGraphicsEffectFlagRecursively();
0
352 -
353 -
354 QGraphicsItem *newFocusScopeItem = subFocusItem ? subFocusItem : parentFocusScopeItem;
partially evaluated: subFocusItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1560
0-1560
355 if (newFocusScopeItem && newParent) {
partially evaluated: newFocusScopeItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1560
never evaluated: newParent
0-1560
356 QGraphicsItem *p = newParent; -
357 while (p) {
never evaluated: p
0
358 if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) {
never evaluated: p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope
0
359 if (subFocusItem && subFocusItem != q_ptr) {
never evaluated: subFocusItem
never evaluated: subFocusItem != q_ptr
0
360 -
361 QGraphicsItem *ancestorScope = 0; -
362 QGraphicsItem *p2 = subFocusItem->d_ptr->parent; -
363 while (p2 && p2 != p) {
never evaluated: p2
never evaluated: p2 != p
0
364 if (p2->d_ptr->flags & QGraphicsItem::ItemIsFocusScope)
never evaluated: p2->d_ptr->flags & QGraphicsItem::ItemIsFocusScope
0
365 ancestorScope = p2;
never executed: ancestorScope = p2;
0
366 if (p2->d_ptr->flags & QGraphicsItem::ItemIsPanel)
never evaluated: p2->d_ptr->flags & QGraphicsItem::ItemIsPanel
0
367 break;
never executed: break;
0
368 if (p2 == q_ptr)
never evaluated: p2 == q_ptr
0
369 break;
never executed: break;
0
370 p2 = p2->d_ptr->parent; -
371 }
never executed: }
0
372 if (ancestorScope)
never evaluated: ancestorScope
0
373 newFocusScopeItem = ancestorScope;
never executed: newFocusScopeItem = ancestorScope;
0
374 }
never executed: }
0
375 -
376 p->d_ptr->focusScopeItem = newFocusScopeItem; -
377 newFocusScopeItem->d_ptr->focusScopeItemChange(true); -
378 -
379 -
380 -
381 if (subFocusItem && !p->focusItem())
never evaluated: subFocusItem
never evaluated: !p->focusItem()
0
382 subFocusItem->d_ptr->clearSubFocus();
never executed: subFocusItem->d_ptr->clearSubFocus();
0
383 break;
never executed: break;
0
384 } -
385 p = p->d_ptr->parent; -
386 }
never executed: }
0
387 }
never executed: }
0
388 -
389 -
390 invalidateDepthRecursively(); -
391 -
392 if ((parent = newParent)) {
evaluated: (parent = newParent)
TRUEFALSE
yes
Evaluation Count:804
yes
Evaluation Count:756
756-804
393 if (parent->d_func()->scene && parent->d_func()->scene != scene) {
evaluated: parent->d_func()->scene
TRUEFALSE
yes
Evaluation Count:730
yes
Evaluation Count:74
evaluated: parent->d_func()->scene != scene
TRUEFALSE
yes
Evaluation Count:722
yes
Evaluation Count:8
8-730
394 -
395 parent->d_func()->scene->addItem(q); -
396 } else if (!parent->d_func()->scene && scene) {
evaluated: !parent->d_func()->scene
TRUEFALSE
yes
Evaluation Count:74
yes
Evaluation Count:8
evaluated: scene
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:67
executed: }
Execution Count:722
7-722
397 -
398 scene->removeItem(q); -
399 }
executed: }
Execution Count:7
7
400 -
401 parent->d_ptr->addChild(q); -
402 if (thisPointerVariant)
evaluated: thisPointerVariant
TRUEFALSE
yes
Evaluation Count:494
yes
Evaluation Count:310
310-494
403 parent->itemChange(QGraphicsItem::ItemChildAddedChange, *thisPointerVariant);
executed: parent->itemChange(QGraphicsItem::ItemChildAddedChange, *thisPointerVariant);
Execution Count:494
494
404 if (scene) {
evaluated: scene
TRUEFALSE
yes
Evaluation Count:730
yes
Evaluation Count:74
74-730
405 -
406 if (scenePosDescendants || (flags & QGraphicsItem::ItemSendsScenePositionChanges))
partially evaluated: scenePosDescendants
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:730
partially evaluated: (flags & QGraphicsItem::ItemSendsScenePositionChanges)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:730
0-730
407 scene->d_func()->setScenePosItemEnabled(q, true);
never executed: scene->d_func()->setScenePosItemEnabled(q, true);
0
408 }
executed: }
Execution Count:730
730
409 -
410 -
411 markParentDirty( true); -
412 -
413 -
414 updateAncestorFlags(); -
415 -
416 -
417 if (parent->d_ptr->visible != visible) {
partially evaluated: parent->d_ptr->visible != visible
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:804
0-804
418 if (!parent->d_ptr->visible || !explicitlyHidden)
never evaluated: !parent->d_ptr->visible
never evaluated: !explicitlyHidden
0
419 setVisibleHelper(parent->d_ptr->visible, false, false);
never executed: setVisibleHelper(parent->d_ptr->visible, false, false);
0
420 }
never executed: }
0
421 if (parent->isEnabled() != enabled) {
partially evaluated: parent->isEnabled() != enabled
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:804
0-804
422 if (!parent->d_ptr->enabled || !explicitlyDisabled)
never evaluated: !parent->d_ptr->enabled
never evaluated: !explicitlyDisabled
0
423 setEnabledHelper(parent->d_ptr->enabled, false, false);
never executed: setEnabledHelper(parent->d_ptr->enabled, false, false);
0
424 }
never executed: }
0
425 -
426 -
427 if (visible && parent->isActive())
partially evaluated: visible
TRUEFALSE
yes
Evaluation Count:804
no
Evaluation Count:0
evaluated: parent->isActive()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:801
0-804
428 q->setActive(true);
executed: q->setActive(true);
Execution Count:3
3
429 } else {
executed: }
Execution Count:804
804
430 -
431 updateAncestorFlags(); -
432 -
433 if (!inDestructor) {
partially evaluated: !inDestructor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:756
0-756
434 -
435 if (!visible && !explicitlyHidden)
never evaluated: !visible
never evaluated: !explicitlyHidden
0
436 setVisibleHelper(true, false);
never executed: setVisibleHelper(true, false);
0
437 if (!enabled && !explicitlyDisabled)
never evaluated: !enabled
never evaluated: !explicitlyDisabled
0
438 setEnabledHelper(true, false);
never executed: setEnabledHelper(true, false);
0
439 }
never executed: }
0
440 }
executed: }
Execution Count:756
756
441 -
442 dirtySceneTransform = 1; -
443 if (!inDestructor && (transformData || (newParent && newParent->d_ptr->transformData)))
evaluated: !inDestructor
TRUEFALSE
yes
Evaluation Count:804
yes
Evaluation Count:756
partially evaluated: transformData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:804
partially evaluated: newParent
TRUEFALSE
yes
Evaluation Count:804
no
Evaluation Count:0
partially evaluated: newParent->d_ptr->transformData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:804
0-804
444 transformChanged();
never executed: transformChanged();
0
445 -
446 -
447 if (subFocusItem) {
partially evaluated: subFocusItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1560
0-1560
448 subFocusItem->d_ptr->setSubFocus(newParent); -
449 if (parent && parent->isActive())
never evaluated: parent
never evaluated: parent->isActive()
0
450 subFocusItem->setFocus();
never executed: subFocusItem->setFocus();
0
451 }
never executed: }
0
452 -
453 -
454 if (newParentVariant)
evaluated: newParentVariant
TRUEFALSE
yes
Evaluation Count:1250
yes
Evaluation Count:310
310-1250
455 q->itemChange(QGraphicsItem::ItemParentHasChanged, *newParentVariant);
executed: q->itemChange(QGraphicsItem::ItemParentHasChanged, *newParentVariant);
Execution Count:1250
1250
456 -
457 if (isObject)
evaluated: isObject
TRUEFALSE
yes
Evaluation Count:1528
yes
Evaluation Count:32
32-1528
458 static_cast<QGraphicsObject *>(q)->parentChanged();
executed: static_cast<QGraphicsObject *>(q)->parentChanged();
Execution Count:1528
1528
459}
executed: }
Execution Count:1560
1560
460 -
461 -
462 -
463 -
464 -
465 -
466void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rect, QGraphicsItem *topMostEffectItem) -
467{ -
468 QGraphicsItem * const q = q_func(); -
469 -
470 QRectF childrenRect; -
471 QRectF *result = rect; -
472 rect = &childrenRect; -
473 const bool setTopMostEffectItem = !topMostEffectItem; -
474 -
475 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:18
18
476 QGraphicsItem *child = children.at(i); -
477 QGraphicsItemPrivate *childd = child->d_ptr.data(); -
478 if (setTopMostEffectItem)
evaluated: setTopMostEffectItem
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:8
8-10
479 topMostEffectItem = child;
executed: topMostEffectItem = child;
Execution Count:10
10
480 bool hasPos = !childd->pos.isNull(); -
481 if (hasPos || childd->transformData) {
partially evaluated: hasPos
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
partially evaluated: childd->transformData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
0-18
482 -
483 QTransform matrix = childd->transformToParent(); -
484 if (x)
never evaluated: x
0
485 matrix *= *x;
never executed: matrix *= *x;
0
486 *rect |= matrix.mapRect(child->d_ptr->effectiveBoundingRect(topMostEffectItem)); -
487 if (!childd->children.isEmpty())
never evaluated: !childd->children.isEmpty()
0
488 childd->childrenBoundingRectHelper(&matrix, rect, topMostEffectItem);
never executed: childd->childrenBoundingRectHelper(&matrix, rect, topMostEffectItem);
0
489 } else {
never executed: }
0
490 if (x)
partially evaluated: x
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
0-18
491 *rect |= x->mapRect(child->d_ptr->effectiveBoundingRect(topMostEffectItem));
never executed: *rect |= x->mapRect(child->d_ptr->effectiveBoundingRect(topMostEffectItem));
0
492 else -
493 *rect |= child->d_ptr->effectiveBoundingRect(topMostEffectItem);
executed: *rect |= child->d_ptr->effectiveBoundingRect(topMostEffectItem);
Execution Count:18
18
494 if (!childd->children.isEmpty())
evaluated: !childd->children.isEmpty()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:10
8-10
495 childd->childrenBoundingRectHelper(x, rect, topMostEffectItem);
executed: childd->childrenBoundingRectHelper(x, rect, topMostEffectItem);
Execution Count:8
8
496 }
executed: }
Execution Count:18
18
497 } -
498 -
499 if (flags & QGraphicsItem::ItemClipsChildrenToShape){
evaluated: flags & QGraphicsItem::ItemClipsChildrenToShape
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:14
4-14
500 if (x)
partially evaluated: x
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
501 *rect &= x->mapRect(q->boundingRect());
never executed: *rect &= x->mapRect(q->boundingRect());
0
502 else -
503 *rect &= q->boundingRect();
executed: *rect &= q->boundingRect();
Execution Count:4
4
504 } -
505 -
506 *result |= *rect; -
507}
executed: }
Execution Count:18
18
508 -
509void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform, -
510 const QRegion &exposedRegion, bool allItems) const -
511{ -
512 qt_noop(); -
513 const QGraphicsItem * const q = q_func(); -
514 -
515 -
516 const QRectF brect = q->boundingRect(); -
517 option->state = QStyle::State_None; -
518 option->rect = brect.toRect(); -
519 option->levelOfDetail = 1; -
520 option->exposedRect = brect; -
521 -
522 -
523 -
524 -
525 option->styleObject = q_ptr->toGraphicsObject(); -
526 if (!option->styleObject)
evaluated: !option->styleObject
TRUEFALSE
yes
Evaluation Count:2219
yes
Evaluation Count:460
460-2219
527 option->styleObject = scene;
executed: option->styleObject = scene;
Execution Count:2219
2219
528 -
529 if (selected)
evaluated: selected
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2678
1-2678
530 option->state |= QStyle::State_Selected;
executed: option->state |= QStyle::State_Selected;
Execution Count:1
1
531 if (enabled)
partially evaluated: enabled
TRUEFALSE
yes
Evaluation Count:2679
no
Evaluation Count:0
0-2679
532 option->state |= QStyle::State_Enabled;
executed: option->state |= QStyle::State_Enabled;
Execution Count:2679
2679
533 if (q->hasFocus())
partially evaluated: q->hasFocus()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2679
0-2679
534 option->state |= QStyle::State_HasFocus;
never executed: option->state |= QStyle::State_HasFocus;
0
535 if (scene) {
partially evaluated: scene
TRUEFALSE
yes
Evaluation Count:2679
no
Evaluation Count:0
0-2679
536 if (scene->d_func()->hoverItems.contains(q_ptr))
partially evaluated: scene->d_func()->hoverItems.contains(q_ptr)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2679
0-2679
537 option->state |= QStyle::State_MouseOver;
never executed: option->state |= QStyle::State_MouseOver;
0
538 if (q == scene->mouseGrabberItem())
partially evaluated: q == scene->mouseGrabberItem()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2679
0-2679
539 option->state |= QStyle::State_Sunken;
never executed: option->state |= QStyle::State_Sunken;
0
540 }
executed: }
Execution Count:2679
2679
541 -
542 if (!(flags & QGraphicsItem::ItemUsesExtendedStyleOption))
evaluated: !(flags & QGraphicsItem::ItemUsesExtendedStyleOption)
TRUEFALSE
yes
Evaluation Count:2269
yes
Evaluation Count:410
410-2269
543 return;
executed: return;
Execution Count:2269
2269
544 -
545 -
546 option->matrix = worldTransform.toAffine(); -
547 -
548 if (!allItems) {
evaluated: !allItems
TRUEFALSE
yes
Evaluation Count:405
yes
Evaluation Count:5
5-405
549 -
550 option->exposedRect = QRectF(); -
551 const QTransform reverseMap = worldTransform.inverted(); -
552 const QVector<QRect> exposedRects(exposedRegion.rects()); -
553 for (int i = 0; i < exposedRects.size(); ++i) {
evaluated: i < exposedRects.size()
TRUEFALSE
yes
Evaluation Count:453
yes
Evaluation Count:122
122-453
554 option->exposedRect |= reverseMap.mapRect(QRectF(exposedRects.at(i))); -
555 if (option->exposedRect.contains(brect))
evaluated: option->exposedRect.contains(brect)
TRUEFALSE
yes
Evaluation Count:283
yes
Evaluation Count:170
170-283
556 break;
executed: break;
Execution Count:283
283
557 }
executed: }
Execution Count:170
170
558 option->exposedRect &= brect; -
559 }
executed: }
Execution Count:405
405
560}
executed: }
Execution Count:410
410
561 -
562 -
563 -
564 -
565 -
566 -
567void QGraphicsItemCache::purge() -
568{ -
569 QPixmapCache::remove(key); -
570 key = QPixmapCache::Key(); -
571 QMutableHashIterator<QPaintDevice *, DeviceData> it(deviceData); -
572 while (it.hasNext()) {
never evaluated: it.hasNext()
0
573 DeviceData &data = it.next().value(); -
574 QPixmapCache::remove(data.key); -
575 data.cacheIndent = QPoint(); -
576 }
never executed: }
0
577 deviceData.clear(); -
578 allExposed = true; -
579 exposed.clear(); -
580}
never executed: }
0
581QGraphicsItem::QGraphicsItem(QGraphicsItem *parent) -
582 : d_ptr(new QGraphicsItemPrivate) -
583{ -
584 d_ptr->q_ptr = this; -
585 setParentItem(parent); -
586}
executed: }
Execution Count:66
66
587 -
588 -
589 -
590 -
591QGraphicsItem::QGraphicsItem(QGraphicsItemPrivate &dd, QGraphicsItem *parent) -
592 : d_ptr(&dd) -
593{ -
594 d_ptr->q_ptr = this; -
595 setParentItem(parent); -
596}
executed: }
Execution Count:2215
2215
597QGraphicsItem::~QGraphicsItem() -
598{ -
599 if (d_ptr->isObject) {
evaluated: d_ptr->isObject
TRUEFALSE
yes
Evaluation Count:1102
yes
Evaluation Count:655
655-1102
600 QGraphicsObject *o = static_cast<QGraphicsObject *>(this); -
601 QObjectPrivate *p = QObjectPrivate::get(o); -
602 p->wasDeleted = true; -
603 if (p->declarativeData) {
partially evaluated: p->declarativeData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1102
0-1102
604 QAbstractDeclarativeData::destroyed(p->declarativeData, o); -
605 p->declarativeData = 0; -
606 }
never executed: }
0
607 }
executed: }
Execution Count:1102
1102
608 -
609 d_ptr->inDestructor = 1; -
610 d_ptr->removeExtraItemCache(); -
611 -
612 -
613 if (d_ptr->isObject && !d_ptr->gestureContext.isEmpty()) {
evaluated: d_ptr->isObject
TRUEFALSE
yes
Evaluation Count:1102
yes
Evaluation Count:655
evaluated: !d_ptr->gestureContext.isEmpty()
TRUEFALSE
yes
Evaluation Count:50
yes
Evaluation Count:1052
50-1102
614 QGraphicsObject *o = static_cast<QGraphicsObject *>(this); -
615 if (QGestureManager *manager = QGestureManager::instance()) {
partially evaluated: QGestureManager *manager = QGestureManager::instance()
TRUEFALSE
yes
Evaluation Count:50
no
Evaluation Count:0
0-50
616 for (QForeachContainer<__typeof__(d_ptr->gestureContext.keys())> _container_(d_ptr->gestureContext.keys()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (Qt::GestureType type = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
617 manager->cleanupCachedGestures(o, type);
executed: manager->cleanupCachedGestures(o, type);
Execution Count:50
50
618 }
executed: }
Execution Count:50
50
619 }
executed: }
Execution Count:50
50
620 -
621 -
622 clearFocus(); -
623 setFocusProxy(0); -
624 -
625 -
626 QGraphicsItem *p = d_ptr->parent; -
627 while (p) {
evaluated: p
TRUEFALSE
yes
Evaluation Count:764
yes
Evaluation Count:1757
764-1757
628 if (p->flags() & ItemIsFocusScope) {
partially evaluated: p->flags() & ItemIsFocusScope
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:764
0-764
629 if (p->d_ptr->focusScopeItem == this)
never evaluated: p->d_ptr->focusScopeItem == this
0
630 p->d_ptr->focusScopeItem = 0;
never executed: p->d_ptr->focusScopeItem = 0;
0
631 break;
never executed: break;
0
632 } -
633 p = p->d_ptr->parent; -
634 }
executed: }
Execution Count:764
764
635 -
636 if (!d_ptr->children.isEmpty()) {
evaluated: !d_ptr->children.isEmpty()
TRUEFALSE
yes
Evaluation Count:199
yes
Evaluation Count:1558
199-1558
637 while (!d_ptr->children.isEmpty())
evaluated: !d_ptr->children.isEmpty()
TRUEFALSE
yes
Evaluation Count:748
yes
Evaluation Count:199
199-748
638 delete d_ptr->children.first();
executed: delete d_ptr->children.first();
Execution Count:748
748
639 qt_noop(); -
640 }
executed: }
Execution Count:199
199
641 -
642 if (d_ptr->scene) {
evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:1686
yes
Evaluation Count:71
71-1686
643 d_ptr->scene->d_func()->removeItemHelper(this); -
644 } else {
executed: }
Execution Count:1686
1686
645 d_ptr->resetFocusProxy(); -
646 setParentItem(0); -
647 }
executed: }
Execution Count:71
71
648 -
649 -
650 delete d_ptr->graphicsEffect; -
651 -
652 if (d_ptr->transformData) {
evaluated: d_ptr->transformData
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:1745
12-1745
653 for(int i = 0; i < d_ptr->transformData->graphicsTransforms.size(); ++i) {
partially evaluated: i < d_ptr->transformData->graphicsTransforms.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
654 QGraphicsTransform *t = d_ptr->transformData->graphicsTransforms.at(i); -
655 static_cast<QGraphicsTransformPrivate *>(t->d_ptr.data())->item = 0; -
656 delete t; -
657 }
never executed: }
0
658 }
executed: }
Execution Count:12
12
659 delete d_ptr->transformData; -
660 -
661 if (QGraphicsItemCustomDataStore *dataStore = qt_dataStore())
partially evaluated: QGraphicsItemCustomDataStore *dataStore = qt_dataStore()
TRUEFALSE
yes
Evaluation Count:1757
no
Evaluation Count:0
0-1757
662 dataStore->data.remove(this);
executed: dataStore->data.remove(this);
Execution Count:1757
1757
663}
executed: }
Execution Count:1757
1757
664 -
665 -
666 -
667 -
668 -
669 -
670 -
671QGraphicsScene *QGraphicsItem::scene() const -
672{ -
673 return d_ptr->scene;
executed: return d_ptr->scene;
Execution Count:8897
8897
674} -
675 -
676 -
677 -
678 -
679 -
680 -
681 -
682QGraphicsItemGroup *QGraphicsItem::group() const -
683{ -
684 if (!d_ptr->isMemberOfGroup)
partially evaluated: !d_ptr->isMemberOfGroup
TRUEFALSE
yes
Evaluation Count:1967
no
Evaluation Count:0
0-1967
685 return 0;
executed: return 0;
Execution Count:1967
1967
686 QGraphicsItem *parent = const_cast<QGraphicsItem *>(this); -
687 while ((parent = parent->d_ptr->parent)) {
never evaluated: (parent = parent->d_ptr->parent)
0
688 if (QGraphicsItemGroup *group = qgraphicsitem_cast<QGraphicsItemGroup *>(parent))
never evaluated: QGraphicsItemGroup *group = qgraphicsitem_cast<QGraphicsItemGroup *>(parent)
0
689 return group;
never executed: return group;
0
690 }
never executed: }
0
691 -
692 -
693 return 0;
never executed: return 0;
0
694} -
695void QGraphicsItem::setGroup(QGraphicsItemGroup *group) -
696{ -
697 if (!group) {
never evaluated: !group
0
698 if (QGraphicsItemGroup *group = this->group())
never evaluated: QGraphicsItemGroup *group = this->group()
0
699 group->removeFromGroup(this);
never executed: group->removeFromGroup(this);
0
700 } else {
never executed: }
0
701 group->addToGroup(this); -
702 }
never executed: }
0
703} -
704 -
705 -
706 -
707 -
708 -
709 -
710 -
711QGraphicsItem *QGraphicsItem::parentItem() const -
712{ -
713 return d_ptr->parent;
executed: return d_ptr->parent;
Execution Count:15829
15829
714} -
715QGraphicsItem *QGraphicsItem::topLevelItem() const -
716{ -
717 QGraphicsItem *parent = const_cast<QGraphicsItem *>(this); -
718 while (QGraphicsItem *grandPa = parent->parentItem())
evaluated: QGraphicsItem *grandPa = parent->parentItem()
TRUEFALSE
yes
Evaluation Count:2678
yes
Evaluation Count:3361
2678-3361
719 parent = grandPa;
executed: parent = grandPa;
Execution Count:2678
2678
720 return parent;
executed: return parent;
Execution Count:3361
3361
721} -
722QGraphicsObject *QGraphicsItem::parentObject() const -
723{ -
724 QGraphicsItem *p = d_ptr->parent; -
725 return (p && p->d_ptr->isObject) ? static_cast<QGraphicsObject *>(p) : 0;
executed: return (p && p->d_ptr->isObject) ? static_cast<QGraphicsObject *>(p) : 0;
Execution Count:885
885
726} -
727QGraphicsWidget *QGraphicsItem::parentWidget() const -
728{ -
729 QGraphicsItem *p = parentItem(); -
730 while (p && !p->isWidget())
evaluated: p
TRUEFALSE
yes
Evaluation Count:4727
yes
Evaluation Count:1783
evaluated: !p->isWidget()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:4717
10-4727
731 p = p->parentItem();
executed: p = p->parentItem();
Execution Count:10
10
732 return (p && p->isWidget()) ? static_cast<QGraphicsWidget *>(p) : 0;
executed: return (p && p->isWidget()) ? static_cast<QGraphicsWidget *>(p) : 0;
Execution Count:6500
6500
733} -
734QGraphicsWidget *QGraphicsItem::topLevelWidget() const -
735{ -
736 if (const QGraphicsWidget *p = parentWidget())
never evaluated: const QGraphicsWidget *p = parentWidget()
0
737 return p->topLevelWidget();
never executed: return p->topLevelWidget();
0
738 return isWidget() ? static_cast<QGraphicsWidget *>(const_cast<QGraphicsItem *>(this)) : 0;
never executed: return isWidget() ? static_cast<QGraphicsWidget *>(const_cast<QGraphicsItem *>(this)) : 0;
0
739} -
740QGraphicsWidget *QGraphicsItem::window() const -
741{ -
742 QGraphicsItem *p = panel(); -
743 if (p && p->isWindow())
evaluated: p
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:290
partially evaluated: p->isWindow()
TRUEFALSE
yes
Evaluation Count:56
no
Evaluation Count:0
0-290
744 return static_cast<QGraphicsWidget *>(p);
executed: return static_cast<QGraphicsWidget *>(p);
Execution Count:56
56
745 return 0;
executed: return 0;
Execution Count:290
290
746} -
747QGraphicsItem *QGraphicsItem::panel() const -
748{ -
749 if (d_ptr->flags & ItemIsPanel)
evaluated: d_ptr->flags & ItemIsPanel
TRUEFALSE
yes
Evaluation Count:172
yes
Evaluation Count:393
172-393
750 return const_cast<QGraphicsItem *>(this);
executed: return const_cast<QGraphicsItem *>(this);
Execution Count:172
172
751 return d_ptr->parent ? d_ptr->parent->panel() : 0;
executed: return d_ptr->parent ? d_ptr->parent->panel() : 0;
Execution Count:393
393
752} -
753 -
754 -
755 -
756 -
757 -
758 -
759 -
760QGraphicsObject *QGraphicsItem::toGraphicsObject() -
761{ -
762 return d_ptr->isObject ? static_cast<QGraphicsObject *>(this) : 0;
executed: return d_ptr->isObject ? static_cast<QGraphicsObject *>(this) : 0;
Execution Count:5617
5617
763} -
764 -
765 -
766 -
767 -
768 -
769 -
770 -
771const QGraphicsObject *QGraphicsItem::toGraphicsObject() const -
772{ -
773 return d_ptr->isObject ? static_cast<const QGraphicsObject *>(this) : 0;
never executed: return d_ptr->isObject ? static_cast<const QGraphicsObject *>(this) : 0;
0
774} -
775void QGraphicsItem::setParentItem(QGraphicsItem *newParent) -
776{ -
777 if (newParent == this) {
partially evaluated: newParent == this
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3591
0-3591
778 QMessageLogger("graphicsview/qgraphicsitem.cpp", 1669, __PRETTY_FUNCTION__).warning("QGraphicsItem::setParentItem: cannot assign %p as a parent of itself", this); -
779 return;
never executed: return;
0
780 } -
781 if (newParent == d_ptr->parent)
evaluated: newParent == d_ptr->parent
TRUEFALSE
yes
Evaluation Count:2341
yes
Evaluation Count:1250
1250-2341
782 return;
executed: return;
Execution Count:2341
2341
783 -
784 const QVariant newParentVariant(itemChange(QGraphicsItem::ItemParentChange, -
785 QVariant::fromValue<QGraphicsItem *>(newParent))); -
786 newParent = qvariant_cast<QGraphicsItem *>(newParentVariant); -
787 if (newParent == d_ptr->parent)
partially evaluated: newParent == d_ptr->parent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1250
0-1250
788 return;
never executed: return;
0
789 -
790 const QVariant thisPointerVariant(QVariant::fromValue<QGraphicsItem *>(this)); -
791 d_ptr->setParentItemHelper(newParent, &newParentVariant, &thisPointerVariant); -
792}
executed: }
Execution Count:1250
1250
793QList<QGraphicsItem *> QGraphicsItem::childItems() const -
794{ -
795 const_cast<QGraphicsItem *>(this)->d_ptr->ensureSortedChildren(); -
796 return d_ptr->children;
executed: return d_ptr->children;
Execution Count:188
188
797} -
798 -
799 -
800 -
801 -
802 -
803 -
804bool QGraphicsItem::isWidget() const -
805{ -
806 return d_ptr->isWidget;
executed: return d_ptr->isWidget;
Execution Count:26161
26161
807} -
808bool QGraphicsItem::isWindow() const -
809{ -
810 return d_ptr->isWidget && (static_cast<const QGraphicsWidget *>(this)->windowType() & Qt::Window);
executed: return d_ptr->isWidget && (static_cast<const QGraphicsWidget *>(this)->windowType() & Qt::Window);
Execution Count:3456
3456
811} -
812 -
813 -
814 -
815 -
816 -
817 -
818 -
819bool QGraphicsItem::isPanel() const -
820{ -
821 return d_ptr->flags & ItemIsPanel;
executed: return d_ptr->flags & ItemIsPanel;
Execution Count:5638
5638
822} -
823QGraphicsItem::GraphicsItemFlags QGraphicsItem::flags() const -
824{ -
825 return GraphicsItemFlags(d_ptr->flags);
executed: return GraphicsItemFlags(d_ptr->flags);
Execution Count:3675
3675
826} -
827 -
828 -
829 -
830 -
831 -
832 -
833 -
834void QGraphicsItem::setFlag(GraphicsItemFlag flag, bool enabled) -
835{ -
836 if (enabled)
evaluated: enabled
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:11
11-43
837 setFlags(GraphicsItemFlags(d_ptr->flags) | flag);
executed: setFlags(GraphicsItemFlags(d_ptr->flags) | flag);
Execution Count:43
43
838 else -
839 setFlags(GraphicsItemFlags(d_ptr->flags) & ~flag);
executed: setFlags(GraphicsItemFlags(d_ptr->flags) & ~flag);
Execution Count:11
11
840} -
841void QGraphicsItem::setFlags(GraphicsItemFlags flags) -
842{ -
843 -
844 if (quint32(d_ptr->flags) == quint32(flags))
evaluated: quint32(d_ptr->flags) == quint32(flags)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:159
7-159
845 return;
executed: return;
Execution Count:7
7
846 flags = GraphicsItemFlags(itemChange(ItemFlagsChange, quint32(flags)).toUInt()); -
847 if (quint32(d_ptr->flags) == quint32(flags))
partially evaluated: quint32(d_ptr->flags) == quint32(flags)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:159
0-159
848 return;
never executed: return;
0
849 if (d_ptr->scene && d_ptr->scene->d_func()->indexMethod != QGraphicsScene::NoIndex)
evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:133
partially evaluated: d_ptr->scene->d_func()->indexMethod != QGraphicsScene::NoIndex
TRUEFALSE
yes
Evaluation Count:26
no
Evaluation Count:0
0-133
850 d_ptr->scene->d_func()->index->itemChange(this, ItemFlagsChange, &flags);
executed: d_ptr->scene->d_func()->index->itemChange(this, ItemFlagsChange, &flags);
Execution Count:26
26
851 -
852 -
853 const quint32 geomChangeFlagsMask = (ItemClipsChildrenToShape | ItemClipsToShape | ItemIgnoresTransformations | ItemIsSelectable); -
854 bool fullUpdate = (quint32(flags) & geomChangeFlagsMask) != (d_ptr->flags & geomChangeFlagsMask); -
855 if (fullUpdate)
evaluated: fullUpdate
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:135
24-135
856 d_ptr->updatePaintedViewBoundingRects( true);
executed: d_ptr->updatePaintedViewBoundingRects( true);
Execution Count:24
24
857 -
858 -
859 GraphicsItemFlags oldFlags = GraphicsItemFlags(d_ptr->flags); -
860 -
861 -
862 d_ptr->flags = flags; -
863 -
864 if (!(d_ptr->flags & ItemIsFocusable) && hasFocus()) {
evaluated: !(d_ptr->flags & ItemIsFocusable)
TRUEFALSE
yes
Evaluation Count:137
yes
Evaluation Count:22
partially evaluated: hasFocus()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:137
0-137
865 -
866 -
867 clearFocus(); -
868 }
never executed: }
0
869 -
870 if (!(d_ptr->flags & ItemIsSelectable) && isSelected()) {
evaluated: !(d_ptr->flags & ItemIsSelectable)
TRUEFALSE
yes
Evaluation Count:152
yes
Evaluation Count:7
partially evaluated: isSelected()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:152
0-152
871 -
872 -
873 setSelected(false); -
874 }
never executed: }
0
875 -
876 if ((flags & ItemClipsChildrenToShape) != (oldFlags & ItemClipsChildrenToShape)) {
evaluated: (flags & ItemClipsChildrenToShape) != (oldFlags & ItemClipsChildrenToShape)
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:146
13-146
877 -
878 -
879 d_ptr->updateAncestorFlag(ItemClipsChildrenToShape); -
880 -
881 -
882 d_ptr->dirtyChildrenBoundingRect = 1; -
883 d_ptr->markParentDirty(true); -
884 }
executed: }
Execution Count:13
13
885 -
886 if ((flags & ItemIgnoresTransformations) != (oldFlags & ItemIgnoresTransformations)) {
evaluated: (flags & ItemIgnoresTransformations) != (oldFlags & ItemIgnoresTransformations)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:155
4-155
887 -
888 -
889 d_ptr->updateAncestorFlag(ItemIgnoresTransformations); -
890 }
executed: }
Execution Count:4
4
891 -
892 if ((flags & ItemNegativeZStacksBehindParent) != (oldFlags & ItemNegativeZStacksBehindParent)) {
partially evaluated: (flags & ItemNegativeZStacksBehindParent) != (oldFlags & ItemNegativeZStacksBehindParent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:159
0-159
893 -
894 -
895 -
896 -
897 -
898 if (d_ptr->z < qreal(0.0))
never evaluated: d_ptr->z < qreal(0.0)
0
899 flags |= ItemStacksBehindParent;
never executed: flags |= ItemStacksBehindParent;
0
900 else -
901 flags &= ~ItemStacksBehindParent;
never executed: flags &= ~ItemStacksBehindParent;
0
902 d_ptr->flags = flags; -
903 }
never executed: }
0
904 -
905 if ((flags & ItemStacksBehindParent) != (oldFlags & ItemStacksBehindParent)) {
evaluated: (flags & ItemStacksBehindParent) != (oldFlags & ItemStacksBehindParent)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:158
1-158
906 -
907 -
908 -
909 -
910 if (d_ptr->parent)
partially evaluated: d_ptr->parent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
911 d_ptr->parent->d_ptr->needSortChildren = 1;
never executed: d_ptr->parent->d_ptr->needSortChildren = 1;
0
912 else if (d_ptr->scene)
partially evaluated: d_ptr->scene
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
913 d_ptr->scene->d_func()->needSortTopLevelItems = 1;
never executed: d_ptr->scene->d_func()->needSortTopLevelItems = 1;
0
914 } -
915 -
916 if ((flags & ItemAcceptsInputMethod) != (oldFlags & ItemAcceptsInputMethod)) {
evaluated: (flags & ItemAcceptsInputMethod) != (oldFlags & ItemAcceptsInputMethod)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:152
7-152
917 -
918 if (d_ptr->scene)
evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4
3-4
919 d_ptr->scene->d_func()->updateInputMethodSensitivityInViews();
executed: d_ptr->scene->d_func()->updateInputMethodSensitivityInViews();
Execution Count:3
3
920 }
executed: }
Execution Count:7
7
921 -
922 -
923 if ((d_ptr->panelModality != NonModal)
partially evaluated: (d_ptr->panelModality != NonModal)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:159
0-159
924 && d_ptr->scene
never evaluated: d_ptr->scene
0
925 && (flags & ItemIsPanel) != (oldFlags & ItemIsPanel)) {
never evaluated: (flags & ItemIsPanel) != (oldFlags & ItemIsPanel)
0
926 -
927 if (flags & ItemIsPanel)
never evaluated: flags & ItemIsPanel
0
928 d_ptr->scene->d_func()->enterModal(this);
never executed: d_ptr->scene->d_func()->enterModal(this);
0
929 else -
930 d_ptr->scene->d_func()->leaveModal(this);
never executed: d_ptr->scene->d_func()->leaveModal(this);
0
931 } -
932 -
933 if (d_ptr->scene) {
evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:133
26-133
934 if ((flags & ItemSendsScenePositionChanges) != (oldFlags & ItemSendsScenePositionChanges)) {
partially evaluated: (flags & ItemSendsScenePositionChanges) != (oldFlags & ItemSendsScenePositionChanges)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
935 if (flags & ItemSendsScenePositionChanges)
never evaluated: flags & ItemSendsScenePositionChanges
0
936 d_ptr->scene->d_func()->registerScenePosItem(this);
never executed: d_ptr->scene->d_func()->registerScenePosItem(this);
0
937 else -
938 d_ptr->scene->d_func()->unregisterScenePosItem(this);
never executed: d_ptr->scene->d_func()->unregisterScenePosItem(this);
0
939 } -
940 d_ptr->scene->d_func()->markDirty(this, QRectF(), true); -
941 }
executed: }
Execution Count:26
26
942 -
943 -
944 itemChange(ItemFlagsHaveChanged, quint32(flags)); -
945}
executed: }
Execution Count:159
159
946QGraphicsItem::CacheMode QGraphicsItem::cacheMode() const -
947{ -
948 return QGraphicsItem::CacheMode(d_ptr->cacheMode);
never executed: return QGraphicsItem::CacheMode(d_ptr->cacheMode);
0
949} -
950void QGraphicsItem::setCacheMode(CacheMode mode, const QSize &logicalCacheSize) -
951{ -
952 CacheMode lastMode = CacheMode(d_ptr->cacheMode); -
953 d_ptr->cacheMode = mode; -
954 bool noVisualChange = (mode == NoCache && lastMode == NoCache)
never evaluated: mode == NoCache
never evaluated: lastMode == NoCache
0
955 || (mode == NoCache && lastMode == DeviceCoordinateCache)
never evaluated: mode == NoCache
never evaluated: lastMode == DeviceCoordinateCache
0
956 || (mode == DeviceCoordinateCache && lastMode == NoCache)
never evaluated: mode == DeviceCoordinateCache
never evaluated: lastMode == NoCache
0
957 || (mode == DeviceCoordinateCache && lastMode == DeviceCoordinateCache);
never evaluated: mode == DeviceCoordinateCache
never evaluated: lastMode == DeviceCoordinateCache
0
958 if (mode == NoCache) {
never evaluated: mode == NoCache
0
959 d_ptr->removeExtraItemCache(); -
960 } else {
never executed: }
0
961 QGraphicsItemCache *cache = d_ptr->extraItemCache(); -
962 -
963 -
964 cache->purge(); -
965 -
966 if (mode == ItemCoordinateCache) {
never evaluated: mode == ItemCoordinateCache
0
967 if (lastMode == mode && cache->fixedSize == logicalCacheSize)
never evaluated: lastMode == mode
never evaluated: cache->fixedSize == logicalCacheSize
0
968 noVisualChange = true;
never executed: noVisualChange = true;
0
969 cache->fixedSize = logicalCacheSize; -
970 }
never executed: }
0
971 }
never executed: }
0
972 if (!noVisualChange)
never evaluated: !noVisualChange
0
973 update();
never executed: update();
0
974}
never executed: }
0
975 -
976 -
977 -
978 -
979 -
980 -
981QGraphicsItem::PanelModality QGraphicsItem::panelModality() const -
982{ -
983 return d_ptr->panelModality;
executed: return d_ptr->panelModality;
Execution Count:361
361
984} -
985void QGraphicsItem::setPanelModality(PanelModality panelModality) -
986{ -
987 if (d_ptr->panelModality == panelModality)
evaluated: d_ptr->panelModality == panelModality
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
988 return;
executed: return;
Execution Count:1
1
989 -
990 PanelModality previousModality = d_ptr->panelModality; -
991 bool enterLeaveModal = (isPanel() && d_ptr->scene && isVisible());
partially evaluated: isPanel()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
partially evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-3
992 if (enterLeaveModal && panelModality == NonModal)
evaluated: enterLeaveModal
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
partially evaluated: panelModality == NonModal
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
993 d_ptr->scene->d_func()->leaveModal(this);
never executed: d_ptr->scene->d_func()->leaveModal(this);
0
994 d_ptr->panelModality = panelModality; -
995 if (enterLeaveModal && d_ptr->panelModality != NonModal)
evaluated: enterLeaveModal
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
partially evaluated: d_ptr->panelModality != NonModal
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
996 d_ptr->scene->d_func()->enterModal(this, previousModality);
executed: d_ptr->scene->d_func()->enterModal(this, previousModality);
Execution Count:2
2
997}
executed: }
Execution Count:3
3
998bool QGraphicsItem::isBlockedByModalPanel(QGraphicsItem **blockingPanel) const -
999{ -
1000 if (!d_ptr->scene)
partially evaluated: !d_ptr->scene
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:758
0-758
1001 return false;
never executed: return false;
0
1002 -
1003 -
1004 QGraphicsItem *dummy = 0; -
1005 if (!blockingPanel)
evaluated: !blockingPanel
TRUEFALSE
yes
Evaluation Count:511
yes
Evaluation Count:247
247-511
1006 blockingPanel = &dummy;
executed: blockingPanel = &dummy;
Execution Count:511
511
1007 -
1008 QGraphicsScenePrivate *scene_d = d_ptr->scene->d_func(); -
1009 if (scene_d->modalPanels.isEmpty())
evaluated: scene_d->modalPanels.isEmpty()
TRUEFALSE
yes
Evaluation Count:750
yes
Evaluation Count:8
8-750
1010 return false;
executed: return false;
Execution Count:750
750
1011 -
1012 -
1013 if (!scene_d->popupWidgets.isEmpty() && scene_d->popupWidgets.first() == this)
partially evaluated: !scene_d->popupWidgets.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
never evaluated: scene_d->popupWidgets.first() == this
0-8
1014 return false;
never executed: return false;
0
1015 -
1016 for (int i = 0; i < scene_d->modalPanels.count(); ++i) {
evaluated: i < scene_d->modalPanels.count()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:5
5-8
1017 QGraphicsItem *modalPanel = scene_d->modalPanels.at(i); -
1018 if (modalPanel->panelModality() == QGraphicsItem::SceneModal) {
evaluated: modalPanel->panelModality() == QGraphicsItem::SceneModal
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
2-6
1019 -
1020 if (modalPanel != this && !modalPanel->isAncestorOf(this)) {
evaluated: modalPanel != this
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
partially evaluated: !modalPanel->isAncestorOf(this)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1021 *blockingPanel = modalPanel; -
1022 return true;
executed: return true;
Execution Count:1
1
1023 } -
1024 } else {
executed: }
Execution Count:1
1
1025 -
1026 if (modalPanel != this
evaluated: modalPanel != this
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3
1027 && !modalPanel->isAncestorOf(this)
partially evaluated: !modalPanel->isAncestorOf(this)
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
1028 && commonAncestorItem(modalPanel)) {
evaluated: commonAncestorItem(modalPanel)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1029 *blockingPanel = modalPanel; -
1030 return true;
executed: return true;
Execution Count:2
2
1031 } -
1032 }
executed: }
Execution Count:4
4
1033 } -
1034 return false;
executed: return false;
Execution Count:5
5
1035} -
1036QString QGraphicsItem::toolTip() const -
1037{ -
1038 return d_ptr->extra(QGraphicsItemPrivate::ExtraToolTip).toString();
never executed: return d_ptr->extra(QGraphicsItemPrivate::ExtraToolTip).toString();
0
1039} -
1040 -
1041 -
1042 -
1043 -
1044 -
1045 -
1046 -
1047void QGraphicsItem::setToolTip(const QString &toolTip) -
1048{ -
1049 const QVariant toolTipVariant(itemChange(ItemToolTipChange, toolTip)); -
1050 d_ptr->setExtra(QGraphicsItemPrivate::ExtraToolTip, toolTipVariant.toString()); -
1051 itemChange(ItemToolTipHasChanged, toolTipVariant); -
1052}
executed: }
Execution Count:52
52
1053QCursor QGraphicsItem::cursor() const -
1054{ -
1055 return qvariant_cast<QCursor>(d_ptr->extra(QGraphicsItemPrivate::ExtraCursor));
executed: return qvariant_cast<QCursor>(d_ptr->extra(QGraphicsItemPrivate::ExtraCursor));
Execution Count:21
21
1056} -
1057void QGraphicsItem::setCursor(const QCursor &cursor) -
1058{ -
1059 const QVariant cursorVariant(itemChange(ItemCursorChange, QVariant::fromValue<QCursor>(cursor))); -
1060 d_ptr->setExtra(QGraphicsItemPrivate::ExtraCursor, qvariant_cast<QCursor>(cursorVariant)); -
1061 d_ptr->hasCursor = 1; -
1062 if (d_ptr->scene) {
evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4
3-4
1063 d_ptr->scene->d_func()->allItemsUseDefaultCursor = false; -
1064 for (QForeachContainer<__typeof__(d_ptr->scene->views())> _container_(d_ptr->scene->views()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
1065 view->viewport()->setMouseTracking(true); -
1066 -
1067 if (view->underMouse()) {
partially evaluated: view->underMouse()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1068 for (QForeachContainer<__typeof__(view->items(view->mapFromGlobal(QCursor::pos())))> _container_(view->items(view->mapFromGlobal(QCursor::pos()))); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *itemUnderCursor = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
1069 if (itemUnderCursor->hasCursor()) {
partially evaluated: itemUnderCursor->hasCursor()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1070 QMetaObject::invokeMethod(view, "_q_setViewportCursor", -
1071 QArgument<QCursor >("QCursor", itemUnderCursor->cursor())); -
1072 break;
executed: break;
Execution Count:1
1
1073 } -
1074 }
never executed: }
0
1075 break;
executed: break;
Execution Count:1
1
1076 } -
1077 }
never executed: }
0
1078 }
executed: }
Execution Count:3
3
1079 itemChange(ItemCursorHasChanged, cursorVariant); -
1080}
executed: }
Execution Count:7
7
1081bool QGraphicsItem::hasCursor() const -
1082{ -
1083 return d_ptr->hasCursor;
executed: return d_ptr->hasCursor;
Execution Count:26
26
1084} -
1085 -
1086 -
1087 -
1088 -
1089 -
1090 -
1091void QGraphicsItem::unsetCursor() -
1092{ -
1093 if (!d_ptr->hasCursor)
never evaluated: !d_ptr->hasCursor
0
1094 return;
never executed: return;
0
1095 d_ptr->unsetExtra(QGraphicsItemPrivate::ExtraCursor); -
1096 d_ptr->hasCursor = 0; -
1097 if (d_ptr->scene) {
never evaluated: d_ptr->scene
0
1098 for (QForeachContainer<__typeof__(d_ptr->scene->views())> _container_(d_ptr->scene->views()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
1099 if (view->underMouse() && view->itemAt(view->mapFromGlobal(QCursor::pos())) == this) {
never evaluated: view->underMouse()
never evaluated: view->itemAt(view->mapFromGlobal(QCursor::pos())) == this
0
1100 QMetaObject::invokeMethod(view, "_q_unsetViewportCursor"); -
1101 break;
never executed: break;
0
1102 } -
1103 }
never executed: }
0
1104 }
never executed: }
0
1105}
never executed: }
0
1106bool QGraphicsItem::isVisible() const -
1107{ -
1108 return d_ptr->visible;
executed: return d_ptr->visible;
Execution Count:1746
1746
1109} -
1110bool QGraphicsItem::isVisibleTo(const QGraphicsItem *parent) const -
1111{ -
1112 const QGraphicsItem *p = this; -
1113 if (d_ptr->explicitlyHidden)
never evaluated: d_ptr->explicitlyHidden
0
1114 return false;
never executed: return false;
0
1115 do { -
1116 if (p == parent)
never evaluated: p == parent
0
1117 return true;
never executed: return true;
0
1118 if (p->d_ptr->explicitlyHidden)
never evaluated: p->d_ptr->explicitlyHidden
0
1119 return false;
never executed: return false;
0
1120 } while ((p = p->d_ptr->parent));
never evaluated: (p = p->d_ptr->parent)
never executed: }
0
1121 return parent == 0;
never executed: return parent == 0;
0
1122} -
1123 -
1124 -
1125 -
1126 -
1127 -
1128 -
1129 -
1130void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, -
1131 bool update, bool hiddenByPanel) -
1132{ -
1133 QGraphicsItem * const q = q_func(); -
1134 -
1135 -
1136 if (explicitly)
evaluated: explicitly
TRUEFALSE
yes
Evaluation Count:150
yes
Evaluation Count:2
2-150
1137 explicitlyHidden = newVisible ? 0 : 1;
evaluated: newVisible
TRUEFALSE
yes
Evaluation Count:142
yes
Evaluation Count:8
executed: explicitlyHidden = newVisible ? 0 : 1;
Execution Count:150
8-150
1138 -
1139 -
1140 if (visible == quint32(newVisible))
evaluated: visible == quint32(newVisible)
TRUEFALSE
yes
Evaluation Count:140
yes
Evaluation Count:12
12-140
1141 return;
executed: return;
Execution Count:140
140
1142 -
1143 -
1144 if (parent && newVisible && !parent->d_ptr->visible)
evaluated: parent
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:6
evaluated: newVisible
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4
partially evaluated: !parent->d_ptr->visible
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-6
1145 return;
never executed: return;
0
1146 -
1147 -
1148 const QVariant newVisibleVariant(q_ptr->itemChange(QGraphicsItem::ItemVisibleChange, -
1149 quint32(newVisible))); -
1150 newVisible = newVisibleVariant.toBool(); -
1151 if (visible == quint32(newVisible))
partially evaluated: visible == quint32(newVisible)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
1152 return;
never executed: return;
0
1153 visible = newVisible; -
1154 -
1155 -
1156 if (update) {
partially evaluated: update
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-12
1157 QGraphicsItemCache *c = (QGraphicsItemCache *)qvariant_cast<void *>(extra(ExtraCacheData)); -
1158 if (c)
partially evaluated: c
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
1159 c->purge();
never executed: c->purge();
0
1160 if (scene) {
evaluated: scene
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:3
3-9
1161 -
1162 invalidateParentGraphicsEffectsRecursively(); -
1163 -
1164 scene->d_func()->markDirty(q_ptr, QRectF(), false, true); -
1165 }
executed: }
Execution Count:9
9
1166 }
executed: }
Execution Count:12
12
1167 -
1168 -
1169 bool hasFocus = q_ptr->hasFocus(); -
1170 if (!newVisible) {
evaluated: !newVisible
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:4
4-8
1171 if (scene) {
evaluated: scene
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2
2-6
1172 if (scene->d_func()->mouseGrabberItems.contains(q))
partially evaluated: scene->d_func()->mouseGrabberItems.contains(q)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
1173 q->ungrabMouse();
never executed: q->ungrabMouse();
0
1174 if (scene->d_func()->keyboardGrabberItems.contains(q))
partially evaluated: scene->d_func()->keyboardGrabberItems.contains(q)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
1175 q->ungrabKeyboard();
never executed: q->ungrabKeyboard();
0
1176 if (q->isPanel() && panelModality != QGraphicsItem::NonModal)
partially evaluated: q->isPanel()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
never evaluated: panelModality != QGraphicsItem::NonModal
0-6
1177 scene->d_func()->leaveModal(q_ptr);
never executed: scene->d_func()->leaveModal(q_ptr);
0
1178 }
executed: }
Execution Count:6
6
1179 if (hasFocus && scene) {
partially evaluated: hasFocus
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
never evaluated: scene
0-8
1180 -
1181 QGraphicsItem *focusItem = scene->focusItem(); -
1182 bool clear = true; -
1183 if (isWidget && !focusItem->isPanel()) {
never evaluated: isWidget
never evaluated: !focusItem->isPanel()
0
1184 do { -
1185 if (focusItem == q_ptr) {
never evaluated: focusItem == q_ptr
0
1186 clear = !static_cast<QGraphicsWidget *>(q_ptr)->focusNextPrevChild(true); -
1187 break;
never executed: break;
0
1188 } -
1189 } while ((focusItem = focusItem->parentWidget()) && !focusItem->isPanel());
never evaluated: (focusItem = focusItem->parentWidget())
never evaluated: !focusItem->isPanel()
never executed: }
0
1190 }
never executed: }
0
1191 if (clear)
never evaluated: clear
0
1192 clearFocusHelper( false, hiddenByPanel);
never executed: clearFocusHelper( false, hiddenByPanel);
0
1193 }
never executed: }
0
1194 if (q_ptr->isSelected())
partially evaluated: q_ptr->isSelected()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1195 q_ptr->setSelected(false);
never executed: q_ptr->setSelected(false);
0
1196 } else {
executed: }
Execution Count:8
8
1197 geometryChanged = 1; -
1198 paintedViewBoundingRectsNeedRepaint = 1; -
1199 if (scene) {
evaluated: scene
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
1200 if (isWidget) {
partially evaluated: isWidget
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
1201 QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(q_ptr); -
1202 if (widget->windowType() == Qt::Popup)
partially evaluated: widget->windowType() == Qt::Popup
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
1203 scene->d_func()->addPopup(widget);
never executed: scene->d_func()->addPopup(widget);
0
1204 }
executed: }
Execution Count:3
3
1205 if (q->isPanel() && panelModality != QGraphicsItem::NonModal) {
partially evaluated: q->isPanel()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
never evaluated: panelModality != QGraphicsItem::NonModal
0-3
1206 scene->d_func()->enterModal(q_ptr); -
1207 }
never executed: }
0
1208 }
executed: }
Execution Count:3
3
1209 }
executed: }
Execution Count:4
4
1210 -
1211 -
1212 const bool updateChildren = update && !((flags & QGraphicsItem::ItemClipsChildrenToShape)
partially evaluated: update
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
partially evaluated: (flags & QGraphicsItem::ItemClipsChildrenToShape)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
1213 && !(flags & QGraphicsItem::ItemHasNoContents));
never evaluated: !(flags & QGraphicsItem::ItemHasNoContents)
0
1214 for (QForeachContainer<__typeof__(children)> _container_(children); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *child = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
1215 if (!newVisible || !child->d_ptr->explicitlyHidden)
evaluated: !newVisible
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
partially evaluated: !child->d_ptr->explicitlyHidden
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1216 child->d_ptr->setVisibleHelper(newVisible, false, updateChildren, hiddenByPanel);
executed: child->d_ptr->setVisibleHelper(newVisible, false, updateChildren, hiddenByPanel);
Execution Count:2
2
1217 }
executed: }
Execution Count:2
2
1218 -
1219 -
1220 if (scene && q->isPanel()) {
evaluated: scene
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:3
partially evaluated: q->isPanel()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
1221 if (newVisible) {
never evaluated: newVisible
0
1222 if (parent && parent->isActive())
never evaluated: parent
never evaluated: parent->isActive()
0
1223 q->setActive(true);
never executed: q->setActive(true);
0
1224 } else {
never executed: }
0
1225 if (q->isActive())
never evaluated: q->isActive()
0
1226 scene->setActivePanel(parent);
never executed: scene->setActivePanel(parent);
0
1227 }
never executed: }
0
1228 } -
1229 -
1230 -
1231 if (scene) {
evaluated: scene
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:3
3-9
1232 if (newVisible) {
evaluated: newVisible
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:6
3-6
1233 -
1234 QGraphicsItem *p = parent; -
1235 bool done = false; -
1236 while (p) {
evaluated: p
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-3
1237 if (p->flags() & QGraphicsItem::ItemIsFocusScope) {
partially evaluated: p->flags() & QGraphicsItem::ItemIsFocusScope
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1238 QGraphicsItem *fsi = p->d_ptr->focusScopeItem; -
1239 if (q_ptr == fsi || q_ptr->isAncestorOf(fsi)) {
never evaluated: q_ptr == fsi
never evaluated: q_ptr->isAncestorOf(fsi)
0
1240 done = true; -
1241 while (fsi->d_ptr->focusScopeItem && fsi->d_ptr->focusScopeItem->isVisible())
never evaluated: fsi->d_ptr->focusScopeItem
never evaluated: fsi->d_ptr->focusScopeItem->isVisible()
0
1242 fsi = fsi->d_ptr->focusScopeItem;
never executed: fsi = fsi->d_ptr->focusScopeItem;
0
1243 fsi->d_ptr->setFocusHelper(Qt::OtherFocusReason, true, -
1244 false); -
1245 }
never executed: }
0
1246 break;
never executed: break;
0
1247 } -
1248 p = p->d_ptr->parent; -
1249 }
executed: }
Execution Count:2
2
1250 if (!done) {
partially evaluated: !done
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
1251 QGraphicsItem *fi = subFocusItem; -
1252 if (fi && fi != scene->focusItem()) {
partially evaluated: fi
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
never evaluated: fi != scene->focusItem()
0-3
1253 scene->setFocusItem(fi); -
1254 } else if (flags & QGraphicsItem::ItemIsFocusScope &&
partially evaluated: flags & QGraphicsItem::ItemIsFocusScope
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
never executed: }
0-3
1255 !scene->focusItem() &&
never evaluated: !scene->focusItem()
0
1256 q->isAncestorOf(scene->d_func()->lastFocusItem)) {
never evaluated: q->isAncestorOf(scene->d_func()->lastFocusItem)
0
1257 q_ptr->setFocus(); -
1258 }
never executed: }
0
1259 } -
1260 } else {
executed: }
Execution Count:3
3
1261 -
1262 if (hasFocus) {
partially evaluated: hasFocus
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
1263 QGraphicsItem *p = parent; -
1264 while (p) {
never evaluated: p
0
1265 if (p->flags() & QGraphicsItem::ItemIsFocusScope) {
never evaluated: p->flags() & QGraphicsItem::ItemIsFocusScope
0
1266 if (p->d_ptr->visible) {
never evaluated: p->d_ptr->visible
0
1267 p->d_ptr->setFocusHelper(Qt::OtherFocusReason, true, -
1268 true); -
1269 }
never executed: }
0
1270 break;
never executed: break;
0
1271 } -
1272 p = p->d_ptr->parent; -
1273 }
never executed: }
0
1274 }
never executed: }
0
1275 }
executed: }
Execution Count:6
6
1276 } -
1277 -
1278 -
1279 q_ptr->itemChange(QGraphicsItem::ItemVisibleHasChanged, newVisibleVariant); -
1280 -
1281 if (isObject)
partially evaluated: isObject
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-12
1282 static_cast<QGraphicsObject *>(q_ptr)->visibleChanged();
executed: static_cast<QGraphicsObject *>(q_ptr)->visibleChanged();
Execution Count:12
12
1283}
executed: }
Execution Count:12
12
1284void QGraphicsItem::setVisible(bool visible) -
1285{ -
1286 d_ptr->setVisibleHelper(visible, -
1287 true, -
1288 true, -
1289 isPanel()); -
1290}
executed: }
Execution Count:150
150
1291bool QGraphicsItem::isEnabled() const -
1292{ -
1293 return d_ptr->enabled;
executed: return d_ptr->enabled;
Execution Count:2924
2924
1294} -
1295 -
1296 -
1297 -
1298 -
1299 -
1300 -
1301 -
1302void QGraphicsItemPrivate::setEnabledHelper(bool newEnabled, bool explicitly, bool update) -
1303{ -
1304 -
1305 if (explicitly)
partially evaluated: explicitly
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
0-11
1306 explicitlyDisabled = newEnabled ? 0 : 1;
evaluated: newEnabled
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:2
executed: explicitlyDisabled = newEnabled ? 0 : 1;
Execution Count:11
2-11
1307 -
1308 -
1309 if (enabled == quint32(newEnabled))
evaluated: enabled == quint32(newEnabled)
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:2
2-9
1310 return;
executed: return;
Execution Count:9
9
1311 -
1312 -
1313 if (!newEnabled) {
evaluated: !newEnabled
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
1314 if (scene && scene->mouseGrabberItem() == q_ptr)
partially evaluated: scene
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: scene->mouseGrabberItem() == q_ptr
0-1
1315 q_ptr->ungrabMouse();
never executed: q_ptr->ungrabMouse();
0
1316 if (q_ptr->hasFocus()) {
partially evaluated: q_ptr->hasFocus()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1317 -
1318 -
1319 QGraphicsItem *focusItem = scene->focusItem(); -
1320 bool clear = true; -
1321 if (isWidget && !focusItem->isPanel() && q_ptr->isAncestorOf(focusItem)) {
never evaluated: isWidget
never evaluated: !focusItem->isPanel()
never evaluated: q_ptr->isAncestorOf(focusItem)
0
1322 do { -
1323 if (focusItem == q_ptr) {
never evaluated: focusItem == q_ptr
0
1324 clear = !static_cast<QGraphicsWidget *>(q_ptr)->focusNextPrevChild(true); -
1325 break;
never executed: break;
0
1326 } -
1327 } while ((focusItem = focusItem->parentWidget()) && !focusItem->isPanel());
never evaluated: (focusItem = focusItem->parentWidget())
never evaluated: !focusItem->isPanel()
never executed: }
0
1328 }
never executed: }
0
1329 if (clear)
never evaluated: clear
0
1330 q_ptr->clearFocus();
never executed: q_ptr->clearFocus();
0
1331 }
never executed: }
0
1332 if (q_ptr->isSelected())
partially evaluated: q_ptr->isSelected()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1333 q_ptr->setSelected(false);
never executed: q_ptr->setSelected(false);
0
1334 }
executed: }
Execution Count:1
1
1335 -
1336 -
1337 const QVariant newEnabledVariant(q_ptr->itemChange(QGraphicsItem::ItemEnabledChange, -
1338 quint32(newEnabled))); -
1339 enabled = newEnabledVariant.toBool(); -
1340 -
1341 -
1342 if (update)
partially evaluated: update
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1343 q_ptr->update();
executed: q_ptr->update();
Execution Count:2
2
1344 -
1345 for (QForeachContainer<__typeof__(children)> _container_(children); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *child = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
1346 if (!newEnabled || !child->d_ptr->explicitlyDisabled)
never evaluated: !newEnabled
never evaluated: !child->d_ptr->explicitlyDisabled
0
1347 child->d_ptr->setEnabledHelper(newEnabled, false);
never executed: child->d_ptr->setEnabledHelper(newEnabled, false);
0
1348 }
never executed: }
0
1349 -
1350 -
1351 q_ptr->itemChange(QGraphicsItem::ItemEnabledHasChanged, newEnabledVariant); -
1352 -
1353 if (isObject)
partially evaluated: isObject
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1354 static_cast<QGraphicsObject *>(q_ptr)->enabledChanged();
executed: static_cast<QGraphicsObject *>(q_ptr)->enabledChanged();
Execution Count:2
2
1355}
executed: }
Execution Count:2
2
1356void QGraphicsItem::setEnabled(bool enabled) -
1357{ -
1358 d_ptr->setEnabledHelper(enabled, true); -
1359}
executed: }
Execution Count:11
11
1360bool QGraphicsItem::isSelected() const -
1361{ -
1362 if (QGraphicsItemGroup *group = this->group())
partially evaluated: QGraphicsItemGroup *group = this->group()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1959
0-1959
1363 return group->isSelected();
never executed: return group->isSelected();
0
1364 return d_ptr->selected;
executed: return d_ptr->selected;
Execution Count:1959
1959
1365} -
1366void QGraphicsItem::setSelected(bool selected) -
1367{ -
1368 if (QGraphicsItemGroup *group = this->group()) {
partially evaluated: QGraphicsItemGroup *group = this->group()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1369 group->setSelected(selected); -
1370 return;
never executed: return;
0
1371 } -
1372 -
1373 if (!(d_ptr->flags & ItemIsSelectable) || !d_ptr->enabled || !d_ptr->visible)
partially evaluated: !(d_ptr->flags & ItemIsSelectable)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
partially evaluated: !d_ptr->enabled
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
partially evaluated: !d_ptr->visible
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1374 selected = false;
never executed: selected = false;
0
1375 if (d_ptr->selected == selected)
partially evaluated: d_ptr->selected == selected
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1376 return;
never executed: return;
0
1377 const QVariant newSelectedVariant(itemChange(ItemSelectedChange, quint32(selected))); -
1378 bool newSelected = newSelectedVariant.toBool(); -
1379 if (d_ptr->selected == newSelected)
partially evaluated: d_ptr->selected == newSelected
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1380 return;
never executed: return;
0
1381 d_ptr->selected = newSelected; -
1382 -
1383 update(); -
1384 if (d_ptr->scene) {
partially evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
1385 QGraphicsScenePrivate *sceneD = d_ptr->scene->d_func(); -
1386 if (selected) {
evaluated: selected
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2
2-6
1387 sceneD->selectedItems << this; -
1388 } else {
executed: }
Execution Count:6
6
1389 -
1390 -
1391 }
executed: }
Execution Count:2
2
1392 if (!sceneD->selectionChanging)
evaluated: !sceneD->selectionChanging
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:5
3-5
1393 d_ptr->scene->selectionChanged();
executed: d_ptr->scene->selectionChanged();
Execution Count:3
3
1394 }
executed: }
Execution Count:8
8
1395 -
1396 -
1397 itemChange(QGraphicsItem::ItemSelectedHasChanged, newSelectedVariant); -
1398}
executed: }
Execution Count:8
8
1399qreal QGraphicsItem::opacity() const -
1400{ -
1401 return d_ptr->opacity;
executed: return d_ptr->opacity;
Execution Count:3
3
1402} -
1403qreal QGraphicsItem::effectiveOpacity() const -
1404{ -
1405 return d_ptr->effectiveOpacity();
never executed: return d_ptr->effectiveOpacity();
0
1406} -
1407void QGraphicsItem::setOpacity(qreal opacity) -
1408{ -
1409 -
1410 const QVariant newOpacityVariant(itemChange(ItemOpacityChange, opacity)); -
1411 -
1412 -
1413 qreal newOpacity = qBound(qreal(0), newOpacityVariant.toReal(), qreal(1)); -
1414 -
1415 -
1416 if (newOpacity == d_ptr->opacity)
evaluated: newOpacity == d_ptr->opacity
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:13
1-13
1417 return;
executed: return;
Execution Count:1
1
1418 -
1419 bool wasFullyTransparent = d_ptr->isOpacityNull(); -
1420 d_ptr->opacity = newOpacity; -
1421 -
1422 -
1423 itemChange(ItemOpacityHasChanged, newOpacityVariant); -
1424 -
1425 -
1426 if (d_ptr->scene) {
evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:3
3-10
1427 -
1428 d_ptr->invalidateParentGraphicsEffectsRecursively(); -
1429 if (!(d_ptr->flags & ItemDoesntPropagateOpacityToChildren))
partially evaluated: !(d_ptr->flags & ItemDoesntPropagateOpacityToChildren)
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
1430 d_ptr->invalidateChildGraphicsEffectsRecursively(QGraphicsItemPrivate::OpacityChanged);
executed: d_ptr->invalidateChildGraphicsEffectsRecursively(QGraphicsItemPrivate::OpacityChanged);
Execution Count:10
10
1431 -
1432 d_ptr->scene->d_func()->markDirty(this, QRectF(), -
1433 true, -
1434 false, -
1435 d_ptr->isOpacityNull()); -
1436 if (wasFullyTransparent)
partially evaluated: wasFullyTransparent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
1437 d_ptr->paintedViewBoundingRectsNeedRepaint = 1;
never executed: d_ptr->paintedViewBoundingRectsNeedRepaint = 1;
0
1438 }
executed: }
Execution Count:10
10
1439 -
1440 if (d_ptr->isObject)
evaluated: d_ptr->isObject
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:11
2-11
1441 static_cast<QGraphicsObject *>(this)->opacityChanged();
executed: static_cast<QGraphicsObject *>(this)->opacityChanged();
Execution Count:2
2
1442}
executed: }
Execution Count:13
13
1443 -
1444 -
1445 -
1446 -
1447 -
1448 -
1449 -
1450QGraphicsEffect *QGraphicsItem::graphicsEffect() const -
1451{ -
1452 return d_ptr->graphicsEffect;
executed: return d_ptr->graphicsEffect;
Execution Count:16
16
1453} -
1454void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect) -
1455{ -
1456 if (d_ptr->graphicsEffect == effect)
partially evaluated: d_ptr->graphicsEffect == effect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
1457 return;
never executed: return;
0
1458 -
1459 if (d_ptr->graphicsEffect) {
evaluated: d_ptr->graphicsEffect
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:22
4-22
1460 delete d_ptr->graphicsEffect; -
1461 d_ptr->graphicsEffect = 0; -
1462 } else if (d_ptr->parent) {
evaluated: d_ptr->parent
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:20
executed: }
Execution Count:4
2-20
1463 d_ptr->parent->d_ptr->updateChildWithGraphicsEffectFlagRecursively(); -
1464 }
executed: }
Execution Count:2
2
1465 -
1466 if (effect) {
evaluated: effect
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:4
4-22
1467 -
1468 QGraphicsEffectSourcePrivate *sourced = new QGraphicsItemEffectSourcePrivate(this); -
1469 QGraphicsEffectSource *source = new QGraphicsEffectSource(*sourced); -
1470 d_ptr->graphicsEffect = effect; -
1471 effect->d_func()->setGraphicsEffectSource(source); -
1472 prepareGeometryChange(); -
1473 }
executed: }
Execution Count:22
22
1474}
executed: }
Execution Count:26
26
1475 -
1476 -
1477void QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively() -
1478{ -
1479 -
1480 QGraphicsItemPrivate *itemPrivate = this; -
1481 do { -
1482 -
1483 if (itemPrivate->mayHaveChildWithGraphicsEffect)
partially evaluated: itemPrivate->mayHaveChildWithGraphicsEffect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1484 return;
never executed: return;
0
1485 itemPrivate->mayHaveChildWithGraphicsEffect = 1; -
1486 } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0));
partially evaluated: itemPrivate->parent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
executed: }
Execution Count:2
0-2
1487 -
1488}
executed: }
Execution Count:2
2
1489QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const -
1490{ -
1491 -
1492 const QGraphicsItem * const q = q_func(); -
1493 QGraphicsEffect *effect = graphicsEffect; -
1494 if (scene && effect && effect->isEnabled()) {
evaluated: scene
TRUEFALSE
yes
Evaluation Count:5630
yes
Evaluation Count:4
evaluated: effect
TRUEFALSE
yes
Evaluation Count:107
yes
Evaluation Count:5523
evaluated: effect->isEnabled()
TRUEFALSE
yes
Evaluation Count:103
yes
Evaluation Count:4
4-5630
1495 if (scene->d_func()->views.isEmpty())
evaluated: scene->d_func()->views.isEmpty()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:89
14-89
1496 return effect->boundingRectFor(rect);
executed: return effect->boundingRectFor(rect);
Execution Count:14
14
1497 QRectF sceneRect = q->mapRectToScene(rect); -
1498 QRectF sceneEffectRect; -
1499 for (QForeachContainer<__typeof__(scene->views())> _container_(scene->views()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
1500 QRectF deviceRect = view->d_func()->mapRectFromScene(sceneRect); -
1501 QRect deviceEffectRect = effect->boundingRectFor(deviceRect).toAlignedRect(); -
1502 sceneEffectRect |= view->d_func()->mapRectToScene(deviceEffectRect); -
1503 }
executed: }
Execution Count:89
89
1504 return q->mapRectFromScene(sceneEffectRect);
executed: return q->mapRectFromScene(sceneEffectRect);
Execution Count:89
89
1505 } -
1506 -
1507 return rect;
executed: return rect;
Execution Count:5531
5531
1508} -
1509QRectF QGraphicsItemPrivate::effectiveBoundingRect(QGraphicsItem *topMostEffectItem) const -
1510{ -
1511 -
1512 const QGraphicsItem * const q = q_func(); -
1513 QRectF brect = effectiveBoundingRect(q_ptr->boundingRect()); -
1514 if (ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren || topMostEffectItem == q)
evaluated: ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:5597
evaluated: topMostEffectItem == q
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:5588
9-5597
1515 return brect;
executed: return brect;
Execution Count:31
31
1516 -
1517 const QGraphicsItem *effectParent = parent; -
1518 while (effectParent) {
evaluated: effectParent
TRUEFALSE
yes
Evaluation Count:823
yes
Evaluation Count:5583
823-5583
1519 QGraphicsEffect *effect = effectParent->d_ptr->graphicsEffect; -
1520 if (scene && effect && effect->isEnabled()) {
evaluated: scene
TRUEFALSE
yes
Evaluation Count:822
yes
Evaluation Count:1
evaluated: effect
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:807
partially evaluated: effect->isEnabled()
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
0-822
1521 const QRectF brectInParentSpace = q->mapRectToItem(effectParent, brect); -
1522 const QRectF effectRectInParentSpace = effectParent->d_ptr->effectiveBoundingRect(brectInParentSpace); -
1523 brect = effectParent->mapRectToItem(q, effectRectInParentSpace); -
1524 }
executed: }
Execution Count:15
15
1525 if (effectParent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren
partially evaluated: effectParent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:823
0-823
1526 || topMostEffectItem == effectParent) {
evaluated: topMostEffectItem == effectParent
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:818
5-818
1527 return brect;
executed: return brect;
Execution Count:5
5
1528 } -
1529 effectParent = effectParent->d_ptr->parent; -
1530 }
executed: }
Execution Count:818
818
1531 -
1532 return brect;
executed: return brect;
Execution Count:5583
5583
1533 -
1534 -
1535 -
1536 -
1537} -
1538QRectF QGraphicsItemPrivate::sceneEffectiveBoundingRect() const -
1539{ -
1540 -
1541 -
1542 QPointF offset; -
1543 const QGraphicsItem *parentItem = q_ptr; -
1544 const QGraphicsItemPrivate *itemd; -
1545 do { -
1546 itemd = parentItem->d_ptr.data(); -
1547 if (itemd->transformData)
evaluated: itemd->transformData
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1408
15-1408
1548 break;
executed: break;
Execution Count:15
15
1549 offset += itemd->pos; -
1550 } while ((parentItem = itemd->parent));
evaluated: (parentItem = itemd->parent)
TRUEFALSE
yes
Evaluation Count:367
yes
Evaluation Count:1041
executed: }
Execution Count:1408
367-1408
1551 -
1552 QRectF br = effectiveBoundingRect(); -
1553 br.translate(offset); -
1554 return !parentItem ? br : parentItem->sceneTransform().mapRect(br);
executed: return !parentItem ? br : parentItem->sceneTransform().mapRect(br);
Execution Count:1056
1056
1555} -
1556bool QGraphicsItem::acceptDrops() const -
1557{ -
1558 return d_ptr->acceptDrops;
never executed: return d_ptr->acceptDrops;
0
1559} -
1560void QGraphicsItem::setAcceptDrops(bool on) -
1561{ -
1562 d_ptr->acceptDrops = on; -
1563}
executed: }
Execution Count:112
112
1564Qt::MouseButtons QGraphicsItem::acceptedMouseButtons() const -
1565{ -
1566 return Qt::MouseButtons(d_ptr->acceptedMouseButtons);
executed: return Qt::MouseButtons(d_ptr->acceptedMouseButtons);
Execution Count:105
105
1567} -
1568void QGraphicsItem::setAcceptedMouseButtons(Qt::MouseButtons buttons) -
1569{ -
1570 if (Qt::MouseButtons(d_ptr->acceptedMouseButtons) != buttons) {
never evaluated: Qt::MouseButtons(d_ptr->acceptedMouseButtons) != buttons
0
1571 if (buttons == 0 && d_ptr->scene && d_ptr->scene->mouseGrabberItem() == this
never evaluated: buttons == 0
never evaluated: d_ptr->scene
never evaluated: d_ptr->scene->mouseGrabberItem() == this
0
1572 && d_ptr->scene->d_func()->lastMouseGrabberItemHasImplicitMouseGrab) {
never evaluated: d_ptr->scene->d_func()->lastMouseGrabberItemHasImplicitMouseGrab
0
1573 ungrabMouse(); -
1574 }
never executed: }
0
1575 d_ptr->acceptedMouseButtons = quint32(buttons); -
1576 }
never executed: }
0
1577}
never executed: }
0
1578bool QGraphicsItem::acceptHoverEvents() const -
1579{ -
1580 return d_ptr->acceptsHover;
never executed: return d_ptr->acceptsHover;
0
1581} -
1582void QGraphicsItem::setAcceptHoverEvents(bool enabled) -
1583{ -
1584 if (d_ptr->acceptsHover == quint32(enabled))
partially evaluated: d_ptr->acceptsHover == quint32(enabled)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:115
0-115
1585 return;
never executed: return;
0
1586 d_ptr->acceptsHover = quint32(enabled); -
1587 if (d_ptr->acceptsHover && d_ptr->scene && d_ptr->scene->d_func()->allItemsIgnoreHoverEvents) {
partially evaluated: d_ptr->acceptsHover
TRUEFALSE
yes
Evaluation Count:115
no
Evaluation Count:0
partially evaluated: d_ptr->scene
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:115
never evaluated: d_ptr->scene->d_func()->allItemsIgnoreHoverEvents
0-115
1588 d_ptr->scene->d_func()->allItemsIgnoreHoverEvents = false; -
1589 d_ptr->scene->d_func()->enableMouseTrackingOnViews(); -
1590 }
never executed: }
0
1591}
executed: }
Execution Count:115
115
1592bool QGraphicsItem::acceptTouchEvents() const -
1593{ -
1594 return d_ptr->acceptTouchEvents;
never executed: return d_ptr->acceptTouchEvents;
0
1595} -
1596void QGraphicsItem::setAcceptTouchEvents(bool enabled) -
1597{ -
1598 if (d_ptr->acceptTouchEvents == quint32(enabled))
never evaluated: d_ptr->acceptTouchEvents == quint32(enabled)
0
1599 return;
never executed: return;
0
1600 d_ptr->acceptTouchEvents = quint32(enabled); -
1601 if (d_ptr->acceptTouchEvents && d_ptr->scene && d_ptr->scene->d_func()->allItemsIgnoreTouchEvents) {
never evaluated: d_ptr->acceptTouchEvents
never evaluated: d_ptr->scene
never evaluated: d_ptr->scene->d_func()->allItemsIgnoreTouchEvents
0
1602 d_ptr->scene->d_func()->allItemsIgnoreTouchEvents = false; -
1603 d_ptr->scene->d_func()->enableTouchEventsOnViews(); -
1604 }
never executed: }
0
1605}
never executed: }
0
1606bool QGraphicsItem::filtersChildEvents() const -
1607{ -
1608 return d_ptr->filtersDescendantEvents;
never executed: return d_ptr->filtersDescendantEvents;
0
1609} -
1610void QGraphicsItem::setFiltersChildEvents(bool enabled) -
1611{ -
1612 if (d_ptr->filtersDescendantEvents == enabled)
never evaluated: d_ptr->filtersDescendantEvents == enabled
0
1613 return;
never executed: return;
0
1614 -
1615 d_ptr->filtersDescendantEvents = enabled; -
1616 d_ptr->updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-2)); -
1617}
never executed: }
0
1618bool QGraphicsItem::handlesChildEvents() const -
1619{ -
1620 return d_ptr->handlesChildEvents;
never executed: return d_ptr->handlesChildEvents;
0
1621} -
1622void QGraphicsItem::setHandlesChildEvents(bool enabled) -
1623{ -
1624 if (d_ptr->handlesChildEvents == enabled)
never evaluated: d_ptr->handlesChildEvents == enabled
0
1625 return;
never executed: return;
0
1626 -
1627 d_ptr->handlesChildEvents = enabled; -
1628 d_ptr->updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-1)); -
1629}
never executed: }
0
1630bool QGraphicsItem::isActive() const -
1631{ -
1632 if (!d_ptr->scene || !d_ptr->scene->isActive())
evaluated: !d_ptr->scene
TRUEFALSE
yes
Evaluation Count:471
yes
Evaluation Count:984
evaluated: !d_ptr->scene->isActive()
TRUEFALSE
yes
Evaluation Count:867
yes
Evaluation Count:117
117-984
1633 return false;
executed: return false;
Execution Count:1338
1338
1634 return panel() == d_ptr->scene->activePanel();
executed: return panel() == d_ptr->scene->activePanel();
Execution Count:117
117
1635} -
1636void QGraphicsItem::setActive(bool active) -
1637{ -
1638 d_ptr->explicitActivate = 1; -
1639 d_ptr->wantsActive = active; -
1640 if (d_ptr->scene) {
partially evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
1641 if (active) {
partially evaluated: active
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
1642 -
1643 d_ptr->scene->setActivePanel(this); -
1644 } else {
executed: }
Execution Count:3
3
1645 -
1646 -
1647 QGraphicsItem *nextToActivate = 0; -
1648 if (d_ptr->parent)
never evaluated: d_ptr->parent
0
1649 nextToActivate = d_ptr->parent->panel();
never executed: nextToActivate = d_ptr->parent->panel();
0
1650 if (!nextToActivate)
never evaluated: !nextToActivate
0
1651 nextToActivate = d_ptr->scene->d_func()->lastActivePanel;
never executed: nextToActivate = d_ptr->scene->d_func()->lastActivePanel;
0
1652 if (nextToActivate == this || isAncestorOf(nextToActivate))
never evaluated: nextToActivate == this
never evaluated: isAncestorOf(nextToActivate)
0
1653 nextToActivate = 0;
never executed: nextToActivate = 0;
0
1654 d_ptr->scene->setActivePanel(nextToActivate); -
1655 }
never executed: }
0
1656 } -
1657}
executed: }
Execution Count:3
3
1658 -
1659 -
1660 -
1661 -
1662 -
1663 -
1664 -
1665bool QGraphicsItem::hasFocus() const -
1666{ -
1667 if (!d_ptr->scene || !d_ptr->scene->isActive())
evaluated: !d_ptr->scene
TRUEFALSE
yes
Evaluation Count:537
yes
Evaluation Count:7125
evaluated: !d_ptr->scene->isActive()
TRUEFALSE
yes
Evaluation Count:2965
yes
Evaluation Count:4160
537-7125
1668 return false;
executed: return false;
Execution Count:3502
3502
1669 -
1670 if (d_ptr->focusProxy)
partially evaluated: d_ptr->focusProxy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4160
0-4160
1671 return d_ptr->focusProxy->hasFocus();
never executed: return d_ptr->focusProxy->hasFocus();
0
1672 -
1673 if (d_ptr->scene->d_func()->focusItem != this)
evaluated: d_ptr->scene->d_func()->focusItem != this
TRUEFALSE
yes
Evaluation Count:4154
yes
Evaluation Count:6
6-4154
1674 return false;
executed: return false;
Execution Count:4154
4154
1675 -
1676 return panel() == d_ptr->scene->d_func()->activePanel;
executed: return panel() == d_ptr->scene->d_func()->activePanel;
Execution Count:6
6
1677} -
1678void QGraphicsItem::setFocus(Qt::FocusReason focusReason) -
1679{ -
1680 d_ptr->setFocusHelper(focusReason, true, false); -
1681}
executed: }
Execution Count:15
15
1682 -
1683 -
1684 -
1685 -
1686void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromHide) -
1687{ -
1688 -
1689 if (!q_ptr->isEnabled() || !(flags & QGraphicsItem::ItemIsFocusable))
partially evaluated: !q_ptr->isEnabled()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
evaluated: !(flags & QGraphicsItem::ItemIsFocusable)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:14
0-15
1690 return;
executed: return;
Execution Count:1
1
1691 -
1692 -
1693 QGraphicsItem *f = q_ptr; -
1694 while (f->d_ptr->focusProxy)
partially evaluated: f->d_ptr->focusProxy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
1695 f = f->d_ptr->focusProxy;
never executed: f = f->d_ptr->focusProxy;
0
1696 -
1697 -
1698 if (scene && scene->focusItem() == f)
partially evaluated: scene
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
partially evaluated: scene->focusItem() == f
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
1699 return;
never executed: return;
0
1700 -
1701 -
1702 QGraphicsItem *p = parent; -
1703 while (p) {
partially evaluated: p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
1704 if (p->flags() & QGraphicsItem::ItemIsFocusScope) {
never evaluated: p->flags() & QGraphicsItem::ItemIsFocusScope
0
1705 QGraphicsItem *oldFocusScopeItem = p->d_ptr->focusScopeItem; -
1706 p->d_ptr->focusScopeItem = q_ptr; -
1707 if (oldFocusScopeItem)
never evaluated: oldFocusScopeItem
0
1708 oldFocusScopeItem->d_ptr->focusScopeItemChange(false);
never executed: oldFocusScopeItem->d_ptr->focusScopeItemChange(false);
0
1709 focusScopeItemChange(true); -
1710 if (!p->focusItem() && !focusFromHide) {
never evaluated: !p->focusItem()
never evaluated: !focusFromHide
0
1711 -
1712 -
1713 -
1714 -
1715 return;
never executed: return;
0
1716 } -
1717 break;
never executed: break;
0
1718 } -
1719 p = p->d_ptr->parent; -
1720 }
never executed: }
0
1721 -
1722 if (climb) {
partially evaluated: climb
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
1723 while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible())
partially evaluated: f->d_ptr->focusScopeItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
never evaluated: f->d_ptr->focusScopeItem->isVisible()
0-14
1724 f = f->d_ptr->focusScopeItem;
never executed: f = f->d_ptr->focusScopeItem;
0
1725 }
executed: }
Execution Count:14
14
1726 -
1727 -
1728 QGraphicsItem *commonAncestor = 0; -
1729 if (scene && scene->focusItem() && scene->focusItem()->panel() == q_ptr->panel()) {
partially evaluated: scene
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
evaluated: scene->focusItem()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:8
partially evaluated: scene->focusItem()->panel() == q_ptr->panel()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-14
1730 commonAncestor = scene->focusItem()->commonAncestorItem(f); -
1731 scene->focusItem()->d_ptr->clearSubFocus(scene->focusItem(), commonAncestor); -
1732 }
executed: }
Execution Count:6
6
1733 -
1734 f->d_ptr->setSubFocus(f, commonAncestor); -
1735 -
1736 -
1737 if (scene) {
partially evaluated: scene
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
1738 QGraphicsItem *p = q_ptr->panel(); -
1739 if ((!p && scene->isActive()) || (p && p->isActive())) {
partially evaluated: !p
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
evaluated: scene->isActive()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:1
partially evaluated: p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: p->isActive()
0-14
1740 -
1741 scene->d_func()->setFocusItemHelper(f, focusReason); -
1742 }
executed: }
Execution Count:13
13
1743 }
executed: }
Execution Count:14
14
1744}
executed: }
Execution Count:14
14
1745void QGraphicsItem::clearFocus() -
1746{ -
1747 d_ptr->clearFocusHelper( true, -
1748 false); -
1749}
executed: }
Execution Count:4393
4393
1750 -
1751 -
1752 -
1753 -
1754void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent, bool hiddenByParentPanel) -
1755{ -
1756 QGraphicsItem *subFocusItem = q_ptr; -
1757 if (flags & QGraphicsItem::ItemIsFocusScope) {
partially evaluated: flags & QGraphicsItem::ItemIsFocusScope
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4393
0-4393
1758 while (subFocusItem->d_ptr->focusScopeItem)
never evaluated: subFocusItem->d_ptr->focusScopeItem
0
1759 subFocusItem = subFocusItem->d_ptr->focusScopeItem;
never executed: subFocusItem = subFocusItem->d_ptr->focusScopeItem;
0
1760 }
never executed: }
0
1761 -
1762 if (giveFocusToParent) {
partially evaluated: giveFocusToParent
TRUEFALSE
yes
Evaluation Count:4393
no
Evaluation Count:0
0-4393
1763 -
1764 if (!inDestructor) {
evaluated: !inDestructor
TRUEFALSE
yes
Evaluation Count:950
yes
Evaluation Count:3443
950-3443
1765 QGraphicsItem *p = parent; -
1766 while (p) {
evaluated: p
TRUEFALSE
yes
Evaluation Count:741
yes
Evaluation Count:950
741-950
1767 if (p->flags() & QGraphicsItem::ItemIsFocusScope) {
partially evaluated: p->flags() & QGraphicsItem::ItemIsFocusScope
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:741
0-741
1768 if (p->d_ptr->focusScopeItem == q_ptr) {
never evaluated: p->d_ptr->focusScopeItem == q_ptr
0
1769 p->d_ptr->focusScopeItem = 0; -
1770 if (!subFocusItem->hasFocus())
never evaluated: !subFocusItem->hasFocus()
0
1771 focusScopeItemChange(false);
never executed: focusScopeItemChange(false);
0
1772 }
never executed: }
0
1773 if (subFocusItem->hasFocus())
never evaluated: subFocusItem->hasFocus()
0
1774 p->d_ptr->setFocusHelper(Qt::OtherFocusReason, false, 0
1775 false);
never executed: p->d_ptr->setFocusHelper(Qt::OtherFocusReason, false, false);
0
1776 return;
never executed: return;
0
1777 } -
1778 p = p->d_ptr->parent; -
1779 }
executed: }
Execution Count:741
741
1780 }
executed: }
Execution Count:950
950
1781 }
executed: }
Execution Count:4393
4393
1782 -
1783 if (subFocusItem->hasFocus()) {
evaluated: subFocusItem->hasFocus()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4388
5-4388
1784 -
1785 if (!hiddenByParentPanel)
partially evaluated: !hiddenByParentPanel
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1786 clearSubFocus(q_ptr);
executed: clearSubFocus(q_ptr);
Execution Count:5
5
1787 -
1788 -
1789 scene->setFocusItem(0); -
1790 }
executed: }
Execution Count:5
5
1791}
executed: }
Execution Count:4393
4393
1792QGraphicsItem *QGraphicsItem::focusProxy() const -
1793{ -
1794 return d_ptr->focusProxy;
never executed: return d_ptr->focusProxy;
0
1795} -
1796void QGraphicsItem::setFocusProxy(QGraphicsItem *item) -
1797{ -
1798 if (item == d_ptr->focusProxy)
partially evaluated: item == d_ptr->focusProxy
TRUEFALSE
yes
Evaluation Count:1757
no
Evaluation Count:0
0-1757
1799 return;
executed: return;
Execution Count:1757
1757
1800 if (item == this) {
never evaluated: item == this
0
1801 QMessageLogger("graphicsview/qgraphicsitem.cpp", 3374, __PRETTY_FUNCTION__).warning("QGraphicsItem::setFocusProxy: cannot assign self as focus proxy"); -
1802 return;
never executed: return;
0
1803 } -
1804 if (item) {
never evaluated: item
0
1805 if (item->d_ptr->scene != d_ptr->scene) {
never evaluated: item->d_ptr->scene != d_ptr->scene
0
1806 QMessageLogger("graphicsview/qgraphicsitem.cpp", 3379, __PRETTY_FUNCTION__).warning("QGraphicsItem::setFocusProxy: focus proxy must be in same scene"); -
1807 return;
never executed: return;
0
1808 } -
1809 for (QGraphicsItem *f = item->focusProxy(); f != 0; f = f->focusProxy()) {
never evaluated: f != 0
0
1810 if (f == this) {
never evaluated: f == this
0
1811 QMessageLogger("graphicsview/qgraphicsitem.cpp", 3384, __PRETTY_FUNCTION__).warning("QGraphicsItem::setFocusProxy: %p is already in the focus proxy chain", item); -
1812 return;
never executed: return;
0
1813 } -
1814 }
never executed: }
0
1815 }
never executed: }
0
1816 -
1817 QGraphicsItem *lastFocusProxy = d_ptr->focusProxy; -
1818 if (lastFocusProxy)
never evaluated: lastFocusProxy
0
1819 lastFocusProxy->d_ptr->focusProxyRefs.removeOne(&d_ptr->focusProxy);
never executed: lastFocusProxy->d_ptr->focusProxyRefs.removeOne(&d_ptr->focusProxy);
0
1820 d_ptr->focusProxy = item; -
1821 if (item)
never evaluated: item
0
1822 item->d_ptr->focusProxyRefs << &d_ptr->focusProxy;
never executed: item->d_ptr->focusProxyRefs << &d_ptr->focusProxy;
0
1823}
never executed: }
0
1824QGraphicsItem *QGraphicsItem::focusItem() const -
1825{ -
1826 return d_ptr->subFocusItem;
executed: return d_ptr->subFocusItem;
Execution Count:1741
1741
1827} -
1828 -
1829 -
1830 -
1831 -
1832 -
1833 -
1834QGraphicsItem *QGraphicsItem::focusScopeItem() const -
1835{ -
1836 return d_ptr->focusScopeItem;
never executed: return d_ptr->focusScopeItem;
0
1837} -
1838void QGraphicsItem::grabMouse() -
1839{ -
1840 if (!d_ptr->scene) {
never evaluated: !d_ptr->scene
0
1841 QMessageLogger("graphicsview/qgraphicsitem.cpp", 3459, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabMouse: cannot grab mouse without scene"); -
1842 return;
never executed: return;
0
1843 } -
1844 if (!d_ptr->visible) {
never evaluated: !d_ptr->visible
0
1845 QMessageLogger("graphicsview/qgraphicsitem.cpp", 3463, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabMouse: cannot grab mouse while invisible"); -
1846 return;
never executed: return;
0
1847 } -
1848 d_ptr->scene->d_func()->grabMouse(this); -
1849}
never executed: }
0
1850 -
1851 -
1852 -
1853 -
1854 -
1855 -
1856 -
1857void QGraphicsItem::ungrabMouse() -
1858{ -
1859 if (!d_ptr->scene) {
partially evaluated: !d_ptr->scene
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
1860 QMessageLogger("graphicsview/qgraphicsitem.cpp", 3478, __PRETTY_FUNCTION__).warning("QGraphicsItem::ungrabMouse: cannot ungrab mouse without scene"); -
1861 return;
never executed: return;
0
1862 } -
1863 d_ptr->scene->d_func()->ungrabMouse(this); -
1864}
executed: }
Execution Count:104
104
1865void QGraphicsItem::grabKeyboard() -
1866{ -
1867 if (!d_ptr->scene) {
never evaluated: !d_ptr->scene
0
1868 QMessageLogger("graphicsview/qgraphicsitem.cpp", 3521, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabKeyboard: cannot grab keyboard without scene"); -
1869 return;
never executed: return;
0
1870 } -
1871 if (!d_ptr->visible) {
never evaluated: !d_ptr->visible
0
1872 QMessageLogger("graphicsview/qgraphicsitem.cpp", 3525, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabKeyboard: cannot grab keyboard while invisible"); -
1873 return;
never executed: return;
0
1874 } -
1875 d_ptr->scene->d_func()->grabKeyboard(this); -
1876}
never executed: }
0
1877 -
1878 -
1879 -
1880 -
1881 -
1882 -
1883 -
1884void QGraphicsItem::ungrabKeyboard() -
1885{ -
1886 if (!d_ptr->scene) {
never evaluated: !d_ptr->scene
0
1887 QMessageLogger("graphicsview/qgraphicsitem.cpp", 3540, __PRETTY_FUNCTION__).warning("QGraphicsItem::ungrabKeyboard: cannot ungrab keyboard without scene"); -
1888 return;
never executed: return;
0
1889 } -
1890 d_ptr->scene->d_func()->ungrabKeyboard(this); -
1891}
never executed: }
0
1892QPointF QGraphicsItem::pos() const -
1893{ -
1894 return d_ptr->pos;
executed: return d_ptr->pos;
Execution Count:8007
8007
1895} -
1896void QGraphicsItem::setX(qreal x) -
1897{ -
1898 if (d_ptr->inDestructor)
partially evaluated: d_ptr->inDestructor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
1899 return;
never executed: return;
0
1900 -
1901 if (qIsNaN(x))
partially evaluated: qIsNaN(x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
1902 return;
never executed: return;
0
1903 -
1904 setPos(QPointF(x, d_ptr->pos.y())); -
1905}
executed: }
Execution Count:3
3
1906void QGraphicsItem::setY(qreal y) -
1907{ -
1908 if (d_ptr->inDestructor)
partially evaluated: d_ptr->inDestructor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
1909 return;
never executed: return;
0
1910 -
1911 if (qIsNaN(y))
partially evaluated: qIsNaN(y)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
1912 return;
never executed: return;
0
1913 -
1914 setPos(QPointF(d_ptr->pos.x(), y)); -
1915}
executed: }
Execution Count:3
3
1916 -
1917 -
1918 -
1919 -
1920 -
1921 -
1922 -
1923QPointF QGraphicsItem::scenePos() const -
1924{ -
1925 return mapToScene(0, 0);
executed: return mapToScene(0, 0);
Execution Count:3
3
1926} -
1927 -
1928 -
1929 -
1930 -
1931 -
1932 -
1933void QGraphicsItemPrivate::setPosHelper(const QPointF &pos) -
1934{ -
1935 QGraphicsItem * const q = q_func(); -
1936 inSetPosHelper = 1; -
1937 if (scene)
evaluated: scene
TRUEFALSE
yes
Evaluation Count:998
yes
Evaluation Count:38
38-998
1938 q->prepareGeometryChange();
executed: q->prepareGeometryChange();
Execution Count:998
998
1939 QPointF oldPos = this->pos; -
1940 this->pos = pos; -
1941 dirtySceneTransform = 1; -
1942 inSetPosHelper = 0; -
1943 if (isObject) {
evaluated: isObject
TRUEFALSE
yes
Evaluation Count:878
yes
Evaluation Count:158
158-878
1944 if (pos.x() != oldPos.x())
evaluated: pos.x() != oldPos.x()
TRUEFALSE
yes
Evaluation Count:613
yes
Evaluation Count:265
265-613
1945 static_cast<QGraphicsObject *>(q_ptr)->xChanged();
executed: static_cast<QGraphicsObject *>(q_ptr)->xChanged();
Execution Count:613
613
1946 if (pos.y() != oldPos.y())
evaluated: pos.y() != oldPos.y()
TRUEFALSE
yes
Evaluation Count:585
yes
Evaluation Count:293
293-585
1947 static_cast<QGraphicsObject *>(q_ptr)->yChanged();
executed: static_cast<QGraphicsObject *>(q_ptr)->yChanged();
Execution Count:585
585
1948 }
executed: }
Execution Count:878
878
1949}
executed: }
Execution Count:1036
1036
1950 -
1951 -
1952 -
1953 -
1954 -
1955 -
1956void QGraphicsItemPrivate::setTransformHelper(const QTransform &transform) -
1957{ -
1958 q_ptr->prepareGeometryChange(); -
1959 transformData->transform = transform; -
1960 dirtySceneTransform = 1; -
1961 transformChanged(); -
1962}
executed: }
Execution Count:14
14
1963void QGraphicsItem::setPos(const QPointF &pos) -
1964{ -
1965 if (d_ptr->pos == pos)
evaluated: d_ptr->pos == pos
TRUEFALSE
yes
Evaluation Count:1228
yes
Evaluation Count:1036
1036-1228
1966 return;
executed: return;
Execution Count:1228
1228
1967 -
1968 if (d_ptr->inDestructor)
partially evaluated: d_ptr->inDestructor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1036
0-1036
1969 return;
never executed: return;
0
1970 -
1971 -
1972 if (!(d_ptr->flags & (ItemSendsGeometryChanges | ItemSendsScenePositionChanges))) {
evaluated: !(d_ptr->flags & (ItemSendsGeometryChanges | ItemSendsScenePositionChanges))
TRUEFALSE
yes
Evaluation Count:283
yes
Evaluation Count:753
283-753
1973 d_ptr->setPosHelper(pos); -
1974 if (d_ptr->isWidget)
partially evaluated: d_ptr->isWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:283
0-283
1975 static_cast<QGraphicsWidget *>(this)->d_func()->setGeometryFromSetPos();
never executed: static_cast<QGraphicsWidget *>(this)->d_func()->setGeometryFromSetPos();
0
1976 if (d_ptr->scenePosDescendants)
partially evaluated: d_ptr->scenePosDescendants
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:283
0-283
1977 d_ptr->sendScenePosChange();
never executed: d_ptr->sendScenePosChange();
0
1978 return;
executed: return;
Execution Count:283
283
1979 } -
1980 -
1981 -
1982 const QVariant newPosVariant(itemChange(ItemPositionChange, QVariant::fromValue<QPointF>(pos))); -
1983 QPointF newPos = newPosVariant.toPointF(); -
1984 if (newPos == d_ptr->pos)
partially evaluated: newPos == d_ptr->pos
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:753
0-753
1985 return;
never executed: return;
0
1986 -
1987 -
1988 d_ptr->setPosHelper(newPos); -
1989 -
1990 -
1991 itemChange(QGraphicsItem::ItemPositionHasChanged, newPosVariant); -
1992 d_ptr->sendScenePosChange(); -
1993}
executed: }
Execution Count:753
753
1994void QGraphicsItem::ensureVisible(const QRectF &rect, int xmargin, int ymargin) -
1995{ -
1996 if (d_ptr->scene) {
never evaluated: d_ptr->scene
0
1997 QRectF sceneRect; -
1998 if (!rect.isNull())
never evaluated: !rect.isNull()
0
1999 sceneRect = sceneTransform().mapRect(rect);
never executed: sceneRect = sceneTransform().mapRect(rect);
0
2000 else -
2001 sceneRect = sceneBoundingRect();
never executed: sceneRect = sceneBoundingRect();
0
2002 for (QForeachContainer<__typeof__(d_ptr->scene->d_func()->views)> _container_(d_ptr->scene->d_func()->views); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
2003 view->ensureVisible(sceneRect, xmargin, ymargin);
never executed: view->ensureVisible(sceneRect, xmargin, ymargin);
0
2004 }
never executed: }
0
2005}
never executed: }
0
2006QMatrix QGraphicsItem::matrix() const -
2007{ -
2008 return transform().toAffine();
never executed: return transform().toAffine();
0
2009} -
2010QTransform QGraphicsItem::transform() const -
2011{ -
2012 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
2013 return QTransform();
never executed: return QTransform();
0
2014 return d_ptr->transformData->transform;
never executed: return d_ptr->transformData->transform;
0
2015} -
2016qreal QGraphicsItem::rotation() const -
2017{ -
2018 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
2019 return 0;
never executed: return 0;
0
2020 return d_ptr->transformData->rotation;
never executed: return d_ptr->transformData->rotation;
0
2021} -
2022void QGraphicsItem::setRotation(qreal angle) -
2023{ -
2024 prepareGeometryChange(); -
2025 qreal newRotation = angle; -
2026 -
2027 if (d_ptr->flags & ItemSendsGeometryChanges) {
never evaluated: d_ptr->flags & ItemSendsGeometryChanges
0
2028 -
2029 const QVariant newRotationVariant(itemChange(ItemRotationChange, angle)); -
2030 newRotation = newRotationVariant.toReal(); -
2031 }
never executed: }
0
2032 -
2033 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
2034 d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
never executed: d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
0
2035 -
2036 if (d_ptr->transformData->rotation == newRotation)
never evaluated: d_ptr->transformData->rotation == newRotation
0
2037 return;
never executed: return;
0
2038 -
2039 d_ptr->transformData->rotation = newRotation; -
2040 d_ptr->transformData->onlyTransform = false; -
2041 d_ptr->dirtySceneTransform = 1; -
2042 -
2043 -
2044 if (d_ptr->flags & ItemSendsGeometryChanges)
never evaluated: d_ptr->flags & ItemSendsGeometryChanges
0
2045 itemChange(ItemRotationHasChanged, newRotation);
never executed: itemChange(ItemRotationHasChanged, newRotation);
0
2046 -
2047 if (d_ptr->isObject)
never evaluated: d_ptr->isObject
0
2048 static_cast<QGraphicsObject *>(this)->rotationChanged();
never executed: static_cast<QGraphicsObject *>(this)->rotationChanged();
0
2049 -
2050 d_ptr->transformChanged(); -
2051}
never executed: }
0
2052qreal QGraphicsItem::scale() const -
2053{ -
2054 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
2055 return 1.;
never executed: return 1.;
0
2056 return d_ptr->transformData->scale;
never executed: return d_ptr->transformData->scale;
0
2057} -
2058void QGraphicsItem::setScale(qreal factor) -
2059{ -
2060 prepareGeometryChange(); -
2061 qreal newScale = factor; -
2062 -
2063 if (d_ptr->flags & ItemSendsGeometryChanges) {
never evaluated: d_ptr->flags & ItemSendsGeometryChanges
0
2064 -
2065 const QVariant newScaleVariant(itemChange(ItemScaleChange, factor)); -
2066 newScale = newScaleVariant.toReal(); -
2067 }
never executed: }
0
2068 -
2069 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
2070 d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
never executed: d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
0
2071 -
2072 if (d_ptr->transformData->scale == newScale)
never evaluated: d_ptr->transformData->scale == newScale
0
2073 return;
never executed: return;
0
2074 -
2075 d_ptr->transformData->scale = newScale; -
2076 d_ptr->transformData->onlyTransform = false; -
2077 d_ptr->dirtySceneTransform = 1; -
2078 -
2079 -
2080 if (d_ptr->flags & ItemSendsGeometryChanges)
never evaluated: d_ptr->flags & ItemSendsGeometryChanges
0
2081 itemChange(ItemScaleHasChanged, newScale);
never executed: itemChange(ItemScaleHasChanged, newScale);
0
2082 -
2083 if (d_ptr->isObject)
never evaluated: d_ptr->isObject
0
2084 static_cast<QGraphicsObject *>(this)->scaleChanged();
never executed: static_cast<QGraphicsObject *>(this)->scaleChanged();
0
2085 -
2086 d_ptr->transformChanged(); -
2087}
never executed: }
0
2088QList<QGraphicsTransform *> QGraphicsItem::transformations() const -
2089{ -
2090 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
2091 return QList<QGraphicsTransform *>();
never executed: return QList<QGraphicsTransform *>();
0
2092 return d_ptr->transformData->graphicsTransforms;
never executed: return d_ptr->transformData->graphicsTransforms;
0
2093} -
2094void QGraphicsItem::setTransformations(const QList<QGraphicsTransform *> &transformations) -
2095{ -
2096 prepareGeometryChange(); -
2097 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
2098 d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
never executed: d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
0
2099 d_ptr->transformData->graphicsTransforms = transformations; -
2100 for (int i = 0; i < transformations.size(); ++i)
never evaluated: i < transformations.size()
0
2101 transformations.at(i)->d_func()->setItem(this);
never executed: transformations.at(i)->d_func()->setItem(this);
0
2102 d_ptr->transformData->onlyTransform = false; -
2103 d_ptr->dirtySceneTransform = 1; -
2104 d_ptr->transformChanged(); -
2105}
never executed: }
0
2106 -
2107 -
2108 -
2109 -
2110void QGraphicsItemPrivate::prependGraphicsTransform(QGraphicsTransform *t) -
2111{ -
2112 if (!transformData)
never evaluated: !transformData
0
2113 transformData = new QGraphicsItemPrivate::TransformData;
never executed: transformData = new QGraphicsItemPrivate::TransformData;
0
2114 if (!transformData->graphicsTransforms.contains(t))
never evaluated: !transformData->graphicsTransforms.contains(t)
0
2115 transformData->graphicsTransforms.prepend(t);
never executed: transformData->graphicsTransforms.prepend(t);
0
2116 -
2117 QGraphicsItem * const q = q_func(); -
2118 t->d_func()->setItem(q); -
2119 transformData->onlyTransform = false; -
2120 dirtySceneTransform = 1; -
2121 transformChanged(); -
2122}
never executed: }
0
2123 -
2124 -
2125 -
2126 -
2127void QGraphicsItemPrivate::appendGraphicsTransform(QGraphicsTransform *t) -
2128{ -
2129 if (!transformData)
never evaluated: !transformData
0
2130 transformData = new QGraphicsItemPrivate::TransformData;
never executed: transformData = new QGraphicsItemPrivate::TransformData;
0
2131 if (!transformData->graphicsTransforms.contains(t))
never evaluated: !transformData->graphicsTransforms.contains(t)
0
2132 transformData->graphicsTransforms.append(t);
never executed: transformData->graphicsTransforms.append(t);
0
2133 -
2134 QGraphicsItem * const q = q_func(); -
2135 t->d_func()->setItem(q); -
2136 transformData->onlyTransform = false; -
2137 dirtySceneTransform = 1; -
2138 transformChanged(); -
2139}
never executed: }
0
2140QPointF QGraphicsItem::transformOriginPoint() const -
2141{ -
2142 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
2143 return QPointF(0,0);
never executed: return QPointF(0,0);
0
2144 return QPointF(d_ptr->transformData->xOrigin, d_ptr->transformData->yOrigin);
never executed: return QPointF(d_ptr->transformData->xOrigin, d_ptr->transformData->yOrigin);
0
2145} -
2146void QGraphicsItem::setTransformOriginPoint(const QPointF &origin) -
2147{ -
2148 prepareGeometryChange(); -
2149 QPointF newOrigin = origin; -
2150 -
2151 if (d_ptr->flags & ItemSendsGeometryChanges) {
never evaluated: d_ptr->flags & ItemSendsGeometryChanges
0
2152 -
2153 const QVariant newOriginVariant(itemChange(ItemTransformOriginPointChange, -
2154 QVariant::fromValue<QPointF>(origin))); -
2155 newOrigin = newOriginVariant.toPointF(); -
2156 }
never executed: }
0
2157 -
2158 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
2159 d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
never executed: d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
0
2160 -
2161 if (d_ptr->transformData->xOrigin == newOrigin.x()
never evaluated: d_ptr->transformData->xOrigin == newOrigin.x()
0
2162 && d_ptr->transformData->yOrigin == newOrigin.y()) {
never evaluated: d_ptr->transformData->yOrigin == newOrigin.y()
0
2163 return;
never executed: return;
0
2164 } -
2165 -
2166 d_ptr->transformData->xOrigin = newOrigin.x(); -
2167 d_ptr->transformData->yOrigin = newOrigin.y(); -
2168 d_ptr->transformData->onlyTransform = false; -
2169 d_ptr->dirtySceneTransform = 1; -
2170 -
2171 -
2172 if (d_ptr->flags & ItemSendsGeometryChanges)
never evaluated: d_ptr->flags & ItemSendsGeometryChanges
0
2173 itemChange(ItemTransformOriginPointHasChanged, QVariant::fromValue<QPointF>(newOrigin));
never executed: itemChange(ItemTransformOriginPointHasChanged, QVariant::fromValue<QPointF>(newOrigin));
0
2174}
never executed: }
0
2175QMatrix QGraphicsItem::sceneMatrix() const -
2176{ -
2177 d_ptr->ensureSceneTransform(); -
2178 return d_ptr->sceneTransform.toAffine();
never executed: return d_ptr->sceneTransform.toAffine();
0
2179} -
2180QTransform QGraphicsItem::sceneTransform() const -
2181{ -
2182 d_ptr->ensureSceneTransform(); -
2183 return d_ptr->sceneTransform;
executed: return d_ptr->sceneTransform;
Execution Count:35
35
2184} -
2185QTransform QGraphicsItem::deviceTransform(const QTransform &viewportTransform) const -
2186{ -
2187 -
2188 if (!d_ptr->itemIsUntransformable()) {
evaluated: !d_ptr->itemIsUntransformable()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:8
8-19
2189 d_ptr->ensureSceneTransform(); -
2190 return d_ptr->sceneTransform * viewportTransform;
executed: return d_ptr->sceneTransform * viewportTransform;
Execution Count:19
19
2191 } -
2192 -
2193 -
2194 const QGraphicsItem *untransformedAncestor = this; -
2195 QList<const QGraphicsItem *> parents; -
2196 while (untransformedAncestor && ((untransformedAncestor->d_ptr->ancestorFlags
partially evaluated: untransformedAncestor
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-9
2197 & QGraphicsItemPrivate::AncestorIgnoresTransformations))) {
evaluated: ((untransformedAncestor->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorIgnoresTransformations))
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:8
1-8
2198 parents.prepend(untransformedAncestor); -
2199 untransformedAncestor = untransformedAncestor->parentItem(); -
2200 }
executed: }
Execution Count:1
1
2201 -
2202 if (!untransformedAncestor) {
partially evaluated: !untransformedAncestor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
2203 -
2204 qt_noop(); -
2205 -
2206 return QTransform();
never executed: return QTransform();
0
2207 } -
2208 -
2209 -
2210 untransformedAncestor->d_ptr->ensureSceneTransform(); -
2211 QPointF mappedPoint = (untransformedAncestor->d_ptr->sceneTransform * viewportTransform).map(QPointF(0, 0)); -
2212 -
2213 -
2214 QTransform matrix = QTransform::fromTranslate(mappedPoint.x(), mappedPoint.y()); -
2215 if (untransformedAncestor->d_ptr->transformData)
partially evaluated: untransformedAncestor->d_ptr->transformData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
2216 matrix = untransformedAncestor->d_ptr->transformData->computedFullTransform(&matrix);
never executed: matrix = untransformedAncestor->d_ptr->transformData->computedFullTransform(&matrix);
0
2217 -
2218 -
2219 for (int i = 0; i < parents.size(); ++i) {
evaluated: i < parents.size()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:8
1-8
2220 const QGraphicsItem *parent = parents.at(i); -
2221 parent->d_ptr->combineTransformFromParent(&matrix); -
2222 }
executed: }
Execution Count:1
1
2223 -
2224 return matrix;
executed: return matrix;
Execution Count:8
8
2225} -
2226QTransform QGraphicsItem::itemTransform(const QGraphicsItem *other, bool *ok) const -
2227{ -
2228 -
2229 if (other == 0) {
partially evaluated: other == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
2230 QMessageLogger("graphicsview/qgraphicsitem.cpp", 4206, __PRETTY_FUNCTION__).warning("QGraphicsItem::itemTransform: null pointer passed"); -
2231 return QTransform();
never executed: return QTransform();
0
2232 } -
2233 if (other == this) {
partially evaluated: other == this
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
2234 if (ok)
never evaluated: ok
0
2235 *ok = true;
never executed: *ok = true;
0
2236 return QTransform();
never executed: return QTransform();
0
2237 } -
2238 -
2239 QGraphicsItem *parent = d_ptr->parent; -
2240 const QGraphicsItem *otherParent = other->d_ptr->parent; -
2241 -
2242 -
2243 if (parent == other) {
evaluated: parent == other
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:25
19-25
2244 if (ok)
partially evaluated: ok
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
2245 *ok = true;
never executed: *ok = true;
0
2246 QTransform x; -
2247 d_ptr->combineTransformFromParent(&x); -
2248 return x;
executed: return x;
Execution Count:19
19
2249 } -
2250 -
2251 -
2252 if (otherParent == this) {
evaluated: otherParent == this
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:6
6-19
2253 const QPointF &otherPos = other->d_ptr->pos; -
2254 if (other->d_ptr->transformData) {
partially evaluated: other->d_ptr->transformData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
2255 QTransform otherToParent; -
2256 other->d_ptr->combineTransformFromParent(&otherToParent); -
2257 return otherToParent.inverted(ok);
never executed: return otherToParent.inverted(ok);
0
2258 } -
2259 if (ok)
partially evaluated: ok
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
2260 *ok = true;
never executed: *ok = true;
0
2261 return QTransform::fromTranslate(-otherPos.x(), -otherPos.y());
executed: return QTransform::fromTranslate(-otherPos.x(), -otherPos.y());
Execution Count:19
19
2262 } -
2263 -
2264 -
2265 if (parent == otherParent) {
partially evaluated: parent == otherParent
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
2266 -
2267 const QPointF &itemPos = d_ptr->pos; -
2268 const QPointF &otherPos = other->d_ptr->pos; -
2269 if (!d_ptr->transformData && !other->d_ptr->transformData) {
partially evaluated: !d_ptr->transformData
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
partially evaluated: !other->d_ptr->transformData
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
2270 QPointF delta = itemPos - otherPos; -
2271 if (ok)
partially evaluated: ok
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
2272 *ok = true;
never executed: *ok = true;
0
2273 return QTransform::fromTranslate(delta.x(), delta.y());
executed: return QTransform::fromTranslate(delta.x(), delta.y());
Execution Count:6
6
2274 } -
2275 -
2276 QTransform itemToParent; -
2277 d_ptr->combineTransformFromParent(&itemToParent); -
2278 QTransform otherToParent; -
2279 other->d_ptr->combineTransformFromParent(&otherToParent); -
2280 return itemToParent * otherToParent.inverted(ok);
never executed: return itemToParent * otherToParent.inverted(ok);
0
2281 } -
2282 -
2283 -
2284 -
2285 const QGraphicsItem *commonAncestor = commonAncestorItem(other); -
2286 if (!commonAncestor) {
never evaluated: !commonAncestor
0
2287 d_ptr->ensureSceneTransform(); -
2288 other->d_ptr->ensureSceneTransform(); -
2289 return d_ptr->sceneTransform * other->d_ptr->sceneTransform.inverted(ok);
never executed: return d_ptr->sceneTransform * other->d_ptr->sceneTransform.inverted(ok);
0
2290 } -
2291 -
2292 -
2293 -
2294 bool cousins = other != commonAncestor && this != commonAncestor;
never evaluated: other != commonAncestor
never evaluated: this != commonAncestor
0
2295 if (cousins) {
never evaluated: cousins
0
2296 bool good = false; -
2297 QTransform thisToScene = itemTransform(commonAncestor, &good); -
2298 QTransform otherToScene(Qt::Uninitialized); -
2299 if (good)
never evaluated: good
0
2300 otherToScene = other->itemTransform(commonAncestor, &good);
never executed: otherToScene = other->itemTransform(commonAncestor, &good);
0
2301 if (!good) {
never evaluated: !good
0
2302 if (ok)
never evaluated: ok
0
2303 *ok = false;
never executed: *ok = false;
0
2304 return QTransform();
never executed: return QTransform();
0
2305 } -
2306 return thisToScene * otherToScene.inverted(ok);
never executed: return thisToScene * otherToScene.inverted(ok);
0
2307 } -
2308 -
2309 -
2310 bool parentOfOther = isAncestorOf(other); -
2311 const QGraphicsItem *child = parentOfOther ? other : this;
never evaluated: parentOfOther
0
2312 const QGraphicsItem *root = parentOfOther ? this : other;
never evaluated: parentOfOther
0
2313 -
2314 QTransform x; -
2315 const QGraphicsItem *p = child; -
2316 do { -
2317 p->d_ptr.data()->combineTransformToParent(&x); -
2318 } while ((p = p->d_ptr->parent) && p != root);
never evaluated: (p = p->d_ptr->parent)
never evaluated: p != root
never executed: }
0
2319 if (parentOfOther)
never evaluated: parentOfOther
0
2320 return x.inverted(ok);
never executed: return x.inverted(ok);
0
2321 if (ok)
never evaluated: ok
0
2322 *ok = true;
never executed: *ok = true;
0
2323 return x;
never executed: return x;
0
2324} -
2325void QGraphicsItem::setMatrix(const QMatrix &matrix, bool combine) -
2326{ -
2327 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
2328 d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
never executed: d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
0
2329 -
2330 QTransform newTransform(combine ? QTransform(matrix) * d_ptr->transformData->transform : QTransform(matrix)); -
2331 if (d_ptr->transformData->transform == newTransform)
never evaluated: d_ptr->transformData->transform == newTransform
0
2332 return;
never executed: return;
0
2333 -
2334 -
2335 if (!(d_ptr->flags & ItemSendsGeometryChanges)) {
never evaluated: !(d_ptr->flags & ItemSendsGeometryChanges)
0
2336 d_ptr->setTransformHelper(newTransform); -
2337 return;
never executed: return;
0
2338 } -
2339 -
2340 -
2341 const QVariant newMatrixVariant = QVariant::fromValue<QMatrix>(newTransform.toAffine()); -
2342 newTransform = QTransform(qvariant_cast<QMatrix>(itemChange(ItemMatrixChange, newMatrixVariant))); -
2343 if (d_ptr->transformData->transform == newTransform)
never evaluated: d_ptr->transformData->transform == newTransform
0
2344 return;
never executed: return;
0
2345 -
2346 -
2347 d_ptr->setTransformHelper(newTransform); -
2348 -
2349 -
2350 itemChange(ItemTransformHasChanged, QVariant::fromValue<QTransform>(newTransform)); -
2351}
never executed: }
0
2352void QGraphicsItem::setTransform(const QTransform &matrix, bool combine) -
2353{ -
2354 if (!d_ptr->transformData)
partially evaluated: !d_ptr->transformData
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
2355 d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
executed: d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
Execution Count:14
14
2356 -
2357 QTransform newTransform(combine ? matrix * d_ptr->transformData->transform : matrix); -
2358 if (d_ptr->transformData->transform == newTransform)
partially evaluated: d_ptr->transformData->transform == newTransform
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
2359 return;
never executed: return;
0
2360 -
2361 -
2362 if (!(d_ptr->flags & (ItemSendsGeometryChanges | ItemSendsScenePositionChanges))) {
evaluated: !(d_ptr->flags & (ItemSendsGeometryChanges | ItemSendsScenePositionChanges))
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:2
2-12
2363 d_ptr->setTransformHelper(newTransform); -
2364 if (d_ptr->scenePosDescendants)
partially evaluated: d_ptr->scenePosDescendants
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
2365 d_ptr->sendScenePosChange();
never executed: d_ptr->sendScenePosChange();
0
2366 return;
executed: return;
Execution Count:12
12
2367 } -
2368 -
2369 -
2370 const QVariant newTransformVariant(itemChange(ItemTransformChange, -
2371 QVariant::fromValue<QTransform>(newTransform))); -
2372 newTransform = qvariant_cast<QTransform>(newTransformVariant); -
2373 if (d_ptr->transformData->transform == newTransform)
partially evaluated: d_ptr->transformData->transform == newTransform
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2374 return;
never executed: return;
0
2375 -
2376 -
2377 d_ptr->setTransformHelper(newTransform); -
2378 -
2379 -
2380 itemChange(ItemTransformHasChanged, newTransformVariant); -
2381 d_ptr->sendScenePosChange(); -
2382}
executed: }
Execution Count:2
2
2383 -
2384 -
2385 -
2386 -
2387 -
2388 -
2389void QGraphicsItem::resetMatrix() -
2390{ -
2391 resetTransform(); -
2392}
never executed: }
0
2393void QGraphicsItem::resetTransform() -
2394{ -
2395 setTransform(QTransform(), false); -
2396}
never executed: }
0
2397void QGraphicsItem::advance(int phase) -
2398{ -
2399 (void)phase;; -
2400}
never executed: }
0
2401qreal QGraphicsItem::zValue() const -
2402{ -
2403 return d_ptr->z;
executed: return d_ptr->z;
Execution Count:39
39
2404} -
2405void QGraphicsItem::setZValue(qreal z) -
2406{ -
2407 const QVariant newZVariant(itemChange(ItemZValueChange, z)); -
2408 qreal newZ = newZVariant.toReal(); -
2409 if (newZ == d_ptr->z)
evaluated: newZ == d_ptr->z
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:87
8-87
2410 return;
executed: return;
Execution Count:8
8
2411 -
2412 if (d_ptr->scene && d_ptr->scene->d_func()->indexMethod != QGraphicsScene::NoIndex) {
evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:32
partially evaluated: d_ptr->scene->d_func()->indexMethod != QGraphicsScene::NoIndex
TRUEFALSE
yes
Evaluation Count:55
no
Evaluation Count:0
0-55
2413 -
2414 d_ptr->scene->d_func()->index->itemChange(this, ItemZValueChange, &newZ); -
2415 }
executed: }
Execution Count:55
55
2416 -
2417 d_ptr->z = newZ; -
2418 if (d_ptr->parent)
evaluated: d_ptr->parent
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:83
4-83
2419 d_ptr->parent->d_ptr->needSortChildren = 1;
executed: d_ptr->parent->d_ptr->needSortChildren = 1;
Execution Count:4
4
2420 else if (d_ptr->scene)
evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:31
31-52
2421 d_ptr->scene->d_func()->needSortTopLevelItems = 1;
executed: d_ptr->scene->d_func()->needSortTopLevelItems = 1;
Execution Count:52
52
2422 -
2423 if (d_ptr->scene)
evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:32
32-55
2424 d_ptr->scene->d_func()->markDirty(this, QRectF(), true);
executed: d_ptr->scene->d_func()->markDirty(this, QRectF(), true);
Execution Count:55
55
2425 -
2426 itemChange(ItemZValueHasChanged, newZVariant); -
2427 -
2428 if (d_ptr->flags & ItemNegativeZStacksBehindParent)
partially evaluated: d_ptr->flags & ItemNegativeZStacksBehindParent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:87
0-87
2429 setFlag(QGraphicsItem::ItemStacksBehindParent, z < qreal(0.0));
never executed: setFlag(QGraphicsItem::ItemStacksBehindParent, z < qreal(0.0));
0
2430 -
2431 if (d_ptr->isObject)
evaluated: d_ptr->isObject
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:43
43-44
2432 static_cast<QGraphicsObject *>(this)->zChanged();
executed: static_cast<QGraphicsObject *>(this)->zChanged();
Execution Count:44
44
2433}
executed: }
Execution Count:87
87
2434void QGraphicsItemPrivate::ensureSequentialSiblingIndex() -
2435{ -
2436 if (!sequentialOrdering) {
partially evaluated: !sequentialOrdering
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1777
0-1777
2437 std::sort(children.begin(), children.end(), insertionOrder); -
2438 sequentialOrdering = 1; -
2439 needSortChildren = 1; -
2440 }
never executed: }
0
2441 if (holesInSiblingIndex) {
partially evaluated: holesInSiblingIndex
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1777
0-1777
2442 holesInSiblingIndex = 0; -
2443 for (int i = 0; i < children.size(); ++i)
never evaluated: i < children.size()
0
2444 children[i]->d_ptr->siblingIndex = i;
never executed: children[i]->d_ptr->siblingIndex = i;
0
2445 }
never executed: }
0
2446}
executed: }
Execution Count:1777
1777
2447 -
2448 -
2449 -
2450 -
2451inline void QGraphicsItemPrivate::sendScenePosChange() -
2452{ -
2453 QGraphicsItem * const q = q_func(); -
2454 if (scene) {
evaluated: scene
TRUEFALSE
yes
Evaluation Count:730
yes
Evaluation Count:25
25-730
2455 if (flags & QGraphicsItem::ItemSendsScenePositionChanges)
partially evaluated: flags & QGraphicsItem::ItemSendsScenePositionChanges
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:730
0-730
2456 q->itemChange(QGraphicsItem::ItemScenePositionHasChanged, q->scenePos());
never executed: q->itemChange(QGraphicsItem::ItemScenePositionHasChanged, q->scenePos());
0
2457 if (scenePosDescendants) {
partially evaluated: scenePosDescendants
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:730
0-730
2458 for (QForeachContainer<__typeof__(scene->d_func()->scenePosItems)> _container_(scene->d_func()->scenePosItems); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
2459 if (q->isAncestorOf(item))
never evaluated: q->isAncestorOf(item)
0
2460 item->itemChange(QGraphicsItem::ItemScenePositionHasChanged, item->scenePos());
never executed: item->itemChange(QGraphicsItem::ItemScenePositionHasChanged, item->scenePos());
0
2461 }
never executed: }
0
2462 }
never executed: }
0
2463 }
executed: }
Execution Count:730
730
2464}
executed: }
Execution Count:755
755
2465void QGraphicsItem::stackBefore(const QGraphicsItem *sibling) -
2466{ -
2467 if (sibling == this)
never evaluated: sibling == this
0
2468 return;
never executed: return;
0
2469 if (!sibling || d_ptr->parent != sibling->parentItem()) {
never evaluated: !sibling
never evaluated: d_ptr->parent != sibling->parentItem()
0
2470 QMessageLogger("graphicsview/qgraphicsitem.cpp", 4641, __PRETTY_FUNCTION__).warning("QGraphicsItem::stackUnder: cannot stack under %p, which must be a sibling", sibling); -
2471 return;
never executed: return;
0
2472 } -
2473 QList<QGraphicsItem *> *siblings = d_ptr->parent
never evaluated: d_ptr->parent
0
2474 ? &d_ptr->parent->d_ptr->children -
2475 : (d_ptr->scene ? &d_ptr->scene->d_func()->topLevelItems : 0); -
2476 if (!siblings) {
never evaluated: !siblings
0
2477 QMessageLogger("graphicsview/qgraphicsitem.cpp", 4648, __PRETTY_FUNCTION__).warning("QGraphicsItem::stackUnder: cannot stack under %p, which must be a sibling", sibling); -
2478 return;
never executed: return;
0
2479 } -
2480 -
2481 -
2482 -
2483 if (d_ptr->parent)
never evaluated: d_ptr->parent
0
2484 d_ptr->parent->d_ptr->ensureSequentialSiblingIndex();
never executed: d_ptr->parent->d_ptr->ensureSequentialSiblingIndex();
0
2485 else -
2486 d_ptr->scene->d_func()->ensureSequentialTopLevelSiblingIndexes();
never executed: d_ptr->scene->d_func()->ensureSequentialTopLevelSiblingIndexes();
0
2487 -
2488 -
2489 int siblingIndex = sibling->d_ptr->siblingIndex; -
2490 int myIndex = d_ptr->siblingIndex; -
2491 if (myIndex >= siblingIndex) {
never evaluated: myIndex >= siblingIndex
0
2492 siblings->move(myIndex, siblingIndex); -
2493 -
2494 for (int i = 0; i < siblings->size(); ++i) {
never evaluated: i < siblings->size()
0
2495 int &index = siblings->at(i)->d_ptr->siblingIndex; -
2496 if (i != siblingIndex && index >= siblingIndex && index <= myIndex)
never evaluated: i != siblingIndex
never evaluated: index >= siblingIndex
never evaluated: index <= myIndex
0
2497 ++index;
never executed: ++index;
0
2498 }
never executed: }
0
2499 d_ptr->siblingIndex = siblingIndex; -
2500 for (int i = 0; i < siblings->size(); ++i) {
never evaluated: i < siblings->size()
0
2501 int &index = siblings->at(i)->d_ptr->siblingIndex; -
2502 if (i != siblingIndex && index >= siblingIndex && index <= myIndex)
never evaluated: i != siblingIndex
never evaluated: index >= siblingIndex
never evaluated: index <= myIndex
0
2503 siblings->at(i)->d_ptr->siblingOrderChange();
never executed: siblings->at(i)->d_ptr->siblingOrderChange();
0
2504 }
never executed: }
0
2505 d_ptr->siblingOrderChange(); -
2506 }
never executed: }
0
2507}
never executed: }
0
2508QRectF QGraphicsItem::childrenBoundingRect() const -
2509{ -
2510 if (!d_ptr->dirtyChildrenBoundingRect)
evaluated: !d_ptr->dirtyChildrenBoundingRect
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:10
9-10
2511 return d_ptr->childrenBoundingRect;
executed: return d_ptr->childrenBoundingRect;
Execution Count:9
9
2512 -
2513 d_ptr->childrenBoundingRect = QRectF(); -
2514 d_ptr->childrenBoundingRectHelper(0, &d_ptr->childrenBoundingRect, 0); -
2515 d_ptr->dirtyChildrenBoundingRect = 0; -
2516 return d_ptr->childrenBoundingRect;
executed: return d_ptr->childrenBoundingRect;
Execution Count:10
10
2517} -
2518QRectF QGraphicsItem::sceneBoundingRect() const -
2519{ -
2520 -
2521 -
2522 QPointF offset; -
2523 const QGraphicsItem *parentItem = this; -
2524 const QGraphicsItemPrivate *itemd; -
2525 do { -
2526 itemd = parentItem->d_ptr.data(); -
2527 if (itemd->transformData)
evaluated: itemd->transformData
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:3628
14-3628
2528 break;
executed: break;
Execution Count:14
14
2529 offset += itemd->pos; -
2530 } while ((parentItem = itemd->parent));
evaluated: (parentItem = itemd->parent)
TRUEFALSE
yes
Evaluation Count:1487
yes
Evaluation Count:2141
executed: }
Execution Count:3628
1487-3628
2531 -
2532 QRectF br = boundingRect(); -
2533 br.translate(offset); -
2534 if (!parentItem)
evaluated: !parentItem
TRUEFALSE
yes
Evaluation Count:2141
yes
Evaluation Count:14
14-2141
2535 return br;
executed: return br;
Execution Count:2141
2141
2536 if (parentItem->d_ptr->hasTranslateOnlySceneTransform()) {
evaluated: parentItem->d_ptr->hasTranslateOnlySceneTransform()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:9
5-9
2537 br.translate(parentItem->d_ptr->sceneTransform.dx(), parentItem->d_ptr->sceneTransform.dy()); -
2538 return br;
executed: return br;
Execution Count:5
5
2539 } -
2540 return parentItem->d_ptr->sceneTransform.mapRect(br);
executed: return parentItem->d_ptr->sceneTransform.mapRect(br);
Execution Count:9
9
2541} -
2542QPainterPath QGraphicsItem::shape() const -
2543{ -
2544 QPainterPath path; -
2545 path.addRect(boundingRect()); -
2546 return path;
executed: return path;
Execution Count:342
342
2547} -
2548bool QGraphicsItem::isClipped() const -
2549{ -
2550 const QGraphicsItemPrivate * const d = d_func(); -
2551 return (d->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) 582
2552 || (d->flags & QGraphicsItem::ItemClipsToShape);
executed: return (d->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) || (d->flags & QGraphicsItem::ItemClipsToShape);
Execution Count:582
582
2553} -
2554QPainterPath QGraphicsItem::clipPath() const -
2555{ -
2556 const QGraphicsItemPrivate * const d = d_func(); -
2557 if (!isClipped())
partially evaluated: !isClipped()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2558 return QPainterPath();
never executed: return QPainterPath();
0
2559 -
2560 const QRectF thisBoundingRect(boundingRect()); -
2561 if (thisBoundingRect.isEmpty())
partially evaluated: thisBoundingRect.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2562 return QPainterPath();
never executed: return QPainterPath();
0
2563 -
2564 QPainterPath clip; -
2565 -
2566 clip.addRect(thisBoundingRect); -
2567 -
2568 if (d->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) {
partially evaluated: d->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
2569 const QGraphicsItem *parent = this; -
2570 const QGraphicsItem *lastParent = this; -
2571 -
2572 -
2573 while ((parent = parent->d_ptr->parent)) {
partially evaluated: (parent = parent->d_ptr->parent)
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
2574 if (parent->d_ptr->flags & ItemClipsChildrenToShape) {
partially evaluated: parent->d_ptr->flags & ItemClipsChildrenToShape
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
2575 -
2576 clip = lastParent->itemTransform(parent).map(clip); -
2577 clip = clip.intersected(parent->shape()); -
2578 if (clip.isEmpty())
partially evaluated: clip.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2579 return clip;
never executed: return clip;
0
2580 lastParent = parent; -
2581 }
executed: }
Execution Count:4
4
2582 -
2583 if (!(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren))
partially evaluated: !(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
2584 break;
executed: break;
Execution Count:4
4
2585 }
never executed: }
0
2586 -
2587 if (lastParent != this) {
partially evaluated: lastParent != this
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
2588 -
2589 -
2590 clip = lastParent->itemTransform(this).map(clip); -
2591 }
executed: }
Execution Count:4
4
2592 }
executed: }
Execution Count:4
4
2593 -
2594 if (d->flags & ItemClipsToShape)
partially evaluated: d->flags & ItemClipsToShape
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2595 clip = clip.intersected(shape());
never executed: clip = clip.intersected(shape());
0
2596 -
2597 return clip;
executed: return clip;
Execution Count:4
4
2598} -
2599bool QGraphicsItem::contains(const QPointF &point) const -
2600{ -
2601 return isClipped() ? clipPath().contains(point) : shape().contains(point);
executed: return isClipped() ? clipPath().contains(point) : shape().contains(point);
Execution Count:211
211
2602} -
2603bool QGraphicsItem::collidesWithItem(const QGraphicsItem *other, Qt::ItemSelectionMode mode) const -
2604{ -
2605 if (other == this)
never evaluated: other == this
0
2606 return true;
never executed: return true;
0
2607 if (!other)
never evaluated: !other
0
2608 return false;
never executed: return false;
0
2609 -
2610 -
2611 bool clips = (d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren); -
2612 bool otherClips = (other->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren); -
2613 if (clips || otherClips) {
never evaluated: clips
never evaluated: otherClips
0
2614 const QGraphicsItem *closestClipper = isAncestorOf(other) ? this : parentItem();
never evaluated: isAncestorOf(other)
0
2615 while (closestClipper && !(closestClipper->flags() & ItemClipsChildrenToShape))
never evaluated: closestClipper
never evaluated: !(closestClipper->flags() & ItemClipsChildrenToShape)
0
2616 closestClipper = closestClipper->parentItem();
never executed: closestClipper = closestClipper->parentItem();
0
2617 const QGraphicsItem *otherClosestClipper = other->isAncestorOf(this) ? other : other->parentItem();
never evaluated: other->isAncestorOf(this)
0
2618 while (otherClosestClipper && !(otherClosestClipper->flags() & ItemClipsChildrenToShape))
never evaluated: otherClosestClipper
never evaluated: !(otherClosestClipper->flags() & ItemClipsChildrenToShape)
0
2619 otherClosestClipper = otherClosestClipper->parentItem();
never executed: otherClosestClipper = otherClosestClipper->parentItem();
0
2620 if (closestClipper == otherClosestClipper) {
never evaluated: closestClipper == otherClosestClipper
0
2621 d_ptr->localCollisionHack = 1; -
2622 bool res = collidesWithPath(mapFromItem(other, other->shape()), mode); -
2623 d_ptr->localCollisionHack = 0; -
2624 return res;
never executed: return res;
0
2625 } -
2626 }
never executed: }
0
2627 -
2628 QPainterPath otherShape = other->isClipped() ? other->clipPath() : other->shape();
never evaluated: other->isClipped()
0
2629 return collidesWithPath(mapFromItem(other, otherShape), mode);
never executed: return collidesWithPath(mapFromItem(other, otherShape), mode);
0
2630} -
2631bool QGraphicsItem::collidesWithPath(const QPainterPath &path, Qt::ItemSelectionMode mode) const -
2632{ -
2633 if (path.isEmpty()) {
partially evaluated: path.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:372
0-372
2634 -
2635 return false;
never executed: return false;
0
2636 } -
2637 -
2638 QRectF rectA(boundingRect()); -
2639 _q_adjustRect(&rectA); -
2640 QRectF rectB(path.controlPointRect()); -
2641 _q_adjustRect(&rectB); -
2642 if (!rectA.intersects(rectB)) {
evaluated: !rectA.intersects(rectB)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:364
8-364
2643 -
2644 -
2645 return false;
executed: return false;
Execution Count:8
8
2646 } -
2647 -
2648 -
2649 QPainterPath thisShape; -
2650 if (mode == Qt::IntersectsItemShape || mode == Qt::ContainsItemShape)
evaluated: mode == Qt::IntersectsItemShape
TRUEFALSE
yes
Evaluation Count:363
yes
Evaluation Count:1
partially evaluated: mode == Qt::ContainsItemShape
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-363
2651 thisShape = (isClipped() && !d_ptr->localCollisionHack) ? clipPath() : shape();
evaluated: isClipped()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:360
partially evaluated: !d_ptr->localCollisionHack
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
executed: thisShape = (isClipped() && !d_ptr->localCollisionHack) ? clipPath() : shape();
Execution Count:364
0-364
2652 else -
2653 thisShape.addRect(rectA);
never executed: thisShape.addRect(rectA);
0
2654 -
2655 if (thisShape == QPainterPath()) {
partially evaluated: thisShape == QPainterPath()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:364
0-364
2656 -
2657 return false;
never executed: return false;
0
2658 } -
2659 -
2660 -
2661 if (mode == Qt::IntersectsItemShape || mode == Qt::IntersectsItemBoundingRect)
evaluated: mode == Qt::IntersectsItemShape
TRUEFALSE
yes
Evaluation Count:363
yes
Evaluation Count:1
partially evaluated: mode == Qt::IntersectsItemBoundingRect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-363
2662 return path.intersects(thisShape);
executed: return path.intersects(thisShape);
Execution Count:363
363
2663 return path.contains(thisShape);
executed: return path.contains(thisShape);
Execution Count:1
1
2664} -
2665QList<QGraphicsItem *> QGraphicsItem::collidingItems(Qt::ItemSelectionMode mode) const -
2666{ -
2667 if (d_ptr->scene)
never evaluated: d_ptr->scene
0
2668 return d_ptr->scene->collidingItems(this, mode);
never executed: return d_ptr->scene->collidingItems(this, mode);
0
2669 return QList<QGraphicsItem *>();
never executed: return QList<QGraphicsItem *>();
0
2670} -
2671static bool qt_QGraphicsItem_isObscured(const QGraphicsItem *item, -
2672 const QGraphicsItem *other, -
2673 const QRectF &rect) -
2674{ -
2675 return other->mapToItem(item, other->opaqueArea()).contains(rect);
executed: return other->mapToItem(item, other->opaqueArea()).contains(rect);
Execution Count:6
6
2676} -
2677bool QGraphicsItem::isObscured(const QRectF &rect) const -
2678{ -
2679 const QGraphicsItemPrivate * const d = d_func(); -
2680 if (!d->scene)
never evaluated: !d->scene
0
2681 return false;
never executed: return false;
0
2682 -
2683 QRectF br = boundingRect(); -
2684 QRectF testRect = rect.isNull() ? br : rect;
never evaluated: rect.isNull()
0
2685 -
2686 for (QForeachContainer<__typeof__(d->scene->items(mapToScene(br), Qt::IntersectsItemBoundingRect))> _container_(d->scene->items(mapToScene(br), Qt::IntersectsItemBoundingRect)); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
2687 if (item == this)
never evaluated: item == this
0
2688 break;
never executed: break;
0
2689 if (qt_QGraphicsItem_isObscured(this, item, testRect))
never evaluated: qt_QGraphicsItem_isObscured(this, item, testRect)
0
2690 return true;
never executed: return true;
0
2691 }
never executed: }
0
2692 return false;
never executed: return false;
0
2693} -
2694bool QGraphicsItem::isObscuredBy(const QGraphicsItem *item) const -
2695{ -
2696 if (!item)
evaluated: !item
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7
2-7
2697 return false;
executed: return false;
Execution Count:2
2
2698 return qt_closestItemFirst(item, this) 7
2699 && qt_QGraphicsItem_isObscured(this, item, boundingRect());
executed: return qt_closestItemFirst(item, this) && qt_QGraphicsItem_isObscured(this, item, boundingRect());
Execution Count:7
7
2700} -
2701QPainterPath QGraphicsItem::opaqueArea() const -
2702{ -
2703 return QPainterPath();
executed: return QPainterPath();
Execution Count:2
2
2704} -
2705QRegion QGraphicsItem::boundingRegion(const QTransform &itemToDeviceTransform) const -
2706{ -
2707 qreal granularity = boundingRegionGranularity(); -
2708 QRect deviceRect = itemToDeviceTransform.mapRect(boundingRect()).toRect(); -
2709 _q_adjustRect(&deviceRect); -
2710 if (granularity == 0.0)
never evaluated: granularity == 0.0
0
2711 return QRegion(deviceRect);
never executed: return QRegion(deviceRect);
0
2712 -
2713 int pad = 1; -
2714 QSize bitmapSize(qMax(1, int(deviceRect.width() * granularity) + pad * 2), -
2715 qMax(1, int(deviceRect.height() * granularity) + pad * 2)); -
2716 QImage mask(bitmapSize, QImage::Format_ARGB32_Premultiplied); -
2717 mask.fill(0); -
2718 QPainter p(&mask); -
2719 p.setRenderHints(QPainter::Antialiasing); -
2720 -
2721 -
2722 -
2723 QPointF viewOrigo = itemToDeviceTransform.map(QPointF(0, 0)); -
2724 QPointF offset = viewOrigo - deviceRect.topLeft(); -
2725 p.scale(granularity, granularity); -
2726 p.translate(offset); -
2727 p.translate(pad, pad); -
2728 p.setWorldTransform(itemToDeviceTransform, true); -
2729 p.translate(itemToDeviceTransform.inverted().map(QPointF(0, 0))); -
2730 -
2731 -
2732 QStyleOptionGraphicsItem option; -
2733 const_cast<QGraphicsItem *>(this)->paint(&p, &option, 0); -
2734 p.end(); -
2735 -
2736 -
2737 QTransform unscale = QTransform::fromScale(1 / granularity, 1 / granularity); -
2738 QRegion r; -
2739 QBitmap colorMask = QBitmap::fromImage(mask.createMaskFromColor(0)); -
2740 for (QForeachContainer<__typeof__(QRegion( colorMask ).rects())> _container_(QRegion( colorMask ).rects()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QRect &rect = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
2741 QRect xrect = unscale.mapRect(rect).translated(deviceRect.topLeft() - QPoint(pad, pad)); -
2742 r += xrect.adjusted(-1, -1, 1, 1) & deviceRect; -
2743 }
never executed: }
0
2744 return r;
never executed: return r;
0
2745} -
2746qreal QGraphicsItem::boundingRegionGranularity() const -
2747{ -
2748 return d_ptr->hasBoundingRegionGranularity 10
2749 ? qvariant_cast<qreal>(d_ptr->extra(QGraphicsItemPrivate::ExtraBoundingRegionGranularity)) 10
2750 : 0;
executed: return d_ptr->hasBoundingRegionGranularity ? qvariant_cast<qreal>(d_ptr->extra(QGraphicsItemPrivate::ExtraBoundingRegionGranularity)) : 0;
Execution Count:10
10
2751} -
2752void QGraphicsItem::setBoundingRegionGranularity(qreal granularity) -
2753{ -
2754 if (granularity < 0.0 || granularity > 1.0) {
never evaluated: granularity < 0.0
never evaluated: granularity > 1.0
0
2755 QMessageLogger("graphicsview/qgraphicsitem.cpp", 5231, __PRETTY_FUNCTION__).warning("QGraphicsItem::setBoundingRegionGranularity: invalid granularity %g", granularity); -
2756 return;
never executed: return;
0
2757 } -
2758 if (granularity == 0.0) {
never evaluated: granularity == 0.0
0
2759 d_ptr->unsetExtra(QGraphicsItemPrivate::ExtraBoundingRegionGranularity); -
2760 d_ptr->hasBoundingRegionGranularity = 0; -
2761 return;
never executed: return;
0
2762 } -
2763 d_ptr->hasBoundingRegionGranularity = 1; -
2764 d_ptr->setExtra(QGraphicsItemPrivate::ExtraBoundingRegionGranularity, -
2765 QVariant::fromValue<qreal>(granularity)); -
2766}
never executed: }
0
2767bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreVisibleBit, bool ignoreDirtyBit, -
2768 bool ignoreOpacity) const -
2769{ -
2770 -
2771 -
2772 return !scene 1499
2773 || (!visible && !ignoreVisibleBit && !this->ignoreVisible) 1499
2774 || (!ignoreDirtyBit && fullUpdatePending) 1499
2775 || (!ignoreOpacity && !this->ignoreOpacity && childrenCombineOpacity() && isFullyTransparent());
executed: return !scene || (!visible && !ignoreVisibleBit && !this->ignoreVisible) || (!ignoreDirtyBit && fullUpdatePending) || (!ignoreOpacity && !this->ignoreOpacity && childrenCombineOpacity() && isFullyTransparent());
Execution Count:1499
1499
2776} -
2777 -
2778 -
2779 -
2780 -
2781int QGraphicsItemPrivate::depth() const -
2782{ -
2783 if (itemDepth == -1)
evaluated: itemDepth == -1
TRUEFALSE
yes
Evaluation Count:222
yes
Evaluation Count:756
222-756
2784 const_cast<QGraphicsItemPrivate *>(this)->resolveDepth();
executed: const_cast<QGraphicsItemPrivate *>(this)->resolveDepth();
Execution Count:222
222
2785 -
2786 return itemDepth;
executed: return itemDepth;
Execution Count:978
978
2787} -
2788 -
2789 -
2790 -
2791 -
2792 -
2793void QGraphicsItemPrivate::invalidateParentGraphicsEffectsRecursively() -
2794{ -
2795 QGraphicsItemPrivate *itemPrivate = this; -
2796 do { -
2797 if (itemPrivate->graphicsEffect) {
evaluated: itemPrivate->graphicsEffect
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:5159
19-5159
2798 itemPrivate->notifyInvalidated = 1; -
2799 -
2800 if (!itemPrivate->updateDueToGraphicsEffect)
evaluated: !itemPrivate->updateDueToGraphicsEffect
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:8
8-11
2801 static_cast<QGraphicsItemEffectSourcePrivate *>(itemPrivate->graphicsEffect->d_func()->source->d_func())->invalidateCache();
executed: static_cast<QGraphicsItemEffectSourcePrivate *>(itemPrivate->graphicsEffect->d_func()->source->d_func())->invalidateCache();
Execution Count:11
11
2802 }
executed: }
Execution Count:19
19
2803 } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0));
evaluated: itemPrivate->parent
TRUEFALSE
yes
Evaluation Count:1426
yes
Evaluation Count:3752
executed: }
Execution Count:5178
1426-5178
2804}
executed: }
Execution Count:3752
3752
2805 -
2806void QGraphicsItemPrivate::invalidateChildGraphicsEffectsRecursively(QGraphicsItemPrivate::InvalidateReason reason) -
2807{ -
2808 if (!mayHaveChildWithGraphicsEffect)
evaluated: !mayHaveChildWithGraphicsEffect
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:2
2-10
2809 return;
executed: return;
Execution Count:10
10
2810 -
2811 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
2812 QGraphicsItemPrivate *childPrivate = children.at(i)->d_ptr.data(); -
2813 if (reason == OpacityChanged && (childPrivate->flags & QGraphicsItem::ItemIgnoresParentOpacity))
partially evaluated: reason == OpacityChanged
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: (childPrivate->flags & QGraphicsItem::ItemIgnoresParentOpacity)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2814 continue;
never executed: continue;
0
2815 if (childPrivate->graphicsEffect) {
partially evaluated: childPrivate->graphicsEffect
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2816 childPrivate->notifyInvalidated = 1; -
2817 static_cast<QGraphicsItemEffectSourcePrivate *>(childPrivate->graphicsEffect->d_func()->source->d_func())->invalidateCache(); -
2818 }
executed: }
Execution Count:2
2
2819 -
2820 childPrivate->invalidateChildGraphicsEffectsRecursively(reason); -
2821 }
executed: }
Execution Count:2
2
2822}
executed: }
Execution Count:2
2
2823 -
2824 -
2825 -
2826 -
2827 -
2828void QGraphicsItemPrivate::invalidateDepthRecursively() -
2829{ -
2830 if (itemDepth == -1)
evaluated: itemDepth == -1
TRUEFALSE
yes
Evaluation Count:1357
yes
Evaluation Count:203
203-1357
2831 return;
executed: return;
Execution Count:1357
1357
2832 -
2833 itemDepth = -1; -
2834 for (int i = 0; i < children.size(); ++i)
partially evaluated: i < children.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:203
0-203
2835 children.at(i)->d_ptr->invalidateDepthRecursively();
never executed: children.at(i)->d_ptr->invalidateDepthRecursively();
0
2836}
executed: }
Execution Count:203
203
2837 -
2838 -
2839 -
2840 -
2841 -
2842 -
2843void QGraphicsItemPrivate::resolveDepth() -
2844{ -
2845 if (!parent)
evaluated: !parent
TRUEFALSE
yes
Evaluation Count:195
yes
Evaluation Count:197
195-197
2846 itemDepth = 0;
executed: itemDepth = 0;
Execution Count:195
195
2847 else { -
2848 if (parent->d_ptr->itemDepth == -1)
evaluated: parent->d_ptr->itemDepth == -1
TRUEFALSE
yes
Evaluation Count:170
yes
Evaluation Count:27
27-170
2849 parent->d_ptr->resolveDepth();
executed: parent->d_ptr->resolveDepth();
Execution Count:170
170
2850 itemDepth = parent->d_ptr->itemDepth + 1; -
2851 }
executed: }
Execution Count:197
197
2852} -
2853 -
2854 -
2855 -
2856 -
2857 -
2858 -
2859 -
2860void QGraphicsItemPrivate::addChild(QGraphicsItem *child) -
2861{ -
2862 -
2863 -
2864 ensureSequentialSiblingIndex(); -
2865 needSortChildren = 1; -
2866 child->d_ptr->siblingIndex = children.size(); -
2867 children.append(child); -
2868 if (isObject)
evaluated: isObject
TRUEFALSE
yes
Evaluation Count:790
yes
Evaluation Count:14
14-790
2869 static_cast<QGraphicsObject *>(q_ptr)->childrenChanged();
executed: static_cast<QGraphicsObject *>(q_ptr)->childrenChanged();
Execution Count:790
790
2870}
executed: }
Execution Count:804
804
2871 -
2872 -
2873 -
2874 -
2875 -
2876 -
2877 -
2878void QGraphicsItemPrivate::removeChild(QGraphicsItem *child) -
2879{ -
2880 -
2881 -
2882 if (!holesInSiblingIndex)
evaluated: !holesInSiblingIndex
TRUEFALSE
yes
Evaluation Count:205
yes
Evaluation Count:554
205-554
2883 holesInSiblingIndex = child->d_ptr->siblingIndex != children.size() - 1;
executed: holesInSiblingIndex = child->d_ptr->siblingIndex != children.size() - 1;
Execution Count:205
205
2884 if (sequentialOrdering && !holesInSiblingIndex)
partially evaluated: sequentialOrdering
TRUEFALSE
yes
Evaluation Count:759
no
Evaluation Count:0
evaluated: !holesInSiblingIndex
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:704
0-759
2885 children.removeAt(child->d_ptr->siblingIndex);
executed: children.removeAt(child->d_ptr->siblingIndex);
Execution Count:55
55
2886 else -
2887 children.removeOne(child);
executed: children.removeOne(child);
Execution Count:704
704
2888 -
2889 -
2890 -
2891 child->d_ptr->siblingIndex = -1; -
2892 if (isObject)
evaluated: isObject
TRUEFALSE
yes
Evaluation Count:746
yes
Evaluation Count:13
13-746
2893 static_cast<QGraphicsObject *>(q_ptr)->childrenChanged();
executed: static_cast<QGraphicsObject *>(q_ptr)->childrenChanged();
Execution Count:746
746
2894}
executed: }
Execution Count:759
759
2895 -
2896 -
2897 -
2898 -
2899QGraphicsItemCache *QGraphicsItemPrivate::maybeExtraItemCache() const -
2900{ -
2901 return (QGraphicsItemCache *)qvariant_cast<void *>(extra(ExtraCacheData));
never executed: return (QGraphicsItemCache *)qvariant_cast<void *>(extra(ExtraCacheData));
0
2902} -
2903 -
2904 -
2905 -
2906 -
2907QGraphicsItemCache *QGraphicsItemPrivate::extraItemCache() const -
2908{ -
2909 QGraphicsItemCache *c = (QGraphicsItemCache *)qvariant_cast<void *>(extra(ExtraCacheData)); -
2910 if (!c) {
never evaluated: !c
0
2911 QGraphicsItemPrivate *that = const_cast<QGraphicsItemPrivate *>(this); -
2912 c = new QGraphicsItemCache; -
2913 that->setExtra(ExtraCacheData, QVariant::fromValue<void *>(c)); -
2914 }
never executed: }
0
2915 return c;
never executed: return c;
0
2916} -
2917 -
2918 -
2919 -
2920 -
2921void QGraphicsItemPrivate::removeExtraItemCache() -
2922{ -
2923 QGraphicsItemCache *c = (QGraphicsItemCache *)qvariant_cast<void *>(extra(ExtraCacheData)); -
2924 if (c) {
partially evaluated: c
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1757
0-1757
2925 c->purge(); -
2926 delete c; -
2927 }
never executed: }
0
2928 unsetExtra(ExtraCacheData); -
2929}
executed: }
Execution Count:1757
1757
2930 -
2931void QGraphicsItemPrivate::updatePaintedViewBoundingRects(bool updateChildren) -
2932{ -
2933 if (!scene)
evaluated: !scene
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:23
7-23
2934 return;
executed: return;
Execution Count:7
7
2935 -
2936 for (int i = 0; i < scene->d_func()->views.size(); ++i) {
evaluated: i < scene->d_func()->views.size()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:23
7-23
2937 QGraphicsViewPrivate *viewPrivate = scene->d_func()->views.at(i)->d_func(); -
2938 QRect rect = paintedViewBoundingRects.value(viewPrivate->viewport); -
2939 rect.translate(viewPrivate->dirtyScrollOffset); -
2940 viewPrivate->updateRect(rect); -
2941 }
executed: }
Execution Count:7
7
2942 -
2943 if (updateChildren) {
partially evaluated: updateChildren
TRUEFALSE
yes
Evaluation Count:23
no
Evaluation Count:0
0-23
2944 for (int i = 0; i < children.size(); ++i)
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:23
6-23
2945 children.at(i)->d_ptr->updatePaintedViewBoundingRects(true);
executed: children.at(i)->d_ptr->updatePaintedViewBoundingRects(true);
Execution Count:6
6
2946 }
executed: }
Execution Count:23
23
2947}
executed: }
Execution Count:23
23
2948 -
2949 -
2950 -
2951 -
2952 -
2953 -
2954void QGraphicsItemPrivate::ensureSceneTransformRecursive(QGraphicsItem **topMostDirtyItem) -
2955{ -
2956 qt_noop(); -
2957 -
2958 if (dirtySceneTransform)
evaluated: dirtySceneTransform
TRUEFALSE
yes
Evaluation Count:195
yes
Evaluation Count:2015
195-2015
2959 *topMostDirtyItem = q_ptr;
executed: *topMostDirtyItem = q_ptr;
Execution Count:195
195
2960 -
2961 if (parent)
evaluated: parent
TRUEFALSE
yes
Evaluation Count:92
yes
Evaluation Count:2118
92-2118
2962 parent->d_ptr->ensureSceneTransformRecursive(topMostDirtyItem);
executed: parent->d_ptr->ensureSceneTransformRecursive(topMostDirtyItem);
Execution Count:92
92
2963 -
2964 if (*topMostDirtyItem == q_ptr) {
evaluated: *topMostDirtyItem == q_ptr
TRUEFALSE
yes
Evaluation Count:2118
yes
Evaluation Count:92
92-2118
2965 if (!dirtySceneTransform)
evaluated: !dirtySceneTransform
TRUEFALSE
yes
Evaluation Count:1931
yes
Evaluation Count:187
187-1931
2966 return;
executed: return;
Execution Count:1931
1931
2967 *topMostDirtyItem = 0; -
2968 } else if (*topMostDirtyItem) {
evaluated: *topMostDirtyItem
TRUEFALSE
yes
Evaluation Count:84
yes
Evaluation Count:8
executed: }
Execution Count:187
8-187
2969 return;
executed: return;
Execution Count:84
84
2970 } -
2971 -
2972 -
2973 -
2974 -
2975 -
2976 invalidateChildrenSceneTransform(); -
2977 -
2978 -
2979 updateSceneTransformFromParent(); -
2980 qt_noop(); -
2981}
executed: }
Execution Count:195
195
2982 -
2983 -
2984 -
2985 -
2986void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem, QGraphicsItem *stopItem) -
2987{ -
2988 -
2989 -
2990 QGraphicsItem *parent = rootItem ? rootItem : q_ptr;
partially evaluated: rootItem
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
2991 if (parent->panel() != q_ptr->panel())
partially evaluated: parent->panel() != q_ptr->panel()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
2992 return;
never executed: return;
0
2993 -
2994 do { -
2995 -
2996 if (parent != q_ptr && parent->d_ptr->subFocusItem) {
partially evaluated: parent != q_ptr
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
never evaluated: parent->d_ptr->subFocusItem
0-14
2997 if (parent->d_ptr->subFocusItem == q_ptr)
never evaluated: parent->d_ptr->subFocusItem == q_ptr
0
2998 break;
never executed: break;
0
2999 parent->d_ptr->subFocusItem->d_ptr->clearSubFocus(0, stopItem); -
3000 }
never executed: }
0
3001 parent->d_ptr->subFocusItem = q_ptr; -
3002 parent->d_ptr->subFocusItemChange(); -
3003 } while (!parent->isPanel() && (parent = parent->d_ptr->parent) && (visible || !parent->d_ptr->visible));
partially evaluated: !parent->isPanel()
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
partially evaluated: (parent = parent->d_ptr->parent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
never evaluated: visible
never evaluated: !parent->d_ptr->visible
executed: }
Execution Count:14
0-14
3004 -
3005 if (scene && !scene->isActive()) {
partially evaluated: scene
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
evaluated: !scene->isActive()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:13
0-14
3006 scene->d_func()->passiveFocusItem = subFocusItem; -
3007 scene->d_func()->lastFocusItem = subFocusItem; -
3008 }
executed: }
Execution Count:1
1
3009}
executed: }
Execution Count:14
14
3010 -
3011 -
3012 -
3013 -
3014void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem, QGraphicsItem *stopItem) -
3015{ -
3016 -
3017 QGraphicsItem *parent = rootItem ? rootItem : q_ptr;
evaluated: rootItem
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:1700
11-1700
3018 do { -
3019 if (parent->d_ptr->subFocusItem != q_ptr)
evaluated: parent->d_ptr->subFocusItem != q_ptr
TRUEFALSE
yes
Evaluation Count:1700
yes
Evaluation Count:11
11-1700
3020 break;
executed: break;
Execution Count:1700
1700
3021 parent->d_ptr->subFocusItem = 0; -
3022 if (parent != stopItem && !parent->isAncestorOf(stopItem))
partially evaluated: parent != stopItem
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
partially evaluated: !parent->isAncestorOf(stopItem)
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
0-11
3023 parent->d_ptr->subFocusItemChange();
executed: parent->d_ptr->subFocusItemChange();
Execution Count:11
11
3024 } while (!parent->isPanel() && (parent = parent->d_ptr->parent));
partially evaluated: !parent->isPanel()
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
partially evaluated: (parent = parent->d_ptr->parent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
executed: }
Execution Count:11
0-11
3025}
executed: }
Execution Count:1711
1711
3026 -
3027 -
3028 -
3029 -
3030 -
3031 -
3032 -
3033void QGraphicsItemPrivate::resetFocusProxy() -
3034{ -
3035 for (int i = 0; i < focusProxyRefs.size(); ++i)
partially evaluated: i < focusProxyRefs.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1771
0-1771
3036 *focusProxyRefs.at(i) = 0;
never executed: *focusProxyRefs.at(i) = 0;
0
3037 focusProxyRefs.clear(); -
3038}
executed: }
Execution Count:1771
1771
3039 -
3040 -
3041 -
3042 -
3043 -
3044 -
3045 -
3046void QGraphicsItemPrivate::subFocusItemChange() -
3047{ -
3048} -
3049 -
3050 -
3051 -
3052 -
3053 -
3054 -
3055 -
3056void QGraphicsItemPrivate::focusScopeItemChange(bool isSubFocusItem) -
3057{ -
3058 (void)isSubFocusItem;; -
3059}
never executed: }
0
3060 -
3061 -
3062 -
3063 -
3064 -
3065 -
3066 -
3067void QGraphicsItemPrivate::siblingOrderChange() -
3068{ -
3069} -
3070 -
3071 -
3072 -
3073 -
3074 -
3075 -
3076bool QGraphicsItemPrivate::isProxyWidget() const -
3077{ -
3078 return false;
never executed: return false;
0
3079} -
3080void QGraphicsItem::update(const QRectF &rect) -
3081{ -
3082 if (rect.isEmpty() && !rect.isNull())
evaluated: rect.isEmpty()
TRUEFALSE
yes
Evaluation Count:3416
yes
Evaluation Count:317
partially evaluated: !rect.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3416
0-3416
3083 return;
never executed: return;
0
3084 -
3085 -
3086 -
3087 d_ptr->invalidateParentGraphicsEffectsRecursively(); -
3088 -
3089 -
3090 if (CacheMode(d_ptr->cacheMode) != NoCache) {
partially evaluated: CacheMode(d_ptr->cacheMode) != NoCache
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3733
0-3733
3091 -
3092 QGraphicsItemCache *cache = d_ptr->extraItemCache(); -
3093 if (!cache->allExposed) {
never evaluated: !cache->allExposed
0
3094 if (rect.isNull()) {
never evaluated: rect.isNull()
0
3095 cache->allExposed = true; -
3096 cache->exposed.clear(); -
3097 } else {
never executed: }
0
3098 cache->exposed.append(rect); -
3099 }
never executed: }
0
3100 } -
3101 -
3102 if (d_ptr->fullUpdatePending)
never evaluated: d_ptr->fullUpdatePending
0
3103 return;
never executed: return;
0
3104 }
never executed: }
0
3105 -
3106 if (d_ptr->scene)
evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:1648
yes
Evaluation Count:2085
1648-2085
3107 d_ptr->scene->d_func()->markDirty(this, rect);
executed: d_ptr->scene->d_func()->markDirty(this, rect);
Execution Count:1648
1648
3108}
executed: }
Execution Count:3733
3733
3109void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect) -
3110{ -
3111 QGraphicsItemPrivate * const d = d_func(); -
3112 if (dx == 0.0 && dy == 0.0)
never evaluated: dx == 0.0
never evaluated: dy == 0.0
0
3113 return;
never executed: return;
0
3114 if (!d->scene)
never evaluated: !d->scene
0
3115 return;
never executed: return;
0
3116 if (d->cacheMode != QGraphicsItem::ItemCoordinateCache
never evaluated: d->cacheMode != QGraphicsItem::ItemCoordinateCache
0
3117 || !qFuzzyIsNull(dx - int(dx)) || !qFuzzyIsNull(dy - int(dy))) {
never evaluated: !qFuzzyIsNull(dx - int(dx))
never evaluated: !qFuzzyIsNull(dy - int(dy))
0
3118 update(rect); -
3119 return;
never executed: return;
0
3120 } -
3121 -
3122 QGraphicsItemCache *cache = d->extraItemCache(); -
3123 if (cache->allExposed || cache->fixedSize.isValid()) {
never evaluated: cache->allExposed
never evaluated: cache->fixedSize.isValid()
0
3124 -
3125 update(rect); -
3126 return;
never executed: return;
0
3127 } -
3128 -
3129 -
3130 QPixmap cachedPixmap; -
3131 if (!QPixmapCache::find(cache->key, &cachedPixmap)) {
never evaluated: !QPixmapCache::find(cache->key, &cachedPixmap)
0
3132 update(rect); -
3133 return;
never executed: return;
0
3134 } -
3135 -
3136 QRect scrollRect = (rect.isNull() ? boundingRect() : rect).toAlignedRect();
never evaluated: rect.isNull()
0
3137 if (!scrollRect.intersects(cache->boundingRect))
never evaluated: !scrollRect.intersects(cache->boundingRect)
0
3138 return;
never executed: return;
0
3139 -
3140 -
3141 QPixmapCache::remove(cache->key); -
3142 -
3143 QRegion exposed; -
3144 cachedPixmap.scroll(dx, dy, scrollRect.translated(-cache->boundingRect.topLeft()), &exposed); -
3145 -
3146 -
3147 cache->key = QPixmapCache::insert(cachedPixmap); -
3148 -
3149 -
3150 for (int i = 0; i < cache->exposed.size(); ++i) {
never evaluated: i < cache->exposed.size()
0
3151 QRectF &e = cache->exposed[i]; -
3152 if (!rect.isNull() && !e.intersects(rect))
never evaluated: !rect.isNull()
never evaluated: !e.intersects(rect)
0
3153 continue;
never executed: continue;
0
3154 e.translate(dx, dy); -
3155 }
never executed: }
0
3156 -
3157 -
3158 -
3159 exposed.translate(cache->boundingRect.topLeft()); -
3160 const QVector<QRect> exposedRects = exposed.rects(); -
3161 for (int i = 0; i < exposedRects.size(); ++i)
never evaluated: i < exposedRects.size()
0
3162 cache->exposed += exposedRects.at(i);
never executed: cache->exposed += exposedRects.at(i);
0
3163 -
3164 -
3165 -
3166 d->scene->d_func()->markDirty(this, rect); -
3167}
never executed: }
0
3168QPointF QGraphicsItem::mapToItem(const QGraphicsItem *item, const QPointF &point) const -
3169{ -
3170 if (item)
never evaluated: item
0
3171 return itemTransform(item).map(point);
never executed: return itemTransform(item).map(point);
0
3172 return mapToScene(point);
never executed: return mapToScene(point);
0
3173} -
3174QPointF QGraphicsItem::mapToParent(const QPointF &point) const -
3175{ -
3176 -
3177 if (!d_ptr->transformData)
partially evaluated: !d_ptr->transformData
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
3178 return point + d_ptr->pos;
executed: return point + d_ptr->pos;
Execution Count:2
2
3179 return d_ptr->transformToParent().map(point);
never executed: return d_ptr->transformToParent().map(point);
0
3180} -
3181QPointF QGraphicsItem::mapToScene(const QPointF &point) const -
3182{ -
3183 if (d_ptr->hasTranslateOnlySceneTransform())
partially evaluated: d_ptr->hasTranslateOnlySceneTransform()
TRUEFALSE
yes
Evaluation Count:37
no
Evaluation Count:0
0-37
3184 return QPointF(point.x() + d_ptr->sceneTransform.dx(), point.y() + d_ptr->sceneTransform.dy());
executed: return QPointF(point.x() + d_ptr->sceneTransform.dx(), point.y() + d_ptr->sceneTransform.dy());
Execution Count:37
37
3185 return d_ptr->sceneTransform.map(point);
never executed: return d_ptr->sceneTransform.map(point);
0
3186} -
3187QPolygonF QGraphicsItem::mapToItem(const QGraphicsItem *item, const QRectF &rect) const -
3188{ -
3189 if (item)
never evaluated: item
0
3190 return itemTransform(item).map(rect);
never executed: return itemTransform(item).map(rect);
0
3191 return mapToScene(rect);
never executed: return mapToScene(rect);
0
3192} -
3193QPolygonF QGraphicsItem::mapToParent(const QRectF &rect) const -
3194{ -
3195 -
3196 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
3197 return rect.translated(d_ptr->pos);
never executed: return rect.translated(d_ptr->pos);
0
3198 return d_ptr->transformToParent().map(rect);
never executed: return d_ptr->transformToParent().map(rect);
0
3199} -
3200QPolygonF QGraphicsItem::mapToScene(const QRectF &rect) const -
3201{ -
3202 if (d_ptr->hasTranslateOnlySceneTransform())
never evaluated: d_ptr->hasTranslateOnlySceneTransform()
0
3203 return rect.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy());
never executed: return rect.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy());
0
3204 return d_ptr->sceneTransform.map(rect);
never executed: return d_ptr->sceneTransform.map(rect);
0
3205} -
3206QRectF QGraphicsItem::mapRectToItem(const QGraphicsItem *item, const QRectF &rect) const -
3207{ -
3208 if (item)
partially evaluated: item
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-30
3209 return itemTransform(item).mapRect(rect);
executed: return itemTransform(item).mapRect(rect);
Execution Count:30
30
3210 return mapRectToScene(rect);
never executed: return mapRectToScene(rect);
0
3211} -
3212QRectF QGraphicsItem::mapRectToParent(const QRectF &rect) const -
3213{ -
3214 -
3215 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
3216 return rect.translated(d_ptr->pos);
never executed: return rect.translated(d_ptr->pos);
0
3217 return d_ptr->transformToParent().mapRect(rect);
never executed: return d_ptr->transformToParent().mapRect(rect);
0
3218} -
3219QRectF QGraphicsItem::mapRectToScene(const QRectF &rect) const -
3220{ -
3221 if (d_ptr->hasTranslateOnlySceneTransform())
evaluated: d_ptr->hasTranslateOnlySceneTransform()
TRUEFALSE
yes
Evaluation Count:86
yes
Evaluation Count:3
3-86
3222 return rect.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy());
executed: return rect.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy());
Execution Count:86
86
3223 return d_ptr->sceneTransform.mapRect(rect);
executed: return d_ptr->sceneTransform.mapRect(rect);
Execution Count:3
3
3224} -
3225QRectF QGraphicsItem::mapRectFromItem(const QGraphicsItem *item, const QRectF &rect) const -
3226{ -
3227 if (item)
never evaluated: item
0
3228 return item->itemTransform(this).mapRect(rect);
never executed: return item->itemTransform(this).mapRect(rect);
0
3229 return mapRectFromScene(rect);
never executed: return mapRectFromScene(rect);
0
3230} -
3231QRectF QGraphicsItem::mapRectFromParent(const QRectF &rect) const -
3232{ -
3233 -
3234 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
3235 return rect.translated(-d_ptr->pos);
never executed: return rect.translated(-d_ptr->pos);
0
3236 return d_ptr->transformToParent().inverted().mapRect(rect);
never executed: return d_ptr->transformToParent().inverted().mapRect(rect);
0
3237} -
3238QRectF QGraphicsItem::mapRectFromScene(const QRectF &rect) const -
3239{ -
3240 if (d_ptr->hasTranslateOnlySceneTransform())
evaluated: d_ptr->hasTranslateOnlySceneTransform()
TRUEFALSE
yes
Evaluation Count:86
yes
Evaluation Count:3
3-86
3241 return rect.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy());
executed: return rect.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy());
Execution Count:86
86
3242 return d_ptr->sceneTransform.inverted().mapRect(rect);
executed: return d_ptr->sceneTransform.inverted().mapRect(rect);
Execution Count:3
3
3243} -
3244QPolygonF QGraphicsItem::mapToItem(const QGraphicsItem *item, const QPolygonF &polygon) const -
3245{ -
3246 if (item)
never evaluated: item
0
3247 return itemTransform(item).map(polygon);
never executed: return itemTransform(item).map(polygon);
0
3248 return mapToScene(polygon);
never executed: return mapToScene(polygon);
0
3249} -
3250QPolygonF QGraphicsItem::mapToParent(const QPolygonF &polygon) const -
3251{ -
3252 -
3253 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
3254 return polygon.translated(d_ptr->pos);
never executed: return polygon.translated(d_ptr->pos);
0
3255 return d_ptr->transformToParent().map(polygon);
never executed: return d_ptr->transformToParent().map(polygon);
0
3256} -
3257QPolygonF QGraphicsItem::mapToScene(const QPolygonF &polygon) const -
3258{ -
3259 if (d_ptr->hasTranslateOnlySceneTransform())
never evaluated: d_ptr->hasTranslateOnlySceneTransform()
0
3260 return polygon.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy());
never executed: return polygon.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy());
0
3261 return d_ptr->sceneTransform.map(polygon);
never executed: return d_ptr->sceneTransform.map(polygon);
0
3262} -
3263QPainterPath QGraphicsItem::mapToItem(const QGraphicsItem *item, const QPainterPath &path) const -
3264{ -
3265 if (item)
partially evaluated: item
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
3266 return itemTransform(item).map(path);
executed: return itemTransform(item).map(path);
Execution Count:6
6
3267 return mapToScene(path);
never executed: return mapToScene(path);
0
3268} -
3269QPainterPath QGraphicsItem::mapToParent(const QPainterPath &path) const -
3270{ -
3271 -
3272 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
3273 return path.translated(d_ptr->pos);
never executed: return path.translated(d_ptr->pos);
0
3274 return d_ptr->transformToParent().map(path);
never executed: return d_ptr->transformToParent().map(path);
0
3275} -
3276QPainterPath QGraphicsItem::mapToScene(const QPainterPath &path) const -
3277{ -
3278 if (d_ptr->hasTranslateOnlySceneTransform())
never evaluated: d_ptr->hasTranslateOnlySceneTransform()
0
3279 return path.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy());
never executed: return path.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy());
0
3280 return d_ptr->sceneTransform.map(path);
never executed: return d_ptr->sceneTransform.map(path);
0
3281} -
3282QPointF QGraphicsItem::mapFromItem(const QGraphicsItem *item, const QPointF &point) const -
3283{ -
3284 if (item)
never evaluated: item
0
3285 return item->itemTransform(this).map(point);
never executed: return item->itemTransform(this).map(point);
0
3286 return mapFromScene(point);
never executed: return mapFromScene(point);
0
3287} -
3288QPointF QGraphicsItem::mapFromParent(const QPointF &point) const -
3289{ -
3290 -
3291 if (d_ptr->transformData)
never evaluated: d_ptr->transformData
0
3292 return d_ptr->transformToParent().inverted().map(point);
never executed: return d_ptr->transformToParent().inverted().map(point);
0
3293 return point - d_ptr->pos;
never executed: return point - d_ptr->pos;
0
3294} -
3295QPointF QGraphicsItem::mapFromScene(const QPointF &point) const -
3296{ -
3297 if (d_ptr->hasTranslateOnlySceneTransform())
partially evaluated: d_ptr->hasTranslateOnlySceneTransform()
TRUEFALSE
yes
Evaluation Count:1640
no
Evaluation Count:0
0-1640
3298 return QPointF(point.x() - d_ptr->sceneTransform.dx(), point.y() - d_ptr->sceneTransform.dy());
executed: return QPointF(point.x() - d_ptr->sceneTransform.dx(), point.y() - d_ptr->sceneTransform.dy());
Execution Count:1640
1640
3299 return d_ptr->sceneTransform.inverted().map(point);
never executed: return d_ptr->sceneTransform.inverted().map(point);
0
3300} -
3301QPolygonF QGraphicsItem::mapFromItem(const QGraphicsItem *item, const QRectF &rect) const -
3302{ -
3303 if (item)
never evaluated: item
0
3304 return item->itemTransform(this).map(rect);
never executed: return item->itemTransform(this).map(rect);
0
3305 return mapFromScene(rect);
never executed: return mapFromScene(rect);
0
3306} -
3307QPolygonF QGraphicsItem::mapFromParent(const QRectF &rect) const -
3308{ -
3309 -
3310 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
3311 return rect.translated(-d_ptr->pos);
never executed: return rect.translated(-d_ptr->pos);
0
3312 return d_ptr->transformToParent().inverted().map(rect);
never executed: return d_ptr->transformToParent().inverted().map(rect);
0
3313} -
3314QPolygonF QGraphicsItem::mapFromScene(const QRectF &rect) const -
3315{ -
3316 if (d_ptr->hasTranslateOnlySceneTransform())
never evaluated: d_ptr->hasTranslateOnlySceneTransform()
0
3317 return rect.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy());
never executed: return rect.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy());
0
3318 return d_ptr->sceneTransform.inverted().map(rect);
never executed: return d_ptr->sceneTransform.inverted().map(rect);
0
3319} -
3320QPolygonF QGraphicsItem::mapFromItem(const QGraphicsItem *item, const QPolygonF &polygon) const -
3321{ -
3322 if (item)
never evaluated: item
0
3323 return item->itemTransform(this).map(polygon);
never executed: return item->itemTransform(this).map(polygon);
0
3324 return mapFromScene(polygon);
never executed: return mapFromScene(polygon);
0
3325} -
3326QPolygonF QGraphicsItem::mapFromParent(const QPolygonF &polygon) const -
3327{ -
3328 -
3329 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
3330 return polygon.translated(-d_ptr->pos);
never executed: return polygon.translated(-d_ptr->pos);
0
3331 return d_ptr->transformToParent().inverted().map(polygon);
never executed: return d_ptr->transformToParent().inverted().map(polygon);
0
3332} -
3333QPolygonF QGraphicsItem::mapFromScene(const QPolygonF &polygon) const -
3334{ -
3335 if (d_ptr->hasTranslateOnlySceneTransform())
never evaluated: d_ptr->hasTranslateOnlySceneTransform()
0
3336 return polygon.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy());
never executed: return polygon.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy());
0
3337 return d_ptr->sceneTransform.inverted().map(polygon);
never executed: return d_ptr->sceneTransform.inverted().map(polygon);
0
3338} -
3339QPainterPath QGraphicsItem::mapFromItem(const QGraphicsItem *item, const QPainterPath &path) const -
3340{ -
3341 if (item)
never evaluated: item
0
3342 return item->itemTransform(this).map(path);
never executed: return item->itemTransform(this).map(path);
0
3343 return mapFromScene(path);
never executed: return mapFromScene(path);
0
3344} -
3345QPainterPath QGraphicsItem::mapFromParent(const QPainterPath &path) const -
3346{ -
3347 -
3348 if (!d_ptr->transformData)
never evaluated: !d_ptr->transformData
0
3349 return path.translated(-d_ptr->pos);
never executed: return path.translated(-d_ptr->pos);
0
3350 return d_ptr->transformToParent().inverted().map(path);
never executed: return d_ptr->transformToParent().inverted().map(path);
0
3351} -
3352QPainterPath QGraphicsItem::mapFromScene(const QPainterPath &path) const -
3353{ -
3354 if (d_ptr->hasTranslateOnlySceneTransform())
never evaluated: d_ptr->hasTranslateOnlySceneTransform()
0
3355 return path.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy());
never executed: return path.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy());
0
3356 return d_ptr->sceneTransform.inverted().map(path);
never executed: return d_ptr->sceneTransform.inverted().map(path);
0
3357} -
3358 -
3359 -
3360 -
3361 -
3362 -
3363 -
3364 -
3365bool QGraphicsItem::isAncestorOf(const QGraphicsItem *child) const -
3366{ -
3367 if (!child || child == this)
evaluated: !child
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:23
partially evaluated: child == this
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:23
0-23
3368 return false;
executed: return false;
Execution Count:11
11
3369 if (child->d_ptr->depth() < d_ptr->depth())
evaluated: child->d_ptr->depth() < d_ptr->depth()
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:12
11-12
3370 return false;
executed: return false;
Execution Count:11
11
3371 const QGraphicsItem *ancestor = child; -
3372 while ((ancestor = ancestor->d_ptr->parent)) {
evaluated: (ancestor = ancestor->d_ptr->parent)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:10
8-10
3373 if (ancestor == this)
evaluated: ancestor == this
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
2-6
3374 return true;
executed: return true;
Execution Count:2
2
3375 }
executed: }
Execution Count:6
6
3376 return false;
executed: return false;
Execution Count:10
10
3377} -
3378QGraphicsItem *QGraphicsItem::commonAncestorItem(const QGraphicsItem *other) const -
3379{ -
3380 if (!other)
partially evaluated: !other
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
3381 return 0;
never executed: return 0;
0
3382 if (other == this)
partially evaluated: other == this
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
3383 return const_cast<QGraphicsItem *>(this);
never executed: return const_cast<QGraphicsItem *>(this);
0
3384 const QGraphicsItem *thisw = this; -
3385 const QGraphicsItem *otherw = other; -
3386 int thisDepth = d_ptr->depth(); -
3387 int otherDepth = other->d_ptr->depth(); -
3388 while (thisDepth > otherDepth) {
partially evaluated: thisDepth > otherDepth
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
3389 thisw = thisw->d_ptr->parent; -
3390 --thisDepth; -
3391 }
never executed: }
0
3392 while (otherDepth > thisDepth) {
evaluated: otherDepth > thisDepth
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:9
3-9
3393 otherw = otherw->d_ptr->parent; -
3394 --otherDepth; -
3395 }
executed: }
Execution Count:3
3
3396 while (thisw && thisw != otherw) {
evaluated: thisw
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:7
evaluated: thisw != otherw
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:2
2-9
3397 thisw = thisw->d_ptr->parent; -
3398 otherw = otherw->d_ptr->parent; -
3399 }
executed: }
Execution Count:7
7
3400 return const_cast<QGraphicsItem *>(thisw);
executed: return const_cast<QGraphicsItem *>(thisw);
Execution Count:9
9
3401} -
3402bool QGraphicsItem::isUnderMouse() const -
3403{ -
3404 const QGraphicsItemPrivate * const d = d_func(); -
3405 if (!d->scene)
evaluated: !d->scene
TRUEFALSE
yes
Evaluation Count:184
yes
Evaluation Count:57
57-184
3406 return false;
executed: return false;
Execution Count:184
184
3407 -
3408 QPoint cursorPos = QCursor::pos(); -
3409 for (QForeachContainer<__typeof__(d->scene->views())> _container_(d->scene->views()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
3410 if (contains(mapFromScene(view->mapToScene(view->mapFromGlobal(cursorPos)))))
evaluated: contains(mapFromScene(view->mapToScene(view->mapFromGlobal(cursorPos))))
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:45
12-45
3411 return true;
executed: return true;
Execution Count:12
12
3412 }
executed: }
Execution Count:45
45
3413 return false;
executed: return false;
Execution Count:45
45
3414} -
3415QVariant QGraphicsItem::data(int key) const -
3416{ -
3417 QGraphicsItemCustomDataStore *store = qt_dataStore(); -
3418 if (!store->data.contains(this))
never evaluated: !store->data.contains(this)
0
3419 return QVariant();
never executed: return QVariant();
0
3420 return store->data.value(this).value(key);
never executed: return store->data.value(this).value(key);
0
3421} -
3422void QGraphicsItem::setData(int key, const QVariant &value) -
3423{ -
3424 qt_dataStore()->data[this][key] = value; -
3425}
executed: }
Execution Count:7
7
3426int QGraphicsItem::type() const -
3427{ -
3428 return (int)UserType;
never executed: return (int)UserType;
0
3429} -
3430void QGraphicsItem::installSceneEventFilter(QGraphicsItem *filterItem) -
3431{ -
3432 if (!d_ptr->scene) {
never evaluated: !d_ptr->scene
0
3433 QMessageLogger("graphicsview/qgraphicsitem.cpp", 6534, __PRETTY_FUNCTION__).warning("QGraphicsItem::installSceneEventFilter: event filters can only be installed" -
3434 " on items in a scene."); -
3435 return;
never executed: return;
0
3436 } -
3437 if (d_ptr->scene != filterItem->scene()) {
never evaluated: d_ptr->scene != filterItem->scene()
0
3438 QMessageLogger("graphicsview/qgraphicsitem.cpp", 6539, __PRETTY_FUNCTION__).warning("QGraphicsItem::installSceneEventFilter: event filters can only be installed" -
3439 " on items in the same scene."); -
3440 return;
never executed: return;
0
3441 } -
3442 d_ptr->scene->d_func()->installSceneEventFilter(this, filterItem); -
3443}
never executed: }
0
3444 -
3445 -
3446 -
3447 -
3448 -
3449 -
3450void QGraphicsItem::removeSceneEventFilter(QGraphicsItem *filterItem) -
3451{ -
3452 if (!d_ptr->scene || d_ptr->scene != filterItem->scene())
never evaluated: !d_ptr->scene
never evaluated: d_ptr->scene != filterItem->scene()
0
3453 return;
never executed: return;
0
3454 d_ptr->scene->d_func()->removeSceneEventFilter(this, filterItem); -
3455}
never executed: }
0
3456bool QGraphicsItem::sceneEventFilter(QGraphicsItem *watched, QEvent *event) -
3457{ -
3458 (void)watched;; -
3459 (void)event;; -
3460 return false;
never executed: return false;
0
3461} -
3462bool QGraphicsItem::sceneEvent(QEvent *event) -
3463{ -
3464 if (d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorHandlesChildEvents) {
partially evaluated: d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorHandlesChildEvents
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:965
0-965
3465 if (event->type() == QEvent::HoverEnter || event->type() == QEvent::HoverLeave
never evaluated: event->type() == QEvent::HoverEnter
never evaluated: event->type() == QEvent::HoverLeave
0
3466 || event->type() == QEvent::DragEnter || event->type() == QEvent::DragLeave) {
never evaluated: event->type() == QEvent::DragEnter
never evaluated: event->type() == QEvent::DragLeave
0
3467 -
3468 -
3469 return true;
never executed: return true;
0
3470 } -
3471 -
3472 QGraphicsItem *handler = this; -
3473 do { -
3474 handler = handler->d_ptr->parent; -
3475 qt_noop(); -
3476 } while (handler->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorHandlesChildEvents);
never evaluated: handler->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorHandlesChildEvents
never executed: }
0
3477 -
3478 -
3479 -
3480 d_ptr->remapItemPos(event, handler); -
3481 handler->sceneEvent(event); -
3482 return true;
never executed: return true;
0
3483 } -
3484 -
3485 if (event->type() == QEvent::FocusOut) {
evaluated: event->type() == QEvent::FocusOut
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:952
13-952
3486 focusOutEvent(static_cast<QFocusEvent *>(event)); -
3487 return true;
executed: return true;
Execution Count:13
13
3488 } -
3489 -
3490 if (!d_ptr->visible) {
partially evaluated: !d_ptr->visible
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:952
0-952
3491 -
3492 return true;
never executed: return true;
0
3493 } -
3494 -
3495 switch (event->type()) { -
3496 case QEvent::FocusIn: -
3497 focusInEvent(static_cast<QFocusEvent *>(event)); -
3498 break;
executed: break;
Execution Count:13
13
3499 case QEvent::GraphicsSceneContextMenu: -
3500 contextMenuEvent(static_cast<QGraphicsSceneContextMenuEvent *>(event)); -
3501 break;
executed: break;
Execution Count:100
100
3502 case QEvent::GraphicsSceneDragEnter: -
3503 dragEnterEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); -
3504 break;
never executed: break;
0
3505 case QEvent::GraphicsSceneDragMove: -
3506 dragMoveEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); -
3507 break;
never executed: break;
0
3508 case QEvent::GraphicsSceneDragLeave: -
3509 dragLeaveEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); -
3510 break;
never executed: break;
0
3511 case QEvent::GraphicsSceneDrop: -
3512 dropEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); -
3513 break;
never executed: break;
0
3514 case QEvent::GraphicsSceneHoverEnter: -
3515 hoverEnterEvent(static_cast<QGraphicsSceneHoverEvent *>(event)); -
3516 break;
never executed: break;
0
3517 case QEvent::GraphicsSceneHoverMove: -
3518 hoverMoveEvent(static_cast<QGraphicsSceneHoverEvent *>(event)); -
3519 break;
never executed: break;
0
3520 case QEvent::GraphicsSceneHoverLeave: -
3521 hoverLeaveEvent(static_cast<QGraphicsSceneHoverEvent *>(event)); -
3522 break;
never executed: break;
0
3523 case QEvent::GraphicsSceneMouseMove: -
3524 mouseMoveEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); -
3525 break;
executed: break;
Execution Count:2
2
3526 case QEvent::GraphicsSceneMousePress: -
3527 mousePressEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); -
3528 break;
executed: break;
Execution Count:103
103
3529 case QEvent::GraphicsSceneMouseRelease: -
3530 mouseReleaseEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); -
3531 break;
executed: break;
Execution Count:104
104
3532 case QEvent::GraphicsSceneMouseDoubleClick: -
3533 mouseDoubleClickEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); -
3534 break;
never executed: break;
0
3535 case QEvent::GraphicsSceneWheel: -
3536 wheelEvent(static_cast<QGraphicsSceneWheelEvent *>(event)); -
3537 break;
executed: break;
Execution Count:2
2
3538 case QEvent::KeyPress: { -
3539 QKeyEvent *k = static_cast<QKeyEvent *>(event); -
3540 if (k->key() == Qt::Key_Tab || k->key() == Qt::Key_Backtab) {
partially evaluated: k->key() == Qt::Key_Tab
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: k->key() == Qt::Key_Backtab
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
3541 if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) {
never evaluated: !(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))
0
3542 bool res = false; -
3543 if (k->key() == Qt::Key_Backtab
never evaluated: k->key() == Qt::Key_Backtab
0
3544 || (k->key() == Qt::Key_Tab && (k->modifiers() & Qt::ShiftModifier))) {
never evaluated: k->key() == Qt::Key_Tab
never evaluated: (k->modifiers() & Qt::ShiftModifier)
0
3545 if (d_ptr->isWidget) {
never evaluated: d_ptr->isWidget
0
3546 res = static_cast<QGraphicsWidget *>(this)->focusNextPrevChild(false); -
3547 } else if (d_ptr->scene) {
never evaluated: d_ptr->scene
never executed: }
0
3548 res = d_ptr->scene->focusNextPrevChild(false); -
3549 }
never executed: }
0
3550 } else if (k->key() == Qt::Key_Tab) {
never evaluated: k->key() == Qt::Key_Tab
0
3551 if (d_ptr->isWidget) {
never evaluated: d_ptr->isWidget
0
3552 res = static_cast<QGraphicsWidget *>(this)->focusNextPrevChild(true); -
3553 } else if (d_ptr->scene) {
never evaluated: d_ptr->scene
never executed: }
0
3554 res = d_ptr->scene->focusNextPrevChild(true); -
3555 }
never executed: }
0
3556 } -
3557 if (!res)
never evaluated: !res
0
3558 event->ignore();
never executed: event->ignore();
0
3559 return true;
never executed: return true;
0
3560 } -
3561 }
never executed: }
0
3562 keyPressEvent(static_cast<QKeyEvent *>(event)); -
3563 break;
executed: break;
Execution Count:1
1
3564 } -
3565 case QEvent::KeyRelease: -
3566 keyReleaseEvent(static_cast<QKeyEvent *>(event)); -
3567 break;
never executed: break;
0
3568 case QEvent::InputMethod: -
3569 inputMethodEvent(static_cast<QInputMethodEvent *>(event)); -
3570 break;
executed: break;
Execution Count:2
2
3571 case QEvent::WindowActivate: -
3572 case QEvent::WindowDeactivate: -
3573 -
3574 if (d_ptr->scene) {
partially evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:415
no
Evaluation Count:0
0-415
3575 for (int i = 0; i < d_ptr->children.size(); ++i) {
evaluated: i < d_ptr->children.size()
TRUEFALSE
yes
Evaluation Count:112
yes
Evaluation Count:415
112-415
3576 QGraphicsItem *child = d_ptr->children.at(i); -
3577 if (child->isVisible() && !child->isPanel()) {
evaluated: child->isVisible()
TRUEFALSE
yes
Evaluation Count:111
yes
Evaluation Count:1
partially evaluated: !child->isPanel()
TRUEFALSE
yes
Evaluation Count:111
no
Evaluation Count:0
0-111
3578 if (!(child->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorHandlesChildEvents))
partially evaluated: !(child->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorHandlesChildEvents)
TRUEFALSE
yes
Evaluation Count:111
no
Evaluation Count:0
0-111
3579 d_ptr->scene->sendEvent(child, event);
executed: d_ptr->scene->sendEvent(child, event);
Execution Count:111
111
3580 }
executed: }
Execution Count:111
111
3581 }
executed: }
Execution Count:112
112
3582 }
executed: }
Execution Count:415
415
3583 break;
executed: break;
Execution Count:415
415
3584 default: -
3585 return false;
executed: return false;
Execution Count:210
210
3586 } -
3587 -
3588 return true;
executed: return true;
Execution Count:742
742
3589} -
3590void QGraphicsItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -
3591{ -
3592 event->ignore(); -
3593}
executed: }
Execution Count:100
100
3594void QGraphicsItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event) -
3595{ -
3596 QGraphicsItemPrivate * const d = d_func(); -
3597 -
3598 if (d->isProxyWidget())
never evaluated: d->isProxyWidget()
0
3599 static_cast<QGraphicsProxyWidget*>(this)->dragEnterEvent(event);
never executed: static_cast<QGraphicsProxyWidget*>(this)->dragEnterEvent(event);
0
3600}
never executed: }
0
3601void QGraphicsItem::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) -
3602{ -
3603 QGraphicsItemPrivate * const d = d_func(); -
3604 -
3605 if (d->isProxyWidget())
never evaluated: d->isProxyWidget()
0
3606 static_cast<QGraphicsProxyWidget*>(this)->dragLeaveEvent(event);
never executed: static_cast<QGraphicsProxyWidget*>(this)->dragLeaveEvent(event);
0
3607}
never executed: }
0
3608void QGraphicsItem::dragMoveEvent(QGraphicsSceneDragDropEvent *event) -
3609{ -
3610 QGraphicsItemPrivate * const d = d_func(); -
3611 -
3612 if (d->isProxyWidget())
never evaluated: d->isProxyWidget()
0
3613 static_cast<QGraphicsProxyWidget*>(this)->dragMoveEvent(event);
never executed: static_cast<QGraphicsProxyWidget*>(this)->dragMoveEvent(event);
0
3614}
never executed: }
0
3615void QGraphicsItem::dropEvent(QGraphicsSceneDragDropEvent *event) -
3616{ -
3617 QGraphicsItemPrivate * const d = d_func(); -
3618 -
3619 if (d->isProxyWidget())
never evaluated: d->isProxyWidget()
0
3620 static_cast<QGraphicsProxyWidget*>(this)->dropEvent(event);
never executed: static_cast<QGraphicsProxyWidget*>(this)->dropEvent(event);
0
3621}
never executed: }
0
3622void QGraphicsItem::focusInEvent(QFocusEvent *event) -
3623{ -
3624 (void)event;; -
3625 update(); -
3626}
executed: }
Execution Count:6
6
3627 -
3628 -
3629 -
3630 -
3631 -
3632 -
3633 -
3634void QGraphicsItem::focusOutEvent(QFocusEvent *event) -
3635{ -
3636 (void)event;; -
3637 update(); -
3638}
executed: }
Execution Count:12
12
3639void QGraphicsItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) -
3640{ -
3641 (void)event;; -
3642 update(); -
3643}
never executed: }
0
3644void QGraphicsItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) -
3645{ -
3646 (void)event;; -
3647}
never executed: }
0
3648void QGraphicsItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -
3649{ -
3650 (void)event;; -
3651 update(); -
3652}
never executed: }
0
3653void QGraphicsItem::keyPressEvent(QKeyEvent *event) -
3654{ -
3655 event->ignore(); -
3656}
executed: }
Execution Count:1
1
3657void QGraphicsItem::keyReleaseEvent(QKeyEvent *event) -
3658{ -
3659 event->ignore(); -
3660}
never executed: }
0
3661void QGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *event) -
3662{ -
3663 if (event->button() == Qt::LeftButton && (flags() & ItemIsSelectable)) {
partially evaluated: event->button() == Qt::LeftButton
TRUEFALSE
yes
Evaluation Count:103
no
Evaluation Count:0
partially evaluated: (flags() & ItemIsSelectable)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:103
0-103
3664 bool multiSelect = (event->modifiers() & Qt::ControlModifier) != 0; -
3665 if (!multiSelect) {
never evaluated: !multiSelect
0
3666 if (!d_ptr->selected) {
never evaluated: !d_ptr->selected
0
3667 if (QGraphicsScene *scene = d_ptr->scene) {
never evaluated: QGraphicsScene *scene = d_ptr->scene
0
3668 ++scene->d_func()->selectionChanging; -
3669 scene->clearSelection(); -
3670 --scene->d_func()->selectionChanging; -
3671 }
never executed: }
0
3672 setSelected(true); -
3673 }
never executed: }
0
3674 }
never executed: }
0
3675 } else if (!(flags() & ItemIsMovable)) {
partially evaluated: !(flags() & ItemIsMovable)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:103
never executed: }
0-103
3676 event->ignore(); -
3677 }
never executed: }
0
3678 if (d_ptr->isWidget) {
partially evaluated: d_ptr->isWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:103
0-103
3679 -
3680 QGraphicsWidget *w = static_cast<QGraphicsWidget *>(this); -
3681 if ((w->windowFlags() & Qt::Popup) == Qt::Popup) {
never evaluated: (w->windowFlags() & Qt::Popup) == Qt::Popup
0
3682 event->accept(); -
3683 if (!w->rect().contains(event->pos()))
never evaluated: !w->rect().contains(event->pos())
0
3684 w->close();
never executed: w->close();
0
3685 }
never executed: }
0
3686 }
never executed: }
0
3687}
executed: }
Execution Count:103
103
3688 -
3689 -
3690 -
3691 -
3692bool _qt_movableAncestorIsSelected(const QGraphicsItem *item) -
3693{ -
3694 const QGraphicsItem *parent = item->parentItem(); -
3695 return parent && (((parent->flags() & QGraphicsItem::ItemIsMovable) && parent->isSelected()) || _qt_movableAncestorIsSelected(parent));
never executed: return parent && (((parent->flags() & QGraphicsItem::ItemIsMovable) && parent->isSelected()) || _qt_movableAncestorIsSelected(parent));
0
3696} -
3697 -
3698bool QGraphicsItemPrivate::movableAncestorIsSelected(const QGraphicsItem *item) -
3699{ -
3700 const QGraphicsItem *parent = item->d_ptr->parent; -
3701 return parent && (((parent->flags() & QGraphicsItem::ItemIsMovable) && parent->isSelected()) || _qt_movableAncestorIsSelected(parent));
executed: return parent && (((parent->flags() & QGraphicsItem::ItemIsMovable) && parent->isSelected()) || _qt_movableAncestorIsSelected(parent));
Execution Count:1
1
3702} -
3703void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -
3704{ -
3705 if ((event->buttons() & Qt::LeftButton) && (flags() & ItemIsMovable)) {
partially evaluated: (event->buttons() & Qt::LeftButton)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: (flags() & ItemIsMovable)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
3706 -
3707 QList<QGraphicsItem *> selectedItems; -
3708 QHash<QGraphicsItem *, QPointF> initialPositions; -
3709 if (d_ptr->scene) {
partially evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
3710 selectedItems = d_ptr->scene->selectedItems(); -
3711 initialPositions = d_ptr->scene->d_func()->movingItemsInitialPositions; -
3712 if (initialPositions.isEmpty()) {
partially evaluated: initialPositions.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
3713 for (QForeachContainer<__typeof__(selectedItems)> _container_(selectedItems); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
3714 initialPositions[item] = item->pos();
never executed: initialPositions[item] = item->pos();
0
3715 initialPositions[this] = pos(); -
3716 }
executed: }
Execution Count:1
1
3717 d_ptr->scene->d_func()->movingItemsInitialPositions = initialPositions; -
3718 }
executed: }
Execution Count:1
1
3719 -
3720 -
3721 QGraphicsView *view = 0; -
3722 if (event->widget())
partially evaluated: event->widget()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
3723 view = qobject_cast<QGraphicsView *>(event->widget()->parentWidget());
executed: view = qobject_cast<QGraphicsView *>(event->widget()->parentWidget());
Execution Count:1
1
3724 -
3725 -
3726 int i = 0; -
3727 bool movedMe = false; -
3728 while (i <= selectedItems.size()) {
evaluated: i <= selectedItems.size()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
3729 QGraphicsItem *item = 0; -
3730 if (i < selectedItems.size())
partially evaluated: i < selectedItems.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
3731 item = selectedItems.at(i);
never executed: item = selectedItems.at(i);
0
3732 else -
3733 item = this;
executed: item = this;
Execution Count:1
1
3734 if (item == this) {
partially evaluated: item == this
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
3735 -
3736 -
3737 -
3738 -
3739 if (movedMe)
partially evaluated: movedMe
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
3740 break;
never executed: break;
0
3741 movedMe = true; -
3742 }
executed: }
Execution Count:1
1
3743 -
3744 if ((item->flags() & ItemIsMovable) && !QGraphicsItemPrivate::movableAncestorIsSelected(item)) {
partially evaluated: (item->flags() & ItemIsMovable)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: !QGraphicsItemPrivate::movableAncestorIsSelected(item)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
3745 QPointF currentParentPos; -
3746 QPointF buttonDownParentPos; -
3747 if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorIgnoresTransformations) {
partially evaluated: item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorIgnoresTransformations
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
3748 -
3749 -
3750 -
3751 QTransform viewToItemTransform = (item->deviceTransform(view->viewportTransform())).inverted(); -
3752 currentParentPos = mapToParent(viewToItemTransform.map(QPointF(view->mapFromGlobal(event->screenPos())))); -
3753 buttonDownParentPos = mapToParent(viewToItemTransform.map(QPointF(view->mapFromGlobal(event->buttonDownScreenPos(Qt::LeftButton))))); -
3754 } else if (item->flags() & ItemIgnoresTransformations) {
partially evaluated: item->flags() & ItemIgnoresTransformations
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never executed: }
0-1
3755 -
3756 -
3757 -
3758 -
3759 QTransform itemTransform; -
3760 if (item->d_ptr->transformData)
never evaluated: item->d_ptr->transformData
0
3761 itemTransform = item->d_ptr->transformData->computedFullTransform();
never executed: itemTransform = item->d_ptr->transformData->computedFullTransform();
0
3762 itemTransform.translate(item->d_ptr->pos.x(), item->d_ptr->pos.y()); -
3763 QTransform viewToParentTransform = itemTransform -
3764 * (item->sceneTransform() * view->viewportTransform()).inverted(); -
3765 currentParentPos = viewToParentTransform.map(QPointF(view->mapFromGlobal(event->screenPos()))); -
3766 buttonDownParentPos = viewToParentTransform.map(QPointF(view->mapFromGlobal(event->buttonDownScreenPos(Qt::LeftButton)))); -
3767 } else {
never executed: }
0
3768 -
3769 currentParentPos = item->mapToParent(item->mapFromScene(event->scenePos())); -
3770 buttonDownParentPos = item->mapToParent(item->mapFromScene(event->buttonDownScenePos(Qt::LeftButton))); -
3771 }
executed: }
Execution Count:1
1
3772 -
3773 item->setPos(initialPositions.value(item) + currentParentPos - buttonDownParentPos); -
3774 -
3775 if (item->flags() & ItemIsSelectable)
partially evaluated: item->flags() & ItemIsSelectable
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
3776 item->setSelected(true);
never executed: item->setSelected(true);
0
3777 }
executed: }
Execution Count:1
1
3778 ++i; -
3779 }
executed: }
Execution Count:1
1
3780 -
3781 } else {
executed: }
Execution Count:1
1
3782 event->ignore(); -
3783 }
never executed: }
0
3784} -
3785void QGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -
3786{ -
3787 if (flags() & ItemIsSelectable) {
partially evaluated: flags() & ItemIsSelectable
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
3788 bool multiSelect = (event->modifiers() & Qt::ControlModifier) != 0; -
3789 if (event->scenePos() == event->buttonDownScenePos(Qt::LeftButton)) {
never evaluated: event->scenePos() == event->buttonDownScenePos(Qt::LeftButton)
0
3790 -
3791 if (multiSelect) {
never evaluated: multiSelect
0
3792 setSelected(!isSelected()); -
3793 } else {
never executed: }
0
3794 bool selectionChanged = false; -
3795 if (QGraphicsScene *scene = d_ptr->scene) {
never evaluated: QGraphicsScene *scene = d_ptr->scene
0
3796 ++scene->d_func()->selectionChanging; -
3797 -
3798 -
3799 -
3800 if (d_ptr->selected) {
never evaluated: d_ptr->selected
0
3801 scene->d_func()->selectedItems.remove(this); -
3802 for (QForeachContainer<__typeof__(scene->d_func()->selectedItems)> _container_(scene->d_func()->selectedItems); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
3803 if (item->isSelected()) {
never evaluated: item->isSelected()
0
3804 selectionChanged = true; -
3805 break;
never executed: break;
0
3806 } -
3807 }
never executed: }
0
3808 }
never executed: }
0
3809 scene->clearSelection(); -
3810 if (d_ptr->selected)
never evaluated: d_ptr->selected
0
3811 scene->d_func()->selectedItems.insert(this);
never executed: scene->d_func()->selectedItems.insert(this);
0
3812 --scene->d_func()->selectionChanging; -
3813 if (selectionChanged)
never evaluated: selectionChanged
0
3814 d_ptr->scene->selectionChanged();
never executed: d_ptr->scene->selectionChanged();
0
3815 }
never executed: }
0
3816 setSelected(true); -
3817 }
never executed: }
0
3818 } -
3819 }
never executed: }
0
3820 if (d_ptr->scene && !event->buttons())
partially evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:104
no
Evaluation Count:0
partially evaluated: !event->buttons()
TRUEFALSE
yes
Evaluation Count:104
no
Evaluation Count:0
0-104
3821 d_ptr->scene->d_func()->movingItemsInitialPositions.clear();
executed: d_ptr->scene->d_func()->movingItemsInitialPositions.clear();
Execution Count:104
104
3822}
executed: }
Execution Count:104
104
3823void QGraphicsItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) -
3824{ -
3825 mousePressEvent(event); -
3826}
never executed: }
0
3827void QGraphicsItem::wheelEvent(QGraphicsSceneWheelEvent *event) -
3828{ -
3829 event->ignore(); -
3830}
executed: }
Execution Count:2
2
3831void QGraphicsItem::inputMethodEvent(QInputMethodEvent *event) -
3832{ -
3833 event->ignore(); -
3834}
executed: }
Execution Count:2
2
3835QVariant QGraphicsItem::inputMethodQuery(Qt::InputMethodQuery query) const -
3836{ -
3837 (void)query;; -
3838 return QVariant();
executed: return QVariant();
Execution Count:7
7
3839} -
3840Qt::InputMethodHints QGraphicsItem::inputMethodHints() const -
3841{ -
3842 const QGraphicsItemPrivate * const d = d_func(); -
3843 return d->imHints;
executed: return d->imHints;
Execution Count:11
11
3844} -
3845void QGraphicsItem::setInputMethodHints(Qt::InputMethodHints hints) -
3846{ -
3847 QGraphicsItemPrivate * const d = d_func(); -
3848 d->imHints = hints; -
3849 if (!hasFocus())
never evaluated: !hasFocus()
0
3850 return;
never executed: return;
0
3851 d->scene->d_func()->updateInputMethodSensitivityInViews(); -
3852 QWidget *fw = QApplication::focusWidget(); -
3853 if (!fw)
never evaluated: !fw
0
3854 return;
never executed: return;
0
3855 (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImHints); -
3856}
never executed: }
0
3857void QGraphicsItem::updateMicroFocus() -
3858{ -
3859} -
3860QVariant QGraphicsItem::itemChange(GraphicsItemChange change, const QVariant &value) -
3861{ -
3862 (void)change;; -
3863 return value;
executed: return value;
Execution Count:11572
11572
3864} -
3865 -
3866 -
3867 -
3868 -
3869 -
3870 -
3871 -
3872bool QGraphicsItem::supportsExtension(Extension extension) const -
3873{ -
3874 (void)extension;; -
3875 return false;
never executed: return false;
0
3876} -
3877 -
3878 -
3879 -
3880 -
3881 -
3882 -
3883 -
3884void QGraphicsItem::setExtension(Extension extension, const QVariant &variant) -
3885{ -
3886 (void)extension;; -
3887 (void)variant;; -
3888}
never executed: }
0
3889 -
3890 -
3891 -
3892 -
3893 -
3894 -
3895 -
3896QVariant QGraphicsItem::extension(const QVariant &variant) const -
3897{ -
3898 (void)variant;; -
3899 return QVariant();
never executed: return QVariant();
0
3900} -
3901void QGraphicsItem::addToIndex() -
3902{ -
3903 if (d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) {
never evaluated: d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren
0
3904 -
3905 return;
never executed: return;
0
3906 } -
3907 if (d_ptr->scene)
never evaluated: d_ptr->scene
0
3908 d_ptr->scene->d_func()->index->addItem(this);
never executed: d_ptr->scene->d_func()->index->addItem(this);
0
3909}
never executed: }
0
3910void QGraphicsItem::removeFromIndex() -
3911{ -
3912 if (d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) {
never evaluated: d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren
0
3913 -
3914 return;
never executed: return;
0
3915 } -
3916 if (d_ptr->scene)
never evaluated: d_ptr->scene
0
3917 d_ptr->scene->d_func()->index->removeItem(this);
never executed: d_ptr->scene->d_func()->index->removeItem(this);
0
3918}
never executed: }
0
3919void QGraphicsItem::prepareGeometryChange() -
3920{ -
3921 if (d_ptr->inDestructor)
evaluated: d_ptr->inDestructor
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:4038
11-4038
3922 return;
executed: return;
Execution Count:11
11
3923 if (d_ptr->scene) {
evaluated: d_ptr->scene
TRUEFALSE
yes
Evaluation Count:1758
yes
Evaluation Count:2280
1758-2280
3924 d_ptr->scene->d_func()->dirtyGrowingItemsBoundingRect = true; -
3925 d_ptr->geometryChanged = 1; -
3926 d_ptr->paintedViewBoundingRectsNeedRepaint = 1; -
3927 d_ptr->notifyBoundingRectChanged = !d_ptr->inSetPosHelper; -
3928 -
3929 QGraphicsScenePrivate *scenePrivate = d_ptr->scene->d_func(); -
3930 scenePrivate->index->prepareBoundingRectChange(this); -
3931 scenePrivate->markDirty(this, QRectF(), true, false, -
3932 false, false, -
3933 true); -
3934 -
3935 -
3936 -
3937 -
3938 -
3939 if (scenePrivate->isSignalConnected(scenePrivate->changedSignalIndex)
evaluated: scenePrivate->isSignalConnected(scenePrivate->changedSignalIndex)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1756
2-1756
3940 || scenePrivate->views.isEmpty()) {
evaluated: scenePrivate->views.isEmpty()
TRUEFALSE
yes
Evaluation Count:182
yes
Evaluation Count:1574
182-1574
3941 if (d_ptr->hasTranslateOnlySceneTransform()) {
evaluated: d_ptr->hasTranslateOnlySceneTransform()
TRUEFALSE
yes
Evaluation Count:180
yes
Evaluation Count:4
4-180
3942 d_ptr->scene->update(boundingRect().translated(d_ptr->sceneTransform.dx(), -
3943 d_ptr->sceneTransform.dy())); -
3944 } else {
executed: }
Execution Count:180
180
3945 d_ptr->scene->update(d_ptr->sceneTransform.mapRect(boundingRect())); -
3946 }
executed: }
Execution Count:4
4
3947 } -
3948 }
executed: }
Execution Count:1758
1758
3949 -
3950 d_ptr->markParentDirty( true); -
3951}
executed: }
Execution Count:4038
4038
3952static void qt_graphicsItem_highlightSelected( -
3953 QGraphicsItem *item, QPainter *painter, const QStyleOptionGraphicsItem *option) -
3954{ -
3955 const QRectF murect = painter->transform().mapRect(QRectF(0, 0, 1, 1)); -
3956 if (qFuzzyIsNull(qMax(murect.width(), murect.height())))
partially evaluated: qFuzzyIsNull(qMax(murect.width(), murect.height()))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
3957 return;
never executed: return;
0
3958 -
3959 const QRectF mbrect = painter->transform().mapRect(item->boundingRect()); -
3960 if (qMin(mbrect.width(), mbrect.height()) < qreal(1.0))
partially evaluated: qMin(mbrect.width(), mbrect.height()) < qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
3961 return;
never executed: return;
0
3962 -
3963 qreal itemPenWidth; -
3964 switch (item->type()) { -
3965 case QGraphicsEllipseItem::Type: -
3966 itemPenWidth = static_cast<QGraphicsEllipseItem *>(item)->pen().widthF(); -
3967 break;
never executed: break;
0
3968 case QGraphicsPathItem::Type: -
3969 itemPenWidth = static_cast<QGraphicsPathItem *>(item)->pen().widthF(); -
3970 break;
never executed: break;
0
3971 case QGraphicsPolygonItem::Type: -
3972 itemPenWidth = static_cast<QGraphicsPolygonItem *>(item)->pen().widthF(); -
3973 break;
never executed: break;
0
3974 case QGraphicsRectItem::Type: -
3975 itemPenWidth = static_cast<QGraphicsRectItem *>(item)->pen().widthF(); -
3976 break;
executed: break;
Execution Count:1
1
3977 case QGraphicsSimpleTextItem::Type: -
3978 itemPenWidth = static_cast<QGraphicsSimpleTextItem *>(item)->pen().widthF(); -
3979 break;
never executed: break;
0
3980 case QGraphicsLineItem::Type: -
3981 itemPenWidth = static_cast<QGraphicsLineItem *>(item)->pen().widthF(); -
3982 break;
never executed: break;
0
3983 default: -
3984 itemPenWidth = 1.0; -
3985 }
never executed: }
0
3986 const qreal pad = itemPenWidth / 2; -
3987 -
3988 const qreal penWidth = 0; -
3989 -
3990 const QColor fgcolor = option->palette.windowText().color(); -
3991 const QColor bgcolor( -
3992 fgcolor.red() > 127 ? 0 : 255, -
3993 fgcolor.green() > 127 ? 0 : 255, -
3994 fgcolor.blue() > 127 ? 0 : 255); -
3995 -
3996 painter->setPen(QPen(bgcolor, penWidth, Qt::SolidLine)); -
3997 painter->setBrush(Qt::NoBrush); -
3998 painter->drawRect(item->boundingRect().adjusted(pad, pad, -pad, -pad)); -
3999 -
4000 painter->setPen(QPen(option->palette.windowText(), 0, Qt::DashLine)); -
4001 painter->setBrush(Qt::NoBrush); -
4002 painter->drawRect(item->boundingRect().adjusted(pad, pad, -pad, -pad)); -
4003}
executed: }
Execution Count:1
1
4004QGraphicsObject::QGraphicsObject(QGraphicsItem *parent) -
4005 : QGraphicsItem(parent) -
4006{ -
4007 QGraphicsItem::d_ptr->isObject = true; -
4008}
executed: }
Execution Count:62
62
4009 -
4010 -
4011 -
4012 -
4013QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent) -
4014 : QGraphicsItem(dd, parent) -
4015{ -
4016 QGraphicsItem::d_ptr->isObject = true; -
4017}
executed: }
Execution Count:1548
1548
4018 -
4019 -
4020 -
4021 -
4022QGraphicsObject::~QGraphicsObject() -
4023{ -
4024} -
4025 -
4026 -
4027 -
4028 -
4029bool QGraphicsObject::event(QEvent *ev) -
4030{ -
4031 if (ev->type() == QEvent::StyleAnimationUpdate) {
partially evaluated: ev->type() == QEvent::StyleAnimationUpdate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:259
0-259
4032 update(); -
4033 return true;
never executed: return true;
0
4034 } -
4035 return QObject::event(ev);
executed: return QObject::event(ev);
Execution Count:259
259
4036} -
4037 -
4038 -
4039 -
4040 -
4041 -
4042 -
4043 -
4044void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags) -
4045{ -
4046 bool contains = QGraphicsItem::d_ptr->gestureContext.contains(gesture); -
4047 QGraphicsItem::d_ptr->gestureContext.insert(gesture, flags); -
4048 if (!contains && QGraphicsItem::d_ptr->scene)
evaluated: !contains
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:4
evaluated: QGraphicsItem::d_ptr->scene
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:31
4-52
4049 QGraphicsItem::d_ptr->scene->d_func()->grabGesture(this, gesture);
executed: QGraphicsItem::d_ptr->scene->d_func()->grabGesture(this, gesture);
Execution Count:21
21
4050}
executed: }
Execution Count:56
56
4051 -
4052 -
4053 -
4054 -
4055 -
4056 -
4057void QGraphicsObject::ungrabGesture(Qt::GestureType gesture) -
4058{ -
4059 if (QGraphicsItem::d_ptr->gestureContext.remove(gesture) && QGraphicsItem::d_ptr->scene)
never evaluated: QGraphicsItem::d_ptr->gestureContext.remove(gesture)
never evaluated: QGraphicsItem::d_ptr->scene
0
4060 QGraphicsItem::d_ptr->scene->d_func()->ungrabGesture(this, gesture);
never executed: QGraphicsItem::d_ptr->scene->d_func()->ungrabGesture(this, gesture);
0
4061}
never executed: }
0
4062void QGraphicsObject::updateMicroFocus() -
4063{ -
4064 QGraphicsItem::updateMicroFocus(); -
4065}
never executed: }
0
4066 -
4067void QGraphicsItemPrivate::children_append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item) -
4068{ -
4069 if (item) {
never evaluated: item
0
4070 QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(list->object); -
4071 if (QGraphicsItemPrivate::get(graphicsObject)->sendParentChangeNotification) {
never evaluated: QGraphicsItemPrivate::get(graphicsObject)->sendParentChangeNotification
0
4072 item->setParentItem(graphicsObject); -
4073 } else {
never executed: }
0
4074 QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, 0, 0); -
4075 }
never executed: }
0
4076 } -
4077}
never executed: }
0
4078 -
4079int QGraphicsItemPrivate::children_count(QDeclarativeListProperty<QGraphicsObject> *list) -
4080{ -
4081 QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(list->object)); -
4082 return d->children.count();
never executed: return d->children.count();
0
4083} -
4084 -
4085QGraphicsObject *QGraphicsItemPrivate::children_at(QDeclarativeListProperty<QGraphicsObject> *list, int index) -
4086{ -
4087 QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(list->object)); -
4088 if (index >= 0 && index < d->children.count())
never evaluated: index >= 0
never evaluated: index < d->children.count()
0
4089 return d->children.at(index)->toGraphicsObject();
never executed: return d->children.at(index)->toGraphicsObject();
0
4090 else -
4091 return 0;
never executed: return 0;
0
4092} -
4093 -
4094void QGraphicsItemPrivate::children_clear(QDeclarativeListProperty<QGraphicsObject> *list) -
4095{ -
4096 QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(list->object)); -
4097 int childCount = d->children.count(); -
4098 if (d->sendParentChangeNotification) {
never evaluated: d->sendParentChangeNotification
0
4099 for (int index = 0; index < childCount; index++)
never evaluated: index < childCount
0
4100 d->children.at(0)->setParentItem(0);
never executed: d->children.at(0)->setParentItem(0);
0
4101 } else {
never executed: }
0
4102 for (int index = 0; index < childCount; index++)
never evaluated: index < childCount
0
4103 QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, 0, 0);
never executed: QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, 0, 0);
0
4104 }
never executed: }
0
4105} -
4106QDeclarativeListProperty<QGraphicsObject> QGraphicsItemPrivate::childrenList() -
4107{ -
4108 QGraphicsItem * const q = q_func(); -
4109 if (isObject) {
never evaluated: isObject
0
4110 QGraphicsObject *that = static_cast<QGraphicsObject *>(q); -
4111 return QDeclarativeListProperty<QGraphicsObject>(that, &children, children_append, 0
4112 children_count, children_at, children_clear);
never executed: return QDeclarativeListProperty<QGraphicsObject>(that, &children, children_append, children_count, children_at, children_clear);
0
4113 } else { -
4114 -
4115 return QDeclarativeListProperty<QGraphicsObject>();
never executed: return QDeclarativeListProperty<QGraphicsObject>();
0
4116 } -
4117} -
4118 -
4119 -
4120 -
4121 -
4122 -
4123 -
4124qreal QGraphicsItemPrivate::width() const -
4125{ -
4126 return 0;
never executed: return 0;
0
4127} -
4128 -
4129 -
4130 -
4131 -
4132 -
4133 -
4134void QGraphicsItemPrivate::setWidth(qreal w) -
4135{ -
4136 (void)w;; -
4137}
never executed: }
0
4138 -
4139 -
4140 -
4141 -
4142 -
4143 -
4144void QGraphicsItemPrivate::resetWidth() -
4145{ -
4146} -
4147 -
4148 -
4149 -
4150 -
4151 -
4152 -
4153qreal QGraphicsItemPrivate::height() const -
4154{ -
4155 return 0;
never executed: return 0;
0
4156} -
4157 -
4158 -
4159 -
4160 -
4161 -
4162 -
4163void QGraphicsItemPrivate::setHeight(qreal h) -
4164{ -
4165 (void)h;; -
4166}
never executed: }
0
4167 -
4168 -
4169 -
4170 -
4171 -
4172 -
4173void QGraphicsItemPrivate::resetHeight() -
4174{ -
4175} -
4176class QAbstractGraphicsShapeItemPrivate : public QGraphicsItemPrivate -
4177{ -
4178 inline QAbstractGraphicsShapeItem* q_func() { return static_cast<QAbstractGraphicsShapeItem *>(q_ptr); } inline const QAbstractGraphicsShapeItem* q_func() const { return static_cast<const QAbstractGraphicsShapeItem *>(q_ptr); } friend class QAbstractGraphicsShapeItem; -
4179public: -
4180 -
4181 QBrush brush; -
4182 QPen pen; -
4183 -
4184 -
4185 mutable QRectF boundingRect; -
4186}; -
4187 -
4188 -
4189 -
4190 -
4191 -
4192QAbstractGraphicsShapeItem::QAbstractGraphicsShapeItem(QGraphicsItem *parent) -
4193 : QGraphicsItem(*new QAbstractGraphicsShapeItemPrivate, parent) -
4194{ -
4195}
never executed: }
0
4196 -
4197 -
4198 -
4199 -
4200QAbstractGraphicsShapeItem::QAbstractGraphicsShapeItem(QAbstractGraphicsShapeItemPrivate &dd, QGraphicsItem *parent) -
4201 : QGraphicsItem(dd, parent) -
4202{ -
4203}
executed: }
Execution Count:618
618
4204 -
4205 -
4206 -
4207 -
4208QAbstractGraphicsShapeItem::~QAbstractGraphicsShapeItem() -
4209{ -
4210} -
4211 -
4212 -
4213 -
4214 -
4215 -
4216QPen QAbstractGraphicsShapeItem::pen() const -
4217{ -
4218 const QAbstractGraphicsShapeItemPrivate * const d = d_func(); -
4219 return d->pen;
executed: return d->pen;
Execution Count:600
600
4220} -
4221void QAbstractGraphicsShapeItem::setPen(const QPen &pen) -
4222{ -
4223 QAbstractGraphicsShapeItemPrivate * const d = d_func(); -
4224 if (d->pen == pen)
evaluated: d->pen == pen
TRUEFALSE
yes
Evaluation Count:114
yes
Evaluation Count:445
114-445
4225 return;
executed: return;
Execution Count:114
114
4226 prepareGeometryChange(); -
4227 d->pen = pen; -
4228 d->boundingRect = QRectF(); -
4229 update(); -
4230}
executed: }
Execution Count:445
445
4231 -
4232 -
4233 -
4234 -
4235 -
4236 -
4237QBrush QAbstractGraphicsShapeItem::brush() const -
4238{ -
4239 const QAbstractGraphicsShapeItemPrivate * const d = d_func(); -
4240 return d->brush;
never executed: return d->brush;
0
4241} -
4242void QAbstractGraphicsShapeItem::setBrush(const QBrush &brush) -
4243{ -
4244 QAbstractGraphicsShapeItemPrivate * const d = d_func(); -
4245 if (d->brush == brush)
evaluated: d->brush == brush
TRUEFALSE
yes
Evaluation Count:104
yes
Evaluation Count:421
104-421
4246 return;
executed: return;
Execution Count:104
104
4247 d->brush = brush; -
4248 update(); -
4249}
executed: }
Execution Count:421
421
4250 -
4251 -
4252 -
4253 -
4254bool QAbstractGraphicsShapeItem::isObscuredBy(const QGraphicsItem *item) const -
4255{ -
4256 return QGraphicsItem::isObscuredBy(item);
executed: return QGraphicsItem::isObscuredBy(item);
Execution Count:2
2
4257} -
4258 -
4259 -
4260 -
4261 -
4262QPainterPath QAbstractGraphicsShapeItem::opaqueArea() const -
4263{ -
4264 const QAbstractGraphicsShapeItemPrivate * const d = d_func(); -
4265 if (d->brush.isOpaque())
partially evaluated: d->brush.isOpaque()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
4266 return isClipped() ? clipPath() : shape();
never executed: return isClipped() ? clipPath() : shape();
0
4267 return QGraphicsItem::opaqueArea();
executed: return QGraphicsItem::opaqueArea();
Execution Count:2
2
4268} -
4269class QGraphicsPathItemPrivate : public QAbstractGraphicsShapeItemPrivate -
4270{ -
4271 inline QGraphicsPathItem* q_func() { return static_cast<QGraphicsPathItem *>(q_ptr); } inline const QGraphicsPathItem* q_func() const { return static_cast<const QGraphicsPathItem *>(q_ptr); } friend class QGraphicsPathItem; -
4272public: -
4273 QPainterPath path; -
4274}; -
4275 -
4276 -
4277 -
4278 -
4279 -
4280 -
4281 -
4282QGraphicsPathItem::QGraphicsPathItem(const QPainterPath &path, -
4283 QGraphicsItem *parent) -
4284 : QAbstractGraphicsShapeItem(*new QGraphicsPathItemPrivate, parent) -
4285{ -
4286 if (!path.isEmpty())
never evaluated: !path.isEmpty()
0
4287 setPath(path);
never executed: setPath(path);
0
4288}
never executed: }
0
4289 -
4290 -
4291 -
4292 -
4293 -
4294 -
4295 -
4296QGraphicsPathItem::QGraphicsPathItem(QGraphicsItem *parent) -
4297 : QAbstractGraphicsShapeItem(*new QGraphicsPathItemPrivate, parent) -
4298{ -
4299}
never executed: }
0
4300 -
4301 -
4302 -
4303 -
4304QGraphicsPathItem::~QGraphicsPathItem() -
4305{ -
4306} -
4307 -
4308 -
4309 -
4310 -
4311 -
4312 -
4313 -
4314QPainterPath QGraphicsPathItem::path() const -
4315{ -
4316 const QGraphicsPathItemPrivate * const d = d_func(); -
4317 return d->path;
never executed: return d->path;
0
4318} -
4319 -
4320 -
4321 -
4322 -
4323 -
4324 -
4325void QGraphicsPathItem::setPath(const QPainterPath &path) -
4326{ -
4327 QGraphicsPathItemPrivate * const d = d_func(); -
4328 if (d->path == path)
never evaluated: d->path == path
0
4329 return;
never executed: return;
0
4330 prepareGeometryChange(); -
4331 d->path = path; -
4332 d->boundingRect = QRectF(); -
4333 update(); -
4334}
never executed: }
0
4335 -
4336 -
4337 -
4338 -
4339QRectF QGraphicsPathItem::boundingRect() const -
4340{ -
4341 const QGraphicsPathItemPrivate * const d = d_func(); -
4342 if (d->boundingRect.isNull()) {
never evaluated: d->boundingRect.isNull()
0
4343 qreal pw = pen().style() == Qt::NoPen ? qreal(0) : pen().widthF();
never evaluated: pen().style() == Qt::NoPen
0
4344 if (pw == 0.0)
never evaluated: pw == 0.0
0
4345 d->boundingRect = d->path.controlPointRect();
never executed: d->boundingRect = d->path.controlPointRect();
0
4346 else { -
4347 d->boundingRect = shape().controlPointRect(); -
4348 }
never executed: }
0
4349 } -
4350 return d->boundingRect;
never executed: return d->boundingRect;
0
4351} -
4352 -
4353 -
4354 -
4355 -
4356QPainterPath QGraphicsPathItem::shape() const -
4357{ -
4358 const QGraphicsPathItemPrivate * const d = d_func(); -
4359 return qt_graphicsItem_shapeFromPath(d->path, d->pen);
never executed: return qt_graphicsItem_shapeFromPath(d->path, d->pen);
0
4360} -
4361 -
4362 -
4363 -
4364 -
4365bool QGraphicsPathItem::contains(const QPointF &point) const -
4366{ -
4367 return QAbstractGraphicsShapeItem::contains(point);
never executed: return QAbstractGraphicsShapeItem::contains(point);
0
4368} -
4369 -
4370 -
4371 -
4372 -
4373void QGraphicsPathItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, -
4374 QWidget *widget) -
4375{ -
4376 QGraphicsPathItemPrivate * const d = d_func(); -
4377 (void)widget;; -
4378 painter->setPen(d->pen); -
4379 painter->setBrush(d->brush); -
4380 painter->drawPath(d->path); -
4381 -
4382 if (option->state & QStyle::State_Selected)
never evaluated: option->state & QStyle::State_Selected
0
4383 qt_graphicsItem_highlightSelected(this, painter, option);
never executed: qt_graphicsItem_highlightSelected(this, painter, option);
0
4384}
never executed: }
0
4385 -
4386 -
4387 -
4388 -
4389bool QGraphicsPathItem::isObscuredBy(const QGraphicsItem *item) const -
4390{ -
4391 return QAbstractGraphicsShapeItem::isObscuredBy(item);
never executed: return QAbstractGraphicsShapeItem::isObscuredBy(item);
0
4392} -
4393 -
4394 -
4395 -
4396 -
4397QPainterPath QGraphicsPathItem::opaqueArea() const -
4398{ -
4399 return QAbstractGraphicsShapeItem::opaqueArea();
never executed: return QAbstractGraphicsShapeItem::opaqueArea();
0
4400} -
4401 -
4402 -
4403 -
4404 -
4405int QGraphicsPathItem::type() const -
4406{ -
4407 return Type;
never executed: return Type;
0
4408} -
4409 -
4410 -
4411 -
4412 -
4413bool QGraphicsPathItem::supportsExtension(Extension extension) const -
4414{ -
4415 (void)extension;; -
4416 return false;
never executed: return false;
0
4417} -
4418 -
4419 -
4420 -
4421 -
4422void QGraphicsPathItem::setExtension(Extension extension, const QVariant &variant) -
4423{ -
4424 (void)extension;; -
4425 (void)variant;; -
4426}
never executed: }
0
4427 -
4428 -
4429 -
4430 -
4431QVariant QGraphicsPathItem::extension(const QVariant &variant) const -
4432{ -
4433 (void)variant;; -
4434 return QVariant();
never executed: return QVariant();
0
4435} -
4436class QGraphicsRectItemPrivate : public QAbstractGraphicsShapeItemPrivate -
4437{ -
4438 inline QGraphicsRectItem* q_func() { return static_cast<QGraphicsRectItem *>(q_ptr); } inline const QGraphicsRectItem* q_func() const { return static_cast<const QGraphicsRectItem *>(q_ptr); } friend class QGraphicsRectItem; -
4439public: -
4440 QRectF rect; -
4441}; -
4442 -
4443 -
4444 -
4445 -
4446 -
4447 -
4448 -
4449QGraphicsRectItem::QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent) -
4450 : QAbstractGraphicsShapeItem(*new QGraphicsRectItemPrivate, parent) -
4451{ -
4452 setRect(rect); -
4453}
executed: }
Execution Count:552
552
4454QGraphicsRectItem::QGraphicsRectItem(qreal x, qreal y, qreal w, qreal h, -
4455 QGraphicsItem *parent) -
4456 : QAbstractGraphicsShapeItem(*new QGraphicsRectItemPrivate, parent) -
4457{ -
4458 setRect(QRectF(x, y, w, h)); -
4459}
executed: }
Execution Count:22
22
4460 -
4461 -
4462 -
4463 -
4464 -
4465 -
4466 -
4467QGraphicsRectItem::QGraphicsRectItem(QGraphicsItem *parent) -
4468 : QAbstractGraphicsShapeItem(*new QGraphicsRectItemPrivate, parent) -
4469{ -
4470}
executed: }
Execution Count:12
12
4471 -
4472 -
4473 -
4474 -
4475QGraphicsRectItem::~QGraphicsRectItem() -
4476{ -
4477} -
4478 -
4479 -
4480 -
4481 -
4482 -
4483 -
4484QRectF QGraphicsRectItem::rect() const -
4485{ -
4486 const QGraphicsRectItemPrivate * const d = d_func(); -
4487 return d->rect;
executed: return d->rect;
Execution Count:41
41
4488} -
4489void QGraphicsRectItem::setRect(const QRectF &rect) -
4490{ -
4491 QGraphicsRectItemPrivate * const d = d_func(); -
4492 if (d->rect == rect)
evaluated: d->rect == rect
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:659
3-659
4493 return;
executed: return;
Execution Count:3
3
4494 prepareGeometryChange(); -
4495 d->rect = rect; -
4496 d->boundingRect = QRectF(); -
4497 update(); -
4498}
executed: }
Execution Count:659
659
4499QRectF QGraphicsRectItem::boundingRect() const -
4500{ -
4501 const QGraphicsRectItemPrivate * const d = d_func(); -
4502 if (d->boundingRect.isNull()) {
evaluated: d->boundingRect.isNull()
TRUEFALSE
yes
Evaluation Count:282
yes
Evaluation Count:1651
282-1651
4503 qreal halfpw = pen().style() == Qt::NoPen ? qreal(0) : pen().widthF() / 2;
evaluated: pen().style() == Qt::NoPen
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:277
5-277
4504 d->boundingRect = d->rect; -
4505 if (halfpw > 0.0)
evaluated: halfpw > 0.0
TRUEFALSE
yes
Evaluation Count:227
yes
Evaluation Count:55
55-227
4506 d->boundingRect.adjust(-halfpw, -halfpw, halfpw, halfpw);
executed: d->boundingRect.adjust(-halfpw, -halfpw, halfpw, halfpw);
Execution Count:227
227
4507 }
executed: }
Execution Count:282
282
4508 return d->boundingRect;
executed: return d->boundingRect;
Execution Count:1933
1933
4509} -
4510 -
4511 -
4512 -
4513 -
4514QPainterPath QGraphicsRectItem::shape() const -
4515{ -
4516 const QGraphicsRectItemPrivate * const d = d_func(); -
4517 QPainterPath path; -
4518 path.addRect(d->rect); -
4519 return qt_graphicsItem_shapeFromPath(path, d->pen);
executed: return qt_graphicsItem_shapeFromPath(path, d->pen);
Execution Count:143
143
4520} -
4521 -
4522 -
4523 -
4524 -
4525bool QGraphicsRectItem::contains(const QPointF &point) const -
4526{ -
4527 return QAbstractGraphicsShapeItem::contains(point);
never executed: return QAbstractGraphicsShapeItem::contains(point);
0
4528} -
4529 -
4530 -
4531 -
4532 -
4533void QGraphicsRectItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, -
4534 QWidget *widget) -
4535{ -
4536 QGraphicsRectItemPrivate * const d = d_func(); -
4537 (void)widget;; -
4538 painter->setPen(d->pen); -
4539 painter->setBrush(d->brush); -
4540 painter->drawRect(d->rect); -
4541 -
4542 if (option->state & QStyle::State_Selected)
evaluated: option->state & QStyle::State_Selected
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:343
1-343
4543 qt_graphicsItem_highlightSelected(this, painter, option);
executed: qt_graphicsItem_highlightSelected(this, painter, option);
Execution Count:1
1
4544}
executed: }
Execution Count:344
344
4545 -
4546 -
4547 -
4548 -
4549bool QGraphicsRectItem::isObscuredBy(const QGraphicsItem *item) const -
4550{ -
4551 return QAbstractGraphicsShapeItem::isObscuredBy(item);
never executed: return QAbstractGraphicsShapeItem::isObscuredBy(item);
0
4552} -
4553 -
4554 -
4555 -
4556 -
4557QPainterPath QGraphicsRectItem::opaqueArea() const -
4558{ -
4559 return QAbstractGraphicsShapeItem::opaqueArea();
never executed: return QAbstractGraphicsShapeItem::opaqueArea();
0
4560} -
4561 -
4562 -
4563 -
4564 -
4565int QGraphicsRectItem::type() const -
4566{ -
4567 return Type;
executed: return Type;
Execution Count:5
5
4568} -
4569 -
4570 -
4571 -
4572 -
4573bool QGraphicsRectItem::supportsExtension(Extension extension) const -
4574{ -
4575 (void)extension;; -
4576 return false;
never executed: return false;
0
4577} -
4578 -
4579 -
4580 -
4581 -
4582void QGraphicsRectItem::setExtension(Extension extension, const QVariant &variant) -
4583{ -
4584 (void)extension;; -
4585 (void)variant;; -
4586}
never executed: }
0
4587 -
4588 -
4589 -
4590 -
4591QVariant QGraphicsRectItem::extension(const QVariant &variant) const -
4592{ -
4593 (void)variant;; -
4594 return QVariant();
never executed: return QVariant();
0
4595} -
4596class QGraphicsEllipseItemPrivate : public QAbstractGraphicsShapeItemPrivate -
4597{ -
4598 inline QGraphicsEllipseItem* q_func() { return static_cast<QGraphicsEllipseItem *>(q_ptr); } inline const QGraphicsEllipseItem* q_func() const { return static_cast<const QGraphicsEllipseItem *>(q_ptr); } friend class QGraphicsEllipseItem; -
4599public: -
4600 inline QGraphicsEllipseItemPrivate() -
4601 : startAngle(0), spanAngle(360 * 16) -
4602 { }
executed: }
Execution Count:17
17
4603 -
4604 QRectF rect; -
4605 int startAngle; -
4606 int spanAngle; -
4607}; -
4608 -
4609 -
4610 -
4611 -
4612 -
4613 -
4614 -
4615QGraphicsEllipseItem::QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent) -
4616 : QAbstractGraphicsShapeItem(*new QGraphicsEllipseItemPrivate, parent) -
4617{ -
4618 setRect(rect); -
4619}
executed: }
Execution Count:17
17
4620QGraphicsEllipseItem::QGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h, -
4621 QGraphicsItem *parent) -
4622 : QAbstractGraphicsShapeItem(*new QGraphicsEllipseItemPrivate, parent) -
4623{ -
4624 setRect(x,y,w,h); -
4625}
never executed: }
0
4626QGraphicsEllipseItem::QGraphicsEllipseItem(QGraphicsItem *parent) -
4627 : QAbstractGraphicsShapeItem(*new QGraphicsEllipseItemPrivate, parent) -
4628{ -
4629}
never executed: }
0
4630 -
4631 -
4632 -
4633 -
4634QGraphicsEllipseItem::~QGraphicsEllipseItem() -
4635{ -
4636} -
4637 -
4638 -
4639 -
4640 -
4641 -
4642 -
4643QRectF QGraphicsEllipseItem::rect() const -
4644{ -
4645 const QGraphicsEllipseItemPrivate * const d = d_func(); -
4646 return d->rect;
never executed: return d->rect;
0
4647} -
4648void QGraphicsEllipseItem::setRect(const QRectF &rect) -
4649{ -
4650 QGraphicsEllipseItemPrivate * const d = d_func(); -
4651 if (d->rect == rect)
partially evaluated: d->rect == rect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
4652 return;
never executed: return;
0
4653 prepareGeometryChange(); -
4654 d->rect = rect; -
4655 d->boundingRect = QRectF(); -
4656 update(); -
4657}
executed: }
Execution Count:17
17
4658int QGraphicsEllipseItem::startAngle() const -
4659{ -
4660 const QGraphicsEllipseItemPrivate * const d = d_func(); -
4661 return d->startAngle;
never executed: return d->startAngle;
0
4662} -
4663void QGraphicsEllipseItem::setStartAngle(int angle) -
4664{ -
4665 QGraphicsEllipseItemPrivate * const d = d_func(); -
4666 if (angle != d->startAngle) {
never evaluated: angle != d->startAngle
0
4667 prepareGeometryChange(); -
4668 d->boundingRect = QRectF(); -
4669 d->startAngle = angle; -
4670 update(); -
4671 }
never executed: }
0
4672}
never executed: }
0
4673int QGraphicsEllipseItem::spanAngle() const -
4674{ -
4675 const QGraphicsEllipseItemPrivate * const d = d_func(); -
4676 return d->spanAngle;
never executed: return d->spanAngle;
0
4677} -
4678void QGraphicsEllipseItem::setSpanAngle(int angle) -
4679{ -
4680 QGraphicsEllipseItemPrivate * const d = d_func(); -
4681 if (angle != d->spanAngle) {
never evaluated: angle != d->spanAngle
0
4682 prepareGeometryChange(); -
4683 d->boundingRect = QRectF(); -
4684 d->spanAngle = angle; -
4685 update(); -
4686 }
never executed: }
0
4687}
never executed: }
0
4688 -
4689 -
4690 -
4691 -
4692QRectF QGraphicsEllipseItem::boundingRect() const -
4693{ -
4694 const QGraphicsEllipseItemPrivate * const d = d_func(); -
4695 if (d->boundingRect.isNull()) {
evaluated: d->boundingRect.isNull()
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:3984
17-3984
4696 qreal pw = pen().style() == Qt::NoPen ? qreal(0) : pen().widthF();
partially evaluated: pen().style() == Qt::NoPen
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
4697 if (pw == 0.0 && d->spanAngle == 360 * 16)
partially evaluated: pw == 0.0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
never evaluated: d->spanAngle == 360 * 16
0-17
4698 d->boundingRect = d->rect;
never executed: d->boundingRect = d->rect;
0
4699 else -
4700 d->boundingRect = shape().controlPointRect();
executed: d->boundingRect = shape().controlPointRect();
Execution Count:17
17
4701 } -
4702 return d->boundingRect;
executed: return d->boundingRect;
Execution Count:4001
4001
4703} -
4704 -
4705 -
4706 -
4707 -
4708QPainterPath QGraphicsEllipseItem::shape() const -
4709{ -
4710 const QGraphicsEllipseItemPrivate * const d = d_func(); -
4711 QPainterPath path; -
4712 if (d->rect.isNull())
partially evaluated: d->rect.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:43
0-43
4713 return path;
never executed: return path;
0
4714 if (d->spanAngle != 360 * 16) {
partially evaluated: d->spanAngle != 360 * 16
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:43
0-43
4715 path.moveTo(d->rect.center()); -
4716 path.arcTo(d->rect, d->startAngle / 16.0, d->spanAngle / 16.0); -
4717 } else {
never executed: }
0
4718 path.addEllipse(d->rect); -
4719 }
executed: }
Execution Count:43
43
4720 -
4721 return qt_graphicsItem_shapeFromPath(path, d->pen);
executed: return qt_graphicsItem_shapeFromPath(path, d->pen);
Execution Count:43
43
4722} -
4723 -
4724 -
4725 -
4726 -
4727bool QGraphicsEllipseItem::contains(const QPointF &point) const -
4728{ -
4729 return QAbstractGraphicsShapeItem::contains(point);
never executed: return QAbstractGraphicsShapeItem::contains(point);
0
4730} -
4731 -
4732 -
4733 -
4734 -
4735void QGraphicsEllipseItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, -
4736 QWidget *widget) -
4737{ -
4738 QGraphicsEllipseItemPrivate * const d = d_func(); -
4739 (void)widget;; -
4740 painter->setPen(d->pen); -
4741 painter->setBrush(d->brush); -
4742 if ((d->spanAngle != 0) && (qAbs(d->spanAngle) % (360 * 16) == 0))
partially evaluated: (d->spanAngle != 0)
TRUEFALSE
yes
Evaluation Count:1037
no
Evaluation Count:0
partially evaluated: (qAbs(d->spanAngle) % (360 * 16) == 0)
TRUEFALSE
yes
Evaluation Count:1037
no
Evaluation Count:0
0-1037
4743 painter->drawEllipse(d->rect);
executed: painter->drawEllipse(d->rect);
Execution Count:1037
1037
4744 else -
4745 painter->drawPie(d->rect, d->startAngle, d->spanAngle);
never executed: painter->drawPie(d->rect, d->startAngle, d->spanAngle);
0
4746 -
4747 if (option->state & QStyle::State_Selected)
partially evaluated: option->state & QStyle::State_Selected
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1037
0-1037
4748 qt_graphicsItem_highlightSelected(this, painter, option);
never executed: qt_graphicsItem_highlightSelected(this, painter, option);
0
4749}
executed: }
Execution Count:1037
1037
4750 -
4751 -
4752 -
4753 -
4754bool QGraphicsEllipseItem::isObscuredBy(const QGraphicsItem *item) const -
4755{ -
4756 return QAbstractGraphicsShapeItem::isObscuredBy(item);
never executed: return QAbstractGraphicsShapeItem::isObscuredBy(item);
0
4757} -
4758 -
4759 -
4760 -
4761 -
4762QPainterPath QGraphicsEllipseItem::opaqueArea() const -
4763{ -
4764 return QAbstractGraphicsShapeItem::opaqueArea();
never executed: return QAbstractGraphicsShapeItem::opaqueArea();
0
4765} -
4766 -
4767 -
4768 -
4769 -
4770int QGraphicsEllipseItem::type() const -
4771{ -
4772 return Type;
never executed: return Type;
0
4773} -
4774 -
4775 -
4776 -
4777 -
4778 -
4779bool QGraphicsEllipseItem::supportsExtension(Extension extension) const -
4780{ -
4781 (void)extension;; -
4782 return false;
never executed: return false;
0
4783} -
4784 -
4785 -
4786 -
4787 -
4788void QGraphicsEllipseItem::setExtension(Extension extension, const QVariant &variant) -
4789{ -
4790 (void)extension;; -
4791 (void)variant;; -
4792}
never executed: }
0
4793 -
4794 -
4795 -
4796 -
4797QVariant QGraphicsEllipseItem::extension(const QVariant &variant) const -
4798{ -
4799 (void)variant;; -
4800 return QVariant();
never executed: return QVariant();
0
4801} -
4802class QGraphicsPolygonItemPrivate : public QAbstractGraphicsShapeItemPrivate -
4803{ -
4804 inline QGraphicsPolygonItem* q_func() { return static_cast<QGraphicsPolygonItem *>(q_ptr); } inline const QGraphicsPolygonItem* q_func() const { return static_cast<const QGraphicsPolygonItem *>(q_ptr); } friend class QGraphicsPolygonItem; -
4805public: -
4806 inline QGraphicsPolygonItemPrivate() -
4807 : fillRule(Qt::OddEvenFill) -
4808 { }
executed: }
Execution Count:15
15
4809 -
4810 QPolygonF polygon; -
4811 Qt::FillRule fillRule; -
4812}; -
4813 -
4814 -
4815 -
4816 -
4817 -
4818 -
4819 -
4820QGraphicsPolygonItem::QGraphicsPolygonItem(const QPolygonF &polygon, QGraphicsItem *parent) -
4821 : QAbstractGraphicsShapeItem(*new QGraphicsPolygonItemPrivate, parent) -
4822{ -
4823 setPolygon(polygon); -
4824}
executed: }
Execution Count:8
8
4825 -
4826 -
4827 -
4828 -
4829 -
4830 -
4831 -
4832QGraphicsPolygonItem::QGraphicsPolygonItem(QGraphicsItem *parent) -
4833 : QAbstractGraphicsShapeItem(*new QGraphicsPolygonItemPrivate, parent) -
4834{ -
4835}
executed: }
Execution Count:7
7
4836 -
4837 -
4838 -
4839 -
4840QGraphicsPolygonItem::~QGraphicsPolygonItem() -
4841{ -
4842} -
4843 -
4844 -
4845 -
4846 -
4847 -
4848 -
4849 -
4850QPolygonF QGraphicsPolygonItem::polygon() const -
4851{ -
4852 const QGraphicsPolygonItemPrivate * const d = d_func(); -
4853 return d->polygon;
executed: return d->polygon;
Execution Count:3
3
4854} -
4855 -
4856 -
4857 -
4858 -
4859 -
4860 -
4861void QGraphicsPolygonItem::setPolygon(const QPolygonF &polygon) -
4862{ -
4863 QGraphicsPolygonItemPrivate * const d = d_func(); -
4864 if (d->polygon == polygon)
evaluated: d->polygon == polygon
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:2
2-9
4865 return;
executed: return;
Execution Count:9
9
4866 prepareGeometryChange(); -
4867 d->polygon = polygon; -
4868 d->boundingRect = QRectF(); -
4869 update(); -
4870}
executed: }
Execution Count:2
2
4871 -
4872 -
4873 -
4874 -
4875 -
4876 -
4877 -
4878Qt::FillRule QGraphicsPolygonItem::fillRule() const -
4879{ -
4880 const QGraphicsPolygonItemPrivate * const d = d_func(); -
4881 return d->fillRule;
executed: return d->fillRule;
Execution Count:3
3
4882} -
4883 -
4884 -
4885 -
4886 -
4887 -
4888 -
4889 -
4890void QGraphicsPolygonItem::setFillRule(Qt::FillRule rule) -
4891{ -
4892 QGraphicsPolygonItemPrivate * const d = d_func(); -
4893 if (rule != d->fillRule) {
evaluated: rule != d->fillRule
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-2
4894 d->fillRule = rule; -
4895 update(); -
4896 }
executed: }
Execution Count:1
1
4897}
executed: }
Execution Count:3
3
4898 -
4899 -
4900 -
4901 -
4902QRectF QGraphicsPolygonItem::boundingRect() const -
4903{ -
4904 const QGraphicsPolygonItemPrivate * const d = d_func(); -
4905 if (d->boundingRect.isNull()) {
partially evaluated: d->boundingRect.isNull()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
4906 qreal pw = pen().style() == Qt::NoPen ? qreal(0) : pen().widthF();
partially evaluated: pen().style() == Qt::NoPen
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
4907 if (pw == 0.0)
evaluated: pw == 0.0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
4908 d->boundingRect = d->polygon.boundingRect();
executed: d->boundingRect = d->polygon.boundingRect();
Execution Count:2
2
4909 else -
4910 d->boundingRect = shape().controlPointRect();
executed: d->boundingRect = shape().controlPointRect();
Execution Count:1
1
4911 } -
4912 return d->boundingRect;
executed: return d->boundingRect;
Execution Count:3
3
4913} -
4914 -
4915 -
4916 -
4917 -
4918QPainterPath QGraphicsPolygonItem::shape() const -
4919{ -
4920 const QGraphicsPolygonItemPrivate * const d = d_func(); -
4921 QPainterPath path; -
4922 path.addPolygon(d->polygon); -
4923 return qt_graphicsItem_shapeFromPath(path, d->pen);
executed: return qt_graphicsItem_shapeFromPath(path, d->pen);
Execution Count:5
5
4924} -
4925 -
4926 -
4927 -
4928 -
4929bool QGraphicsPolygonItem::contains(const QPointF &point) const -
4930{ -
4931 return QAbstractGraphicsShapeItem::contains(point);
executed: return QAbstractGraphicsShapeItem::contains(point);
Execution Count:2
2
4932} -
4933 -
4934 -
4935 -
4936 -
4937void QGraphicsPolygonItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -
4938{ -
4939 QGraphicsPolygonItemPrivate * const d = d_func(); -
4940 (void)widget;; -
4941 painter->setPen(d->pen); -
4942 painter->setBrush(d->brush); -
4943 painter->drawPolygon(d->polygon, d->fillRule); -
4944 -
4945 if (option->state & QStyle::State_Selected)
never evaluated: option->state & QStyle::State_Selected
0
4946 qt_graphicsItem_highlightSelected(this, painter, option);
never executed: qt_graphicsItem_highlightSelected(this, painter, option);
0
4947}
never executed: }
0
4948 -
4949 -
4950 -
4951 -
4952bool QGraphicsPolygonItem::isObscuredBy(const QGraphicsItem *item) const -
4953{ -
4954 return QAbstractGraphicsShapeItem::isObscuredBy(item);
executed: return QAbstractGraphicsShapeItem::isObscuredBy(item);
Execution Count:2
2
4955} -
4956 -
4957 -
4958 -
4959 -
4960QPainterPath QGraphicsPolygonItem::opaqueArea() const -
4961{ -
4962 return QAbstractGraphicsShapeItem::opaqueArea();
executed: return QAbstractGraphicsShapeItem::opaqueArea();
Execution Count:2
2
4963} -
4964 -
4965 -
4966 -
4967 -
4968int QGraphicsPolygonItem::type() const -
4969{ -
4970 return Type;
executed: return Type;
Execution Count:1
1
4971} -
4972 -
4973 -
4974 -
4975 -
4976bool QGraphicsPolygonItem::supportsExtension(Extension extension) const -
4977{ -
4978 (void)extension;; -
4979 return false;
executed: return false;
Execution Count:2
2
4980} -
4981 -
4982 -
4983 -
4984 -
4985void QGraphicsPolygonItem::setExtension(Extension extension, const QVariant &variant) -
4986{ -
4987 (void)extension;; -
4988 (void)variant;; -
4989}
executed: }
Execution Count:2
2
4990 -
4991 -
4992 -
4993 -
4994QVariant QGraphicsPolygonItem::extension(const QVariant &variant) const -
4995{ -
4996 (void)variant;; -
4997 return QVariant();
executed: return QVariant();
Execution Count:2
2
4998} -
4999class QGraphicsLineItemPrivate : public QGraphicsItemPrivate -
5000{ -
5001 inline QGraphicsLineItem* q_func() { return static_cast<QGraphicsLineItem *>(q_ptr); } inline const QGraphicsLineItem* q_func() const { return static_cast<const QGraphicsLineItem *>(q_ptr); } friend class QGraphicsLineItem; -
5002public: -
5003 QLineF line; -
5004 QPen pen; -
5005}; -
5006 -
5007 -
5008 -
5009 -
5010 -
5011 -
5012 -
5013QGraphicsLineItem::QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent) -
5014 : QGraphicsItem(*new QGraphicsLineItemPrivate, parent) -
5015{ -
5016 setLine(line); -
5017}
executed: }
Execution Count:4
4
5018QGraphicsLineItem::QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent) -
5019 : QGraphicsItem(*new QGraphicsLineItemPrivate, parent) -
5020{ -
5021 setLine(x1, y1, x2, y2); -
5022}
never executed: }
0
5023QGraphicsLineItem::QGraphicsLineItem(QGraphicsItem *parent) -
5024 : QGraphicsItem(*new QGraphicsLineItemPrivate, parent) -
5025{ -
5026}
never executed: }
0
5027 -
5028 -
5029 -
5030 -
5031QGraphicsLineItem::~QGraphicsLineItem() -
5032{ -
5033} -
5034 -
5035 -
5036 -
5037 -
5038 -
5039 -
5040 -
5041QPen QGraphicsLineItem::pen() const -
5042{ -
5043 const QGraphicsLineItemPrivate * const d = d_func(); -
5044 return d->pen;
never executed: return d->pen;
0
5045} -
5046 -
5047 -
5048 -
5049 -
5050 -
5051 -
5052 -
5053void QGraphicsLineItem::setPen(const QPen &pen) -
5054{ -
5055 QGraphicsLineItemPrivate * const d = d_func(); -
5056 if (d->pen == pen)
partially evaluated: d->pen == pen
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
5057 return;
never executed: return;
0
5058 prepareGeometryChange(); -
5059 d->pen = pen; -
5060 update(); -
5061}
executed: }
Execution Count:4
4
5062 -
5063 -
5064 -
5065 -
5066 -
5067 -
5068QLineF QGraphicsLineItem::line() const -
5069{ -
5070 const QGraphicsLineItemPrivate * const d = d_func(); -
5071 return d->line;
never executed: return d->line;
0
5072} -
5073 -
5074 -
5075 -
5076 -
5077 -
5078 -
5079void QGraphicsLineItem::setLine(const QLineF &line) -
5080{ -
5081 QGraphicsLineItemPrivate * const d = d_func(); -
5082 if (d->line == line)
partially evaluated: d->line == line
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
5083 return;
never executed: return;
0
5084 prepareGeometryChange(); -
5085 d->line = line; -
5086 update(); -
5087}
executed: }
Execution Count:4
4
5088QRectF QGraphicsLineItem::boundingRect() const -
5089{ -
5090 const QGraphicsLineItemPrivate * const d = d_func(); -
5091 if (d->pen.widthF() == 0.0) {
partially evaluated: d->pen.widthF() == 0.0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1703
0-1703
5092 const qreal x1 = d->line.p1().x(); -
5093 const qreal x2 = d->line.p2().x(); -
5094 const qreal y1 = d->line.p1().y(); -
5095 const qreal y2 = d->line.p2().y(); -
5096 qreal lx = qMin(x1, x2); -
5097 qreal rx = qMax(x1, x2); -
5098 qreal ty = qMin(y1, y2); -
5099 qreal by = qMax(y1, y2); -
5100 return QRectF(lx, ty, rx - lx, by - ty);
never executed: return QRectF(lx, ty, rx - lx, by - ty);
0
5101 } -
5102 return shape().controlPointRect();
executed: return shape().controlPointRect();
Execution Count:1703
1703
5103} -
5104 -
5105 -
5106 -
5107 -
5108QPainterPath QGraphicsLineItem::shape() const -
5109{ -
5110 const QGraphicsLineItemPrivate * const d = d_func(); -
5111 QPainterPath path; -
5112 if (d->line == QLineF())
partially evaluated: d->line == QLineF()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1703
0-1703
5113 return path;
never executed: return path;
0
5114 -
5115 path.moveTo(d->line.p1()); -
5116 path.lineTo(d->line.p2()); -
5117 return qt_graphicsItem_shapeFromPath(path, d->pen);
executed: return qt_graphicsItem_shapeFromPath(path, d->pen);
Execution Count:1703
1703
5118} -
5119 -
5120 -
5121 -
5122 -
5123bool QGraphicsLineItem::contains(const QPointF &point) const -
5124{ -
5125 return QGraphicsItem::contains(point);
never executed: return QGraphicsItem::contains(point);
0
5126} -
5127 -
5128 -
5129 -
5130 -
5131void QGraphicsLineItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -
5132{ -
5133 QGraphicsLineItemPrivate * const d = d_func(); -
5134 (void)widget;; -
5135 painter->setPen(d->pen); -
5136 painter->drawLine(d->line); -
5137 -
5138 if (option->state & QStyle::State_Selected)
partially evaluated: option->state & QStyle::State_Selected
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:764
0-764
5139 qt_graphicsItem_highlightSelected(this, painter, option);
never executed: qt_graphicsItem_highlightSelected(this, painter, option);
0
5140}
executed: }
Execution Count:764
764
5141 -
5142 -
5143 -
5144 -
5145bool QGraphicsLineItem::isObscuredBy(const QGraphicsItem *item) const -
5146{ -
5147 return QGraphicsItem::isObscuredBy(item);
never executed: return QGraphicsItem::isObscuredBy(item);
0
5148} -
5149 -
5150 -
5151 -
5152 -
5153QPainterPath QGraphicsLineItem::opaqueArea() const -
5154{ -
5155 return QGraphicsItem::opaqueArea();
never executed: return QGraphicsItem::opaqueArea();
0
5156} -
5157 -
5158 -
5159 -
5160 -
5161int QGraphicsLineItem::type() const -
5162{ -
5163 return Type;
never executed: return Type;
0
5164} -
5165 -
5166 -
5167 -
5168 -
5169bool QGraphicsLineItem::supportsExtension(Extension extension) const -
5170{ -
5171 (void)extension;; -
5172 return false;
never executed: return false;
0
5173} -
5174 -
5175 -
5176 -
5177 -
5178void QGraphicsLineItem::setExtension(Extension extension, const QVariant &variant) -
5179{ -
5180 (void)extension;; -
5181 (void)variant;; -
5182}
never executed: }
0
5183 -
5184 -
5185 -
5186 -
5187QVariant QGraphicsLineItem::extension(const QVariant &variant) const -
5188{ -
5189 (void)variant;; -
5190 return QVariant();
never executed: return QVariant();
0
5191} -
5192extern QPainterPath qt_regionToPath(const QRegion &region); -
5193 -
5194class QGraphicsPixmapItemPrivate : public QGraphicsItemPrivate -
5195{ -
5196 inline QGraphicsPixmapItem* q_func() { return static_cast<QGraphicsPixmapItem *>(q_ptr); } inline const QGraphicsPixmapItem* q_func() const { return static_cast<const QGraphicsPixmapItem *>(q_ptr); } friend class QGraphicsPixmapItem; -
5197public: -
5198 QGraphicsPixmapItemPrivate() -
5199 : transformationMode(Qt::FastTransformation), -
5200 shapeMode(QGraphicsPixmapItem::MaskShape), -
5201 hasShape(false) -
5202 {}
executed: }
Execution Count:45
45
5203 -
5204 QPixmap pixmap; -
5205 Qt::TransformationMode transformationMode; -
5206 QPointF offset; -
5207 QGraphicsPixmapItem::ShapeMode shapeMode; -
5208 QPainterPath shape; -
5209 bool hasShape; -
5210 -
5211 void updateShape() -
5212 { -
5213 shape = QPainterPath(); -
5214 switch (shapeMode) { -
5215 case QGraphicsPixmapItem::MaskShape: { -
5216 QBitmap mask = pixmap.mask(); -
5217 if (!mask.isNull()) {
partially evaluated: !mask.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
5218 shape = qt_regionToPath(QRegion(mask).translated(offset.toPoint())); -
5219 break;
never executed: break;
0
5220 } -
5221 -
5222 } -
5223 case QGraphicsPixmapItem::BoundingRectShape:
code before this statement executed: case QGraphicsPixmapItem::BoundingRectShape:
Execution Count:15
15
5224 shape.addRect(QRectF(offset.x(), offset.y(), pixmap.width(), pixmap.height())); -
5225 break;
executed: break;
Execution Count:15
15
5226 case QGraphicsPixmapItem::HeuristicMaskShape: -
5227 -
5228 shape = qt_regionToPath(QRegion(pixmap.createHeuristicMask()).translated(offset.toPoint())); -
5229 -
5230 -
5231 -
5232 break;
never executed: break;
0
5233 } -
5234 }
executed: }
Execution Count:15
15
5235}; -
5236 -
5237 -
5238 -
5239 -
5240 -
5241 -
5242 -
5243QGraphicsPixmapItem::QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent) -
5244 : QGraphicsItem(*new QGraphicsPixmapItemPrivate, parent) -
5245{ -
5246 setPixmap(pixmap); -
5247}
executed: }
Execution Count:37
37
5248 -
5249 -
5250 -
5251 -
5252 -
5253 -
5254 -
5255QGraphicsPixmapItem::QGraphicsPixmapItem(QGraphicsItem *parent) -
5256 : QGraphicsItem(*new QGraphicsPixmapItemPrivate, parent) -
5257{ -
5258}
executed: }
Execution Count:8
8
5259 -
5260 -
5261 -
5262 -
5263QGraphicsPixmapItem::~QGraphicsPixmapItem() -
5264{ -
5265} -
5266 -
5267 -
5268 -
5269 -
5270 -
5271 -
5272void QGraphicsPixmapItem::setPixmap(const QPixmap &pixmap) -
5273{ -
5274 QGraphicsPixmapItemPrivate * const d = d_func(); -
5275 prepareGeometryChange(); -
5276 d->pixmap = pixmap; -
5277 d->hasShape = false; -
5278 update(); -
5279}
executed: }
Execution Count:40
40
5280 -
5281 -
5282 -
5283 -
5284 -
5285 -
5286 -
5287QPixmap QGraphicsPixmapItem::pixmap() const -
5288{ -
5289 const QGraphicsPixmapItemPrivate * const d = d_func(); -
5290 return d->pixmap;
executed: return d->pixmap;
Execution Count:10
10
5291} -
5292Qt::TransformationMode QGraphicsPixmapItem::transformationMode() const -
5293{ -
5294 const QGraphicsPixmapItemPrivate * const d = d_func(); -
5295 return d->transformationMode;
executed: return d->transformationMode;
Execution Count:3
3
5296} -
5297void QGraphicsPixmapItem::setTransformationMode(Qt::TransformationMode mode) -
5298{ -
5299 QGraphicsPixmapItemPrivate * const d = d_func(); -
5300 if (mode != d->transformationMode) {
evaluated: mode != d->transformationMode
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-2
5301 d->transformationMode = mode; -
5302 update(); -
5303 }
executed: }
Execution Count:1
1
5304}
executed: }
Execution Count:3
3
5305 -
5306 -
5307 -
5308 -
5309 -
5310 -
5311 -
5312QPointF QGraphicsPixmapItem::offset() const -
5313{ -
5314 const QGraphicsPixmapItemPrivate * const d = d_func(); -
5315 return d->offset;
executed: return d->offset;
Execution Count:4
4
5316} -
5317 -
5318 -
5319 -
5320 -
5321 -
5322 -
5323 -
5324void QGraphicsPixmapItem::setOffset(const QPointF &offset) -
5325{ -
5326 QGraphicsPixmapItemPrivate * const d = d_func(); -
5327 if (d->offset == offset)
evaluated: d->offset == offset
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:11
5-11
5328 return;
executed: return;
Execution Count:5
5
5329 prepareGeometryChange(); -
5330 d->offset = offset; -
5331 d->hasShape = false; -
5332 update(); -
5333}
executed: }
Execution Count:11
11
5334QRectF QGraphicsPixmapItem::boundingRect() const -
5335{ -
5336 const QGraphicsPixmapItemPrivate * const d = d_func(); -
5337 if (d->pixmap.isNull())
evaluated: d->pixmap.isNull()
TRUEFALSE
yes
Evaluation Count:73
yes
Evaluation Count:76
73-76
5338 return QRectF();
executed: return QRectF();
Execution Count:73
73
5339 if (d->flags & ItemIsSelectable) {
partially evaluated: d->flags & ItemIsSelectable
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:76
0-76
5340 qreal pw = 1.0; -
5341 return QRectF(d->offset, d->pixmap.size()).adjusted(-pw/2, -pw/2, pw/2, pw/2);
never executed: return QRectF(d->offset, d->pixmap.size()).adjusted(-pw/2, -pw/2, pw/2, pw/2);
0
5342 } else { -
5343 return QRectF(d->offset, d->pixmap.size());
executed: return QRectF(d->offset, d->pixmap.size());
Execution Count:76
76
5344 } -
5345} -
5346 -
5347 -
5348 -
5349 -
5350QPainterPath QGraphicsPixmapItem::shape() const -
5351{ -
5352 const QGraphicsPixmapItemPrivate * const d = d_func(); -
5353 if (!d->hasShape) {
evaluated: !d->hasShape
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1
1-15
5354 QGraphicsPixmapItemPrivate *thatD = const_cast<QGraphicsPixmapItemPrivate *>(d); -
5355 thatD->updateShape(); -
5356 thatD->hasShape = true; -
5357 }
executed: }
Execution Count:15
15
5358 return d_func()->shape;
executed: return d_func()->shape;
Execution Count:16
16
5359} -
5360 -
5361 -
5362 -
5363 -
5364bool QGraphicsPixmapItem::contains(const QPointF &point) const -
5365{ -
5366 return QGraphicsItem::contains(point);
executed: return QGraphicsItem::contains(point);
Execution Count:6
6
5367} -
5368 -
5369 -
5370 -
5371 -
5372void QGraphicsPixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, -
5373 QWidget *widget) -
5374{ -
5375 QGraphicsPixmapItemPrivate * const d = d_func(); -
5376 (void)widget;; -
5377 -
5378 painter->setRenderHint(QPainter::SmoothPixmapTransform, -
5379 (d->transformationMode == Qt::SmoothTransformation)); -
5380 -
5381 painter->drawPixmap(d->offset, d->pixmap); -
5382 -
5383 if (option->state & QStyle::State_Selected)
partially evaluated: option->state & QStyle::State_Selected
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
5384 qt_graphicsItem_highlightSelected(this, painter, option);
never executed: qt_graphicsItem_highlightSelected(this, painter, option);
0
5385}
executed: }
Execution Count:19
19
5386 -
5387 -
5388 -
5389 -
5390bool QGraphicsPixmapItem::isObscuredBy(const QGraphicsItem *item) const -
5391{ -
5392 return QGraphicsItem::isObscuredBy(item);
executed: return QGraphicsItem::isObscuredBy(item);
Execution Count:7
7
5393} -
5394 -
5395 -
5396 -
5397 -
5398QPainterPath QGraphicsPixmapItem::opaqueArea() const -
5399{ -
5400 return shape();
executed: return shape();
Execution Count:8
8
5401} -
5402 -
5403 -
5404 -
5405 -
5406int QGraphicsPixmapItem::type() const -
5407{ -
5408 return Type;
executed: return Type;
Execution Count:6
6
5409} -
5410 -
5411 -
5412 -
5413 -
5414 -
5415 -
5416 -
5417QGraphicsPixmapItem::ShapeMode QGraphicsPixmapItem::shapeMode() const -
5418{ -
5419 return d_func()->shapeMode;
executed: return d_func()->shapeMode;
Execution Count:4
4
5420} -
5421 -
5422 -
5423 -
5424 -
5425 -
5426 -
5427 -
5428void QGraphicsPixmapItem::setShapeMode(ShapeMode mode) -
5429{ -
5430 QGraphicsPixmapItemPrivate * const d = d_func(); -
5431 if (d->shapeMode == mode)
evaluated: d->shapeMode == mode
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
5432 return;
executed: return;
Execution Count:2
2
5433 d->shapeMode = mode; -
5434 d->hasShape = false; -
5435}
executed: }
Execution Count:2
2
5436 -
5437 -
5438 -
5439 -
5440bool QGraphicsPixmapItem::supportsExtension(Extension extension) const -
5441{ -
5442 (void)extension;; -
5443 return false;
executed: return false;
Execution Count:2
2
5444} -
5445 -
5446 -
5447 -
5448 -
5449void QGraphicsPixmapItem::setExtension(Extension extension, const QVariant &variant) -
5450{ -
5451 (void)extension;; -
5452 (void)variant;; -
5453}
executed: }
Execution Count:2
2
5454 -
5455 -
5456 -
5457 -
5458QVariant QGraphicsPixmapItem::extension(const QVariant &variant) const -
5459{ -
5460 (void)variant;; -
5461 return QVariant();
executed: return QVariant();
Execution Count:2
2
5462} -
5463class QGraphicsTextItemPrivate -
5464{ -
5465public: -
5466 QGraphicsTextItemPrivate() -
5467 : control(0), pageNumber(0), useDefaultImpl(false), tabChangesFocus(false), clickCausedFocus(0) -
5468 { }
executed: }
Execution Count:104
104
5469 -
5470 mutable QWidgetTextControl *control; -
5471 QWidgetTextControl *textControl() const; -
5472 -
5473 inline QPointF controlOffset() const -
5474 { return QPointF(0., pageNumber * control->document()->pageSize().height()); }
executed: return QPointF(0., pageNumber * control->document()->pageSize().height());
Execution Count:638
638
5475 inline void sendControlEvent(QEvent *e) -
5476 { if (control) control->processEvent(e, controlOffset()); }
executed: control->processEvent(e, controlOffset());
Execution Count:1
executed: }
Execution Count:1
partially evaluated: control
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
5477 -
5478 void _q_updateBoundingRect(const QSizeF &); -
5479 void _q_update(QRectF); -
5480 void _q_ensureVisible(QRectF); -
5481 bool _q_mouseOnEdge(QGraphicsSceneMouseEvent *); -
5482 -
5483 QRectF boundingRect; -
5484 int pageNumber; -
5485 bool useDefaultImpl; -
5486 bool tabChangesFocus; -
5487 -
5488 uint clickCausedFocus : 1; -
5489 -
5490 QGraphicsTextItem *qq; -
5491}; -
5492QGraphicsTextItem::QGraphicsTextItem(const QString &text, QGraphicsItem *parent) -
5493 : QGraphicsObject(*new QGraphicsItemPrivate, parent), -
5494 dd(new QGraphicsTextItemPrivate) -
5495{ -
5496 dd->qq = this; -
5497 if (!text.isEmpty())
partially evaluated: !text.isEmpty()
TRUEFALSE
yes
Evaluation Count:104
no
Evaluation Count:0
0-104
5498 setPlainText(text);
executed: setPlainText(text);
Execution Count:104
104
5499 setAcceptDrops(true); -
5500 setAcceptHoverEvents(true); -
5501 setFlags(ItemUsesExtendedStyleOption); -
5502}
executed: }
Execution Count:104
104
5503 -
5504 -
5505 -
5506 -
5507 -
5508 -
5509 -
5510QGraphicsTextItem::QGraphicsTextItem(QGraphicsItem *parent) -
5511 : QGraphicsObject(*new QGraphicsItemPrivate, parent), -
5512 dd(new QGraphicsTextItemPrivate) -
5513{ -
5514 dd->qq = this; -
5515 setAcceptDrops(true); -
5516 setAcceptHoverEvents(true); -
5517 setFlag(ItemUsesExtendedStyleOption); -
5518}
never executed: }
0
5519 -
5520 -
5521 -
5522 -
5523QGraphicsTextItem::~QGraphicsTextItem() -
5524{ -
5525 delete dd; -
5526}
executed: }
Execution Count:104
104
5527 -
5528 -
5529 -
5530 -
5531 -
5532 -
5533QString QGraphicsTextItem::toHtml() const -
5534{ -
5535 -
5536 if (dd->control)
never evaluated: dd->control
0
5537 return dd->control->toHtml();
never executed: return dd->control->toHtml();
0
5538 -
5539 return QString();
never executed: return QString();
0
5540} -
5541void QGraphicsTextItem::setHtml(const QString &text) -
5542{ -
5543 dd->textControl()->setHtml(text); -
5544}
never executed: }
0
5545 -
5546 -
5547 -
5548 -
5549 -
5550 -
5551QString QGraphicsTextItem::toPlainText() const -
5552{ -
5553 if (dd->control)
never evaluated: dd->control
0
5554 return dd->control->toPlainText();
never executed: return dd->control->toPlainText();
0
5555 return QString();
never executed: return QString();
0
5556} -
5557void QGraphicsTextItem::setPlainText(const QString &text) -
5558{ -
5559 dd->textControl()->setPlainText(text); -
5560}
executed: }
Execution Count:104
104
5561 -
5562 -
5563 -
5564 -
5565 -
5566 -
5567QFont QGraphicsTextItem::font() const -
5568{ -
5569 if (!dd->control)
never evaluated: !dd->control
0
5570 return QFont();
never executed: return QFont();
0
5571 return dd->control->document()->defaultFont();
never executed: return dd->control->document()->defaultFont();
0
5572} -
5573 -
5574 -
5575 -
5576 -
5577 -
5578 -
5579void QGraphicsTextItem::setFont(const QFont &font) -
5580{ -
5581 dd->textControl()->document()->setDefaultFont(font); -
5582}
executed: }
Execution Count:103
103
5583 -
5584 -
5585 -
5586 -
5587void QGraphicsTextItem::setDefaultTextColor(const QColor &col) -
5588{ -
5589 QWidgetTextControl *c = dd->textControl(); -
5590 QPalette pal = c->palette(); -
5591 QColor old = pal.color(QPalette::Text); -
5592 pal.setColor(QPalette::Text, col); -
5593 c->setPalette(pal); -
5594 if (old != col)
never evaluated: old != col
0
5595 update();
never executed: update();
0
5596}
never executed: }
0
5597 -
5598 -
5599 -
5600 -
5601QColor QGraphicsTextItem::defaultTextColor() const -
5602{ -
5603 return dd->textControl()->palette().color(QPalette::Text);
never executed: return dd->textControl()->palette().color(QPalette::Text);
0
5604} -
5605 -
5606 -
5607 -
5608 -
5609QRectF QGraphicsTextItem::boundingRect() const -
5610{ -
5611 return dd->boundingRect;
executed: return dd->boundingRect;
Execution Count:632
632
5612} -
5613 -
5614 -
5615 -
5616 -
5617QPainterPath QGraphicsTextItem::shape() const -
5618{ -
5619 if (!dd->control)
never evaluated: !dd->control
0
5620 return QPainterPath();
never executed: return QPainterPath();
0
5621 QPainterPath path; -
5622 path.addRect(dd->boundingRect); -
5623 return path;
never executed: return path;
0
5624} -
5625 -
5626 -
5627 -
5628 -
5629bool QGraphicsTextItem::contains(const QPointF &point) const -
5630{ -
5631 return dd->boundingRect.contains(point);
never executed: return dd->boundingRect.contains(point);
0
5632} -
5633 -
5634 -
5635 -
5636 -
5637void QGraphicsTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, -
5638 QWidget *widget) -
5639{ -
5640 (void)widget;; -
5641 if (dd->control) {
partially evaluated: dd->control
TRUEFALSE
yes
Evaluation Count:163
no
Evaluation Count:0
0-163
5642 painter->save(); -
5643 QRectF r = option->exposedRect; -
5644 painter->translate(-dd->controlOffset()); -
5645 r.translate(dd->controlOffset()); -
5646 -
5647 QTextDocument *doc = dd->control->document(); -
5648 QTextDocumentLayout *layout = qobject_cast<QTextDocumentLayout *>(doc->documentLayout()); -
5649 -
5650 -
5651 -
5652 if (layout)
partially evaluated: layout
TRUEFALSE
yes
Evaluation Count:163
no
Evaluation Count:0
0-163
5653 layout->setViewport(dd->boundingRect);
executed: layout->setViewport(dd->boundingRect);
Execution Count:163
163
5654 -
5655 dd->control->drawContents(painter, r); -
5656 -
5657 if (layout)
partially evaluated: layout
TRUEFALSE
yes
Evaluation Count:163
no
Evaluation Count:0
0-163
5658 layout->setViewport(QRect());
executed: layout->setViewport(QRect());
Execution Count:163
163
5659 -
5660 painter->restore(); -
5661 }
executed: }
Execution Count:163
163
5662 -
5663 if (option->state & (QStyle::State_Selected | QStyle::State_HasFocus))
partially evaluated: option->state & (QStyle::State_Selected | QStyle::State_HasFocus)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:163
0-163
5664 qt_graphicsItem_highlightSelected(this, painter, option);
never executed: qt_graphicsItem_highlightSelected(this, painter, option);
0
5665}
executed: }
Execution Count:163
163
5666 -
5667 -
5668 -
5669 -
5670bool QGraphicsTextItem::isObscuredBy(const QGraphicsItem *item) const -
5671{ -
5672 return QGraphicsItem::isObscuredBy(item);
never executed: return QGraphicsItem::isObscuredBy(item);
0
5673} -
5674 -
5675 -
5676 -
5677 -
5678QPainterPath QGraphicsTextItem::opaqueArea() const -
5679{ -
5680 return QGraphicsItem::opaqueArea();
never executed: return QGraphicsItem::opaqueArea();
0
5681} -
5682 -
5683 -
5684 -
5685 -
5686int QGraphicsTextItem::type() const -
5687{ -
5688 return Type;
never executed: return Type;
0
5689} -
5690void QGraphicsTextItem::setTextWidth(qreal width) -
5691{ -
5692 dd->textControl()->setTextWidth(width); -
5693}
never executed: }
0
5694qreal QGraphicsTextItem::textWidth() const -
5695{ -
5696 if (!dd->control)
never evaluated: !dd->control
0
5697 return -1;
never executed: return -1;
0
5698 return dd->control->textWidth();
never executed: return dd->control->textWidth();
0
5699} -
5700 -
5701 -
5702 -
5703 -
5704void QGraphicsTextItem::adjustSize() -
5705{ -
5706 if (dd->control)
never evaluated: dd->control
0
5707 dd->control->adjustSize();
never executed: dd->control->adjustSize();
0
5708}
never executed: }
0
5709 -
5710 -
5711 -
5712 -
5713void QGraphicsTextItem::setDocument(QTextDocument *document) -
5714{ -
5715 dd->textControl()->setDocument(document); -
5716 dd->_q_updateBoundingRect(dd->control->size()); -
5717}
never executed: }
0
5718 -
5719 -
5720 -
5721 -
5722QTextDocument *QGraphicsTextItem::document() const -
5723{ -
5724 return dd->textControl()->document();
never executed: return dd->textControl()->document();
0
5725} -
5726 -
5727 -
5728 -
5729 -
5730bool QGraphicsTextItem::sceneEvent(QEvent *event) -
5731{ -
5732 QEvent::Type t = event->type(); -
5733 if (!dd->tabChangesFocus && (t == QEvent::KeyPress || t == QEvent::KeyRelease)) {
partially evaluated: !dd->tabChangesFocus
TRUEFALSE
yes
Evaluation Count:104
no
Evaluation Count:0
partially evaluated: t == QEvent::KeyPress
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
partially evaluated: t == QEvent::KeyRelease
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
5734 int k = ((QKeyEvent *)event)->key(); -
5735 if (k == Qt::Key_Tab || k == Qt::Key_Backtab) {
never evaluated: k == Qt::Key_Tab
never evaluated: k == Qt::Key_Backtab
0
5736 dd->sendControlEvent(event); -
5737 return true;
never executed: return true;
0
5738 } -
5739 }
never executed: }
0
5740 bool result = QGraphicsItem::sceneEvent(event); -
5741 -
5742 -
5743 switch (event->type()) { -
5744 case QEvent::ContextMenu: -
5745 case QEvent::FocusIn: -
5746 case QEvent::FocusOut: -
5747 case QEvent::GraphicsSceneDragEnter: -
5748 case QEvent::GraphicsSceneDragLeave: -
5749 case QEvent::GraphicsSceneDragMove: -
5750 case QEvent::GraphicsSceneDrop: -
5751 case QEvent::GraphicsSceneHoverEnter: -
5752 case QEvent::GraphicsSceneHoverLeave: -
5753 case QEvent::GraphicsSceneHoverMove: -
5754 case QEvent::GraphicsSceneMouseDoubleClick: -
5755 case QEvent::GraphicsSceneMousePress: -
5756 case QEvent::GraphicsSceneMouseMove: -
5757 case QEvent::GraphicsSceneMouseRelease: -
5758 case QEvent::KeyPress: -
5759 case QEvent::KeyRelease: -
5760 -
5761 -
5762 if (event->type() == QEvent::FocusIn || event->type() == QEvent::FocusOut) {
partially evaluated: event->type() == QEvent::FocusIn
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: event->type() == QEvent::FocusOut
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
5763 (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->reset(); -
5764 } else {
never executed: }
0
5765 (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImQueryInput); -
5766 }
executed: }
Execution Count:1
1
5767 break;
executed: break;
Execution Count:1
1
5768 case QEvent::ShortcutOverride: -
5769 dd->sendControlEvent(event); -
5770 return true;
never executed: return true;
0
5771 default: -
5772 break;
executed: break;
Execution Count:103
103
5773 } -
5774 -
5775 return result;
executed: return result;
Execution Count:104
104
5776} -
5777 -
5778 -
5779 -
5780 -
5781void QGraphicsTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event) -
5782{ -
5783 if ((QGraphicsItem::d_ptr->flags & (ItemIsSelectable | ItemIsMovable))
never evaluated: (QGraphicsItem::d_ptr->flags & (ItemIsSelectable | ItemIsMovable))
0
5784 && (event->buttons() & Qt::LeftButton) && dd->_q_mouseOnEdge(event)) {
never evaluated: (event->buttons() & Qt::LeftButton)
never evaluated: dd->_q_mouseOnEdge(event)
0
5785 -
5786 -
5787 dd->useDefaultImpl = true; -
5788 } else if (event->buttons() == event->button()
never executed: }
never evaluated: event->buttons() == event->button()
0
5789 && dd->control->textInteractionFlags() == Qt::NoTextInteraction) {
never evaluated: dd->control->textInteractionFlags() == Qt::NoTextInteraction
0
5790 -
5791 dd->useDefaultImpl = true; -
5792 }
never executed: }
0
5793 if (dd->useDefaultImpl) {
never evaluated: dd->useDefaultImpl
0
5794 QGraphicsItem::mousePressEvent(event); -
5795 if (!event->isAccepted())
never evaluated: !event->isAccepted()
0
5796 dd->useDefaultImpl = false;
never executed: dd->useDefaultImpl = false;
0
5797 return;
never executed: return;
0
5798 } -
5799 -
5800 dd->sendControlEvent(event); -
5801}
never executed: }
0
5802 -
5803 -
5804 -
5805 -
5806void QGraphicsTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -
5807{ -
5808 if (dd->useDefaultImpl) {
partially evaluated: dd->useDefaultImpl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
5809 QGraphicsItem::mouseMoveEvent(event); -
5810 return;
never executed: return;
0
5811 } -
5812 -
5813 dd->sendControlEvent(event); -
5814}
executed: }
Execution Count:1
1
5815 -
5816 -
5817 -
5818 -
5819void QGraphicsTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -
5820{ -
5821 if (dd->useDefaultImpl) {
never evaluated: dd->useDefaultImpl
0
5822 QGraphicsItem::mouseReleaseEvent(event); -
5823 if (dd->control->textInteractionFlags() == Qt::NoTextInteraction
never evaluated: dd->control->textInteractionFlags() == Qt::NoTextInteraction
0
5824 && !event->buttons()) {
never evaluated: !event->buttons()
0
5825 -
5826 dd->useDefaultImpl = false; -
5827 } else if ((event->buttons() & Qt::LeftButton) == 0) {
never executed: }
never evaluated: (event->buttons() & Qt::LeftButton) == 0
0
5828 -
5829 dd->useDefaultImpl = false; -
5830 }
never executed: }
0
5831 return;
never executed: return;
0
5832 } -
5833 -
5834 QWidget *widget = event->widget(); -
5835 if (widget && (dd->control->textInteractionFlags() & Qt::TextEditable) && boundingRect().contains(event->pos())) {
never evaluated: widget
never evaluated: (dd->control->textInteractionFlags() & Qt::TextEditable)
never evaluated: boundingRect().contains(event->pos())
0
5836 qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), dd->clickCausedFocus); -
5837 }
never executed: }
0
5838 dd->clickCausedFocus = 0; -
5839 dd->sendControlEvent(event); -
5840}
never executed: }
0
5841 -
5842 -
5843 -
5844 -
5845void QGraphicsTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) -
5846{ -
5847 if (dd->useDefaultImpl) {
never evaluated: dd->useDefaultImpl
0
5848 QGraphicsItem::mouseDoubleClickEvent(event); -
5849 return;
never executed: return;
0
5850 } -
5851 -
5852 if (!hasFocus()) {
never evaluated: !hasFocus()
0
5853 QGraphicsItem::mouseDoubleClickEvent(event); -
5854 return;
never executed: return;
0
5855 } -
5856 -
5857 dd->sendControlEvent(event); -
5858}
never executed: }
0
5859 -
5860 -
5861 -
5862 -
5863void QGraphicsTextItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) -
5864{ -
5865 dd->sendControlEvent(event); -
5866}
never executed: }
0
5867 -
5868 -
5869 -
5870 -
5871void QGraphicsTextItem::keyPressEvent(QKeyEvent *event) -
5872{ -
5873 dd->sendControlEvent(event); -
5874}
never executed: }
0
5875 -
5876 -
5877 -
5878 -
5879void QGraphicsTextItem::keyReleaseEvent(QKeyEvent *event) -
5880{ -
5881 dd->sendControlEvent(event); -
5882}
never executed: }
0
5883 -
5884 -
5885 -
5886 -
5887void QGraphicsTextItem::focusInEvent(QFocusEvent *event) -
5888{ -
5889 dd->sendControlEvent(event); -
5890 if (event->reason() == Qt::MouseFocusReason) {
never evaluated: event->reason() == Qt::MouseFocusReason
0
5891 dd->clickCausedFocus = 1; -
5892 }
never executed: }
0
5893 update(); -
5894}
never executed: }
0
5895 -
5896 -
5897 -
5898 -
5899void QGraphicsTextItem::focusOutEvent(QFocusEvent *event) -
5900{ -
5901 dd->sendControlEvent(event); -
5902 update(); -
5903}
never executed: }
0
5904 -
5905 -
5906 -
5907 -
5908void QGraphicsTextItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event) -
5909{ -
5910 dd->sendControlEvent(event); -
5911}
never executed: }
0
5912 -
5913 -
5914 -
5915 -
5916void QGraphicsTextItem::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) -
5917{ -
5918 dd->sendControlEvent(event); -
5919}
never executed: }
0
5920 -
5921 -
5922 -
5923 -
5924void QGraphicsTextItem::dragMoveEvent(QGraphicsSceneDragDropEvent *event) -
5925{ -
5926 dd->sendControlEvent(event); -
5927}
never executed: }
0
5928 -
5929 -
5930 -
5931 -
5932void QGraphicsTextItem::dropEvent(QGraphicsSceneDragDropEvent *event) -
5933{ -
5934 dd->sendControlEvent(event); -
5935}
never executed: }
0
5936 -
5937 -
5938 -
5939 -
5940void QGraphicsTextItem::inputMethodEvent(QInputMethodEvent *event) -
5941{ -
5942 dd->sendControlEvent(event); -
5943}
never executed: }
0
5944 -
5945 -
5946 -
5947 -
5948void QGraphicsTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) -
5949{ -
5950 dd->sendControlEvent(event); -
5951}
never executed: }
0
5952 -
5953 -
5954 -
5955 -
5956void QGraphicsTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) -
5957{ -
5958 dd->sendControlEvent(event); -
5959}
never executed: }
0
5960 -
5961 -
5962 -
5963 -
5964void QGraphicsTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -
5965{ -
5966 dd->sendControlEvent(event); -
5967}
never executed: }
0
5968 -
5969 -
5970 -
5971 -
5972QVariant QGraphicsTextItem::inputMethodQuery(Qt::InputMethodQuery query) const -
5973{ -
5974 QVariant v; -
5975 if (dd->control)
never evaluated: dd->control
0
5976 v = dd->control->inputMethodQuery(query);
never executed: v = dd->control->inputMethodQuery(query);
0
5977 if (v.type() == QVariant::RectF)
never evaluated: v.type() == QVariant::RectF
0
5978 v = v.toRectF().translated(-dd->controlOffset());
never executed: v = v.toRectF().translated(-dd->controlOffset());
0
5979 else if (v.type() == QVariant::PointF)
never evaluated: v.type() == QVariant::PointF
0
5980 v = v.toPointF() - dd->controlOffset();
never executed: v = v.toPointF() - dd->controlOffset();
0
5981 else if (v.type() == QVariant::Rect)
never evaluated: v.type() == QVariant::Rect
0
5982 v = v.toRect().translated(-dd->controlOffset().toPoint());
never executed: v = v.toRect().translated(-dd->controlOffset().toPoint());
0
5983 else if (v.type() == QVariant::Point)
never evaluated: v.type() == QVariant::Point
0
5984 v = v.toPoint() - dd->controlOffset().toPoint();
never executed: v = v.toPoint() - dd->controlOffset().toPoint();
0
5985 return v;
never executed: return v;
0
5986} -
5987 -
5988 -
5989 -
5990 -
5991bool QGraphicsTextItem::supportsExtension(Extension extension) const -
5992{ -
5993 (void)extension;; -
5994 return false;
never executed: return false;
0
5995} -
5996 -
5997 -
5998 -
5999 -
6000void QGraphicsTextItem::setExtension(Extension extension, const QVariant &variant) -
6001{ -
6002 (void)extension;; -
6003 (void)variant;; -
6004}
never executed: }
0
6005 -
6006 -
6007 -
6008 -
6009QVariant QGraphicsTextItem::extension(const QVariant &variant) const -
6010{ -
6011 (void)variant;; -
6012 return QVariant();
never executed: return QVariant();
0
6013} -
6014 -
6015 -
6016 -
6017 -
6018void QGraphicsTextItemPrivate::_q_update(QRectF rect) -
6019{ -
6020 if (rect.isValid()) {
partially evaluated: rect.isValid()
TRUEFALSE
yes
Evaluation Count:311
no
Evaluation Count:0
0-311
6021 rect.translate(-controlOffset()); -
6022 } else {
executed: }
Execution Count:311
311
6023 rect = boundingRect; -
6024 }
never executed: }
0
6025 if (rect.intersects(boundingRect))
partially evaluated: rect.intersects(boundingRect)
TRUEFALSE
yes
Evaluation Count:311
no
Evaluation Count:0
0-311
6026 qq->update(rect);
executed: qq->update(rect);
Execution Count:311
311
6027}
executed: }
Execution Count:311
311
6028 -
6029 -
6030 -
6031 -
6032void QGraphicsTextItemPrivate::_q_updateBoundingRect(const QSizeF &size) -
6033{ -
6034 if (!control) return;
never executed: return;
partially evaluated: !control
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:208
0-208
6035 const QSizeF pageSize = control->document()->pageSize(); -
6036 -
6037 if (size == boundingRect.size() || pageSize.height() != -1)
partially evaluated: size == boundingRect.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:208
partially evaluated: pageSize.height() != -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:208
0-208
6038 return;
never executed: return;
0
6039 qq->prepareGeometryChange(); -
6040 boundingRect.setSize(size); -
6041 qq->update(); -
6042}
executed: }
Execution Count:208
208
6043 -
6044 -
6045 -
6046 -
6047void QGraphicsTextItemPrivate::_q_ensureVisible(QRectF rect) -
6048{ -
6049 if (qq->hasFocus()) {
partially evaluated: qq->hasFocus()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
6050 rect.translate(-controlOffset()); -
6051 qq->ensureVisible(rect, 0, 0); -
6052 }
never executed: }
0
6053}
executed: }
Execution Count:104
104
6054 -
6055QWidgetTextControl *QGraphicsTextItemPrivate::textControl() const -
6056{ -
6057 if (!control) {
evaluated: !control
TRUEFALSE
yes
Evaluation Count:104
yes
Evaluation Count:103
103-104
6058 QGraphicsTextItem *that = const_cast<QGraphicsTextItem *>(qq); -
6059 control = new QWidgetTextControl(that); -
6060 control->setTextInteractionFlags(Qt::NoTextInteraction); -
6061 -
6062 QObject::connect(control, "2""updateRequest(QRectF)", -
6063 qq, "1""_q_update(QRectF)"); -
6064 QObject::connect(control, "2""documentSizeChanged(QSizeF)", -
6065 qq, "1""_q_updateBoundingRect(QSizeF)"); -
6066 QObject::connect(control, "2""visibilityRequest(QRectF)", -
6067 qq, "1""_q_ensureVisible(QRectF)"); -
6068 QObject::connect(control, "2""linkActivated(QString)", -
6069 qq, "2""linkActivated(QString)"); -
6070 QObject::connect(control, "2""linkHovered(QString)", -
6071 qq, "2""linkHovered(QString)"); -
6072 -
6073 const QSizeF pgSize = control->document()->pageSize(); -
6074 if (pgSize.height() != -1) {
partially evaluated: pgSize.height() != -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
6075 qq->prepareGeometryChange(); -
6076 that->dd->boundingRect.setSize(pgSize); -
6077 qq->update(); -
6078 } else {
never executed: }
0
6079 that->dd->_q_updateBoundingRect(control->size()); -
6080 }
executed: }
Execution Count:104
104
6081 } -
6082 return control;
executed: return control;
Execution Count:207
207
6083} -
6084 -
6085 -
6086 -
6087 -
6088bool QGraphicsTextItemPrivate::_q_mouseOnEdge(QGraphicsSceneMouseEvent *event) -
6089{ -
6090 QPainterPath path; -
6091 path.addRect(qq->boundingRect()); -
6092 -
6093 QPainterPath docPath; -
6094 const QTextFrameFormat format = control->document()->rootFrame()->frameFormat(); -
6095 docPath.addRect( -
6096 qq->boundingRect().adjusted( -
6097 format.leftMargin(), -
6098 format.topMargin(), -
6099 -format.rightMargin(), -
6100 -format.bottomMargin())); -
6101 -
6102 return path.subtracted(docPath).contains(event->pos());
never executed: return path.subtracted(docPath).contains(event->pos());
0
6103} -
6104void QGraphicsTextItem::setTextInteractionFlags(Qt::TextInteractionFlags flags) -
6105{ -
6106 if (flags == Qt::NoTextInteraction)
never evaluated: flags == Qt::NoTextInteraction
0
6107 setFlags(this->flags() & ~(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemAcceptsInputMethod));
never executed: setFlags(this->flags() & ~(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemAcceptsInputMethod));
0
6108 else -
6109 setFlags(this->flags() | QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemAcceptsInputMethod);
never executed: setFlags(this->flags() | QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemAcceptsInputMethod);
0
6110 -
6111 dd->textControl()->setTextInteractionFlags(flags); -
6112}
never executed: }
0
6113 -
6114 -
6115 -
6116 -
6117 -
6118 -
6119Qt::TextInteractionFlags QGraphicsTextItem::textInteractionFlags() const -
6120{ -
6121 if (!dd->control)
never evaluated: !dd->control
0
6122 return Qt::NoTextInteraction;
never executed: return Qt::NoTextInteraction;
0
6123 return dd->control->textInteractionFlags();
never executed: return dd->control->textInteractionFlags();
0
6124} -
6125void QGraphicsTextItem::setTabChangesFocus(bool b) -
6126{ -
6127 dd->tabChangesFocus = b; -
6128}
never executed: }
0
6129bool QGraphicsTextItem::tabChangesFocus() const -
6130{ -
6131 return dd->tabChangesFocus;
never executed: return dd->tabChangesFocus;
0
6132} -
6133void QGraphicsTextItem::setOpenExternalLinks(bool open) -
6134{ -
6135 dd->textControl()->setOpenExternalLinks(open); -
6136}
never executed: }
0
6137 -
6138bool QGraphicsTextItem::openExternalLinks() const -
6139{ -
6140 if (!dd->control)
never evaluated: !dd->control
0
6141 return false;
never executed: return false;
0
6142 return dd->control->openExternalLinks();
never executed: return dd->control->openExternalLinks();
0
6143} -
6144void QGraphicsTextItem::setTextCursor(const QTextCursor &cursor) -
6145{ -
6146 dd->textControl()->setTextCursor(cursor); -
6147}
never executed: }
0
6148 -
6149QTextCursor QGraphicsTextItem::textCursor() const -
6150{ -
6151 if (!dd->control)
never evaluated: !dd->control
0
6152 return QTextCursor();
never executed: return QTextCursor();
0
6153 return dd->control->textCursor();
never executed: return dd->control->textCursor();
0
6154} -
6155 -
6156class QGraphicsSimpleTextItemPrivate : public QAbstractGraphicsShapeItemPrivate -
6157{ -
6158 inline QGraphicsSimpleTextItem* q_func() { return static_cast<QGraphicsSimpleTextItem *>(q_ptr); } inline const QGraphicsSimpleTextItem* q_func() const { return static_cast<const QGraphicsSimpleTextItem *>(q_ptr); } friend class QGraphicsSimpleTextItem; -
6159public: -
6160 inline QGraphicsSimpleTextItemPrivate() { -
6161 pen.setStyle(Qt::NoPen); -
6162 brush.setStyle(Qt::SolidPattern); -
6163 }
never executed: }
0
6164 QString text; -
6165 QFont font; -
6166 QRectF boundingRect; -
6167 -
6168 void updateBoundingRect(); -
6169}; -
6170 -
6171static QRectF setupTextLayout(QTextLayout *layout) -
6172{ -
6173 layout->setCacheEnabled(true); -
6174 layout->beginLayout(); -
6175 while (layout->createLine().isValid())
never evaluated: layout->createLine().isValid()
0
6176 ;
never executed: ;
0
6177 layout->endLayout(); -
6178 qreal maxWidth = 0; -
6179 qreal y = 0; -
6180 for (int i = 0; i < layout->lineCount(); ++i) {
never evaluated: i < layout->lineCount()
0
6181 QTextLine line = layout->lineAt(i); -
6182 maxWidth = qMax(maxWidth, line.naturalTextWidth()); -
6183 line.setPosition(QPointF(0, y)); -
6184 y += line.height(); -
6185 }
never executed: }
0
6186 return QRectF(0, 0, maxWidth, y);
never executed: return QRectF(0, 0, maxWidth, y);
0
6187} -
6188 -
6189void QGraphicsSimpleTextItemPrivate::updateBoundingRect() -
6190{ -
6191 QGraphicsSimpleTextItem * const q = q_func(); -
6192 QRectF br; -
6193 if (text.isEmpty()) {
never evaluated: text.isEmpty()
0
6194 br = QRectF(); -
6195 } else {
never executed: }
0
6196 QString tmp = text; -
6197 tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); -
6198 QStackTextEngine engine(tmp, font); -
6199 QTextLayout layout(&engine); -
6200 br = setupTextLayout(&layout); -
6201 }
never executed: }
0
6202 if (br != boundingRect) {
never evaluated: br != boundingRect
0
6203 q->prepareGeometryChange(); -
6204 boundingRect = br; -
6205 q->update(); -
6206 }
never executed: }
0
6207}
never executed: }
0
6208QGraphicsSimpleTextItem::QGraphicsSimpleTextItem(QGraphicsItem *parent) -
6209 : QAbstractGraphicsShapeItem(*new QGraphicsSimpleTextItemPrivate, parent) -
6210{ -
6211}
never executed: }
0
6212QGraphicsSimpleTextItem::QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent) -
6213 : QAbstractGraphicsShapeItem(*new QGraphicsSimpleTextItemPrivate, parent) -
6214{ -
6215 setText(text); -
6216}
never executed: }
0
6217 -
6218 -
6219 -
6220 -
6221QGraphicsSimpleTextItem::~QGraphicsSimpleTextItem() -
6222{ -
6223} -
6224 -
6225 -
6226 -
6227 -
6228 -
6229 -
6230 -
6231void QGraphicsSimpleTextItem::setText(const QString &text) -
6232{ -
6233 QGraphicsSimpleTextItemPrivate * const d = d_func(); -
6234 if (d->text == text)
never evaluated: d->text == text
0
6235 return;
never executed: return;
0
6236 d->text = text; -
6237 d->updateBoundingRect(); -
6238 update(); -
6239}
never executed: }
0
6240 -
6241 -
6242 -
6243 -
6244QString QGraphicsSimpleTextItem::text() const -
6245{ -
6246 const QGraphicsSimpleTextItemPrivate * const d = d_func(); -
6247 return d->text;
never executed: return d->text;
0
6248} -
6249 -
6250 -
6251 -
6252 -
6253void QGraphicsSimpleTextItem::setFont(const QFont &font) -
6254{ -
6255 QGraphicsSimpleTextItemPrivate * const d = d_func(); -
6256 d->font = font; -
6257 d->updateBoundingRect(); -
6258}
never executed: }
0
6259 -
6260 -
6261 -
6262 -
6263QFont QGraphicsSimpleTextItem::font() const -
6264{ -
6265 const QGraphicsSimpleTextItemPrivate * const d = d_func(); -
6266 return d->font;
never executed: return d->font;
0
6267} -
6268 -
6269 -
6270 -
6271 -
6272QRectF QGraphicsSimpleTextItem::boundingRect() const -
6273{ -
6274 const QGraphicsSimpleTextItemPrivate * const d = d_func(); -
6275 return d->boundingRect;
never executed: return d->boundingRect;
0
6276} -
6277 -
6278 -
6279 -
6280 -
6281QPainterPath QGraphicsSimpleTextItem::shape() const -
6282{ -
6283 const QGraphicsSimpleTextItemPrivate * const d = d_func(); -
6284 QPainterPath path; -
6285 path.addRect(d->boundingRect); -
6286 return path;
never executed: return path;
0
6287} -
6288 -
6289 -
6290 -
6291 -
6292bool QGraphicsSimpleTextItem::contains(const QPointF &point) const -
6293{ -
6294 const QGraphicsSimpleTextItemPrivate * const d = d_func(); -
6295 return d->boundingRect.contains(point);
never executed: return d->boundingRect.contains(point);
0
6296} -
6297 -
6298 -
6299 -
6300 -
6301void QGraphicsSimpleTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -
6302{ -
6303 (void)widget;; -
6304 QGraphicsSimpleTextItemPrivate * const d = d_func(); -
6305 -
6306 painter->setFont(d->font); -
6307 -
6308 QString tmp = d->text; -
6309 tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); -
6310 QStackTextEngine engine(tmp, d->font); -
6311 QTextLayout layout(&engine); -
6312 setupTextLayout(&layout); -
6313 -
6314 QPen p; -
6315 p.setBrush(d->brush); -
6316 painter->setPen(p); -
6317 if (d->pen.style() == Qt::NoPen && d->brush.style() == Qt::SolidPattern) {
never evaluated: d->pen.style() == Qt::NoPen
never evaluated: d->brush.style() == Qt::SolidPattern
0
6318 painter->setBrush(Qt::NoBrush); -
6319 } else {
never executed: }
0
6320 QTextLayout::FormatRange range; -
6321 range.start = 0; -
6322 range.length = layout.text().length(); -
6323 range.format.setTextOutline(d->pen); -
6324 QList<QTextLayout::FormatRange> formats; -
6325 formats.append(range); -
6326 layout.setAdditionalFormats(formats); -
6327 }
never executed: }
0
6328 -
6329 layout.draw(painter, QPointF(0, 0)); -
6330 -
6331 if (option->state & (QStyle::State_Selected | QStyle::State_HasFocus))
never evaluated: option->state & (QStyle::State_Selected | QStyle::State_HasFocus)
0
6332 qt_graphicsItem_highlightSelected(this, painter, option);
never executed: qt_graphicsItem_highlightSelected(this, painter, option);
0
6333}
never executed: }
0
6334 -
6335 -
6336 -
6337 -
6338bool QGraphicsSimpleTextItem::isObscuredBy(const QGraphicsItem *item) const -
6339{ -
6340 return QAbstractGraphicsShapeItem::isObscuredBy(item);
never executed: return QAbstractGraphicsShapeItem::isObscuredBy(item);
0
6341} -
6342 -
6343 -
6344 -
6345 -
6346QPainterPath QGraphicsSimpleTextItem::opaqueArea() const -
6347{ -
6348 return QAbstractGraphicsShapeItem::opaqueArea();
never executed: return QAbstractGraphicsShapeItem::opaqueArea();
0
6349} -
6350 -
6351 -
6352 -
6353 -
6354int QGraphicsSimpleTextItem::type() const -
6355{ -
6356 return Type;
never executed: return Type;
0
6357} -
6358 -
6359 -
6360 -
6361 -
6362bool QGraphicsSimpleTextItem::supportsExtension(Extension extension) const -
6363{ -
6364 (void)extension;; -
6365 return false;
never executed: return false;
0
6366} -
6367 -
6368 -
6369 -
6370 -
6371void QGraphicsSimpleTextItem::setExtension(Extension extension, const QVariant &variant) -
6372{ -
6373 (void)extension;; -
6374 (void)variant;; -
6375}
never executed: }
0
6376 -
6377 -
6378 -
6379 -
6380QVariant QGraphicsSimpleTextItem::extension(const QVariant &variant) const -
6381{ -
6382 (void)variant;; -
6383 return QVariant();
never executed: return QVariant();
0
6384} -
6385class QGraphicsItemGroupPrivate : public QGraphicsItemPrivate -
6386{ -
6387public: -
6388 QRectF itemsBoundingRect; -
6389}; -
6390 -
6391 -
6392 -
6393 -
6394 -
6395 -
6396 -
6397QGraphicsItemGroup::QGraphicsItemGroup(QGraphicsItem *parent) -
6398 : QGraphicsItem(*new QGraphicsItemGroupPrivate, parent) -
6399{ -
6400 setHandlesChildEvents(true); -
6401}
never executed: }
0
6402 -
6403 -
6404 -
6405 -
6406QGraphicsItemGroup::~QGraphicsItemGroup() -
6407{ -
6408} -
6409void QGraphicsItemGroup::addToGroup(QGraphicsItem *item) -
6410{ -
6411 QGraphicsItemGroupPrivate * const d = d_func(); -
6412 if (!item) {
never evaluated: !item
0
6413 QMessageLogger("graphicsview/qgraphicsitem.cpp", 10903, __PRETTY_FUNCTION__).warning("QGraphicsItemGroup::addToGroup: cannot add null item"); -
6414 return;
never executed: return;
0
6415 } -
6416 if (item == this) {
never evaluated: item == this
0
6417 QMessageLogger("graphicsview/qgraphicsitem.cpp", 10907, __PRETTY_FUNCTION__).warning("QGraphicsItemGroup::addToGroup: cannot add a group to itself"); -
6418 return;
never executed: return;
0
6419 } -
6420 -
6421 -
6422 bool ok; -
6423 QTransform itemTransform = item->itemTransform(this, &ok); -
6424 -
6425 if (!ok) {
never evaluated: !ok
0
6426 QMessageLogger("graphicsview/qgraphicsitem.cpp", 10916, __PRETTY_FUNCTION__).warning("QGraphicsItemGroup::addToGroup: could not find a valid transformation from item to group coordinates"); -
6427 return;
never executed: return;
0
6428 } -
6429 -
6430 QTransform newItemTransform(itemTransform); -
6431 item->setPos(mapFromItem(item, 0, 0)); -
6432 item->setParentItem(this); -
6433 -
6434 -
6435 if (!item->pos().isNull())
never evaluated: !item->pos().isNull()
0
6436 newItemTransform *= QTransform::fromTranslate(-item->x(), -item->y());
never executed: newItemTransform *= QTransform::fromTranslate(-item->x(), -item->y());
0
6437 -
6438 -
6439 QPointF origin = item->transformOriginPoint(); -
6440 QMatrix4x4 m; -
6441 QList<QGraphicsTransform*> transformList = item->transformations(); -
6442 for (int i = 0; i < transformList.size(); ++i)
never evaluated: i < transformList.size()
0
6443 transformList.at(i)->applyTo(&m);
never executed: transformList.at(i)->applyTo(&m);
0
6444 newItemTransform *= m.toTransform().inverted(); -
6445 newItemTransform.translate(origin.x(), origin.y()); -
6446 newItemTransform.rotate(-item->rotation()); -
6447 newItemTransform.scale(1/item->scale(), 1/item->scale()); -
6448 newItemTransform.translate(-origin.x(), -origin.y()); -
6449 -
6450 -
6451 -
6452 item->setTransform(newItemTransform); -
6453 item->d_func()->setIsMemberOfGroup(true); -
6454 prepareGeometryChange(); -
6455 d->itemsBoundingRect |= itemTransform.mapRect(item->boundingRect() | item->childrenBoundingRect()); -
6456 update(); -
6457}
never executed: }
0
6458void QGraphicsItemGroup::removeFromGroup(QGraphicsItem *item) -
6459{ -
6460 QGraphicsItemGroupPrivate * const d = d_func(); -
6461 if (!item) {
never evaluated: !item
0
6462 QMessageLogger("graphicsview/qgraphicsitem.cpp", 10961, __PRETTY_FUNCTION__).warning("QGraphicsItemGroup::removeFromGroup: cannot remove null item"); -
6463 return;
never executed: return;
0
6464 } -
6465 -
6466 QGraphicsItem *newParent = d_ptr->parent; -
6467 -
6468 -
6469 bool ok; -
6470 QTransform itemTransform; -
6471 if (newParent)
never evaluated: newParent
0
6472 itemTransform = item->itemTransform(newParent, &ok);
never executed: itemTransform = item->itemTransform(newParent, &ok);
0
6473 else -
6474 itemTransform = item->sceneTransform();
never executed: itemTransform = item->sceneTransform();
0
6475 -
6476 QPointF oldPos = item->mapToItem(newParent, 0, 0); -
6477 item->setParentItem(newParent); -
6478 item->setPos(oldPos); -
6479 -
6480 -
6481 if (!item->pos().isNull())
never evaluated: !item->pos().isNull()
0
6482 itemTransform *= QTransform::fromTranslate(-item->x(), -item->y());
never executed: itemTransform *= QTransform::fromTranslate(-item->x(), -item->y());
0
6483 -
6484 -
6485 -
6486 QPointF origin = item->transformOriginPoint(); -
6487 QMatrix4x4 m; -
6488 QList<QGraphicsTransform*> transformList = item->transformations(); -
6489 for (int i = 0; i < transformList.size(); ++i)
never evaluated: i < transformList.size()
0
6490 transformList.at(i)->applyTo(&m);
never executed: transformList.at(i)->applyTo(&m);
0
6491 itemTransform *= m.toTransform().inverted(); -
6492 itemTransform.translate(origin.x(), origin.y()); -
6493 itemTransform.rotate(-item->rotation()); -
6494 itemTransform.scale(1 / item->scale(), 1 / item->scale()); -
6495 itemTransform.translate(-origin.x(), -origin.y()); -
6496 -
6497 -
6498 -
6499 item->setTransform(itemTransform); -
6500 item->d_func()->setIsMemberOfGroup(item->group() != 0); -
6501 -
6502 -
6503 prepareGeometryChange(); -
6504 d->itemsBoundingRect = childrenBoundingRect(); -
6505}
never executed: }
0
6506 -
6507 -
6508 -
6509 -
6510 -
6511 -
6512QRectF QGraphicsItemGroup::boundingRect() const -
6513{ -
6514 const QGraphicsItemGroupPrivate * const d = d_func(); -
6515 return d->itemsBoundingRect;
never executed: return d->itemsBoundingRect;
0
6516} -
6517 -
6518 -
6519 -
6520 -
6521void QGraphicsItemGroup::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, -
6522 QWidget *widget) -
6523{ -
6524 (void)widget;; -
6525 if (option->state & QStyle::State_Selected) {
never evaluated: option->state & QStyle::State_Selected
0
6526 QGraphicsItemGroupPrivate * const d = d_func(); -
6527 painter->setBrush(Qt::NoBrush); -
6528 painter->drawRect(d->itemsBoundingRect); -
6529 }
never executed: }
0
6530}
never executed: }
0
6531 -
6532 -
6533 -
6534 -
6535bool QGraphicsItemGroup::isObscuredBy(const QGraphicsItem *item) const -
6536{ -
6537 return QGraphicsItem::isObscuredBy(item);
never executed: return QGraphicsItem::isObscuredBy(item);
0
6538} -
6539 -
6540 -
6541 -
6542 -
6543QPainterPath QGraphicsItemGroup::opaqueArea() const -
6544{ -
6545 return QGraphicsItem::opaqueArea();
never executed: return QGraphicsItem::opaqueArea();
0
6546} -
6547 -
6548 -
6549 -
6550 -
6551int QGraphicsItemGroup::type() const -
6552{ -
6553 return Type;
never executed: return Type;
0
6554} -
6555 -
6556 -
6557QRectF QGraphicsItemEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const -
6558{ -
6559 const bool deviceCoordinates = (system == Qt::DeviceCoordinates); -
6560 if (!info && deviceCoordinates) {
evaluated: !info
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:35
evaluated: deviceCoordinates
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:26
1-35
6561 -
6562 QMessageLogger("graphicsview/qgraphicsitem.cpp", 11061, __PRETTY_FUNCTION__).warning("QGraphicsEffectSource::boundingRect: Not yet implemented, lacking device context"); -
6563 return QRectF();
executed: return QRectF();
Execution Count:1
1
6564 } -
6565 -
6566 QRectF rect = item->boundingRect(); -
6567 if (!item->d_ptr->children.isEmpty())
evaluated: !item->d_ptr->children.isEmpty()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:42
19-42
6568 rect |= item->childrenBoundingRect();
executed: rect |= item->childrenBoundingRect();
Execution Count:19
19
6569 -
6570 if (deviceCoordinates) {
evaluated: deviceCoordinates
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:32
29-32
6571 qt_noop(); -
6572 rect = info->painter->worldTransform().mapRect(rect); -
6573 }
executed: }
Execution Count:29
29
6574 -
6575 return rect;
executed: return rect;
Execution Count:61
61
6576} -
6577 -
6578void QGraphicsItemEffectSourcePrivate::draw(QPainter *painter) -
6579{ -
6580 if (!info) {
evaluated: !info
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:13
1-13
6581 QMessageLogger("graphicsview/qgraphicsitem.cpp", 11080, __PRETTY_FUNCTION__).warning("QGraphicsEffectSource::draw: Can only begin as a result of QGraphicsEffect::draw"); -
6582 return;
executed: return;
Execution Count:1
1
6583 } -
6584 -
6585 qt_noop(); -
6586 QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func(); -
6587 if (painter == info->painter) {
partially evaluated: painter == info->painter
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
0-13
6588 scened->draw(item, painter, info->viewTransform, info->transformPtr, info->exposedRegion, -
6589 info->widget, info->opacity, info->effectTransform, info->wasDirtySceneTransform, -
6590 info->drawItem); -
6591 } else {
executed: }
Execution Count:13
13
6592 QTransform effectTransform = info->painter->worldTransform().inverted(); -
6593 effectTransform *= painter->worldTransform(); -
6594 scened->draw(item, painter, info->viewTransform, info->transformPtr, info->exposedRegion, -
6595 info->widget, info->opacity, &effectTransform, info->wasDirtySceneTransform, -
6596 info->drawItem); -
6597 }
never executed: }
0
6598} -
6599 -
6600 -
6601QRect QGraphicsItemEffectSourcePrivate::paddedEffectRect(Qt::CoordinateSystem system, QGraphicsEffect::PixmapPadMode mode, const QRectF &sourceRect, bool *unpadded) const -
6602{ -
6603 QRectF effectRectF; -
6604 -
6605 if (unpadded)
evaluated: unpadded
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:9
9-20
6606 *unpadded = false;
executed: *unpadded = false;
Execution Count:20
20
6607 -
6608 if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) {
evaluated: mode == QGraphicsEffect::PadToEffectiveBoundingRect
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:13
13-16
6609 if (info) {
evaluated: info
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1
1-15
6610 QRectF deviceRect = system == Qt::DeviceCoordinates ? sourceRect : info->painter->worldTransform().mapRect(sourceRect);
evaluated: system == Qt::DeviceCoordinates
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:3
3-12
6611 effectRectF = item->graphicsEffect()->boundingRectFor(deviceRect); -
6612 if (unpadded)
evaluated: unpadded
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:2
2-13
6613 *unpadded = (effectRectF.size() == sourceRect.size());
executed: *unpadded = (effectRectF.size() == sourceRect.size());
Execution Count:13
13
6614 if (info && system == Qt::LogicalCoordinates)
partially evaluated: info
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
evaluated: system == Qt::LogicalCoordinates
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:12
0-15
6615 effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF);
executed: effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF);
Execution Count:3
3
6616 } else {
executed: }
Execution Count:15
15
6617 -
6618 effectRectF = item->graphicsEffect()->boundingRectFor(sourceRect); -
6619 }
executed: }
Execution Count:1
1
6620 } else if (mode == QGraphicsEffect::PadToTransparentBorder) {
evaluated: mode == QGraphicsEffect::PadToTransparentBorder
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:4
4-9
6621 -
6622 effectRectF = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5); -
6623 } else {
executed: }
Execution Count:9
9
6624 effectRectF = sourceRect; -
6625 if (unpadded)
partially evaluated: unpadded
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
6626 *unpadded = true;
executed: *unpadded = true;
Execution Count:4
4
6627 }
executed: }
Execution Count:4
4
6628 -
6629 return effectRectF.toAlignedRect();
executed: return effectRectF.toAlignedRect();
Execution Count:29
29
6630} -
6631 -
6632QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *offset, -
6633 QGraphicsEffect::PixmapPadMode mode) const -
6634{ -
6635 const bool deviceCoordinates = (system == Qt::DeviceCoordinates); -
6636 if (!info && deviceCoordinates) {
evaluated: !info
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:19
partially evaluated: deviceCoordinates
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-19
6637 -
6638 QMessageLogger("graphicsview/qgraphicsitem.cpp", 11137, __PRETTY_FUNCTION__).warning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context"); -
6639 return QPixmap();
never executed: return QPixmap();
0
6640 } -
6641 if (!item->d_ptr->scene)
partially evaluated: !item->d_ptr->scene
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20
0-20
6642 return QPixmap();
never executed: return QPixmap();
0
6643 QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func(); -
6644 -
6645 bool unpadded; -
6646 const QRectF sourceRect = boundingRect(system); -
6647 QRect effectRect = paddedEffectRect(system, mode, sourceRect, &unpadded); -
6648 -
6649 if (offset)
partially evaluated: offset
TRUEFALSE
yes
Evaluation Count:20
no
Evaluation Count:0
0-20
6650 *offset = effectRect.topLeft();
executed: *offset = effectRect.topLeft();
Execution Count:20
20
6651 -
6652 bool untransformed = !deviceCoordinates
evaluated: !deviceCoordinates
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:15
5-15
6653 || info->painter->worldTransform().type() <= QTransform::TxTranslate;
evaluated: info->painter->worldTransform().type() <= QTransform::TxTranslate
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:4
4-11
6654 if (untransformed && unpadded && isPixmap()) {
evaluated: untransformed
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:4
evaluated: unpadded
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:10
evaluated: isPixmap()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3-16
6655 if (offset)
partially evaluated: offset
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
6656 *offset = boundingRect(system).topLeft().toPoint();
executed: *offset = boundingRect(system).topLeft().toPoint();
Execution Count:3
3
6657 return static_cast<QGraphicsPixmapItem *>(item)->pixmap();
executed: return static_cast<QGraphicsPixmapItem *>(item)->pixmap();
Execution Count:3
3
6658 } -
6659 -
6660 if (effectRect.isEmpty())
partially evaluated: effectRect.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
6661 return QPixmap();
never executed: return QPixmap();
0
6662 -
6663 QPixmap pixmap(effectRect.size()); -
6664 pixmap.fill(Qt::transparent); -
6665 QPainter pixmapPainter(&pixmap); -
6666 pixmapPainter.setRenderHints(info ? info->painter->renderHints() : QPainter::TextAntialiasing); -
6667 -
6668 QTransform effectTransform = QTransform::fromTranslate(-effectRect.x(), -effectRect.y()); -
6669 if (deviceCoordinates && info->effectTransform)
evaluated: deviceCoordinates
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:3
partially evaluated: info->effectTransform
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
6670 effectTransform *= *info->effectTransform;
never executed: effectTransform *= *info->effectTransform;
0
6671 -
6672 if (!info) {
evaluated: !info
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:16
1-16
6673 -
6674 QTransform sceneTransform = item->sceneTransform(); -
6675 QTransform newEffectTransform = sceneTransform.inverted(); -
6676 newEffectTransform *= effectTransform; -
6677 scened->draw(item, &pixmapPainter, 0, &sceneTransform, 0, 0, qreal(1.0), -
6678 &newEffectTransform, false, true); -
6679 } else if (deviceCoordinates) {
executed: }
Execution Count:1
evaluated: deviceCoordinates
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:2
1-14
6680 -
6681 scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, 0, -
6682 info->widget, info->opacity, &effectTransform, info->wasDirtySceneTransform, -
6683 info->drawItem); -
6684 } else {
executed: }
Execution Count:14
14
6685 -
6686 QTransform newEffectTransform = info->transformPtr->inverted(); -
6687 newEffectTransform *= effectTransform; -
6688 scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, 0, -
6689 info->widget, info->opacity, &newEffectTransform, info->wasDirtySceneTransform, -
6690 info->drawItem); -
6691 }
executed: }
Execution Count:2
2
6692 -
6693 pixmapPainter.end(); -
6694 -
6695 return pixmap;
executed: return pixmap;
Execution Count:17
17
6696} -
6697 -
6698 -
6699 -
6700QDebug operator<<(QDebug debug, QGraphicsItem *item) -
6701{ -
6702 if (!item) {
never evaluated: !item
0
6703 debug << "QGraphicsItem(0)"; -
6704 return debug;
never executed: return debug;
0
6705 } -
6706 -
6707 if (QGraphicsObject *o = item->toGraphicsObject())
never evaluated: QGraphicsObject *o = item->toGraphicsObject()
0
6708 debug << o->metaObject()->className();
never executed: debug << o->metaObject()->className();
0
6709 else -
6710 debug << "QGraphicsItem";
never executed: debug << "QGraphicsItem";
0
6711 debug << "(this =" << (void*)item -
6712 << ", parent =" << (void*)item->parentItem() -
6713 << ", pos =" << item->pos() -
6714 << ", z =" << item->zValue() << ", flags = " -
6715 << item->flags() << ")"; -
6716 return debug;
never executed: return debug;
0
6717} -
6718 -
6719QDebug operator<<(QDebug debug, QGraphicsObject *item) -
6720{ -
6721 if (!item) {
never evaluated: !item
0
6722 debug << "QGraphicsObject(0)"; -
6723 return debug;
never executed: return debug;
0
6724 } -
6725 -
6726 debug.nospace() << item->metaObject()->className() << '(' << (void*)item; -
6727 if (!item->objectName().isEmpty())
never evaluated: !item->objectName().isEmpty()
0
6728 debug << ", name = " << item->objectName();
never executed: debug << ", name = " << item->objectName();
0
6729 debug.nospace() << ", parent = " << ((void*)item->parentItem()) -
6730 << ", pos = " << item->pos() -
6731 << ", z = " << item->zValue() << ", flags = " -
6732 << item->flags() << ')'; -
6733 return debug.space();
never executed: return debug.space();
0
6734} -
6735 -
6736QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemChange change) -
6737{ -
6738 const char *str = "UnknownChange"; -
6739 switch (change) { -
6740 case QGraphicsItem::ItemChildAddedChange: -
6741 str = "ItemChildAddedChange"; -
6742 break;
never executed: break;
0
6743 case QGraphicsItem::ItemChildRemovedChange: -
6744 str = "ItemChildRemovedChange"; -
6745 break;
never executed: break;
0
6746 case QGraphicsItem::ItemCursorChange: -
6747 str = "ItemCursorChange"; -
6748 break;
never executed: break;
0
6749 case QGraphicsItem::ItemCursorHasChanged: -
6750 str = "ItemCursorHasChanged"; -
6751 break;
never executed: break;
0
6752 case QGraphicsItem::ItemEnabledChange: -
6753 str = "ItemEnabledChange"; -
6754 break;
never executed: break;
0
6755 case QGraphicsItem::ItemEnabledHasChanged: -
6756 str = "ItemEnabledHasChanged"; -
6757 break;
never executed: break;
0
6758 case QGraphicsItem::ItemFlagsChange: -
6759 str = "ItemFlagsChange"; -
6760 break;
never executed: break;
0
6761 case QGraphicsItem::ItemFlagsHaveChanged: -
6762 str = "ItemFlagsHaveChanged"; -
6763 break;
never executed: break;
0
6764 case QGraphicsItem::ItemMatrixChange: -
6765 str = "ItemMatrixChange"; -
6766 break;
never executed: break;
0
6767 case QGraphicsItem::ItemParentChange: -
6768 str = "ItemParentChange"; -
6769 break;
never executed: break;
0
6770 case QGraphicsItem::ItemParentHasChanged: -
6771 str = "ItemParentHasChanged"; -
6772 break;
never executed: break;
0
6773 case QGraphicsItem::ItemPositionChange: -
6774 str = "ItemPositionChange"; -
6775 break;
never executed: break;
0
6776 case QGraphicsItem::ItemPositionHasChanged: -
6777 str = "ItemPositionHasChanged"; -
6778 break;
never executed: break;
0
6779 case QGraphicsItem::ItemSceneChange: -
6780 str = "ItemSceneChange"; -
6781 break;
never executed: break;
0
6782 case QGraphicsItem::ItemSceneHasChanged: -
6783 str = "ItemSceneHasChanged"; -
6784 break;
never executed: break;
0
6785 case QGraphicsItem::ItemSelectedChange: -
6786 str = "ItemSelectedChange"; -
6787 break;
never executed: break;
0
6788 case QGraphicsItem::ItemSelectedHasChanged: -
6789 str = "ItemSelectedHasChanged"; -
6790 break;
never executed: break;
0
6791 case QGraphicsItem::ItemToolTipChange: -
6792 str = "ItemToolTipChange"; -
6793 break;
never executed: break;
0
6794 case QGraphicsItem::ItemToolTipHasChanged: -
6795 str = "ItemToolTipHasChanged"; -
6796 break;
never executed: break;
0
6797 case QGraphicsItem::ItemTransformChange: -
6798 str = "ItemTransformChange"; -
6799 break;
never executed: break;
0
6800 case QGraphicsItem::ItemTransformHasChanged: -
6801 str = "ItemTransformHasChanged"; -
6802 break;
never executed: break;
0
6803 case QGraphicsItem::ItemVisibleChange: -
6804 str = "ItemVisibleChange"; -
6805 break;
never executed: break;
0
6806 case QGraphicsItem::ItemVisibleHasChanged: -
6807 str = "ItemVisibleHasChanged"; -
6808 break;
never executed: break;
0
6809 case QGraphicsItem::ItemZValueChange: -
6810 str = "ItemZValueChange"; -
6811 break;
never executed: break;
0
6812 case QGraphicsItem::ItemZValueHasChanged: -
6813 str = "ItemZValueHasChanged"; -
6814 break;
never executed: break;
0
6815 case QGraphicsItem::ItemOpacityChange: -
6816 str = "ItemOpacityChange"; -
6817 break;
never executed: break;
0
6818 case QGraphicsItem::ItemOpacityHasChanged: -
6819 str = "ItemOpacityHasChanged"; -
6820 break;
never executed: break;
0
6821 case QGraphicsItem::ItemScenePositionHasChanged: -
6822 str = "ItemScenePositionHasChanged"; -
6823 break;
never executed: break;
0
6824 case QGraphicsItem::ItemRotationChange: -
6825 str = "ItemRotationChange"; -
6826 break;
never executed: break;
0
6827 case QGraphicsItem::ItemRotationHasChanged: -
6828 str = "ItemRotationHasChanged"; -
6829 break;
never executed: break;
0
6830 case QGraphicsItem::ItemScaleChange: -
6831 str = "ItemScaleChange"; -
6832 break;
never executed: break;
0
6833 case QGraphicsItem::ItemScaleHasChanged: -
6834 str = "ItemScaleHasChanged"; -
6835 break;
never executed: break;
0
6836 case QGraphicsItem::ItemTransformOriginPointChange: -
6837 str = "ItemTransformOriginPointChange"; -
6838 break;
never executed: break;
0
6839 case QGraphicsItem::ItemTransformOriginPointHasChanged: -
6840 str = "ItemTransformOriginPointHasChanged"; -
6841 break;
never executed: break;
0
6842 } -
6843 debug << str; -
6844 return debug;
never executed: return debug;
0
6845} -
6846 -
6847QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag) -
6848{ -
6849 const char *str = "UnknownFlag"; -
6850 switch (flag) { -
6851 case QGraphicsItem::ItemIsMovable: -
6852 str = "ItemIsMovable"; -
6853 break;
never executed: break;
0
6854 case QGraphicsItem::ItemIsSelectable: -
6855 str = "ItemIsSelectable"; -
6856 break;
never executed: break;
0
6857 case QGraphicsItem::ItemIsFocusable: -
6858 str = "ItemIsFocusable"; -
6859 break;
never executed: break;
0
6860 case QGraphicsItem::ItemClipsToShape: -
6861 str = "ItemClipsToShape"; -
6862 break;
never executed: break;
0
6863 case QGraphicsItem::ItemClipsChildrenToShape: -
6864 str = "ItemClipsChildrenToShape"; -
6865 break;
never executed: break;
0
6866 case QGraphicsItem::ItemIgnoresTransformations: -
6867 str = "ItemIgnoresTransformations"; -
6868 break;
never executed: break;
0
6869 case QGraphicsItem::ItemIgnoresParentOpacity: -
6870 str = "ItemIgnoresParentOpacity"; -
6871 break;
never executed: break;
0
6872 case QGraphicsItem::ItemDoesntPropagateOpacityToChildren: -
6873 str = "ItemDoesntPropagateOpacityToChildren"; -
6874 break;
never executed: break;
0
6875 case QGraphicsItem::ItemStacksBehindParent: -
6876 str = "ItemStacksBehindParent"; -
6877 break;
never executed: break;
0
6878 case QGraphicsItem::ItemUsesExtendedStyleOption: -
6879 str = "ItemUsesExtendedStyleOption"; -
6880 break;
never executed: break;
0
6881 case QGraphicsItem::ItemHasNoContents: -
6882 str = "ItemHasNoContents"; -
6883 break;
never executed: break;
0
6884 case QGraphicsItem::ItemSendsGeometryChanges: -
6885 str = "ItemSendsGeometryChanges"; -
6886 break;
never executed: break;
0
6887 case QGraphicsItem::ItemAcceptsInputMethod: -
6888 str = "ItemAcceptsInputMethod"; -
6889 break;
never executed: break;
0
6890 case QGraphicsItem::ItemNegativeZStacksBehindParent: -
6891 str = "ItemNegativeZStacksBehindParent"; -
6892 break;
never executed: break;
0
6893 case QGraphicsItem::ItemIsPanel: -
6894 str = "ItemIsPanel"; -
6895 break;
never executed: break;
0
6896 case QGraphicsItem::ItemIsFocusScope: -
6897 str = "ItemIsFocusScope"; -
6898 break;
never executed: break;
0
6899 case QGraphicsItem::ItemSendsScenePositionChanges: -
6900 str = "ItemSendsScenePositionChanges"; -
6901 break;
never executed: break;
0
6902 case QGraphicsItem::ItemStopsClickFocusPropagation: -
6903 str = "ItemStopsClickFocusPropagation"; -
6904 break;
never executed: break;
0
6905 case QGraphicsItem::ItemStopsFocusHandling: -
6906 str = "ItemStopsFocusHandling"; -
6907 break;
never executed: break;
0
6908 } -
6909 debug << str; -
6910 return debug;
never executed: return debug;
0
6911} -
6912 -
6913QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlags flags) -
6914{ -
6915 debug << '('; -
6916 bool f = false; -
6917 for (int i = 0; i < 17; ++i) {
never evaluated: i < 17
0
6918 if (flags & (1 << i)) {
never evaluated: flags & (1 << i)
0
6919 if (f)
never evaluated: f
0
6920 debug << '|';
never executed: debug << '|';
0
6921 f = true; -
6922 debug << QGraphicsItem::GraphicsItemFlag(int(flags & (1 << i))); -
6923 }
never executed: }
0
6924 }
never executed: }
0
6925 debug << ')'; -
6926 return debug;
never executed: return debug;
0
6927} -
6928 -
6929 -
6930 -
6931 -
6932 -
6933 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial