Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); | - |
11 | | - |
12 | static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraphicsSceneMouseEvent *mouseEvent) | - |
13 | { | - |
14 | hover->setWidget(mouseEvent->widget()); | - |
15 | hover->setPos(mouseEvent->pos()); | - |
16 | hover->setScenePos(mouseEvent->scenePos()); | - |
17 | hover->setScreenPos(mouseEvent->screenPos()); | - |
18 | hover->setLastPos(mouseEvent->lastPos()); | - |
19 | hover->setLastScenePos(mouseEvent->lastScenePos()); | - |
20 | hover->setLastScreenPos(mouseEvent->lastScreenPos()); | - |
21 | hover->setModifiers(mouseEvent->modifiers()); | - |
22 | hover->setAccepted(mouseEvent->isAccepted()); | - |
23 | } executed: } Execution Count:261 | 261 |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | QGraphicsScenePrivate::QGraphicsScenePrivate() | - |
29 | : indexMethod(QGraphicsScene::BspTreeIndex), | - |
30 | index(0), | - |
31 | lastItemCount(0), | - |
32 | hasSceneRect(false), | - |
33 | dirtyGrowingItemsBoundingRect(true), | - |
34 | updateAll(false), | - |
35 | calledEmitUpdated(false), | - |
36 | processDirtyItemsEmitted(false), | - |
37 | needSortTopLevelItems(true), | - |
38 | holesInTopLevelSiblingIndex(false), | - |
39 | topLevelSequentialOrdering(true), | - |
40 | scenePosDescendantsUpdatePending(false), | - |
41 | stickyFocus(false), | - |
42 | hasFocus(false), | - |
43 | lastMouseGrabberItemHasImplicitMouseGrab(false), | - |
44 | allItemsIgnoreHoverEvents(true), | - |
45 | allItemsUseDefaultCursor(true), | - |
46 | painterStateProtection(true), | - |
47 | sortCacheEnabled(false), | - |
48 | allItemsIgnoreTouchEvents(true), | - |
49 | selectionChanging(0), | - |
50 | rectAdjust(2), | - |
51 | focusItem(0), | - |
52 | lastFocusItem(0), | - |
53 | passiveFocusItem(0), | - |
54 | tabFocusFirst(0), | - |
55 | activePanel(0), | - |
56 | lastActivePanel(0), | - |
57 | activationRefCount(0), | - |
58 | childExplicitActivation(0), | - |
59 | lastMouseGrabberItem(0), | - |
60 | dragDropItem(0), | - |
61 | enterWidget(0), | - |
62 | lastDropAction(Qt::IgnoreAction), | - |
63 | style(0) | - |
64 | { | - |
65 | } executed: } Execution Count:798 | 798 |
66 | | - |
67 | | - |
68 | | - |
69 | | - |
70 | void QGraphicsScenePrivate::init() | - |
71 | { | - |
72 | QGraphicsScene * const q = q_func(); | - |
73 | | - |
74 | index = new QGraphicsSceneBspTreeIndex(q); | - |
75 | | - |
76 | | - |
77 | changedSignalIndex = signalIndex("changed(QList<QRectF>)"); | - |
78 | processDirtyItemsIndex = q->metaObject()->indexOfSlot("_q_processDirtyItems()"); | - |
79 | polishItemsIndex = q->metaObject()->indexOfSlot("_q_polishItems()"); | - |
80 | | - |
81 | (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->scene_list.append(q); | - |
82 | q->update(); | - |
83 | } executed: } Execution Count:798 | 798 |
84 | | - |
85 | | - |
86 | | - |
87 | | - |
88 | QGraphicsScenePrivate *QGraphicsScenePrivate::get(QGraphicsScene *q) | - |
89 | { | - |
90 | return q->d_func(); never executed: return q->d_func(); | 0 |
91 | } | - |
92 | | - |
93 | void QGraphicsScenePrivate::_q_emitUpdated() | - |
94 | { | - |
95 | QGraphicsScene * const q = q_func(); | - |
96 | calledEmitUpdated = false; | - |
97 | | - |
98 | if (dirtyGrowingItemsBoundingRect) { evaluated: dirtyGrowingItemsBoundingRect yes Evaluation Count:164 | yes Evaluation Count:612 |
| 164-612 |
99 | if (!hasSceneRect) { evaluated: !hasSceneRect yes Evaluation Count:111 | yes Evaluation Count:53 |
| 53-111 |
100 | const QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect; | - |
101 | growingItemsBoundingRect |= q->itemsBoundingRect(); | - |
102 | if (oldGrowingItemsBoundingRect != growingItemsBoundingRect) evaluated: oldGrowingItemsBoundingRect != growingItemsBoundingRect yes Evaluation Count:110 | yes Evaluation Count:1 |
| 1-110 |
103 | q->sceneRectChanged(growingItemsBoundingRect); executed: q->sceneRectChanged(growingItemsBoundingRect); Execution Count:110 | 110 |
104 | } executed: } Execution Count:111 | 111 |
105 | dirtyGrowingItemsBoundingRect = false; | - |
106 | } executed: } Execution Count:164 | 164 |
107 | | - |
108 | | - |
109 | | - |
110 | | - |
111 | | - |
112 | if (isSignalConnected(changedSignalIndex)) { evaluated: isSignalConnected(changedSignalIndex) yes Evaluation Count:22 | yes Evaluation Count:754 |
| 22-754 |
113 | for (int i = 0; i < views.size(); ++i) { evaluated: i < views.size() yes Evaluation Count:22 | yes Evaluation Count:22 |
| 22 |
114 | QGraphicsView *view = views.at(i); | - |
115 | if (!view->d_func()->connectedToScene) { evaluated: !view->d_func()->connectedToScene yes Evaluation Count:10 | yes Evaluation Count:12 |
| 10-12 |
116 | view->d_func()->connectedToScene = true; | - |
117 | q->connect(q, "2""changed(QList<QRectF>)", | - |
118 | views.at(i), "1""updateScene(QList<QRectF>)"); | - |
119 | } executed: } Execution Count:10 | 10 |
120 | } executed: } Execution Count:22 | 22 |
121 | } else { executed: } Execution Count:22 | 22 |
122 | if (views.isEmpty()) { evaluated: views.isEmpty() yes Evaluation Count:15 | yes Evaluation Count:739 |
| 15-739 |
123 | updateAll = false; | - |
124 | return; executed: return; Execution Count:15 | 15 |
125 | } | - |
126 | for (int i = 0; i < views.size(); ++i) evaluated: i < views.size() yes Evaluation Count:739 | yes Evaluation Count:739 |
| 739 |
127 | views.at(i)->d_func()->processPendingUpdates(); executed: views.at(i)->d_func()->processPendingUpdates(); Execution Count:739 | 739 |
128 | | - |
129 | for (int i = 0; i < views.size(); ++i) evaluated: i < views.size() yes Evaluation Count:739 | yes Evaluation Count:739 |
| 739 |
130 | views.at(i)->d_func()->dispatchPendingUpdateRequests(); executed: views.at(i)->d_func()->dispatchPendingUpdateRequests(); Execution Count:739 | 739 |
131 | return; executed: return; Execution Count:739 | 739 |
132 | } | - |
133 | | - |
134 | | - |
135 | QList<QRectF> oldUpdatedRects; | - |
136 | oldUpdatedRects = updateAll ? (QList<QRectF>() << q->sceneRect()) : updatedRects; evaluated: updateAll yes Evaluation Count:12 | yes Evaluation Count:10 |
| 10-12 |
137 | updateAll = false; | - |
138 | updatedRects.clear(); | - |
139 | q->changed(oldUpdatedRects); | - |
140 | } executed: } Execution Count:22 | 22 |
141 | | - |
142 | | - |
143 | | - |
144 | | - |
145 | | - |
146 | | - |
147 | void QGraphicsScenePrivate::registerTopLevelItem(QGraphicsItem *item) | - |
148 | { | - |
149 | item->d_ptr->ensureSequentialSiblingIndex(); | - |
150 | needSortTopLevelItems = true; | - |
151 | item->d_ptr->siblingIndex = topLevelItems.size(); | - |
152 | topLevelItems.append(item); | - |
153 | } executed: } Execution Count:973 | 973 |
154 | | - |
155 | | - |
156 | | - |
157 | | - |
158 | | - |
159 | | - |
160 | void QGraphicsScenePrivate::unregisterTopLevelItem(QGraphicsItem *item) | - |
161 | { | - |
162 | if (!holesInTopLevelSiblingIndex) evaluated: !holesInTopLevelSiblingIndex yes Evaluation Count:748 | yes Evaluation Count:205 |
| 205-748 |
163 | holesInTopLevelSiblingIndex = item->d_ptr->siblingIndex != topLevelItems.size() - 1; executed: holesInTopLevelSiblingIndex = item->d_ptr->siblingIndex != topLevelItems.size() - 1; Execution Count:748 | 748 |
164 | if (topLevelSequentialOrdering && !holesInTopLevelSiblingIndex) evaluated: topLevelSequentialOrdering yes Evaluation Count:748 | yes Evaluation Count:205 |
evaluated: !holesInTopLevelSiblingIndex yes Evaluation Count:698 | yes Evaluation Count:50 |
| 50-748 |
165 | topLevelItems.removeAt(item->d_ptr->siblingIndex); executed: topLevelItems.removeAt(item->d_ptr->siblingIndex); Execution Count:698 | 698 |
166 | else | - |
167 | topLevelItems.removeOne(item); executed: topLevelItems.removeOne(item); Execution Count:255 | 255 |
168 | | - |
169 | | - |
170 | | - |
171 | item->d_ptr->siblingIndex = -1; | - |
172 | if (topLevelSequentialOrdering) evaluated: topLevelSequentialOrdering yes Evaluation Count:748 | yes Evaluation Count:205 |
| 205-748 |
173 | topLevelSequentialOrdering = !holesInTopLevelSiblingIndex; executed: topLevelSequentialOrdering = !holesInTopLevelSiblingIndex; Execution Count:748 | 748 |
174 | } executed: } Execution Count:953 | 953 |
175 | | - |
176 | | - |
177 | | - |
178 | | - |
179 | void QGraphicsScenePrivate::_q_polishItems() | - |
180 | { | - |
181 | if (unpolishedItems.isEmpty()) evaluated: unpolishedItems.isEmpty() yes Evaluation Count:6 | yes Evaluation Count:290 |
| 6-290 |
182 | return; executed: return; Execution Count:6 | 6 |
183 | | - |
184 | const QVariant booleanTrueVariant(true); | - |
185 | QGraphicsItem *item = 0; | - |
186 | QGraphicsItemPrivate *itemd = 0; | - |
187 | const int oldUnpolishedCount = unpolishedItems.count(); | - |
188 | | - |
189 | for (int i = 0; i < oldUnpolishedCount; ++i) { evaluated: i < oldUnpolishedCount yes Evaluation Count:1075 | yes Evaluation Count:290 |
| 290-1075 |
190 | item = unpolishedItems.at(i); | - |
191 | if (!item) evaluated: !item yes Evaluation Count:4 | yes Evaluation Count:1071 |
| 4-1071 |
192 | continue; executed: continue; Execution Count:4 | 4 |
193 | itemd = item->d_ptr.data(); | - |
194 | itemd->pendingPolish = false; | - |
195 | if (!itemd->explicitlyHidden) { evaluated: !itemd->explicitlyHidden yes Evaluation Count:1070 | yes Evaluation Count:1 |
| 1-1070 |
196 | item->itemChange(QGraphicsItem::ItemVisibleChange, booleanTrueVariant); | - |
197 | item->itemChange(QGraphicsItem::ItemVisibleHasChanged, booleanTrueVariant); | - |
198 | } executed: } Execution Count:1070 | 1070 |
199 | if (itemd->isWidget) { evaluated: itemd->isWidget yes Evaluation Count:746 | yes Evaluation Count:325 |
| 325-746 |
200 | QEvent event(QEvent::Polish); | - |
201 | QApplication::sendEvent((QGraphicsWidget *)item, &event); | - |
202 | } executed: } Execution Count:746 | 746 |
203 | } executed: } Execution Count:1071 | 1071 |
204 | | - |
205 | if (unpolishedItems.count() == oldUnpolishedCount) { partially evaluated: unpolishedItems.count() == oldUnpolishedCount yes Evaluation Count:290 | no Evaluation Count:0 |
| 0-290 |
206 | | - |
207 | unpolishedItems.clear(); | - |
208 | } else { executed: } Execution Count:290 | 290 |
209 | | - |
210 | unpolishedItems.remove(0, oldUnpolishedCount); | - |
211 | unpolishedItems.squeeze(); | - |
212 | QMetaObject::invokeMethod(q_ptr, "_q_polishItems", Qt::QueuedConnection); | - |
213 | } | 0 |
214 | } | - |
215 | | - |
216 | void QGraphicsScenePrivate::_q_processDirtyItems() | - |
217 | { | - |
218 | processDirtyItemsEmitted = false; | - |
219 | | - |
220 | if (updateAll) { evaluated: updateAll yes Evaluation Count:2 | yes Evaluation Count:234 |
| 2-234 |
221 | qt_noop(); | - |
222 | | - |
223 | | - |
224 | for (int i = 0; i < topLevelItems.size(); ++i) evaluated: i < topLevelItems.size() yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
225 | resetDirtyItem(topLevelItems.at(i), true); executed: resetDirtyItem(topLevelItems.at(i), true); Execution Count:2 | 2 |
226 | return; executed: return; Execution Count:2 | 2 |
227 | } | - |
228 | | - |
229 | const bool wasPendingSceneUpdate = calledEmitUpdated; | - |
230 | const QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect; | - |
231 | | - |
232 | | - |
233 | for (int i = 0; i < topLevelItems.size(); ++i) evaluated: i < topLevelItems.size() yes Evaluation Count:1011 | yes Evaluation Count:234 |
| 234-1011 |
234 | processDirtyItemsRecursive(topLevelItems.at(i)); executed: processDirtyItemsRecursive(topLevelItems.at(i)); Execution Count:1011 | 1011 |
235 | | - |
236 | dirtyGrowingItemsBoundingRect = false; | - |
237 | if (!hasSceneRect && oldGrowingItemsBoundingRect != growingItemsBoundingRect) evaluated: !hasSceneRect yes Evaluation Count:209 | yes Evaluation Count:25 |
evaluated: oldGrowingItemsBoundingRect != growingItemsBoundingRect yes Evaluation Count:23 | yes Evaluation Count:186 |
| 23-209 |
238 | q_func()->sceneRectChanged(growingItemsBoundingRect); executed: q_func()->sceneRectChanged(growingItemsBoundingRect); Execution Count:23 | 23 |
239 | | - |
240 | if (wasPendingSceneUpdate) evaluated: wasPendingSceneUpdate yes Evaluation Count:5 | yes Evaluation Count:229 |
| 5-229 |
241 | return; executed: return; Execution Count:5 | 5 |
242 | | - |
243 | for (int i = 0; i < views.size(); ++i) evaluated: i < views.size() yes Evaluation Count:226 | yes Evaluation Count:229 |
| 226-229 |
244 | views.at(i)->d_func()->processPendingUpdates(); executed: views.at(i)->d_func()->processPendingUpdates(); Execution Count:226 | 226 |
245 | | - |
246 | if (calledEmitUpdated) { evaluated: calledEmitUpdated yes Evaluation Count:7 | yes Evaluation Count:222 |
| 7-222 |
247 | | - |
248 | | - |
249 | | - |
250 | _q_emitUpdated(); | - |
251 | } executed: } Execution Count:7 | 7 |
252 | | - |
253 | | - |
254 | for (int i = 0; i < views.size(); ++i) evaluated: i < views.size() yes Evaluation Count:226 | yes Evaluation Count:229 |
| 226-229 |
255 | views.at(i)->d_func()->dispatchPendingUpdateRequests(); executed: views.at(i)->d_func()->dispatchPendingUpdateRequests(); Execution Count:226 | 226 |
256 | } executed: } Execution Count:229 | 229 |
257 | | - |
258 | | - |
259 | | - |
260 | | - |
261 | void QGraphicsScenePrivate::setScenePosItemEnabled(QGraphicsItem *item, bool enabled) | - |
262 | { | - |
263 | QGraphicsItem *p = item->d_ptr->parent; | - |
264 | while (p) { | 0 |
265 | p->d_ptr->scenePosDescendants = enabled; | - |
266 | p = p->d_ptr->parent; | - |
267 | } | 0 |
268 | if (!enabled && !scenePosDescendantsUpdatePending) { never evaluated: !enabled never evaluated: !scenePosDescendantsUpdatePending | 0 |
269 | scenePosDescendantsUpdatePending = true; | - |
270 | QMetaObject::invokeMethod(q_func(), "_q_updateScenePosDescendants", Qt::QueuedConnection); | - |
271 | } | 0 |
272 | } | 0 |
273 | | - |
274 | | - |
275 | | - |
276 | | - |
277 | void QGraphicsScenePrivate::registerScenePosItem(QGraphicsItem *item) | - |
278 | { | - |
279 | scenePosItems.insert(item); | - |
280 | setScenePosItemEnabled(item, true); | - |
281 | } | 0 |
282 | | - |
283 | | - |
284 | | - |
285 | | - |
286 | void QGraphicsScenePrivate::unregisterScenePosItem(QGraphicsItem *item) | - |
287 | { | - |
288 | scenePosItems.remove(item); | - |
289 | setScenePosItemEnabled(item, false); | - |
290 | } | 0 |
291 | | - |
292 | | - |
293 | | - |
294 | | - |
295 | void QGraphicsScenePrivate::_q_updateScenePosDescendants() | - |
296 | { | - |
297 | for (QForeachContainer<__typeof__(scenePosItems)> _container_(scenePosItems); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
298 | QGraphicsItem *p = item->d_ptr->parent; | - |
299 | while (p) { | 0 |
300 | p->d_ptr->scenePosDescendants = 1; | - |
301 | p = p->d_ptr->parent; | - |
302 | } | 0 |
303 | } | 0 |
304 | scenePosDescendantsUpdatePending = false; | - |
305 | } | 0 |
306 | void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) | - |
307 | { | - |
308 | QGraphicsScene * const q = q_func(); | - |
309 | | - |
310 | | - |
311 | item->clearFocus(); | - |
312 | | - |
313 | markDirty(item, QRectF(), false, false, | - |
314 | false, true); | - |
315 | | - |
316 | if (item->d_ptr->inDestructor) { evaluated: item->d_ptr->inDestructor yes Evaluation Count:1686 | yes Evaluation Count:14 |
| 14-1686 |
317 | | - |
318 | index->deleteItem(item); | - |
319 | } else { executed: } Execution Count:1686 | 1686 |
320 | | - |
321 | | - |
322 | index->removeItem(item); | - |
323 | } executed: } Execution Count:14 | 14 |
324 | | - |
325 | item->d_ptr->clearSubFocus(); | - |
326 | | - |
327 | if (item->flags() & QGraphicsItem::ItemSendsScenePositionChanges) partially evaluated: item->flags() & QGraphicsItem::ItemSendsScenePositionChanges no Evaluation Count:0 | yes Evaluation Count:1700 |
| 0-1700 |
328 | unregisterScenePosItem(item); never executed: unregisterScenePosItem(item); | 0 |
329 | | - |
330 | QGraphicsScene *oldScene = item->d_func()->scene; | - |
331 | item->d_func()->scene = 0; | - |
332 | | - |
333 | | - |
334 | | - |
335 | if (!item->d_ptr->inDestructor) { evaluated: !item->d_ptr->inDestructor yes Evaluation Count:14 | yes Evaluation Count:1686 |
| 14-1686 |
336 | | - |
337 | for (int i = 0; i < item->d_ptr->children.size(); ++i) partially evaluated: i < item->d_ptr->children.size() no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
338 | q->removeItem(item->d_ptr->children.at(i)); never executed: q->removeItem(item->d_ptr->children.at(i)); | 0 |
339 | } executed: } Execution Count:14 | 14 |
340 | | - |
341 | if (!item->d_ptr->inDestructor && item == tabFocusFirst) { evaluated: !item->d_ptr->inDestructor yes Evaluation Count:14 | yes Evaluation Count:1686 |
partially evaluated: item == tabFocusFirst no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-1686 |
342 | QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); | - |
343 | widget->d_func()->fixFocusChainBeforeReparenting(0, oldScene, 0); | - |
344 | } | 0 |
345 | | - |
346 | | - |
347 | item->d_ptr->resetFocusProxy(); | - |
348 | | - |
349 | | - |
350 | if (QGraphicsItem *parentItem = item->parentItem()) { evaluated: QGraphicsItem *parentItem = item->parentItem() yes Evaluation Count:759 | yes Evaluation Count:941 |
| 759-941 |
351 | if (parentItem->scene()) { evaluated: parentItem->scene() yes Evaluation Count:752 | yes Evaluation Count:7 |
| 7-752 |
352 | qt_noop(); | - |
353 | | - |
354 | item->setParentItem(0); | - |
355 | } executed: } Execution Count:752 | 752 |
356 | } else { executed: } Execution Count:759 | 759 |
357 | unregisterTopLevelItem(item); | - |
358 | } executed: } Execution Count:941 | 941 |
359 | | - |
360 | | - |
361 | if (item == focusItem) partially evaluated: item == focusItem no Evaluation Count:0 | yes Evaluation Count:1700 |
| 0-1700 |
362 | focusItem = 0; never executed: focusItem = 0; | 0 |
363 | if (item == lastFocusItem) evaluated: item == lastFocusItem yes Evaluation Count:6 | yes Evaluation Count:1694 |
| 6-1694 |
364 | lastFocusItem = 0; executed: lastFocusItem = 0; Execution Count:6 | 6 |
365 | if (item == passiveFocusItem) evaluated: item == passiveFocusItem yes Evaluation Count:1 | yes Evaluation Count:1699 |
| 1-1699 |
366 | passiveFocusItem = 0; executed: passiveFocusItem = 0; Execution Count:1 | 1 |
367 | if (item == activePanel) { evaluated: item == activePanel yes Evaluation Count:16 | yes Evaluation Count:1684 |
| 16-1684 |
368 | | - |
369 | activePanel = 0; | - |
370 | } executed: } Execution Count:16 | 16 |
371 | if (item == lastActivePanel) evaluated: item == lastActivePanel yes Evaluation Count:162 | yes Evaluation Count:1538 |
| 162-1538 |
372 | lastActivePanel = 0; executed: lastActivePanel = 0; Execution Count:162 | 162 |
373 | | - |
374 | | - |
375 | { | - |
376 | QMap<int, QGraphicsItem *>::iterator it = itemForTouchPointId.begin(); | - |
377 | while (it != itemForTouchPointId.end()) { partially evaluated: it != itemForTouchPointId.end() no Evaluation Count:0 | yes Evaluation Count:1700 |
| 0-1700 |
378 | if (it.value() == item) { never evaluated: it.value() == item | 0 |
379 | sceneCurrentTouchPoints.remove(it.key()); | - |
380 | it = itemForTouchPointId.erase(it); | - |
381 | } else { | 0 |
382 | ++it; | - |
383 | } | 0 |
384 | } | - |
385 | } | - |
386 | | - |
387 | | - |
388 | ++selectionChanging; | - |
389 | int oldSelectedItemsSize = selectedItems.size(); | - |
390 | | - |
391 | | - |
392 | selectedItems.remove(item); | - |
393 | hoverItems.removeAll(item); | - |
394 | cachedItemsUnderMouse.removeAll(item); | - |
395 | if (item->d_ptr->pendingPolish) { evaluated: item->d_ptr->pendingPolish yes Evaluation Count:649 | yes Evaluation Count:1051 |
| 649-1051 |
396 | const int unpolishedIndex = unpolishedItems.indexOf(item); | - |
397 | if (unpolishedIndex != -1) partially evaluated: unpolishedIndex != -1 yes Evaluation Count:649 | no Evaluation Count:0 |
| 0-649 |
398 | unpolishedItems[unpolishedIndex] = 0; executed: unpolishedItems[unpolishedIndex] = 0; Execution Count:649 | 649 |
399 | item->d_ptr->pendingPolish = false; | - |
400 | } executed: } Execution Count:649 | 649 |
401 | resetDirtyItem(item); | - |
402 | | - |
403 | | - |
404 | QMultiMap<QGraphicsItem*, QGraphicsItem*>::iterator iterator = sceneEventFilters.begin(); | - |
405 | while (iterator != sceneEventFilters.end()) { partially evaluated: iterator != sceneEventFilters.end() no Evaluation Count:0 | yes Evaluation Count:1700 |
| 0-1700 |
406 | if (iterator.value() == item || iterator.key() == item) never evaluated: iterator.value() == item never evaluated: iterator.key() == item | 0 |
407 | iterator = sceneEventFilters.erase(iterator); never executed: iterator = sceneEventFilters.erase(iterator); | 0 |
408 | else | - |
409 | ++iterator; never executed: ++iterator; | 0 |
410 | } | - |
411 | | - |
412 | if (item->isPanel() && item->isVisible() && item->panelModality() != QGraphicsItem::NonModal) evaluated: item->isPanel() yes Evaluation Count:177 | yes Evaluation Count:1523 |
partially evaluated: item->isVisible() yes Evaluation Count:177 | no Evaluation Count:0 |
evaluated: item->panelModality() != QGraphicsItem::NonModal yes Evaluation Count:2 | yes Evaluation Count:175 |
| 0-1523 |
413 | leaveModal(item); executed: leaveModal(item); Execution Count:2 | 2 |
414 | | - |
415 | | - |
416 | if (mouseGrabberItems.contains(item)) evaluated: mouseGrabberItems.contains(item) yes Evaluation Count:1 | yes Evaluation Count:1699 |
| 1-1699 |
417 | ungrabMouse(item, item->d_ptr->inDestructor); executed: ungrabMouse(item, item->d_ptr->inDestructor); Execution Count:1 | 1 |
418 | | - |
419 | | - |
420 | if (keyboardGrabberItems.contains(item)) partially evaluated: keyboardGrabberItems.contains(item) no Evaluation Count:0 | yes Evaluation Count:1700 |
| 0-1700 |
421 | ungrabKeyboard(item, item->d_ptr->inDestructor); never executed: ungrabKeyboard(item, item->d_ptr->inDestructor); | 0 |
422 | | - |
423 | | - |
424 | if (item == lastMouseGrabberItem) evaluated: item == lastMouseGrabberItem yes Evaluation Count:4 | yes Evaluation Count:1696 |
| 4-1696 |
425 | lastMouseGrabberItem = 0; executed: lastMouseGrabberItem = 0; Execution Count:4 | 4 |
426 | | - |
427 | | - |
428 | if (item == dragDropItem) partially evaluated: item == dragDropItem no Evaluation Count:0 | yes Evaluation Count:1700 |
| 0-1700 |
429 | dragDropItem = 0; never executed: dragDropItem = 0; | 0 |
430 | | - |
431 | | - |
432 | --selectionChanging; | - |
433 | if (!selectionChanging && selectedItems.size() != oldSelectedItemsSize) partially evaluated: !selectionChanging yes Evaluation Count:1700 | no Evaluation Count:0 |
evaluated: selectedItems.size() != oldSelectedItemsSize yes Evaluation Count:4 | yes Evaluation Count:1696 |
| 0-1700 |
434 | q->selectionChanged(); executed: q->selectionChanged(); Execution Count:4 | 4 |
435 | | - |
436 | | - |
437 | QHash<QGesture *, QGraphicsObject *>::iterator it; | - |
438 | for (it = gestureTargets.begin(); it != gestureTargets.end();) { evaluated: it != gestureTargets.end() yes Evaluation Count:2 | yes Evaluation Count:1700 |
| 2-1700 |
439 | if (it.value() == item) partially evaluated: it.value() == item yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
440 | it = gestureTargets.erase(it); executed: it = gestureTargets.erase(it); Execution Count:2 | 2 |
441 | else | - |
442 | ++it; | 0 |
443 | } | - |
444 | | - |
445 | QGraphicsObject *dummy = static_cast<QGraphicsObject *>(item); | - |
446 | cachedTargetItems.removeOne(dummy); | - |
447 | cachedItemGestures.remove(dummy); | - |
448 | cachedAlreadyDeliveredGestures.remove(dummy); | - |
449 | | - |
450 | for (QForeachContainer<__typeof__(item->d_ptr->gestureContext.keys())> _container_(item->d_ptr->gestureContext.keys()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (Qt::GestureType gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
451 | ungrabGesture(item, gesture); executed: ungrabGesture(item, gesture); Execution Count:50 | 50 |
452 | | - |
453 | } executed: } Execution Count:1700 | 1700 |
454 | | - |
455 | | - |
456 | | - |
457 | | - |
458 | void QGraphicsScenePrivate::setActivePanelHelper(QGraphicsItem *item, bool duringActivationEvent) | - |
459 | { | - |
460 | QGraphicsScene * const q = q_func(); | - |
461 | if (item && item->scene() != q) { partially evaluated: item yes Evaluation Count:19 | no Evaluation Count:0 |
partially evaluated: item->scene() != q no Evaluation Count:0 | yes Evaluation Count:19 |
| 0-19 |
462 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 728, __PRETTY_FUNCTION__).warning("QGraphicsScene::setActivePanel: item %p must be part of this scene", | - |
463 | item); | - |
464 | return; | 0 |
465 | } | - |
466 | | - |
467 | | - |
468 | q->setFocus(Qt::ActiveWindowFocusReason); | - |
469 | | - |
470 | | - |
471 | QGraphicsItem *panel = item ? item->panel() : 0; partially evaluated: item yes Evaluation Count:19 | no Evaluation Count:0 |
| 0-19 |
472 | lastActivePanel = panel ? activePanel : 0; evaluated: panel yes Evaluation Count:18 | yes Evaluation Count:1 |
| 1-18 |
473 | if (panel == activePanel || (!q->isActive() && !duringActivationEvent)) evaluated: panel == activePanel yes Evaluation Count:3 | yes Evaluation Count:16 |
partially evaluated: !q->isActive() no Evaluation Count:0 | yes Evaluation Count:16 |
never evaluated: !duringActivationEvent | 0-16 |
474 | return; executed: return; Execution Count:3 | 3 |
475 | | - |
476 | | - |
477 | if (activePanel) { partially evaluated: activePanel no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
478 | if (QGraphicsItem *fi = activePanel->focusItem()) { never evaluated: QGraphicsItem *fi = activePanel->focusItem() | 0 |
479 | | - |
480 | if (fi == q->focusItem()) never evaluated: fi == q->focusItem() | 0 |
481 | q->setFocusItem(0, Qt::ActiveWindowFocusReason); never executed: q->setFocusItem(0, Qt::ActiveWindowFocusReason); | 0 |
482 | } | 0 |
483 | | - |
484 | QEvent event(QEvent::WindowDeactivate); | - |
485 | q->sendEvent(activePanel, &event); | - |
486 | } else if (panel && !duringActivationEvent) { partially evaluated: panel yes Evaluation Count:16 | no Evaluation Count:0 |
evaluated: !duringActivationEvent yes Evaluation Count:2 | yes Evaluation Count:14 |
| 0-16 |
487 | | - |
488 | QEvent event(QEvent::WindowDeactivate); | - |
489 | for (QForeachContainer<__typeof__(q->items())> _container_(q->items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
490 | if (item->isVisible() && !item->isPanel() && !item->parentItem()) partially evaluated: item->isVisible() yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: !item->isPanel() no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: !item->parentItem() | 0-2 |
491 | q->sendEvent(item, &event); never executed: q->sendEvent(item, &event); | 0 |
492 | } executed: } Execution Count:2 | 2 |
493 | } executed: } Execution Count:2 | 2 |
494 | | - |
495 | | - |
496 | activePanel = panel; | - |
497 | QEvent event(QEvent::ActivationChange); | - |
498 | QApplication::sendEvent(q, &event); | - |
499 | | - |
500 | | - |
501 | if (panel) { partially evaluated: panel yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
502 | QEvent event(QEvent::WindowActivate); | - |
503 | q->sendEvent(panel, &event); | - |
504 | | - |
505 | | - |
506 | if (QGraphicsItem *focusItem = panel->focusItem()) partially evaluated: QGraphicsItem *focusItem = panel->focusItem() no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
507 | focusItem->setFocus(Qt::ActiveWindowFocusReason); never executed: focusItem->setFocus(Qt::ActiveWindowFocusReason); | 0 |
508 | } else if (q->isActive()) { never evaluated: q->isActive() executed: } Execution Count:16 | 0-16 |
509 | | - |
510 | QEvent event(QEvent::WindowActivate); | - |
511 | for (QForeachContainer<__typeof__(q->items())> _container_(q->items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
512 | if (item->isVisible() && !item->isPanel() && !item->parentItem()) never evaluated: item->isVisible() never evaluated: !item->isPanel() never evaluated: !item->parentItem() | 0 |
513 | q->sendEvent(item, &event); never executed: q->sendEvent(item, &event); | 0 |
514 | } | 0 |
515 | } | 0 |
516 | } | - |
517 | | - |
518 | | - |
519 | | - |
520 | | - |
521 | void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, | - |
522 | Qt::FocusReason focusReason) | - |
523 | { | - |
524 | QGraphicsScene * const q = q_func(); | - |
525 | if (item == focusItem) evaluated: item == focusItem yes Evaluation Count:124 | yes Evaluation Count:21 |
| 21-124 |
526 | return; executed: return; Execution Count:124 | 124 |
527 | | - |
528 | | - |
529 | | - |
530 | if (item && (!(item->flags() & QGraphicsItem::ItemIsFocusable) evaluated: item yes Evaluation Count:13 | yes Evaluation Count:8 |
partially evaluated: !(item->flags() & QGraphicsItem::ItemIsFocusable) no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
531 | || !item->isVisible() || !item->isEnabled())) { partially evaluated: !item->isVisible() no Evaluation Count:0 | yes Evaluation Count:13 |
partially evaluated: !item->isEnabled() no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
532 | item = 0; | - |
533 | } | 0 |
534 | | - |
535 | | - |
536 | if (item) { evaluated: item yes Evaluation Count:13 | yes Evaluation Count:8 |
| 8-13 |
537 | q->setFocus(focusReason); | - |
538 | if (item == focusItem) partially evaluated: item == focusItem no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
539 | return; | 0 |
540 | } executed: } Execution Count:13 | 13 |
541 | | - |
542 | if (focusItem) { evaluated: focusItem yes Evaluation Count:13 | yes Evaluation Count:8 |
| 8-13 |
543 | lastFocusItem = focusItem; | - |
544 | | - |
545 | | - |
546 | if (lastFocusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod) { evaluated: lastFocusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod yes Evaluation Count:8 | yes Evaluation Count:5 |
| 5-8 |
547 | | - |
548 | | - |
549 | | - |
550 | | - |
551 | if ((static_cast<QApplication *>(QCoreApplication::instance()))) partially evaluated: (static_cast<QApplication *>(QCoreApplication::instance())) yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
552 | (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit(); executed: (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit(); Execution Count:8 | 8 |
553 | } executed: } Execution Count:8 | 8 |
554 | | - |
555 | | - |
556 | focusItem = 0; | - |
557 | QFocusEvent event(QEvent::FocusOut, focusReason); | - |
558 | sendEvent(lastFocusItem, &event); | - |
559 | } executed: } Execution Count:13 | 13 |
560 | | - |
561 | | - |
562 | | - |
563 | if (item && item->scene() != q) evaluated: item yes Evaluation Count:13 | yes Evaluation Count:8 |
partially evaluated: item->scene() != q no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
564 | item = 0; never executed: item = 0; | 0 |
565 | | - |
566 | if (item) evaluated: item yes Evaluation Count:13 | yes Evaluation Count:8 |
| 8-13 |
567 | focusItem = item; executed: focusItem = item; Execution Count:13 | 13 |
568 | updateInputMethodSensitivityInViews(); | - |
569 | | - |
570 | if (item) { evaluated: item yes Evaluation Count:13 | yes Evaluation Count:8 |
| 8-13 |
571 | QFocusEvent event(QEvent::FocusIn, focusReason); | - |
572 | sendEvent(item, &event); | - |
573 | } executed: } Execution Count:13 | 13 |
574 | } executed: } Execution Count:21 | 21 |
575 | | - |
576 | | - |
577 | | - |
578 | | - |
579 | void QGraphicsScenePrivate::addPopup(QGraphicsWidget *widget) | - |
580 | { | - |
581 | qt_noop(); | - |
582 | qt_noop(); | - |
583 | popupWidgets << widget; | - |
584 | if (QGraphicsWidget *focusWidget = widget->focusWidget()) { never evaluated: QGraphicsWidget *focusWidget = widget->focusWidget() | 0 |
585 | focusWidget->setFocus(Qt::PopupFocusReason); | - |
586 | } else { | 0 |
587 | grabKeyboard((QGraphicsItem *)widget); | - |
588 | if (focusItem && popupWidgets.size() == 1) { never evaluated: focusItem never evaluated: popupWidgets.size() == 1 | 0 |
589 | QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); | - |
590 | sendEvent(focusItem, &event); | - |
591 | } | 0 |
592 | } | 0 |
593 | grabMouse((QGraphicsItem *)widget); | - |
594 | } | 0 |
595 | void QGraphicsScenePrivate::removePopup(QGraphicsWidget *widget, bool itemIsDying) | - |
596 | { | - |
597 | qt_noop(); | - |
598 | int index = popupWidgets.indexOf(widget); | - |
599 | qt_noop(); | - |
600 | | - |
601 | for (int i = popupWidgets.size() - 1; i >= index; --i) { never evaluated: i >= index | 0 |
602 | QGraphicsWidget *widget = popupWidgets.takeLast(); | - |
603 | ungrabMouse(widget, itemIsDying); | - |
604 | if (focusItem && popupWidgets.isEmpty()) { never evaluated: focusItem never evaluated: popupWidgets.isEmpty() | 0 |
605 | QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason); | - |
606 | sendEvent(focusItem, &event); | - |
607 | } else if (keyboardGrabberItems.contains(static_cast<QGraphicsItem *>(widget))) { never evaluated: keyboardGrabberItems.contains(static_cast<QGraphicsItem *>(widget)) | 0 |
608 | ungrabKeyboard(static_cast<QGraphicsItem *>(widget), itemIsDying); | - |
609 | } | 0 |
610 | if (!itemIsDying && widget->isVisible()) { never evaluated: !itemIsDying never evaluated: widget->isVisible() | 0 |
611 | widget->QGraphicsItem::d_ptr->setVisibleHelper(false, false); | - |
612 | } | 0 |
613 | } | 0 |
614 | } | 0 |
615 | | - |
616 | | - |
617 | | - |
618 | | - |
619 | void QGraphicsScenePrivate::grabMouse(QGraphicsItem *item, bool implicit) | - |
620 | { | - |
621 | | - |
622 | if (mouseGrabberItems.contains(item)) { partially evaluated: mouseGrabberItems.contains(item) no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
623 | if (mouseGrabberItems.last() == item) { never evaluated: mouseGrabberItems.last() == item | 0 |
624 | qt_noop(); | - |
625 | if (!lastMouseGrabberItemHasImplicitMouseGrab) { never evaluated: !lastMouseGrabberItemHasImplicitMouseGrab | 0 |
626 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 902, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabMouse: already a mouse grabber"); | - |
627 | } else { | 0 |
628 | | - |
629 | lastMouseGrabberItemHasImplicitMouseGrab = false; | - |
630 | } | 0 |
631 | } else { | - |
632 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 908, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabMouse: already blocked by mouse grabber: %p", | - |
633 | mouseGrabberItems.last()); | - |
634 | } | 0 |
635 | return; | 0 |
636 | } | - |
637 | | - |
638 | | - |
639 | if (!mouseGrabberItems.isEmpty()) { partially evaluated: !mouseGrabberItems.isEmpty() no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
640 | QGraphicsItem *last = mouseGrabberItems.last(); | - |
641 | if (lastMouseGrabberItemHasImplicitMouseGrab) { never evaluated: lastMouseGrabberItemHasImplicitMouseGrab | 0 |
642 | | - |
643 | last->ungrabMouse(); | - |
644 | } else { | 0 |
645 | | - |
646 | QEvent ungrabEvent(QEvent::UngrabMouse); | - |
647 | sendEvent(last, &ungrabEvent); | - |
648 | } | 0 |
649 | } | - |
650 | | - |
651 | mouseGrabberItems << item; | - |
652 | lastMouseGrabberItemHasImplicitMouseGrab = implicit; | - |
653 | | - |
654 | | - |
655 | QEvent grabEvent(QEvent::GrabMouse); | - |
656 | sendEvent(item, &grabEvent); | - |
657 | } executed: } Execution Count:105 | 105 |
658 | | - |
659 | | - |
660 | | - |
661 | | - |
662 | void QGraphicsScenePrivate::ungrabMouse(QGraphicsItem *item, bool itemIsDying) | - |
663 | { | - |
664 | int index = mouseGrabberItems.indexOf(item); | - |
665 | if (index == -1) { partially evaluated: index == -1 no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
666 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 942, __PRETTY_FUNCTION__).warning("QGraphicsItem::ungrabMouse: not a mouse grabber"); | - |
667 | return; | 0 |
668 | } | - |
669 | | - |
670 | if (item != mouseGrabberItems.last()) { partially evaluated: item != mouseGrabberItems.last() no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
671 | | - |
672 | | - |
673 | ungrabMouse(mouseGrabberItems.at(index + 1), itemIsDying); | - |
674 | } | 0 |
675 | if (!popupWidgets.isEmpty() && item == popupWidgets.last()) { partially evaluated: !popupWidgets.isEmpty() no Evaluation Count:0 | yes Evaluation Count:105 |
never evaluated: item == popupWidgets.last() | 0-105 |
676 | | - |
677 | | - |
678 | | - |
679 | removePopup((QGraphicsWidget *)item, itemIsDying); | - |
680 | return; | 0 |
681 | } | - |
682 | | - |
683 | | - |
684 | if (!itemIsDying) { evaluated: !itemIsDying yes Evaluation Count:104 | yes Evaluation Count:1 |
| 1-104 |
685 | QEvent event(QEvent::UngrabMouse); | - |
686 | sendEvent(item, &event); | - |
687 | } executed: } Execution Count:104 | 104 |
688 | | - |
689 | | - |
690 | | - |
691 | | - |
692 | | - |
693 | mouseGrabberItems.takeLast(); | - |
694 | lastMouseGrabberItemHasImplicitMouseGrab = false; | - |
695 | | - |
696 | | - |
697 | | - |
698 | | - |
699 | if (!itemIsDying && !mouseGrabberItems.isEmpty()) { evaluated: !itemIsDying yes Evaluation Count:104 | yes Evaluation Count:1 |
partially evaluated: !mouseGrabberItems.isEmpty() no Evaluation Count:0 | yes Evaluation Count:104 |
| 0-104 |
700 | QGraphicsItem *last = mouseGrabberItems.last(); | - |
701 | QEvent event(QEvent::GrabMouse); | - |
702 | sendEvent(last, &event); | - |
703 | } | 0 |
704 | } executed: } Execution Count:105 | 105 |
705 | | - |
706 | | - |
707 | | - |
708 | | - |
709 | void QGraphicsScenePrivate::clearMouseGrabber() | - |
710 | { | - |
711 | if (!mouseGrabberItems.isEmpty()) partially evaluated: !mouseGrabberItems.isEmpty() no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
712 | mouseGrabberItems.first()->ungrabMouse(); never executed: mouseGrabberItems.first()->ungrabMouse(); | 0 |
713 | lastMouseGrabberItem = 0; | - |
714 | } executed: } Execution Count:10 | 10 |
715 | | - |
716 | | - |
717 | | - |
718 | | - |
719 | void QGraphicsScenePrivate::grabKeyboard(QGraphicsItem *item) | - |
720 | { | - |
721 | if (keyboardGrabberItems.contains(item)) { never evaluated: keyboardGrabberItems.contains(item) | 0 |
722 | if (keyboardGrabberItems.last() == item) never evaluated: keyboardGrabberItems.last() == item | 0 |
723 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 999, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabKeyboard: already a keyboard grabber"); never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 999, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabKeyboard: already a keyboard grabber"); | 0 |
724 | else | - |
725 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 1001, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabKeyboard: already blocked by keyboard grabber: %p", | 0 |
726 | keyboardGrabberItems.last()); never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 1001, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabKeyboard: already blocked by keyboard grabber: %p", keyboardGrabberItems.last()); | 0 |
727 | return; | 0 |
728 | } | - |
729 | | - |
730 | | - |
731 | if (!keyboardGrabberItems.isEmpty()) { never evaluated: !keyboardGrabberItems.isEmpty() | 0 |
732 | | - |
733 | QEvent ungrabEvent(QEvent::UngrabKeyboard); | - |
734 | sendEvent(keyboardGrabberItems.last(), &ungrabEvent); | - |
735 | } | 0 |
736 | | - |
737 | keyboardGrabberItems << item; | - |
738 | | - |
739 | | - |
740 | QEvent grabEvent(QEvent::GrabKeyboard); | - |
741 | sendEvent(item, &grabEvent); | - |
742 | } | 0 |
743 | | - |
744 | | - |
745 | | - |
746 | | - |
747 | void QGraphicsScenePrivate::ungrabKeyboard(QGraphicsItem *item, bool itemIsDying) | - |
748 | { | - |
749 | int index = keyboardGrabberItems.lastIndexOf(item); | - |
750 | if (index == -1) { never evaluated: index == -1 | 0 |
751 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 1027, __PRETTY_FUNCTION__).warning("QGraphicsItem::ungrabKeyboard: not a keyboard grabber"); | - |
752 | return; | 0 |
753 | } | - |
754 | if (item != keyboardGrabberItems.last()) { never evaluated: item != keyboardGrabberItems.last() | 0 |
755 | | - |
756 | | - |
757 | ungrabKeyboard(keyboardGrabberItems.at(index + 1), itemIsDying); | - |
758 | } | 0 |
759 | | - |
760 | | - |
761 | if (!itemIsDying) { never evaluated: !itemIsDying | 0 |
762 | QEvent event(QEvent::UngrabKeyboard); | - |
763 | sendEvent(item, &event); | - |
764 | } | 0 |
765 | | - |
766 | | - |
767 | keyboardGrabberItems.takeLast(); | - |
768 | | - |
769 | | - |
770 | if (!itemIsDying && !keyboardGrabberItems.isEmpty()) { never evaluated: !itemIsDying never evaluated: !keyboardGrabberItems.isEmpty() | 0 |
771 | QGraphicsItem *last = keyboardGrabberItems.last(); | - |
772 | QEvent event(QEvent::GrabKeyboard); | - |
773 | sendEvent(last, &event); | - |
774 | } | 0 |
775 | } | 0 |
776 | | - |
777 | | - |
778 | | - |
779 | | - |
780 | void QGraphicsScenePrivate::clearKeyboardGrabber() | - |
781 | { | - |
782 | if (!keyboardGrabberItems.isEmpty()) never evaluated: !keyboardGrabberItems.isEmpty() | 0 |
783 | ungrabKeyboard(keyboardGrabberItems.first()); never executed: ungrabKeyboard(keyboardGrabberItems.first()); | 0 |
784 | } | 0 |
785 | | - |
786 | void QGraphicsScenePrivate::enableMouseTrackingOnViews() | - |
787 | { | - |
788 | for (QForeachContainer<__typeof__(views)> _container_(views); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
789 | view->viewport()->setMouseTracking(true); executed: view->viewport()->setMouseTracking(true); Execution Count:181 | 181 |
790 | } executed: } Execution Count:189 | 189 |
791 | | - |
792 | | - |
793 | | - |
794 | | - |
795 | QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &screenPos, | - |
796 | const QPointF &scenePos, | - |
797 | QWidget *widget) const | - |
798 | { | - |
799 | const QGraphicsScene * const q = q_func(); | - |
800 | QGraphicsView *view = widget ? qobject_cast<QGraphicsView *>(widget->parentWidget()) : 0; evaluated: widget yes Evaluation Count:254 | yes Evaluation Count:67 |
| 67-254 |
801 | if (!view) evaluated: !view yes Evaluation Count:67 | yes Evaluation Count:254 |
| 67-254 |
802 | return q->items(scenePos, Qt::IntersectsItemShape, Qt::DescendingOrder, QTransform()); executed: return q->items(scenePos, Qt::IntersectsItemShape, Qt::DescendingOrder, QTransform()); Execution Count:67 | 67 |
803 | | - |
804 | const QRectF pointRect(QPointF(widget->mapFromGlobal(screenPos)), QSizeF(1, 1)); | - |
805 | if (!view->isTransformed()) evaluated: !view->isTransformed() yes Evaluation Count:4 | yes Evaluation Count:250 |
| 4-250 |
806 | return q->items(pointRect, Qt::IntersectsItemShape, Qt::DescendingOrder); executed: return q->items(pointRect, Qt::IntersectsItemShape, Qt::DescendingOrder); Execution Count:4 | 4 |
807 | | - |
808 | const QTransform viewTransform = view->viewportTransform(); | - |
809 | if (viewTransform.type() <= QTransform::TxScale) { partially evaluated: viewTransform.type() <= QTransform::TxScale yes Evaluation Count:250 | no Evaluation Count:0 |
| 0-250 |
810 | return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape, | 250 |
811 | Qt::DescendingOrder, viewTransform); executed: return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape, Qt::DescendingOrder, viewTransform); Execution Count:250 | 250 |
812 | } | - |
813 | return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape, | 0 |
814 | Qt::DescendingOrder, viewTransform); never executed: return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape, Qt::DescendingOrder, viewTransform); | 0 |
815 | } | - |
816 | | - |
817 | | - |
818 | | - |
819 | | - |
820 | void QGraphicsScenePrivate::storeMouseButtonsForMouseGrabber(QGraphicsSceneMouseEvent *event) | - |
821 | { | - |
822 | for (int i = 0x1; i <= 0x10; i <<= 1) { evaluated: i <= 0x10 yes Evaluation Count:525 | yes Evaluation Count:105 |
| 105-525 |
823 | if (event->buttons() & i) { evaluated: event->buttons() & i yes Evaluation Count:2 | yes Evaluation Count:523 |
| 2-523 |
824 | mouseGrabberButtonDownPos.insert(Qt::MouseButton(i), | - |
825 | mouseGrabberItems.last()->d_ptr->genericMapFromScene(event->scenePos(), | - |
826 | event->widget())); | - |
827 | mouseGrabberButtonDownScenePos.insert(Qt::MouseButton(i), event->scenePos()); | - |
828 | mouseGrabberButtonDownScreenPos.insert(Qt::MouseButton(i), event->screenPos()); | - |
829 | } executed: } Execution Count:2 | 2 |
830 | } executed: } Execution Count:525 | 525 |
831 | } executed: } Execution Count:105 | 105 |
832 | | - |
833 | | - |
834 | | - |
835 | | - |
836 | void QGraphicsScenePrivate::installSceneEventFilter(QGraphicsItem *watched, QGraphicsItem *filter) | - |
837 | { | - |
838 | sceneEventFilters.insert(watched, filter); | - |
839 | } | 0 |
840 | | - |
841 | | - |
842 | | - |
843 | | - |
844 | void QGraphicsScenePrivate::removeSceneEventFilter(QGraphicsItem *watched, QGraphicsItem *filter) | - |
845 | { | - |
846 | if (!sceneEventFilters.contains(watched)) never evaluated: !sceneEventFilters.contains(watched) | 0 |
847 | return; | 0 |
848 | | - |
849 | QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator it = sceneEventFilters.lowerBound(watched); | - |
850 | QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator end = sceneEventFilters.upperBound(watched); | - |
851 | do { | - |
852 | if (it.value() == filter) never evaluated: it.value() == filter | 0 |
853 | it = sceneEventFilters.erase(it); never executed: it = sceneEventFilters.erase(it); | 0 |
854 | else | - |
855 | ++it; | 0 |
856 | } while (it != end); never evaluated: it != end | 0 |
857 | } | 0 |
858 | | - |
859 | | - |
860 | | - |
861 | | - |
862 | bool QGraphicsScenePrivate::filterDescendantEvent(QGraphicsItem *item, QEvent *event) | - |
863 | { | - |
864 | if (item && (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorFiltersChildEvents)) { partially evaluated: item yes Evaluation Count:1393 | no Evaluation Count:0 |
partially evaluated: (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorFiltersChildEvents) no Evaluation Count:0 | yes Evaluation Count:1393 |
| 0-1393 |
865 | QGraphicsItem *parent = item->parentItem(); | - |
866 | while (parent) { | 0 |
867 | if (parent->d_ptr->filtersDescendantEvents && parent->sceneEventFilter(item, event)) never evaluated: parent->d_ptr->filtersDescendantEvents never evaluated: parent->sceneEventFilter(item, event) | 0 |
868 | return true; never executed: return true; | 0 |
869 | if (!(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorFiltersChildEvents)) never evaluated: !(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorFiltersChildEvents) | 0 |
870 | return false; never executed: return false; | 0 |
871 | parent = parent->parentItem(); | - |
872 | } | 0 |
873 | } | 0 |
874 | return false; executed: return false; Execution Count:1393 | 1393 |
875 | } | - |
876 | | - |
877 | | - |
878 | | - |
879 | | - |
880 | bool QGraphicsScenePrivate::filterEvent(QGraphicsItem *item, QEvent *event) | - |
881 | { | - |
882 | if (item && !sceneEventFilters.contains(item)) partially evaluated: item yes Evaluation Count:1393 | no Evaluation Count:0 |
partially evaluated: !sceneEventFilters.contains(item) yes Evaluation Count:1393 | no Evaluation Count:0 |
| 0-1393 |
883 | return false; executed: return false; Execution Count:1393 | 1393 |
884 | | - |
885 | QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator it = sceneEventFilters.lowerBound(item); | - |
886 | QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator end = sceneEventFilters.upperBound(item); | - |
887 | while (it != end) { never evaluated: it != end | 0 |
888 | | - |
889 | if (it.value()->sceneEventFilter(it.key(), event)) never evaluated: it.value()->sceneEventFilter(it.key(), event) | 0 |
890 | return true; never executed: return true; | 0 |
891 | ++it; | - |
892 | } | 0 |
893 | return false; never executed: return false; | 0 |
894 | } | - |
895 | bool QGraphicsScenePrivate::sendEvent(QGraphicsItem *item, QEvent *event) | - |
896 | { | - |
897 | if (QGraphicsObject *object = item->toGraphicsObject()) { evaluated: QGraphicsObject *object = item->toGraphicsObject() yes Evaluation Count:706 | yes Evaluation Count:687 |
| 687-706 |
898 | | - |
899 | QGestureManager *gestureManager = QApplicationPrivate::instance()->gestureManager; | - |
900 | if (gestureManager) { evaluated: gestureManager yes Evaluation Count:705 | yes Evaluation Count:1 |
| 1-705 |
901 | if (gestureManager->filterEvent(object, event)) partially evaluated: gestureManager->filterEvent(object, event) no Evaluation Count:0 | yes Evaluation Count:705 |
| 0-705 |
902 | return true; never executed: return true; | 0 |
903 | } executed: } Execution Count:705 | 705 |
904 | | - |
905 | } executed: } Execution Count:706 | 706 |
906 | | - |
907 | if (filterEvent(item, event)) partially evaluated: filterEvent(item, event) no Evaluation Count:0 | yes Evaluation Count:1393 |
| 0-1393 |
908 | return false; never executed: return false; | 0 |
909 | if (filterDescendantEvent(item, event)) partially evaluated: filterDescendantEvent(item, event) no Evaluation Count:0 | yes Evaluation Count:1393 |
| 0-1393 |
910 | return false; never executed: return false; | 0 |
911 | if (!item || !item->isEnabled()) partially evaluated: !item no Evaluation Count:0 | yes Evaluation Count:1393 |
partially evaluated: !item->isEnabled() no Evaluation Count:0 | yes Evaluation Count:1393 |
| 0-1393 |
912 | return false; never executed: return false; | 0 |
913 | if (QGraphicsObject *o = item->toGraphicsObject()) { evaluated: QGraphicsObject *o = item->toGraphicsObject() yes Evaluation Count:706 | yes Evaluation Count:687 |
| 687-706 |
914 | bool spont = event->spontaneous(); | - |
915 | if (spont ? qt_sendSpontaneousEvent(o, event) : QApplication::sendEvent(o, event)) evaluated: spont yes Evaluation Count:5 | yes Evaluation Count:701 |
| 5-701 |
916 | return true; executed: return true; Execution Count:428 | 428 |
917 | event->spont = spont; | - |
918 | } executed: } Execution Count:278 | 278 |
919 | return item->sceneEvent(event); executed: return item->sceneEvent(event); Execution Count:965 | 965 |
920 | } | - |
921 | | - |
922 | | - |
923 | | - |
924 | | - |
925 | void QGraphicsScenePrivate::cloneDragDropEvent(QGraphicsSceneDragDropEvent *dest, | - |
926 | QGraphicsSceneDragDropEvent *source) | - |
927 | { | - |
928 | dest->setWidget(source->widget()); | - |
929 | dest->setPos(source->pos()); | - |
930 | dest->setScenePos(source->scenePos()); | - |
931 | dest->setScreenPos(source->screenPos()); | - |
932 | dest->setButtons(source->buttons()); | - |
933 | dest->setModifiers(source->modifiers()); | - |
934 | dest->setPossibleActions(source->possibleActions()); | - |
935 | dest->setProposedAction(source->proposedAction()); | - |
936 | dest->setDropAction(source->dropAction()); | - |
937 | dest->setSource(source->source()); | - |
938 | dest->setMimeData(source->mimeData()); | - |
939 | } | 0 |
940 | | - |
941 | | - |
942 | | - |
943 | | - |
944 | void QGraphicsScenePrivate::sendDragDropEvent(QGraphicsItem *item, | - |
945 | QGraphicsSceneDragDropEvent *dragDropEvent) | - |
946 | { | - |
947 | dragDropEvent->setPos(item->d_ptr->genericMapFromScene(dragDropEvent->scenePos(), dragDropEvent->widget())); | - |
948 | sendEvent(item, dragDropEvent); | - |
949 | } | 0 |
950 | | - |
951 | | - |
952 | | - |
953 | | - |
954 | void QGraphicsScenePrivate::sendHoverEvent(QEvent::Type type, QGraphicsItem *item, | - |
955 | QGraphicsSceneHoverEvent *hoverEvent) | - |
956 | { | - |
957 | QGraphicsSceneHoverEvent event(type); | - |
958 | event.setWidget(hoverEvent->widget()); | - |
959 | event.setPos(item->d_ptr->genericMapFromScene(hoverEvent->scenePos(), hoverEvent->widget())); | - |
960 | event.setScenePos(hoverEvent->scenePos()); | - |
961 | event.setScreenPos(hoverEvent->screenPos()); | - |
962 | event.setLastPos(item->d_ptr->genericMapFromScene(hoverEvent->lastScenePos(), hoverEvent->widget())); | - |
963 | event.setLastScenePos(hoverEvent->lastScenePos()); | - |
964 | event.setLastScreenPos(hoverEvent->lastScreenPos()); | - |
965 | event.setModifiers(hoverEvent->modifiers()); | - |
966 | sendEvent(item, &event); | - |
967 | } | 0 |
968 | | - |
969 | | - |
970 | | - |
971 | | - |
972 | void QGraphicsScenePrivate::sendMouseEvent(QGraphicsSceneMouseEvent *mouseEvent) | - |
973 | { | - |
974 | if (mouseEvent->button() == 0 && mouseEvent->buttons() == 0 && lastMouseGrabberItemHasImplicitMouseGrab) { partially evaluated: mouseEvent->button() == 0 no Evaluation Count:0 | yes Evaluation Count:211 |
never evaluated: mouseEvent->buttons() == 0 never evaluated: lastMouseGrabberItemHasImplicitMouseGrab | 0-211 |
975 | | - |
976 | | - |
977 | clearMouseGrabber(); | - |
978 | return; | 0 |
979 | } | - |
980 | | - |
981 | QGraphicsItem *item = mouseGrabberItems.last(); | - |
982 | if (item->isBlockedByModalPanel()) partially evaluated: item->isBlockedByModalPanel() no Evaluation Count:0 | yes Evaluation Count:211 |
| 0-211 |
983 | return; | 0 |
984 | | - |
985 | for (int i = 0x1; i <= 0x10; i <<= 1) { evaluated: i <= 0x10 yes Evaluation Count:1055 | yes Evaluation Count:211 |
| 211-1055 |
986 | Qt::MouseButton button = Qt::MouseButton(i); | - |
987 | mouseEvent->setButtonDownPos(button, mouseGrabberButtonDownPos.value(button, item->d_ptr->genericMapFromScene(mouseEvent->scenePos(), mouseEvent->widget()))); | - |
988 | mouseEvent->setButtonDownScenePos(button, mouseGrabberButtonDownScenePos.value(button, mouseEvent->scenePos())); | - |
989 | mouseEvent->setButtonDownScreenPos(button, mouseGrabberButtonDownScreenPos.value(button, mouseEvent->screenPos())); | - |
990 | } executed: } Execution Count:1055 | 1055 |
991 | mouseEvent->setPos(item->d_ptr->genericMapFromScene(mouseEvent->scenePos(), mouseEvent->widget())); | - |
992 | mouseEvent->setLastPos(item->d_ptr->genericMapFromScene(mouseEvent->lastScenePos(), mouseEvent->widget())); | - |
993 | sendEvent(item, mouseEvent); | - |
994 | } executed: } Execution Count:211 | 211 |
995 | | - |
996 | | - |
997 | | - |
998 | | - |
999 | void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mouseEvent) | - |
1000 | { | - |
1001 | QGraphicsScene * const q = q_func(); | - |
1002 | | - |
1003 | | - |
1004 | mouseEvent->ignore(); | - |
1005 | | - |
1006 | | - |
1007 | if (!mouseGrabberItems.isEmpty()) { evaluated: !mouseGrabberItems.isEmpty() yes Evaluation Count:1 | yes Evaluation Count:115 |
| 1-115 |
1008 | if (mouseGrabberItems.last()->isBlockedByModalPanel()) partially evaluated: mouseGrabberItems.last()->isBlockedByModalPanel() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1009 | return; | 0 |
1010 | | - |
1011 | | - |
1012 | sendMouseEvent(mouseEvent); | - |
1013 | return; executed: return; Execution Count:1 | 1 |
1014 | } | - |
1015 | | - |
1016 | | - |
1017 | | - |
1018 | if (cachedItemsUnderMouse.isEmpty()) { partially evaluated: cachedItemsUnderMouse.isEmpty() yes Evaluation Count:115 | no Evaluation Count:0 |
| 0-115 |
1019 | cachedItemsUnderMouse = itemsAtPosition(mouseEvent->screenPos(), | - |
1020 | mouseEvent->scenePos(), | - |
1021 | mouseEvent->widget()); | - |
1022 | } executed: } Execution Count:115 | 115 |
1023 | | - |
1024 | | - |
1025 | QGraphicsItem *topItem = cachedItemsUnderMouse.value(0); | - |
1026 | QGraphicsWidget *newActiveWindow = topItem ? topItem->window() : 0; evaluated: topItem yes Evaluation Count:105 | yes Evaluation Count:10 |
| 10-105 |
1027 | if (newActiveWindow && newActiveWindow->isBlockedByModalPanel(&topItem)) { partially evaluated: newActiveWindow no Evaluation Count:0 | yes Evaluation Count:115 |
never evaluated: newActiveWindow->isBlockedByModalPanel(&topItem) | 0-115 |
1028 | | - |
1029 | newActiveWindow = topItem ? topItem->window() : 0; | 0 |
1030 | } | 0 |
1031 | | - |
1032 | if (newActiveWindow != q->activeWindow()) partially evaluated: newActiveWindow != q->activeWindow() no Evaluation Count:0 | yes Evaluation Count:115 |
| 0-115 |
1033 | q->setActiveWindow(newActiveWindow); never executed: q->setActiveWindow(newActiveWindow); | 0 |
1034 | | - |
1035 | | - |
1036 | bool setFocus = false; | - |
1037 | | - |
1038 | for (QForeachContainer<__typeof__(cachedItemsUnderMouse)> _container_(cachedItemsUnderMouse); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
1039 | if (item->isBlockedByModalPanel() partially evaluated: item->isBlockedByModalPanel() no Evaluation Count:0 | yes Evaluation Count:107 |
| 0-107 |
1040 | || (item->d_ptr->flags & QGraphicsItem::ItemStopsFocusHandling)) { partially evaluated: (item->d_ptr->flags & QGraphicsItem::ItemStopsFocusHandling) no Evaluation Count:0 | yes Evaluation Count:107 |
| 0-107 |
1041 | | - |
1042 | setFocus = true; | - |
1043 | break; | 0 |
1044 | } | - |
1045 | if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable))) { partially evaluated: item->isEnabled() yes Evaluation Count:107 | no Evaluation Count:0 |
evaluated: ((item->flags() & QGraphicsItem::ItemIsFocusable)) yes Evaluation Count:1 | yes Evaluation Count:106 |
| 0-107 |
1046 | if (!item->isWidget() || ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus) { partially evaluated: !item->isWidget() yes Evaluation Count:1 | no Evaluation Count:0 |
never evaluated: ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus | 0-1 |
1047 | setFocus = true; | - |
1048 | if (item != q->focusItem() && item->d_ptr->mouseSetsFocus) partially evaluated: item != q->focusItem() no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: item->d_ptr->mouseSetsFocus | 0-1 |
1049 | q->setFocusItem(item, Qt::MouseFocusReason); never executed: q->setFocusItem(item, Qt::MouseFocusReason); | 0 |
1050 | break; executed: break; Execution Count:1 | 1 |
1051 | } | - |
1052 | } | 0 |
1053 | if (item->isPanel()) partially evaluated: item->isPanel() no Evaluation Count:0 | yes Evaluation Count:106 |
| 0-106 |
1054 | break; | 0 |
1055 | if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation) partially evaluated: item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation no Evaluation Count:0 | yes Evaluation Count:106 |
| 0-106 |
1056 | break; | 0 |
1057 | } executed: } Execution Count:106 | 106 |
1058 | | - |
1059 | | - |
1060 | bool sceneModality = false; | - |
1061 | for (int i = 0; i < modalPanels.size(); ++i) { partially evaluated: i < modalPanels.size() no Evaluation Count:0 | yes Evaluation Count:115 |
| 0-115 |
1062 | if (modalPanels.at(i)->panelModality() == QGraphicsItem::SceneModal) { never evaluated: modalPanels.at(i)->panelModality() == QGraphicsItem::SceneModal | 0 |
1063 | sceneModality = true; | - |
1064 | break; | 0 |
1065 | } | - |
1066 | } | 0 |
1067 | | - |
1068 | | - |
1069 | if (!stickyFocus && !setFocus && !sceneModality) partially evaluated: !stickyFocus yes Evaluation Count:115 | no Evaluation Count:0 |
evaluated: !setFocus yes Evaluation Count:114 | yes Evaluation Count:1 |
partially evaluated: !sceneModality yes Evaluation Count:114 | no Evaluation Count:0 |
| 0-115 |
1070 | q->setFocusItem(0, Qt::MouseFocusReason); executed: q->setFocusItem(0, Qt::MouseFocusReason); Execution Count:114 | 114 |
1071 | | - |
1072 | | - |
1073 | if (sceneModality && cachedItemsUnderMouse.isEmpty()) partially evaluated: sceneModality no Evaluation Count:0 | yes Evaluation Count:115 |
never evaluated: cachedItemsUnderMouse.isEmpty() | 0-115 |
1074 | cachedItemsUnderMouse << modalPanels.first(); never executed: cachedItemsUnderMouse << modalPanels.first(); | 0 |
1075 | | - |
1076 | | - |
1077 | | - |
1078 | | - |
1079 | | - |
1080 | for (QForeachContainer<__typeof__(cachedItemsUnderMouse)> _container_(cachedItemsUnderMouse); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
1081 | if (!(item->acceptedMouseButtons() & mouseEvent->button())) { partially evaluated: !(item->acceptedMouseButtons() & mouseEvent->button()) no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
1082 | | - |
1083 | continue; never executed: continue; | 0 |
1084 | } | - |
1085 | | - |
1086 | | - |
1087 | | - |
1088 | (void) item->isBlockedByModalPanel(&item); | - |
1089 | | - |
1090 | grabMouse(item, true); | - |
1091 | mouseEvent->accept(); | - |
1092 | | - |
1093 | | - |
1094 | bool disabled = !item->isEnabled(); | - |
1095 | bool isPanel = item->isPanel(); | - |
1096 | if (mouseEvent->type() == QEvent::GraphicsSceneMouseDoubleClick partially evaluated: mouseEvent->type() == QEvent::GraphicsSceneMouseDoubleClick no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
1097 | && item != lastMouseGrabberItem && lastMouseGrabberItem) { never evaluated: item != lastMouseGrabberItem never evaluated: lastMouseGrabberItem | 0 |
1098 | | - |
1099 | | - |
1100 | | - |
1101 | | - |
1102 | QGraphicsSceneMouseEvent mousePress(QEvent::GraphicsSceneMousePress); | - |
1103 | mousePress.spont = mouseEvent->spont; | - |
1104 | mousePress.accept(); | - |
1105 | mousePress.setButton(mouseEvent->button()); | - |
1106 | mousePress.setButtons(mouseEvent->buttons()); | - |
1107 | mousePress.setScreenPos(mouseEvent->screenPos()); | - |
1108 | mousePress.setScenePos(mouseEvent->scenePos()); | - |
1109 | mousePress.setModifiers(mouseEvent->modifiers()); | - |
1110 | mousePress.setWidget(mouseEvent->widget()); | - |
1111 | mousePress.setButtonDownPos(mouseEvent->button(), | - |
1112 | mouseEvent->buttonDownPos(mouseEvent->button())); | - |
1113 | mousePress.setButtonDownScenePos(mouseEvent->button(), | - |
1114 | mouseEvent->buttonDownScenePos(mouseEvent->button())); | - |
1115 | mousePress.setButtonDownScreenPos(mouseEvent->button(), | - |
1116 | mouseEvent->buttonDownScreenPos(mouseEvent->button())); | - |
1117 | sendMouseEvent(&mousePress); | - |
1118 | mouseEvent->setAccepted(mousePress.isAccepted()); | - |
1119 | } else { | 0 |
1120 | sendMouseEvent(mouseEvent); | - |
1121 | } executed: } Execution Count:105 | 105 |
1122 | | - |
1123 | bool dontSendUngrabEvents = mouseGrabberItems.isEmpty() || mouseGrabberItems.last() != item; partially evaluated: mouseGrabberItems.isEmpty() no Evaluation Count:0 | yes Evaluation Count:105 |
partially evaluated: mouseGrabberItems.last() != item no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
1124 | if (disabled) { partially evaluated: disabled no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
1125 | ungrabMouse(item, dontSendUngrabEvents); | - |
1126 | break; | 0 |
1127 | } | - |
1128 | if (mouseEvent->isAccepted()) { partially evaluated: mouseEvent->isAccepted() yes Evaluation Count:105 | no Evaluation Count:0 |
| 0-105 |
1129 | if (!mouseGrabberItems.isEmpty()) partially evaluated: !mouseGrabberItems.isEmpty() yes Evaluation Count:105 | no Evaluation Count:0 |
| 0-105 |
1130 | storeMouseButtonsForMouseGrabber(mouseEvent); executed: storeMouseButtonsForMouseGrabber(mouseEvent); Execution Count:105 | 105 |
1131 | lastMouseGrabberItem = item; | - |
1132 | return; executed: return; Execution Count:105 | 105 |
1133 | } | - |
1134 | ungrabMouse(item, dontSendUngrabEvents); | - |
1135 | | - |
1136 | | - |
1137 | if (isPanel) | 0 |
1138 | break; | 0 |
1139 | } | 0 |
1140 | | - |
1141 | | - |
1142 | | - |
1143 | | - |
1144 | | - |
1145 | if (!mouseEvent->isAccepted()) { partially evaluated: !mouseEvent->isAccepted() yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
1146 | clearMouseGrabber(); | - |
1147 | | - |
1148 | QGraphicsView *view = mouseEvent->widget() ? qobject_cast<QGraphicsView *>(mouseEvent->widget()->parentWidget()) : 0; partially evaluated: mouseEvent->widget() yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
1149 | bool dontClearSelection = view && view->dragMode() == QGraphicsView::ScrollHandDrag; partially evaluated: view yes Evaluation Count:10 | no Evaluation Count:0 |
evaluated: view->dragMode() == QGraphicsView::ScrollHandDrag yes Evaluation Count:3 | yes Evaluation Count:7 |
| 0-10 |
1150 | if (!dontClearSelection) { evaluated: !dontClearSelection yes Evaluation Count:7 | yes Evaluation Count:3 |
| 3-7 |
1151 | | - |
1152 | | - |
1153 | | - |
1154 | q->clearSelection(); | - |
1155 | } executed: } Execution Count:7 | 7 |
1156 | } executed: } Execution Count:10 | 10 |
1157 | } executed: } Execution Count:10 | 10 |
1158 | void QGraphicsScenePrivate::ensureSequentialTopLevelSiblingIndexes() | - |
1159 | { | - |
1160 | if (!topLevelSequentialOrdering) { never evaluated: !topLevelSequentialOrdering | 0 |
1161 | std::sort(topLevelItems.begin(), topLevelItems.end(), QGraphicsItemPrivate::insertionOrder); | - |
1162 | topLevelSequentialOrdering = true; | - |
1163 | needSortTopLevelItems = 1; | - |
1164 | } | 0 |
1165 | if (holesInTopLevelSiblingIndex) { never evaluated: holesInTopLevelSiblingIndex | 0 |
1166 | holesInTopLevelSiblingIndex = 0; | - |
1167 | for (int i = 0; i < topLevelItems.size(); ++i) never evaluated: i < topLevelItems.size() | 0 |
1168 | topLevelItems[i]->d_ptr->siblingIndex = i; never executed: topLevelItems[i]->d_ptr->siblingIndex = i; | 0 |
1169 | } | 0 |
1170 | } | 0 |
1171 | | - |
1172 | | - |
1173 | | - |
1174 | | - |
1175 | | - |
1176 | | - |
1177 | | - |
1178 | void QGraphicsScenePrivate::setFont_helper(const QFont &font) | - |
1179 | { | - |
1180 | if (this->font == font && this->font.resolve() == font.resolve()) never evaluated: this->font == font never evaluated: this->font.resolve() == font.resolve() | 0 |
1181 | return; | 0 |
1182 | updateFont(font); | - |
1183 | } | 0 |
1184 | | - |
1185 | | - |
1186 | | - |
1187 | | - |
1188 | | - |
1189 | | - |
1190 | | - |
1191 | void QGraphicsScenePrivate::resolveFont() | - |
1192 | { | - |
1193 | QFont naturalFont = QApplication::font(); | - |
1194 | naturalFont.resolve(0); | - |
1195 | QFont resolvedFont = font.resolve(naturalFont); | - |
1196 | updateFont(resolvedFont); | - |
1197 | } | 0 |
1198 | | - |
1199 | | - |
1200 | | - |
1201 | | - |
1202 | | - |
1203 | | - |
1204 | | - |
1205 | void QGraphicsScenePrivate::updateFont(const QFont &font) | - |
1206 | { | - |
1207 | QGraphicsScene * const q = q_func(); | - |
1208 | | - |
1209 | | - |
1210 | this->font = font; | - |
1211 | | - |
1212 | | - |
1213 | | - |
1214 | for (QForeachContainer<__typeof__(q->items())> _container_(q->items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
1215 | if (!item->parentItem()) { never evaluated: !item->parentItem() | 0 |
1216 | | - |
1217 | | - |
1218 | | - |
1219 | item->d_ptr->resolveFont(font.resolve()); | - |
1220 | } | 0 |
1221 | } | 0 |
1222 | | - |
1223 | | - |
1224 | QEvent event(QEvent::FontChange); | - |
1225 | QApplication::sendEvent(q, &event); | - |
1226 | } | 0 |
1227 | | - |
1228 | | - |
1229 | | - |
1230 | | - |
1231 | | - |
1232 | | - |
1233 | | - |
1234 | void QGraphicsScenePrivate::setPalette_helper(const QPalette &palette) | - |
1235 | { | - |
1236 | if (this->palette == palette && this->palette.resolve() == palette.resolve()) never evaluated: this->palette == palette never evaluated: this->palette.resolve() == palette.resolve() | 0 |
1237 | return; | 0 |
1238 | updatePalette(palette); | - |
1239 | } | 0 |
1240 | | - |
1241 | | - |
1242 | | - |
1243 | | - |
1244 | | - |
1245 | | - |
1246 | | - |
1247 | void QGraphicsScenePrivate::resolvePalette() | - |
1248 | { | - |
1249 | QPalette naturalPalette = QApplication::palette(); | - |
1250 | naturalPalette.resolve(0); | - |
1251 | QPalette resolvedPalette = palette.resolve(naturalPalette); | - |
1252 | updatePalette(resolvedPalette); | - |
1253 | } | 0 |
1254 | | - |
1255 | | - |
1256 | | - |
1257 | | - |
1258 | | - |
1259 | | - |
1260 | | - |
1261 | void QGraphicsScenePrivate::updatePalette(const QPalette &palette) | - |
1262 | { | - |
1263 | QGraphicsScene * const q = q_func(); | - |
1264 | | - |
1265 | | - |
1266 | this->palette = palette; | - |
1267 | | - |
1268 | | - |
1269 | | - |
1270 | for (QForeachContainer<__typeof__(q->items())> _container_(q->items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
1271 | if (!item->parentItem()) { never evaluated: !item->parentItem() | 0 |
1272 | | - |
1273 | | - |
1274 | | - |
1275 | item->d_ptr->resolvePalette(palette.resolve()); | - |
1276 | } | 0 |
1277 | } | 0 |
1278 | | - |
1279 | | - |
1280 | QEvent event(QEvent::PaletteChange); | - |
1281 | QApplication::sendEvent(q, &event); | - |
1282 | } | 0 |
1283 | | - |
1284 | | - |
1285 | | - |
1286 | | - |
1287 | | - |
1288 | QGraphicsScene::QGraphicsScene(QObject *parent) | - |
1289 | : QObject(*new QGraphicsScenePrivate, parent) | - |
1290 | { | - |
1291 | d_func()->init(); | - |
1292 | } executed: } Execution Count:723 | 723 |
1293 | QGraphicsScene::QGraphicsScene(const QRectF &sceneRect, QObject *parent) | - |
1294 | : QObject(*new QGraphicsScenePrivate, parent) | - |
1295 | { | - |
1296 | d_func()->init(); | - |
1297 | setSceneRect(sceneRect); | - |
1298 | } executed: } Execution Count:1 | 1 |
1299 | QGraphicsScene::QGraphicsScene(qreal x, qreal y, qreal width, qreal height, QObject *parent) | - |
1300 | : QObject(*new QGraphicsScenePrivate, parent) | - |
1301 | { | - |
1302 | d_func()->init(); | - |
1303 | setSceneRect(x, y, width, height); | - |
1304 | } executed: } Execution Count:74 | 74 |
1305 | | - |
1306 | | - |
1307 | | - |
1308 | | - |
1309 | | - |
1310 | | - |
1311 | | - |
1312 | QGraphicsScene::~QGraphicsScene() | - |
1313 | { | - |
1314 | QGraphicsScenePrivate * const d = d_func(); | - |
1315 | | - |
1316 | | - |
1317 | if (!QApplicationPrivate::is_app_closing) partially evaluated: !QApplicationPrivate::is_app_closing yes Evaluation Count:779 | no Evaluation Count:0 |
| 0-779 |
1318 | (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->scene_list.removeAll(this); executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->scene_list.removeAll(this); Execution Count:779 | 779 |
1319 | | - |
1320 | clear(); | - |
1321 | | - |
1322 | | - |
1323 | for (int j = 0; j < d->views.size(); ++j) evaluated: j < d->views.size() yes Evaluation Count:15 | yes Evaluation Count:779 |
| 15-779 |
1324 | d->views.at(j)->setScene(0); executed: d->views.at(j)->setScene(0); Execution Count:15 | 15 |
1325 | } executed: } Execution Count:779 | 779 |
1326 | QRectF QGraphicsScene::sceneRect() const | - |
1327 | { | - |
1328 | const QGraphicsScenePrivate * const d = d_func(); | - |
1329 | if (d->hasSceneRect) evaluated: d->hasSceneRect yes Evaluation Count:753 | yes Evaluation Count:3813 |
| 753-3813 |
1330 | return d->sceneRect; executed: return d->sceneRect; Execution Count:753 | 753 |
1331 | | - |
1332 | if (d->dirtyGrowingItemsBoundingRect) { evaluated: d->dirtyGrowingItemsBoundingRect yes Evaluation Count:973 | yes Evaluation Count:2840 |
| 973-2840 |
1333 | | - |
1334 | QGraphicsScenePrivate *thatd = const_cast<QGraphicsScenePrivate *>(d); | - |
1335 | QRectF oldGrowingBoundingRect = thatd->growingItemsBoundingRect; | - |
1336 | thatd->growingItemsBoundingRect |= itemsBoundingRect(); | - |
1337 | thatd->dirtyGrowingItemsBoundingRect = false; | - |
1338 | if (oldGrowingBoundingRect != thatd->growingItemsBoundingRect) evaluated: oldGrowingBoundingRect != thatd->growingItemsBoundingRect yes Evaluation Count:230 | yes Evaluation Count:743 |
| 230-743 |
1339 | const_cast<QGraphicsScene *>(this)->sceneRectChanged(thatd->growingItemsBoundingRect); executed: const_cast<QGraphicsScene *>(this)->sceneRectChanged(thatd->growingItemsBoundingRect); Execution Count:230 | 230 |
1340 | } executed: } Execution Count:973 | 973 |
1341 | return d->growingItemsBoundingRect; executed: return d->growingItemsBoundingRect; Execution Count:3813 | 3813 |
1342 | } | - |
1343 | void QGraphicsScene::setSceneRect(const QRectF &rect) | - |
1344 | { | - |
1345 | QGraphicsScenePrivate * const d = d_func(); | - |
1346 | if (rect != d->sceneRect) { partially evaluated: rect != d->sceneRect yes Evaluation Count:470 | no Evaluation Count:0 |
| 0-470 |
1347 | d->hasSceneRect = !rect.isNull(); | - |
1348 | d->sceneRect = rect; | - |
1349 | sceneRectChanged(d->hasSceneRect ? rect : d->growingItemsBoundingRect); | - |
1350 | } executed: } Execution Count:470 | 470 |
1351 | } executed: } Execution Count:470 | 470 |
1352 | void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRectF &source, | - |
1353 | Qt::AspectRatioMode aspectRatioMode) | - |
1354 | { | - |
1355 | | - |
1356 | | - |
1357 | | - |
1358 | QRectF sourceRect = source; | - |
1359 | if (sourceRect.isNull()) evaluated: sourceRect.isNull() yes Evaluation Count:8 | yes Evaluation Count:7 |
| 7-8 |
1360 | sourceRect = sceneRect(); executed: sourceRect = sceneRect(); Execution Count:8 | 8 |
1361 | | - |
1362 | | - |
1363 | QRectF targetRect = target; | - |
1364 | if (targetRect.isNull()) { evaluated: targetRect.isNull() yes Evaluation Count:8 | yes Evaluation Count:7 |
| 7-8 |
1365 | if (painter->device()->devType() == QInternal::Picture) partially evaluated: painter->device()->devType() == QInternal::Picture no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
1366 | targetRect = sourceRect; never executed: targetRect = sourceRect; | 0 |
1367 | else | - |
1368 | targetRect.setRect(0, 0, painter->device()->width(), painter->device()->height()); executed: targetRect.setRect(0, 0, painter->device()->width(), painter->device()->height()); Execution Count:8 | 8 |
1369 | } | - |
1370 | | - |
1371 | | - |
1372 | qreal xratio = targetRect.width() / sourceRect.width(); | - |
1373 | qreal yratio = targetRect.height() / sourceRect.height(); | - |
1374 | | - |
1375 | | - |
1376 | switch (aspectRatioMode) { | - |
1377 | case Qt::KeepAspectRatio: | - |
1378 | xratio = yratio = qMin(xratio, yratio); | - |
1379 | break; executed: break; Execution Count:15 | 15 |
1380 | case Qt::KeepAspectRatioByExpanding: | - |
1381 | xratio = yratio = qMax(xratio, yratio); | - |
1382 | break; | 0 |
1383 | case Qt::IgnoreAspectRatio: | - |
1384 | break; | 0 |
1385 | } | - |
1386 | | - |
1387 | | - |
1388 | | - |
1389 | QList<QGraphicsItem *> itemList = items(sourceRect, Qt::IntersectsItemBoundingRect); | - |
1390 | QGraphicsItem **itemArray = new QGraphicsItem *[itemList.size()]; | - |
1391 | int numItems = itemList.size(); | - |
1392 | for (int i = 0; i < numItems; ++i) evaluated: i < numItems yes Evaluation Count:23 | yes Evaluation Count:15 |
| 15-23 |
1393 | itemArray[numItems - i - 1] = itemList.at(i); executed: itemArray[numItems - i - 1] = itemList.at(i); Execution Count:23 | 23 |
1394 | itemList.clear(); | - |
1395 | | - |
1396 | painter->save(); | - |
1397 | | - |
1398 | | - |
1399 | painter->setClipRect(targetRect, Qt::IntersectClip); | - |
1400 | QTransform painterTransform; | - |
1401 | painterTransform *= QTransform() | - |
1402 | .translate(targetRect.left(), targetRect.top()) | - |
1403 | .scale(xratio, yratio) | - |
1404 | .translate(-sourceRect.left(), -sourceRect.top()); | - |
1405 | painter->setWorldTransform(painterTransform, true); | - |
1406 | | - |
1407 | | - |
1408 | QLineF v1(0, 0, 1, 0); | - |
1409 | QLineF v2(0, 0, 0, 1); | - |
1410 | | - |
1411 | | - |
1412 | QStyleOptionGraphicsItem *styleOptionArray = new QStyleOptionGraphicsItem[numItems]; | - |
1413 | for (int i = 0; i < numItems; ++i) evaluated: i < numItems yes Evaluation Count:23 | yes Evaluation Count:15 |
| 15-23 |
1414 | itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], painterTransform, targetRect.toRect()); executed: itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], painterTransform, targetRect.toRect()); Execution Count:23 | 23 |
1415 | | - |
1416 | | - |
1417 | drawBackground(painter, sourceRect); | - |
1418 | drawItems(painter, numItems, itemArray, styleOptionArray); | - |
1419 | drawForeground(painter, sourceRect); | - |
1420 | | - |
1421 | delete [] itemArray; | - |
1422 | delete [] styleOptionArray; | - |
1423 | | - |
1424 | painter->restore(); | - |
1425 | } executed: } Execution Count:15 | 15 |
1426 | QGraphicsScene::ItemIndexMethod QGraphicsScene::itemIndexMethod() const | - |
1427 | { | - |
1428 | const QGraphicsScenePrivate * const d = d_func(); | - |
1429 | return d->indexMethod; never executed: return d->indexMethod; | 0 |
1430 | } | - |
1431 | void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) | - |
1432 | { | - |
1433 | QGraphicsScenePrivate * const d = d_func(); | - |
1434 | if (d->indexMethod == method) never evaluated: d->indexMethod == method | 0 |
1435 | return; | 0 |
1436 | | - |
1437 | d->indexMethod = method; | - |
1438 | | - |
1439 | QList<QGraphicsItem *> oldItems = d->index->items(Qt::DescendingOrder); | - |
1440 | delete d->index; | - |
1441 | if (method == BspTreeIndex) never evaluated: method == BspTreeIndex | 0 |
1442 | d->index = new QGraphicsSceneBspTreeIndex(this); never executed: d->index = new QGraphicsSceneBspTreeIndex(this); | 0 |
1443 | else | - |
1444 | d->index = new QGraphicsSceneLinearIndex(this); never executed: d->index = new QGraphicsSceneLinearIndex(this); | 0 |
1445 | for (int i = oldItems.size() - 1; i >= 0; --i) | 0 |
1446 | d->index->addItem(oldItems.at(i)); never executed: d->index->addItem(oldItems.at(i)); | 0 |
1447 | } | 0 |
1448 | int QGraphicsScene::bspTreeDepth() const | - |
1449 | { | - |
1450 | const QGraphicsScenePrivate * const d = d_func(); | - |
1451 | QGraphicsSceneBspTreeIndex *bspTree = qobject_cast<QGraphicsSceneBspTreeIndex *>(d->index); | - |
1452 | return bspTree ? bspTree->bspTreeDepth() : 0; never executed: return bspTree ? bspTree->bspTreeDepth() : 0; | 0 |
1453 | } | - |
1454 | void QGraphicsScene::setBspTreeDepth(int depth) | - |
1455 | { | - |
1456 | QGraphicsScenePrivate * const d = d_func(); | - |
1457 | if (depth < 0) { never evaluated: depth < 0 | 0 |
1458 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 1872, __PRETTY_FUNCTION__).warning("QGraphicsScene::setBspTreeDepth: invalid depth %d ignored; must be >= 0", depth); | - |
1459 | return; | 0 |
1460 | } | - |
1461 | | - |
1462 | QGraphicsSceneBspTreeIndex *bspTree = qobject_cast<QGraphicsSceneBspTreeIndex *>(d->index); | - |
1463 | if (!bspTree) { never evaluated: !bspTree | 0 |
1464 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 1878, __PRETTY_FUNCTION__).warning("QGraphicsScene::setBspTreeDepth: can not apply if indexing method is not BSP"); | - |
1465 | return; | 0 |
1466 | } | - |
1467 | bspTree->setBspTreeDepth(depth); | - |
1468 | } | 0 |
1469 | bool QGraphicsScene::isSortCacheEnabled() const | - |
1470 | { | - |
1471 | const QGraphicsScenePrivate * const d = d_func(); | - |
1472 | return d->sortCacheEnabled; never executed: return d->sortCacheEnabled; | 0 |
1473 | } | - |
1474 | void QGraphicsScene::setSortCacheEnabled(bool enabled) | - |
1475 | { | - |
1476 | QGraphicsScenePrivate * const d = d_func(); | - |
1477 | if (d->sortCacheEnabled == enabled) never evaluated: d->sortCacheEnabled == enabled | 0 |
1478 | return; | 0 |
1479 | d->sortCacheEnabled = enabled; | - |
1480 | } | 0 |
1481 | QRectF QGraphicsScene::itemsBoundingRect() const | - |
1482 | { | - |
1483 | | - |
1484 | QRectF boundingRect; | - |
1485 | for (QForeachContainer<__typeof__(items())> _container_(items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
1486 | boundingRect |= item->sceneBoundingRect(); executed: boundingRect |= item->sceneBoundingRect(); Execution Count:2141 | 2141 |
1487 | return boundingRect; executed: return boundingRect; Execution Count:1097 | 1097 |
1488 | } | - |
1489 | | - |
1490 | | - |
1491 | | - |
1492 | | - |
1493 | | - |
1494 | | - |
1495 | | - |
1496 | QList<QGraphicsItem *> QGraphicsScene::items(Qt::SortOrder order) const | - |
1497 | { | - |
1498 | const QGraphicsScenePrivate * const d = d_func(); | - |
1499 | return d->index->items(order); executed: return d->index->items(order); Execution Count:1679 | 1679 |
1500 | } | - |
1501 | QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos, Qt::ItemSelectionMode mode, | - |
1502 | Qt::SortOrder order, const QTransform &deviceTransform) const | - |
1503 | { | - |
1504 | const QGraphicsScenePrivate * const d = d_func(); | - |
1505 | return d->index->items(pos, mode, order, deviceTransform); executed: return d->index->items(pos, mode, order, deviceTransform); Execution Count:67 | 67 |
1506 | } | - |
1507 | QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rect, Qt::ItemSelectionMode mode, | - |
1508 | Qt::SortOrder order, const QTransform &deviceTransform) const | - |
1509 | { | - |
1510 | const QGraphicsScenePrivate * const d = d_func(); | - |
1511 | return d->index->items(rect, mode, order, deviceTransform); executed: return d->index->items(rect, mode, order, deviceTransform); Execution Count:340 | 340 |
1512 | } | - |
1513 | QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, | - |
1514 | Qt::SortOrder order, const QTransform &deviceTransform) const | - |
1515 | { | - |
1516 | const QGraphicsScenePrivate * const d = d_func(); | - |
1517 | return d->index->items(polygon, mode, order, deviceTransform); executed: return d->index->items(polygon, mode, order, deviceTransform); Execution Count:11 | 11 |
1518 | } | - |
1519 | QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode, | - |
1520 | Qt::SortOrder order, const QTransform &deviceTransform) const | - |
1521 | { | - |
1522 | const QGraphicsScenePrivate * const d = d_func(); | - |
1523 | return d->index->items(path, mode, order, deviceTransform); executed: return d->index->items(path, mode, order, deviceTransform); Execution Count:7 | 7 |
1524 | } | - |
1525 | QList<QGraphicsItem *> QGraphicsScene::collidingItems(const QGraphicsItem *item, | - |
1526 | Qt::ItemSelectionMode mode) const | - |
1527 | { | - |
1528 | const QGraphicsScenePrivate * const d = d_func(); | - |
1529 | if (!item) { | 0 |
1530 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 2079, __PRETTY_FUNCTION__).warning("QGraphicsScene::collidingItems: cannot find collisions for null item"); | - |
1531 | return QList<QGraphicsItem *>(); never executed: return QList<QGraphicsItem *>(); | 0 |
1532 | } | - |
1533 | | - |
1534 | | - |
1535 | QList<QGraphicsItem *> tmp; | - |
1536 | for (QForeachContainer<__typeof__(d->index->estimateItems(item->sceneBoundingRect(), Qt::DescendingOrder))> _container_(d->index->estimateItems(item->sceneBoundingRect(), Qt::DescendingOrder)); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *itemInVicinity = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
1537 | if (item != itemInVicinity && item->collidesWithItem(itemInVicinity, mode)) never evaluated: item != itemInVicinity never evaluated: item->collidesWithItem(itemInVicinity, mode) | 0 |
1538 | tmp << itemInVicinity; never executed: tmp << itemInVicinity; | 0 |
1539 | } | 0 |
1540 | return tmp; never executed: return tmp; | 0 |
1541 | } | - |
1542 | QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform &deviceTransform) const | - |
1543 | { | - |
1544 | QList<QGraphicsItem *> itemsAtPoint = items(position, Qt::IntersectsItemShape, | - |
1545 | Qt::DescendingOrder, deviceTransform); | - |
1546 | return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first(); never executed: return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first(); | 0 |
1547 | } | - |
1548 | QList<QGraphicsItem *> QGraphicsScene::selectedItems() const | - |
1549 | { | - |
1550 | const QGraphicsScenePrivate * const d = d_func(); | - |
1551 | | - |
1552 | | - |
1553 | QGraphicsScene *that = const_cast<QGraphicsScene *>(this); | - |
1554 | QSet<QGraphicsItem *> actuallySelectedSet; | - |
1555 | for (QForeachContainer<__typeof__(that->d_func()->selectedItems)> _container_(that->d_func()->selectedItems); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
1556 | if (item->isSelected()) partially evaluated: item->isSelected() yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1557 | actuallySelectedSet << item; executed: actuallySelectedSet << item; Execution Count:3 | 3 |
1558 | } executed: } Execution Count:3 | 3 |
1559 | | - |
1560 | that->d_func()->selectedItems = actuallySelectedSet; | - |
1561 | | - |
1562 | return d->selectedItems.values(); executed: return d->selectedItems.values(); Execution Count:7 | 7 |
1563 | } | - |
1564 | QPainterPath QGraphicsScene::selectionArea() const | - |
1565 | { | - |
1566 | const QGraphicsScenePrivate * const d = d_func(); | - |
1567 | return d->selectionArea; never executed: return d->selectionArea; | 0 |
1568 | } | - |
1569 | void QGraphicsScene::setSelectionArea(const QPainterPath &path, const QTransform &deviceTransform) | - |
1570 | { | - |
1571 | setSelectionArea(path, Qt::IntersectsItemShape, deviceTransform); | - |
1572 | } | 0 |
1573 | void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode, | - |
1574 | const QTransform &deviceTransform) | - |
1575 | { | - |
1576 | QGraphicsScenePrivate * const d = d_func(); | - |
1577 | | - |
1578 | | - |
1579 | | - |
1580 | | - |
1581 | | - |
1582 | d->selectionArea = path; | - |
1583 | | - |
1584 | QSet<QGraphicsItem *> unselectItems = d->selectedItems; | - |
1585 | | - |
1586 | | - |
1587 | ++d->selectionChanging; | - |
1588 | bool changed = false; | - |
1589 | | - |
1590 | | - |
1591 | for (QForeachContainer<__typeof__(items(path, mode, Qt::DescendingOrder, deviceTransform))> _container_(items(path, mode, Qt::DescendingOrder, deviceTransform)); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
1592 | if (item->flags() & QGraphicsItem::ItemIsSelectable) { partially evaluated: item->flags() & QGraphicsItem::ItemIsSelectable yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1593 | if (!item->isSelected()) partially evaluated: !item->isSelected() yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1594 | changed = true; executed: changed = true; Execution Count:3 | 3 |
1595 | unselectItems.remove(item); | - |
1596 | item->setSelected(true); | - |
1597 | } executed: } Execution Count:3 | 3 |
1598 | } executed: } Execution Count:3 | 3 |
1599 | | - |
1600 | | - |
1601 | for (QForeachContainer<__typeof__(unselectItems)> _container_(unselectItems); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
1602 | item->setSelected(false); | - |
1603 | changed = true; | - |
1604 | } | 0 |
1605 | | - |
1606 | | - |
1607 | --d->selectionChanging; | - |
1608 | | - |
1609 | if (!d->selectionChanging && changed) partially evaluated: !d->selectionChanging yes Evaluation Count:5 | no Evaluation Count:0 |
evaluated: changed yes Evaluation Count:3 | yes Evaluation Count:2 |
| 0-5 |
1610 | selectionChanged(); executed: selectionChanged(); Execution Count:3 | 3 |
1611 | } executed: } Execution Count:5 | 5 |
1612 | | - |
1613 | | - |
1614 | | - |
1615 | | - |
1616 | | - |
1617 | | - |
1618 | void QGraphicsScene::clearSelection() | - |
1619 | { | - |
1620 | QGraphicsScenePrivate * const d = d_func(); | - |
1621 | | - |
1622 | | - |
1623 | ++d->selectionChanging; | - |
1624 | bool changed = !d->selectedItems.isEmpty(); | - |
1625 | | - |
1626 | for (QForeachContainer<__typeof__(d->selectedItems)> _container_(d->selectedItems); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
1627 | item->setSelected(false); executed: item->setSelected(false); Execution Count:2 | 2 |
1628 | d->selectedItems.clear(); | - |
1629 | | - |
1630 | | - |
1631 | --d->selectionChanging; | - |
1632 | | - |
1633 | if (!d->selectionChanging && changed) partially evaluated: !d->selectionChanging yes Evaluation Count:11 | no Evaluation Count:0 |
evaluated: changed yes Evaluation Count:2 | yes Evaluation Count:9 |
| 0-11 |
1634 | selectionChanged(); executed: selectionChanged(); Execution Count:2 | 2 |
1635 | } executed: } Execution Count:11 | 11 |
1636 | void QGraphicsScene::clear() | - |
1637 | { | - |
1638 | QGraphicsScenePrivate * const d = d_func(); | - |
1639 | | - |
1640 | | - |
1641 | d->index->clear(); | - |
1642 | | - |
1643 | while (!d->topLevelItems.isEmpty()) evaluated: !d->topLevelItems.isEmpty() yes Evaluation Count:770 | yes Evaluation Count:779 |
| 770-779 |
1644 | delete d->topLevelItems.first(); executed: delete d->topLevelItems.first(); Execution Count:770 | 770 |
1645 | qt_noop(); | - |
1646 | d->lastItemCount = 0; | - |
1647 | d->allItemsIgnoreHoverEvents = true; | - |
1648 | d->allItemsUseDefaultCursor = true; | - |
1649 | d->allItemsIgnoreTouchEvents = true; | - |
1650 | } executed: } Execution Count:779 | 779 |
1651 | QGraphicsItemGroup *QGraphicsScene::createItemGroup(const QList<QGraphicsItem *> &items) | - |
1652 | { | - |
1653 | | - |
1654 | QList<QGraphicsItem *> ancestors; | - |
1655 | int n = 0; | - |
1656 | if (!items.isEmpty()) { never evaluated: !items.isEmpty() | 0 |
1657 | QGraphicsItem *parent = items.at(n++); | - |
1658 | while ((parent = parent->parentItem())) never evaluated: (parent = parent->parentItem()) | 0 |
1659 | ancestors.append(parent); never executed: ancestors.append(parent); | 0 |
1660 | } | 0 |
1661 | | - |
1662 | | - |
1663 | QGraphicsItem *commonAncestor = 0; | - |
1664 | if (!ancestors.isEmpty()) { never evaluated: !ancestors.isEmpty() | 0 |
1665 | while (n < items.size()) { never evaluated: n < items.size() | 0 |
1666 | int commonIndex = -1; | - |
1667 | QGraphicsItem *parent = items.at(n++); | - |
1668 | do { | - |
1669 | int index = ancestors.indexOf(parent, qMax(0, commonIndex)); | - |
1670 | if (index != -1) { never evaluated: index != -1 | 0 |
1671 | commonIndex = index; | - |
1672 | break; | 0 |
1673 | } | - |
1674 | } while ((parent = parent->parentItem())); never evaluated: (parent = parent->parentItem()) | 0 |
1675 | | - |
1676 | if (commonIndex == -1) { never evaluated: commonIndex == -1 | 0 |
1677 | commonAncestor = 0; | - |
1678 | break; | 0 |
1679 | } | - |
1680 | | - |
1681 | commonAncestor = ancestors.at(commonIndex); | - |
1682 | } | 0 |
1683 | } | 0 |
1684 | | - |
1685 | | - |
1686 | QGraphicsItemGroup *group = new QGraphicsItemGroup(commonAncestor); | - |
1687 | if (!commonAncestor) never evaluated: !commonAncestor | 0 |
1688 | addItem(group); never executed: addItem(group); | 0 |
1689 | for (QForeachContainer<__typeof__(items)> _container_(items); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
1690 | group->addToGroup(item); never executed: group->addToGroup(item); | 0 |
1691 | return group; never executed: return group; | 0 |
1692 | } | - |
1693 | void QGraphicsScene::destroyItemGroup(QGraphicsItemGroup *group) | - |
1694 | { | - |
1695 | for (QForeachContainer<__typeof__(group->childItems())> _container_(group->childItems()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
1696 | group->removeFromGroup(item); never executed: group->removeFromGroup(item); | 0 |
1697 | removeItem(group); | - |
1698 | delete group; | - |
1699 | } | 0 |
1700 | void QGraphicsScene::addItem(QGraphicsItem *item) | - |
1701 | { | - |
1702 | QGraphicsScenePrivate * const d = d_func(); | - |
1703 | if (!item) { partially evaluated: !item no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
1704 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 2420, __PRETTY_FUNCTION__).warning("QGraphicsScene::addItem: cannot add null item"); | - |
1705 | return; | 0 |
1706 | } | - |
1707 | if (item->d_ptr->scene == this) { partially evaluated: item->d_ptr->scene == this no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
1708 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 2424, __PRETTY_FUNCTION__).warning("QGraphicsScene::addItem: item has already been added to this scene"); | - |
1709 | return; | 0 |
1710 | } | - |
1711 | | - |
1712 | if (QGraphicsScene *oldScene = item->d_ptr->scene) partially evaluated: QGraphicsScene *oldScene = item->d_ptr->scene no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
1713 | oldScene->removeItem(item); never executed: oldScene->removeItem(item); | 0 |
1714 | | - |
1715 | | - |
1716 | | - |
1717 | const QVariant newSceneVariant(item->itemChange(QGraphicsItem::ItemSceneChange, | - |
1718 | QVariant::fromValue<QGraphicsScene *>(this))); | - |
1719 | QGraphicsScene *targetScene = qvariant_cast<QGraphicsScene *>(newSceneVariant); | - |
1720 | if (targetScene != this) { partially evaluated: targetScene != this no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
1721 | if (targetScene && item->d_ptr->scene != targetScene) never evaluated: targetScene never evaluated: item->d_ptr->scene != targetScene | 0 |
1722 | targetScene->addItem(item); never executed: targetScene->addItem(item); | 0 |
1723 | return; | 0 |
1724 | } | - |
1725 | | - |
1726 | | - |
1727 | | - |
1728 | if (!item->d_ptr->isDeclarativeItem) { partially evaluated: !item->d_ptr->isDeclarativeItem yes Evaluation Count:1726 | no Evaluation Count:0 |
| 0-1726 |
1729 | if (d->unpolishedItems.isEmpty()) { evaluated: d->unpolishedItems.isEmpty() yes Evaluation Count:754 | yes Evaluation Count:972 |
| 754-972 |
1730 | QMetaMethod method = metaObject()->method(d->polishItemsIndex); | - |
1731 | method.invoke(this, Qt::QueuedConnection); | - |
1732 | } executed: } Execution Count:754 | 754 |
1733 | d->unpolishedItems.append(item); | - |
1734 | item->d_ptr->pendingPolish = true; | - |
1735 | } executed: } Execution Count:1726 | 1726 |
1736 | | - |
1737 | | - |
1738 | | - |
1739 | if (QGraphicsItem *itemParent = item->d_ptr->parent) { evaluated: QGraphicsItem *itemParent = item->d_ptr->parent yes Evaluation Count:753 | yes Evaluation Count:973 |
| 753-973 |
1740 | if (itemParent->d_ptr->scene != this) partially evaluated: itemParent->d_ptr->scene != this no Evaluation Count:0 | yes Evaluation Count:753 |
| 0-753 |
1741 | item->setParentItem(0); never executed: item->setParentItem(0); | 0 |
1742 | } executed: } Execution Count:753 | 753 |
1743 | | - |
1744 | | - |
1745 | item->d_func()->scene = targetScene; | - |
1746 | | - |
1747 | | - |
1748 | d->index->addItem(item); | - |
1749 | | - |
1750 | | - |
1751 | if (!item->d_ptr->parent) evaluated: !item->d_ptr->parent yes Evaluation Count:973 | yes Evaluation Count:753 |
| 753-973 |
1752 | d->registerTopLevelItem(item); executed: d->registerTopLevelItem(item); Execution Count:973 | 973 |
1753 | | - |
1754 | | - |
1755 | | - |
1756 | | - |
1757 | d->markDirty(item); | - |
1758 | d->dirtyGrowingItemsBoundingRect = true; | - |
1759 | | - |
1760 | | - |
1761 | ++d->selectionChanging; | - |
1762 | int oldSelectedItemSize = d->selectedItems.size(); | - |
1763 | | - |
1764 | | - |
1765 | if (d->allItemsIgnoreHoverEvents && d->itemAcceptsHoverEvents_helper(item)) { evaluated: d->allItemsIgnoreHoverEvents yes Evaluation Count:923 | yes Evaluation Count:803 |
evaluated: d->itemAcceptsHoverEvents_helper(item) yes Evaluation Count:185 | yes Evaluation Count:738 |
| 185-923 |
1766 | d->allItemsIgnoreHoverEvents = false; | - |
1767 | d->enableMouseTrackingOnViews(); | - |
1768 | } executed: } Execution Count:185 | 185 |
1769 | | - |
1770 | if (d->allItemsUseDefaultCursor && item->d_ptr->hasCursor) { evaluated: d->allItemsUseDefaultCursor yes Evaluation Count:1725 | yes Evaluation Count:1 |
evaluated: item->d_ptr->hasCursor yes Evaluation Count:4 | yes Evaluation Count:1721 |
| 1-1725 |
1771 | d->allItemsUseDefaultCursor = false; | - |
1772 | if (d->allItemsIgnoreHoverEvents) evaluated: d->allItemsIgnoreHoverEvents yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
1773 | d->enableMouseTrackingOnViews(); executed: d->enableMouseTrackingOnViews(); Execution Count:3 | 3 |
1774 | } executed: } Execution Count:4 | 4 |
1775 | | - |
1776 | | - |
1777 | | - |
1778 | if (d->allItemsIgnoreTouchEvents && item->d_ptr->acceptTouchEvents) { partially evaluated: d->allItemsIgnoreTouchEvents yes Evaluation Count:1726 | no Evaluation Count:0 |
partially evaluated: item->d_ptr->acceptTouchEvents no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
1779 | d->allItemsIgnoreTouchEvents = false; | - |
1780 | d->enableTouchEventsOnViews(); | - |
1781 | } | 0 |
1782 | | - |
1783 | | - |
1784 | for (QForeachContainer<__typeof__(item->d_ptr->gestureContext.keys())> _container_(item->d_ptr->gestureContext.keys()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (Qt::GestureType gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
1785 | d->grabGesture(item, gesture); executed: d->grabGesture(item, gesture); Execution Count:31 | 31 |
1786 | | - |
1787 | | - |
1788 | | - |
1789 | if (item->isSelected()) partially evaluated: item->isSelected() no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
1790 | d->selectedItems << item; never executed: d->selectedItems << item; | 0 |
1791 | if (item->isWidget() && item->isVisible() && static_cast<QGraphicsWidget *>(item)->windowType() == Qt::Popup) evaluated: item->isWidget() yes Evaluation Count:937 | yes Evaluation Count:789 |
evaluated: item->isVisible() yes Evaluation Count:936 | yes Evaluation Count:1 |
partially evaluated: static_cast<QGraphicsWidget *>(item)->windowType() == Qt::Popup no Evaluation Count:0 | yes Evaluation Count:936 |
| 0-937 |
1792 | d->addPopup(static_cast<QGraphicsWidget *>(item)); never executed: d->addPopup(static_cast<QGraphicsWidget *>(item)); | 0 |
1793 | if (item->isPanel() && item->isVisible() && item->panelModality() != QGraphicsItem::NonModal) evaluated: item->isPanel() yes Evaluation Count:176 | yes Evaluation Count:1550 |
partially evaluated: item->isVisible() yes Evaluation Count:176 | no Evaluation Count:0 |
evaluated: item->panelModality() != QGraphicsItem::NonModal yes Evaluation Count:1 | yes Evaluation Count:175 |
| 0-1550 |
1794 | d->enterModal(item); executed: d->enterModal(item); Execution Count:1 | 1 |
1795 | | - |
1796 | | - |
1797 | | - |
1798 | if (item->isWidget()) { evaluated: item->isWidget() yes Evaluation Count:937 | yes Evaluation Count:789 |
| 789-937 |
1799 | QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); | - |
1800 | if (!d->tabFocusFirst) { evaluated: !d->tabFocusFirst yes Evaluation Count:200 | yes Evaluation Count:737 |
| 200-737 |
1801 | | - |
1802 | | - |
1803 | d->tabFocusFirst = widget; | - |
1804 | } else if (!widget->parentWidget()) { evaluated: !widget->parentWidget() yes Evaluation Count:6 | yes Evaluation Count:731 |
executed: } Execution Count:200 | 6-731 |
1805 | | - |
1806 | QGraphicsWidget *last = d->tabFocusFirst->d_func()->focusPrev; | - |
1807 | QGraphicsWidget *lastNew = widget->d_func()->focusPrev; | - |
1808 | last->d_func()->focusNext = widget; | - |
1809 | widget->d_func()->focusPrev = last; | - |
1810 | d->tabFocusFirst->d_func()->focusPrev = lastNew; | - |
1811 | lastNew->d_func()->focusNext = d->tabFocusFirst; | - |
1812 | } executed: } Execution Count:6 | 6 |
1813 | } | - |
1814 | | - |
1815 | | - |
1816 | item->d_ptr->ensureSortedChildren(); | - |
1817 | for (int i = 0; i < item->d_ptr->children.size(); ++i) evaluated: i < item->d_ptr->children.size() yes Evaluation Count:31 | yes Evaluation Count:1726 |
| 31-1726 |
1818 | addItem(item->d_ptr->children.at(i)); executed: addItem(item->d_ptr->children.at(i)); Execution Count:31 | 31 |
1819 | | - |
1820 | | - |
1821 | item->d_ptr->resolveFont(d->font.resolve()); | - |
1822 | item->d_ptr->resolvePalette(d->palette.resolve()); | - |
1823 | | - |
1824 | | - |
1825 | | - |
1826 | --d->selectionChanging; | - |
1827 | if (!d->selectionChanging && d->selectedItems.size() != oldSelectedItemSize) evaluated: !d->selectionChanging yes Evaluation Count:1695 | yes Evaluation Count:31 |
partially evaluated: d->selectedItems.size() != oldSelectedItemSize no Evaluation Count:0 | yes Evaluation Count:1695 |
| 0-1695 |
1828 | selectionChanged(); never executed: selectionChanged(); | 0 |
1829 | | - |
1830 | | - |
1831 | item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant); | - |
1832 | | - |
1833 | | - |
1834 | bool autoActivate = true; | - |
1835 | if (!d->childExplicitActivation && item->d_ptr->explicitActivate) partially evaluated: !d->childExplicitActivation yes Evaluation Count:1726 | no Evaluation Count:0 |
partially evaluated: item->d_ptr->explicitActivate no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
1836 | d->childExplicitActivation = item->d_ptr->wantsActive ? 1 : 2; never evaluated: item->d_ptr->wantsActive never executed: d->childExplicitActivation = item->d_ptr->wantsActive ? 1 : 2; | 0 |
1837 | if (d->childExplicitActivation && item->isPanel()) { partially evaluated: d->childExplicitActivation no Evaluation Count:0 | yes Evaluation Count:1726 |
never evaluated: item->isPanel() | 0-1726 |
1838 | if (d->childExplicitActivation == 1) never evaluated: d->childExplicitActivation == 1 | 0 |
1839 | setActivePanel(item); never executed: setActivePanel(item); | 0 |
1840 | else | - |
1841 | autoActivate = false; never executed: autoActivate = false; | 0 |
1842 | d->childExplicitActivation = 0; | - |
1843 | } else if (!item->d_ptr->parent) { evaluated: !item->d_ptr->parent yes Evaluation Count:973 | yes Evaluation Count:753 |
| 0-973 |
1844 | d->childExplicitActivation = 0; | - |
1845 | } executed: } Execution Count:973 | 973 |
1846 | | - |
1847 | | - |
1848 | if (autoActivate) { partially evaluated: autoActivate yes Evaluation Count:1726 | no Evaluation Count:0 |
| 0-1726 |
1849 | if (!d->lastActivePanel && !d->activePanel && item->isPanel()) { evaluated: !d->lastActivePanel yes Evaluation Count:1036 | yes Evaluation Count:690 |
evaluated: !d->activePanel yes Evaluation Count:1034 | yes Evaluation Count:2 |
evaluated: item->isPanel() yes Evaluation Count:176 | yes Evaluation Count:858 |
| 2-1036 |
1850 | if (isActive()) evaluated: isActive() yes Evaluation Count:2 | yes Evaluation Count:174 |
| 2-174 |
1851 | setActivePanel(item); executed: setActivePanel(item); Execution Count:2 | 2 |
1852 | else | - |
1853 | d->lastActivePanel = item; executed: d->lastActivePanel = item; Execution Count:174 | 174 |
1854 | } | - |
1855 | } executed: } Execution Count:1726 | 1726 |
1856 | | - |
1857 | if (item->d_ptr->flags & QGraphicsItem::ItemSendsScenePositionChanges) partially evaluated: item->d_ptr->flags & QGraphicsItem::ItemSendsScenePositionChanges no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
1858 | d->registerScenePosItem(item); never executed: d->registerScenePosItem(item); | 0 |
1859 | | - |
1860 | | - |
1861 | | - |
1862 | if (!d->focusItem && item != d->lastFocusItem && item->focusItem() == item) evaluated: !d->focusItem yes Evaluation Count:1725 | yes Evaluation Count:1 |
partially evaluated: item != d->lastFocusItem yes Evaluation Count:1725 | no Evaluation Count:0 |
partially evaluated: item->focusItem() == item no Evaluation Count:0 | yes Evaluation Count:1725 |
| 0-1725 |
1863 | item->focusItem()->setFocus(); never executed: item->focusItem()->setFocus(); | 0 |
1864 | | - |
1865 | d->updateInputMethodSensitivityInViews(); | - |
1866 | } executed: } Execution Count:1726 | 1726 |
1867 | QGraphicsEllipseItem *QGraphicsScene::addEllipse(const QRectF &rect, const QPen &pen, const QBrush &brush) | - |
1868 | { | - |
1869 | QGraphicsEllipseItem *item = new QGraphicsEllipseItem(rect); | - |
1870 | item->setPen(pen); | - |
1871 | item->setBrush(brush); | - |
1872 | addItem(item); | - |
1873 | return item; executed: return item; Execution Count:17 | 17 |
1874 | } | - |
1875 | QGraphicsLineItem *QGraphicsScene::addLine(const QLineF &line, const QPen &pen) | - |
1876 | { | - |
1877 | QGraphicsLineItem *item = new QGraphicsLineItem(line); | - |
1878 | item->setPen(pen); | - |
1879 | addItem(item); | - |
1880 | return item; executed: return item; Execution Count:4 | 4 |
1881 | } | - |
1882 | QGraphicsPathItem *QGraphicsScene::addPath(const QPainterPath &path, const QPen &pen, const QBrush &brush) | - |
1883 | { | - |
1884 | QGraphicsPathItem *item = new QGraphicsPathItem(path); | - |
1885 | item->setPen(pen); | - |
1886 | item->setBrush(brush); | - |
1887 | addItem(item); | - |
1888 | return item; never executed: return item; | 0 |
1889 | } | - |
1890 | QGraphicsPixmapItem *QGraphicsScene::addPixmap(const QPixmap &pixmap) | - |
1891 | { | - |
1892 | QGraphicsPixmapItem *item = new QGraphicsPixmapItem(pixmap); | - |
1893 | addItem(item); | - |
1894 | return item; executed: return item; Execution Count:1 | 1 |
1895 | } | - |
1896 | QGraphicsPolygonItem *QGraphicsScene::addPolygon(const QPolygonF &polygon, | - |
1897 | const QPen &pen, const QBrush &brush) | - |
1898 | { | - |
1899 | QGraphicsPolygonItem *item = new QGraphicsPolygonItem(polygon); | - |
1900 | item->setPen(pen); | - |
1901 | item->setBrush(brush); | - |
1902 | addItem(item); | - |
1903 | return item; never executed: return item; | 0 |
1904 | } | - |
1905 | QGraphicsRectItem *QGraphicsScene::addRect(const QRectF &rect, const QPen &pen, const QBrush &brush) | - |
1906 | { | - |
1907 | QGraphicsRectItem *item = new QGraphicsRectItem(rect); | - |
1908 | item->setPen(pen); | - |
1909 | item->setBrush(brush); | - |
1910 | addItem(item); | - |
1911 | return item; executed: return item; Execution Count:483 | 483 |
1912 | } | - |
1913 | QGraphicsTextItem *QGraphicsScene::addText(const QString &text, const QFont &font) | - |
1914 | { | - |
1915 | QGraphicsTextItem *item = new QGraphicsTextItem(text); | - |
1916 | item->setFont(font); | - |
1917 | addItem(item); | - |
1918 | return item; executed: return item; Execution Count:103 | 103 |
1919 | } | - |
1920 | QGraphicsSimpleTextItem *QGraphicsScene::addSimpleText(const QString &text, const QFont &font) | - |
1921 | { | - |
1922 | QGraphicsSimpleTextItem *item = new QGraphicsSimpleTextItem(text); | - |
1923 | item->setFont(font); | - |
1924 | addItem(item); | - |
1925 | return item; never executed: return item; | 0 |
1926 | } | - |
1927 | QGraphicsProxyWidget *QGraphicsScene::addWidget(QWidget *widget, Qt::WindowFlags wFlags) | - |
1928 | { | - |
1929 | QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(0, wFlags); | - |
1930 | proxy->setWidget(widget); | - |
1931 | addItem(proxy); | - |
1932 | return proxy; executed: return proxy; Execution Count:4 | 4 |
1933 | } | - |
1934 | void QGraphicsScene::removeItem(QGraphicsItem *item) | - |
1935 | { | - |
1936 | | - |
1937 | QGraphicsScenePrivate * const d = d_func(); | - |
1938 | if (!item) { partially evaluated: !item no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
1939 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 2833, __PRETTY_FUNCTION__).warning("QGraphicsScene::removeItem: cannot remove 0-item"); | - |
1940 | return; | 0 |
1941 | } | - |
1942 | if (item->scene() != this) { partially evaluated: item->scene() != this no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
1943 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 2837, __PRETTY_FUNCTION__).warning("QGraphicsScene::removeItem: item %p's scene (%p)" | - |
1944 | " is different from this scene (%p)", | - |
1945 | item, item->scene(), this); | - |
1946 | return; | 0 |
1947 | } | - |
1948 | | - |
1949 | | - |
1950 | | - |
1951 | const QVariant newSceneVariant(item->itemChange(QGraphicsItem::ItemSceneChange, | - |
1952 | QVariant::fromValue<QGraphicsScene *>(0))); | - |
1953 | QGraphicsScene *targetScene = qvariant_cast<QGraphicsScene *>(newSceneVariant); | - |
1954 | if (targetScene != 0 && targetScene != this) { partially evaluated: targetScene != 0 no Evaluation Count:0 | yes Evaluation Count:14 |
never evaluated: targetScene != this | 0-14 |
1955 | targetScene->addItem(item); | - |
1956 | return; | 0 |
1957 | } | - |
1958 | | - |
1959 | d->removeItemHelper(item); | - |
1960 | | - |
1961 | | - |
1962 | item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant); | - |
1963 | | - |
1964 | d->updateInputMethodSensitivityInViews(); | - |
1965 | } executed: } Execution Count:14 | 14 |
1966 | QGraphicsItem *QGraphicsScene::focusItem() const | - |
1967 | { | - |
1968 | const QGraphicsScenePrivate * const d = d_func(); | - |
1969 | return isActive() ? d->focusItem : d->passiveFocusItem; executed: return isActive() ? d->focusItem : d->passiveFocusItem; Execution Count:2804 | 2804 |
1970 | } | - |
1971 | void QGraphicsScene::setFocusItem(QGraphicsItem *item, Qt::FocusReason focusReason) | - |
1972 | { | - |
1973 | QGraphicsScenePrivate * const d = d_func(); | - |
1974 | if (item) evaluated: item yes Evaluation Count:14 | yes Evaluation Count:132 |
| 14-132 |
1975 | item->setFocus(focusReason); executed: item->setFocus(focusReason); Execution Count:14 | 14 |
1976 | else | - |
1977 | d->setFocusItemHelper(item, focusReason); executed: d->setFocusItemHelper(item, focusReason); Execution Count:132 | 132 |
1978 | } | - |
1979 | bool QGraphicsScene::hasFocus() const | - |
1980 | { | - |
1981 | const QGraphicsScenePrivate * const d = d_func(); | - |
1982 | return d->hasFocus; never executed: return d->hasFocus; | 0 |
1983 | } | - |
1984 | void QGraphicsScene::setFocus(Qt::FocusReason focusReason) | - |
1985 | { | - |
1986 | QGraphicsScenePrivate * const d = d_func(); | - |
1987 | if (d->hasFocus || !isActive()) evaluated: d->hasFocus yes Evaluation Count:18 | yes Evaluation Count:20 |
partially evaluated: !isActive() no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
1988 | return; executed: return; Execution Count:18 | 18 |
1989 | QFocusEvent event(QEvent::FocusIn, focusReason); | - |
1990 | QCoreApplication::sendEvent(this, &event); | - |
1991 | } executed: } Execution Count:20 | 20 |
1992 | void QGraphicsScene::clearFocus() | - |
1993 | { | - |
1994 | QGraphicsScenePrivate * const d = d_func(); | - |
1995 | if (d->hasFocus) { partially evaluated: d->hasFocus yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
1996 | d->hasFocus = false; | - |
1997 | d->passiveFocusItem = d->focusItem; | - |
1998 | setFocusItem(0, Qt::OtherFocusReason); | - |
1999 | } executed: } Execution Count:8 | 8 |
2000 | } executed: } Execution Count:8 | 8 |
2001 | void QGraphicsScene::setStickyFocus(bool enabled) | - |
2002 | { | - |
2003 | QGraphicsScenePrivate * const d = d_func(); | - |
2004 | d->stickyFocus = enabled; | - |
2005 | } | 0 |
2006 | bool QGraphicsScene::stickyFocus() const | - |
2007 | { | - |
2008 | const QGraphicsScenePrivate * const d = d_func(); | - |
2009 | return d->stickyFocus; never executed: return d->stickyFocus; | 0 |
2010 | } | - |
2011 | QGraphicsItem *QGraphicsScene::mouseGrabberItem() const | - |
2012 | { | - |
2013 | const QGraphicsScenePrivate * const d = d_func(); | - |
2014 | return !d->mouseGrabberItems.isEmpty() ? d->mouseGrabberItems.last() : 0; executed: return !d->mouseGrabberItems.isEmpty() ? d->mouseGrabberItems.last() : 0; Execution Count:2679 | 2679 |
2015 | } | - |
2016 | QBrush QGraphicsScene::backgroundBrush() const | - |
2017 | { | - |
2018 | const QGraphicsScenePrivate * const d = d_func(); | - |
2019 | return d->backgroundBrush; executed: return d->backgroundBrush; Execution Count:259 | 259 |
2020 | } | - |
2021 | void QGraphicsScene::setBackgroundBrush(const QBrush &brush) | - |
2022 | { | - |
2023 | QGraphicsScenePrivate * const d = d_func(); | - |
2024 | d->backgroundBrush = brush; | - |
2025 | for (QForeachContainer<__typeof__(d->views)> _container_(d->views); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
2026 | view->resetCachedContent(); | - |
2027 | view->viewport()->update(); | - |
2028 | } executed: } Execution Count:153 | 153 |
2029 | update(); | - |
2030 | } executed: } Execution Count:154 | 154 |
2031 | QBrush QGraphicsScene::foregroundBrush() const | - |
2032 | { | - |
2033 | const QGraphicsScenePrivate * const d = d_func(); | - |
2034 | return d->foregroundBrush; executed: return d->foregroundBrush; Execution Count:255 | 255 |
2035 | } | - |
2036 | void QGraphicsScene::setForegroundBrush(const QBrush &brush) | - |
2037 | { | - |
2038 | QGraphicsScenePrivate * const d = d_func(); | - |
2039 | d->foregroundBrush = brush; | - |
2040 | for (QForeachContainer<__typeof__(views())> _container_(views()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
2041 | view->viewport()->update(); executed: view->viewport()->update(); Execution Count:103 | 103 |
2042 | update(); | - |
2043 | } executed: } Execution Count:103 | 103 |
2044 | QVariant QGraphicsScene::inputMethodQuery(Qt::InputMethodQuery query) const | - |
2045 | { | - |
2046 | const QGraphicsScenePrivate * const d = d_func(); | - |
2047 | if (!d->focusItem || !(d->focusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)) evaluated: !d->focusItem yes Evaluation Count:2 | yes Evaluation Count:9 |
partially evaluated: !(d->focusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod) no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
2048 | return QVariant(); executed: return QVariant(); Execution Count:2 | 2 |
2049 | const QTransform matrix = d->focusItem->sceneTransform(); | - |
2050 | QVariant value = d->focusItem->inputMethodQuery(query); | - |
2051 | if (value.type() == QVariant::RectF) evaluated: value.type() == QVariant::RectF yes Evaluation Count:2 | yes Evaluation Count:7 |
| 2-7 |
2052 | value = matrix.mapRect(value.toRectF()); executed: value = matrix.mapRect(value.toRectF()); Execution Count:2 | 2 |
2053 | else if (value.type() == QVariant::PointF) partially evaluated: value.type() == QVariant::PointF no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
2054 | value = matrix.map(value.toPointF()); never executed: value = matrix.map(value.toPointF()); | 0 |
2055 | else if (value.type() == QVariant::Rect) partially evaluated: value.type() == QVariant::Rect no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
2056 | value = matrix.mapRect(value.toRect()); never executed: value = matrix.mapRect(value.toRect()); | 0 |
2057 | else if (value.type() == QVariant::Point) partially evaluated: value.type() == QVariant::Point no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
2058 | value = matrix.map(value.toPoint()); never executed: value = matrix.map(value.toPoint()); | 0 |
2059 | return value; executed: return value; Execution Count:9 | 9 |
2060 | } | - |
2061 | | - |
2062 | | - |
2063 | | - |
2064 | | - |
2065 | | - |
2066 | | - |
2067 | | - |
2068 | void QGraphicsScene::update(const QRectF &rect) | - |
2069 | { | - |
2070 | QGraphicsScenePrivate * const d = d_func(); | - |
2071 | if (d->updateAll || (rect.isEmpty() && !rect.isNull())) evaluated: d->updateAll yes Evaluation Count:380 | yes Evaluation Count:1491 |
evaluated: rect.isEmpty() yes Evaluation Count:1370 | yes Evaluation Count:121 |
partially evaluated: !rect.isNull() no Evaluation Count:0 | yes Evaluation Count:1370 |
| 0-1491 |
2072 | return; executed: return; Execution Count:380 | 380 |
2073 | | - |
2074 | | - |
2075 | | - |
2076 | bool directUpdates = !(d->isSignalConnected(d->changedSignalIndex)) && !d->views.isEmpty(); evaluated: !(d->isSignalConnected(d->changedSignalIndex)) yes Evaluation Count:1477 | yes Evaluation Count:14 |
evaluated: !d->views.isEmpty() yes Evaluation Count:160 | yes Evaluation Count:1317 |
| 14-1477 |
2077 | if (rect.isNull()) { evaluated: rect.isNull() yes Evaluation Count:1370 | yes Evaluation Count:121 |
| 121-1370 |
2078 | d->updateAll = true; | - |
2079 | d->updatedRects.clear(); | - |
2080 | if (directUpdates) { evaluated: directUpdates yes Evaluation Count:54 | yes Evaluation Count:1316 |
| 54-1316 |
2081 | | - |
2082 | for (int i = 0; i < d->views.size(); ++i) evaluated: i < d->views.size() yes Evaluation Count:54 | yes Evaluation Count:54 |
| 54 |
2083 | d->views.at(i)->d_func()->fullUpdatePending = true; executed: d->views.at(i)->d_func()->fullUpdatePending = true; Execution Count:54 | 54 |
2084 | } executed: } Execution Count:54 | 54 |
2085 | } else { executed: } Execution Count:1370 | 1370 |
2086 | if (directUpdates) { evaluated: directUpdates yes Evaluation Count:106 | yes Evaluation Count:15 |
| 15-106 |
2087 | | - |
2088 | for (int i = 0; i < d->views.size(); ++i) { evaluated: i < d->views.size() yes Evaluation Count:106 | yes Evaluation Count:106 |
| 106 |
2089 | QGraphicsView *view = d->views.at(i); | - |
2090 | if (view->isTransformed()) partially evaluated: view->isTransformed() yes Evaluation Count:106 | no Evaluation Count:0 |
| 0-106 |
2091 | view->d_func()->updateRectF(view->viewportTransform().mapRect(rect)); executed: view->d_func()->updateRectF(view->viewportTransform().mapRect(rect)); Execution Count:106 | 106 |
2092 | else | - |
2093 | view->d_func()->updateRectF(rect); never executed: view->d_func()->updateRectF(rect); | 0 |
2094 | } | - |
2095 | } else { executed: } Execution Count:106 | 106 |
2096 | d->updatedRects << rect; | - |
2097 | } executed: } Execution Count:15 | 15 |
2098 | } | - |
2099 | | - |
2100 | if (!d->calledEmitUpdated) { evaluated: !d->calledEmitUpdated yes Evaluation Count:1385 | yes Evaluation Count:106 |
| 106-1385 |
2101 | d->calledEmitUpdated = true; | - |
2102 | QMetaObject::invokeMethod(this, "_q_emitUpdated", Qt::QueuedConnection); | - |
2103 | } executed: } Execution Count:1385 | 1385 |
2104 | } executed: } Execution Count:1491 | 1491 |
2105 | void QGraphicsScene::invalidate(const QRectF &rect, SceneLayers layers) | - |
2106 | { | - |
2107 | for (QForeachContainer<__typeof__(views())> _container_(views()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
2108 | view->invalidateScene(rect, layers); never executed: view->invalidateScene(rect, layers); | 0 |
2109 | update(rect); | - |
2110 | } | 0 |
2111 | QList <QGraphicsView *> QGraphicsScene::views() const | - |
2112 | { | - |
2113 | const QGraphicsScenePrivate * const d = d_func(); | - |
2114 | return d->views; executed: return d->views; Execution Count:258 | 258 |
2115 | } | - |
2116 | void QGraphicsScene::advance() | - |
2117 | { | - |
2118 | for (int i = 0; i < 2; ++i) { | 0 |
2119 | for (QForeachContainer<__typeof__(items())> _container_(items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
2120 | item->advance(i); never executed: item->advance(i); | 0 |
2121 | } | 0 |
2122 | } | 0 |
2123 | bool QGraphicsScene::event(QEvent *event) | - |
2124 | { | - |
2125 | QGraphicsScenePrivate * const d = d_func(); | - |
2126 | | - |
2127 | switch (event->type()) { | - |
2128 | case QEvent::GraphicsSceneMousePress: | - |
2129 | case QEvent::GraphicsSceneMouseMove: | - |
2130 | case QEvent::GraphicsSceneMouseRelease: | - |
2131 | case QEvent::GraphicsSceneMouseDoubleClick: | - |
2132 | case QEvent::GraphicsSceneHoverEnter: | - |
2133 | case QEvent::GraphicsSceneHoverLeave: | - |
2134 | case QEvent::GraphicsSceneHoverMove: | - |
2135 | case QEvent::TouchBegin: | - |
2136 | case QEvent::TouchUpdate: | - |
2137 | case QEvent::TouchEnd: | - |
2138 | | - |
2139 | | - |
2140 | | - |
2141 | | - |
2142 | | - |
2143 | | - |
2144 | | - |
2145 | d->cachedItemsUnderMouse.clear(); | - |
2146 | default: | - |
2147 | break; executed: break; Execution Count:4316 | 4316 |
2148 | } | - |
2149 | | - |
2150 | switch (event->type()) { | - |
2151 | case QEvent::GraphicsSceneDragEnter: | - |
2152 | dragEnterEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); | - |
2153 | break; | 0 |
2154 | case QEvent::GraphicsSceneDragMove: | - |
2155 | dragMoveEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); | - |
2156 | break; | 0 |
2157 | case QEvent::GraphicsSceneDragLeave: | - |
2158 | dragLeaveEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); | - |
2159 | break; | 0 |
2160 | case QEvent::GraphicsSceneDrop: | - |
2161 | dropEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); | - |
2162 | break; | 0 |
2163 | case QEvent::GraphicsSceneContextMenu: | - |
2164 | contextMenuEvent(static_cast<QGraphicsSceneContextMenuEvent *>(event)); | - |
2165 | break; executed: break; Execution Count:100 | 100 |
2166 | case QEvent::KeyPress: | - |
2167 | if (!d->focusItem) { partially evaluated: !d->focusItem no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2168 | QKeyEvent *k = static_cast<QKeyEvent *>(event); | - |
2169 | 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 |
2170 | if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { never evaluated: !(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier)) | 0 |
2171 | bool res = false; | - |
2172 | if (k->key() == Qt::Key_Backtab never evaluated: k->key() == Qt::Key_Backtab | 0 |
2173 | || (k->key() == Qt::Key_Tab && (k->modifiers() & Qt::ShiftModifier))) { never evaluated: k->key() == Qt::Key_Tab never evaluated: (k->modifiers() & Qt::ShiftModifier) | 0 |
2174 | res = focusNextPrevChild(false); | - |
2175 | } else if (k->key() == Qt::Key_Tab) { never evaluated: k->key() == Qt::Key_Tab | 0 |
2176 | res = focusNextPrevChild(true); | - |
2177 | } | 0 |
2178 | if (!res) | 0 |
2179 | event->ignore(); never executed: event->ignore(); | 0 |
2180 | return true; never executed: return true; | 0 |
2181 | } | - |
2182 | } | 0 |
2183 | } | 0 |
2184 | keyPressEvent(static_cast<QKeyEvent *>(event)); | - |
2185 | break; executed: break; Execution Count:1 | 1 |
2186 | case QEvent::KeyRelease: | - |
2187 | keyReleaseEvent(static_cast<QKeyEvent *>(event)); | - |
2188 | break; | 0 |
2189 | case QEvent::ShortcutOverride: { | - |
2190 | QGraphicsItem *parent = focusItem(); | - |
2191 | while (parent) { evaluated: parent yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
2192 | d->sendEvent(parent, event); | - |
2193 | if (event->isAccepted()) partially evaluated: event->isAccepted() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2194 | return true; never executed: return true; | 0 |
2195 | parent = parent->parentItem(); | - |
2196 | } executed: } Execution Count:1 | 1 |
2197 | } | - |
2198 | return false; executed: return false; Execution Count:1 | 1 |
2199 | case QEvent::GraphicsSceneMouseMove: | - |
2200 | { | - |
2201 | QGraphicsSceneMouseEvent *mouseEvent = static_cast<QGraphicsSceneMouseEvent *>(event); | - |
2202 | d->lastSceneMousePos = mouseEvent->scenePos(); | - |
2203 | mouseMoveEvent(mouseEvent); | - |
2204 | break; executed: break; Execution Count:57 | 57 |
2205 | } | - |
2206 | case QEvent::GraphicsSceneMousePress: | - |
2207 | mousePressEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); | - |
2208 | break; executed: break; Execution Count:116 | 116 |
2209 | case QEvent::GraphicsSceneMouseRelease: | - |
2210 | mouseReleaseEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); | - |
2211 | break; executed: break; Execution Count:112 | 112 |
2212 | case QEvent::GraphicsSceneMouseDoubleClick: | - |
2213 | mouseDoubleClickEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); | - |
2214 | break; | 0 |
2215 | case QEvent::GraphicsSceneWheel: | - |
2216 | wheelEvent(static_cast<QGraphicsSceneWheelEvent *>(event)); | - |
2217 | break; executed: break; Execution Count:2 | 2 |
2218 | case QEvent::FocusIn: | - |
2219 | focusInEvent(static_cast<QFocusEvent *>(event)); | - |
2220 | break; executed: break; Execution Count:581 | 581 |
2221 | case QEvent::FocusOut: | - |
2222 | focusOutEvent(static_cast<QFocusEvent *>(event)); | - |
2223 | break; executed: break; Execution Count:4 | 4 |
2224 | case QEvent::GraphicsSceneHoverEnter: | - |
2225 | case QEvent::GraphicsSceneHoverLeave: | - |
2226 | case QEvent::GraphicsSceneHoverMove: | - |
2227 | { | - |
2228 | QGraphicsSceneHoverEvent *hoverEvent = static_cast<QGraphicsSceneHoverEvent *>(event); | - |
2229 | d->lastSceneMousePos = hoverEvent->scenePos(); | - |
2230 | d->dispatchHoverEvent(hoverEvent); | - |
2231 | break; | 0 |
2232 | } | - |
2233 | case QEvent::Leave: | - |
2234 | | - |
2235 | d->leaveScene(reinterpret_cast<QWidget *>(event->d)); | - |
2236 | break; executed: break; Execution Count:2 | 2 |
2237 | case QEvent::GraphicsSceneHelp: | - |
2238 | helpEvent(static_cast<QGraphicsSceneHelpEvent *>(event)); | - |
2239 | break; | 0 |
2240 | case QEvent::InputMethod: | - |
2241 | inputMethodEvent(static_cast<QInputMethodEvent *>(event)); | - |
2242 | break; executed: break; Execution Count:3 | 3 |
2243 | case QEvent::WindowActivate: | - |
2244 | if (!d->activationRefCount++) { evaluated: !d->activationRefCount++ yes Evaluation Count:567 | yes Evaluation Count:5 |
| 5-567 |
2245 | if (d->lastActivePanel) { evaluated: d->lastActivePanel yes Evaluation Count:14 | yes Evaluation Count:553 |
| 14-553 |
2246 | | - |
2247 | d->setActivePanelHelper(d->lastActivePanel, true); | - |
2248 | } else if (d->tabFocusFirst && d->tabFocusFirst->isPanel()) { evaluated: d->tabFocusFirst yes Evaluation Count:10 | yes Evaluation Count:543 |
partially evaluated: d->tabFocusFirst->isPanel() no Evaluation Count:0 | yes Evaluation Count:10 |
executed: } Execution Count:14 | 0-543 |
2249 | | - |
2250 | | - |
2251 | d->setActivePanelHelper(d->tabFocusFirst, true); | - |
2252 | } else { | 0 |
2253 | | - |
2254 | QEvent event(QEvent::WindowActivate); | - |
2255 | for (QForeachContainer<__typeof__(items())> _container_(items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
2256 | if (item->isVisible() && !item->isPanel() && !item->parentItem()) evaluated: item->isVisible() yes Evaluation Count:311 | yes Evaluation Count:1 |
partially evaluated: !item->isPanel() yes Evaluation Count:311 | no Evaluation Count:0 |
evaluated: !item->parentItem() yes Evaluation Count:283 | yes Evaluation Count:28 |
| 0-311 |
2257 | sendEvent(item, &event); executed: sendEvent(item, &event); Execution Count:283 | 283 |
2258 | } executed: } Execution Count:312 | 312 |
2259 | } executed: } Execution Count:553 | 553 |
2260 | } | - |
2261 | break; executed: break; Execution Count:572 | 572 |
2262 | case QEvent::WindowDeactivate: | - |
2263 | if (!--d->activationRefCount) { evaluated: !--d->activationRefCount yes Evaluation Count:10 | yes Evaluation Count:3 |
| 3-10 |
2264 | if (d->activePanel) { partially evaluated: d->activePanel no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
2265 | | - |
2266 | | - |
2267 | QGraphicsItem *lastActivePanel = d->activePanel; | - |
2268 | d->setActivePanelHelper(0, true); | - |
2269 | d->lastActivePanel = lastActivePanel; | - |
2270 | } else { | 0 |
2271 | | - |
2272 | QEvent event(QEvent::WindowDeactivate); | - |
2273 | for (QForeachContainer<__typeof__(items())> _container_(items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
2274 | if (item->isVisible() && !item->isPanel() && !item->parentItem()) partially evaluated: item->isVisible() yes Evaluation Count:6 | no Evaluation Count:0 |
partially evaluated: !item->isPanel() yes Evaluation Count:6 | no Evaluation Count:0 |
evaluated: !item->parentItem() yes Evaluation Count:5 | yes Evaluation Count:1 |
| 0-6 |
2275 | sendEvent(item, &event); executed: sendEvent(item, &event); Execution Count:5 | 5 |
2276 | } executed: } Execution Count:6 | 6 |
2277 | } executed: } Execution Count:10 | 10 |
2278 | } | - |
2279 | break; executed: break; Execution Count:13 | 13 |
2280 | case QEvent::ApplicationFontChange: { | - |
2281 | | - |
2282 | d->resolveFont(); | - |
2283 | break; | 0 |
2284 | } | - |
2285 | case QEvent::FontChange: | - |
2286 | | - |
2287 | update(); | - |
2288 | break; | 0 |
2289 | case QEvent::ApplicationPaletteChange: { | - |
2290 | | - |
2291 | d->resolvePalette(); | - |
2292 | break; | 0 |
2293 | } | - |
2294 | case QEvent::PaletteChange: | - |
2295 | | - |
2296 | update(); | - |
2297 | break; | 0 |
2298 | case QEvent::StyleChange: | - |
2299 | | - |
2300 | | - |
2301 | update(); | - |
2302 | break; | 0 |
2303 | case QEvent::StyleAnimationUpdate: | - |
2304 | | - |
2305 | | - |
2306 | update(); | - |
2307 | break; | 0 |
2308 | case QEvent::TouchBegin: | - |
2309 | case QEvent::TouchUpdate: | - |
2310 | case QEvent::TouchEnd: | - |
2311 | d->touchEventHandler(static_cast<QTouchEvent *>(event)); | - |
2312 | break; | 0 |
2313 | | - |
2314 | case QEvent::Gesture: | - |
2315 | case QEvent::GestureOverride: | - |
2316 | d->gestureEventHandler(static_cast<QGestureEvent *>(event)); | - |
2317 | break; executed: break; Execution Count:144 | 144 |
2318 | | - |
2319 | default: | - |
2320 | return QObject::event(event); executed: return QObject::event(event); Execution Count:2608 | 2608 |
2321 | } | - |
2322 | return true; executed: return true; Execution Count:1707 | 1707 |
2323 | } | - |
2324 | | - |
2325 | | - |
2326 | | - |
2327 | | - |
2328 | | - |
2329 | | - |
2330 | | - |
2331 | bool QGraphicsScene::eventFilter(QObject *watched, QEvent *event) | - |
2332 | { | - |
2333 | if (watched != (static_cast<QApplication *>(QCoreApplication::instance()))) never evaluated: watched != (static_cast<QApplication *>(QCoreApplication::instance())) | 0 |
2334 | return false; never executed: return false; | 0 |
2335 | | - |
2336 | switch (event->type()) { | - |
2337 | case QEvent::ApplicationPaletteChange: | - |
2338 | QApplication::postEvent(this, new QEvent(QEvent::ApplicationPaletteChange)); | - |
2339 | break; | 0 |
2340 | case QEvent::ApplicationFontChange: | - |
2341 | QApplication::postEvent(this, new QEvent(QEvent::ApplicationFontChange)); | - |
2342 | break; | 0 |
2343 | default: | - |
2344 | break; | 0 |
2345 | } | - |
2346 | return false; never executed: return false; | 0 |
2347 | } | - |
2348 | void QGraphicsScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent) | - |
2349 | { | - |
2350 | QGraphicsScenePrivate * const d = d_func(); | - |
2351 | | - |
2352 | contextMenuEvent->ignore(); | - |
2353 | | - |
2354 | | - |
2355 | | - |
2356 | for (QForeachContainer<__typeof__(d->itemsAtPosition(contextMenuEvent->screenPos(), contextMenuEvent->scenePos(), contextMenuEvent->widget()))> _container_(d->itemsAtPosition(contextMenuEvent->screenPos(), contextMenuEvent->scenePos(), contextMenuEvent->widget())); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
2357 | | - |
2358 | | - |
2359 | contextMenuEvent->setPos(item->d_ptr->genericMapFromScene(contextMenuEvent->scenePos(), | - |
2360 | contextMenuEvent->widget())); | - |
2361 | contextMenuEvent->accept(); | - |
2362 | if (!d->sendEvent(item, contextMenuEvent)) partially evaluated: !d->sendEvent(item, contextMenuEvent) no Evaluation Count:0 | yes Evaluation Count:100 |
| 0-100 |
2363 | break; | 0 |
2364 | | - |
2365 | if (contextMenuEvent->isAccepted()) partially evaluated: contextMenuEvent->isAccepted() no Evaluation Count:0 | yes Evaluation Count:100 |
| 0-100 |
2366 | break; | 0 |
2367 | } executed: } Execution Count:100 | 100 |
2368 | } executed: } Execution Count:100 | 100 |
2369 | void QGraphicsScene::dragEnterEvent(QGraphicsSceneDragDropEvent *event) | - |
2370 | { | - |
2371 | QGraphicsScenePrivate * const d = d_func(); | - |
2372 | d->dragDropItem = 0; | - |
2373 | d->lastDropAction = Qt::IgnoreAction; | - |
2374 | event->accept(); | - |
2375 | } | 0 |
2376 | void QGraphicsScene::dragMoveEvent(QGraphicsSceneDragDropEvent *event) | - |
2377 | { | - |
2378 | QGraphicsScenePrivate * const d = d_func(); | - |
2379 | event->ignore(); | - |
2380 | | - |
2381 | if (!d->mouseGrabberItems.isEmpty()) { never evaluated: !d->mouseGrabberItems.isEmpty() | 0 |
2382 | | - |
2383 | d->clearMouseGrabber(); | - |
2384 | d->mouseGrabberButtonDownPos.clear(); | - |
2385 | d->mouseGrabberButtonDownScenePos.clear(); | - |
2386 | d->mouseGrabberButtonDownScreenPos.clear(); | - |
2387 | } | 0 |
2388 | | - |
2389 | bool eventDelivered = false; | - |
2390 | | - |
2391 | | - |
2392 | | - |
2393 | for (QForeachContainer<__typeof__(d->itemsAtPosition(event->screenPos(), event->scenePos(), event->widget()))> _container_(d->itemsAtPosition(event->screenPos(), event->scenePos(), event->widget())); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
2394 | | - |
2395 | | - |
2396 | if (!item->isEnabled() || !item->acceptDrops()) never evaluated: !item->isEnabled() never evaluated: !item->acceptDrops() | 0 |
2397 | continue; never executed: continue; | 0 |
2398 | | - |
2399 | if (item != d->dragDropItem) { never evaluated: item != d->dragDropItem | 0 |
2400 | | - |
2401 | | - |
2402 | QGraphicsSceneDragDropEvent dragEnter(QEvent::GraphicsSceneDragEnter); | - |
2403 | d->cloneDragDropEvent(&dragEnter, event); | - |
2404 | dragEnter.setDropAction(event->proposedAction()); | - |
2405 | d->sendDragDropEvent(item, &dragEnter); | - |
2406 | event->setAccepted(dragEnter.isAccepted()); | - |
2407 | event->setDropAction(dragEnter.dropAction()); | - |
2408 | if (!event->isAccepted()) { never evaluated: !event->isAccepted() | 0 |
2409 | | - |
2410 | continue; never executed: continue; | 0 |
2411 | } | - |
2412 | | - |
2413 | d->lastDropAction = event->dropAction(); | - |
2414 | | - |
2415 | if (d->dragDropItem) { never evaluated: d->dragDropItem | 0 |
2416 | | - |
2417 | | - |
2418 | | - |
2419 | | - |
2420 | QGraphicsSceneDragDropEvent dragLeave(QEvent::GraphicsSceneDragLeave); | - |
2421 | d->cloneDragDropEvent(&dragLeave, event); | - |
2422 | d->sendDragDropEvent(d->dragDropItem, &dragLeave); | - |
2423 | } | 0 |
2424 | | - |
2425 | | - |
2426 | d->dragDropItem = item; | - |
2427 | } | 0 |
2428 | | - |
2429 | | - |
2430 | event->setDropAction(d->lastDropAction); | - |
2431 | event->accept(); | - |
2432 | d->sendDragDropEvent(item, event); | - |
2433 | if (event->isAccepted()) never evaluated: event->isAccepted() | 0 |
2434 | d->lastDropAction = event->dropAction(); never executed: d->lastDropAction = event->dropAction(); | 0 |
2435 | eventDelivered = true; | - |
2436 | break; | 0 |
2437 | } | - |
2438 | | - |
2439 | if (!eventDelivered) { never evaluated: !eventDelivered | 0 |
2440 | if (d->dragDropItem) { never evaluated: d->dragDropItem | 0 |
2441 | | - |
2442 | QGraphicsSceneDragDropEvent dragLeave(QEvent::GraphicsSceneDragLeave); | - |
2443 | d->cloneDragDropEvent(&dragLeave, event); | - |
2444 | d->sendDragDropEvent(d->dragDropItem, &dragLeave); | - |
2445 | d->dragDropItem = 0; | - |
2446 | } | 0 |
2447 | | - |
2448 | event->setDropAction(Qt::IgnoreAction); | - |
2449 | } | 0 |
2450 | } | 0 |
2451 | void QGraphicsScene::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) | - |
2452 | { | - |
2453 | QGraphicsScenePrivate * const d = d_func(); | - |
2454 | if (d->dragDropItem) { never evaluated: d->dragDropItem | 0 |
2455 | | - |
2456 | d->sendDragDropEvent(d->dragDropItem, event); | - |
2457 | d->dragDropItem = 0; | - |
2458 | } | 0 |
2459 | } | 0 |
2460 | void QGraphicsScene::dropEvent(QGraphicsSceneDragDropEvent *event) | - |
2461 | { | - |
2462 | (void)event;; | - |
2463 | QGraphicsScenePrivate * const d = d_func(); | - |
2464 | if (d->dragDropItem) { never evaluated: d->dragDropItem | 0 |
2465 | | - |
2466 | d->sendDragDropEvent(d->dragDropItem, event); | - |
2467 | d->dragDropItem = 0; | - |
2468 | } | 0 |
2469 | } | 0 |
2470 | void QGraphicsScene::focusInEvent(QFocusEvent *focusEvent) | - |
2471 | { | - |
2472 | QGraphicsScenePrivate * const d = d_func(); | - |
2473 | | - |
2474 | d->hasFocus = true; | - |
2475 | switch (focusEvent->reason()) { | - |
2476 | case Qt::TabFocusReason: | - |
2477 | if (!focusNextPrevChild(true)) never evaluated: !focusNextPrevChild(true) | 0 |
2478 | focusEvent->ignore(); never executed: focusEvent->ignore(); | 0 |
2479 | break; | 0 |
2480 | case Qt::BacktabFocusReason: | - |
2481 | if (!focusNextPrevChild(false)) never evaluated: !focusNextPrevChild(false) | 0 |
2482 | focusEvent->ignore(); never executed: focusEvent->ignore(); | 0 |
2483 | break; | 0 |
2484 | default: | - |
2485 | if (d->passiveFocusItem) { evaluated: d->passiveFocusItem yes Evaluation Count:2 | yes Evaluation Count:579 |
| 2-579 |
2486 | | - |
2487 | setFocusItem(d->passiveFocusItem, focusEvent->reason()); | - |
2488 | } executed: } Execution Count:2 | 2 |
2489 | break; executed: break; Execution Count:581 | 581 |
2490 | } | - |
2491 | } executed: } Execution Count:581 | 581 |
2492 | void QGraphicsScene::focusOutEvent(QFocusEvent *focusEvent) | - |
2493 | { | - |
2494 | QGraphicsScenePrivate * const d = d_func(); | - |
2495 | d->hasFocus = false; | - |
2496 | d->passiveFocusItem = d->focusItem; | - |
2497 | setFocusItem(0, focusEvent->reason()); | - |
2498 | | - |
2499 | | - |
2500 | if (!d->popupWidgets.isEmpty()) partially evaluated: !d->popupWidgets.isEmpty() no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
2501 | d->removePopup(d->popupWidgets.first()); never executed: d->removePopup(d->popupWidgets.first()); | 0 |
2502 | } executed: } Execution Count:4 | 4 |
2503 | void QGraphicsScene::helpEvent(QGraphicsSceneHelpEvent *helpEvent) | - |
2504 | { | - |
2505 | | - |
2506 | | - |
2507 | | - |
2508 | | - |
2509 | QGraphicsScenePrivate * const d = d_func(); | - |
2510 | QList<QGraphicsItem *> itemsAtPos = d->itemsAtPosition(helpEvent->screenPos(), | - |
2511 | helpEvent->scenePos(), | - |
2512 | helpEvent->widget()); | - |
2513 | QGraphicsItem *toolTipItem = 0; | - |
2514 | for (int i = 0; i < itemsAtPos.size(); ++i) { never evaluated: i < itemsAtPos.size() | 0 |
2515 | QGraphicsItem *tmp = itemsAtPos.at(i); | - |
2516 | if (tmp->d_func()->isProxyWidget()) { never evaluated: tmp->d_func()->isProxyWidget() | 0 |
2517 | | - |
2518 | sendEvent(tmp, helpEvent); | - |
2519 | if (helpEvent->isAccepted()) never evaluated: helpEvent->isAccepted() | 0 |
2520 | return; | 0 |
2521 | } | 0 |
2522 | if (!tmp->toolTip().isEmpty()) { never evaluated: !tmp->toolTip().isEmpty() | 0 |
2523 | toolTipItem = tmp; | - |
2524 | break; | 0 |
2525 | } | - |
2526 | } | 0 |
2527 | | - |
2528 | | - |
2529 | QString text; | - |
2530 | QPoint point; | - |
2531 | if (toolTipItem && !toolTipItem->toolTip().isEmpty()) { never evaluated: toolTipItem never evaluated: !toolTipItem->toolTip().isEmpty() | 0 |
2532 | text = toolTipItem->toolTip(); | - |
2533 | point = helpEvent->screenPos(); | - |
2534 | } | 0 |
2535 | QToolTip::showText(point, text, helpEvent->widget()); | - |
2536 | helpEvent->setAccepted(!text.isEmpty()); | - |
2537 | | - |
2538 | } | 0 |
2539 | | - |
2540 | bool QGraphicsScenePrivate::itemAcceptsHoverEvents_helper(const QGraphicsItem *item) const | - |
2541 | { | - |
2542 | return (item->d_ptr->acceptsHover | 923 |
2543 | || (item->d_ptr->isWidget | 923 |
2544 | && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration())) | 923 |
2545 | && !item->isBlockedByModalPanel(); executed: return (item->d_ptr->acceptsHover || (item->d_ptr->isWidget && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration())) && !item->isBlockedByModalPanel(); Execution Count:923 | 923 |
2546 | } | - |
2547 | bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEvent) | - |
2548 | { | - |
2549 | if (allItemsIgnoreHoverEvents) partially evaluated: allItemsIgnoreHoverEvents yes Evaluation Count:263 | no Evaluation Count:0 |
| 0-263 |
2550 | return false; executed: return false; Execution Count:263 | 263 |
2551 | | - |
2552 | | - |
2553 | | - |
2554 | if (cachedItemsUnderMouse.isEmpty()) { never evaluated: cachedItemsUnderMouse.isEmpty() | 0 |
2555 | cachedItemsUnderMouse = itemsAtPosition(hoverEvent->screenPos(), | - |
2556 | hoverEvent->scenePos(), | - |
2557 | hoverEvent->widget()); | - |
2558 | } | 0 |
2559 | | - |
2560 | QGraphicsItem *item = 0; | - |
2561 | for (int i = 0; i < cachedItemsUnderMouse.size(); ++i) { never evaluated: i < cachedItemsUnderMouse.size() | 0 |
2562 | QGraphicsItem *tmp = cachedItemsUnderMouse.at(i); | - |
2563 | if (itemAcceptsHoverEvents_helper(tmp)) { never evaluated: itemAcceptsHoverEvents_helper(tmp) | 0 |
2564 | item = tmp; | - |
2565 | break; | 0 |
2566 | } | - |
2567 | } | 0 |
2568 | | - |
2569 | | - |
2570 | | - |
2571 | QGraphicsItem *commonAncestorItem = (item && !hoverItems.isEmpty()) ? item->commonAncestorItem(hoverItems.last()) : 0; never evaluated: !hoverItems.isEmpty() | 0 |
2572 | while (commonAncestorItem && !itemAcceptsHoverEvents_helper(commonAncestorItem)) never evaluated: commonAncestorItem never evaluated: !itemAcceptsHoverEvents_helper(commonAncestorItem) | 0 |
2573 | commonAncestorItem = commonAncestorItem->parentItem(); never executed: commonAncestorItem = commonAncestorItem->parentItem(); | 0 |
2574 | if (commonAncestorItem && commonAncestorItem->panel() != item->panel()) { never evaluated: commonAncestorItem never evaluated: commonAncestorItem->panel() != item->panel() | 0 |
2575 | | - |
2576 | | - |
2577 | commonAncestorItem = 0; | - |
2578 | } | 0 |
2579 | | - |
2580 | | - |
2581 | int index = commonAncestorItem ? hoverItems.indexOf(commonAncestorItem) : -1; never evaluated: commonAncestorItem | 0 |
2582 | | - |
2583 | | - |
2584 | for (int i = hoverItems.size() - 1; i > index; --i) { never evaluated: i > index | 0 |
2585 | QGraphicsItem *lastItem = hoverItems.takeLast(); | - |
2586 | if (itemAcceptsHoverEvents_helper(lastItem)) never evaluated: itemAcceptsHoverEvents_helper(lastItem) | 0 |
2587 | sendHoverEvent(QEvent::GraphicsSceneHoverLeave, lastItem, hoverEvent); never executed: sendHoverEvent(QEvent::GraphicsSceneHoverLeave, lastItem, hoverEvent); | 0 |
2588 | } | 0 |
2589 | | - |
2590 | | - |
2591 | | - |
2592 | QList<QGraphicsItem *> parents; | - |
2593 | QGraphicsItem *parent = item; | - |
2594 | while (parent && parent != commonAncestorItem) { never evaluated: parent != commonAncestorItem | 0 |
2595 | parents.prepend(parent); | - |
2596 | if (parent->isPanel()) { never evaluated: parent->isPanel() | 0 |
2597 | | - |
2598 | break; | 0 |
2599 | } | - |
2600 | parent = parent->parentItem(); | - |
2601 | } | 0 |
2602 | for (int i = 0; i < parents.size(); ++i) { never evaluated: i < parents.size() | 0 |
2603 | parent = parents.at(i); | - |
2604 | hoverItems << parent; | - |
2605 | if (itemAcceptsHoverEvents_helper(parent)) never evaluated: itemAcceptsHoverEvents_helper(parent) | 0 |
2606 | sendHoverEvent(QEvent::GraphicsSceneHoverEnter, parent, hoverEvent); never executed: sendHoverEvent(QEvent::GraphicsSceneHoverEnter, parent, hoverEvent); | 0 |
2607 | } | 0 |
2608 | | - |
2609 | | - |
2610 | if (item | 0 |
2611 | && !hoverItems.isEmpty() never evaluated: !hoverItems.isEmpty() | 0 |
2612 | && item == hoverItems.last()) { never evaluated: item == hoverItems.last() | 0 |
2613 | sendHoverEvent(QEvent::GraphicsSceneHoverMove, item, hoverEvent); | - |
2614 | return true; never executed: return true; | 0 |
2615 | } | - |
2616 | return false; never executed: return false; | 0 |
2617 | } | - |
2618 | | - |
2619 | | - |
2620 | | - |
2621 | | - |
2622 | | - |
2623 | | - |
2624 | | - |
2625 | void QGraphicsScenePrivate::leaveScene(QWidget *viewport) | - |
2626 | { | - |
2627 | | - |
2628 | QToolTip::hideText(); | - |
2629 | | - |
2630 | QGraphicsView *view = qobject_cast<QGraphicsView *>(viewport->parent()); | - |
2631 | | - |
2632 | QGraphicsSceneHoverEvent hoverEvent; | - |
2633 | hoverEvent.setWidget(viewport); | - |
2634 | | - |
2635 | if (view) { partially evaluated: view yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
2636 | QPoint cursorPos = QCursor::pos(); | - |
2637 | hoverEvent.setScenePos(view->mapToScene(viewport->mapFromGlobal(cursorPos))); | - |
2638 | hoverEvent.setLastScenePos(hoverEvent.scenePos()); | - |
2639 | hoverEvent.setScreenPos(cursorPos); | - |
2640 | hoverEvent.setLastScreenPos(hoverEvent.screenPos()); | - |
2641 | } executed: } Execution Count:2 | 2 |
2642 | | - |
2643 | while (!hoverItems.isEmpty()) { partially evaluated: !hoverItems.isEmpty() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
2644 | QGraphicsItem *lastItem = hoverItems.takeLast(); | - |
2645 | if (itemAcceptsHoverEvents_helper(lastItem)) never evaluated: itemAcceptsHoverEvents_helper(lastItem) | 0 |
2646 | sendHoverEvent(QEvent::GraphicsSceneHoverLeave, lastItem, &hoverEvent); never executed: sendHoverEvent(QEvent::GraphicsSceneHoverLeave, lastItem, &hoverEvent); | 0 |
2647 | } | 0 |
2648 | } executed: } Execution Count:2 | 2 |
2649 | void QGraphicsScene::keyPressEvent(QKeyEvent *keyEvent) | - |
2650 | { | - |
2651 | | - |
2652 | | - |
2653 | QGraphicsScenePrivate * const d = d_func(); | - |
2654 | QGraphicsItem *item = !d->keyboardGrabberItems.isEmpty() ? d->keyboardGrabberItems.last() : 0; partially evaluated: !d->keyboardGrabberItems.isEmpty() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2655 | if (!item) partially evaluated: !item yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2656 | item = focusItem(); executed: item = focusItem(); Execution Count:1 | 1 |
2657 | if (item) { partially evaluated: item yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2658 | QGraphicsItem *p = item; | - |
2659 | do { | - |
2660 | | - |
2661 | keyEvent->accept(); | - |
2662 | | - |
2663 | | - |
2664 | if (p->isBlockedByModalPanel()) partially evaluated: p->isBlockedByModalPanel() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2665 | break; | 0 |
2666 | if (!d->sendEvent(p, keyEvent)) partially evaluated: !d->sendEvent(p, keyEvent) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2667 | break; | 0 |
2668 | } while (!keyEvent->isAccepted() && !p->isPanel() && (p = p->parentItem())); partially evaluated: !keyEvent->isAccepted() yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: !p->isPanel() yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: (p = p->parentItem()) no Evaluation Count:0 | yes Evaluation Count:1 |
executed: } Execution Count:1 | 0-1 |
2669 | } else { executed: } Execution Count:1 | 1 |
2670 | keyEvent->ignore(); | - |
2671 | } | 0 |
2672 | } | - |
2673 | void QGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent) | - |
2674 | { | - |
2675 | | - |
2676 | | - |
2677 | QGraphicsScenePrivate * const d = d_func(); | - |
2678 | QGraphicsItem *item = !d->keyboardGrabberItems.isEmpty() ? d->keyboardGrabberItems.last() : 0; never evaluated: !d->keyboardGrabberItems.isEmpty() | 0 |
2679 | if (!item) | 0 |
2680 | item = focusItem(); never executed: item = focusItem(); | 0 |
2681 | if (item) { | 0 |
2682 | QGraphicsItem *p = item; | - |
2683 | do { | - |
2684 | | - |
2685 | keyEvent->accept(); | - |
2686 | | - |
2687 | | - |
2688 | if (p->isBlockedByModalPanel()) never evaluated: p->isBlockedByModalPanel() | 0 |
2689 | break; | 0 |
2690 | if (!d->sendEvent(p, keyEvent)) never evaluated: !d->sendEvent(p, keyEvent) | 0 |
2691 | break; | 0 |
2692 | } while (!keyEvent->isAccepted() && !p->isPanel() && (p = p->parentItem())); never evaluated: !keyEvent->isAccepted() never evaluated: !p->isPanel() never evaluated: (p = p->parentItem()) | 0 |
2693 | } else { | 0 |
2694 | keyEvent->ignore(); | - |
2695 | } | 0 |
2696 | } | - |
2697 | void QGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) | - |
2698 | { | - |
2699 | QGraphicsScenePrivate * const d = d_func(); | - |
2700 | if (d->mouseGrabberItems.isEmpty()) { evaluated: d->mouseGrabberItems.isEmpty() yes Evaluation Count:115 | yes Evaluation Count:1 |
| 1-115 |
2701 | | - |
2702 | QGraphicsSceneHoverEvent hover; | - |
2703 | _q_hoverFromMouseEvent(&hover, mouseEvent); | - |
2704 | d->dispatchHoverEvent(&hover); | - |
2705 | } executed: } Execution Count:115 | 115 |
2706 | | - |
2707 | d->mousePressEventHandler(mouseEvent); | - |
2708 | } executed: } Execution Count:116 | 116 |
2709 | void QGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) | - |
2710 | { | - |
2711 | QGraphicsScenePrivate * const d = d_func(); | - |
2712 | if (d->mouseGrabberItems.isEmpty()) { evaluated: d->mouseGrabberItems.isEmpty() yes Evaluation Count:56 | yes Evaluation Count:1 |
| 1-56 |
2713 | if (mouseEvent->buttons()) evaluated: mouseEvent->buttons() yes Evaluation Count:14 | yes Evaluation Count:42 |
| 14-42 |
2714 | return; executed: return; Execution Count:14 | 14 |
2715 | QGraphicsSceneHoverEvent hover; | - |
2716 | _q_hoverFromMouseEvent(&hover, mouseEvent); | - |
2717 | mouseEvent->setAccepted(d->dispatchHoverEvent(&hover)); | - |
2718 | return; executed: return; Execution Count:42 | 42 |
2719 | } | - |
2720 | | - |
2721 | | - |
2722 | d->sendMouseEvent(mouseEvent); | - |
2723 | mouseEvent->accept(); | - |
2724 | } executed: } Execution Count:1 | 1 |
2725 | void QGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) | - |
2726 | { | - |
2727 | QGraphicsScenePrivate * const d = d_func(); | - |
2728 | if (d->mouseGrabberItems.isEmpty()) { evaluated: d->mouseGrabberItems.isEmpty() yes Evaluation Count:8 | yes Evaluation Count:104 |
| 8-104 |
2729 | mouseEvent->ignore(); | - |
2730 | return; executed: return; Execution Count:8 | 8 |
2731 | } | - |
2732 | | - |
2733 | | - |
2734 | d->sendMouseEvent(mouseEvent); | - |
2735 | mouseEvent->accept(); | - |
2736 | | - |
2737 | | - |
2738 | if (!mouseEvent->buttons()) { partially evaluated: !mouseEvent->buttons() yes Evaluation Count:104 | no Evaluation Count:0 |
| 0-104 |
2739 | if (!d->mouseGrabberItems.isEmpty()) { partially evaluated: !d->mouseGrabberItems.isEmpty() yes Evaluation Count:104 | no Evaluation Count:0 |
| 0-104 |
2740 | d->lastMouseGrabberItem = d->mouseGrabberItems.last(); | - |
2741 | if (d->lastMouseGrabberItemHasImplicitMouseGrab) partially evaluated: d->lastMouseGrabberItemHasImplicitMouseGrab yes Evaluation Count:104 | no Evaluation Count:0 |
| 0-104 |
2742 | d->mouseGrabberItems.last()->ungrabMouse(); executed: d->mouseGrabberItems.last()->ungrabMouse(); Execution Count:104 | 104 |
2743 | } else { executed: } Execution Count:104 | 104 |
2744 | d->lastMouseGrabberItem = 0; | - |
2745 | } | 0 |
2746 | | - |
2747 | | - |
2748 | QGraphicsSceneHoverEvent hoverEvent; | - |
2749 | _q_hoverFromMouseEvent(&hoverEvent, mouseEvent); | - |
2750 | d->dispatchHoverEvent(&hoverEvent); | - |
2751 | } executed: } Execution Count:104 | 104 |
2752 | } executed: } Execution Count:104 | 104 |
2753 | void QGraphicsScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouseEvent) | - |
2754 | { | - |
2755 | QGraphicsScenePrivate * const d = d_func(); | - |
2756 | d->mousePressEventHandler(mouseEvent); | - |
2757 | } | 0 |
2758 | void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent) | - |
2759 | { | - |
2760 | QGraphicsScenePrivate * const d = d_func(); | - |
2761 | QList<QGraphicsItem *> wheelCandidates = d->itemsAtPosition(wheelEvent->screenPos(), | - |
2762 | wheelEvent->scenePos(), | - |
2763 | wheelEvent->widget()); | - |
2764 | QList<QGraphicsWidget *>::const_iterator iter = d->popupWidgets.constEnd(); | - |
2765 | while (--iter >= d->popupWidgets.constBegin() && !wheelCandidates.isEmpty()) { partially evaluated: --iter >= d->popupWidgets.constBegin() no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: !wheelCandidates.isEmpty() | 0-2 |
2766 | if (wheelCandidates.first() == *iter || (*iter)->isAncestorOf(wheelCandidates.first())) never evaluated: wheelCandidates.first() == *iter never evaluated: (*iter)->isAncestorOf(wheelCandidates.first()) | 0 |
2767 | break; | 0 |
2768 | d->removePopup(*iter); | - |
2769 | } | 0 |
2770 | | - |
2771 | | - |
2772 | bool hasSetFocus = false; | - |
2773 | for (QForeachContainer<__typeof__(wheelCandidates)> _container_(wheelCandidates); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
2774 | if (!hasSetFocus && item->isEnabled() partially evaluated: !hasSetFocus yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: item->isEnabled() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
2775 | && ((item->flags() & QGraphicsItem::ItemIsFocusable) && item->d_ptr->mouseSetsFocus)) { partially evaluated: (item->flags() & QGraphicsItem::ItemIsFocusable) yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: item->d_ptr->mouseSetsFocus yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
2776 | if (item->isWidget() && static_cast<QGraphicsWidget *>(item)->focusPolicy() == Qt::WheelFocus) { partially evaluated: item->isWidget() yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: static_cast<QGraphicsWidget *>(item)->focusPolicy() == Qt::WheelFocus yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
2777 | hasSetFocus = true; | - |
2778 | if (item != focusItem()) evaluated: item != focusItem() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
2779 | setFocusItem(item, Qt::MouseFocusReason); executed: setFocusItem(item, Qt::MouseFocusReason); Execution Count:1 | 1 |
2780 | } executed: } Execution Count:2 | 2 |
2781 | } executed: } Execution Count:2 | 2 |
2782 | | - |
2783 | wheelEvent->setPos(item->d_ptr->genericMapFromScene(wheelEvent->scenePos(), | - |
2784 | wheelEvent->widget())); | - |
2785 | wheelEvent->accept(); | - |
2786 | bool isPanel = item->isPanel(); | - |
2787 | d->sendEvent(item, wheelEvent); | - |
2788 | if (isPanel || wheelEvent->isAccepted()) partially evaluated: isPanel no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: wheelEvent->isAccepted() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
2789 | break; | 0 |
2790 | } executed: } Execution Count:2 | 2 |
2791 | } executed: } Execution Count:2 | 2 |
2792 | void QGraphicsScene::inputMethodEvent(QInputMethodEvent *event) | - |
2793 | { | - |
2794 | QGraphicsScenePrivate * const d = d_func(); | - |
2795 | if (d->focusItem && (d->focusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)) evaluated: d->focusItem yes Evaluation Count:2 | yes Evaluation Count:1 |
partially evaluated: (d->focusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod) yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
2796 | d->sendEvent(d->focusItem, event); executed: d->sendEvent(d->focusItem, event); Execution Count:2 | 2 |
2797 | } executed: } Execution Count:3 | 3 |
2798 | void QGraphicsScene::drawBackground(QPainter *painter, const QRectF &rect) | - |
2799 | { | - |
2800 | QGraphicsScenePrivate * const d = d_func(); | - |
2801 | | - |
2802 | if (d->backgroundBrush.style() != Qt::NoBrush) { evaluated: d->backgroundBrush.style() != Qt::NoBrush yes Evaluation Count:256 | yes Evaluation Count:1758 |
| 256-1758 |
2803 | if (d->painterStateProtection) partially evaluated: d->painterStateProtection yes Evaluation Count:256 | no Evaluation Count:0 |
| 0-256 |
2804 | painter->save(); executed: painter->save(); Execution Count:256 | 256 |
2805 | painter->setBrushOrigin(0, 0); | - |
2806 | painter->fillRect(rect, backgroundBrush()); | - |
2807 | if (d->painterStateProtection) partially evaluated: d->painterStateProtection yes Evaluation Count:256 | no Evaluation Count:0 |
| 0-256 |
2808 | painter->restore(); executed: painter->restore(); Execution Count:256 | 256 |
2809 | } executed: } Execution Count:256 | 256 |
2810 | } executed: } Execution Count:2014 | 2014 |
2811 | void QGraphicsScene::drawForeground(QPainter *painter, const QRectF &rect) | - |
2812 | { | - |
2813 | QGraphicsScenePrivate * const d = d_func(); | - |
2814 | | - |
2815 | if (d->foregroundBrush.style() != Qt::NoBrush) { evaluated: d->foregroundBrush.style() != Qt::NoBrush yes Evaluation Count:252 | yes Evaluation Count:1771 |
| 252-1771 |
2816 | if (d->painterStateProtection) partially evaluated: d->painterStateProtection yes Evaluation Count:252 | no Evaluation Count:0 |
| 0-252 |
2817 | painter->save(); executed: painter->save(); Execution Count:252 | 252 |
2818 | painter->setBrushOrigin(0, 0); | - |
2819 | painter->fillRect(rect, foregroundBrush()); | - |
2820 | if (d->painterStateProtection) partially evaluated: d->painterStateProtection yes Evaluation Count:252 | no Evaluation Count:0 |
| 0-252 |
2821 | painter->restore(); executed: painter->restore(); Execution Count:252 | 252 |
2822 | } executed: } Execution Count:252 | 252 |
2823 | } executed: } Execution Count:2023 | 2023 |
2824 | | - |
2825 | static void _q_paintItem(QGraphicsItem *item, QPainter *painter, | - |
2826 | const QStyleOptionGraphicsItem *option, QWidget *widget, | - |
2827 | bool useWindowOpacity, bool painterStateProtection) | - |
2828 | { | - |
2829 | if (!item->isWidget()) { partially evaluated: !item->isWidget() no Evaluation Count:0 | yes Evaluation Count:245 |
| 0-245 |
2830 | item->paint(painter, option, widget); | - |
2831 | return; | 0 |
2832 | } | - |
2833 | QGraphicsWidget *widgetItem = static_cast<QGraphicsWidget *>(item); | - |
2834 | QGraphicsProxyWidget *proxy = qobject_cast<QGraphicsProxyWidget *>(widgetItem); | - |
2835 | const qreal windowOpacity = (proxy && proxy->widget() && useWindowOpacity) evaluated: proxy yes Evaluation Count:8 | yes Evaluation Count:237 |
partially evaluated: proxy->widget() yes Evaluation Count:8 | no Evaluation Count:0 |
partially evaluated: useWindowOpacity yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-237 |
2836 | ? proxy->widget()->windowOpacity() : 1.0; | - |
2837 | const qreal oldPainterOpacity = painter->opacity(); | - |
2838 | | - |
2839 | if (qFuzzyIsNull(windowOpacity)) partially evaluated: qFuzzyIsNull(windowOpacity) no Evaluation Count:0 | yes Evaluation Count:245 |
| 0-245 |
2840 | return; | 0 |
2841 | | - |
2842 | if (windowOpacity < 1.0) partially evaluated: windowOpacity < 1.0 no Evaluation Count:0 | yes Evaluation Count:245 |
| 0-245 |
2843 | painter->setOpacity(oldPainterOpacity * windowOpacity); never executed: painter->setOpacity(oldPainterOpacity * windowOpacity); | 0 |
2844 | | - |
2845 | | - |
2846 | Qt::LayoutDirection oldLayoutDirection = painter->layoutDirection(); | - |
2847 | painter->setLayoutDirection(widgetItem->layoutDirection()); | - |
2848 | | - |
2849 | if (widgetItem->isWindow() && widgetItem->windowType() != Qt::Popup && widgetItem->windowType() != Qt::ToolTip evaluated: widgetItem->isWindow() yes Evaluation Count:29 | yes Evaluation Count:216 |
partially evaluated: widgetItem->windowType() != Qt::Popup yes Evaluation Count:29 | no Evaluation Count:0 |
partially evaluated: widgetItem->windowType() != Qt::ToolTip yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-216 |
2850 | && !(widgetItem->windowFlags() & Qt::FramelessWindowHint)) { partially evaluated: !(widgetItem->windowFlags() & Qt::FramelessWindowHint) yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-29 |
2851 | if (painterStateProtection) partially evaluated: painterStateProtection yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-29 |
2852 | painter->save(); executed: painter->save(); Execution Count:29 | 29 |
2853 | widgetItem->paintWindowFrame(painter, option, widget); | - |
2854 | if (painterStateProtection) partially evaluated: painterStateProtection yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-29 |
2855 | painter->restore(); executed: painter->restore(); Execution Count:29 | 29 |
2856 | } else if (widgetItem->autoFillBackground()) { partially evaluated: widgetItem->autoFillBackground() no Evaluation Count:0 | yes Evaluation Count:216 |
executed: } Execution Count:29 | 0-216 |
2857 | painter->fillRect(option->exposedRect, widgetItem->palette().window()); | - |
2858 | } | 0 |
2859 | | - |
2860 | widgetItem->paint(painter, option, widget); | - |
2861 | | - |
2862 | | - |
2863 | painter->setLayoutDirection(oldLayoutDirection); | - |
2864 | | - |
2865 | if (windowOpacity < 1.0) partially evaluated: windowOpacity < 1.0 no Evaluation Count:0 | yes Evaluation Count:245 |
| 0-245 |
2866 | painter->setOpacity(oldPainterOpacity); never executed: painter->setOpacity(oldPainterOpacity); | 0 |
2867 | } executed: } Execution Count:245 | 245 |
2868 | | - |
2869 | static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion &pixmapExposed, | - |
2870 | const QTransform &itemToPixmap, QPainter::RenderHints renderHints, | - |
2871 | const QStyleOptionGraphicsItem *option, bool painterStateProtection) | - |
2872 | { | - |
2873 | QPixmap subPix; | - |
2874 | QPainter pixmapPainter; | - |
2875 | QRect br = pixmapExposed.boundingRect(); | - |
2876 | | - |
2877 | | - |
2878 | if (pixmapExposed.isEmpty() || (pixmapExposed.rectCount() == 1 && br.contains(pix->rect()))) { never evaluated: pixmapExposed.isEmpty() never evaluated: pixmapExposed.rectCount() == 1 never evaluated: br.contains(pix->rect()) | 0 |
2879 | pix->fill(Qt::transparent); | - |
2880 | pixmapPainter.begin(pix); | - |
2881 | } else { | 0 |
2882 | subPix = QPixmap(br.size()); | - |
2883 | subPix.fill(Qt::transparent); | - |
2884 | pixmapPainter.begin(&subPix); | - |
2885 | pixmapPainter.translate(-br.topLeft()); | - |
2886 | if (!pixmapExposed.isEmpty()) { never evaluated: !pixmapExposed.isEmpty() | 0 |
2887 | | - |
2888 | | - |
2889 | pixmapPainter.setClipRegion(pixmapExposed); | - |
2890 | } | 0 |
2891 | } | 0 |
2892 | | - |
2893 | pixmapPainter.setRenderHints(pixmapPainter.renderHints(), false); | - |
2894 | pixmapPainter.setRenderHints(renderHints, true); | - |
2895 | pixmapPainter.setWorldTransform(itemToPixmap, true); | - |
2896 | | - |
2897 | | - |
2898 | _q_paintItem(item, &pixmapPainter, option, 0, false, painterStateProtection); | - |
2899 | pixmapPainter.end(); | - |
2900 | | - |
2901 | if (!subPix.isNull()) { never evaluated: !subPix.isNull() | 0 |
2902 | | - |
2903 | pixmapPainter.begin(pix); | - |
2904 | pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source); | - |
2905 | pixmapPainter.setClipRegion(pixmapExposed); | - |
2906 | pixmapPainter.drawPixmap(br.topLeft(), subPix); | - |
2907 | pixmapPainter.end(); | - |
2908 | } | 0 |
2909 | } | 0 |
2910 | | - |
2911 | | - |
2912 | | - |
2913 | static inline bool transformIsSimple(const QTransform& transform) | - |
2914 | { | - |
2915 | QTransform::TransformationType type = transform.type(); | - |
2916 | if (type <= QTransform::TxScale) { never evaluated: type <= QTransform::TxScale | 0 |
2917 | return true; never executed: return true; | 0 |
2918 | } else if (type == QTransform::TxRotate) { never evaluated: type == QTransform::TxRotate | 0 |
2919 | | - |
2920 | qreal m11 = transform.m11(); | - |
2921 | qreal m12 = transform.m12(); | - |
2922 | qreal m21 = transform.m21(); | - |
2923 | qreal m22 = transform.m22(); | - |
2924 | if (m11 == 0.0f && m22 == 0.0f) { never evaluated: m11 == 0.0f never evaluated: m22 == 0.0f | 0 |
2925 | if (m12 == 1.0f && m21 == -1.0f) never evaluated: m12 == 1.0f never evaluated: m21 == -1.0f | 0 |
2926 | return true; never executed: return true; | 0 |
2927 | else if (m12 == -1.0f && m21 == 1.0f) never evaluated: m12 == -1.0f never evaluated: m21 == 1.0f | 0 |
2928 | return true; never executed: return true; | 0 |
2929 | else if (m12 == -1.0f && m21 == -1.0f) never evaluated: m12 == -1.0f never evaluated: m21 == -1.0f | 0 |
2930 | return true; never executed: return true; | 0 |
2931 | else if (m12 == 1.0f && m21 == 1.0f) never evaluated: m12 == 1.0f never evaluated: m21 == 1.0f | 0 |
2932 | return true; never executed: return true; | 0 |
2933 | } | - |
2934 | } | 0 |
2935 | return false; never executed: return false; | 0 |
2936 | } | - |
2937 | | - |
2938 | | - |
2939 | | - |
2940 | | - |
2941 | | - |
2942 | | - |
2943 | void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painter, | - |
2944 | const QStyleOptionGraphicsItem *option, QWidget *widget, | - |
2945 | bool painterStateProtection) | - |
2946 | { | - |
2947 | QGraphicsItemPrivate *itemd = item->d_ptr.data(); | - |
2948 | QGraphicsItem::CacheMode cacheMode = QGraphicsItem::CacheMode(itemd->cacheMode); | - |
2949 | | - |
2950 | | - |
2951 | if (cacheMode == QGraphicsItem::NoCache partially evaluated: cacheMode == QGraphicsItem::NoCache yes Evaluation Count:245 | no Evaluation Count:0 |
| 0-245 |
2952 | | - |
2953 | | - |
2954 | | - |
2955 | ) { | - |
2956 | _q_paintItem(static_cast<QGraphicsWidget *>(item), painter, option, widget, true, painterStateProtection); | - |
2957 | return; executed: return; Execution Count:245 | 245 |
2958 | } | - |
2959 | | - |
2960 | const qreal oldPainterOpacity = painter->opacity(); | - |
2961 | qreal newPainterOpacity = oldPainterOpacity; | - |
2962 | QGraphicsProxyWidget *proxy = item->isWidget() ? qobject_cast<QGraphicsProxyWidget *>(static_cast<QGraphicsWidget *>(item)) : 0; never evaluated: item->isWidget() | 0 |
2963 | if (proxy && proxy->widget()) { never evaluated: proxy->widget() | 0 |
2964 | const qreal windowOpacity = proxy->widget()->windowOpacity(); | - |
2965 | if (windowOpacity < 1.0) never evaluated: windowOpacity < 1.0 | 0 |
2966 | newPainterOpacity *= windowOpacity; never executed: newPainterOpacity *= windowOpacity; | 0 |
2967 | } | 0 |
2968 | | - |
2969 | | - |
2970 | QRectF brect = item->boundingRect(); | - |
2971 | QRectF adjustedBrect(brect); | - |
2972 | _q_adjustRect(&adjustedBrect); | - |
2973 | if (adjustedBrect.isEmpty()) never evaluated: adjustedBrect.isEmpty() | 0 |
2974 | return; | 0 |
2975 | | - |
2976 | | - |
2977 | QPixmapCache::Key pixmapKey; | - |
2978 | QPixmap pix; | - |
2979 | bool pixmapFound; | - |
2980 | QGraphicsItemCache *itemCache = itemd->extraItemCache(); | - |
2981 | if (cacheMode == QGraphicsItem::ItemCoordinateCache) { never evaluated: cacheMode == QGraphicsItem::ItemCoordinateCache | 0 |
2982 | pixmapKey = itemCache->key; | - |
2983 | } else { | 0 |
2984 | pixmapKey = itemCache->deviceData.value(widget).key; | - |
2985 | } | 0 |
2986 | | - |
2987 | | - |
2988 | pixmapFound = QPixmapCache::find(pixmapKey, &pix); | - |
2989 | | - |
2990 | | - |
2991 | if (cacheMode == QGraphicsItem::ItemCoordinateCache) { never evaluated: cacheMode == QGraphicsItem::ItemCoordinateCache | 0 |
2992 | QSize pixmapSize; | - |
2993 | bool fixedCacheSize = false; | - |
2994 | QRect br = brect.toAlignedRect(); | - |
2995 | if ((fixedCacheSize = itemCache->fixedSize.isValid())) { never evaluated: (fixedCacheSize = itemCache->fixedSize.isValid()) | 0 |
2996 | pixmapSize = itemCache->fixedSize; | - |
2997 | } else { | 0 |
2998 | pixmapSize = br.size(); | - |
2999 | } | 0 |
3000 | | - |
3001 | | - |
3002 | int adjust = itemCache->fixedSize.isValid() ? 0 : 2; never evaluated: itemCache->fixedSize.isValid() | 0 |
3003 | QSize adjustSize(adjust*2, adjust*2); | - |
3004 | br.adjust(-adjust, -adjust, adjust, adjust); | - |
3005 | if (pix.isNull() || (!fixedCacheSize && (pixmapSize + adjustSize) != pix.size())) { never evaluated: pix.isNull() never evaluated: !fixedCacheSize never evaluated: (pixmapSize + adjustSize) != pix.size() | 0 |
3006 | pix = QPixmap(pixmapSize + adjustSize); | - |
3007 | itemCache->boundingRect = br; | - |
3008 | itemCache->exposed.clear(); | - |
3009 | itemCache->allExposed = true; | - |
3010 | } else if (itemCache->boundingRect != br) { never evaluated: itemCache->boundingRect != br | 0 |
3011 | itemCache->boundingRect = br; | - |
3012 | itemCache->exposed.clear(); | - |
3013 | itemCache->allExposed = true; | - |
3014 | } | 0 |
3015 | | - |
3016 | | - |
3017 | if (itemCache->allExposed || !itemCache->exposed.isEmpty()) { never evaluated: itemCache->allExposed never evaluated: !itemCache->exposed.isEmpty() | 0 |
3018 | | - |
3019 | | - |
3020 | | - |
3021 | if (pixmapFound) never evaluated: pixmapFound | 0 |
3022 | QPixmapCache::remove(pixmapKey); never executed: QPixmapCache::remove(pixmapKey); | 0 |
3023 | | - |
3024 | | - |
3025 | QTransform itemToPixmap; | - |
3026 | if (fixedCacheSize) { never evaluated: fixedCacheSize | 0 |
3027 | const QPointF scale(pixmapSize.width() / brect.width(), pixmapSize.height() / brect.height()); | - |
3028 | itemToPixmap.scale(scale.x(), scale.y()); | - |
3029 | } | 0 |
3030 | itemToPixmap.translate(-br.x(), -br.y()); | - |
3031 | | - |
3032 | | - |
3033 | | - |
3034 | styleOptionTmp = *option; | - |
3035 | QRegion pixmapExposed; | - |
3036 | QRectF exposedRect; | - |
3037 | if (!itemCache->allExposed) { never evaluated: !itemCache->allExposed | 0 |
3038 | for (int i = 0; i < itemCache->exposed.size(); ++i) { never evaluated: i < itemCache->exposed.size() | 0 |
3039 | QRectF r = itemCache->exposed.at(i); | - |
3040 | exposedRect |= r; | - |
3041 | pixmapExposed += itemToPixmap.mapRect(r).toAlignedRect(); | - |
3042 | } | 0 |
3043 | } else { | 0 |
3044 | exposedRect = brect; | - |
3045 | } | 0 |
3046 | styleOptionTmp.exposedRect = exposedRect; | - |
3047 | | - |
3048 | | - |
3049 | _q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(), | - |
3050 | &styleOptionTmp, painterStateProtection); | - |
3051 | | - |
3052 | | - |
3053 | itemCache->key = QPixmapCache::insert(pix); | - |
3054 | | - |
3055 | | - |
3056 | itemCache->allExposed = false; | - |
3057 | itemCache->exposed.clear(); | - |
3058 | } | 0 |
3059 | | - |
3060 | | - |
3061 | | - |
3062 | | - |
3063 | if (newPainterOpacity != oldPainterOpacity) { never evaluated: newPainterOpacity != oldPainterOpacity | 0 |
3064 | painter->setOpacity(newPainterOpacity); | - |
3065 | painter->drawPixmap(br.topLeft(), pix); | - |
3066 | painter->setOpacity(oldPainterOpacity); | - |
3067 | } else { | 0 |
3068 | painter->drawPixmap(br.topLeft(), pix); | - |
3069 | } | 0 |
3070 | return; | 0 |
3071 | } | - |
3072 | | - |
3073 | | - |
3074 | if (cacheMode == QGraphicsItem::DeviceCoordinateCache) { never evaluated: cacheMode == QGraphicsItem::DeviceCoordinateCache | 0 |
3075 | | - |
3076 | QRectF deviceBounds = painter->worldTransform().mapRect(brect); | - |
3077 | QRect deviceRect = deviceBounds.toRect().adjusted(-1, -1, 1, 1); | - |
3078 | if (deviceRect.isEmpty()) never evaluated: deviceRect.isEmpty() | 0 |
3079 | return; | 0 |
3080 | QRect viewRect = widget ? widget->rect() : QRect(); | 0 |
3081 | if (widget && !viewRect.intersects(deviceRect)) never evaluated: !viewRect.intersects(deviceRect) | 0 |
3082 | return; | 0 |
3083 | | - |
3084 | | - |
3085 | | - |
3086 | QSize maximumCacheSize = | - |
3087 | itemd->extra(QGraphicsItemPrivate::ExtraMaxDeviceCoordCacheSize).toSize(); | - |
3088 | if (!maximumCacheSize.isEmpty() never evaluated: !maximumCacheSize.isEmpty() | 0 |
3089 | && (deviceRect.width() > maximumCacheSize.width() never evaluated: deviceRect.width() > maximumCacheSize.width() | 0 |
3090 | || deviceRect.height() > maximumCacheSize.height())) { never evaluated: deviceRect.height() > maximumCacheSize.height() | 0 |
3091 | _q_paintItem(static_cast<QGraphicsWidget *>(item), painter, option, widget, | - |
3092 | oldPainterOpacity != newPainterOpacity, painterStateProtection); | - |
3093 | return; | 0 |
3094 | } | - |
3095 | | - |
3096 | | - |
3097 | | - |
3098 | | - |
3099 | bool pixModified = false; | - |
3100 | QGraphicsItemCache::DeviceData *deviceData = &itemCache->deviceData[widget]; | - |
3101 | bool invertable = true; | - |
3102 | QTransform diff = deviceData->lastTransform.inverted(&invertable); | - |
3103 | if (invertable) never evaluated: invertable | 0 |
3104 | diff *= painter->worldTransform(); never executed: diff *= painter->worldTransform(); | 0 |
3105 | deviceData->lastTransform = painter->worldTransform(); | - |
3106 | bool allowPartialCacheExposure = false; | - |
3107 | bool simpleTransform = invertable && diff.type() <= QTransform::TxTranslate never evaluated: invertable never evaluated: diff.type() <= QTransform::TxTranslate | 0 |
3108 | && transformIsSimple(painter->worldTransform()); never evaluated: transformIsSimple(painter->worldTransform()) | 0 |
3109 | if (!simpleTransform) { never evaluated: !simpleTransform | 0 |
3110 | pixModified = true; | - |
3111 | itemCache->allExposed = true; | - |
3112 | itemCache->exposed.clear(); | - |
3113 | deviceData->cacheIndent = QPoint(); | - |
3114 | pix = QPixmap(); | - |
3115 | } else if (!viewRect.isNull()) { never evaluated: !viewRect.isNull() | 0 |
3116 | allowPartialCacheExposure = deviceData->cacheIndent != QPoint(); | - |
3117 | } | 0 |
3118 | | - |
3119 | | - |
3120 | | - |
3121 | if (!allowPartialCacheExposure && !viewRect.isNull() && !viewRect.contains(deviceRect)) { never evaluated: !allowPartialCacheExposure never evaluated: !viewRect.isNull() never evaluated: !viewRect.contains(deviceRect) | 0 |
3122 | allowPartialCacheExposure = (viewRect.width() * 1.2 < deviceRect.width()) never evaluated: (viewRect.width() * 1.2 < deviceRect.width()) | 0 |
3123 | || (viewRect.height() * 1.2 < deviceRect.height()); never evaluated: (viewRect.height() * 1.2 < deviceRect.height()) | 0 |
3124 | } | 0 |
3125 | | - |
3126 | QRegion scrollExposure; | - |
3127 | if (allowPartialCacheExposure) { never evaluated: allowPartialCacheExposure | 0 |
3128 | | - |
3129 | | - |
3130 | | - |
3131 | | - |
3132 | int dx = deviceRect.left() < viewRect.left() ? viewRect.left() - deviceRect.left() : 0; never evaluated: deviceRect.left() < viewRect.left() | 0 |
3133 | int dy = deviceRect.top() < viewRect.top() ? viewRect.top() - deviceRect.top() : 0; never evaluated: deviceRect.top() < viewRect.top() | 0 |
3134 | QPoint newCacheIndent(dx, dy); | - |
3135 | deviceRect &= viewRect; | - |
3136 | | - |
3137 | if (pix.isNull()) { never evaluated: pix.isNull() | 0 |
3138 | deviceData->cacheIndent = QPoint(); | - |
3139 | itemCache->allExposed = true; | - |
3140 | itemCache->exposed.clear(); | - |
3141 | pixModified = true; | - |
3142 | } | 0 |
3143 | | - |
3144 | | - |
3145 | | - |
3146 | if (newCacheIndent != deviceData->cacheIndent || deviceRect.size() != pix.size()) { never evaluated: newCacheIndent != deviceData->cacheIndent never evaluated: deviceRect.size() != pix.size() | 0 |
3147 | QPoint diff = newCacheIndent - deviceData->cacheIndent; | - |
3148 | QPixmap newPix(deviceRect.size()); | - |
3149 | | - |
3150 | | - |
3151 | newPix.fill(Qt::transparent); | - |
3152 | if (!pix.isNull()) { never evaluated: !pix.isNull() | 0 |
3153 | QPainter newPixPainter(&newPix); | - |
3154 | newPixPainter.drawPixmap(-diff, pix); | - |
3155 | newPixPainter.end(); | - |
3156 | } | 0 |
3157 | QRegion exposed; | - |
3158 | exposed += newPix.rect(); | - |
3159 | if (!pix.isNull()) never evaluated: !pix.isNull() | 0 |
3160 | exposed -= QRect(-diff, pix.size()); never executed: exposed -= QRect(-diff, pix.size()); | 0 |
3161 | scrollExposure = exposed; | - |
3162 | | - |
3163 | pix = newPix; | - |
3164 | pixModified = true; | - |
3165 | } | 0 |
3166 | deviceData->cacheIndent = newCacheIndent; | - |
3167 | } else { | 0 |
3168 | | - |
3169 | deviceData->cacheIndent = QPoint(); | - |
3170 | | - |
3171 | | - |
3172 | if (deviceRect.size() != pix.size()) { never evaluated: deviceRect.size() != pix.size() | 0 |
3173 | | - |
3174 | pix = QPixmap(deviceRect.size()); | - |
3175 | pixModified = true; | - |
3176 | itemCache->allExposed = true; | - |
3177 | itemCache->exposed.clear(); | - |
3178 | } | 0 |
3179 | } | 0 |
3180 | | - |
3181 | | - |
3182 | if (itemCache->allExposed || !itemCache->exposed.isEmpty() || !scrollExposure.isEmpty()) { never evaluated: itemCache->allExposed never evaluated: !itemCache->exposed.isEmpty() never evaluated: !scrollExposure.isEmpty() | 0 |
3183 | | - |
3184 | | - |
3185 | if (pixmapFound) never evaluated: pixmapFound | 0 |
3186 | QPixmapCache::remove(pixmapKey); never executed: QPixmapCache::remove(pixmapKey); | 0 |
3187 | | - |
3188 | | - |
3189 | QPointF p = deviceRect.topLeft(); | - |
3190 | QTransform itemToPixmap = painter->worldTransform(); | - |
3191 | if (!p.isNull()) never evaluated: !p.isNull() | 0 |
3192 | itemToPixmap *= QTransform::fromTranslate(-p.x(), -p.y()); never executed: itemToPixmap *= QTransform::fromTranslate(-p.x(), -p.y()); | 0 |
3193 | | - |
3194 | | - |
3195 | QRegion pixmapExposed = scrollExposure; | - |
3196 | if (!itemCache->allExposed) { never evaluated: !itemCache->allExposed | 0 |
3197 | const QVector<QRectF> &exposed = itemCache->exposed; | - |
3198 | for (int i = 0; i < exposed.size(); ++i) never evaluated: i < exposed.size() | 0 |
3199 | pixmapExposed += itemToPixmap.mapRect(exposed.at(i)).toRect().adjusted(-1, -1, 1, 1); never executed: pixmapExposed += itemToPixmap.mapRect(exposed.at(i)).toRect().adjusted(-1, -1, 1, 1); | 0 |
3200 | } | 0 |
3201 | | - |
3202 | | - |
3203 | QRectF br; | - |
3204 | if (itemCache->allExposed) { never evaluated: itemCache->allExposed | 0 |
3205 | br = item->boundingRect(); | - |
3206 | } else { | 0 |
3207 | const QVector<QRectF> &exposed = itemCache->exposed; | - |
3208 | for (int i = 0; i < exposed.size(); ++i) never evaluated: i < exposed.size() | 0 |
3209 | br |= exposed.at(i); never executed: br |= exposed.at(i); | 0 |
3210 | QTransform pixmapToItem = itemToPixmap.inverted(); | - |
3211 | for (QForeachContainer<__typeof__(scrollExposure.rects())> _container_(scrollExposure.rects()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QRect &r = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
3212 | br |= pixmapToItem.mapRect(r); never executed: br |= pixmapToItem.mapRect(r); | 0 |
3213 | } | 0 |
3214 | styleOptionTmp = *option; | - |
3215 | styleOptionTmp.exposedRect = br.adjusted(-1, -1, 1, 1); | - |
3216 | | - |
3217 | | - |
3218 | _q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(), | - |
3219 | &styleOptionTmp, painterStateProtection); | - |
3220 | | - |
3221 | | - |
3222 | pixModified = true; | - |
3223 | itemCache->allExposed = false; | - |
3224 | itemCache->exposed.clear(); | - |
3225 | } | 0 |
3226 | | - |
3227 | if (pixModified) { never evaluated: pixModified | 0 |
3228 | | - |
3229 | deviceData->key = QPixmapCache::insert(pix); | - |
3230 | } | 0 |
3231 | | - |
3232 | | - |
3233 | | - |
3234 | QTransform restoreTransform = painter->worldTransform(); | - |
3235 | painter->setWorldTransform(QTransform()); | - |
3236 | if (newPainterOpacity != oldPainterOpacity) { never evaluated: newPainterOpacity != oldPainterOpacity | 0 |
3237 | painter->setOpacity(newPainterOpacity); | - |
3238 | painter->drawPixmap(deviceRect.topLeft(), pix); | - |
3239 | painter->setOpacity(oldPainterOpacity); | - |
3240 | } else { | 0 |
3241 | painter->drawPixmap(deviceRect.topLeft(), pix); | - |
3242 | } | 0 |
3243 | painter->setWorldTransform(restoreTransform); | - |
3244 | return; | 0 |
3245 | } | - |
3246 | } | 0 |
3247 | | - |
3248 | void QGraphicsScenePrivate::drawItems(QPainter *painter, const QTransform *const viewTransform, | - |
3249 | QRegion *exposedRegion, QWidget *widget) | - |
3250 | { | - |
3251 | | - |
3252 | if (!unpolishedItems.isEmpty()) evaluated: !unpolishedItems.isEmpty() yes Evaluation Count:6 | yes Evaluation Count:2011 |
| 6-2011 |
3253 | _q_polishItems(); executed: _q_polishItems(); Execution Count:6 | 6 |
3254 | | - |
3255 | updateAll = false; | - |
3256 | QRectF exposedSceneRect; | - |
3257 | if (exposedRegion && indexMethod != QGraphicsScene::NoIndex) { partially evaluated: exposedRegion yes Evaluation Count:2017 | no Evaluation Count:0 |
partially evaluated: indexMethod != QGraphicsScene::NoIndex yes Evaluation Count:2017 | no Evaluation Count:0 |
| 0-2017 |
3258 | exposedSceneRect = exposedRegion->boundingRect().adjusted(-1, -1, 1, 1); | - |
3259 | if (viewTransform) evaluated: viewTransform yes Evaluation Count:1979 | yes Evaluation Count:38 |
| 38-1979 |
3260 | exposedSceneRect = viewTransform->inverted().mapRect(exposedSceneRect); executed: exposedSceneRect = viewTransform->inverted().mapRect(exposedSceneRect); Execution Count:1979 | 1979 |
3261 | } executed: } Execution Count:2017 | 2017 |
3262 | const QList<QGraphicsItem *> tli = index->estimateTopLevelItems(exposedSceneRect, Qt::AscendingOrder); | - |
3263 | for (int i = 0; i < tli.size(); ++i) evaluated: i < tli.size() yes Evaluation Count:3839 | yes Evaluation Count:2017 |
| 2017-3839 |
3264 | drawSubtreeRecursive(tli.at(i), painter, viewTransform, exposedRegion, widget); executed: drawSubtreeRecursive(tli.at(i), painter, viewTransform, exposedRegion, widget); Execution Count:3839 | 3839 |
3265 | } executed: } Execution Count:2017 | 2017 |
3266 | | - |
3267 | void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *painter, | - |
3268 | const QTransform *const viewTransform, | - |
3269 | QRegion *exposedRegion, QWidget *widget, | - |
3270 | qreal parentOpacity, const QTransform *const effectTransform) | - |
3271 | { | - |
3272 | qt_noop(); | - |
3273 | | - |
3274 | if (!item->d_ptr->visible) evaluated: !item->d_ptr->visible yes Evaluation Count:2 | yes Evaluation Count:4166 |
| 2-4166 |
3275 | return; executed: return; Execution Count:2 | 2 |
3276 | | - |
3277 | const bool itemHasContents = !(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents); | - |
3278 | const bool itemHasChildren = !item->d_ptr->children.isEmpty(); | - |
3279 | if (!itemHasContents && !itemHasChildren) evaluated: !itemHasContents yes Evaluation Count:8 | yes Evaluation Count:4158 |
partially evaluated: !itemHasChildren no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-4158 |
3280 | return; | 0 |
3281 | | - |
3282 | const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); | - |
3283 | const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity); | - |
3284 | if (itemIsFullyTransparent && (!itemHasChildren || item->d_ptr->childrenCombineOpacity())) partially evaluated: itemIsFullyTransparent no Evaluation Count:0 | yes Evaluation Count:4166 |
never evaluated: !itemHasChildren never evaluated: item->d_ptr->childrenCombineOpacity() | 0-4166 |
3285 | return; | 0 |
3286 | | - |
3287 | QTransform transform(Qt::Uninitialized); | - |
3288 | QTransform *transformPtr = 0; | - |
3289 | bool translateOnlyTransform = false; | - |
3290 | bool wasDirtyParentSceneTransform = false; | - |
3291 | const bool itemIsUntransformable = item->d_ptr->itemIsUntransformable(); | - |
3292 | if (itemIsUntransformable) { evaluated: itemIsUntransformable yes Evaluation Count:4 | yes Evaluation Count:4162 |
| 4-4162 |
3293 | transform = item->deviceTransform(viewTransform ? *viewTransform : QTransform()); | - |
3294 | transformPtr = &transform; | - |
3295 | } else if (item->d_ptr->dirtySceneTransform) { evaluated: item->d_ptr->dirtySceneTransform yes Evaluation Count:285 | yes Evaluation Count:3877 |
executed: } Execution Count:4 | 4-3877 |
3296 | item->d_ptr->updateSceneTransformFromParent(); | - |
3297 | qt_noop(); | - |
3298 | wasDirtyParentSceneTransform = true; | - |
3299 | } executed: } Execution Count:285 | 285 |
3300 | | - |
3301 | const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); | - |
3302 | bool drawItem = itemHasContents && !itemIsFullyTransparent; evaluated: itemHasContents yes Evaluation Count:4158 | yes Evaluation Count:8 |
partially evaluated: !itemIsFullyTransparent yes Evaluation Count:4158 | no Evaluation Count:0 |
| 0-4158 |
3303 | if (drawItem) { evaluated: drawItem yes Evaluation Count:4158 | yes Evaluation Count:8 |
| 8-4158 |
3304 | const QRectF brect = adjustedItemEffectiveBoundingRect(item); | - |
3305 | if (!transformPtr) { qt_noop(); if (viewTransform) { transform = item->d_ptr->sceneTransform; transform *= *viewTransform; transformPtr = &transform; } else { transformPtr = &item->d_ptr->sceneTransform; translateOnlyTransform = item->d_ptr->sceneTransformTranslateOnly; } } evaluated: !transformPtr yes Evaluation Count:4154 | yes Evaluation Count:4 |
evaluated: viewTransform yes Evaluation Count:3972 | yes Evaluation Count:182 |
executed: } Execution Count:3972 executed: } Execution Count:182 | 4-4154 |
3306 | QRect viewBoundingRect = translateOnlyTransform ? brect.translated(transformPtr->dx(), transformPtr->dy()).toAlignedRect() evaluated: translateOnlyTransform yes Evaluation Count:182 | yes Evaluation Count:3976 |
| 182-3976 |
3307 | : transformPtr->mapRect(brect).toAlignedRect(); | - |
3308 | viewBoundingRect.adjust(-int(rectAdjust), -int(rectAdjust), rectAdjust, rectAdjust); | - |
3309 | if (widget) evaluated: widget yes Evaluation Count:4130 | yes Evaluation Count:28 |
| 28-4130 |
3310 | item->d_ptr->paintedViewBoundingRects.insert(widget, viewBoundingRect); executed: item->d_ptr->paintedViewBoundingRects.insert(widget, viewBoundingRect); Execution Count:4130 | 4130 |
3311 | drawItem = exposedRegion ? exposedRegion->intersects(viewBoundingRect) evaluated: exposedRegion yes Evaluation Count:4128 | yes Evaluation Count:30 |
| 30-4128 |
3312 | : !viewBoundingRect.normalized().isEmpty(); | - |
3313 | if (!drawItem) { evaluated: !drawItem yes Evaluation Count:1510 | yes Evaluation Count:2648 |
| 1510-2648 |
3314 | if (!itemHasChildren) partially evaluated: !itemHasChildren yes Evaluation Count:1510 | no Evaluation Count:0 |
| 0-1510 |
3315 | return; executed: return; Execution Count:1510 | 1510 |
3316 | if (itemClipsChildrenToShape) { never evaluated: itemClipsChildrenToShape | 0 |
3317 | if (wasDirtyParentSceneTransform) never evaluated: wasDirtyParentSceneTransform | 0 |
3318 | item->d_ptr->invalidateChildrenSceneTransform(); never executed: item->d_ptr->invalidateChildrenSceneTransform(); | 0 |
3319 | return; | 0 |
3320 | } | - |
3321 | } | 0 |
3322 | } executed: } Execution Count:2648 | 2648 |
3323 | | - |
3324 | if (itemHasChildren && itemClipsChildrenToShape) evaluated: itemHasChildren yes Evaluation Count:95 | yes Evaluation Count:2561 |
evaluated: itemClipsChildrenToShape yes Evaluation Count:13 | yes Evaluation Count:82 |
| 13-2561 |
3325 | if (!transformPtr) { qt_noop(); if (viewTransform) { transform = item->d_ptr->sceneTransform; transform *= *viewTransform; transformPtr = &transform; } else { transformPtr = &item->d_ptr->sceneTransform; translateOnlyTransform = item->d_ptr->sceneTransformTranslateOnly; } }; evaluated: !transformPtr yes Evaluation Count:3 | yes Evaluation Count:10 |
partially evaluated: viewTransform yes Evaluation Count:3 | no Evaluation Count:0 |
executed: } Execution Count:3 | 0-10 |
3326 | | - |
3327 | | - |
3328 | if (item->d_ptr->graphicsEffect && item->d_ptr->graphicsEffect->isEnabled()) { evaluated: item->d_ptr->graphicsEffect yes Evaluation Count:37 | yes Evaluation Count:2619 |
evaluated: item->d_ptr->graphicsEffect->isEnabled() yes Evaluation Count:36 | yes Evaluation Count:1 |
| 1-2619 |
3329 | if (!transformPtr) { qt_noop(); if (viewTransform) { transform = item->d_ptr->sceneTransform; transform *= *viewTransform; transformPtr = &transform; } else { transformPtr = &item->d_ptr->sceneTransform; translateOnlyTransform = item->d_ptr->sceneTransformTranslateOnly; } }; evaluated: !transformPtr yes Evaluation Count:4 | yes Evaluation Count:32 |
partially evaluated: viewTransform no Evaluation Count:0 | yes Evaluation Count:4 |
executed: } Execution Count:4 | 0-32 |
3330 | QGraphicsItemPaintInfo info(viewTransform, transformPtr, effectTransform, exposedRegion, widget, &styleOptionTmp, | - |
3331 | painter, opacity, wasDirtyParentSceneTransform, itemHasContents && !itemIsFullyTransparent); | - |
3332 | QGraphicsEffectSource *source = item->d_ptr->graphicsEffect->d_func()->source; | - |
3333 | QGraphicsItemEffectSourcePrivate *sourced = static_cast<QGraphicsItemEffectSourcePrivate *> | - |
3334 | (source->d_func()); | - |
3335 | sourced->info = &info; | - |
3336 | const QTransform restoreTransform = painter->worldTransform(); | - |
3337 | if (effectTransform) partially evaluated: effectTransform no Evaluation Count:0 | yes Evaluation Count:36 |
| 0-36 |
3338 | painter->setWorldTransform(*transformPtr * *effectTransform); never executed: painter->setWorldTransform(*transformPtr * *effectTransform); | 0 |
3339 | else | - |
3340 | painter->setWorldTransform(*transformPtr); executed: painter->setWorldTransform(*transformPtr); Execution Count:36 | 36 |
3341 | painter->setOpacity(opacity); | - |
3342 | | - |
3343 | if (sourced->currentCachedSystem() != Qt::LogicalCoordinates partially evaluated: sourced->currentCachedSystem() != Qt::LogicalCoordinates yes Evaluation Count:36 | no Evaluation Count:0 |
| 0-36 |
3344 | && sourced->lastEffectTransform != painter->worldTransform()) evaluated: sourced->lastEffectTransform != painter->worldTransform() yes Evaluation Count:16 | yes Evaluation Count:20 |
| 16-20 |
3345 | { | - |
3346 | if (sourced->lastEffectTransform.type() <= QTransform::TxTranslate partially evaluated: sourced->lastEffectTransform.type() <= QTransform::TxTranslate yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
3347 | && painter->worldTransform().type() <= QTransform::TxTranslate) evaluated: painter->worldTransform().type() <= QTransform::TxTranslate yes Evaluation Count:9 | yes Evaluation Count:7 |
| 7-9 |
3348 | { | - |
3349 | QRectF sourceRect = sourced->boundingRect(Qt::DeviceCoordinates); | - |
3350 | QRect effectRect = sourced->paddedEffectRect(Qt::DeviceCoordinates, sourced->currentCachedMode(), sourceRect); | - |
3351 | | - |
3352 | sourced->setCachedOffset(effectRect.topLeft()); | - |
3353 | } else { executed: } Execution Count:9 | 9 |
3354 | sourced->invalidateCache(QGraphicsEffectSourcePrivate::TransformChanged); | - |
3355 | } executed: } Execution Count:7 | 7 |
3356 | | - |
3357 | sourced->lastEffectTransform = painter->worldTransform(); | - |
3358 | } executed: } Execution Count:16 | 16 |
3359 | | - |
3360 | item->d_ptr->graphicsEffect->draw(painter); | - |
3361 | painter->setWorldTransform(restoreTransform); | - |
3362 | sourced->info = 0; | - |
3363 | } else executed: } Execution Count:36 | 36 |
3364 | | - |
3365 | { | - |
3366 | draw(item, painter, viewTransform, transformPtr, exposedRegion, widget, opacity, | - |
3367 | effectTransform, wasDirtyParentSceneTransform, drawItem); | - |
3368 | } executed: } Execution Count:2620 | 2620 |
3369 | } | - |
3370 | | - |
3371 | static inline void setClip(QPainter *painter, QGraphicsItem *item) | - |
3372 | { | - |
3373 | painter->save(); | - |
3374 | QRectF clipRect; | - |
3375 | const QPainterPath clipPath(item->shape()); | - |
3376 | if (QPathClipper::pathToRect(clipPath, &clipRect)) partially evaluated: QPathClipper::pathToRect(clipPath, &clipRect) no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
3377 | painter->setClipRect(clipRect, Qt::IntersectClip); never executed: painter->setClipRect(clipRect, Qt::IntersectClip); | 0 |
3378 | else | - |
3379 | painter->setClipPath(clipPath, Qt::IntersectClip); executed: painter->setClipPath(clipPath, Qt::IntersectClip); Execution Count:12 | 12 |
3380 | } | - |
3381 | | - |
3382 | static inline void setWorldTransform(QPainter *painter, const QTransform *const transformPtr, | - |
3383 | const QTransform *effectTransform) | - |
3384 | { | - |
3385 | qt_noop(); | - |
3386 | if (effectTransform) evaluated: effectTransform yes Evaluation Count:20 | yes Evaluation Count:2625 |
| 20-2625 |
3387 | painter->setWorldTransform(*transformPtr * *effectTransform); executed: painter->setWorldTransform(*transformPtr * *effectTransform); Execution Count:20 | 20 |
3388 | else | - |
3389 | painter->setWorldTransform(*transformPtr); executed: painter->setWorldTransform(*transformPtr); Execution Count:2625 | 2625 |
3390 | } | - |
3391 | | - |
3392 | void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const QTransform *const viewTransform, | - |
3393 | const QTransform *const transformPtr, QRegion *exposedRegion, QWidget *widget, | - |
3394 | qreal opacity, const QTransform *effectTransform, | - |
3395 | bool wasDirtyParentSceneTransform, bool drawItem) | - |
3396 | { | - |
3397 | const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity); | - |
3398 | const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); | - |
3399 | const bool itemHasChildren = !item->d_ptr->children.isEmpty(); | - |
3400 | bool setChildClip = itemClipsChildrenToShape; | - |
3401 | bool itemHasChildrenStackedBehind = false; | - |
3402 | | - |
3403 | int i = 0; | - |
3404 | if (itemHasChildren) { evaluated: itemHasChildren yes Evaluation Count:94 | yes Evaluation Count:2556 |
| 94-2556 |
3405 | if (itemClipsChildrenToShape) evaluated: itemClipsChildrenToShape yes Evaluation Count:12 | yes Evaluation Count:82 |
| 12-82 |
3406 | setWorldTransform(painter, transformPtr, effectTransform); executed: setWorldTransform(painter, transformPtr, effectTransform); Execution Count:12 | 12 |
3407 | | - |
3408 | item->d_ptr->ensureSortedChildren(); | - |
3409 | | - |
3410 | | - |
3411 | itemHasChildrenStackedBehind = (item->d_ptr->children.at(0)->d_ptr->flags | - |
3412 | & QGraphicsItem::ItemStacksBehindParent); | - |
3413 | | - |
3414 | if (itemHasChildrenStackedBehind) { evaluated: itemHasChildrenStackedBehind yes Evaluation Count:1 | yes Evaluation Count:93 |
| 1-93 |
3415 | if (itemClipsChildrenToShape) { partially evaluated: itemClipsChildrenToShape no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
3416 | setClip(painter, item); | - |
3417 | setChildClip = false; | - |
3418 | } | 0 |
3419 | | - |
3420 | | - |
3421 | for (i = 0; i < item->d_ptr->children.size(); ++i) { evaluated: i < item->d_ptr->children.size() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
3422 | QGraphicsItem *child = item->d_ptr->children.at(i); | - |
3423 | if (wasDirtyParentSceneTransform) partially evaluated: wasDirtyParentSceneTransform yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
3424 | child->d_ptr->dirtySceneTransform = 1; executed: child->d_ptr->dirtySceneTransform = 1; Execution Count:1 | 1 |
3425 | if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent)) partially evaluated: !(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
3426 | break; | 0 |
3427 | if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity)) partially evaluated: itemIsFullyTransparent no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity) | 0-1 |
3428 | continue; never executed: continue; | 0 |
3429 | drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform); | - |
3430 | } executed: } Execution Count:1 | 1 |
3431 | } executed: } Execution Count:1 | 1 |
3432 | } executed: } Execution Count:94 | 94 |
3433 | | - |
3434 | | - |
3435 | if (drawItem) { evaluated: drawItem yes Evaluation Count:2642 | yes Evaluation Count:8 |
| 8-2642 |
3436 | qt_noop(); | - |
3437 | qt_noop(); | - |
3438 | qt_noop(); | - |
3439 | item->d_ptr->initStyleOption(&styleOptionTmp, *transformPtr, exposedRegion | - |
3440 | ? *exposedRegion : QRegion(), exposedRegion == 0); | - |
3441 | | - |
3442 | const bool itemClipsToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsToShape; | - |
3443 | bool restorePainterClip = false; | - |
3444 | | - |
3445 | if (!itemHasChildren || !itemClipsChildrenToShape) { evaluated: !itemHasChildren yes Evaluation Count:2556 | yes Evaluation Count:86 |
evaluated: !itemClipsChildrenToShape yes Evaluation Count:77 | yes Evaluation Count:9 |
| 9-2556 |
3446 | | - |
3447 | setWorldTransform(painter, transformPtr, effectTransform); | - |
3448 | if ((restorePainterClip = itemClipsToShape)) partially evaluated: (restorePainterClip = itemClipsToShape) no Evaluation Count:0 | yes Evaluation Count:2633 |
| 0-2633 |
3449 | setClip(painter, item); never executed: setClip(painter, item); | 0 |
3450 | } else if (itemHasChildrenStackedBehind){ partially evaluated: itemHasChildrenStackedBehind no Evaluation Count:0 | yes Evaluation Count:9 |
executed: } Execution Count:2633 | 0-2633 |
3451 | | - |
3452 | | - |
3453 | if (itemClipsToShape) { never evaluated: itemClipsToShape | 0 |
3454 | | - |
3455 | setWorldTransform(painter, transformPtr, effectTransform); | - |
3456 | } else { | 0 |
3457 | | - |
3458 | painter->restore(); | - |
3459 | setChildClip = true; | - |
3460 | } | 0 |
3461 | } else if (itemClipsToShape) { partially evaluated: itemClipsToShape no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
3462 | | - |
3463 | | - |
3464 | | - |
3465 | setClip(painter, item); | - |
3466 | setChildClip = false; | - |
3467 | } | 0 |
3468 | | - |
3469 | if (painterStateProtection && !restorePainterClip) evaluated: painterStateProtection yes Evaluation Count:2634 | yes Evaluation Count:8 |
partially evaluated: !restorePainterClip yes Evaluation Count:2634 | no Evaluation Count:0 |
| 0-2634 |
3470 | painter->save(); executed: painter->save(); Execution Count:2634 | 2634 |
3471 | | - |
3472 | painter->setOpacity(opacity); | - |
3473 | if (!item->d_ptr->cacheMode && !item->d_ptr->isWidget) partially evaluated: !item->d_ptr->cacheMode yes Evaluation Count:2642 | no Evaluation Count:0 |
evaluated: !item->d_ptr->isWidget yes Evaluation Count:2397 | yes Evaluation Count:245 |
| 0-2642 |
3474 | item->paint(painter, &styleOptionTmp, widget); executed: item->paint(painter, &styleOptionTmp, widget); Execution Count:2397 | 2397 |
3475 | else | - |
3476 | drawItemHelper(item, painter, &styleOptionTmp, widget, painterStateProtection); executed: drawItemHelper(item, painter, &styleOptionTmp, widget, painterStateProtection); Execution Count:245 | 245 |
3477 | | - |
3478 | if (painterStateProtection || restorePainterClip) evaluated: painterStateProtection yes Evaluation Count:2634 | yes Evaluation Count:8 |
partially evaluated: restorePainterClip no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-2634 |
3479 | painter->restore(); executed: painter->restore(); Execution Count:2634 | 2634 |
3480 | | - |
3481 | static int drawRect = qgetenv("QT_DRAW_SCENE_ITEM_RECTS").toInt(); | - |
3482 | if (drawRect) { partially evaluated: drawRect no Evaluation Count:0 | yes Evaluation Count:2642 |
| 0-2642 |
3483 | QPen oldPen = painter->pen(); | - |
3484 | QBrush oldBrush = painter->brush(); | - |
3485 | quintptr ptr = reinterpret_cast<quintptr>(item); | - |
3486 | const QColor color = QColor::fromHsv(ptr % 255, 255, 255); | - |
3487 | painter->setPen(color); | - |
3488 | painter->setBrush(Qt::NoBrush); | - |
3489 | painter->drawRect(adjustedItemBoundingRect(item)); | - |
3490 | painter->setPen(oldPen); | - |
3491 | painter->setBrush(oldBrush); | - |
3492 | } | 0 |
3493 | } executed: } Execution Count:2642 | 2642 |
3494 | | - |
3495 | | - |
3496 | if (itemHasChildren) { evaluated: itemHasChildren yes Evaluation Count:94 | yes Evaluation Count:2556 |
| 94-2556 |
3497 | if (setChildClip) evaluated: setChildClip yes Evaluation Count:12 | yes Evaluation Count:82 |
| 12-82 |
3498 | setClip(painter, item); executed: setClip(painter, item); Execution Count:12 | 12 |
3499 | | - |
3500 | for (; i < item->d_ptr->children.size(); ++i) { evaluated: i < item->d_ptr->children.size() yes Evaluation Count:293 | yes Evaluation Count:94 |
| 94-293 |
3501 | QGraphicsItem *child = item->d_ptr->children.at(i); | - |
3502 | if (wasDirtyParentSceneTransform) evaluated: wasDirtyParentSceneTransform yes Evaluation Count:107 | yes Evaluation Count:186 |
| 107-186 |
3503 | child->d_ptr->dirtySceneTransform = 1; executed: child->d_ptr->dirtySceneTransform = 1; Execution Count:107 | 107 |
3504 | if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity)) partially evaluated: itemIsFullyTransparent no Evaluation Count:0 | yes Evaluation Count:293 |
never evaluated: !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity) | 0-293 |
3505 | continue; never executed: continue; | 0 |
3506 | drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform); | - |
3507 | } executed: } Execution Count:293 | 293 |
3508 | | - |
3509 | | - |
3510 | if (itemClipsChildrenToShape) evaluated: itemClipsChildrenToShape yes Evaluation Count:12 | yes Evaluation Count:82 |
| 12-82 |
3511 | painter->restore(); executed: painter->restore(); Execution Count:12 | 12 |
3512 | } executed: } Execution Count:94 | 94 |
3513 | } executed: } Execution Count:2650 | 2650 |
3514 | | - |
3515 | void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, bool invalidateChildren, | - |
3516 | bool force, bool ignoreOpacity, bool removingItemFromScene, | - |
3517 | bool updateBoundingRect) | - |
3518 | { | - |
3519 | qt_noop(); | - |
3520 | if (updateAll) evaluated: updateAll yes Evaluation Count:5433 | yes Evaluation Count:1499 |
| 1499-5433 |
3521 | return; executed: return; Execution Count:5433 | 5433 |
3522 | | - |
3523 | if (removingItemFromScene && !ignoreOpacity && !item->d_ptr->ignoreOpacity) { evaluated: removingItemFromScene yes Evaluation Count:564 | yes Evaluation Count:935 |
partially evaluated: !ignoreOpacity yes Evaluation Count:564 | no Evaluation Count:0 |
partially evaluated: !item->d_ptr->ignoreOpacity yes Evaluation Count:564 | no Evaluation Count:0 |
| 0-935 |
3524 | | - |
3525 | | - |
3526 | | - |
3527 | | - |
3528 | | - |
3529 | | - |
3530 | | - |
3531 | QGraphicsItem *p = item->d_ptr->parent; | - |
3532 | while (p) { evaluated: p yes Evaluation Count:43 | yes Evaluation Count:564 |
| 43-564 |
3533 | if (p->d_ptr->ignoreOpacity) { partially evaluated: p->d_ptr->ignoreOpacity no Evaluation Count:0 | yes Evaluation Count:43 |
| 0-43 |
3534 | item->d_ptr->ignoreOpacity = true; | - |
3535 | break; | 0 |
3536 | } | - |
3537 | p = p->d_ptr->parent; | - |
3538 | } executed: } Execution Count:43 | 43 |
3539 | } executed: } Execution Count:564 | 564 |
3540 | | - |
3541 | if (item->d_ptr->discardUpdateRequest( force, | 113-1386 |
3542 | removingItemFromScene || invalidateChildren, | 113-1386 |
3543 | ignoreOpacity)) { evaluated: item->d_ptr->discardUpdateRequest( force, removingItemFromScene || invalidateChildren, ignoreOpacity) yes Evaluation Count:113 | yes Evaluation Count:1386 |
| 113-1386 |
3544 | if (item->d_ptr->dirty) { partially evaluated: item->d_ptr->dirty yes Evaluation Count:113 | no Evaluation Count:0 |
| 0-113 |
3545 | | - |
3546 | | - |
3547 | | - |
3548 | | - |
3549 | if (force) partially evaluated: force no Evaluation Count:0 | yes Evaluation Count:113 |
| 0-113 |
3550 | item->d_ptr->ignoreVisible = 1; never executed: item->d_ptr->ignoreVisible = 1; | 0 |
3551 | if (ignoreOpacity) partially evaluated: ignoreOpacity no Evaluation Count:0 | yes Evaluation Count:113 |
| 0-113 |
3552 | item->d_ptr->ignoreOpacity = 1; never executed: item->d_ptr->ignoreOpacity = 1; | 0 |
3553 | } executed: } Execution Count:113 | 113 |
3554 | return; executed: return; Execution Count:113 | 113 |
3555 | } | - |
3556 | | - |
3557 | const bool fullItemUpdate = rect.isNull(); | - |
3558 | if (!fullItemUpdate && rect.isEmpty()) evaluated: !fullItemUpdate yes Evaluation Count:2 | yes Evaluation Count:1384 |
partially evaluated: rect.isEmpty() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-1384 |
3559 | return; | 0 |
3560 | | - |
3561 | if (!processDirtyItemsEmitted) { evaluated: !processDirtyItemsEmitted yes Evaluation Count:763 | yes Evaluation Count:623 |
| 623-763 |
3562 | QMetaMethod method = q_ptr->metaObject()->method(processDirtyItemsIndex); | - |
3563 | method.invoke(q_ptr, Qt::QueuedConnection); | - |
3564 | | - |
3565 | processDirtyItemsEmitted = true; | - |
3566 | } executed: } Execution Count:763 | 763 |
3567 | | - |
3568 | if (removingItemFromScene) { evaluated: removingItemFromScene yes Evaluation Count:564 | yes Evaluation Count:822 |
| 564-822 |
3569 | | - |
3570 | | - |
3571 | if (isSignalConnected(changedSignalIndex) || views.isEmpty()) { evaluated: isSignalConnected(changedSignalIndex) yes Evaluation Count:4 | yes Evaluation Count:560 |
evaluated: views.isEmpty() yes Evaluation Count:510 | yes Evaluation Count:50 |
| 4-560 |
3572 | | - |
3573 | | - |
3574 | | - |
3575 | q_func()->update(); | - |
3576 | return; executed: return; Execution Count:514 | 514 |
3577 | } | - |
3578 | | - |
3579 | for (int i = 0; i < views.size(); ++i) { evaluated: i < views.size() yes Evaluation Count:50 | yes Evaluation Count:50 |
| 50 |
3580 | QGraphicsViewPrivate *viewPrivate = views.at(i)->d_func(); | - |
3581 | QRect rect = item->d_ptr->paintedViewBoundingRects.value(viewPrivate->viewport); | - |
3582 | rect.translate(viewPrivate->dirtyScrollOffset); | - |
3583 | viewPrivate->updateRect(rect); | - |
3584 | } executed: } Execution Count:50 | 50 |
3585 | return; executed: return; Execution Count:50 | 50 |
3586 | } | - |
3587 | | - |
3588 | bool hasNoContents = item->d_ptr->flags & QGraphicsItem::ItemHasNoContents; | - |
3589 | if (!hasNoContents) { evaluated: !hasNoContents yes Evaluation Count:815 | yes Evaluation Count:7 |
| 7-815 |
3590 | item->d_ptr->dirty = 1; | - |
3591 | if (fullItemUpdate) evaluated: fullItemUpdate yes Evaluation Count:813 | yes Evaluation Count:2 |
| 2-813 |
3592 | item->d_ptr->fullUpdatePending = 1; executed: item->d_ptr->fullUpdatePending = 1; Execution Count:813 | 813 |
3593 | else if (!item->d_ptr->fullUpdatePending) partially evaluated: !item->d_ptr->fullUpdatePending yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
3594 | item->d_ptr->needsRepaint |= rect; executed: item->d_ptr->needsRepaint |= rect; Execution Count:2 | 2 |
3595 | } else if (item->d_ptr->graphicsEffect) { evaluated: item->d_ptr->graphicsEffect yes Evaluation Count:4 | yes Evaluation Count:3 |
| 3-4 |
3596 | invalidateChildren = true; | - |
3597 | } executed: } Execution Count:4 | 4 |
3598 | | - |
3599 | if (invalidateChildren) { evaluated: invalidateChildren yes Evaluation Count:269 | yes Evaluation Count:553 |
| 269-553 |
3600 | item->d_ptr->allChildrenDirty = 1; | - |
3601 | item->d_ptr->dirtyChildren = 1; | - |
3602 | } executed: } Execution Count:269 | 269 |
3603 | | - |
3604 | if (force) evaluated: force yes Evaluation Count:2 | yes Evaluation Count:820 |
| 2-820 |
3605 | item->d_ptr->ignoreVisible = 1; executed: item->d_ptr->ignoreVisible = 1; Execution Count:2 | 2 |
3606 | if (ignoreOpacity) partially evaluated: ignoreOpacity no Evaluation Count:0 | yes Evaluation Count:822 |
| 0-822 |
3607 | item->d_ptr->ignoreOpacity = 1; never executed: item->d_ptr->ignoreOpacity = 1; | 0 |
3608 | | - |
3609 | if (!updateBoundingRect) evaluated: !updateBoundingRect yes Evaluation Count:567 | yes Evaluation Count:255 |
| 255-567 |
3610 | item->d_ptr->markParentDirty(); executed: item->d_ptr->markParentDirty(); Execution Count:567 | 567 |
3611 | } executed: } Execution Count:822 | 822 |
3612 | | - |
3613 | static inline bool updateHelper(QGraphicsViewPrivate *view, QGraphicsItemPrivate *item, | - |
3614 | const QRectF &rect, bool itemIsUntransformable) | - |
3615 | { | - |
3616 | qt_noop(); | - |
3617 | qt_noop(); | - |
3618 | | - |
3619 | QGraphicsItem *itemq = static_cast<QGraphicsItem *>(item->q_ptr); | - |
3620 | QGraphicsView *viewq = static_cast<QGraphicsView *>(view->q_ptr); | - |
3621 | | - |
3622 | if (itemIsUntransformable) { partially evaluated: itemIsUntransformable no Evaluation Count:0 | yes Evaluation Count:354 |
| 0-354 |
3623 | const QTransform xform = itemq->deviceTransform(viewq->viewportTransform()); | - |
3624 | if (!item->hasBoundingRegionGranularity) never evaluated: !item->hasBoundingRegionGranularity | 0 |
3625 | return view->updateRectF(xform.mapRect(rect)); never executed: return view->updateRectF(xform.mapRect(rect)); | 0 |
3626 | return view->updateRegion(rect, xform); never executed: return view->updateRegion(rect, xform); | 0 |
3627 | } | - |
3628 | | - |
3629 | if (item->sceneTransformTranslateOnly && view->identityMatrix) { evaluated: item->sceneTransformTranslateOnly yes Evaluation Count:353 | yes Evaluation Count:1 |
evaluated: view->identityMatrix yes Evaluation Count:248 | yes Evaluation Count:105 |
| 1-353 |
3630 | const qreal dx = item->sceneTransform.dx(); | - |
3631 | const qreal dy = item->sceneTransform.dy(); | - |
3632 | QRectF r(rect); | - |
3633 | r.translate(dx - view->horizontalScroll(), dy - view->verticalScroll()); | - |
3634 | return view->updateRectF(r); executed: return view->updateRectF(r); Execution Count:248 | 248 |
3635 | } | - |
3636 | | - |
3637 | if (!viewq->isTransformed()) { partially evaluated: !viewq->isTransformed() no Evaluation Count:0 | yes Evaluation Count:106 |
| 0-106 |
3638 | if (!item->hasBoundingRegionGranularity) never evaluated: !item->hasBoundingRegionGranularity | 0 |
3639 | return view->updateRectF(item->sceneTransform.mapRect(rect)); never executed: return view->updateRectF(item->sceneTransform.mapRect(rect)); | 0 |
3640 | return view->updateRegion(rect, item->sceneTransform); never executed: return view->updateRegion(rect, item->sceneTransform); | 0 |
3641 | } | - |
3642 | | - |
3643 | QTransform xform = item->sceneTransform; | - |
3644 | xform *= viewq->viewportTransform(); | - |
3645 | if (!item->hasBoundingRegionGranularity) partially evaluated: !item->hasBoundingRegionGranularity yes Evaluation Count:106 | no Evaluation Count:0 |
| 0-106 |
3646 | return view->updateRectF(xform.mapRect(rect)); executed: return view->updateRectF(xform.mapRect(rect)); Execution Count:106 | 106 |
3647 | return view->updateRegion(rect, xform); never executed: return view->updateRegion(rect, xform); | 0 |
3648 | } | - |
3649 | | - |
3650 | void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool dirtyAncestorContainsChildren, | - |
3651 | qreal parentOpacity) | - |
3652 | { | - |
3653 | QGraphicsScene * const q = q_func(); | - |
3654 | qt_noop(); | - |
3655 | qt_noop(); | - |
3656 | | - |
3657 | if (!item->d_ptr->dirty && !item->d_ptr->dirtyChildren) { evaluated: !item->d_ptr->dirty yes Evaluation Count:810 | yes Evaluation Count:379 |
evaluated: !item->d_ptr->dirtyChildren yes Evaluation Count:776 | yes Evaluation Count:34 |
| 34-810 |
3658 | resetDirtyItem(item); | - |
3659 | return; executed: return; Execution Count:776 | 776 |
3660 | } | - |
3661 | | - |
3662 | const bool itemIsHidden = !item->d_ptr->ignoreVisible && !item->d_ptr->visible; evaluated: !item->d_ptr->ignoreVisible yes Evaluation Count:412 | yes Evaluation Count:1 |
evaluated: !item->d_ptr->visible yes Evaluation Count:1 | yes Evaluation Count:411 |
| 1-412 |
3663 | if (itemIsHidden) { evaluated: itemIsHidden yes Evaluation Count:1 | yes Evaluation Count:412 |
| 1-412 |
3664 | resetDirtyItem(item, true); | - |
3665 | return; executed: return; Execution Count:1 | 1 |
3666 | } | - |
3667 | | - |
3668 | bool itemHasContents = !(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents); | - |
3669 | const bool itemHasChildren = !item->d_ptr->children.isEmpty(); | - |
3670 | if (!itemHasContents) { evaluated: !itemHasContents yes Evaluation Count:7 | yes Evaluation Count:405 |
| 7-405 |
3671 | if (!itemHasChildren) { partially evaluated: !itemHasChildren no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
3672 | resetDirtyItem(item); | - |
3673 | return; | 0 |
3674 | } | - |
3675 | if (item->d_ptr->graphicsEffect) evaluated: item->d_ptr->graphicsEffect yes Evaluation Count:4 | yes Evaluation Count:3 |
| 3-4 |
3676 | itemHasContents = true; executed: itemHasContents = true; Execution Count:4 | 4 |
3677 | } executed: } Execution Count:7 | 7 |
3678 | | - |
3679 | const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); | - |
3680 | const bool itemIsFullyTransparent = !item->d_ptr->ignoreOpacity partially evaluated: !item->d_ptr->ignoreOpacity yes Evaluation Count:412 | no Evaluation Count:0 |
| 0-412 |
3681 | && QGraphicsItemPrivate::isOpacityNull(opacity); partially evaluated: QGraphicsItemPrivate::isOpacityNull(opacity) no Evaluation Count:0 | yes Evaluation Count:412 |
| 0-412 |
3682 | if (itemIsFullyTransparent && (!itemHasChildren || item->d_ptr->childrenCombineOpacity())) { partially evaluated: itemIsFullyTransparent no Evaluation Count:0 | yes Evaluation Count:412 |
never evaluated: !itemHasChildren never evaluated: item->d_ptr->childrenCombineOpacity() | 0-412 |
3683 | resetDirtyItem(item, itemHasChildren); | - |
3684 | return; | 0 |
3685 | } | - |
3686 | | - |
3687 | bool wasDirtyParentSceneTransform = item->d_ptr->dirtySceneTransform; | - |
3688 | const bool itemIsUntransformable = item->d_ptr->itemIsUntransformable(); | - |
3689 | if (wasDirtyParentSceneTransform && !itemIsUntransformable) { evaluated: wasDirtyParentSceneTransform yes Evaluation Count:162 | yes Evaluation Count:250 |
partially evaluated: !itemIsUntransformable yes Evaluation Count:162 | no Evaluation Count:0 |
| 0-250 |
3690 | item->d_ptr->updateSceneTransformFromParent(); | - |
3691 | qt_noop(); | - |
3692 | } executed: } Execution Count:162 | 162 |
3693 | | - |
3694 | const bool wasDirtyParentViewBoundingRects = item->d_ptr->paintedViewBoundingRectsNeedRepaint; | - |
3695 | if (itemIsFullyTransparent || !itemHasContents || dirtyAncestorContainsChildren) { partially evaluated: itemIsFullyTransparent no Evaluation Count:0 | yes Evaluation Count:412 |
evaluated: !itemHasContents yes Evaluation Count:3 | yes Evaluation Count:409 |
evaluated: dirtyAncestorContainsChildren yes Evaluation Count:3 | yes Evaluation Count:406 |
| 0-412 |
3696 | | - |
3697 | item->d_ptr->dirty = 0; | - |
3698 | item->d_ptr->fullUpdatePending = 0; | - |
3699 | | - |
3700 | if (itemIsFullyTransparent || !itemHasContents) partially evaluated: itemIsFullyTransparent no Evaluation Count:0 | yes Evaluation Count:6 |
evaluated: !itemHasContents yes Evaluation Count:3 | yes Evaluation Count:3 |
| 0-6 |
3701 | item->d_ptr->paintedViewBoundingRectsNeedRepaint = 0; executed: item->d_ptr->paintedViewBoundingRectsNeedRepaint = 0; Execution Count:3 | 3 |
3702 | } executed: } Execution Count:6 | 6 |
3703 | | - |
3704 | if (!hasSceneRect && item->d_ptr->geometryChanged && item->d_ptr->visible) { evaluated: !hasSceneRect yes Evaluation Count:378 | yes Evaluation Count:34 |
evaluated: item->d_ptr->geometryChanged yes Evaluation Count:338 | yes Evaluation Count:40 |
partially evaluated: item->d_ptr->visible yes Evaluation Count:338 | no Evaluation Count:0 |
| 0-378 |
3705 | | - |
3706 | if (item->d_ptr->sceneTransformTranslateOnly) { evaluated: item->d_ptr->sceneTransformTranslateOnly yes Evaluation Count:337 | yes Evaluation Count:1 |
| 1-337 |
3707 | growingItemsBoundingRect |= item->boundingRect().translated(item->d_ptr->sceneTransform.dx(), | - |
3708 | item->d_ptr->sceneTransform.dy()); | - |
3709 | } else { executed: } Execution Count:337 | 337 |
3710 | growingItemsBoundingRect |= item->d_ptr->sceneTransform.mapRect(item->boundingRect()); | - |
3711 | } executed: } Execution Count:1 | 1 |
3712 | } | - |
3713 | | - |
3714 | | - |
3715 | if (item->d_ptr->dirty || item->d_ptr->paintedViewBoundingRectsNeedRepaint) { evaluated: item->d_ptr->dirty yes Evaluation Count:374 | yes Evaluation Count:38 |
evaluated: item->d_ptr->paintedViewBoundingRectsNeedRepaint yes Evaluation Count:3 | yes Evaluation Count:35 |
| 3-374 |
3716 | const bool useCompatUpdate = views.isEmpty() || isSignalConnected(changedSignalIndex); evaluated: views.isEmpty() yes Evaluation Count:4 | yes Evaluation Count:373 |
evaluated: isSignalConnected(changedSignalIndex) yes Evaluation Count:6 | yes Evaluation Count:367 |
| 4-373 |
3717 | const QRectF itemBoundingRect = adjustedItemEffectiveBoundingRect(item); | - |
3718 | | - |
3719 | if (useCompatUpdate && !itemIsUntransformable && qFuzzyIsNull(item->boundingRegionGranularity())) { evaluated: useCompatUpdate yes Evaluation Count:10 | yes Evaluation Count:367 |
partially evaluated: !itemIsUntransformable yes Evaluation Count:10 | no Evaluation Count:0 |
partially evaluated: qFuzzyIsNull(item->boundingRegionGranularity()) yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-367 |
3720 | | - |
3721 | | - |
3722 | | - |
3723 | if (item->d_ptr->sceneTransformTranslateOnly) { partially evaluated: item->d_ptr->sceneTransformTranslateOnly yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
3724 | q->update(itemBoundingRect.translated(item->d_ptr->sceneTransform.dx(), | - |
3725 | item->d_ptr->sceneTransform.dy())); | - |
3726 | } else { executed: } Execution Count:10 | 10 |
3727 | QRectF rect = item->d_ptr->sceneTransform.mapRect(itemBoundingRect); | - |
3728 | if (!rect.isEmpty()) never evaluated: !rect.isEmpty() | 0 |
3729 | q->update(rect); never executed: q->update(rect); | 0 |
3730 | } | 0 |
3731 | } else { | - |
3732 | QRectF dirtyRect; | - |
3733 | bool uninitializedDirtyRect = true; | - |
3734 | | - |
3735 | for (int j = 0; j < views.size(); ++j) { evaluated: j < views.size() yes Evaluation Count:367 | yes Evaluation Count:367 |
| 367 |
3736 | QGraphicsView *view = views.at(j); | - |
3737 | QGraphicsViewPrivate *viewPrivate = view->d_func(); | - |
3738 | QRect &paintedViewBoundingRect = item->d_ptr->paintedViewBoundingRects[viewPrivate->viewport]; | - |
3739 | if (viewPrivate->fullUpdatePending evaluated: viewPrivate->fullUpdatePending yes Evaluation Count:11 | yes Evaluation Count:356 |
| 11-356 |
3740 | || viewPrivate->viewportUpdateMode == QGraphicsView::NoViewportUpdate) { evaluated: viewPrivate->viewportUpdateMode == QGraphicsView::NoViewportUpdate yes Evaluation Count:1 | yes Evaluation Count:355 |
| 1-355 |
3741 | | - |
3742 | | - |
3743 | | - |
3744 | paintedViewBoundingRect = QRect(-1, -1, -1, -1); | - |
3745 | continue; executed: continue; Execution Count:12 | 12 |
3746 | } | - |
3747 | | - |
3748 | if (item->d_ptr->paintedViewBoundingRectsNeedRepaint) { evaluated: item->d_ptr->paintedViewBoundingRectsNeedRepaint yes Evaluation Count:315 | yes Evaluation Count:40 |
| 40-315 |
3749 | paintedViewBoundingRect.translate(viewPrivate->dirtyScrollOffset); | - |
3750 | if (!viewPrivate->updateRect(paintedViewBoundingRect)) evaluated: !viewPrivate->updateRect(paintedViewBoundingRect) yes Evaluation Count:10 | yes Evaluation Count:305 |
| 10-305 |
3751 | paintedViewBoundingRect = QRect(-1, -1, -1, -1); executed: paintedViewBoundingRect = QRect(-1, -1, -1, -1); Execution Count:10 | 10 |
3752 | } executed: } Execution Count:315 | 315 |
3753 | | - |
3754 | if (!item->d_ptr->dirty) evaluated: !item->d_ptr->dirty yes Evaluation Count:1 | yes Evaluation Count:354 |
| 1-354 |
3755 | continue; executed: continue; Execution Count:1 | 1 |
3756 | | - |
3757 | if (!item->d_ptr->paintedViewBoundingRectsNeedRepaint evaluated: !item->d_ptr->paintedViewBoundingRectsNeedRepaint yes Evaluation Count:40 | yes Evaluation Count:314 |
| 40-314 |
3758 | && paintedViewBoundingRect.x() == -1 && paintedViewBoundingRect.y() == -1 partially evaluated: paintedViewBoundingRect.x() == -1 no Evaluation Count:0 | yes Evaluation Count:40 |
never evaluated: paintedViewBoundingRect.y() == -1 | 0-40 |
3759 | && paintedViewBoundingRect.width() == -1 && paintedViewBoundingRect.height() == -1) { never evaluated: paintedViewBoundingRect.width() == -1 never evaluated: paintedViewBoundingRect.height() == -1 | 0 |
3760 | continue; never executed: continue; | 0 |
3761 | } | - |
3762 | | - |
3763 | if (uninitializedDirtyRect) { partially evaluated: uninitializedDirtyRect yes Evaluation Count:354 | no Evaluation Count:0 |
| 0-354 |
3764 | dirtyRect = itemBoundingRect; | - |
3765 | if (!item->d_ptr->fullUpdatePending) { partially evaluated: !item->d_ptr->fullUpdatePending no Evaluation Count:0 | yes Evaluation Count:354 |
| 0-354 |
3766 | _q_adjustRect(&item->d_ptr->needsRepaint); | - |
3767 | dirtyRect &= item->d_ptr->needsRepaint; | - |
3768 | } | 0 |
3769 | uninitializedDirtyRect = false; | - |
3770 | } executed: } Execution Count:354 | 354 |
3771 | | - |
3772 | if (dirtyRect.isEmpty()) partially evaluated: dirtyRect.isEmpty() no Evaluation Count:0 | yes Evaluation Count:354 |
| 0-354 |
3773 | continue; never executed: continue; | 0 |
3774 | | - |
3775 | if (!updateHelper(viewPrivate, item->d_ptr.data(), dirtyRect, itemIsUntransformable) evaluated: !updateHelper(viewPrivate, item->d_ptr.data(), dirtyRect, itemIsUntransformable) yes Evaluation Count:5 | yes Evaluation Count:349 |
| 5-349 |
3776 | && item->d_ptr->paintedViewBoundingRectsNeedRepaint) { partially evaluated: item->d_ptr->paintedViewBoundingRectsNeedRepaint yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
3777 | paintedViewBoundingRect = QRect(-1, -1, -1, -1); | - |
3778 | } executed: } Execution Count:5 | 5 |
3779 | } executed: } Execution Count:354 | 354 |
3780 | } executed: } Execution Count:367 | 367 |
3781 | } | - |
3782 | | - |
3783 | | - |
3784 | if (itemHasChildren && item->d_ptr->dirtyChildren) { evaluated: itemHasChildren yes Evaluation Count:58 | yes Evaluation Count:354 |
evaluated: item->d_ptr->dirtyChildren yes Evaluation Count:57 | yes Evaluation Count:1 |
| 1-354 |
3785 | const bool itemClipsChildrenToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape; | - |
3786 | | - |
3787 | | - |
3788 | | - |
3789 | | - |
3790 | const bool bypassUpdateClip = !itemHasContents && wasDirtyParentViewBoundingRects; evaluated: !itemHasContents yes Evaluation Count:3 | yes Evaluation Count:54 |
evaluated: wasDirtyParentViewBoundingRects yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-54 |
3791 | if (itemClipsChildrenToShape && !bypassUpdateClip) { evaluated: itemClipsChildrenToShape yes Evaluation Count:8 | yes Evaluation Count:49 |
evaluated: !bypassUpdateClip yes Evaluation Count:7 | yes Evaluation Count:1 |
| 1-49 |
3792 | | - |
3793 | for (int i = 0; i < views.size(); ++i) evaluated: i < views.size() yes Evaluation Count:7 | yes Evaluation Count:7 |
| 7 |
3794 | views.at(i)->d_func()->setUpdateClip(item); executed: views.at(i)->d_func()->setUpdateClip(item); Execution Count:7 | 7 |
3795 | } executed: } Execution Count:7 | 7 |
3796 | if (!dirtyAncestorContainsChildren) { evaluated: !dirtyAncestorContainsChildren yes Evaluation Count:56 | yes Evaluation Count:1 |
| 1-56 |
3797 | dirtyAncestorContainsChildren = item->d_ptr->fullUpdatePending evaluated: item->d_ptr->fullUpdatePending yes Evaluation Count:21 | yes Evaluation Count:35 |
| 21-35 |
3798 | && itemClipsChildrenToShape; evaluated: itemClipsChildrenToShape yes Evaluation Count:2 | yes Evaluation Count:19 |
| 2-19 |
3799 | } executed: } Execution Count:56 | 56 |
3800 | const bool allChildrenDirty = item->d_ptr->allChildrenDirty; | - |
3801 | const bool parentIgnoresVisible = item->d_ptr->ignoreVisible; | - |
3802 | const bool parentIgnoresOpacity = item->d_ptr->ignoreOpacity; | - |
3803 | for (int i = 0; i < item->d_ptr->children.size(); ++i) { evaluated: i < item->d_ptr->children.size() yes Evaluation Count:178 | yes Evaluation Count:57 |
| 57-178 |
3804 | QGraphicsItem *child = item->d_ptr->children.at(i); | - |
3805 | if (wasDirtyParentSceneTransform) evaluated: wasDirtyParentSceneTransform yes Evaluation Count:5 | yes Evaluation Count:173 |
| 5-173 |
3806 | child->d_ptr->dirtySceneTransform = 1; executed: child->d_ptr->dirtySceneTransform = 1; Execution Count:5 | 5 |
3807 | if (wasDirtyParentViewBoundingRects) evaluated: wasDirtyParentViewBoundingRects yes Evaluation Count:85 | yes Evaluation Count:93 |
| 85-93 |
3808 | child->d_ptr->paintedViewBoundingRectsNeedRepaint = 1; executed: child->d_ptr->paintedViewBoundingRectsNeedRepaint = 1; Execution Count:85 | 85 |
3809 | if (parentIgnoresVisible) partially evaluated: parentIgnoresVisible no Evaluation Count:0 | yes Evaluation Count:178 |
| 0-178 |
3810 | child->d_ptr->ignoreVisible = 1; never executed: child->d_ptr->ignoreVisible = 1; | 0 |
3811 | if (parentIgnoresOpacity) partially evaluated: parentIgnoresOpacity no Evaluation Count:0 | yes Evaluation Count:178 |
| 0-178 |
3812 | child->d_ptr->ignoreOpacity = 1; never executed: child->d_ptr->ignoreOpacity = 1; | 0 |
3813 | if (allChildrenDirty) { evaluated: allChildrenDirty yes Evaluation Count:20 | yes Evaluation Count:158 |
| 20-158 |
3814 | child->d_ptr->dirty = 1; | - |
3815 | child->d_ptr->fullUpdatePending = 1; | - |
3816 | child->d_ptr->dirtyChildren = 1; | - |
3817 | child->d_ptr->allChildrenDirty = 1; | - |
3818 | } executed: } Execution Count:20 | 20 |
3819 | processDirtyItemsRecursive(child, dirtyAncestorContainsChildren, opacity); | - |
3820 | } executed: } Execution Count:178 | 178 |
3821 | | - |
3822 | if (itemClipsChildrenToShape) { evaluated: itemClipsChildrenToShape yes Evaluation Count:8 | yes Evaluation Count:49 |
| 8-49 |
3823 | | - |
3824 | for (int i = 0; i < views.size(); ++i) evaluated: i < views.size() yes Evaluation Count:8 | yes Evaluation Count:8 |
| 8 |
3825 | views.at(i)->d_func()->setUpdateClip(0); executed: views.at(i)->d_func()->setUpdateClip(0); Execution Count:8 | 8 |
3826 | } executed: } Execution Count:8 | 8 |
3827 | } else if (wasDirtyParentSceneTransform) { evaluated: wasDirtyParentSceneTransform yes Evaluation Count:157 | yes Evaluation Count:198 |
executed: } Execution Count:57 | 57-198 |
3828 | item->d_ptr->invalidateChildrenSceneTransform(); | - |
3829 | } executed: } Execution Count:157 | 157 |
3830 | | - |
3831 | resetDirtyItem(item); | - |
3832 | } executed: } Execution Count:412 | 412 |
3833 | void QGraphicsScene::drawItems(QPainter *painter, | - |
3834 | int numItems, | - |
3835 | QGraphicsItem *items[], | - |
3836 | const QStyleOptionGraphicsItem options[], QWidget *widget) | - |
3837 | { | - |
3838 | QGraphicsScenePrivate * const d = d_func(); | - |
3839 | | - |
3840 | if (!d->unpolishedItems.isEmpty()) evaluated: !d->unpolishedItems.isEmpty() yes Evaluation Count:7 | yes Evaluation Count:13 |
| 7-13 |
3841 | d->_q_polishItems(); executed: d->_q_polishItems(); Execution Count:7 | 7 |
3842 | | - |
3843 | const qreal opacity = painter->opacity(); | - |
3844 | QTransform viewTransform = painter->worldTransform(); | - |
3845 | (void)options;; | - |
3846 | | - |
3847 | | - |
3848 | QGraphicsView *view = widget ? qobject_cast<QGraphicsView *>(widget->parentWidget()) : 0; evaluated: widget yes Evaluation Count:4 | yes Evaluation Count:16 |
| 4-16 |
3849 | QRegion *expose = 0; | - |
3850 | const quint32 oldRectAdjust = d->rectAdjust; | - |
3851 | if (view) { evaluated: view yes Evaluation Count:4 | yes Evaluation Count:16 |
| 4-16 |
3852 | d->updateAll = false; | - |
3853 | expose = &view->d_func()->exposedRegion; | - |
3854 | if (view->d_func()->optimizationFlags & QGraphicsView::DontAdjustForAntialiasing) partially evaluated: view->d_func()->optimizationFlags & QGraphicsView::DontAdjustForAntialiasing no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
3855 | d->rectAdjust = 1; never executed: d->rectAdjust = 1; | 0 |
3856 | else | - |
3857 | d->rectAdjust = 2; executed: d->rectAdjust = 2; Execution Count:4 | 4 |
3858 | } | - |
3859 | | - |
3860 | | - |
3861 | QList<QGraphicsItem *> topLevelItems; | - |
3862 | for (int i = 0; i < numItems; ++i) { evaluated: i < numItems yes Evaluation Count:35 | yes Evaluation Count:20 |
| 20-35 |
3863 | QGraphicsItem *item = items[i]->topLevelItem(); | - |
3864 | if (!item->d_ptr->itemDiscovered) { partially evaluated: !item->d_ptr->itemDiscovered yes Evaluation Count:35 | no Evaluation Count:0 |
| 0-35 |
3865 | topLevelItems << item; | - |
3866 | item->d_ptr->itemDiscovered = 1; | - |
3867 | d->drawSubtreeRecursive(item, painter, &viewTransform, expose, widget); | - |
3868 | } executed: } Execution Count:35 | 35 |
3869 | } executed: } Execution Count:35 | 35 |
3870 | | - |
3871 | d->rectAdjust = oldRectAdjust; | - |
3872 | | - |
3873 | for (int i = 0; i < topLevelItems.size(); ++i) evaluated: i < topLevelItems.size() yes Evaluation Count:35 | yes Evaluation Count:20 |
| 20-35 |
3874 | topLevelItems.at(i)->d_ptr->itemDiscovered = 0; executed: topLevelItems.at(i)->d_ptr->itemDiscovered = 0; Execution Count:35 | 35 |
3875 | | - |
3876 | painter->setWorldTransform(viewTransform); | - |
3877 | painter->setOpacity(opacity); | - |
3878 | } executed: } Execution Count:20 | 20 |
3879 | bool QGraphicsScene::focusNextPrevChild(bool next) | - |
3880 | { | - |
3881 | QGraphicsScenePrivate * const d = d_func(); | - |
3882 | | - |
3883 | QGraphicsItem *item = focusItem(); | - |
3884 | if (item && !item->isWidget()) { never evaluated: !item->isWidget() | 0 |
3885 | | - |
3886 | return false; never executed: return false; | 0 |
3887 | } | - |
3888 | if (!item) { | 0 |
3889 | if (d->lastFocusItem && !d->lastFocusItem->isWidget()) { never evaluated: d->lastFocusItem never evaluated: !d->lastFocusItem->isWidget() | 0 |
3890 | | - |
3891 | | - |
3892 | setFocusItem(d->lastFocusItem, next ? Qt::TabFocusReason : Qt::BacktabFocusReason); | - |
3893 | return true; never executed: return true; | 0 |
3894 | } | - |
3895 | } | 0 |
3896 | if (!d->tabFocusFirst) { never evaluated: !d->tabFocusFirst | 0 |
3897 | | - |
3898 | return false; never executed: return false; | 0 |
3899 | } | - |
3900 | | - |
3901 | | - |
3902 | QGraphicsWidget *widget = 0; | - |
3903 | if (!item) { | 0 |
3904 | widget = next ? d->tabFocusFirst : d->tabFocusFirst->d_func()->focusPrev; | 0 |
3905 | } else { | 0 |
3906 | QGraphicsWidget *test = static_cast<QGraphicsWidget *>(item); | - |
3907 | widget = next ? test->d_func()->focusNext : test->d_func()->focusPrev; | 0 |
3908 | if ((next && widget == d->tabFocusFirst) || (!next && widget == d->tabFocusFirst->d_func()->focusPrev)) never evaluated: widget == d->tabFocusFirst never evaluated: widget == d->tabFocusFirst->d_func()->focusPrev | 0 |
3909 | return false; never executed: return false; | 0 |
3910 | } | 0 |
3911 | QGraphicsWidget *widgetThatHadFocus = widget; | - |
3912 | | - |
3913 | | - |
3914 | do { | - |
3915 | if (widget->flags() & QGraphicsItem::ItemIsFocusable never evaluated: widget->flags() & QGraphicsItem::ItemIsFocusable | 0 |
3916 | && widget->isEnabled() && widget->isVisibleTo(0) never evaluated: widget->isEnabled() never evaluated: widget->isVisibleTo(0) | 0 |
3917 | && (widget->focusPolicy() & Qt::TabFocus) never evaluated: (widget->focusPolicy() & Qt::TabFocus) | 0 |
3918 | && (!item || !item->isPanel() || item->isAncestorOf(widget)) never evaluated: !item->isPanel() never evaluated: item->isAncestorOf(widget) | 0 |
3919 | ) { | - |
3920 | setFocusItem(widget, next ? Qt::TabFocusReason : Qt::BacktabFocusReason); | - |
3921 | return true; never executed: return true; | 0 |
3922 | } | - |
3923 | widget = next ? widget->d_func()->focusNext : widget->d_func()->focusPrev; | 0 |
3924 | if ((next && widget == d->tabFocusFirst) || (!next && widget == d->tabFocusFirst->d_func()->focusPrev)) never evaluated: widget == d->tabFocusFirst never evaluated: widget == d->tabFocusFirst->d_func()->focusPrev | 0 |
3925 | return false; never executed: return false; | 0 |
3926 | } while (widget != widgetThatHadFocus); never evaluated: widget != widgetThatHadFocus | 0 |
3927 | | - |
3928 | return false; never executed: return false; | 0 |
3929 | } | - |
3930 | QStyle *QGraphicsScene::style() const | - |
3931 | { | - |
3932 | const QGraphicsScenePrivate * const d = d_func(); | - |
3933 | | - |
3934 | return d->style ? d->style : QApplication::style(); executed: return d->style ? d->style : QApplication::style(); Execution Count:2387 | 2387 |
3935 | } | - |
3936 | void QGraphicsScene::setStyle(QStyle *style) | - |
3937 | { | - |
3938 | QGraphicsScenePrivate * const d = d_func(); | - |
3939 | | - |
3940 | if (style == d->style) never evaluated: style == d->style | 0 |
3941 | return; | 0 |
3942 | | - |
3943 | | - |
3944 | delete d->style; | - |
3945 | if ((d->style = style)) never evaluated: (d->style = style) | 0 |
3946 | d->style->setParent(this); never executed: d->style->setParent(this); | 0 |
3947 | | - |
3948 | | - |
3949 | QEvent event(QEvent::StyleChange); | - |
3950 | QApplication::sendEvent(this, &event); | - |
3951 | | - |
3952 | | - |
3953 | for (QForeachContainer<__typeof__(items())> _container_(items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
3954 | if (item->isWidget()) { never evaluated: item->isWidget() | 0 |
3955 | QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); | - |
3956 | if (!widget->testAttribute(Qt::WA_SetStyle)) never evaluated: !widget->testAttribute(Qt::WA_SetStyle) | 0 |
3957 | QApplication::sendEvent(widget, &event); never executed: QApplication::sendEvent(widget, &event); | 0 |
3958 | } | 0 |
3959 | } | 0 |
3960 | } | 0 |
3961 | QFont QGraphicsScene::font() const | - |
3962 | { | - |
3963 | const QGraphicsScenePrivate * const d = d_func(); | - |
3964 | return d->font; executed: return d->font; Execution Count:208 | 208 |
3965 | } | - |
3966 | void QGraphicsScene::setFont(const QFont &font) | - |
3967 | { | - |
3968 | QGraphicsScenePrivate * const d = d_func(); | - |
3969 | QFont naturalFont = QApplication::font(); | - |
3970 | naturalFont.resolve(0); | - |
3971 | QFont resolvedFont = font.resolve(naturalFont); | - |
3972 | d->setFont_helper(resolvedFont); | - |
3973 | } | 0 |
3974 | QPalette QGraphicsScene::palette() const | - |
3975 | { | - |
3976 | const QGraphicsScenePrivate * const d = d_func(); | - |
3977 | return d->palette; executed: return d->palette; Execution Count:206 | 206 |
3978 | } | - |
3979 | void QGraphicsScene::setPalette(const QPalette &palette) | - |
3980 | { | - |
3981 | QGraphicsScenePrivate * const d = d_func(); | - |
3982 | QPalette naturalPalette = QApplication::palette(); | - |
3983 | naturalPalette.resolve(0); | - |
3984 | QPalette resolvedPalette = palette.resolve(naturalPalette); | - |
3985 | d->setPalette_helper(resolvedPalette); | - |
3986 | } | 0 |
3987 | bool QGraphicsScene::isActive() const | - |
3988 | { | - |
3989 | const QGraphicsScenePrivate * const d = d_func(); | - |
3990 | return d->activationRefCount > 0; executed: return d->activationRefCount > 0; Execution Count:11153 | 11153 |
3991 | } | - |
3992 | | - |
3993 | | - |
3994 | | - |
3995 | | - |
3996 | | - |
3997 | | - |
3998 | | - |
3999 | QGraphicsItem *QGraphicsScene::activePanel() const | - |
4000 | { | - |
4001 | const QGraphicsScenePrivate * const d = d_func(); | - |
4002 | return d->activePanel; executed: return d->activePanel; Execution Count:117 | 117 |
4003 | } | - |
4004 | void QGraphicsScene::setActivePanel(QGraphicsItem *item) | - |
4005 | { | - |
4006 | QGraphicsScenePrivate * const d = d_func(); | - |
4007 | d->setActivePanelHelper(item, false); | - |
4008 | } executed: } Execution Count:5 | 5 |
4009 | QGraphicsWidget *QGraphicsScene::activeWindow() const | - |
4010 | { | - |
4011 | const QGraphicsScenePrivate * const d = d_func(); | - |
4012 | if (d->activePanel && d->activePanel->isWindow()) partially evaluated: d->activePanel no Evaluation Count:0 | yes Evaluation Count:115 |
never evaluated: d->activePanel->isWindow() | 0-115 |
4013 | return static_cast<QGraphicsWidget *>(d->activePanel); never executed: return static_cast<QGraphicsWidget *>(d->activePanel); | 0 |
4014 | return 0; executed: return 0; Execution Count:115 | 115 |
4015 | } | - |
4016 | void QGraphicsScene::setActiveWindow(QGraphicsWidget *widget) | - |
4017 | { | - |
4018 | if (widget && widget->scene() != this) { never evaluated: widget->scene() != this | 0 |
4019 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 5600, __PRETTY_FUNCTION__).warning("QGraphicsScene::setActiveWindow: widget %p must be part of this scene", | - |
4020 | widget); | - |
4021 | return; | 0 |
4022 | } | - |
4023 | | - |
4024 | | - |
4025 | QGraphicsItem *panel = widget ? widget->panel() : 0; | 0 |
4026 | setActivePanel(panel); | - |
4027 | | - |
4028 | | - |
4029 | if (panel) { | 0 |
4030 | QList<QGraphicsItem *> siblingWindows; | - |
4031 | QGraphicsItem *parent = panel->parentItem(); | - |
4032 | | - |
4033 | for (QForeachContainer<__typeof__(parent ? parent->childItems() : items())> _container_(parent ? parent->childItems() : items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *sibling = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
4034 | if (sibling != panel && sibling->isWindow()) never evaluated: sibling != panel never evaluated: sibling->isWindow() | 0 |
4035 | siblingWindows << sibling; never executed: siblingWindows << sibling; | 0 |
4036 | } | 0 |
4037 | | - |
4038 | | - |
4039 | qreal z = panel->zValue(); | - |
4040 | for (int i = 0; i < siblingWindows.size(); ++i) never evaluated: i < siblingWindows.size() | 0 |
4041 | z = qMax(z, siblingWindows.at(i)->zValue()); never executed: z = qMax(z, siblingWindows.at(i)->zValue()); | 0 |
4042 | | - |
4043 | | - |
4044 | const qreal litt = qreal(0.001); | - |
4045 | panel->setZValue(z + litt); | - |
4046 | } | 0 |
4047 | } | 0 |
4048 | bool QGraphicsScene::sendEvent(QGraphicsItem *item, QEvent *event) | - |
4049 | { | - |
4050 | QGraphicsScenePrivate * const d = d_func(); | - |
4051 | if (!item) { partially evaluated: !item no Evaluation Count:0 | yes Evaluation Count:634 |
| 0-634 |
4052 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 5646, __PRETTY_FUNCTION__).warning("QGraphicsScene::sendEvent: cannot send event to a null item"); | - |
4053 | return false; never executed: return false; | 0 |
4054 | } | - |
4055 | if (item->scene() != this) { partially evaluated: item->scene() != this no Evaluation Count:0 | yes Evaluation Count:634 |
| 0-634 |
4056 | QMessageLogger("graphicsview/qgraphicsscene.cpp", 5650, __PRETTY_FUNCTION__).warning("QGraphicsScene::sendEvent: item %p's scene (%p)" | - |
4057 | " is different from this scene (%p)", | - |
4058 | item, item->scene(), this); | - |
4059 | return false; never executed: return false; | 0 |
4060 | } | - |
4061 | return d->sendEvent(item, event); executed: return d->sendEvent(item, event); Execution Count:634 | 634 |
4062 | } | - |
4063 | | - |
4064 | void QGraphicsScenePrivate::addView(QGraphicsView *view) | - |
4065 | { | - |
4066 | views << view; | - |
4067 | | - |
4068 | for (QForeachContainer<__typeof__(grabbedGestures.keys())> _container_(grabbedGestures.keys()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (Qt::GestureType gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
4069 | view->viewport()->grabGesture(gesture); never executed: view->viewport()->grabGesture(gesture); | 0 |
4070 | | - |
4071 | } executed: } Execution Count:786 | 786 |
4072 | | - |
4073 | void QGraphicsScenePrivate::removeView(QGraphicsView *view) | - |
4074 | { | - |
4075 | views.removeAll(view); | - |
4076 | } executed: } Execution Count:22 | 22 |
4077 | | - |
4078 | void QGraphicsScenePrivate::updateTouchPointsForItem(QGraphicsItem *item, QTouchEvent *touchEvent) | - |
4079 | { | - |
4080 | QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints(); | - |
4081 | for (int i = 0; i < touchPoints.count(); ++i) { never evaluated: i < touchPoints.count() | 0 |
4082 | QTouchEvent::TouchPoint &touchPoint = touchPoints[i]; | - |
4083 | touchPoint.setRect(item->mapFromScene(touchPoint.sceneRect()).boundingRect()); | - |
4084 | touchPoint.setStartPos(item->d_ptr->genericMapFromScene(touchPoint.startScenePos(), static_cast<QWidget *>(touchEvent->target()))); | - |
4085 | touchPoint.setLastPos(item->d_ptr->genericMapFromScene(touchPoint.lastScenePos(), static_cast<QWidget *>(touchEvent->target()))); | - |
4086 | } | 0 |
4087 | touchEvent->setTouchPoints(touchPoints); | - |
4088 | } | 0 |
4089 | | - |
4090 | int QGraphicsScenePrivate::findClosestTouchPointId(const QPointF &scenePos) | - |
4091 | { | - |
4092 | int closestTouchPointId = -1; | - |
4093 | qreal closestDistance = qreal(0.); | - |
4094 | for (QForeachContainer<__typeof__(sceneCurrentTouchPoints)> _container_(sceneCurrentTouchPoints); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QTouchEvent::TouchPoint &touchPoint = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
4095 | qreal distance = QLineF(scenePos, touchPoint.scenePos()).length(); | - |
4096 | if (closestTouchPointId == -1|| distance < closestDistance) { never evaluated: closestTouchPointId == -1 never evaluated: distance < closestDistance | 0 |
4097 | closestTouchPointId = touchPoint.id(); | - |
4098 | closestDistance = distance; | - |
4099 | } | 0 |
4100 | } | 0 |
4101 | return closestTouchPointId; never executed: return closestTouchPointId; | 0 |
4102 | } | - |
4103 | | - |
4104 | void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent) | - |
4105 | { | - |
4106 | typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints; | - |
4107 | QHash<QGraphicsItem *, StatesAndTouchPoints> itemsNeedingEvents; | - |
4108 | | - |
4109 | for (int i = 0; i < sceneTouchEvent->touchPoints().count(); ++i) { never evaluated: i < sceneTouchEvent->touchPoints().count() | 0 |
4110 | const QTouchEvent::TouchPoint &touchPoint = sceneTouchEvent->touchPoints().at(i); | - |
4111 | | - |
4112 | | - |
4113 | QGraphicsItem *item = 0; | - |
4114 | if (touchPoint.state() == Qt::TouchPointPressed) { never evaluated: touchPoint.state() == Qt::TouchPointPressed | 0 |
4115 | if (sceneTouchEvent->device()->type() == QTouchDevice::TouchPad) { never evaluated: sceneTouchEvent->device()->type() == QTouchDevice::TouchPad | 0 |
4116 | | - |
4117 | item = itemForTouchPointId.isEmpty() never evaluated: itemForTouchPointId.isEmpty() | 0 |
4118 | ? 0 | - |
4119 | : itemForTouchPointId.constBegin().value(); | - |
4120 | } | 0 |
4121 | | - |
4122 | if (!item) { | 0 |
4123 | | - |
4124 | cachedItemsUnderMouse = itemsAtPosition(touchPoint.screenPos().toPoint(), | - |
4125 | touchPoint.scenePos(), | - |
4126 | static_cast<QWidget *>(sceneTouchEvent->target())); | - |
4127 | item = cachedItemsUnderMouse.isEmpty() ? 0 : cachedItemsUnderMouse.first(); never evaluated: cachedItemsUnderMouse.isEmpty() | 0 |
4128 | } | 0 |
4129 | | - |
4130 | if (sceneTouchEvent->device()->type() == QTouchDevice::TouchScreen) { never evaluated: sceneTouchEvent->device()->type() == QTouchDevice::TouchScreen | 0 |
4131 | | - |
4132 | int closestTouchPointId = findClosestTouchPointId(touchPoint.scenePos()); | - |
4133 | QGraphicsItem *closestItem = itemForTouchPointId.value(closestTouchPointId); | - |
4134 | if (!item || (closestItem && cachedItemsUnderMouse.contains(closestItem))) never evaluated: closestItem never evaluated: cachedItemsUnderMouse.contains(closestItem) | 0 |
4135 | item = closestItem; never executed: item = closestItem; | 0 |
4136 | } | 0 |
4137 | if (!item) | 0 |
4138 | continue; never executed: continue; | 0 |
4139 | | - |
4140 | itemForTouchPointId.insert(touchPoint.id(), item); | - |
4141 | sceneCurrentTouchPoints.insert(touchPoint.id(), touchPoint); | - |
4142 | } else if (touchPoint.state() == Qt::TouchPointReleased) { never evaluated: touchPoint.state() == Qt::TouchPointReleased | 0 |
4143 | item = itemForTouchPointId.take(touchPoint.id()); | - |
4144 | if (!item) | 0 |
4145 | continue; never executed: continue; | 0 |
4146 | | - |
4147 | sceneCurrentTouchPoints.remove(touchPoint.id()); | - |
4148 | } else { | 0 |
4149 | item = itemForTouchPointId.value(touchPoint.id()); | - |
4150 | if (!item) | 0 |
4151 | continue; never executed: continue; | 0 |
4152 | qt_noop(); | - |
4153 | sceneCurrentTouchPoints[touchPoint.id()] = touchPoint; | - |
4154 | } | 0 |
4155 | | - |
4156 | StatesAndTouchPoints &statesAndTouchPoints = itemsNeedingEvents[item]; | - |
4157 | statesAndTouchPoints.first |= touchPoint.state(); | - |
4158 | statesAndTouchPoints.second.append(touchPoint); | - |
4159 | } | 0 |
4160 | | - |
4161 | if (itemsNeedingEvents.isEmpty()) { never evaluated: itemsNeedingEvents.isEmpty() | 0 |
4162 | sceneTouchEvent->accept(); | - |
4163 | return; | 0 |
4164 | } | - |
4165 | | - |
4166 | bool ignoreSceneTouchEvent = true; | - |
4167 | QHash<QGraphicsItem *, StatesAndTouchPoints>::ConstIterator it = itemsNeedingEvents.constBegin(); | - |
4168 | const QHash<QGraphicsItem *, StatesAndTouchPoints>::ConstIterator end = itemsNeedingEvents.constEnd(); | - |
4169 | for (; it != end; ++it) { never evaluated: it != end | 0 |
4170 | QGraphicsItem *item = it.key(); | - |
4171 | | - |
4172 | (void) item->isBlockedByModalPanel(&item); | - |
4173 | | - |
4174 | | - |
4175 | QEvent::Type eventType; | - |
4176 | switch (it.value().first) { | - |
4177 | case Qt::TouchPointPressed: | - |
4178 | | - |
4179 | eventType = QEvent::TouchBegin; | - |
4180 | break; | 0 |
4181 | case Qt::TouchPointReleased: | - |
4182 | | - |
4183 | eventType = QEvent::TouchEnd; | - |
4184 | break; | 0 |
4185 | case Qt::TouchPointStationary: | - |
4186 | | - |
4187 | continue; never executed: continue; | 0 |
4188 | default: | - |
4189 | | - |
4190 | eventType = QEvent::TouchUpdate; | - |
4191 | break; | 0 |
4192 | } | - |
4193 | | - |
4194 | QTouchEvent touchEvent(eventType); | - |
4195 | touchEvent.setWindow(sceneTouchEvent->window()); | - |
4196 | touchEvent.setTarget(sceneTouchEvent->target()); | - |
4197 | touchEvent.setDevice(sceneTouchEvent->device()); | - |
4198 | touchEvent.setModifiers(sceneTouchEvent->modifiers()); | - |
4199 | touchEvent.setTouchPointStates(it.value().first); | - |
4200 | touchEvent.setTouchPoints(it.value().second); | - |
4201 | touchEvent.setTimestamp(sceneTouchEvent->timestamp()); | - |
4202 | | - |
4203 | switch (touchEvent.type()) { | - |
4204 | case QEvent::TouchBegin: | - |
4205 | { | - |
4206 | | - |
4207 | | - |
4208 | item->d_ptr->acceptedTouchBeginEvent = true; | - |
4209 | bool res = sendTouchBeginEvent(item, &touchEvent) never evaluated: sendTouchBeginEvent(item, &touchEvent) | 0 |
4210 | && touchEvent.isAccepted(); never evaluated: touchEvent.isAccepted() | 0 |
4211 | if (!res) { | 0 |
4212 | | - |
4213 | for (int i = 0; i < touchEvent.touchPoints().count(); ++i) { never evaluated: i < touchEvent.touchPoints().count() | 0 |
4214 | const QTouchEvent::TouchPoint &touchPoint = touchEvent.touchPoints().at(i); | - |
4215 | itemForTouchPointId.remove(touchPoint.id()); | - |
4216 | sceneCurrentTouchPoints.remove(touchPoint.id()); | - |
4217 | } | 0 |
4218 | ignoreSceneTouchEvent = false; | - |
4219 | } | 0 |
4220 | break; | 0 |
4221 | } | - |
4222 | default: | - |
4223 | if (item->d_ptr->acceptedTouchBeginEvent) { never evaluated: item->d_ptr->acceptedTouchBeginEvent | 0 |
4224 | updateTouchPointsForItem(item, &touchEvent); | - |
4225 | (void) sendEvent(item, &touchEvent); | - |
4226 | ignoreSceneTouchEvent = false; | - |
4227 | } | 0 |
4228 | break; | 0 |
4229 | } | - |
4230 | } | 0 |
4231 | sceneTouchEvent->setAccepted(ignoreSceneTouchEvent); | - |
4232 | } | 0 |
4233 | | - |
4234 | bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEvent *touchEvent) | - |
4235 | { | - |
4236 | QGraphicsScene * const q = q_func(); | - |
4237 | | - |
4238 | if (cachedItemsUnderMouse.isEmpty() || cachedItemsUnderMouse.first() != origin) { never evaluated: cachedItemsUnderMouse.isEmpty() never evaluated: cachedItemsUnderMouse.first() != origin | 0 |
4239 | const QTouchEvent::TouchPoint &firstTouchPoint = touchEvent->touchPoints().first(); | - |
4240 | cachedItemsUnderMouse = itemsAtPosition(firstTouchPoint.screenPos().toPoint(), | - |
4241 | firstTouchPoint.scenePos(), | - |
4242 | static_cast<QWidget *>(touchEvent->target())); | - |
4243 | } | 0 |
4244 | | - |
4245 | | - |
4246 | bool setFocus = false; | - |
4247 | | - |
4248 | for (QForeachContainer<__typeof__(cachedItemsUnderMouse)> _container_(cachedItemsUnderMouse); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
4249 | if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable) && item->d_ptr->mouseSetsFocus)) { never evaluated: item->isEnabled() never evaluated: (item->flags() & QGraphicsItem::ItemIsFocusable) never evaluated: item->d_ptr->mouseSetsFocus | 0 |
4250 | if (!item->isWidget() || ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus) { never evaluated: !item->isWidget() never evaluated: ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus | 0 |
4251 | setFocus = true; | - |
4252 | if (item != q->focusItem()) never evaluated: item != q->focusItem() | 0 |
4253 | q->setFocusItem(item, Qt::MouseFocusReason); never executed: q->setFocusItem(item, Qt::MouseFocusReason); | 0 |
4254 | break; | 0 |
4255 | } | - |
4256 | } | 0 |
4257 | if (item->isPanel()) never evaluated: item->isPanel() | 0 |
4258 | break; | 0 |
4259 | if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation) never evaluated: item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation | 0 |
4260 | break; | 0 |
4261 | if (item->d_ptr->flags & QGraphicsItem::ItemStopsFocusHandling) { never evaluated: item->d_ptr->flags & QGraphicsItem::ItemStopsFocusHandling | 0 |
4262 | | - |
4263 | setFocus = true; | - |
4264 | break; | 0 |
4265 | } | - |
4266 | } | 0 |
4267 | | - |
4268 | | - |
4269 | if (!stickyFocus && !setFocus) never evaluated: !stickyFocus never evaluated: !setFocus | 0 |
4270 | q->setFocusItem(0, Qt::MouseFocusReason); never executed: q->setFocusItem(0, Qt::MouseFocusReason); | 0 |
4271 | | - |
4272 | bool res = false; | - |
4273 | bool eventAccepted = touchEvent->isAccepted(); | - |
4274 | for (QForeachContainer<__typeof__(cachedItemsUnderMouse)> _container_(cachedItemsUnderMouse); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
4275 | | - |
4276 | updateTouchPointsForItem(item, touchEvent); | - |
4277 | bool acceptTouchEvents = item->acceptTouchEvents(); | - |
4278 | touchEvent->setAccepted(acceptTouchEvents); | - |
4279 | res = acceptTouchEvents && sendEvent(item, touchEvent); never evaluated: acceptTouchEvents never evaluated: sendEvent(item, touchEvent) | 0 |
4280 | eventAccepted = touchEvent->isAccepted(); | - |
4281 | if (itemForTouchPointId.value(touchEvent->touchPoints().first().id()) == 0) { never evaluated: itemForTouchPointId.value(touchEvent->touchPoints().first().id()) == 0 | 0 |
4282 | | - |
4283 | item = 0; | - |
4284 | } else { | 0 |
4285 | item->d_ptr->acceptedTouchBeginEvent = (res && eventAccepted); never evaluated: eventAccepted | 0 |
4286 | } | 0 |
4287 | touchEvent->spont = false; | - |
4288 | if (res && eventAccepted) { never evaluated: eventAccepted | 0 |
4289 | | - |
4290 | for (int i = 0; i < touchEvent->touchPoints().count(); ++i) { never evaluated: i < touchEvent->touchPoints().count() | 0 |
4291 | const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().at(i); | - |
4292 | itemForTouchPointId[touchPoint.id()] = item; | - |
4293 | } | 0 |
4294 | break; | 0 |
4295 | } | - |
4296 | if (item && item->isPanel()) never evaluated: item->isPanel() | 0 |
4297 | break; | 0 |
4298 | } | 0 |
4299 | | - |
4300 | touchEvent->setAccepted(eventAccepted); | - |
4301 | return res; never executed: return res; | 0 |
4302 | } | - |
4303 | | - |
4304 | void QGraphicsScenePrivate::enableTouchEventsOnViews() | - |
4305 | { | - |
4306 | for (QForeachContainer<__typeof__(views)> _container_(views); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
4307 | view->viewport()->setAttribute(Qt::WA_AcceptTouchEvents, true); never executed: view->viewport()->setAttribute(Qt::WA_AcceptTouchEvents, true); | 0 |
4308 | } | 0 |
4309 | | - |
4310 | void QGraphicsScenePrivate::updateInputMethodSensitivityInViews() | - |
4311 | { | - |
4312 | for (int i = 0; i < views.size(); ++i) evaluated: i < views.size() yes Evaluation Count:1389 | yes Evaluation Count:1764 |
| 1389-1764 |
4313 | views.at(i)->d_func()->updateInputMethodSensitivity(); executed: views.at(i)->d_func()->updateInputMethodSensitivity(); Execution Count:1389 | 1389 |
4314 | } executed: } Execution Count:1764 | 1764 |
4315 | | - |
4316 | void QGraphicsScenePrivate::enterModal(QGraphicsItem *panel, QGraphicsItem::PanelModality previousModality) | - |
4317 | { | - |
4318 | QGraphicsScene * const q = q_func(); | - |
4319 | qt_noop(); | - |
4320 | | - |
4321 | QGraphicsItem::PanelModality panelModality = panel->d_ptr->panelModality; | - |
4322 | if (previousModality != QGraphicsItem::NonModal) { evaluated: previousModality != QGraphicsItem::NonModal yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
4323 | | - |
4324 | | - |
4325 | panel->d_ptr->panelModality = previousModality; | - |
4326 | } executed: } Execution Count:1 | 1 |
4327 | | - |
4328 | QSet<QGraphicsItem *> blockedPanels; | - |
4329 | QList<QGraphicsItem *> items = q->items(); | - |
4330 | for (int i = 0; i < items.count(); ++i) { evaluated: i < items.count() yes Evaluation Count:10 | yes Evaluation Count:3 |
| 3-10 |
4331 | QGraphicsItem *item = items.at(i); | - |
4332 | if (item->isPanel() && item->isBlockedByModalPanel()) evaluated: item->isPanel() yes Evaluation Count:3 | yes Evaluation Count:7 |
partially evaluated: item->isBlockedByModalPanel() no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-7 |
4333 | blockedPanels.insert(item); never executed: blockedPanels.insert(item); | 0 |
4334 | } executed: } Execution Count:10 | 10 |
4335 | | - |
4336 | | - |
4337 | if (previousModality != QGraphicsItem::NonModal) { evaluated: previousModality != QGraphicsItem::NonModal yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
4338 | | - |
4339 | panel->d_ptr->panelModality = panelModality; | - |
4340 | | - |
4341 | modalPanels.removeAll(panel); | - |
4342 | } executed: } Execution Count:1 | 1 |
4343 | | - |
4344 | modalPanels.prepend(panel); | - |
4345 | | - |
4346 | if (!hoverItems.isEmpty()) { partially evaluated: !hoverItems.isEmpty() no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
4347 | | - |
4348 | QGraphicsSceneHoverEvent hoverEvent; | - |
4349 | hoverEvent.setScenePos(lastSceneMousePos); | - |
4350 | dispatchHoverEvent(&hoverEvent); | - |
4351 | } | 0 |
4352 | | - |
4353 | if (!mouseGrabberItems.isEmpty() && lastMouseGrabberItemHasImplicitMouseGrab) { partially evaluated: !mouseGrabberItems.isEmpty() no Evaluation Count:0 | yes Evaluation Count:3 |
never evaluated: lastMouseGrabberItemHasImplicitMouseGrab | 0-3 |
4354 | QGraphicsItem *item = mouseGrabberItems.last(); | - |
4355 | if (item->isBlockedByModalPanel()) never evaluated: item->isBlockedByModalPanel() | 0 |
4356 | ungrabMouse(item, false); never executed: ungrabMouse(item, false); | 0 |
4357 | } | 0 |
4358 | | - |
4359 | QEvent windowBlockedEvent(QEvent::WindowBlocked); | - |
4360 | QEvent windowUnblockedEvent(QEvent::WindowUnblocked); | - |
4361 | for (int i = 0; i < items.count(); ++i) { evaluated: i < items.count() yes Evaluation Count:10 | yes Evaluation Count:3 |
| 3-10 |
4362 | QGraphicsItem *item = items.at(i); | - |
4363 | if (item->isPanel()) { evaluated: item->isPanel() yes Evaluation Count:3 | yes Evaluation Count:7 |
| 3-7 |
4364 | if (!blockedPanels.contains(item) && item->isBlockedByModalPanel()) { partially evaluated: !blockedPanels.contains(item) yes Evaluation Count:3 | no Evaluation Count:0 |
partially evaluated: item->isBlockedByModalPanel() no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
4365 | | - |
4366 | sendEvent(item, &windowBlockedEvent); | - |
4367 | } else if (blockedPanels.contains(item) && !item->isBlockedByModalPanel()) { partially evaluated: blockedPanels.contains(item) no Evaluation Count:0 | yes Evaluation Count:3 |
never evaluated: !item->isBlockedByModalPanel() | 0-3 |
4368 | | - |
4369 | | - |
4370 | sendEvent(item, &windowUnblockedEvent); | - |
4371 | } | 0 |
4372 | } | - |
4373 | } executed: } Execution Count:10 | 10 |
4374 | } executed: } Execution Count:3 | 3 |
4375 | | - |
4376 | void QGraphicsScenePrivate::leaveModal(QGraphicsItem *panel) | - |
4377 | { | - |
4378 | QGraphicsScene * const q = q_func(); | - |
4379 | qt_noop(); | - |
4380 | | - |
4381 | QSet<QGraphicsItem *> blockedPanels; | - |
4382 | QList<QGraphicsItem *> items = q->items(); | - |
4383 | for (int i = 0; i < items.count(); ++i) { partially evaluated: i < items.count() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
4384 | QGraphicsItem *item = items.at(i); | - |
4385 | if (item->isPanel() && item->isBlockedByModalPanel()) never evaluated: item->isPanel() never evaluated: item->isBlockedByModalPanel() | 0 |
4386 | blockedPanels.insert(item); never executed: blockedPanels.insert(item); | 0 |
4387 | } | 0 |
4388 | | - |
4389 | modalPanels.removeAll(panel); | - |
4390 | | - |
4391 | QEvent e(QEvent::WindowUnblocked); | - |
4392 | for (int i = 0; i < items.count(); ++i) { partially evaluated: i < items.count() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
4393 | QGraphicsItem *item = items.at(i); | - |
4394 | if (item->isPanel() && blockedPanels.contains(item) && !item->isBlockedByModalPanel()) never evaluated: item->isPanel() never evaluated: blockedPanels.contains(item) never evaluated: !item->isBlockedByModalPanel() | 0 |
4395 | sendEvent(item, &e); never executed: sendEvent(item, &e); | 0 |
4396 | } | 0 |
4397 | | - |
4398 | | - |
4399 | QGraphicsSceneHoverEvent hoverEvent; | - |
4400 | hoverEvent.setScenePos(lastSceneMousePos); | - |
4401 | dispatchHoverEvent(&hoverEvent); | - |
4402 | } executed: } Execution Count:2 | 2 |
4403 | | - |
4404 | | - |
4405 | void QGraphicsScenePrivate::gestureTargetsAtHotSpots(const QSet<QGesture *> &gestures, | - |
4406 | Qt::GestureFlag flag, | - |
4407 | QHash<QGraphicsObject *, QSet<QGesture *> > *targets, | - |
4408 | QSet<QGraphicsObject *> *itemsSet, | - |
4409 | QSet<QGesture *> *normal, | - |
4410 | QSet<QGesture *> *conflicts) | - |
4411 | { | - |
4412 | QSet<QGesture *> normalGestures; | - |
4413 | for (QForeachContainer<__typeof__(gestures)> _container_(gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
4414 | if (!gesture->hasHotSpot()) partially evaluated: !gesture->hasHotSpot() no Evaluation Count:0 | yes Evaluation Count:67 |
| 0-67 |
4415 | continue; never executed: continue; | 0 |
4416 | const Qt::GestureType gestureType = gesture->gestureType(); | - |
4417 | QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), gesture->d_func()->sceneHotSpot, 0); | - |
4418 | for (int j = 0; j < items.size(); ++j) { evaluated: j < items.size() yes Evaluation Count:142 | yes Evaluation Count:63 |
| 63-142 |
4419 | QGraphicsItem *item = items.at(j); | - |
4420 | | - |
4421 | | - |
4422 | | - |
4423 | (void) item->isBlockedByModalPanel(&item); | - |
4424 | | - |
4425 | if (QGraphicsObject *itemobj = item->toGraphicsObject()) { partially evaluated: QGraphicsObject *itemobj = item->toGraphicsObject() yes Evaluation Count:142 | no Evaluation Count:0 |
| 0-142 |
4426 | QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); | - |
4427 | QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it = | - |
4428 | d->gestureContext.constFind(gestureType); | - |
4429 | if (it != d->gestureContext.constEnd() && (!flag || (it.value() & flag))) { evaluated: it != d->gestureContext.constEnd() yes Evaluation Count:117 | yes Evaluation Count:25 |
evaluated: !flag yes Evaluation Count:67 | yes Evaluation Count:50 |
evaluated: (it.value() & flag) yes Evaluation Count:8 | yes Evaluation Count:42 |
| 8-117 |
4430 | if (normalGestures.contains(gesture)) { evaluated: normalGestures.contains(gesture) yes Evaluation Count:26 | yes Evaluation Count:49 |
| 26-49 |
4431 | normalGestures.remove(gesture); | - |
4432 | if (conflicts) evaluated: conflicts yes Evaluation Count:24 | yes Evaluation Count:2 |
| 2-24 |
4433 | conflicts->insert(gesture); executed: conflicts->insert(gesture); Execution Count:24 | 24 |
4434 | } else { executed: } Execution Count:26 | 26 |
4435 | normalGestures.insert(gesture); | - |
4436 | } executed: } Execution Count:49 | 49 |
4437 | if (targets) partially evaluated: targets yes Evaluation Count:75 | no Evaluation Count:0 |
| 0-75 |
4438 | (*targets)[itemobj].insert(gesture); executed: (*targets)[itemobj].insert(gesture); Execution Count:75 | 75 |
4439 | if (itemsSet) evaluated: itemsSet yes Evaluation Count:8 | yes Evaluation Count:67 |
| 8-67 |
4440 | (*itemsSet).insert(itemobj); executed: (*itemsSet).insert(itemobj); Execution Count:8 | 8 |
4441 | } executed: } Execution Count:75 | 75 |
4442 | } executed: } Execution Count:142 | 142 |
4443 | | - |
4444 | if (item->isPanel()) evaluated: item->isPanel() yes Evaluation Count:4 | yes Evaluation Count:138 |
| 4-138 |
4445 | break; executed: break; Execution Count:4 | 4 |
4446 | } executed: } Execution Count:138 | 138 |
4447 | } executed: } Execution Count:67 | 67 |
4448 | if (normal) evaluated: normal yes Evaluation Count:39 | yes Evaluation Count:30 |
| 30-39 |
4449 | *normal = normalGestures; executed: *normal = normalGestures; Execution Count:39 | 39 |
4450 | } executed: } Execution Count:69 | 69 |
4451 | | - |
4452 | void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) | - |
4453 | { | - |
4454 | QWidget *viewport = event->widget(); | - |
4455 | if (!viewport) partially evaluated: !viewport no Evaluation Count:0 | yes Evaluation Count:144 |
| 0-144 |
4456 | return; | 0 |
4457 | QGraphicsView *graphicsView = qobject_cast<QGraphicsView *>(viewport->parent()); | - |
4458 | if (!graphicsView) partially evaluated: !graphicsView no Evaluation Count:0 | yes Evaluation Count:144 |
| 0-144 |
4459 | return; | 0 |
4460 | | - |
4461 | QList<QGesture *> allGestures = event->gestures(); | - |
4462 | if (0) QMessageLogger("graphicsview/qgraphicsscene.cpp", 6056, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:144 |
| 0-144 |
4463 | << "Gestures:" << allGestures; never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6056, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "Gestures:" << allGestures; | 0 |
4464 | | - |
4465 | QSet<QGesture *> startedGestures; | - |
4466 | QPoint delta = viewport->mapFromGlobal(QPoint()); | - |
4467 | QTransform toScene = QTransform::fromTranslate(delta.x(), delta.y()) | - |
4468 | * graphicsView->viewportTransform().inverted(); | - |
4469 | for (QForeachContainer<__typeof__(allGestures)> _container_(allGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
4470 | | - |
4471 | if (gesture->hasHotSpot()) { partially evaluated: gesture->hasHotSpot() yes Evaluation Count:146 | no Evaluation Count:0 |
| 0-146 |
4472 | gesture->d_func()->sceneHotSpot = toScene.map(gesture->hotSpot()); | - |
4473 | } else { executed: } Execution Count:146 | 146 |
4474 | gesture->d_func()->sceneHotSpot = QPointF(); | - |
4475 | } | 0 |
4476 | | - |
4477 | QGraphicsObject *target = gestureTargets.value(gesture, 0); | - |
4478 | if (!target) { evaluated: !target yes Evaluation Count:44 | yes Evaluation Count:102 |
| 44-102 |
4479 | | - |
4480 | | - |
4481 | if (gesture->state() == Qt::GestureStarted) evaluated: gesture->state() == Qt::GestureStarted yes Evaluation Count:40 | yes Evaluation Count:4 |
| 4-40 |
4482 | startedGestures.insert(gesture); executed: startedGestures.insert(gesture); Execution Count:40 | 40 |
4483 | } executed: } Execution Count:44 | 44 |
4484 | } executed: } Execution Count:146 | 146 |
4485 | | - |
4486 | if (!startedGestures.isEmpty()) { evaluated: !startedGestures.isEmpty() yes Evaluation Count:39 | yes Evaluation Count:105 |
| 39-105 |
4487 | QSet<QGesture *> normalGestures; | - |
4488 | QSet<QGesture *> conflictedGestures; | - |
4489 | gestureTargetsAtHotSpots(startedGestures, Qt::GestureFlag(0), &cachedItemGestures, 0, | - |
4490 | &normalGestures, &conflictedGestures); | - |
4491 | cachedTargetItems = cachedItemGestures.keys(); | - |
4492 | std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); | - |
4493 | if (0) QMessageLogger("graphicsview/qgraphicsscene.cpp", 6087, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:39 |
| 0-39 |
4494 | << "Normal gestures:" << normalGestures | 0 |
4495 | << "Conflicting gestures:" << conflictedGestures; never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6087, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "Normal gestures:" << normalGestures << "Conflicting gestures:" << conflictedGestures; | 0 |
4496 | | - |
4497 | | - |
4498 | | - |
4499 | if (!conflictedGestures.isEmpty()) { evaluated: !conflictedGestures.isEmpty() yes Evaluation Count:22 | yes Evaluation Count:17 |
| 17-22 |
4500 | for (int i = 0; i < cachedTargetItems.size(); ++i) { evaluated: i < cachedTargetItems.size() yes Evaluation Count:48 | yes Evaluation Count:20 |
| 20-48 |
4501 | QPointer<QGraphicsObject> item = cachedTargetItems.at(i); | - |
4502 | | - |
4503 | | - |
4504 | QSet<QGesture *> gestures = conflictedGestures & cachedItemGestures.value(item.data()); | - |
4505 | if (gestures.isEmpty()) partially evaluated: gestures.isEmpty() no Evaluation Count:0 | yes Evaluation Count:48 |
| 0-48 |
4506 | continue; never executed: continue; | 0 |
4507 | | - |
4508 | if (0) QMessageLogger("graphicsview/qgraphicsscene.cpp", 6102, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:48 |
| 0-48 |
4509 | << "delivering override to" | 0 |
4510 | << item.data() << gestures; never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6102, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering override to" << item.data() << gestures; | 0 |
4511 | | - |
4512 | QGestureEvent ev(gestures.toList()); | - |
4513 | ev.t = QEvent::GestureOverride; | - |
4514 | ev.setWidget(event->widget()); | - |
4515 | | - |
4516 | ev.ignore(); | - |
4517 | for (QForeachContainer<__typeof__(gestures)> _container_(gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
4518 | ev.setAccepted(g, false); executed: ev.setAccepted(g, false); Execution Count:48 | 48 |
4519 | sendEvent(item.data(), &ev); | - |
4520 | | - |
4521 | for (QForeachContainer<__typeof__(gestures)> _container_(gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
4522 | if (ev.isAccepted() || ev.isAccepted(g)) { evaluated: ev.isAccepted() yes Evaluation Count:2 | yes Evaluation Count:46 |
partially evaluated: ev.isAccepted(g) no Evaluation Count:0 | yes Evaluation Count:46 |
| 0-46 |
4523 | conflictedGestures.remove(g); | - |
4524 | | - |
4525 | if (item) { partially evaluated: item yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
4526 | gestureTargets.insert(g, item.data()); | - |
4527 | QHash<QGraphicsObject *, QSet<QGesture *> >::iterator it, e; | - |
4528 | it = cachedItemGestures.begin(); | - |
4529 | e = cachedItemGestures.end(); | - |
4530 | for(; it != e; ++it) evaluated: it != e yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-4 |
4531 | it.value().remove(g); executed: it.value().remove(g); Execution Count:4 | 4 |
4532 | cachedItemGestures[item.data()].insert(g); | - |
4533 | } executed: } Execution Count:2 | 2 |
4534 | if (0) QMessageLogger("graphicsview/qgraphicsscene.cpp", 6128, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
4535 | << "override was accepted:" | 0 |
4536 | << g << item.data(); never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6128, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "override was accepted:" << g << item.data(); | 0 |
4537 | } executed: } Execution Count:2 | 2 |
4538 | | - |
4539 | | - |
4540 | | - |
4541 | if (!gestureTargets.contains(g) && item) evaluated: !gestureTargets.contains(g) yes Evaluation Count:21 | yes Evaluation Count:27 |
partially evaluated: item yes Evaluation Count:21 | no Evaluation Count:0 |
| 0-27 |
4542 | gestureTargets.insert(g, item.data()); executed: gestureTargets.insert(g, item.data()); Execution Count:21 | 21 |
4543 | | - |
4544 | } executed: } Execution Count:48 | 48 |
4545 | if (conflictedGestures.isEmpty()) evaluated: conflictedGestures.isEmpty() yes Evaluation Count:2 | yes Evaluation Count:46 |
| 2-46 |
4546 | break; executed: break; Execution Count:2 | 2 |
4547 | } executed: } Execution Count:46 | 46 |
4548 | } executed: } Execution Count:22 | 22 |
4549 | | - |
4550 | | - |
4551 | if (!normalGestures.isEmpty()) { evaluated: !normalGestures.isEmpty() yes Evaluation Count:18 | yes Evaluation Count:21 |
| 18-21 |
4552 | for (int i = 0; i < cachedTargetItems.size() && !normalGestures.isEmpty(); ++i) { evaluated: i < cachedTargetItems.size() yes Evaluation Count:21 | yes Evaluation Count:18 |
partially evaluated: !normalGestures.isEmpty() yes Evaluation Count:21 | no Evaluation Count:0 |
| 0-21 |
4553 | QGraphicsObject *item = cachedTargetItems.at(i); | - |
4554 | | - |
4555 | | - |
4556 | for (QForeachContainer<__typeof__(cachedItemGestures.value(item))> _container_(cachedItemGestures.value(item)); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
4557 | if (!gestureTargets.contains(g)) { evaluated: !gestureTargets.contains(g) yes Evaluation Count:18 | yes Evaluation Count:3 |
| 3-18 |
4558 | gestureTargets.insert(g, item); | - |
4559 | normalGestures.remove(g); | - |
4560 | } executed: } Execution Count:18 | 18 |
4561 | } executed: } Execution Count:21 | 21 |
4562 | } executed: } Execution Count:21 | 21 |
4563 | } executed: } Execution Count:18 | 18 |
4564 | } executed: } Execution Count:39 | 39 |
4565 | | - |
4566 | | - |
4567 | | - |
4568 | QSet<QGesture *> undeliveredGestures; | - |
4569 | QSet<QGesture *> parentPropagatedGestures; | - |
4570 | for (QForeachContainer<__typeof__(allGestures)> _container_(allGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
4571 | if (QGraphicsObject *target = gestureTargets.value(gesture, 0)) { evaluated: QGraphicsObject *target = gestureTargets.value(gesture, 0) yes Evaluation Count:142 | yes Evaluation Count:4 |
| 4-142 |
4572 | cachedItemGestures[target].insert(gesture); | - |
4573 | cachedTargetItems.append(target); | - |
4574 | undeliveredGestures.insert(gesture); | - |
4575 | QGraphicsItemPrivate *d = target->QGraphicsItem::d_func(); | - |
4576 | const Qt::GestureFlags flags = d->gestureContext.value(gesture->gestureType()); | - |
4577 | if (flags & Qt::IgnoredGesturesPropagateToParent) evaluated: flags & Qt::IgnoredGesturesPropagateToParent yes Evaluation Count:4 | yes Evaluation Count:138 |
| 4-138 |
4578 | parentPropagatedGestures.insert(gesture); executed: parentPropagatedGestures.insert(gesture); Execution Count:4 | 4 |
4579 | } else { executed: } Execution Count:142 | 142 |
4580 | if (0) QMessageLogger("graphicsview/qgraphicsscene.cpp", 6174, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
4581 | << "no target for" << gesture << "at" | 0 |
4582 | << gesture->hotSpot() << gesture->d_func()->sceneHotSpot; never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6174, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "no target for" << gesture << "at" << gesture->hotSpot() << gesture->d_func()->sceneHotSpot; | 0 |
4583 | } executed: } Execution Count:4 | 4 |
4584 | } | - |
4585 | std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); | - |
4586 | for (int i = 0; i < cachedTargetItems.size(); ++i) { evaluated: i < cachedTargetItems.size() yes Evaluation Count:189 | yes Evaluation Count:32 |
| 32-189 |
4587 | QPointer<QGraphicsObject> receiver = cachedTargetItems.at(i); | - |
4588 | QSet<QGesture *> gestures = | - |
4589 | undeliveredGestures & cachedItemGestures.value(receiver.data()); | - |
4590 | gestures -= cachedAlreadyDeliveredGestures.value(receiver.data()); | - |
4591 | | - |
4592 | if (gestures.isEmpty()) evaluated: gestures.isEmpty() yes Evaluation Count:32 | yes Evaluation Count:157 |
| 32-157 |
4593 | continue; executed: continue; Execution Count:32 | 32 |
4594 | | - |
4595 | cachedAlreadyDeliveredGestures[receiver.data()] += gestures; | - |
4596 | const bool isPanel = receiver.data()->isPanel(); | - |
4597 | | - |
4598 | if (0) QMessageLogger("graphicsview/qgraphicsscene.cpp", 6192, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:157 |
| 0-157 |
4599 | << "delivering to" | 0 |
4600 | << receiver.data() << gestures; never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6192, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering to" << receiver.data() << gestures; | 0 |
4601 | QGestureEvent ev(gestures.toList()); | - |
4602 | ev.setWidget(event->widget()); | - |
4603 | sendEvent(receiver.data(), &ev); | - |
4604 | QSet<QGesture *> ignoredGestures; | - |
4605 | for (QForeachContainer<__typeof__(gestures)> _container_(gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
4606 | if (!ev.isAccepted() && !ev.isAccepted(g)) { evaluated: !ev.isAccepted() yes Evaluation Count:43 | yes Evaluation Count:114 |
partially evaluated: !ev.isAccepted(g) yes Evaluation Count:43 | no Evaluation Count:0 |
| 0-114 |
4607 | | - |
4608 | | - |
4609 | | - |
4610 | | - |
4611 | | - |
4612 | if (receiver && receiver.data() == gestureTargets.value(g, 0)) evaluated: receiver yes Evaluation Count:42 | yes Evaluation Count:1 |
evaluated: receiver.data() == gestureTargets.value(g, 0) yes Evaluation Count:30 | yes Evaluation Count:12 |
| 1-42 |
4613 | ignoredGestures.insert(g); executed: ignoredGestures.insert(g); Execution Count:30 | 30 |
4614 | } else { executed: } Execution Count:43 | 43 |
4615 | if (receiver && g->state() == Qt::GestureStarted) { evaluated: receiver yes Evaluation Count:113 | yes Evaluation Count:1 |
evaluated: g->state() == Qt::GestureStarted yes Evaluation Count:35 | yes Evaluation Count:78 |
| 1-113 |
4616 | | - |
4617 | | - |
4618 | gestureTargets[g] = receiver.data(); | - |
4619 | } executed: } Execution Count:35 | 35 |
4620 | undeliveredGestures.remove(g); | - |
4621 | } executed: } Execution Count:114 | 114 |
4622 | } | - |
4623 | if (undeliveredGestures.isEmpty()) evaluated: undeliveredGestures.isEmpty() yes Evaluation Count:112 | yes Evaluation Count:45 |
| 45-112 |
4624 | break; executed: break; Execution Count:112 | 112 |
4625 | | - |
4626 | | - |
4627 | | - |
4628 | if (!ignoredGestures.isEmpty() && !isPanel) { evaluated: !ignoredGestures.isEmpty() yes Evaluation Count:30 | yes Evaluation Count:15 |
partially evaluated: !isPanel yes Evaluation Count:30 | no Evaluation Count:0 |
| 0-30 |
4629 | | - |
4630 | | - |
4631 | | - |
4632 | QSet<QGraphicsObject *> targetsSet = cachedTargetItems.toSet(); | - |
4633 | | - |
4634 | if (receiver) { partially evaluated: receiver yes Evaluation Count:30 | no Evaluation Count:0 |
| 0-30 |
4635 | | - |
4636 | for (QSet<QGesture *>::iterator it = ignoredGestures.begin(); | - |
4637 | it != ignoredGestures.end();) { evaluated: it != ignoredGestures.end() yes Evaluation Count:30 | yes Evaluation Count:30 |
| 30 |
4638 | if (parentPropagatedGestures.contains(*it)) { evaluated: parentPropagatedGestures.contains(*it) yes Evaluation Count:3 | yes Evaluation Count:27 |
| 3-27 |
4639 | QGesture *gesture = *it; | - |
4640 | const Qt::GestureType gestureType = gesture->gestureType(); | - |
4641 | QGraphicsItem *item = receiver.data(); | - |
4642 | while (item) { evaluated: item yes Evaluation Count:9 | yes Evaluation Count:3 |
| 3-9 |
4643 | if (QGraphicsObject *obj = item->toGraphicsObject()) { partially evaluated: QGraphicsObject *obj = item->toGraphicsObject() yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
4644 | if (item->d_func()->gestureContext.contains(gestureType)) { partially evaluated: item->d_func()->gestureContext.contains(gestureType) yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
4645 | targetsSet.insert(obj); | - |
4646 | cachedItemGestures[obj].insert(gesture); | - |
4647 | } executed: } Execution Count:9 | 9 |
4648 | } executed: } Execution Count:9 | 9 |
4649 | if (item->isPanel()) partially evaluated: item->isPanel() no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
4650 | break; | 0 |
4651 | item = item->parentItem(); | - |
4652 | } executed: } Execution Count:9 | 9 |
4653 | | - |
4654 | it = ignoredGestures.erase(it); | - |
4655 | continue; executed: continue; Execution Count:3 | 3 |
4656 | } | - |
4657 | ++it; | - |
4658 | } executed: } Execution Count:27 | 27 |
4659 | } executed: } Execution Count:30 | 30 |
4660 | | - |
4661 | gestureTargetsAtHotSpots(ignoredGestures, Qt::ReceivePartialGestures, | - |
4662 | &cachedItemGestures, &targetsSet, 0, 0); | - |
4663 | | - |
4664 | cachedTargetItems = targetsSet.toList(); | - |
4665 | std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); | - |
4666 | if (0) QMessageLogger("graphicsview/qgraphicsscene.cpp", 6260, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:30 |
| 0-30 |
4667 | << "new targets:" << cachedTargetItems; never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6260, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "new targets:" << cachedTargetItems; | 0 |
4668 | i = -1; | - |
4669 | continue; executed: continue; Execution Count:30 | 30 |
4670 | } | - |
4671 | } executed: } Execution Count:15 | 15 |
4672 | | - |
4673 | for (QForeachContainer<__typeof__(startedGestures)> _container_(startedGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
4674 | if (g->gestureCancelPolicy() == QGesture::CancelAllInContext) { evaluated: g->gestureCancelPolicy() == QGesture::CancelAllInContext yes Evaluation Count:2 | yes Evaluation Count:38 |
| 2-38 |
4675 | if (0) QMessageLogger("graphicsview/qgraphicsscene.cpp", 6269, __PRETTY_FUNCTION__).debug() << "lets try to cancel some"; partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:2 |
never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6269, __PRETTY_FUNCTION__).debug() << "lets try to cancel some"; | 0-2 |
4676 | | - |
4677 | cancelGesturesForChildren(g); | - |
4678 | } executed: } Execution Count:2 | 2 |
4679 | } executed: } Execution Count:40 | 40 |
4680 | | - |
4681 | | - |
4682 | for (QForeachContainer<__typeof__(allGestures)> _container_(allGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
4683 | switch (g->state()) { | - |
4684 | case Qt::GestureFinished: | - |
4685 | case Qt::GestureCanceled: | - |
4686 | gestureTargets.remove(g); | - |
4687 | break; executed: break; Execution Count:38 | 38 |
4688 | default: | - |
4689 | break; executed: break; Execution Count:108 | 108 |
4690 | } | - |
4691 | } executed: } Execution Count:146 | 146 |
4692 | | - |
4693 | cachedTargetItems.clear(); | - |
4694 | cachedItemGestures.clear(); | - |
4695 | cachedAlreadyDeliveredGestures.clear(); | - |
4696 | } executed: } Execution Count:144 | 144 |
4697 | | - |
4698 | void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original) | - |
4699 | { | - |
4700 | qt_noop(); | - |
4701 | QGraphicsItem *originalItem = gestureTargets.value(original); | - |
4702 | if (originalItem == 0) partially evaluated: originalItem == 0 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
4703 | return; | 0 |
4704 | | - |
4705 | | - |
4706 | | - |
4707 | | - |
4708 | QSet<QGesture *> canceledGestures; | - |
4709 | QHash<QGesture *, QGraphicsObject *>::Iterator iter = gestureTargets.begin(); | - |
4710 | while (iter != gestureTargets.end()) { evaluated: iter != gestureTargets.end() yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-4 |
4711 | QGraphicsObject *item = iter.value(); | - |
4712 | | - |
4713 | if (item != originalItem && originalItem->isAncestorOf(item)) { evaluated: item != originalItem yes Evaluation Count:2 | yes Evaluation Count:2 |
partially evaluated: originalItem->isAncestorOf(item) yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
4714 | if (0) QMessageLogger("graphicsview/qgraphicsscene.cpp", 6308, __PRETTY_FUNCTION__).debug() << " found a gesture to cancel" << iter.key(); partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:2 |
never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6308, __PRETTY_FUNCTION__).debug() << " found a gesture to cancel" << iter.key(); | 0-2 |
4715 | iter.key()->d_func()->state = Qt::GestureCanceled; | - |
4716 | canceledGestures << iter.key(); | - |
4717 | } executed: } Execution Count:2 | 2 |
4718 | ++iter; | - |
4719 | } executed: } Execution Count:4 | 4 |
4720 | | - |
4721 | | - |
4722 | QSet<QGesture *> almostCanceledGestures = canceledGestures; | - |
4723 | QSet<QGesture *>::Iterator setIter; | - |
4724 | while (!almostCanceledGestures.isEmpty()) { evaluated: !almostCanceledGestures.isEmpty() yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
4725 | QGraphicsObject *target = 0; | - |
4726 | QSet<QGesture*> gestures; | - |
4727 | setIter = almostCanceledGestures.begin(); | - |
4728 | | - |
4729 | while (setIter != almostCanceledGestures.end()) { evaluated: setIter != almostCanceledGestures.end() yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
4730 | QGraphicsObject *item = gestureTargets.value(*setIter); | - |
4731 | if (target == 0) partially evaluated: target == 0 yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
4732 | target = item; executed: target = item; Execution Count:2 | 2 |
4733 | if (target == item) { partially evaluated: target == item yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
4734 | gestures << *setIter; | - |
4735 | setIter = almostCanceledGestures.erase(setIter); | - |
4736 | } else { executed: } Execution Count:2 | 2 |
4737 | ++setIter; | - |
4738 | } | 0 |
4739 | } | - |
4740 | qt_noop(); | - |
4741 | | - |
4742 | QList<QGesture *> list = gestures.toList(); | - |
4743 | QGestureEvent ev(list); | - |
4744 | sendEvent(target, &ev); | - |
4745 | | - |
4746 | for (QForeachContainer<__typeof__(list)> _container_(list); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
4747 | if (ev.isAccepted() || ev.isAccepted(g)) partially evaluated: ev.isAccepted() yes Evaluation Count:2 | no Evaluation Count:0 |
never evaluated: ev.isAccepted(g) | 0-2 |
4748 | gestures.remove(g); executed: gestures.remove(g); Execution Count:2 | 2 |
4749 | } executed: } Execution Count:2 | 2 |
4750 | | - |
4751 | for (QForeachContainer<__typeof__(gestures)> _container_(gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
4752 | if (!g->hasHotSpot()) never evaluated: !g->hasHotSpot() | 0 |
4753 | continue; never executed: continue; | 0 |
4754 | | - |
4755 | QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), g->d_func()->sceneHotSpot, 0); | - |
4756 | for (int j = 0; j < items.size(); ++j) { never evaluated: j < items.size() | 0 |
4757 | QGraphicsObject *item = items.at(j)->toGraphicsObject(); | - |
4758 | if (!item) | 0 |
4759 | continue; never executed: continue; | 0 |
4760 | QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); | - |
4761 | if (d->gestureContext.contains(g->gestureType())) { never evaluated: d->gestureContext.contains(g->gestureType()) | 0 |
4762 | QList<QGesture *> list; | - |
4763 | list << g; | - |
4764 | QGestureEvent ev(list); | - |
4765 | sendEvent(item, &ev); | - |
4766 | if (ev.isAccepted() || ev.isAccepted(g)) never evaluated: ev.isAccepted() never evaluated: ev.isAccepted(g) | 0 |
4767 | break; | 0 |
4768 | } | 0 |
4769 | } | 0 |
4770 | } | 0 |
4771 | } executed: } Execution Count:2 | 2 |
4772 | | - |
4773 | QGestureManager *gestureManager = QApplicationPrivate::instance()->gestureManager; | - |
4774 | qt_noop(); | - |
4775 | for (setIter = canceledGestures.begin(); setIter != canceledGestures.end(); ++setIter) { evaluated: setIter != canceledGestures.end() yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
4776 | gestureManager->recycle(*setIter); | - |
4777 | gestureTargets.remove(*setIter); | - |
4778 | } executed: } Execution Count:2 | 2 |
4779 | } executed: } Execution Count:2 | 2 |
4780 | | - |
4781 | void QGraphicsScenePrivate::grabGesture(QGraphicsItem *, Qt::GestureType gesture) | - |
4782 | { | - |
4783 | (void)QGestureManager::instance(); | - |
4784 | if (!grabbedGestures[gesture]++) { evaluated: !grabbedGestures[gesture]++ yes Evaluation Count:26 | yes Evaluation Count:26 |
| 26 |
4785 | for (QForeachContainer<__typeof__(views)> _container_(views); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
4786 | view->viewport()->grabGesture(gesture); executed: view->viewport()->grabGesture(gesture); Execution Count:26 | 26 |
4787 | } executed: } Execution Count:26 | 26 |
4788 | } executed: } Execution Count:52 | 52 |
4789 | | - |
4790 | void QGraphicsScenePrivate::ungrabGesture(QGraphicsItem *item, Qt::GestureType gesture) | - |
4791 | { | - |
4792 | | - |
4793 | qt_noop(); | - |
4794 | QGraphicsObject *obj = static_cast<QGraphicsObject *>(item); | - |
4795 | QGestureManager::instance()->cleanupCachedGestures(obj, gesture); | - |
4796 | if (!--grabbedGestures[gesture]) { evaluated: !--grabbedGestures[gesture] yes Evaluation Count:24 | yes Evaluation Count:26 |
| 24-26 |
4797 | for (QForeachContainer<__typeof__(views)> _container_(views); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
4798 | view->viewport()->ungrabGesture(gesture); executed: view->viewport()->ungrabGesture(gesture); Execution Count:1 | 1 |
4799 | } executed: } Execution Count:24 | 24 |
4800 | } executed: } Execution Count:50 | 50 |
4801 | | - |
4802 | | - |
4803 | | - |
4804 | | - |
4805 | | - |
| | |