graphicsview/qgraphicsitem.cpp

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

Generated by Squish Coco Non-Commercial