qgraphicsscene.cpp

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

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9