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