| Line | Source Code | Coverage |
|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
| 4 | ** Contact: http://www.qt-project.org/legal | - |
| 5 | ** | - |
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - |
| 7 | ** | - |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
| 9 | ** Commercial License Usage | - |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
| 11 | ** accordance with the commercial license agreement provided with the | - |
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - |
| 13 | ** a written agreement between you and Digia. For licensing terms and | - |
| 14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
| 15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
| 16 | ** | - |
| 17 | ** GNU Lesser General Public License Usage | - |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
| 19 | ** General Public License version 2.1 as published by the Free Software | - |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
| 21 | ** packaging of this file. Please review the following information to | - |
| 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
| 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
| 24 | ** | - |
| 25 | ** In addition, as a special exception, Digia gives you certain additional | - |
| 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
| 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
| 28 | ** | - |
| 29 | ** GNU General Public License Usage | - |
| 30 | ** Alternatively, this file may be used under the terms of the GNU | - |
| 31 | ** General Public License version 3.0 as published by the Free Software | - |
| 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
| 33 | ** packaging of this file. Please review the following information to | - |
| 34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
| 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
| 36 | ** | - |
| 37 | ** | - |
| 38 | ** $QT_END_LICENSE$ | - |
| 39 | ** | - |
| 40 | ****************************************************************************/ | - |
| 41 | | - |
| 42 | /*! | - |
| 43 | \class QGraphicsScene | - |
| 44 | \brief The QGraphicsScene class provides a surface for managing a large | - |
| 45 | number of 2D graphical items. | - |
| 46 | \since 4.2 | - |
| 47 | \ingroup graphicsview-api | - |
| 48 | \inmodule QtWidgets | - |
| 49 | | - |
| 50 | The class serves as a container for QGraphicsItems. It is used together | - |
| 51 | with QGraphicsView for visualizing graphical items, such as lines, | - |
| 52 | rectangles, text, or even custom items, on a 2D surface. QGraphicsScene is | - |
| 53 | part of the \l{Graphics View Framework}. | - |
| 54 | | - |
| 55 | QGraphicsScene also provides functionality that lets you efficiently | - |
| 56 | determine both the location of items, and for determining what items are | - |
| 57 | visible within an arbitrary area on the scene. With the QGraphicsView | - |
| 58 | widget, you can either visualize the whole scene, or zoom in and view only | - |
| 59 | parts of the scene. | - |
| 60 | | - |
| 61 | Example: | - |
| 62 | | - |
| 63 | \snippet code/src_gui_graphicsview_qgraphicsscene.cpp 0 | - |
| 64 | | - |
| 65 | Note that QGraphicsScene has no visual appearance of its own; it only | - |
| 66 | manages the items. You need to create a QGraphicsView widget to visualize | - |
| 67 | the scene. | - |
| 68 | | - |
| 69 | To add items to a scene, you start off by constructing a QGraphicsScene | - |
| 70 | object. Then, you have two options: either add your existing QGraphicsItem | - |
| 71 | objects by calling addItem(), or you can call one of the convenience | - |
| 72 | functions addEllipse(), addLine(), addPath(), addPixmap(), addPolygon(), | - |
| 73 | addRect(), or addText(), which all return a pointer to the newly added item. | - |
| 74 | The dimensions of the items added with these functions are relative to the | - |
| 75 | item's coordinate system, and the items position is initialized to (0, | - |
| 76 | 0) in the scene. | - |
| 77 | | - |
| 78 | You can then visualize the scene using QGraphicsView. When the scene | - |
| 79 | changes, (e.g., when an item moves or is transformed) QGraphicsScene | - |
| 80 | emits the changed() signal. To remove an item, call removeItem(). | - |
| 81 | | - |
| 82 | QGraphicsScene uses an indexing algorithm to manage the location of items | - |
| 83 | efficiently. By default, a BSP (Binary Space Partitioning) tree is used; an | - |
| 84 | algorithm suitable for large scenes where most items remain static (i.e., | - |
| 85 | do not move around). You can choose to disable this index by calling | - |
| 86 | setItemIndexMethod(). For more information about the available indexing | - |
| 87 | algorithms, see the itemIndexMethod property. | - |
| 88 | | - |
| 89 | The scene's bounding rect is set by calling setSceneRect(). Items can be | - |
| 90 | placed at any position on the scene, and the size of the scene is by | - |
| 91 | default unlimited. The scene rect is used only for internal bookkeeping, | - |
| 92 | maintaining the scene's item index. If the scene rect is unset, | - |
| 93 | QGraphicsScene will use the bounding area of all items, as returned by | - |
| 94 | itemsBoundingRect(), as the scene rect. However, itemsBoundingRect() is a | - |
| 95 | relatively time consuming function, as it operates by collecting | - |
| 96 | positional information for every item on the scene. Because of this, you | - |
| 97 | should always set the scene rect when operating on large scenes. | - |
| 98 | | - |
| 99 | One of QGraphicsScene's greatest strengths is its ability to efficiently | - |
| 100 | determine the location of items. Even with millions of items on the scene, | - |
| 101 | the items() functions can determine the location of an item within a few | - |
| 102 | milliseconds. There are several overloads to items(): one that finds items | - |
| 103 | at a certain position, one that finds items inside or intersecting with a | - |
| 104 | polygon or a rectangle, and more. The list of returned items is sorted by | - |
| 105 | stacking order, with the topmost item being the first item in the list. | - |
| 106 | For convenience, there is also an itemAt() function that returns the | - |
| 107 | topmost item at a given position. | - |
| 108 | | - |
| 109 | QGraphicsScene maintains selection information for the scene. To select | - |
| 110 | items, call setSelectionArea(), and to clear the current selection, call | - |
| 111 | clearSelection(). Call selectedItems() to get the list of all selected | - |
| 112 | items. | - |
| 113 | | - |
| 114 | \section1 Event Handling and Propagation | - |
| 115 | | - |
| 116 | Another responsibility that QGraphicsScene has, is to propagate events | - |
| 117 | from QGraphicsView. To send an event to a scene, you construct an event | - |
| 118 | that inherits QEvent, and then send it using, for example, | - |
| 119 | QApplication::sendEvent(). event() is responsible for dispatching | - |
| 120 | the event to the individual items. Some common events are handled by | - |
| 121 | convenience event handlers. For example, key press events are handled by | - |
| 122 | keyPressEvent(), and mouse press events are handled by mousePressEvent(). | - |
| 123 | | - |
| 124 | Key events are delivered to the \e {focus item}. To set the focus item, | - |
| 125 | you can either call setFocusItem(), passing an item that accepts focus, or | - |
| 126 | the item itself can call QGraphicsItem::setFocus(). Call focusItem() to | - |
| 127 | get the current focus item. For compatibility with widgets, the scene also | - |
| 128 | maintains its own focus information. By default, the scene does not have | - |
| 129 | focus, and all key events are discarded. If setFocus() is called, or if an | - |
| 130 | item on the scene gains focus, the scene automatically gains focus. If the | - |
| 131 | scene has focus, hasFocus() will return true, and key events will be | - |
| 132 | forwarded to the focus item, if any. If the scene loses focus, (i.e., | - |
| 133 | someone calls clearFocus()) while an item has focus, the scene will | - |
| 134 | maintain its item focus information, and once the scene regains focus, it | - |
| 135 | will make sure the last focus item regains focus. | - |
| 136 | | - |
| 137 | For mouse-over effects, QGraphicsScene dispatches \e {hover | - |
| 138 | events}. If an item accepts hover events (see | - |
| 139 | QGraphicsItem::acceptHoverEvents()), it will receive a \l | - |
| 140 | {QEvent::}{GraphicsSceneHoverEnter} event when the mouse enters | - |
| 141 | its area. As the mouse continues moving inside the item's area, | - |
| 142 | QGraphicsScene will send it \l {QEvent::}{GraphicsSceneHoverMove} | - |
| 143 | events. When the mouse leaves the item's area, the item will | - |
| 144 | receive a \l {QEvent::}{GraphicsSceneHoverLeave} event. | - |
| 145 | | - |
| 146 | All mouse events are delivered to the current \e {mouse grabber} | - |
| 147 | item. An item becomes the scene's mouse grabber if it accepts | - |
| 148 | mouse events (see QGraphicsItem::acceptedMouseButtons()) and it | - |
| 149 | receives a mouse press. It stays the mouse grabber until it | - |
| 150 | receives a mouse release when no other mouse buttons are | - |
| 151 | pressed. You can call mouseGrabberItem() to determine what item is | - |
| 152 | currently grabbing the mouse. | - |
| 153 | | - |
| 154 | \sa QGraphicsItem, QGraphicsView | - |
| 155 | */ | - |
| 156 | | - |
| 157 | /*! | - |
| 158 | \enum QGraphicsScene::SceneLayer | - |
| 159 | \since 4.3 | - |
| 160 | | - |
| 161 | This enum describes the rendering layers in a QGraphicsScene. When | - |
| 162 | QGraphicsScene draws the scene contents, it renders each of these layers | - |
| 163 | separately, in order. | - |
| 164 | | - |
| 165 | Each layer represents a flag that can be OR'ed together when calling | - |
| 166 | functions such as invalidate() or QGraphicsView::invalidateScene(). | - |
| 167 | | - |
| 168 | \value ItemLayer The item layer. QGraphicsScene renders all items are in | - |
| 169 | this layer by calling the virtual function drawItems(). The item layer is | - |
| 170 | drawn after the background layer, but before the foreground layer. | - |
| 171 | | - |
| 172 | \value BackgroundLayer The background layer. QGraphicsScene renders the | - |
| 173 | scene's background in this layer by calling the virtual function | - |
| 174 | drawBackground(). The background layer is drawn first of all layers. | - |
| 175 | | - |
| 176 | \value ForegroundLayer The foreground layer. QGraphicsScene renders the | - |
| 177 | scene's foreground in this layer by calling the virtual function | - |
| 178 | drawForeground(). The foreground layer is drawn last of all layers. | - |
| 179 | | - |
| 180 | \value AllLayers All layers; this value represents a combination of all | - |
| 181 | three layers. | - |
| 182 | | - |
| 183 | \sa invalidate(), QGraphicsView::invalidateScene() | - |
| 184 | */ | - |
| 185 | | - |
| 186 | /*! | - |
| 187 | \enum QGraphicsScene::ItemIndexMethod | - |
| 188 | | - |
| 189 | This enum describes the indexing algorithms QGraphicsScene provides for | - |
| 190 | managing positional information about items on the scene. | - |
| 191 | | - |
| 192 | \value BspTreeIndex A Binary Space Partitioning tree is applied. All | - |
| 193 | QGraphicsScene's item location algorithms are of an order close to | - |
| 194 | logarithmic complexity, by making use of binary search. Adding, moving and | - |
| 195 | removing items is logarithmic. This approach is best for static scenes | - |
| 196 | (i.e., scenes where most items do not move). | - |
| 197 | | - |
| 198 | \value NoIndex No index is applied. Item location is of linear complexity, | - |
| 199 | as all items on the scene are searched. Adding, moving and removing items, | - |
| 200 | however, is done in constant time. This approach is ideal for dynamic | - |
| 201 | scenes, where many items are added, moved or removed continuously. | - |
| 202 | | - |
| 203 | \sa setItemIndexMethod(), bspTreeDepth | - |
| 204 | */ | - |
| 205 | | - |
| 206 | #include "qgraphicsscene.h" | - |
| 207 | | - |
| 208 | #ifndef QT_NO_GRAPHICSVIEW | - |
| 209 | | - |
| 210 | #include "qgraphicsitem.h" | - |
| 211 | #include "qgraphicsitem_p.h" | - |
| 212 | #include "qgraphicslayout.h" | - |
| 213 | #include "qgraphicsscene_p.h" | - |
| 214 | #include "qgraphicssceneevent.h" | - |
| 215 | #include "qgraphicsview.h" | - |
| 216 | #include "qgraphicsview_p.h" | - |
| 217 | #include "qgraphicswidget.h" | - |
| 218 | #include "qgraphicswidget_p.h" | - |
| 219 | #include "qgraphicssceneindex_p.h" | - |
| 220 | #include "qgraphicsscenebsptreeindex_p.h" | - |
| 221 | #include "qgraphicsscenelinearindex_p.h" | - |
| 222 | | - |
| 223 | #include <QtCore/qdebug.h> | - |
| 224 | #include <QtCore/qlist.h> | - |
| 225 | #include <QtCore/qmath.h> | - |
| 226 | #include <QtCore/qrect.h> | - |
| 227 | #include <QtCore/qset.h> | - |
| 228 | #include <QtCore/qstack.h> | - |
| 229 | #include <QtCore/qtimer.h> | - |
| 230 | #include <QtCore/qvarlengtharray.h> | - |
| 231 | #include <QtCore/QMetaMethod> | - |
| 232 | #include <QtWidgets/qapplication.h> | - |
| 233 | #include <QtWidgets/qdesktopwidget.h> | - |
| 234 | #include <QtGui/qevent.h> | - |
| 235 | #include <QtWidgets/qgraphicslayout.h> | - |
| 236 | #include <QtWidgets/qgraphicsproxywidget.h> | - |
| 237 | #include <QtWidgets/qgraphicswidget.h> | - |
| 238 | #include <QtGui/qmatrix.h> | - |
| 239 | #include <QtGui/qpaintengine.h> | - |
| 240 | #include <QtGui/qpainter.h> | - |
| 241 | #include <QtGui/qpixmapcache.h> | - |
| 242 | #include <QtGui/qpolygon.h> | - |
| 243 | #include <QtWidgets/qstyleoption.h> | - |
| 244 | #include <QtWidgets/qtooltip.h> | - |
| 245 | #include <QtGui/qtransform.h> | - |
| 246 | #include <QtGui/qinputmethod.h> | - |
| 247 | #include <QtWidgets/qgraphicseffect.h> | - |
| 248 | #include <private/qapplication_p.h> | - |
| 249 | #include <private/qobject_p.h> | - |
| 250 | #include <private/qgraphicseffect_p.h> | - |
| 251 | #include <private/qgesturemanager_p.h> | - |
| 252 | #include <private/qpathclipper_p.h> | - |
| 253 | | - |
| 254 | // #define GESTURE_DEBUG | - |
| 255 | #ifndef GESTURE_DEBUG | - |
| 256 | # define DEBUG if (0) qDebug | - |
| 257 | #else | - |
| 258 | # define DEBUG qDebug | - |
| 259 | #endif | - |
| 260 | | - |
| 261 | QT_BEGIN_NAMESPACE | - |
| 262 | | - |
| 263 | bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); | - |
| 264 | | - |
| 265 | static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraphicsSceneMouseEvent *mouseEvent) | - |
| 266 | { | - |
| 267 | hover->setWidget(mouseEvent->widget()); executed (the execution status of this line is deduced): hover->setWidget(mouseEvent->widget()); | - |
| 268 | hover->setPos(mouseEvent->pos()); executed (the execution status of this line is deduced): hover->setPos(mouseEvent->pos()); | - |
| 269 | hover->setScenePos(mouseEvent->scenePos()); executed (the execution status of this line is deduced): hover->setScenePos(mouseEvent->scenePos()); | - |
| 270 | hover->setScreenPos(mouseEvent->screenPos()); executed (the execution status of this line is deduced): hover->setScreenPos(mouseEvent->screenPos()); | - |
| 271 | hover->setLastPos(mouseEvent->lastPos()); executed (the execution status of this line is deduced): hover->setLastPos(mouseEvent->lastPos()); | - |
| 272 | hover->setLastScenePos(mouseEvent->lastScenePos()); executed (the execution status of this line is deduced): hover->setLastScenePos(mouseEvent->lastScenePos()); | - |
| 273 | hover->setLastScreenPos(mouseEvent->lastScreenPos()); executed (the execution status of this line is deduced): hover->setLastScreenPos(mouseEvent->lastScreenPos()); | - |
| 274 | hover->setModifiers(mouseEvent->modifiers()); executed (the execution status of this line is deduced): hover->setModifiers(mouseEvent->modifiers()); | - |
| 275 | hover->setAccepted(mouseEvent->isAccepted()); executed (the execution status of this line is deduced): hover->setAccepted(mouseEvent->isAccepted()); | - |
| 276 | } executed: }Execution Count:261 | 261 |
| 277 | | - |
| 278 | /*! | - |
| 279 | \internal | - |
| 280 | */ | - |
| 281 | QGraphicsScenePrivate::QGraphicsScenePrivate() | - |
| 282 | : indexMethod(QGraphicsScene::BspTreeIndex), | - |
| 283 | index(0), | - |
| 284 | lastItemCount(0), | - |
| 285 | hasSceneRect(false), | - |
| 286 | dirtyGrowingItemsBoundingRect(true), | - |
| 287 | updateAll(false), | - |
| 288 | calledEmitUpdated(false), | - |
| 289 | processDirtyItemsEmitted(false), | - |
| 290 | needSortTopLevelItems(true), | - |
| 291 | holesInTopLevelSiblingIndex(false), | - |
| 292 | topLevelSequentialOrdering(true), | - |
| 293 | scenePosDescendantsUpdatePending(false), | - |
| 294 | stickyFocus(false), | - |
| 295 | hasFocus(false), | - |
| 296 | lastMouseGrabberItemHasImplicitMouseGrab(false), | - |
| 297 | allItemsIgnoreHoverEvents(true), | - |
| 298 | allItemsUseDefaultCursor(true), | - |
| 299 | painterStateProtection(true), | - |
| 300 | sortCacheEnabled(false), | - |
| 301 | allItemsIgnoreTouchEvents(true), | - |
| 302 | selectionChanging(0), | - |
| 303 | rectAdjust(2), | - |
| 304 | focusItem(0), | - |
| 305 | lastFocusItem(0), | - |
| 306 | passiveFocusItem(0), | - |
| 307 | tabFocusFirst(0), | - |
| 308 | activePanel(0), | - |
| 309 | lastActivePanel(0), | - |
| 310 | activationRefCount(0), | - |
| 311 | childExplicitActivation(0), | - |
| 312 | lastMouseGrabberItem(0), | - |
| 313 | dragDropItem(0), | - |
| 314 | enterWidget(0), | - |
| 315 | lastDropAction(Qt::IgnoreAction), | - |
| 316 | style(0) | - |
| 317 | { | - |
| 318 | } executed: }Execution Count:798 | 798 |
| 319 | | - |
| 320 | /*! | - |
| 321 | \internal | - |
| 322 | */ | - |
| 323 | void QGraphicsScenePrivate::init() | - |
| 324 | { | - |
| 325 | Q_Q(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScene * const q = q_func(); | - |
| 326 | | - |
| 327 | index = new QGraphicsSceneBspTreeIndex(q); executed (the execution status of this line is deduced): index = new QGraphicsSceneBspTreeIndex(q); | - |
| 328 | | - |
| 329 | // Keep this index so we can check for connected slots later on. | - |
| 330 | changedSignalIndex = signalIndex("changed(QList<QRectF>)"); executed (the execution status of this line is deduced): changedSignalIndex = signalIndex("changed(QList<QRectF>)"); | - |
| 331 | processDirtyItemsIndex = q->metaObject()->indexOfSlot("_q_processDirtyItems()"); executed (the execution status of this line is deduced): processDirtyItemsIndex = q->metaObject()->indexOfSlot("_q_processDirtyItems()"); | - |
| 332 | polishItemsIndex = q->metaObject()->indexOfSlot("_q_polishItems()"); executed (the execution status of this line is deduced): polishItemsIndex = q->metaObject()->indexOfSlot("_q_polishItems()"); | - |
| 333 | | - |
| 334 | qApp->d_func()->scene_list.append(q); executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->scene_list.append(q); | - |
| 335 | q->update(); executed (the execution status of this line is deduced): q->update(); | - |
| 336 | } executed: }Execution Count:798 | 798 |
| 337 | | - |
| 338 | /*! | - |
| 339 | \internal | - |
| 340 | */ | - |
| 341 | QGraphicsScenePrivate *QGraphicsScenePrivate::get(QGraphicsScene *q) | - |
| 342 | { | - |
| 343 | return q->d_func(); never executed: return q->d_func(); | 0 |
| 344 | } | - |
| 345 | | - |
| 346 | void QGraphicsScenePrivate::_q_emitUpdated() | - |
| 347 | { | - |
| 348 | Q_Q(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScene * const q = q_func(); | - |
| 349 | calledEmitUpdated = false; executed (the execution status of this line is deduced): calledEmitUpdated = false; | - |
| 350 | | - |
| 351 | if (dirtyGrowingItemsBoundingRect) { evaluated: dirtyGrowingItemsBoundingRect| yes Evaluation Count:164 | yes Evaluation Count:612 |
| 164-612 |
| 352 | if (!hasSceneRect) { evaluated: !hasSceneRect| yes Evaluation Count:111 | yes Evaluation Count:53 |
| 53-111 |
| 353 | const QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect; executed (the execution status of this line is deduced): const QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect; | - |
| 354 | growingItemsBoundingRect |= q->itemsBoundingRect(); executed (the execution status of this line is deduced): growingItemsBoundingRect |= q->itemsBoundingRect(); | - |
| 355 | if (oldGrowingItemsBoundingRect != growingItemsBoundingRect) evaluated: oldGrowingItemsBoundingRect != growingItemsBoundingRect| yes Evaluation Count:110 | yes Evaluation Count:1 |
| 1-110 |
| 356 | emit q->sceneRectChanged(growingItemsBoundingRect); executed: q->sceneRectChanged(growingItemsBoundingRect);Execution Count:110 | 110 |
| 357 | } executed: }Execution Count:111 | 111 |
| 358 | dirtyGrowingItemsBoundingRect = false; executed (the execution status of this line is deduced): dirtyGrowingItemsBoundingRect = false; | - |
| 359 | } executed: }Execution Count:164 | 164 |
| 360 | | - |
| 361 | // Ensure all views are connected if anything is connected. This disables | - |
| 362 | // the optimization that items send updates directly to the views, but it | - |
| 363 | // needs to happen in order to keep compatibility with the behavior from | - |
| 364 | // Qt 4.4 and backward. | - |
| 365 | if (isSignalConnected(changedSignalIndex)) { evaluated: isSignalConnected(changedSignalIndex)| yes Evaluation Count:22 | yes Evaluation Count:754 |
| 22-754 |
| 366 | for (int i = 0; i < views.size(); ++i) { evaluated: i < views.size()| yes Evaluation Count:22 | yes Evaluation Count:22 |
| 22 |
| 367 | QGraphicsView *view = views.at(i); executed (the execution status of this line is deduced): QGraphicsView *view = views.at(i); | - |
| 368 | if (!view->d_func()->connectedToScene) { evaluated: !view->d_func()->connectedToScene| yes Evaluation Count:10 | yes Evaluation Count:12 |
| 10-12 |
| 369 | view->d_func()->connectedToScene = true; executed (the execution status of this line is deduced): view->d_func()->connectedToScene = true; | - |
| 370 | q->connect(q, SIGNAL(changed(QList<QRectF>)), executed (the execution status of this line is deduced): q->connect(q, "2""changed(QList<QRectF>)", | - |
| 371 | views.at(i), SLOT(updateScene(QList<QRectF>))); executed (the execution status of this line is deduced): views.at(i), "1""updateScene(QList<QRectF>)"); | - |
| 372 | } executed: }Execution Count:10 | 10 |
| 373 | } executed: }Execution Count:22 | 22 |
| 374 | } else { executed: }Execution Count:22 | 22 |
| 375 | if (views.isEmpty()) { evaluated: views.isEmpty()| yes Evaluation Count:15 | yes Evaluation Count:739 |
| 15-739 |
| 376 | updateAll = false; executed (the execution status of this line is deduced): updateAll = false; | - |
| 377 | return; executed: return;Execution Count:15 | 15 |
| 378 | } | - |
| 379 | for (int i = 0; i < views.size(); ++i) evaluated: i < views.size()| yes Evaluation Count:739 | yes Evaluation Count:739 |
| 739 |
| 380 | views.at(i)->d_func()->processPendingUpdates(); executed: views.at(i)->d_func()->processPendingUpdates();Execution Count:739 | 739 |
| 381 | // It's important that we update all views before we dispatch, hence two for-loops. | - |
| 382 | for (int i = 0; i < views.size(); ++i) evaluated: i < views.size()| yes Evaluation Count:739 | yes Evaluation Count:739 |
| 739 |
| 383 | views.at(i)->d_func()->dispatchPendingUpdateRequests(); executed: views.at(i)->d_func()->dispatchPendingUpdateRequests();Execution Count:739 | 739 |
| 384 | return; executed: return;Execution Count:739 | 739 |
| 385 | } | - |
| 386 | | - |
| 387 | // Notify the changes to anybody interested. | - |
| 388 | QList<QRectF> oldUpdatedRects; executed (the execution status of this line is deduced): QList<QRectF> oldUpdatedRects; | - |
| 389 | oldUpdatedRects = updateAll ? (QList<QRectF>() << q->sceneRect()) : updatedRects; evaluated: updateAll| yes Evaluation Count:12 | yes Evaluation Count:10 |
| 10-12 |
| 390 | updateAll = false; executed (the execution status of this line is deduced): updateAll = false; | - |
| 391 | updatedRects.clear(); executed (the execution status of this line is deduced): updatedRects.clear(); | - |
| 392 | emit q->changed(oldUpdatedRects); executed (the execution status of this line is deduced): q->changed(oldUpdatedRects); | - |
| 393 | } executed: }Execution Count:22 | 22 |
| 394 | | - |
| 395 | /*! | - |
| 396 | \internal | - |
| 397 | | - |
| 398 | ### This function is almost identical to QGraphicsItemPrivate::addChild(). | - |
| 399 | */ | - |
| 400 | void QGraphicsScenePrivate::registerTopLevelItem(QGraphicsItem *item) | - |
| 401 | { | - |
| 402 | item->d_ptr->ensureSequentialSiblingIndex(); executed (the execution status of this line is deduced): item->d_ptr->ensureSequentialSiblingIndex(); | - |
| 403 | needSortTopLevelItems = true; // ### maybe false executed (the execution status of this line is deduced): needSortTopLevelItems = true; | - |
| 404 | item->d_ptr->siblingIndex = topLevelItems.size(); executed (the execution status of this line is deduced): item->d_ptr->siblingIndex = topLevelItems.size(); | - |
| 405 | topLevelItems.append(item); executed (the execution status of this line is deduced): topLevelItems.append(item); | - |
| 406 | } executed: }Execution Count:973 | 973 |
| 407 | | - |
| 408 | /*! | - |
| 409 | \internal | - |
| 410 | | - |
| 411 | ### This function is almost identical to QGraphicsItemPrivate::removeChild(). | - |
| 412 | */ | - |
| 413 | void QGraphicsScenePrivate::unregisterTopLevelItem(QGraphicsItem *item) | - |
| 414 | { | - |
| 415 | if (!holesInTopLevelSiblingIndex) evaluated: !holesInTopLevelSiblingIndex| yes Evaluation Count:748 | yes Evaluation Count:205 |
| 205-748 |
| 416 | holesInTopLevelSiblingIndex = item->d_ptr->siblingIndex != topLevelItems.size() - 1; executed: holesInTopLevelSiblingIndex = item->d_ptr->siblingIndex != topLevelItems.size() - 1;Execution Count:748 | 748 |
| 417 | if (topLevelSequentialOrdering && !holesInTopLevelSiblingIndex) evaluated: topLevelSequentialOrdering| yes Evaluation Count:748 | yes Evaluation Count:205 |
evaluated: !holesInTopLevelSiblingIndex| yes Evaluation Count:698 | yes Evaluation Count:50 |
| 50-748 |
| 418 | topLevelItems.removeAt(item->d_ptr->siblingIndex); executed: topLevelItems.removeAt(item->d_ptr->siblingIndex);Execution Count:698 | 698 |
| 419 | else | - |
| 420 | topLevelItems.removeOne(item); executed: topLevelItems.removeOne(item);Execution Count:255 | 255 |
| 421 | // NB! Do not use topLevelItems.removeAt(item->d_ptr->siblingIndex) because | - |
| 422 | // the item is not guaranteed to be at the index after the list is sorted | - |
| 423 | // (see ensureSortedTopLevelItems()). | - |
| 424 | item->d_ptr->siblingIndex = -1; executed (the execution status of this line is deduced): item->d_ptr->siblingIndex = -1; | - |
| 425 | if (topLevelSequentialOrdering) evaluated: topLevelSequentialOrdering| yes Evaluation Count:748 | yes Evaluation Count:205 |
| 205-748 |
| 426 | topLevelSequentialOrdering = !holesInTopLevelSiblingIndex; executed: topLevelSequentialOrdering = !holesInTopLevelSiblingIndex;Execution Count:748 | 748 |
| 427 | } executed: }Execution Count:953 | 953 |
| 428 | | - |
| 429 | /*! | - |
| 430 | \internal | - |
| 431 | */ | - |
| 432 | void QGraphicsScenePrivate::_q_polishItems() | - |
| 433 | { | - |
| 434 | if (unpolishedItems.isEmpty()) evaluated: unpolishedItems.isEmpty()| yes Evaluation Count:6 | yes Evaluation Count:290 |
| 6-290 |
| 435 | return; executed: return;Execution Count:6 | 6 |
| 436 | | - |
| 437 | const QVariant booleanTrueVariant(true); executed (the execution status of this line is deduced): const QVariant booleanTrueVariant(true); | - |
| 438 | QGraphicsItem *item = 0; executed (the execution status of this line is deduced): QGraphicsItem *item = 0; | - |
| 439 | QGraphicsItemPrivate *itemd = 0; executed (the execution status of this line is deduced): QGraphicsItemPrivate *itemd = 0; | - |
| 440 | const int oldUnpolishedCount = unpolishedItems.count(); executed (the execution status of this line is deduced): const int oldUnpolishedCount = unpolishedItems.count(); | - |
| 441 | | - |
| 442 | for (int i = 0; i < oldUnpolishedCount; ++i) { evaluated: i < oldUnpolishedCount| yes Evaluation Count:1075 | yes Evaluation Count:290 |
| 290-1075 |
| 443 | item = unpolishedItems.at(i); executed (the execution status of this line is deduced): item = unpolishedItems.at(i); | - |
| 444 | if (!item) evaluated: !item| yes Evaluation Count:4 | yes Evaluation Count:1071 |
| 4-1071 |
| 445 | continue; executed: continue;Execution Count:4 | 4 |
| 446 | itemd = item->d_ptr.data(); executed (the execution status of this line is deduced): itemd = item->d_ptr.data(); | - |
| 447 | itemd->pendingPolish = false; executed (the execution status of this line is deduced): itemd->pendingPolish = false; | - |
| 448 | if (!itemd->explicitlyHidden) { evaluated: !itemd->explicitlyHidden| yes Evaluation Count:1070 | yes Evaluation Count:1 |
| 1-1070 |
| 449 | item->itemChange(QGraphicsItem::ItemVisibleChange, booleanTrueVariant); executed (the execution status of this line is deduced): item->itemChange(QGraphicsItem::ItemVisibleChange, booleanTrueVariant); | - |
| 450 | item->itemChange(QGraphicsItem::ItemVisibleHasChanged, booleanTrueVariant); executed (the execution status of this line is deduced): item->itemChange(QGraphicsItem::ItemVisibleHasChanged, booleanTrueVariant); | - |
| 451 | } executed: }Execution Count:1070 | 1070 |
| 452 | if (itemd->isWidget) { evaluated: itemd->isWidget| yes Evaluation Count:746 | yes Evaluation Count:325 |
| 325-746 |
| 453 | QEvent event(QEvent::Polish); executed (the execution status of this line is deduced): QEvent event(QEvent::Polish); | - |
| 454 | QApplication::sendEvent((QGraphicsWidget *)item, &event); executed (the execution status of this line is deduced): QApplication::sendEvent((QGraphicsWidget *)item, &event); | - |
| 455 | } executed: }Execution Count:746 | 746 |
| 456 | } executed: }Execution Count:1071 | 1071 |
| 457 | | - |
| 458 | if (unpolishedItems.count() == oldUnpolishedCount) { partially evaluated: unpolishedItems.count() == oldUnpolishedCount| yes Evaluation Count:290 | no Evaluation Count:0 |
| 0-290 |
| 459 | // No new items were added to the vector. | - |
| 460 | unpolishedItems.clear(); executed (the execution status of this line is deduced): unpolishedItems.clear(); | - |
| 461 | } else { executed: }Execution Count:290 | 290 |
| 462 | // New items were appended; keep them and remove the old ones. | - |
| 463 | unpolishedItems.remove(0, oldUnpolishedCount); never executed (the execution status of this line is deduced): unpolishedItems.remove(0, oldUnpolishedCount); | - |
| 464 | unpolishedItems.squeeze(); never executed (the execution status of this line is deduced): unpolishedItems.squeeze(); | - |
| 465 | QMetaObject::invokeMethod(q_ptr, "_q_polishItems", Qt::QueuedConnection); never executed (the execution status of this line is deduced): QMetaObject::invokeMethod(q_ptr, "_q_polishItems", Qt::QueuedConnection); | - |
| 466 | } | 0 |
| 467 | } | - |
| 468 | | - |
| 469 | void QGraphicsScenePrivate::_q_processDirtyItems() | - |
| 470 | { | - |
| 471 | processDirtyItemsEmitted = false; executed (the execution status of this line is deduced): processDirtyItemsEmitted = false; | - |
| 472 | | - |
| 473 | if (updateAll) { evaluated: updateAll| yes Evaluation Count:2 | yes Evaluation Count:234 |
| 2-234 |
| 474 | Q_ASSERT(calledEmitUpdated); executed (the execution status of this line is deduced): qt_noop(); | - |
| 475 | // No need for further processing (except resetting the dirty states). | - |
| 476 | // The growingItemsBoundingRect is updated in _q_emitUpdated. | - |
| 477 | for (int i = 0; i < topLevelItems.size(); ++i) evaluated: i < topLevelItems.size()| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
| 478 | resetDirtyItem(topLevelItems.at(i), /*recursive=*/true); executed: resetDirtyItem(topLevelItems.at(i), true);Execution Count:2 | 2 |
| 479 | return; executed: return;Execution Count:2 | 2 |
| 480 | } | - |
| 481 | | - |
| 482 | const bool wasPendingSceneUpdate = calledEmitUpdated; executed (the execution status of this line is deduced): const bool wasPendingSceneUpdate = calledEmitUpdated; | - |
| 483 | const QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect; executed (the execution status of this line is deduced): const QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect; | - |
| 484 | | - |
| 485 | // Process items recursively. | - |
| 486 | for (int i = 0; i < topLevelItems.size(); ++i) evaluated: i < topLevelItems.size()| yes Evaluation Count:1011 | yes Evaluation Count:234 |
| 234-1011 |
| 487 | processDirtyItemsRecursive(topLevelItems.at(i)); executed: processDirtyItemsRecursive(topLevelItems.at(i));Execution Count:1011 | 1011 |
| 488 | | - |
| 489 | dirtyGrowingItemsBoundingRect = false; executed (the execution status of this line is deduced): dirtyGrowingItemsBoundingRect = false; | - |
| 490 | if (!hasSceneRect && oldGrowingItemsBoundingRect != growingItemsBoundingRect) evaluated: !hasSceneRect| yes Evaluation Count:209 | yes Evaluation Count:25 |
evaluated: oldGrowingItemsBoundingRect != growingItemsBoundingRect| yes Evaluation Count:23 | yes Evaluation Count:186 |
| 23-209 |
| 491 | emit q_func()->sceneRectChanged(growingItemsBoundingRect); executed: q_func()->sceneRectChanged(growingItemsBoundingRect);Execution Count:23 | 23 |
| 492 | | - |
| 493 | if (wasPendingSceneUpdate) evaluated: wasPendingSceneUpdate| yes Evaluation Count:5 | yes Evaluation Count:229 |
| 5-229 |
| 494 | return; executed: return;Execution Count:5 | 5 |
| 495 | | - |
| 496 | for (int i = 0; i < views.size(); ++i) evaluated: i < views.size()| yes Evaluation Count:226 | yes Evaluation Count:229 |
| 226-229 |
| 497 | views.at(i)->d_func()->processPendingUpdates(); executed: views.at(i)->d_func()->processPendingUpdates();Execution Count:226 | 226 |
| 498 | | - |
| 499 | if (calledEmitUpdated) { evaluated: calledEmitUpdated| yes Evaluation Count:7 | yes Evaluation Count:222 |
| 7-222 |
| 500 | // We did a compatibility QGraphicsScene::update in processDirtyItemsRecursive | - |
| 501 | // and we cannot wait for the control to reach the eventloop before the | - |
| 502 | // changed signal is emitted, so we emit it now. | - |
| 503 | _q_emitUpdated(); executed (the execution status of this line is deduced): _q_emitUpdated(); | - |
| 504 | } executed: }Execution Count:7 | 7 |
| 505 | | - |
| 506 | // Immediately dispatch all pending update requests on the views. | - |
| 507 | for (int i = 0; i < views.size(); ++i) evaluated: i < views.size()| yes Evaluation Count:226 | yes Evaluation Count:229 |
| 226-229 |
| 508 | views.at(i)->d_func()->dispatchPendingUpdateRequests(); executed: views.at(i)->d_func()->dispatchPendingUpdateRequests();Execution Count:226 | 226 |
| 509 | } executed: }Execution Count:229 | 229 |
| 510 | | - |
| 511 | /*! | - |
| 512 | \internal | - |
| 513 | */ | - |
| 514 | void QGraphicsScenePrivate::setScenePosItemEnabled(QGraphicsItem *item, bool enabled) | - |
| 515 | { | - |
| 516 | QGraphicsItem *p = item->d_ptr->parent; never executed (the execution status of this line is deduced): QGraphicsItem *p = item->d_ptr->parent; | - |
| 517 | while (p) { | 0 |
| 518 | p->d_ptr->scenePosDescendants = enabled; never executed (the execution status of this line is deduced): p->d_ptr->scenePosDescendants = enabled; | - |
| 519 | p = p->d_ptr->parent; never executed (the execution status of this line is deduced): p = p->d_ptr->parent; | - |
| 520 | } | 0 |
| 521 | if (!enabled && !scenePosDescendantsUpdatePending) { never evaluated: !enabled never evaluated: !scenePosDescendantsUpdatePending | 0 |
| 522 | scenePosDescendantsUpdatePending = true; never executed (the execution status of this line is deduced): scenePosDescendantsUpdatePending = true; | - |
| 523 | QMetaObject::invokeMethod(q_func(), "_q_updateScenePosDescendants", Qt::QueuedConnection); never executed (the execution status of this line is deduced): QMetaObject::invokeMethod(q_func(), "_q_updateScenePosDescendants", Qt::QueuedConnection); | - |
| 524 | } | 0 |
| 525 | } | 0 |
| 526 | | - |
| 527 | /*! | - |
| 528 | \internal | - |
| 529 | */ | - |
| 530 | void QGraphicsScenePrivate::registerScenePosItem(QGraphicsItem *item) | - |
| 531 | { | - |
| 532 | scenePosItems.insert(item); never executed (the execution status of this line is deduced): scenePosItems.insert(item); | - |
| 533 | setScenePosItemEnabled(item, true); never executed (the execution status of this line is deduced): setScenePosItemEnabled(item, true); | - |
| 534 | } | 0 |
| 535 | | - |
| 536 | /*! | - |
| 537 | \internal | - |
| 538 | */ | - |
| 539 | void QGraphicsScenePrivate::unregisterScenePosItem(QGraphicsItem *item) | - |
| 540 | { | - |
| 541 | scenePosItems.remove(item); never executed (the execution status of this line is deduced): scenePosItems.remove(item); | - |
| 542 | setScenePosItemEnabled(item, false); never executed (the execution status of this line is deduced): setScenePosItemEnabled(item, false); | - |
| 543 | } | 0 |
| 544 | | - |
| 545 | /*! | - |
| 546 | \internal | - |
| 547 | */ | - |
| 548 | void QGraphicsScenePrivate::_q_updateScenePosDescendants() | - |
| 549 | { | - |
| 550 | foreach (QGraphicsItem *item, scenePosItems) { never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(scenePosItems)> _container_(scenePosItems); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 551 | QGraphicsItem *p = item->d_ptr->parent; never executed (the execution status of this line is deduced): QGraphicsItem *p = item->d_ptr->parent; | - |
| 552 | while (p) { | 0 |
| 553 | p->d_ptr->scenePosDescendants = 1; never executed (the execution status of this line is deduced): p->d_ptr->scenePosDescendants = 1; | - |
| 554 | p = p->d_ptr->parent; never executed (the execution status of this line is deduced): p = p->d_ptr->parent; | - |
| 555 | } | 0 |
| 556 | } | 0 |
| 557 | scenePosDescendantsUpdatePending = false; never executed (the execution status of this line is deduced): scenePosDescendantsUpdatePending = false; | - |
| 558 | } | 0 |
| 559 | | - |
| 560 | /*! | - |
| 561 | \internal | - |
| 562 | | - |
| 563 | Schedules an item for removal. This function leaves some stale indexes | - |
| 564 | around in the BSP tree if called from the item's destructor; these will | - |
| 565 | be cleaned up the next time someone triggers purgeRemovedItems(). | - |
| 566 | | - |
| 567 | Note: This function might get called from QGraphicsItem's destructor. \a item is | - |
| 568 | being destroyed, so we cannot call any pure virtual functions on it (such | - |
| 569 | as boundingRect()). Also, it is unnecessary to update the item's own state | - |
| 570 | in any way. | - |
| 571 | */ | - |
| 572 | void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) | - |
| 573 | { | - |
| 574 | Q_Q(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScene * const q = q_func(); | - |
| 575 | | - |
| 576 | // Clear focus on the item to remove any reference in the focusWidget chain. | - |
| 577 | item->clearFocus(); executed (the execution status of this line is deduced): item->clearFocus(); | - |
| 578 | | - |
| 579 | markDirty(item, QRectF(), /*invalidateChildren=*/false, /*force=*/false, executed (the execution status of this line is deduced): markDirty(item, QRectF(), false, false, | - |
| 580 | /*ignoreOpacity=*/false, /*removingItemFromScene=*/true); executed (the execution status of this line is deduced): false, true); | - |
| 581 | | - |
| 582 | if (item->d_ptr->inDestructor) { evaluated: item->d_ptr->inDestructor| yes Evaluation Count:1686 | yes Evaluation Count:14 |
| 14-1686 |
| 583 | // The item is actually in its destructor, we call the special method in the index. | - |
| 584 | index->deleteItem(item); executed (the execution status of this line is deduced): index->deleteItem(item); | - |
| 585 | } else { executed: }Execution Count:1686 | 1686 |
| 586 | // Can potentially call item->boundingRect() (virtual function), that's why | - |
| 587 | // we only can call this function if the item is not in its destructor. | - |
| 588 | index->removeItem(item); executed (the execution status of this line is deduced): index->removeItem(item); | - |
| 589 | } executed: }Execution Count:14 | 14 |
| 590 | | - |
| 591 | item->d_ptr->clearSubFocus(); executed (the execution status of this line is deduced): item->d_ptr->clearSubFocus(); | - |
| 592 | | - |
| 593 | if (item->flags() & QGraphicsItem::ItemSendsScenePositionChanges) partially evaluated: item->flags() & QGraphicsItem::ItemSendsScenePositionChanges| no Evaluation Count:0 | yes Evaluation Count:1700 |
| 0-1700 |
| 594 | unregisterScenePosItem(item); never executed: unregisterScenePosItem(item); | 0 |
| 595 | | - |
| 596 | QGraphicsScene *oldScene = item->d_func()->scene; executed (the execution status of this line is deduced): QGraphicsScene *oldScene = item->d_func()->scene; | - |
| 597 | item->d_func()->scene = 0; executed (the execution status of this line is deduced): item->d_func()->scene = 0; | - |
| 598 | | - |
| 599 | //We need to remove all children first because they might use their parent | - |
| 600 | //attributes (e.g. sceneTransform). | - |
| 601 | if (!item->d_ptr->inDestructor) { evaluated: !item->d_ptr->inDestructor| yes Evaluation Count:14 | yes Evaluation Count:1686 |
| 14-1686 |
| 602 | // Remove all children recursively | - |
| 603 | for (int i = 0; i < item->d_ptr->children.size(); ++i) partially evaluated: i < item->d_ptr->children.size()| no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
| 604 | q->removeItem(item->d_ptr->children.at(i)); never executed: q->removeItem(item->d_ptr->children.at(i)); | 0 |
| 605 | } executed: }Execution Count:14 | 14 |
| 606 | | - |
| 607 | if (!item->d_ptr->inDestructor && item == tabFocusFirst) { evaluated: !item->d_ptr->inDestructor| yes Evaluation Count:14 | yes Evaluation Count:1686 |
partially evaluated: item == tabFocusFirst| no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-1686 |
| 608 | QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); never executed (the execution status of this line is deduced): QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); | - |
| 609 | widget->d_func()->fixFocusChainBeforeReparenting(0, oldScene, 0); never executed (the execution status of this line is deduced): widget->d_func()->fixFocusChainBeforeReparenting(0, oldScene, 0); | - |
| 610 | } | 0 |
| 611 | | - |
| 612 | // Unregister focus proxy. | - |
| 613 | item->d_ptr->resetFocusProxy(); executed (the execution status of this line is deduced): item->d_ptr->resetFocusProxy(); | - |
| 614 | | - |
| 615 | // Remove from parent, or unregister from toplevels. | - |
| 616 | if (QGraphicsItem *parentItem = item->parentItem()) { evaluated: QGraphicsItem *parentItem = item->parentItem()| yes Evaluation Count:759 | yes Evaluation Count:941 |
| 759-941 |
| 617 | if (parentItem->scene()) { evaluated: parentItem->scene()| yes Evaluation Count:752 | yes Evaluation Count:7 |
| 7-752 |
| 618 | Q_ASSERT_X(parentItem->scene() == q, "QGraphicsScene::removeItem", executed (the execution status of this line is deduced): qt_noop(); | - |
| 619 | "Parent item's scene is different from this item's scene"); | - |
| 620 | item->setParentItem(0); executed (the execution status of this line is deduced): item->setParentItem(0); | - |
| 621 | } executed: }Execution Count:752 | 752 |
| 622 | } else { executed: }Execution Count:759 | 759 |
| 623 | unregisterTopLevelItem(item); executed (the execution status of this line is deduced): unregisterTopLevelItem(item); | - |
| 624 | } executed: }Execution Count:941 | 941 |
| 625 | | - |
| 626 | // Reset the mouse grabber and focus item data. | - |
| 627 | if (item == focusItem) partially evaluated: item == focusItem| no Evaluation Count:0 | yes Evaluation Count:1700 |
| 0-1700 |
| 628 | focusItem = 0; never executed: focusItem = 0; | 0 |
| 629 | if (item == lastFocusItem) evaluated: item == lastFocusItem| yes Evaluation Count:6 | yes Evaluation Count:1694 |
| 6-1694 |
| 630 | lastFocusItem = 0; executed: lastFocusItem = 0;Execution Count:6 | 6 |
| 631 | if (item == passiveFocusItem) evaluated: item == passiveFocusItem| yes Evaluation Count:1 | yes Evaluation Count:1699 |
| 1-1699 |
| 632 | passiveFocusItem = 0; executed: passiveFocusItem = 0;Execution Count:1 | 1 |
| 633 | if (item == activePanel) { evaluated: item == activePanel| yes Evaluation Count:16 | yes Evaluation Count:1684 |
| 16-1684 |
| 634 | // ### deactivate... | - |
| 635 | activePanel = 0; executed (the execution status of this line is deduced): activePanel = 0; | - |
| 636 | } executed: }Execution Count:16 | 16 |
| 637 | if (item == lastActivePanel) evaluated: item == lastActivePanel| yes Evaluation Count:162 | yes Evaluation Count:1538 |
| 162-1538 |
| 638 | lastActivePanel = 0; executed: lastActivePanel = 0;Execution Count:162 | 162 |
| 639 | | - |
| 640 | // Cancel active touches | - |
| 641 | { | - |
| 642 | QMap<int, QGraphicsItem *>::iterator it = itemForTouchPointId.begin(); executed (the execution status of this line is deduced): QMap<int, QGraphicsItem *>::iterator it = itemForTouchPointId.begin(); | - |
| 643 | while (it != itemForTouchPointId.end()) { partially evaluated: it != itemForTouchPointId.end()| no Evaluation Count:0 | yes Evaluation Count:1700 |
| 0-1700 |
| 644 | if (it.value() == item) { never evaluated: it.value() == item | 0 |
| 645 | sceneCurrentTouchPoints.remove(it.key()); never executed (the execution status of this line is deduced): sceneCurrentTouchPoints.remove(it.key()); | - |
| 646 | it = itemForTouchPointId.erase(it); never executed (the execution status of this line is deduced): it = itemForTouchPointId.erase(it); | - |
| 647 | } else { | 0 |
| 648 | ++it; never executed (the execution status of this line is deduced): ++it; | - |
| 649 | } | 0 |
| 650 | } | - |
| 651 | } | - |
| 652 | | - |
| 653 | // Disable selectionChanged() for individual items | - |
| 654 | ++selectionChanging; executed (the execution status of this line is deduced): ++selectionChanging; | - |
| 655 | int oldSelectedItemsSize = selectedItems.size(); executed (the execution status of this line is deduced): int oldSelectedItemsSize = selectedItems.size(); | - |
| 656 | | - |
| 657 | // Update selected & hovered item bookkeeping | - |
| 658 | selectedItems.remove(item); executed (the execution status of this line is deduced): selectedItems.remove(item); | - |
| 659 | hoverItems.removeAll(item); executed (the execution status of this line is deduced): hoverItems.removeAll(item); | - |
| 660 | cachedItemsUnderMouse.removeAll(item); executed (the execution status of this line is deduced): cachedItemsUnderMouse.removeAll(item); | - |
| 661 | if (item->d_ptr->pendingPolish) { evaluated: item->d_ptr->pendingPolish| yes Evaluation Count:649 | yes Evaluation Count:1051 |
| 649-1051 |
| 662 | const int unpolishedIndex = unpolishedItems.indexOf(item); executed (the execution status of this line is deduced): const int unpolishedIndex = unpolishedItems.indexOf(item); | - |
| 663 | if (unpolishedIndex != -1) partially evaluated: unpolishedIndex != -1| yes Evaluation Count:649 | no Evaluation Count:0 |
| 0-649 |
| 664 | unpolishedItems[unpolishedIndex] = 0; executed: unpolishedItems[unpolishedIndex] = 0;Execution Count:649 | 649 |
| 665 | item->d_ptr->pendingPolish = false; executed (the execution status of this line is deduced): item->d_ptr->pendingPolish = false; | - |
| 666 | } executed: }Execution Count:649 | 649 |
| 667 | resetDirtyItem(item); executed (the execution status of this line is deduced): resetDirtyItem(item); | - |
| 668 | | - |
| 669 | //We remove all references of item from the sceneEventFilter arrays | - |
| 670 | QMultiMap<QGraphicsItem*, QGraphicsItem*>::iterator iterator = sceneEventFilters.begin(); executed (the execution status of this line is deduced): QMultiMap<QGraphicsItem*, QGraphicsItem*>::iterator iterator = sceneEventFilters.begin(); | - |
| 671 | while (iterator != sceneEventFilters.end()) { partially evaluated: iterator != sceneEventFilters.end()| no Evaluation Count:0 | yes Evaluation Count:1700 |
| 0-1700 |
| 672 | if (iterator.value() == item || iterator.key() == item) never evaluated: iterator.value() == item never evaluated: iterator.key() == item | 0 |
| 673 | iterator = sceneEventFilters.erase(iterator); never executed: iterator = sceneEventFilters.erase(iterator); | 0 |
| 674 | else | - |
| 675 | ++iterator; never executed: ++iterator; | 0 |
| 676 | } | - |
| 677 | | - |
| 678 | if (item->isPanel() && item->isVisible() && item->panelModality() != QGraphicsItem::NonModal) evaluated: item->isPanel()| yes Evaluation Count:177 | yes Evaluation Count:1523 |
partially evaluated: item->isVisible()| yes Evaluation Count:177 | no Evaluation Count:0 |
evaluated: item->panelModality() != QGraphicsItem::NonModal| yes Evaluation Count:2 | yes Evaluation Count:175 |
| 0-1523 |
| 679 | leaveModal(item); executed: leaveModal(item);Execution Count:2 | 2 |
| 680 | | - |
| 681 | // Reset the mouse grabber and focus item data. | - |
| 682 | if (mouseGrabberItems.contains(item)) evaluated: mouseGrabberItems.contains(item)| yes Evaluation Count:1 | yes Evaluation Count:1699 |
| 1-1699 |
| 683 | ungrabMouse(item, /* item is dying */ item->d_ptr->inDestructor); executed: ungrabMouse(item, item->d_ptr->inDestructor);Execution Count:1 | 1 |
| 684 | | - |
| 685 | // Reset the keyboard grabber | - |
| 686 | if (keyboardGrabberItems.contains(item)) partially evaluated: keyboardGrabberItems.contains(item)| no Evaluation Count:0 | yes Evaluation Count:1700 |
| 0-1700 |
| 687 | ungrabKeyboard(item, /* item is dying */ item->d_ptr->inDestructor); never executed: ungrabKeyboard(item, item->d_ptr->inDestructor); | 0 |
| 688 | | - |
| 689 | // Reset the last mouse grabber item | - |
| 690 | if (item == lastMouseGrabberItem) evaluated: item == lastMouseGrabberItem| yes Evaluation Count:4 | yes Evaluation Count:1696 |
| 4-1696 |
| 691 | lastMouseGrabberItem = 0; executed: lastMouseGrabberItem = 0;Execution Count:4 | 4 |
| 692 | | - |
| 693 | // Reset the current drop item | - |
| 694 | if (item == dragDropItem) partially evaluated: item == dragDropItem| no Evaluation Count:0 | yes Evaluation Count:1700 |
| 0-1700 |
| 695 | dragDropItem = 0; never executed: dragDropItem = 0; | 0 |
| 696 | | - |
| 697 | // Reenable selectionChanged() for individual items | - |
| 698 | --selectionChanging; executed (the execution status of this line is deduced): --selectionChanging; | - |
| 699 | if (!selectionChanging && selectedItems.size() != oldSelectedItemsSize) partially evaluated: !selectionChanging| yes Evaluation Count:1700 | no Evaluation Count:0 |
evaluated: selectedItems.size() != oldSelectedItemsSize| yes Evaluation Count:4 | yes Evaluation Count:1696 |
| 0-1700 |
| 700 | emit q->selectionChanged(); executed: q->selectionChanged();Execution Count:4 | 4 |
| 701 | | - |
| 702 | #ifndef QT_NO_GESTURES | - |
| 703 | QHash<QGesture *, QGraphicsObject *>::iterator it; executed (the execution status of this line is deduced): QHash<QGesture *, QGraphicsObject *>::iterator it; | - |
| 704 | for (it = gestureTargets.begin(); it != gestureTargets.end();) { evaluated: it != gestureTargets.end()| yes Evaluation Count:2 | yes Evaluation Count:1700 |
| 2-1700 |
| 705 | if (it.value() == item) partially evaluated: it.value() == item| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 706 | it = gestureTargets.erase(it); executed: it = gestureTargets.erase(it);Execution Count:2 | 2 |
| 707 | else | - |
| 708 | ++it; | 0 |
| 709 | } | - |
| 710 | | - |
| 711 | QGraphicsObject *dummy = static_cast<QGraphicsObject *>(item); executed (the execution status of this line is deduced): QGraphicsObject *dummy = static_cast<QGraphicsObject *>(item); | - |
| 712 | cachedTargetItems.removeOne(dummy); executed (the execution status of this line is deduced): cachedTargetItems.removeOne(dummy); | - |
| 713 | cachedItemGestures.remove(dummy); executed (the execution status of this line is deduced): cachedItemGestures.remove(dummy); | - |
| 714 | cachedAlreadyDeliveredGestures.remove(dummy); executed (the execution status of this line is deduced): cachedAlreadyDeliveredGestures.remove(dummy); | - |
| 715 | | - |
| 716 | foreach (Qt::GestureType gesture, item->d_ptr->gestureContext.keys()) executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(item->d_ptr->gestureContext.keys())> _container_(item->d_ptr->gestureContext.keys()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (Qt::GestureType gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 717 | ungrabGesture(item, gesture); executed: ungrabGesture(item, gesture);Execution Count:50 | 50 |
| 718 | #endif // QT_NO_GESTURES | - |
| 719 | } executed: }Execution Count:1700 | 1700 |
| 720 | | - |
| 721 | /*! | - |
| 722 | \internal | - |
| 723 | */ | - |
| 724 | void QGraphicsScenePrivate::setActivePanelHelper(QGraphicsItem *item, bool duringActivationEvent) | - |
| 725 | { | - |
| 726 | Q_Q(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScene * const q = q_func(); | - |
| 727 | if (item && item->scene() != q) { partially evaluated: item| yes Evaluation Count:19 | no Evaluation Count:0 |
partially evaluated: item->scene() != q| no Evaluation Count:0 | yes Evaluation Count:19 |
| 0-19 |
| 728 | qWarning("QGraphicsScene::setActivePanel: item %p must be part of this scene", never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsscene.cpp", 728, __PRETTY_FUNCTION__).warning("QGraphicsScene::setActivePanel: item %p must be part of this scene", | - |
| 729 | item); never executed (the execution status of this line is deduced): item); | - |
| 730 | return; | 0 |
| 731 | } | - |
| 732 | | - |
| 733 | // Ensure the scene has focus when we change panel activation. | - |
| 734 | q->setFocus(Qt::ActiveWindowFocusReason); executed (the execution status of this line is deduced): q->setFocus(Qt::ActiveWindowFocusReason); | - |
| 735 | | - |
| 736 | // Find the item's panel. | - |
| 737 | QGraphicsItem *panel = item ? item->panel() : 0; partially evaluated: item| yes Evaluation Count:19 | no Evaluation Count:0 |
| 0-19 |
| 738 | lastActivePanel = panel ? activePanel : 0; evaluated: panel| yes Evaluation Count:18 | yes Evaluation Count:1 |
| 1-18 |
| 739 | if (panel == activePanel || (!q->isActive() && !duringActivationEvent)) evaluated: panel == activePanel| yes Evaluation Count:3 | yes Evaluation Count:16 |
partially evaluated: !q->isActive()| no Evaluation Count:0 | yes Evaluation Count:16 |
never evaluated: !duringActivationEvent | 0-16 |
| 740 | return; executed: return;Execution Count:3 | 3 |
| 741 | | - |
| 742 | // Deactivate the last active panel. | - |
| 743 | if (activePanel) { partially evaluated: activePanel| no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
| 744 | if (QGraphicsItem *fi = activePanel->focusItem()) { never evaluated: QGraphicsItem *fi = activePanel->focusItem() | 0 |
| 745 | // Remove focus from the current focus item. | - |
| 746 | if (fi == q->focusItem()) never evaluated: fi == q->focusItem() | 0 |
| 747 | q->setFocusItem(0, Qt::ActiveWindowFocusReason); never executed: q->setFocusItem(0, Qt::ActiveWindowFocusReason); | 0 |
| 748 | } | 0 |
| 749 | | - |
| 750 | QEvent event(QEvent::WindowDeactivate); never executed (the execution status of this line is deduced): QEvent event(QEvent::WindowDeactivate); | - |
| 751 | q->sendEvent(activePanel, &event); never executed (the execution status of this line is deduced): q->sendEvent(activePanel, &event); | - |
| 752 | } else if (panel && !duringActivationEvent) { never executed: } partially evaluated: panel| yes Evaluation Count:16 | no Evaluation Count:0 |
evaluated: !duringActivationEvent| yes Evaluation Count:2 | yes Evaluation Count:14 |
| 0-16 |
| 753 | // Deactivate the scene if changing activation to a panel. | - |
| 754 | QEvent event(QEvent::WindowDeactivate); executed (the execution status of this line is deduced): QEvent event(QEvent::WindowDeactivate); | - |
| 755 | foreach (QGraphicsItem *item, q->items()) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(q->items())> _container_(q->items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 756 | if (item->isVisible() && !item->isPanel() && !item->parentItem()) partially evaluated: item->isVisible()| yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: !item->isPanel()| no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: !item->parentItem() | 0-2 |
| 757 | q->sendEvent(item, &event); never executed: q->sendEvent(item, &event); | 0 |
| 758 | } executed: }Execution Count:2 | 2 |
| 759 | } executed: }Execution Count:2 | 2 |
| 760 | | - |
| 761 | // Update activate state. | - |
| 762 | activePanel = panel; never executed (the execution status of this line is deduced): activePanel = panel; | - |
| 763 | QEvent event(QEvent::ActivationChange); never executed (the execution status of this line is deduced): QEvent event(QEvent::ActivationChange); | - |
| 764 | QApplication::sendEvent(q, &event); never executed (the execution status of this line is deduced): QApplication::sendEvent(q, &event); | - |
| 765 | | - |
| 766 | // Activate | - |
| 767 | if (panel) { partially evaluated: panel| yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
| 768 | QEvent event(QEvent::WindowActivate); executed (the execution status of this line is deduced): QEvent event(QEvent::WindowActivate); | - |
| 769 | q->sendEvent(panel, &event); executed (the execution status of this line is deduced): q->sendEvent(panel, &event); | - |
| 770 | | - |
| 771 | // Set focus on the panel's focus item. | - |
| 772 | if (QGraphicsItem *focusItem = panel->focusItem()) partially evaluated: QGraphicsItem *focusItem = panel->focusItem()| no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
| 773 | focusItem->setFocus(Qt::ActiveWindowFocusReason); never executed: focusItem->setFocus(Qt::ActiveWindowFocusReason); | 0 |
| 774 | } else if (q->isActive()) { executed: }Execution Count:16 never evaluated: q->isActive() | 0-16 |
| 775 | // Activate the scene | - |
| 776 | QEvent event(QEvent::WindowActivate); never executed (the execution status of this line is deduced): QEvent event(QEvent::WindowActivate); | - |
| 777 | foreach (QGraphicsItem *item, q->items()) { never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(q->items())> _container_(q->items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 778 | if (item->isVisible() && !item->isPanel() && !item->parentItem()) never evaluated: item->isVisible() never evaluated: !item->isPanel() never evaluated: !item->parentItem() | 0 |
| 779 | q->sendEvent(item, &event); never executed: q->sendEvent(item, &event); | 0 |
| 780 | } | 0 |
| 781 | } | 0 |
| 782 | } | - |
| 783 | | - |
| 784 | /*! | - |
| 785 | \internal | - |
| 786 | */ | - |
| 787 | void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, | - |
| 788 | Qt::FocusReason focusReason) | - |
| 789 | { | - |
| 790 | Q_Q(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScene * const q = q_func(); | - |
| 791 | if (item == focusItem) evaluated: item == focusItem| yes Evaluation Count:124 | yes Evaluation Count:21 |
| 21-124 |
| 792 | return; executed: return;Execution Count:124 | 124 |
| 793 | | - |
| 794 | // Clear focus if asked to set focus on something that can't | - |
| 795 | // accept input focus. | - |
| 796 | if (item && (!(item->flags() & QGraphicsItem::ItemIsFocusable) evaluated: item| yes Evaluation Count:13 | yes Evaluation Count:8 |
partially evaluated: !(item->flags() & QGraphicsItem::ItemIsFocusable)| no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
| 797 | || !item->isVisible() || !item->isEnabled())) { partially evaluated: !item->isVisible()| no Evaluation Count:0 | yes Evaluation Count:13 |
partially evaluated: !item->isEnabled()| no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
| 798 | item = 0; never executed (the execution status of this line is deduced): item = 0; | - |
| 799 | } | 0 |
| 800 | | - |
| 801 | // Set focus on the scene if an item requests focus. | - |
| 802 | if (item) { evaluated: item| yes Evaluation Count:13 | yes Evaluation Count:8 |
| 8-13 |
| 803 | q->setFocus(focusReason); executed (the execution status of this line is deduced): q->setFocus(focusReason); | - |
| 804 | if (item == focusItem) partially evaluated: item == focusItem| no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
| 805 | return; | 0 |
| 806 | } executed: }Execution Count:13 | 13 |
| 807 | | - |
| 808 | if (focusItem) { evaluated: focusItem| yes Evaluation Count:13 | yes Evaluation Count:8 |
| 8-13 |
| 809 | lastFocusItem = focusItem; executed (the execution status of this line is deduced): lastFocusItem = focusItem; | - |
| 810 | | - |
| 811 | #ifndef QT_NO_IM | - |
| 812 | if (lastFocusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod) { evaluated: lastFocusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod| yes Evaluation Count:8 | yes Evaluation Count:5 |
| 5-8 |
| 813 | // Close any external input method panel. This happens | - |
| 814 | // automatically by removing WA_InputMethodEnabled on | - |
| 815 | // the views, but if we are changing focus, we have to | - |
| 816 | // do it ourselves. | - |
| 817 | if (qApp) partially evaluated: (static_cast<QApplication *>(QCoreApplication::instance()))| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 818 | qApp->inputMethod()->commit(); executed: (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit();Execution Count:8 | 8 |
| 819 | } executed: }Execution Count:8 | 8 |
| 820 | #endif //QT_NO_IM | - |
| 821 | | - |
| 822 | focusItem = 0; executed (the execution status of this line is deduced): focusItem = 0; | - |
| 823 | QFocusEvent event(QEvent::FocusOut, focusReason); executed (the execution status of this line is deduced): QFocusEvent event(QEvent::FocusOut, focusReason); | - |
| 824 | sendEvent(lastFocusItem, &event); executed (the execution status of this line is deduced): sendEvent(lastFocusItem, &event); | - |
| 825 | } executed: }Execution Count:13 | 13 |
| 826 | | - |
| 827 | // This handles the case that the item has been removed from the | - |
| 828 | // scene in response to the FocusOut event. | - |
| 829 | if (item && item->scene() != q) evaluated: item| yes Evaluation Count:13 | yes Evaluation Count:8 |
partially evaluated: item->scene() != q| no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
| 830 | item = 0; never executed: item = 0; | 0 |
| 831 | | - |
| 832 | if (item) evaluated: item| yes Evaluation Count:13 | yes Evaluation Count:8 |
| 8-13 |
| 833 | focusItem = item; executed: focusItem = item;Execution Count:13 | 13 |
| 834 | updateInputMethodSensitivityInViews(); executed (the execution status of this line is deduced): updateInputMethodSensitivityInViews(); | - |
| 835 | | - |
| 836 | if (item) { evaluated: item| yes Evaluation Count:13 | yes Evaluation Count:8 |
| 8-13 |
| 837 | QFocusEvent event(QEvent::FocusIn, focusReason); executed (the execution status of this line is deduced): QFocusEvent event(QEvent::FocusIn, focusReason); | - |
| 838 | sendEvent(item, &event); executed (the execution status of this line is deduced): sendEvent(item, &event); | - |
| 839 | } executed: }Execution Count:13 | 13 |
| 840 | } executed: }Execution Count:21 | 21 |
| 841 | | - |
| 842 | /*! | - |
| 843 | \internal | - |
| 844 | */ | - |
| 845 | void QGraphicsScenePrivate::addPopup(QGraphicsWidget *widget) | - |
| 846 | { | - |
| 847 | Q_ASSERT(widget); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 848 | Q_ASSERT(!popupWidgets.contains(widget)); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 849 | popupWidgets << widget; never executed (the execution status of this line is deduced): popupWidgets << widget; | - |
| 850 | if (QGraphicsWidget *focusWidget = widget->focusWidget()) { never evaluated: QGraphicsWidget *focusWidget = widget->focusWidget() | 0 |
| 851 | focusWidget->setFocus(Qt::PopupFocusReason); never executed (the execution status of this line is deduced): focusWidget->setFocus(Qt::PopupFocusReason); | - |
| 852 | } else { | 0 |
| 853 | grabKeyboard((QGraphicsItem *)widget); never executed (the execution status of this line is deduced): grabKeyboard((QGraphicsItem *)widget); | - |
| 854 | if (focusItem && popupWidgets.size() == 1) { never evaluated: focusItem never evaluated: popupWidgets.size() == 1 | 0 |
| 855 | QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); never executed (the execution status of this line is deduced): QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); | - |
| 856 | sendEvent(focusItem, &event); never executed (the execution status of this line is deduced): sendEvent(focusItem, &event); | - |
| 857 | } | 0 |
| 858 | } | 0 |
| 859 | grabMouse((QGraphicsItem *)widget); never executed (the execution status of this line is deduced): grabMouse((QGraphicsItem *)widget); | - |
| 860 | } | 0 |
| 861 | | - |
| 862 | /*! | - |
| 863 | \internal | - |
| 864 | | - |
| 865 | Remove \a widget from the popup list. Important notes: | - |
| 866 | | - |
| 867 | \a widget is guaranteed to be in the list of popups, but it might not be | - |
| 868 | the last entry; you can hide any item in the pop list before the others, | - |
| 869 | and this must cause all later mouse grabbers to lose the grab. | - |
| 870 | */ | - |
| 871 | void QGraphicsScenePrivate::removePopup(QGraphicsWidget *widget, bool itemIsDying) | - |
| 872 | { | - |
| 873 | Q_ASSERT(widget); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 874 | int index = popupWidgets.indexOf(widget); never executed (the execution status of this line is deduced): int index = popupWidgets.indexOf(widget); | - |
| 875 | Q_ASSERT(index != -1); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 876 | | - |
| 877 | for (int i = popupWidgets.size() - 1; i >= index; --i) { never evaluated: i >= index | 0 |
| 878 | QGraphicsWidget *widget = popupWidgets.takeLast(); never executed (the execution status of this line is deduced): QGraphicsWidget *widget = popupWidgets.takeLast(); | - |
| 879 | ungrabMouse(widget, itemIsDying); never executed (the execution status of this line is deduced): ungrabMouse(widget, itemIsDying); | - |
| 880 | if (focusItem && popupWidgets.isEmpty()) { never evaluated: focusItem never evaluated: popupWidgets.isEmpty() | 0 |
| 881 | QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason); never executed (the execution status of this line is deduced): QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason); | - |
| 882 | sendEvent(focusItem, &event); never executed (the execution status of this line is deduced): sendEvent(focusItem, &event); | - |
| 883 | } else if (keyboardGrabberItems.contains(static_cast<QGraphicsItem *>(widget))) { never executed: } never evaluated: keyboardGrabberItems.contains(static_cast<QGraphicsItem *>(widget)) | 0 |
| 884 | ungrabKeyboard(static_cast<QGraphicsItem *>(widget), itemIsDying); never executed (the execution status of this line is deduced): ungrabKeyboard(static_cast<QGraphicsItem *>(widget), itemIsDying); | - |
| 885 | } | 0 |
| 886 | if (!itemIsDying && widget->isVisible()) { never evaluated: !itemIsDying never evaluated: widget->isVisible() | 0 |
| 887 | widget->QGraphicsItem::d_ptr->setVisibleHelper(false, /* explicit = */ false); never executed (the execution status of this line is deduced): widget->QGraphicsItem::d_ptr->setVisibleHelper(false, false); | - |
| 888 | } | 0 |
| 889 | } | 0 |
| 890 | } | 0 |
| 891 | | - |
| 892 | /*! | - |
| 893 | \internal | - |
| 894 | */ | - |
| 895 | void QGraphicsScenePrivate::grabMouse(QGraphicsItem *item, bool implicit) | - |
| 896 | { | - |
| 897 | // Append to list of mouse grabber items, and send a mouse grab event. | - |
| 898 | if (mouseGrabberItems.contains(item)) { partially evaluated: mouseGrabberItems.contains(item)| no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
| 899 | if (mouseGrabberItems.last() == item) { never evaluated: mouseGrabberItems.last() == item | 0 |
| 900 | Q_ASSERT(!implicit); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 901 | if (!lastMouseGrabberItemHasImplicitMouseGrab) { never evaluated: !lastMouseGrabberItemHasImplicitMouseGrab | 0 |
| 902 | qWarning("QGraphicsItem::grabMouse: already a mouse grabber"); never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsscene.cpp", 902, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabMouse: already a mouse grabber"); | - |
| 903 | } else { | 0 |
| 904 | // Upgrade to an explicit mouse grab | - |
| 905 | lastMouseGrabberItemHasImplicitMouseGrab = false; never executed (the execution status of this line is deduced): lastMouseGrabberItemHasImplicitMouseGrab = false; | - |
| 906 | } | 0 |
| 907 | } else { | - |
| 908 | qWarning("QGraphicsItem::grabMouse: already blocked by mouse grabber: %p", never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsscene.cpp", 908, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabMouse: already blocked by mouse grabber: %p", | - |
| 909 | mouseGrabberItems.last()); never executed (the execution status of this line is deduced): mouseGrabberItems.last()); | - |
| 910 | } | 0 |
| 911 | return; | 0 |
| 912 | } | - |
| 913 | | - |
| 914 | // Send ungrab event to the last grabber. | - |
| 915 | if (!mouseGrabberItems.isEmpty()) { partially evaluated: !mouseGrabberItems.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
| 916 | QGraphicsItem *last = mouseGrabberItems.last(); never executed (the execution status of this line is deduced): QGraphicsItem *last = mouseGrabberItems.last(); | - |
| 917 | if (lastMouseGrabberItemHasImplicitMouseGrab) { never evaluated: lastMouseGrabberItemHasImplicitMouseGrab | 0 |
| 918 | // Implicit mouse grab is immediately lost. | - |
| 919 | last->ungrabMouse(); never executed (the execution status of this line is deduced): last->ungrabMouse(); | - |
| 920 | } else { | 0 |
| 921 | // Just send ungrab event to current grabber. | - |
| 922 | QEvent ungrabEvent(QEvent::UngrabMouse); never executed (the execution status of this line is deduced): QEvent ungrabEvent(QEvent::UngrabMouse); | - |
| 923 | sendEvent(last, &ungrabEvent); never executed (the execution status of this line is deduced): sendEvent(last, &ungrabEvent); | - |
| 924 | } | 0 |
| 925 | } | - |
| 926 | | - |
| 927 | mouseGrabberItems << item; executed (the execution status of this line is deduced): mouseGrabberItems << item; | - |
| 928 | lastMouseGrabberItemHasImplicitMouseGrab = implicit; executed (the execution status of this line is deduced): lastMouseGrabberItemHasImplicitMouseGrab = implicit; | - |
| 929 | | - |
| 930 | // Send grab event to current grabber. | - |
| 931 | QEvent grabEvent(QEvent::GrabMouse); executed (the execution status of this line is deduced): QEvent grabEvent(QEvent::GrabMouse); | - |
| 932 | sendEvent(item, &grabEvent); executed (the execution status of this line is deduced): sendEvent(item, &grabEvent); | - |
| 933 | } executed: }Execution Count:105 | 105 |
| 934 | | - |
| 935 | /*! | - |
| 936 | \internal | - |
| 937 | */ | - |
| 938 | void QGraphicsScenePrivate::ungrabMouse(QGraphicsItem *item, bool itemIsDying) | - |
| 939 | { | - |
| 940 | int index = mouseGrabberItems.indexOf(item); executed (the execution status of this line is deduced): int index = mouseGrabberItems.indexOf(item); | - |
| 941 | if (index == -1) { partially evaluated: index == -1| no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
| 942 | qWarning("QGraphicsItem::ungrabMouse: not a mouse grabber"); never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsscene.cpp", 942, __PRETTY_FUNCTION__).warning("QGraphicsItem::ungrabMouse: not a mouse grabber"); | - |
| 943 | return; | 0 |
| 944 | } | - |
| 945 | | - |
| 946 | if (item != mouseGrabberItems.last()) { partially evaluated: item != mouseGrabberItems.last()| no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
| 947 | // Recursively ungrab the next mouse grabber until we reach this item | - |
| 948 | // to ensure state consistency. | - |
| 949 | ungrabMouse(mouseGrabberItems.at(index + 1), itemIsDying); never executed (the execution status of this line is deduced): ungrabMouse(mouseGrabberItems.at(index + 1), itemIsDying); | - |
| 950 | } | 0 |
| 951 | if (!popupWidgets.isEmpty() && item == popupWidgets.last()) { partially evaluated: !popupWidgets.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:105 |
never evaluated: item == popupWidgets.last() | 0-105 |
| 952 | // If the item is a popup, go via removePopup to ensure state | - |
| 953 | // consistency and that it gets hidden correctly - beware that | - |
| 954 | // removePopup() reenters this function to continue removing the grab. | - |
| 955 | removePopup((QGraphicsWidget *)item, itemIsDying); never executed (the execution status of this line is deduced): removePopup((QGraphicsWidget *)item, itemIsDying); | - |
| 956 | return; | 0 |
| 957 | } | - |
| 958 | | - |
| 959 | // Send notification about mouse ungrab. | - |
| 960 | if (!itemIsDying) { evaluated: !itemIsDying| yes Evaluation Count:104 | yes Evaluation Count:1 |
| 1-104 |
| 961 | QEvent event(QEvent::UngrabMouse); executed (the execution status of this line is deduced): QEvent event(QEvent::UngrabMouse); | - |
| 962 | sendEvent(item, &event); executed (the execution status of this line is deduced): sendEvent(item, &event); | - |
| 963 | } executed: }Execution Count:104 | 104 |
| 964 | | - |
| 965 | // Remove the item from the list of grabbers. Whenever this happens, we | - |
| 966 | // reset the implicitGrab (there can be only ever be one implicit grabber | - |
| 967 | // in a scene, and it is always the latest grabber; if the implicit grab | - |
| 968 | // is lost, it is not automatically regained. | - |
| 969 | mouseGrabberItems.takeLast(); executed (the execution status of this line is deduced): mouseGrabberItems.takeLast(); | - |
| 970 | lastMouseGrabberItemHasImplicitMouseGrab = false; executed (the execution status of this line is deduced): lastMouseGrabberItemHasImplicitMouseGrab = false; | - |
| 971 | | - |
| 972 | // Send notification about mouse regrab. ### It's unfortunate that all the | - |
| 973 | // items get a GrabMouse event, but this is a rare case with a simple | - |
| 974 | // implementation and it does ensure a consistent state. | - |
| 975 | if (!itemIsDying && !mouseGrabberItems.isEmpty()) { evaluated: !itemIsDying| yes Evaluation Count:104 | yes Evaluation Count:1 |
partially evaluated: !mouseGrabberItems.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:104 |
| 0-104 |
| 976 | QGraphicsItem *last = mouseGrabberItems.last(); never executed (the execution status of this line is deduced): QGraphicsItem *last = mouseGrabberItems.last(); | - |
| 977 | QEvent event(QEvent::GrabMouse); never executed (the execution status of this line is deduced): QEvent event(QEvent::GrabMouse); | - |
| 978 | sendEvent(last, &event); never executed (the execution status of this line is deduced): sendEvent(last, &event); | - |
| 979 | } | 0 |
| 980 | } executed: }Execution Count:105 | 105 |
| 981 | | - |
| 982 | /*! | - |
| 983 | \internal | - |
| 984 | */ | - |
| 985 | void QGraphicsScenePrivate::clearMouseGrabber() | - |
| 986 | { | - |
| 987 | if (!mouseGrabberItems.isEmpty()) partially evaluated: !mouseGrabberItems.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
| 988 | mouseGrabberItems.first()->ungrabMouse(); never executed: mouseGrabberItems.first()->ungrabMouse(); | 0 |
| 989 | lastMouseGrabberItem = 0; executed (the execution status of this line is deduced): lastMouseGrabberItem = 0; | - |
| 990 | } executed: }Execution Count:10 | 10 |
| 991 | | - |
| 992 | /*! | - |
| 993 | \internal | - |
| 994 | */ | - |
| 995 | void QGraphicsScenePrivate::grabKeyboard(QGraphicsItem *item) | - |
| 996 | { | - |
| 997 | if (keyboardGrabberItems.contains(item)) { never evaluated: keyboardGrabberItems.contains(item) | 0 |
| 998 | if (keyboardGrabberItems.last() == item) never evaluated: keyboardGrabberItems.last() == item | 0 |
| 999 | qWarning("QGraphicsItem::grabKeyboard: already a keyboard grabber"); never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 999, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabKeyboard: already a keyboard grabber"); | 0 |
| 1000 | else | - |
| 1001 | qWarning("QGraphicsItem::grabKeyboard: already blocked by keyboard grabber: %p", never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 1001, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabKeyboard: already blocked by keyboard grabber: %p", keyboardGrabberItems.last()); | 0 |
| 1002 | keyboardGrabberItems.last()); never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 1001, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabKeyboard: already blocked by keyboard grabber: %p", keyboardGrabberItems.last()); | 0 |
| 1003 | return; | 0 |
| 1004 | } | - |
| 1005 | | - |
| 1006 | // Send ungrab event to the last grabber. | - |
| 1007 | if (!keyboardGrabberItems.isEmpty()) { never evaluated: !keyboardGrabberItems.isEmpty() | 0 |
| 1008 | // Just send ungrab event to current grabber. | - |
| 1009 | QEvent ungrabEvent(QEvent::UngrabKeyboard); never executed (the execution status of this line is deduced): QEvent ungrabEvent(QEvent::UngrabKeyboard); | - |
| 1010 | sendEvent(keyboardGrabberItems.last(), &ungrabEvent); never executed (the execution status of this line is deduced): sendEvent(keyboardGrabberItems.last(), &ungrabEvent); | - |
| 1011 | } | 0 |
| 1012 | | - |
| 1013 | keyboardGrabberItems << item; never executed (the execution status of this line is deduced): keyboardGrabberItems << item; | - |
| 1014 | | - |
| 1015 | // Send grab event to current grabber. | - |
| 1016 | QEvent grabEvent(QEvent::GrabKeyboard); never executed (the execution status of this line is deduced): QEvent grabEvent(QEvent::GrabKeyboard); | - |
| 1017 | sendEvent(item, &grabEvent); never executed (the execution status of this line is deduced): sendEvent(item, &grabEvent); | - |
| 1018 | } | 0 |
| 1019 | | - |
| 1020 | /*! | - |
| 1021 | \internal | - |
| 1022 | */ | - |
| 1023 | void QGraphicsScenePrivate::ungrabKeyboard(QGraphicsItem *item, bool itemIsDying) | - |
| 1024 | { | - |
| 1025 | int index = keyboardGrabberItems.lastIndexOf(item); never executed (the execution status of this line is deduced): int index = keyboardGrabberItems.lastIndexOf(item); | - |
| 1026 | if (index == -1) { never evaluated: index == -1 | 0 |
| 1027 | qWarning("QGraphicsItem::ungrabKeyboard: not a keyboard grabber"); never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsscene.cpp", 1027, __PRETTY_FUNCTION__).warning("QGraphicsItem::ungrabKeyboard: not a keyboard grabber"); | - |
| 1028 | return; | 0 |
| 1029 | } | - |
| 1030 | if (item != keyboardGrabberItems.last()) { never evaluated: item != keyboardGrabberItems.last() | 0 |
| 1031 | // Recursively ungrab the topmost keyboard grabber until we reach this | - |
| 1032 | // item to ensure state consistency. | - |
| 1033 | ungrabKeyboard(keyboardGrabberItems.at(index + 1), itemIsDying); never executed (the execution status of this line is deduced): ungrabKeyboard(keyboardGrabberItems.at(index + 1), itemIsDying); | - |
| 1034 | } | 0 |
| 1035 | | - |
| 1036 | // Send notification about keyboard ungrab. | - |
| 1037 | if (!itemIsDying) { never evaluated: !itemIsDying | 0 |
| 1038 | QEvent event(QEvent::UngrabKeyboard); never executed (the execution status of this line is deduced): QEvent event(QEvent::UngrabKeyboard); | - |
| 1039 | sendEvent(item, &event); never executed (the execution status of this line is deduced): sendEvent(item, &event); | - |
| 1040 | } | 0 |
| 1041 | | - |
| 1042 | // Remove the item from the list of grabbers. | - |
| 1043 | keyboardGrabberItems.takeLast(); never executed (the execution status of this line is deduced): keyboardGrabberItems.takeLast(); | - |
| 1044 | | - |
| 1045 | // Send notification about mouse regrab. | - |
| 1046 | if (!itemIsDying && !keyboardGrabberItems.isEmpty()) { never evaluated: !itemIsDying never evaluated: !keyboardGrabberItems.isEmpty() | 0 |
| 1047 | QGraphicsItem *last = keyboardGrabberItems.last(); never executed (the execution status of this line is deduced): QGraphicsItem *last = keyboardGrabberItems.last(); | - |
| 1048 | QEvent event(QEvent::GrabKeyboard); never executed (the execution status of this line is deduced): QEvent event(QEvent::GrabKeyboard); | - |
| 1049 | sendEvent(last, &event); never executed (the execution status of this line is deduced): sendEvent(last, &event); | - |
| 1050 | } | 0 |
| 1051 | } | 0 |
| 1052 | | - |
| 1053 | /*! | - |
| 1054 | \internal | - |
| 1055 | */ | - |
| 1056 | void QGraphicsScenePrivate::clearKeyboardGrabber() | - |
| 1057 | { | - |
| 1058 | if (!keyboardGrabberItems.isEmpty()) never evaluated: !keyboardGrabberItems.isEmpty() | 0 |
| 1059 | ungrabKeyboard(keyboardGrabberItems.first()); never executed: ungrabKeyboard(keyboardGrabberItems.first()); | 0 |
| 1060 | } | 0 |
| 1061 | | - |
| 1062 | void QGraphicsScenePrivate::enableMouseTrackingOnViews() | - |
| 1063 | { | - |
| 1064 | foreach (QGraphicsView *view, views) executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(views)> _container_(views); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 1065 | view->viewport()->setMouseTracking(true); executed: view->viewport()->setMouseTracking(true);Execution Count:181 | 181 |
| 1066 | } executed: }Execution Count:189 | 189 |
| 1067 | | - |
| 1068 | /*! | - |
| 1069 | Returns all items for the screen position in \a event. | - |
| 1070 | */ | - |
| 1071 | QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &screenPos, | - |
| 1072 | const QPointF &scenePos, | - |
| 1073 | QWidget *widget) const | - |
| 1074 | { | - |
| 1075 | Q_Q(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScene * const q = q_func(); | - |
| 1076 | QGraphicsView *view = widget ? qobject_cast<QGraphicsView *>(widget->parentWidget()) : 0; evaluated: widget| yes Evaluation Count:254 | yes Evaluation Count:67 |
| 67-254 |
| 1077 | if (!view) evaluated: !view| yes Evaluation Count:67 | yes Evaluation Count:254 |
| 67-254 |
| 1078 | return q->items(scenePos, Qt::IntersectsItemShape, Qt::DescendingOrder, QTransform()); executed: return q->items(scenePos, Qt::IntersectsItemShape, Qt::DescendingOrder, QTransform());Execution Count:67 | 67 |
| 1079 | | - |
| 1080 | const QRectF pointRect(QPointF(widget->mapFromGlobal(screenPos)), QSizeF(1, 1)); executed (the execution status of this line is deduced): const QRectF pointRect(QPointF(widget->mapFromGlobal(screenPos)), QSizeF(1, 1)); | - |
| 1081 | if (!view->isTransformed()) evaluated: !view->isTransformed()| yes Evaluation Count:4 | yes Evaluation Count:250 |
| 4-250 |
| 1082 | return q->items(pointRect, Qt::IntersectsItemShape, Qt::DescendingOrder); executed: return q->items(pointRect, Qt::IntersectsItemShape, Qt::DescendingOrder);Execution Count:4 | 4 |
| 1083 | | - |
| 1084 | const QTransform viewTransform = view->viewportTransform(); executed (the execution status of this line is deduced): const QTransform viewTransform = view->viewportTransform(); | - |
| 1085 | if (viewTransform.type() <= QTransform::TxScale) { partially evaluated: viewTransform.type() <= QTransform::TxScale| yes Evaluation Count:250 | no Evaluation Count:0 |
| 0-250 |
| 1086 | return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape, executed: return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape, Qt::DescendingOrder, viewTransform);Execution Count:250 | 250 |
| 1087 | Qt::DescendingOrder, viewTransform); executed: return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape, Qt::DescendingOrder, viewTransform);Execution Count:250 | 250 |
| 1088 | } | - |
| 1089 | return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape, never executed: return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape, Qt::DescendingOrder, viewTransform); | 0 |
| 1090 | Qt::DescendingOrder, viewTransform); never executed: return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape, Qt::DescendingOrder, viewTransform); | 0 |
| 1091 | } | - |
| 1092 | | - |
| 1093 | /*! | - |
| 1094 | \internal | - |
| 1095 | */ | - |
| 1096 | void QGraphicsScenePrivate::storeMouseButtonsForMouseGrabber(QGraphicsSceneMouseEvent *event) | - |
| 1097 | { | - |
| 1098 | for (int i = 0x1; i <= 0x10; i <<= 1) { evaluated: i <= 0x10| yes Evaluation Count:525 | yes Evaluation Count:105 |
| 105-525 |
| 1099 | if (event->buttons() & i) { evaluated: event->buttons() & i| yes Evaluation Count:2 | yes Evaluation Count:523 |
| 2-523 |
| 1100 | mouseGrabberButtonDownPos.insert(Qt::MouseButton(i), executed (the execution status of this line is deduced): mouseGrabberButtonDownPos.insert(Qt::MouseButton(i), | - |
| 1101 | mouseGrabberItems.last()->d_ptr->genericMapFromScene(event->scenePos(), executed (the execution status of this line is deduced): mouseGrabberItems.last()->d_ptr->genericMapFromScene(event->scenePos(), | - |
| 1102 | event->widget())); executed (the execution status of this line is deduced): event->widget())); | - |
| 1103 | mouseGrabberButtonDownScenePos.insert(Qt::MouseButton(i), event->scenePos()); executed (the execution status of this line is deduced): mouseGrabberButtonDownScenePos.insert(Qt::MouseButton(i), event->scenePos()); | - |
| 1104 | mouseGrabberButtonDownScreenPos.insert(Qt::MouseButton(i), event->screenPos()); executed (the execution status of this line is deduced): mouseGrabberButtonDownScreenPos.insert(Qt::MouseButton(i), event->screenPos()); | - |
| 1105 | } executed: }Execution Count:2 | 2 |
| 1106 | } executed: }Execution Count:525 | 525 |
| 1107 | } executed: }Execution Count:105 | 105 |
| 1108 | | - |
| 1109 | /*! | - |
| 1110 | \internal | - |
| 1111 | */ | - |
| 1112 | void QGraphicsScenePrivate::installSceneEventFilter(QGraphicsItem *watched, QGraphicsItem *filter) | - |
| 1113 | { | - |
| 1114 | sceneEventFilters.insert(watched, filter); never executed (the execution status of this line is deduced): sceneEventFilters.insert(watched, filter); | - |
| 1115 | } | 0 |
| 1116 | | - |
| 1117 | /*! | - |
| 1118 | \internal | - |
| 1119 | */ | - |
| 1120 | void QGraphicsScenePrivate::removeSceneEventFilter(QGraphicsItem *watched, QGraphicsItem *filter) | - |
| 1121 | { | - |
| 1122 | if (!sceneEventFilters.contains(watched)) never evaluated: !sceneEventFilters.contains(watched) | 0 |
| 1123 | return; | 0 |
| 1124 | | - |
| 1125 | QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator it = sceneEventFilters.lowerBound(watched); never executed (the execution status of this line is deduced): QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator it = sceneEventFilters.lowerBound(watched); | - |
| 1126 | QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator end = sceneEventFilters.upperBound(watched); never executed (the execution status of this line is deduced): QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator end = sceneEventFilters.upperBound(watched); | - |
| 1127 | do { | - |
| 1128 | if (it.value() == filter) never evaluated: it.value() == filter | 0 |
| 1129 | it = sceneEventFilters.erase(it); never executed: it = sceneEventFilters.erase(it); | 0 |
| 1130 | else | - |
| 1131 | ++it; | 0 |
| 1132 | } while (it != end); never evaluated: it != end | 0 |
| 1133 | } | 0 |
| 1134 | | - |
| 1135 | /*! | - |
| 1136 | \internal | - |
| 1137 | */ | - |
| 1138 | bool QGraphicsScenePrivate::filterDescendantEvent(QGraphicsItem *item, QEvent *event) | - |
| 1139 | { | - |
| 1140 | if (item && (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorFiltersChildEvents)) { partially evaluated: item| yes Evaluation Count:1393 | no Evaluation Count:0 |
partially evaluated: (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorFiltersChildEvents)| no Evaluation Count:0 | yes Evaluation Count:1393 |
| 0-1393 |
| 1141 | QGraphicsItem *parent = item->parentItem(); never executed (the execution status of this line is deduced): QGraphicsItem *parent = item->parentItem(); | - |
| 1142 | while (parent) { | 0 |
| 1143 | if (parent->d_ptr->filtersDescendantEvents && parent->sceneEventFilter(item, event)) never evaluated: parent->d_ptr->filtersDescendantEvents never evaluated: parent->sceneEventFilter(item, event) | 0 |
| 1144 | return true; never executed: return true; | 0 |
| 1145 | if (!(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorFiltersChildEvents)) never evaluated: !(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorFiltersChildEvents) | 0 |
| 1146 | return false; never executed: return false; | 0 |
| 1147 | parent = parent->parentItem(); never executed (the execution status of this line is deduced): parent = parent->parentItem(); | - |
| 1148 | } | 0 |
| 1149 | } | 0 |
| 1150 | return false; executed: return false;Execution Count:1393 | 1393 |
| 1151 | } | - |
| 1152 | | - |
| 1153 | /*! | - |
| 1154 | \internal | - |
| 1155 | */ | - |
| 1156 | bool QGraphicsScenePrivate::filterEvent(QGraphicsItem *item, QEvent *event) | - |
| 1157 | { | - |
| 1158 | if (item && !sceneEventFilters.contains(item)) partially evaluated: item| yes Evaluation Count:1393 | no Evaluation Count:0 |
partially evaluated: !sceneEventFilters.contains(item)| yes Evaluation Count:1393 | no Evaluation Count:0 |
| 0-1393 |
| 1159 | return false; executed: return false;Execution Count:1393 | 1393 |
| 1160 | | - |
| 1161 | QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator it = sceneEventFilters.lowerBound(item); never executed (the execution status of this line is deduced): QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator it = sceneEventFilters.lowerBound(item); | - |
| 1162 | QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator end = sceneEventFilters.upperBound(item); never executed (the execution status of this line is deduced): QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator end = sceneEventFilters.upperBound(item); | - |
| 1163 | while (it != end) { never evaluated: it != end | 0 |
| 1164 | // ### The filterer and filteree might both be deleted. | - |
| 1165 | if (it.value()->sceneEventFilter(it.key(), event)) never evaluated: it.value()->sceneEventFilter(it.key(), event) | 0 |
| 1166 | return true; never executed: return true; | 0 |
| 1167 | ++it; never executed (the execution status of this line is deduced): ++it; | - |
| 1168 | } | 0 |
| 1169 | return false; never executed: return false; | 0 |
| 1170 | } | - |
| 1171 | | - |
| 1172 | /*! | - |
| 1173 | \internal | - |
| 1174 | | - |
| 1175 | This is the final dispatch point for any events from the scene to the | - |
| 1176 | item. It filters the event first - if the filter returns true, the event | - |
| 1177 | is considered to have been eaten by the filter, and is therefore stopped | - |
| 1178 | (the default filter returns false). Then/otherwise, if the item is | - |
| 1179 | enabled, the event is sent; otherwise it is stopped. | - |
| 1180 | */ | - |
| 1181 | bool QGraphicsScenePrivate::sendEvent(QGraphicsItem *item, QEvent *event) | - |
| 1182 | { | - |
| 1183 | if (QGraphicsObject *object = item->toGraphicsObject()) { evaluated: QGraphicsObject *object = item->toGraphicsObject()| yes Evaluation Count:706 | yes Evaluation Count:687 |
| 687-706 |
| 1184 | #ifndef QT_NO_GESTURES | - |
| 1185 | QGestureManager *gestureManager = QApplicationPrivate::instance()->gestureManager; executed (the execution status of this line is deduced): QGestureManager *gestureManager = QApplicationPrivate::instance()->gestureManager; | - |
| 1186 | if (gestureManager) { evaluated: gestureManager| yes Evaluation Count:705 | yes Evaluation Count:1 |
| 1-705 |
| 1187 | if (gestureManager->filterEvent(object, event)) partially evaluated: gestureManager->filterEvent(object, event)| no Evaluation Count:0 | yes Evaluation Count:705 |
| 0-705 |
| 1188 | return true; never executed: return true; | 0 |
| 1189 | } executed: }Execution Count:705 | 705 |
| 1190 | #endif // QT_NO_GESTURES | - |
| 1191 | } executed: }Execution Count:706 | 706 |
| 1192 | | - |
| 1193 | if (filterEvent(item, event)) partially evaluated: filterEvent(item, event)| no Evaluation Count:0 | yes Evaluation Count:1393 |
| 0-1393 |
| 1194 | return false; never executed: return false; | 0 |
| 1195 | if (filterDescendantEvent(item, event)) partially evaluated: filterDescendantEvent(item, event)| no Evaluation Count:0 | yes Evaluation Count:1393 |
| 0-1393 |
| 1196 | return false; never executed: return false; | 0 |
| 1197 | if (!item || !item->isEnabled()) partially evaluated: !item| no Evaluation Count:0 | yes Evaluation Count:1393 |
partially evaluated: !item->isEnabled()| no Evaluation Count:0 | yes Evaluation Count:1393 |
| 0-1393 |
| 1198 | return false; never executed: return false; | 0 |
| 1199 | if (QGraphicsObject *o = item->toGraphicsObject()) { evaluated: QGraphicsObject *o = item->toGraphicsObject()| yes Evaluation Count:706 | yes Evaluation Count:687 |
| 687-706 |
| 1200 | bool spont = event->spontaneous(); executed (the execution status of this line is deduced): bool spont = event->spontaneous(); | - |
| 1201 | if (spont ? qt_sendSpontaneousEvent(o, event) : QApplication::sendEvent(o, event)) evaluated: spont| yes Evaluation Count:5 | yes Evaluation Count:701 |
| 5-701 |
| 1202 | return true; executed: return true;Execution Count:428 | 428 |
| 1203 | event->spont = spont; executed (the execution status of this line is deduced): event->spont = spont; | - |
| 1204 | } executed: }Execution Count:278 | 278 |
| 1205 | return item->sceneEvent(event); executed: return item->sceneEvent(event);Execution Count:965 | 965 |
| 1206 | } | - |
| 1207 | | - |
| 1208 | /*! | - |
| 1209 | \internal | - |
| 1210 | */ | - |
| 1211 | void QGraphicsScenePrivate::cloneDragDropEvent(QGraphicsSceneDragDropEvent *dest, | - |
| 1212 | QGraphicsSceneDragDropEvent *source) | - |
| 1213 | { | - |
| 1214 | dest->setWidget(source->widget()); never executed (the execution status of this line is deduced): dest->setWidget(source->widget()); | - |
| 1215 | dest->setPos(source->pos()); never executed (the execution status of this line is deduced): dest->setPos(source->pos()); | - |
| 1216 | dest->setScenePos(source->scenePos()); never executed (the execution status of this line is deduced): dest->setScenePos(source->scenePos()); | - |
| 1217 | dest->setScreenPos(source->screenPos()); never executed (the execution status of this line is deduced): dest->setScreenPos(source->screenPos()); | - |
| 1218 | dest->setButtons(source->buttons()); never executed (the execution status of this line is deduced): dest->setButtons(source->buttons()); | - |
| 1219 | dest->setModifiers(source->modifiers()); never executed (the execution status of this line is deduced): dest->setModifiers(source->modifiers()); | - |
| 1220 | dest->setPossibleActions(source->possibleActions()); never executed (the execution status of this line is deduced): dest->setPossibleActions(source->possibleActions()); | - |
| 1221 | dest->setProposedAction(source->proposedAction()); never executed (the execution status of this line is deduced): dest->setProposedAction(source->proposedAction()); | - |
| 1222 | dest->setDropAction(source->dropAction()); never executed (the execution status of this line is deduced): dest->setDropAction(source->dropAction()); | - |
| 1223 | dest->setSource(source->source()); never executed (the execution status of this line is deduced): dest->setSource(source->source()); | - |
| 1224 | dest->setMimeData(source->mimeData()); never executed (the execution status of this line is deduced): dest->setMimeData(source->mimeData()); | - |
| 1225 | } | 0 |
| 1226 | | - |
| 1227 | /*! | - |
| 1228 | \internal | - |
| 1229 | */ | - |
| 1230 | void QGraphicsScenePrivate::sendDragDropEvent(QGraphicsItem *item, | - |
| 1231 | QGraphicsSceneDragDropEvent *dragDropEvent) | - |
| 1232 | { | - |
| 1233 | dragDropEvent->setPos(item->d_ptr->genericMapFromScene(dragDropEvent->scenePos(), dragDropEvent->widget())); never executed (the execution status of this line is deduced): dragDropEvent->setPos(item->d_ptr->genericMapFromScene(dragDropEvent->scenePos(), dragDropEvent->widget())); | - |
| 1234 | sendEvent(item, dragDropEvent); never executed (the execution status of this line is deduced): sendEvent(item, dragDropEvent); | - |
| 1235 | } | 0 |
| 1236 | | - |
| 1237 | /*! | - |
| 1238 | \internal | - |
| 1239 | */ | - |
| 1240 | void QGraphicsScenePrivate::sendHoverEvent(QEvent::Type type, QGraphicsItem *item, | - |
| 1241 | QGraphicsSceneHoverEvent *hoverEvent) | - |
| 1242 | { | - |
| 1243 | QGraphicsSceneHoverEvent event(type); never executed (the execution status of this line is deduced): QGraphicsSceneHoverEvent event(type); | - |
| 1244 | event.setWidget(hoverEvent->widget()); never executed (the execution status of this line is deduced): event.setWidget(hoverEvent->widget()); | - |
| 1245 | event.setPos(item->d_ptr->genericMapFromScene(hoverEvent->scenePos(), hoverEvent->widget())); never executed (the execution status of this line is deduced): event.setPos(item->d_ptr->genericMapFromScene(hoverEvent->scenePos(), hoverEvent->widget())); | - |
| 1246 | event.setScenePos(hoverEvent->scenePos()); never executed (the execution status of this line is deduced): event.setScenePos(hoverEvent->scenePos()); | - |
| 1247 | event.setScreenPos(hoverEvent->screenPos()); never executed (the execution status of this line is deduced): event.setScreenPos(hoverEvent->screenPos()); | - |
| 1248 | event.setLastPos(item->d_ptr->genericMapFromScene(hoverEvent->lastScenePos(), hoverEvent->widget())); never executed (the execution status of this line is deduced): event.setLastPos(item->d_ptr->genericMapFromScene(hoverEvent->lastScenePos(), hoverEvent->widget())); | - |
| 1249 | event.setLastScenePos(hoverEvent->lastScenePos()); never executed (the execution status of this line is deduced): event.setLastScenePos(hoverEvent->lastScenePos()); | - |
| 1250 | event.setLastScreenPos(hoverEvent->lastScreenPos()); never executed (the execution status of this line is deduced): event.setLastScreenPos(hoverEvent->lastScreenPos()); | - |
| 1251 | event.setModifiers(hoverEvent->modifiers()); never executed (the execution status of this line is deduced): event.setModifiers(hoverEvent->modifiers()); | - |
| 1252 | sendEvent(item, &event); never executed (the execution status of this line is deduced): sendEvent(item, &event); | - |
| 1253 | } | 0 |
| 1254 | | - |
| 1255 | /*! | - |
| 1256 | \internal | - |
| 1257 | */ | - |
| 1258 | void QGraphicsScenePrivate::sendMouseEvent(QGraphicsSceneMouseEvent *mouseEvent) | - |
| 1259 | { | - |
| 1260 | if (mouseEvent->button() == 0 && mouseEvent->buttons() == 0 && lastMouseGrabberItemHasImplicitMouseGrab) { partially evaluated: mouseEvent->button() == 0| no Evaluation Count:0 | yes Evaluation Count:211 |
never evaluated: mouseEvent->buttons() == 0 never evaluated: lastMouseGrabberItemHasImplicitMouseGrab | 0-211 |
| 1261 | // ### This is a temporary fix for until we get proper mouse | - |
| 1262 | // grab events. | - |
| 1263 | clearMouseGrabber(); never executed (the execution status of this line is deduced): clearMouseGrabber(); | - |
| 1264 | return; | 0 |
| 1265 | } | - |
| 1266 | | - |
| 1267 | QGraphicsItem *item = mouseGrabberItems.last(); executed (the execution status of this line is deduced): QGraphicsItem *item = mouseGrabberItems.last(); | - |
| 1268 | if (item->isBlockedByModalPanel()) partially evaluated: item->isBlockedByModalPanel()| no Evaluation Count:0 | yes Evaluation Count:211 |
| 0-211 |
| 1269 | return; | 0 |
| 1270 | | - |
| 1271 | for (int i = 0x1; i <= 0x10; i <<= 1) { evaluated: i <= 0x10| yes Evaluation Count:1055 | yes Evaluation Count:211 |
| 211-1055 |
| 1272 | Qt::MouseButton button = Qt::MouseButton(i); executed (the execution status of this line is deduced): Qt::MouseButton button = Qt::MouseButton(i); | - |
| 1273 | mouseEvent->setButtonDownPos(button, mouseGrabberButtonDownPos.value(button, item->d_ptr->genericMapFromScene(mouseEvent->scenePos(), mouseEvent->widget()))); executed (the execution status of this line is deduced): mouseEvent->setButtonDownPos(button, mouseGrabberButtonDownPos.value(button, item->d_ptr->genericMapFromScene(mouseEvent->scenePos(), mouseEvent->widget()))); | - |
| 1274 | mouseEvent->setButtonDownScenePos(button, mouseGrabberButtonDownScenePos.value(button, mouseEvent->scenePos())); executed (the execution status of this line is deduced): mouseEvent->setButtonDownScenePos(button, mouseGrabberButtonDownScenePos.value(button, mouseEvent->scenePos())); | - |
| 1275 | mouseEvent->setButtonDownScreenPos(button, mouseGrabberButtonDownScreenPos.value(button, mouseEvent->screenPos())); executed (the execution status of this line is deduced): mouseEvent->setButtonDownScreenPos(button, mouseGrabberButtonDownScreenPos.value(button, mouseEvent->screenPos())); | - |
| 1276 | } executed: }Execution Count:1055 | 1055 |
| 1277 | mouseEvent->setPos(item->d_ptr->genericMapFromScene(mouseEvent->scenePos(), mouseEvent->widget())); executed (the execution status of this line is deduced): mouseEvent->setPos(item->d_ptr->genericMapFromScene(mouseEvent->scenePos(), mouseEvent->widget())); | - |
| 1278 | mouseEvent->setLastPos(item->d_ptr->genericMapFromScene(mouseEvent->lastScenePos(), mouseEvent->widget())); executed (the execution status of this line is deduced): mouseEvent->setLastPos(item->d_ptr->genericMapFromScene(mouseEvent->lastScenePos(), mouseEvent->widget())); | - |
| 1279 | sendEvent(item, mouseEvent); executed (the execution status of this line is deduced): sendEvent(item, mouseEvent); | - |
| 1280 | } executed: }Execution Count:211 | 211 |
| 1281 | | - |
| 1282 | /*! | - |
| 1283 | \internal | - |
| 1284 | */ | - |
| 1285 | void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mouseEvent) | - |
| 1286 | { | - |
| 1287 | Q_Q(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScene * const q = q_func(); | - |
| 1288 | | - |
| 1289 | // Ignore by default, unless we find a mouse grabber that accepts it. | - |
| 1290 | mouseEvent->ignore(); executed (the execution status of this line is deduced): mouseEvent->ignore(); | - |
| 1291 | | - |
| 1292 | // Deliver to any existing mouse grabber. | - |
| 1293 | if (!mouseGrabberItems.isEmpty()) { evaluated: !mouseGrabberItems.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:115 |
| 1-115 |
| 1294 | if (mouseGrabberItems.last()->isBlockedByModalPanel()) partially evaluated: mouseGrabberItems.last()->isBlockedByModalPanel()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1295 | return; | 0 |
| 1296 | // The event is ignored by default, but we disregard the event's | - |
| 1297 | // accepted state after delivery; the mouse is grabbed, after all. | - |
| 1298 | sendMouseEvent(mouseEvent); executed (the execution status of this line is deduced): sendMouseEvent(mouseEvent); | - |
| 1299 | return; executed: return;Execution Count:1 | 1 |
| 1300 | } | - |
| 1301 | | - |
| 1302 | // Start by determining the number of items at the current position. | - |
| 1303 | // Reuse value from earlier calculations if possible. | - |
| 1304 | if (cachedItemsUnderMouse.isEmpty()) { partially evaluated: cachedItemsUnderMouse.isEmpty()| yes Evaluation Count:115 | no Evaluation Count:0 |
| 0-115 |
| 1305 | cachedItemsUnderMouse = itemsAtPosition(mouseEvent->screenPos(), executed (the execution status of this line is deduced): cachedItemsUnderMouse = itemsAtPosition(mouseEvent->screenPos(), | - |
| 1306 | mouseEvent->scenePos(), executed (the execution status of this line is deduced): mouseEvent->scenePos(), | - |
| 1307 | mouseEvent->widget()); executed (the execution status of this line is deduced): mouseEvent->widget()); | - |
| 1308 | } executed: }Execution Count:115 | 115 |
| 1309 | | - |
| 1310 | // Update window activation. | - |
| 1311 | QGraphicsItem *topItem = cachedItemsUnderMouse.value(0); executed (the execution status of this line is deduced): QGraphicsItem *topItem = cachedItemsUnderMouse.value(0); | - |
| 1312 | QGraphicsWidget *newActiveWindow = topItem ? topItem->window() : 0; evaluated: topItem| yes Evaluation Count:105 | yes Evaluation Count:10 |
| 10-105 |
| 1313 | if (newActiveWindow && newActiveWindow->isBlockedByModalPanel(&topItem)) { partially evaluated: newActiveWindow| no Evaluation Count:0 | yes Evaluation Count:115 |
never evaluated: newActiveWindow->isBlockedByModalPanel(&topItem) | 0-115 |
| 1314 | // pass activation to the blocking modal window | - |
| 1315 | newActiveWindow = topItem ? topItem->window() : 0; | 0 |
| 1316 | } | 0 |
| 1317 | | - |
| 1318 | if (newActiveWindow != q->activeWindow()) partially evaluated: newActiveWindow != q->activeWindow()| no Evaluation Count:0 | yes Evaluation Count:115 |
| 0-115 |
| 1319 | q->setActiveWindow(newActiveWindow); never executed: q->setActiveWindow(newActiveWindow); | 0 |
| 1320 | | - |
| 1321 | // Set focus on the topmost enabled item that can take focus. | - |
| 1322 | bool setFocus = false; executed (the execution status of this line is deduced): bool setFocus = false; | - |
| 1323 | | - |
| 1324 | foreach (QGraphicsItem *item, cachedItemsUnderMouse) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(cachedItemsUnderMouse)> _container_(cachedItemsUnderMouse); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 1325 | if (item->isBlockedByModalPanel() partially evaluated: item->isBlockedByModalPanel()| no Evaluation Count:0 | yes Evaluation Count:107 |
| 0-107 |
| 1326 | || (item->d_ptr->flags & QGraphicsItem::ItemStopsFocusHandling)) { partially evaluated: (item->d_ptr->flags & QGraphicsItem::ItemStopsFocusHandling)| no Evaluation Count:0 | yes Evaluation Count:107 |
| 0-107 |
| 1327 | // Make sure we don't clear focus. | - |
| 1328 | setFocus = true; never executed (the execution status of this line is deduced): setFocus = true; | - |
| 1329 | break; | 0 |
| 1330 | } | - |
| 1331 | if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable))) { partially evaluated: item->isEnabled()| yes Evaluation Count:107 | no Evaluation Count:0 |
evaluated: ((item->flags() & QGraphicsItem::ItemIsFocusable))| yes Evaluation Count:1 | yes Evaluation Count:106 |
| 0-107 |
| 1332 | if (!item->isWidget() || ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus) { partially evaluated: !item->isWidget()| yes Evaluation Count:1 | no Evaluation Count:0 |
never evaluated: ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus | 0-1 |
| 1333 | setFocus = true; executed (the execution status of this line is deduced): setFocus = true; | - |
| 1334 | if (item != q->focusItem() && item->d_ptr->mouseSetsFocus) partially evaluated: item != q->focusItem()| no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: item->d_ptr->mouseSetsFocus | 0-1 |
| 1335 | q->setFocusItem(item, Qt::MouseFocusReason); never executed: q->setFocusItem(item, Qt::MouseFocusReason); | 0 |
| 1336 | break; executed: break;Execution Count:1 | 1 |
| 1337 | } | - |
| 1338 | } | 0 |
| 1339 | if (item->isPanel()) partially evaluated: item->isPanel()| no Evaluation Count:0 | yes Evaluation Count:106 |
| 0-106 |
| 1340 | break; | 0 |
| 1341 | if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation) partially evaluated: item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation| no Evaluation Count:0 | yes Evaluation Count:106 |
| 0-106 |
| 1342 | break; | 0 |
| 1343 | } executed: }Execution Count:106 | 106 |
| 1344 | | - |
| 1345 | // Check for scene modality. | - |
| 1346 | bool sceneModality = false; executed (the execution status of this line is deduced): bool sceneModality = false; | - |
| 1347 | for (int i = 0; i < modalPanels.size(); ++i) { partially evaluated: i < modalPanels.size()| no Evaluation Count:0 | yes Evaluation Count:115 |
| 0-115 |
| 1348 | if (modalPanels.at(i)->panelModality() == QGraphicsItem::SceneModal) { never evaluated: modalPanels.at(i)->panelModality() == QGraphicsItem::SceneModal | 0 |
| 1349 | sceneModality = true; never executed (the execution status of this line is deduced): sceneModality = true; | - |
| 1350 | break; | 0 |
| 1351 | } | - |
| 1352 | } | 0 |
| 1353 | | - |
| 1354 | // If nobody could take focus, clear it. | - |
| 1355 | if (!stickyFocus && !setFocus && !sceneModality) partially evaluated: !stickyFocus| yes Evaluation Count:115 | no Evaluation Count:0 |
evaluated: !setFocus| yes Evaluation Count:114 | yes Evaluation Count:1 |
partially evaluated: !sceneModality| yes Evaluation Count:114 | no Evaluation Count:0 |
| 0-115 |
| 1356 | q->setFocusItem(0, Qt::MouseFocusReason); executed: q->setFocusItem(0, Qt::MouseFocusReason);Execution Count:114 | 114 |
| 1357 | | - |
| 1358 | // Any item will do. | - |
| 1359 | if (sceneModality && cachedItemsUnderMouse.isEmpty()) partially evaluated: sceneModality| no Evaluation Count:0 | yes Evaluation Count:115 |
never evaluated: cachedItemsUnderMouse.isEmpty() | 0-115 |
| 1360 | cachedItemsUnderMouse << modalPanels.first(); never executed: cachedItemsUnderMouse << modalPanels.first(); | 0 |
| 1361 | | - |
| 1362 | // Find a mouse grabber by sending mouse press events to all mouse grabber | - |
| 1363 | // candidates one at a time, until the event is accepted. It's accepted by | - |
| 1364 | // default, so the receiver has to explicitly ignore it for it to pass | - |
| 1365 | // through. | - |
| 1366 | foreach (QGraphicsItem *item, cachedItemsUnderMouse) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(cachedItemsUnderMouse)> _container_(cachedItemsUnderMouse); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 1367 | if (!(item->acceptedMouseButtons() & mouseEvent->button())) { partially evaluated: !(item->acceptedMouseButtons() & mouseEvent->button())| no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
| 1368 | // Skip items that don't accept the event's mouse button. | - |
| 1369 | continue; never executed: continue; | 0 |
| 1370 | } | - |
| 1371 | | - |
| 1372 | // Check if this item is blocked by a modal panel and deliver the mouse event to the | - |
| 1373 | // blocking panel instead of this item if blocked. | - |
| 1374 | (void) item->isBlockedByModalPanel(&item); executed (the execution status of this line is deduced): (void) item->isBlockedByModalPanel(&item); | - |
| 1375 | | - |
| 1376 | grabMouse(item, /* implicit = */ true); executed (the execution status of this line is deduced): grabMouse(item, true); | - |
| 1377 | mouseEvent->accept(); executed (the execution status of this line is deduced): mouseEvent->accept(); | - |
| 1378 | | - |
| 1379 | // check if the item we are sending to are disabled (before we send the event) | - |
| 1380 | bool disabled = !item->isEnabled(); executed (the execution status of this line is deduced): bool disabled = !item->isEnabled(); | - |
| 1381 | bool isPanel = item->isPanel(); executed (the execution status of this line is deduced): bool isPanel = item->isPanel(); | - |
| 1382 | if (mouseEvent->type() == QEvent::GraphicsSceneMouseDoubleClick partially evaluated: mouseEvent->type() == QEvent::GraphicsSceneMouseDoubleClick| no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
| 1383 | && item != lastMouseGrabberItem && lastMouseGrabberItem) { never evaluated: item != lastMouseGrabberItem never evaluated: lastMouseGrabberItem | 0 |
| 1384 | // If this item is different from the item that received the last | - |
| 1385 | // mouse event, and mouseEvent is a doubleclick event, then the | - |
| 1386 | // event is converted to a press. Known limitation: | - |
| 1387 | // Triple-clicking will not generate a doubleclick, though. | - |
| 1388 | QGraphicsSceneMouseEvent mousePress(QEvent::GraphicsSceneMousePress); never executed (the execution status of this line is deduced): QGraphicsSceneMouseEvent mousePress(QEvent::GraphicsSceneMousePress); | - |
| 1389 | mousePress.spont = mouseEvent->spont; never executed (the execution status of this line is deduced): mousePress.spont = mouseEvent->spont; | - |
| 1390 | mousePress.accept(); never executed (the execution status of this line is deduced): mousePress.accept(); | - |
| 1391 | mousePress.setButton(mouseEvent->button()); never executed (the execution status of this line is deduced): mousePress.setButton(mouseEvent->button()); | - |
| 1392 | mousePress.setButtons(mouseEvent->buttons()); never executed (the execution status of this line is deduced): mousePress.setButtons(mouseEvent->buttons()); | - |
| 1393 | mousePress.setScreenPos(mouseEvent->screenPos()); never executed (the execution status of this line is deduced): mousePress.setScreenPos(mouseEvent->screenPos()); | - |
| 1394 | mousePress.setScenePos(mouseEvent->scenePos()); never executed (the execution status of this line is deduced): mousePress.setScenePos(mouseEvent->scenePos()); | - |
| 1395 | mousePress.setModifiers(mouseEvent->modifiers()); never executed (the execution status of this line is deduced): mousePress.setModifiers(mouseEvent->modifiers()); | - |
| 1396 | mousePress.setWidget(mouseEvent->widget()); never executed (the execution status of this line is deduced): mousePress.setWidget(mouseEvent->widget()); | - |
| 1397 | mousePress.setButtonDownPos(mouseEvent->button(), never executed (the execution status of this line is deduced): mousePress.setButtonDownPos(mouseEvent->button(), | - |
| 1398 | mouseEvent->buttonDownPos(mouseEvent->button())); never executed (the execution status of this line is deduced): mouseEvent->buttonDownPos(mouseEvent->button())); | - |
| 1399 | mousePress.setButtonDownScenePos(mouseEvent->button(), never executed (the execution status of this line is deduced): mousePress.setButtonDownScenePos(mouseEvent->button(), | - |
| 1400 | mouseEvent->buttonDownScenePos(mouseEvent->button())); never executed (the execution status of this line is deduced): mouseEvent->buttonDownScenePos(mouseEvent->button())); | - |
| 1401 | mousePress.setButtonDownScreenPos(mouseEvent->button(), never executed (the execution status of this line is deduced): mousePress.setButtonDownScreenPos(mouseEvent->button(), | - |
| 1402 | mouseEvent->buttonDownScreenPos(mouseEvent->button())); never executed (the execution status of this line is deduced): mouseEvent->buttonDownScreenPos(mouseEvent->button())); | - |
| 1403 | sendMouseEvent(&mousePress); never executed (the execution status of this line is deduced): sendMouseEvent(&mousePress); | - |
| 1404 | mouseEvent->setAccepted(mousePress.isAccepted()); never executed (the execution status of this line is deduced): mouseEvent->setAccepted(mousePress.isAccepted()); | - |
| 1405 | } else { | 0 |
| 1406 | sendMouseEvent(mouseEvent); executed (the execution status of this line is deduced): sendMouseEvent(mouseEvent); | - |
| 1407 | } executed: }Execution Count:105 | 105 |
| 1408 | | - |
| 1409 | bool dontSendUngrabEvents = mouseGrabberItems.isEmpty() || mouseGrabberItems.last() != item; partially evaluated: mouseGrabberItems.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:105 |
partially evaluated: mouseGrabberItems.last() != item| no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
| 1410 | if (disabled) { partially evaluated: disabled| no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
| 1411 | ungrabMouse(item, /* itemIsDying = */ dontSendUngrabEvents); never executed (the execution status of this line is deduced): ungrabMouse(item, dontSendUngrabEvents); | - |
| 1412 | break; | 0 |
| 1413 | } | - |
| 1414 | if (mouseEvent->isAccepted()) { partially evaluated: mouseEvent->isAccepted()| yes Evaluation Count:105 | no Evaluation Count:0 |
| 0-105 |
| 1415 | if (!mouseGrabberItems.isEmpty()) partially evaluated: !mouseGrabberItems.isEmpty()| yes Evaluation Count:105 | no Evaluation Count:0 |
| 0-105 |
| 1416 | storeMouseButtonsForMouseGrabber(mouseEvent); executed: storeMouseButtonsForMouseGrabber(mouseEvent);Execution Count:105 | 105 |
| 1417 | lastMouseGrabberItem = item; executed (the execution status of this line is deduced): lastMouseGrabberItem = item; | - |
| 1418 | return; executed: return;Execution Count:105 | 105 |
| 1419 | } | - |
| 1420 | ungrabMouse(item, /* itemIsDying = */ dontSendUngrabEvents); never executed (the execution status of this line is deduced): ungrabMouse(item, dontSendUngrabEvents); | - |
| 1421 | | - |
| 1422 | // Don't propagate through panels. | - |
| 1423 | if (isPanel) | 0 |
| 1424 | break; | 0 |
| 1425 | } | 0 |
| 1426 | | - |
| 1427 | // Is the event still ignored? Then the mouse press goes to the scene. | - |
| 1428 | // Reset the mouse grabber, clear the selection, clear focus, and leave | - |
| 1429 | // the event ignored so that it can propagate through the originating | - |
| 1430 | // view. | - |
| 1431 | if (!mouseEvent->isAccepted()) { partially evaluated: !mouseEvent->isAccepted()| yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
| 1432 | clearMouseGrabber(); executed (the execution status of this line is deduced): clearMouseGrabber(); | - |
| 1433 | | - |
| 1434 | QGraphicsView *view = mouseEvent->widget() ? qobject_cast<QGraphicsView *>(mouseEvent->widget()->parentWidget()) : 0; partially evaluated: mouseEvent->widget()| yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
| 1435 | bool dontClearSelection = view && view->dragMode() == QGraphicsView::ScrollHandDrag; partially evaluated: view| yes Evaluation Count:10 | no Evaluation Count:0 |
evaluated: view->dragMode() == QGraphicsView::ScrollHandDrag| yes Evaluation Count:3 | yes Evaluation Count:7 |
| 0-10 |
| 1436 | if (!dontClearSelection) { evaluated: !dontClearSelection| yes Evaluation Count:7 | yes Evaluation Count:3 |
| 3-7 |
| 1437 | // Clear the selection if the originating view isn't in scroll | - |
| 1438 | // hand drag mode. The view will clear the selection if no drag | - |
| 1439 | // happened. | - |
| 1440 | q->clearSelection(); executed (the execution status of this line is deduced): q->clearSelection(); | - |
| 1441 | } executed: }Execution Count:7 | 7 |
| 1442 | } executed: }Execution Count:10 | 10 |
| 1443 | } executed: }Execution Count:10 | 10 |
| 1444 | | - |
| 1445 | /*! | - |
| 1446 | \internal | - |
| 1447 | | - |
| 1448 | Ensures that the list of toplevels is sorted by insertion order, and that | - |
| 1449 | the siblingIndexes are packed (no gaps), and start at 0. | - |
| 1450 | | - |
| 1451 | ### This function is almost identical to | - |
| 1452 | QGraphicsItemPrivate::ensureSequentialSiblingIndex(). | - |
| 1453 | */ | - |
| 1454 | void QGraphicsScenePrivate::ensureSequentialTopLevelSiblingIndexes() | - |
| 1455 | { | - |
| 1456 | if (!topLevelSequentialOrdering) { never evaluated: !topLevelSequentialOrdering | 0 |
| 1457 | std::sort(topLevelItems.begin(), topLevelItems.end(), QGraphicsItemPrivate::insertionOrder); never executed (the execution status of this line is deduced): std::sort(topLevelItems.begin(), topLevelItems.end(), QGraphicsItemPrivate::insertionOrder); | - |
| 1458 | topLevelSequentialOrdering = true; never executed (the execution status of this line is deduced): topLevelSequentialOrdering = true; | - |
| 1459 | needSortTopLevelItems = 1; never executed (the execution status of this line is deduced): needSortTopLevelItems = 1; | - |
| 1460 | } | 0 |
| 1461 | if (holesInTopLevelSiblingIndex) { never evaluated: holesInTopLevelSiblingIndex | 0 |
| 1462 | holesInTopLevelSiblingIndex = 0; never executed (the execution status of this line is deduced): holesInTopLevelSiblingIndex = 0; | - |
| 1463 | for (int i = 0; i < topLevelItems.size(); ++i) never evaluated: i < topLevelItems.size() | 0 |
| 1464 | topLevelItems[i]->d_ptr->siblingIndex = i; never executed: topLevelItems[i]->d_ptr->siblingIndex = i; | 0 |
| 1465 | } | 0 |
| 1466 | } | 0 |
| 1467 | | - |
| 1468 | /*! | - |
| 1469 | \internal | - |
| 1470 | | - |
| 1471 | Set the font and propagate the changes if the font is different from the | - |
| 1472 | current font. | - |
| 1473 | */ | - |
| 1474 | void QGraphicsScenePrivate::setFont_helper(const QFont &font) | - |
| 1475 | { | - |
| 1476 | if (this->font == font && this->font.resolve() == font.resolve()) never evaluated: this->font == font never evaluated: this->font.resolve() == font.resolve() | 0 |
| 1477 | return; | 0 |
| 1478 | updateFont(font); never executed (the execution status of this line is deduced): updateFont(font); | - |
| 1479 | } | 0 |
| 1480 | | - |
| 1481 | /*! | - |
| 1482 | \internal | - |
| 1483 | | - |
| 1484 | Resolve the scene's font against the application font, and propagate the | - |
| 1485 | changes too all items in the scene. | - |
| 1486 | */ | - |
| 1487 | void QGraphicsScenePrivate::resolveFont() | - |
| 1488 | { | - |
| 1489 | QFont naturalFont = QApplication::font(); never executed (the execution status of this line is deduced): QFont naturalFont = QApplication::font(); | - |
| 1490 | naturalFont.resolve(0); never executed (the execution status of this line is deduced): naturalFont.resolve(0); | - |
| 1491 | QFont resolvedFont = font.resolve(naturalFont); never executed (the execution status of this line is deduced): QFont resolvedFont = font.resolve(naturalFont); | - |
| 1492 | updateFont(resolvedFont); never executed (the execution status of this line is deduced): updateFont(resolvedFont); | - |
| 1493 | } | 0 |
| 1494 | | - |
| 1495 | /*! | - |
| 1496 | \internal | - |
| 1497 | | - |
| 1498 | Update the font, and whether or not it has changed, reresolve all fonts in | - |
| 1499 | the scene. | - |
| 1500 | */ | - |
| 1501 | void QGraphicsScenePrivate::updateFont(const QFont &font) | - |
| 1502 | { | - |
| 1503 | Q_Q(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScene * const q = q_func(); | - |
| 1504 | | - |
| 1505 | // Update local font setting. | - |
| 1506 | this->font = font; never executed (the execution status of this line is deduced): this->font = font; | - |
| 1507 | | - |
| 1508 | // Resolve the fonts of all top-level widget items, or widget items | - |
| 1509 | // whose parent is not a widget. | - |
| 1510 | foreach (QGraphicsItem *item, q->items()) { never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(q->items())> _container_(q->items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 1511 | if (!item->parentItem()) { never evaluated: !item->parentItem() | 0 |
| 1512 | // Resolvefont for an item is a noop operation, but | - |
| 1513 | // every item can be a widget, or can have a widget | - |
| 1514 | // childre. | - |
| 1515 | item->d_ptr->resolveFont(font.resolve()); never executed (the execution status of this line is deduced): item->d_ptr->resolveFont(font.resolve()); | - |
| 1516 | } | 0 |
| 1517 | } | 0 |
| 1518 | | - |
| 1519 | // Send the scene a FontChange event. | - |
| 1520 | QEvent event(QEvent::FontChange); never executed (the execution status of this line is deduced): QEvent event(QEvent::FontChange); | - |
| 1521 | QApplication::sendEvent(q, &event); never executed (the execution status of this line is deduced): QApplication::sendEvent(q, &event); | - |
| 1522 | } | 0 |
| 1523 | | - |
| 1524 | /*! | - |
| 1525 | \internal | - |
| 1526 | | - |
| 1527 | Set the palette and propagate the changes if the palette is different from | - |
| 1528 | the current palette. | - |
| 1529 | */ | - |
| 1530 | void QGraphicsScenePrivate::setPalette_helper(const QPalette &palette) | - |
| 1531 | { | - |
| 1532 | if (this->palette == palette && this->palette.resolve() == palette.resolve()) never evaluated: this->palette == palette never evaluated: this->palette.resolve() == palette.resolve() | 0 |
| 1533 | return; | 0 |
| 1534 | updatePalette(palette); never executed (the execution status of this line is deduced): updatePalette(palette); | - |
| 1535 | } | 0 |
| 1536 | | - |
| 1537 | /*! | - |
| 1538 | \internal | - |
| 1539 | | - |
| 1540 | Resolve the scene's palette against the application palette, and propagate | - |
| 1541 | the changes too all items in the scene. | - |
| 1542 | */ | - |
| 1543 | void QGraphicsScenePrivate::resolvePalette() | - |
| 1544 | { | - |
| 1545 | QPalette naturalPalette = QApplication::palette(); never executed (the execution status of this line is deduced): QPalette naturalPalette = QApplication::palette(); | - |
| 1546 | naturalPalette.resolve(0); never executed (the execution status of this line is deduced): naturalPalette.resolve(0); | - |
| 1547 | QPalette resolvedPalette = palette.resolve(naturalPalette); never executed (the execution status of this line is deduced): QPalette resolvedPalette = palette.resolve(naturalPalette); | - |
| 1548 | updatePalette(resolvedPalette); never executed (the execution status of this line is deduced): updatePalette(resolvedPalette); | - |
| 1549 | } | 0 |
| 1550 | | - |
| 1551 | /*! | - |
| 1552 | \internal | - |
| 1553 | | - |
| 1554 | Update the palette, and whether or not it has changed, reresolve all | - |
| 1555 | palettes in the scene. | - |
| 1556 | */ | - |
| 1557 | void QGraphicsScenePrivate::updatePalette(const QPalette &palette) | - |
| 1558 | { | - |
| 1559 | Q_Q(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScene * const q = q_func(); | - |
| 1560 | | - |
| 1561 | // Update local palette setting. | - |
| 1562 | this->palette = palette; never executed (the execution status of this line is deduced): this->palette = palette; | - |
| 1563 | | - |
| 1564 | // Resolve the palettes of all top-level widget items, or widget items | - |
| 1565 | // whose parent is not a widget. | - |
| 1566 | foreach (QGraphicsItem *item, q->items()) { never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(q->items())> _container_(q->items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 1567 | if (!item->parentItem()) { never evaluated: !item->parentItem() | 0 |
| 1568 | // Resolvefont for an item is a noop operation, but | - |
| 1569 | // every item can be a widget, or can have a widget | - |
| 1570 | // childre. | - |
| 1571 | item->d_ptr->resolvePalette(palette.resolve()); never executed (the execution status of this line is deduced): item->d_ptr->resolvePalette(palette.resolve()); | - |
| 1572 | } | 0 |
| 1573 | } | 0 |
| 1574 | | - |
| 1575 | // Send the scene a PaletteChange event. | - |
| 1576 | QEvent event(QEvent::PaletteChange); never executed (the execution status of this line is deduced): QEvent event(QEvent::PaletteChange); | - |
| 1577 | QApplication::sendEvent(q, &event); never executed (the execution status of this line is deduced): QApplication::sendEvent(q, &event); | - |
| 1578 | } | 0 |
| 1579 | | - |
| 1580 | /*! | - |
| 1581 | Constructs a QGraphicsScene object. The \a parent parameter is | - |
| 1582 | passed to QObject's constructor. | - |
| 1583 | */ | - |
| 1584 | QGraphicsScene::QGraphicsScene(QObject *parent) | - |
| 1585 | : QObject(*new QGraphicsScenePrivate, parent) | - |
| 1586 | { | - |
| 1587 | d_func()->init(); executed (the execution status of this line is deduced): d_func()->init(); | - |
| 1588 | } executed: }Execution Count:723 | 723 |
| 1589 | | - |
| 1590 | /*! | - |
| 1591 | Constructs a QGraphicsScene object, using \a sceneRect for its | - |
| 1592 | scene rectangle. The \a parent parameter is passed to QObject's | - |
| 1593 | constructor. | - |
| 1594 | | - |
| 1595 | \sa sceneRect | - |
| 1596 | */ | - |
| 1597 | QGraphicsScene::QGraphicsScene(const QRectF &sceneRect, QObject *parent) | - |
| 1598 | : QObject(*new QGraphicsScenePrivate, parent) | - |
| 1599 | { | - |
| 1600 | d_func()->init(); executed (the execution status of this line is deduced): d_func()->init(); | - |
| 1601 | setSceneRect(sceneRect); executed (the execution status of this line is deduced): setSceneRect(sceneRect); | - |
| 1602 | } executed: }Execution Count:1 | 1 |
| 1603 | | - |
| 1604 | /*! | - |
| 1605 | Constructs a QGraphicsScene object, using the rectangle specified | - |
| 1606 | by (\a x, \a y), and the given \a width and \a height for its | - |
| 1607 | scene rectangle. The \a parent parameter is passed to QObject's | - |
| 1608 | constructor. | - |
| 1609 | | - |
| 1610 | \sa sceneRect | - |
| 1611 | */ | - |
| 1612 | QGraphicsScene::QGraphicsScene(qreal x, qreal y, qreal width, qreal height, QObject *parent) | - |
| 1613 | : QObject(*new QGraphicsScenePrivate, parent) | - |
| 1614 | { | - |
| 1615 | d_func()->init(); executed (the execution status of this line is deduced): d_func()->init(); | - |
| 1616 | setSceneRect(x, y, width, height); executed (the execution status of this line is deduced): setSceneRect(x, y, width, height); | - |
| 1617 | } executed: }Execution Count:74 | 74 |
| 1618 | | - |
| 1619 | /*! | - |
| 1620 | Removes and deletes all items from the scene object | - |
| 1621 | before destroying the scene object. The scene object | - |
| 1622 | is removed from the application's global scene list, | - |
| 1623 | and it is removed from all associated views. | - |
| 1624 | */ | - |
| 1625 | QGraphicsScene::~QGraphicsScene() | - |
| 1626 | { | - |
| 1627 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 1628 | | - |
| 1629 | // Remove this scene from qApp's global scene list. | - |
| 1630 | if (!QApplicationPrivate::is_app_closing) partially evaluated: !QApplicationPrivate::is_app_closing| yes Evaluation Count:779 | no Evaluation Count:0 |
| 0-779 |
| 1631 | qApp->d_func()->scene_list.removeAll(this); executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->scene_list.removeAll(this);Execution Count:779 | 779 |
| 1632 | | - |
| 1633 | clear(); executed (the execution status of this line is deduced): clear(); | - |
| 1634 | | - |
| 1635 | // Remove this scene from all associated views. | - |
| 1636 | for (int j = 0; j < d->views.size(); ++j) evaluated: j < d->views.size()| yes Evaluation Count:15 | yes Evaluation Count:779 |
| 15-779 |
| 1637 | d->views.at(j)->setScene(0); executed: d->views.at(j)->setScene(0);Execution Count:15 | 15 |
| 1638 | } executed: }Execution Count:779 | 779 |
| 1639 | | - |
| 1640 | /*! | - |
| 1641 | \property QGraphicsScene::sceneRect | - |
| 1642 | \brief the scene rectangle; the bounding rectangle of the scene | - |
| 1643 | | - |
| 1644 | The scene rectangle defines the extent of the scene. It is | - |
| 1645 | primarily used by QGraphicsView to determine the view's default | - |
| 1646 | scrollable area, and by QGraphicsScene to manage item indexing. | - |
| 1647 | | - |
| 1648 | If unset, or if set to a null QRectF, sceneRect() will return the largest | - |
| 1649 | bounding rect of all items on the scene since the scene was created (i.e., | - |
| 1650 | a rectangle that grows when items are added to or moved in the scene, but | - |
| 1651 | never shrinks). | - |
| 1652 | | - |
| 1653 | \sa width(), height(), QGraphicsView::sceneRect | - |
| 1654 | */ | - |
| 1655 | QRectF QGraphicsScene::sceneRect() const | - |
| 1656 | { | - |
| 1657 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 1658 | if (d->hasSceneRect) evaluated: d->hasSceneRect| yes Evaluation Count:753 | yes Evaluation Count:3813 |
| 753-3813 |
| 1659 | return d->sceneRect; executed: return d->sceneRect;Execution Count:753 | 753 |
| 1660 | | - |
| 1661 | if (d->dirtyGrowingItemsBoundingRect) { evaluated: d->dirtyGrowingItemsBoundingRect| yes Evaluation Count:973 | yes Evaluation Count:2840 |
| 973-2840 |
| 1662 | // Lazily update the growing items bounding rect | - |
| 1663 | QGraphicsScenePrivate *thatd = const_cast<QGraphicsScenePrivate *>(d); executed (the execution status of this line is deduced): QGraphicsScenePrivate *thatd = const_cast<QGraphicsScenePrivate *>(d); | - |
| 1664 | QRectF oldGrowingBoundingRect = thatd->growingItemsBoundingRect; executed (the execution status of this line is deduced): QRectF oldGrowingBoundingRect = thatd->growingItemsBoundingRect; | - |
| 1665 | thatd->growingItemsBoundingRect |= itemsBoundingRect(); executed (the execution status of this line is deduced): thatd->growingItemsBoundingRect |= itemsBoundingRect(); | - |
| 1666 | thatd->dirtyGrowingItemsBoundingRect = false; executed (the execution status of this line is deduced): thatd->dirtyGrowingItemsBoundingRect = false; | - |
| 1667 | if (oldGrowingBoundingRect != thatd->growingItemsBoundingRect) evaluated: oldGrowingBoundingRect != thatd->growingItemsBoundingRect| yes Evaluation Count:230 | yes Evaluation Count:743 |
| 230-743 |
| 1668 | emit const_cast<QGraphicsScene *>(this)->sceneRectChanged(thatd->growingItemsBoundingRect); executed: const_cast<QGraphicsScene *>(this)->sceneRectChanged(thatd->growingItemsBoundingRect);Execution Count:230 | 230 |
| 1669 | } executed: }Execution Count:973 | 973 |
| 1670 | return d->growingItemsBoundingRect; executed: return d->growingItemsBoundingRect;Execution Count:3813 | 3813 |
| 1671 | } | - |
| 1672 | void QGraphicsScene::setSceneRect(const QRectF &rect) | - |
| 1673 | { | - |
| 1674 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 1675 | if (rect != d->sceneRect) { partially evaluated: rect != d->sceneRect| yes Evaluation Count:470 | no Evaluation Count:0 |
| 0-470 |
| 1676 | d->hasSceneRect = !rect.isNull(); executed (the execution status of this line is deduced): d->hasSceneRect = !rect.isNull(); | - |
| 1677 | d->sceneRect = rect; executed (the execution status of this line is deduced): d->sceneRect = rect; | - |
| 1678 | emit sceneRectChanged(d->hasSceneRect ? rect : d->growingItemsBoundingRect); executed (the execution status of this line is deduced): sceneRectChanged(d->hasSceneRect ? rect : d->growingItemsBoundingRect); | - |
| 1679 | } executed: }Execution Count:470 | 470 |
| 1680 | } executed: }Execution Count:470 | 470 |
| 1681 | | - |
| 1682 | /*! | - |
| 1683 | \fn qreal QGraphicsScene::width() const | - |
| 1684 | | - |
| 1685 | This convenience function is equivalent to calling sceneRect().width(). | - |
| 1686 | | - |
| 1687 | \sa height() | - |
| 1688 | */ | - |
| 1689 | | - |
| 1690 | /*! | - |
| 1691 | \fn qreal QGraphicsScene::height() const | - |
| 1692 | | - |
| 1693 | This convenience function is equivalent to calling \c sceneRect().height(). | - |
| 1694 | | - |
| 1695 | \sa width() | - |
| 1696 | */ | - |
| 1697 | | - |
| 1698 | /*! | - |
| 1699 | Renders the \a source rect from scene into \a target, using \a painter. This | - |
| 1700 | function is useful for capturing the contents of the scene onto a paint | - |
| 1701 | device, such as a QImage (e.g., to take a screenshot), or for printing | - |
| 1702 | with QPrinter. For example: | - |
| 1703 | | - |
| 1704 | \snippet code/src_gui_graphicsview_qgraphicsscene.cpp 1 | - |
| 1705 | | - |
| 1706 | If \a source is a null rect, this function will use sceneRect() to | - |
| 1707 | determine what to render. If \a target is a null rect, the dimensions of \a | - |
| 1708 | painter's paint device will be used. | - |
| 1709 | | - |
| 1710 | The source rect contents will be transformed according to \a | - |
| 1711 | aspectRatioMode to fit into the target rect. By default, the aspect ratio | - |
| 1712 | is kept, and \a source is scaled to fit in \a target. | - |
| 1713 | | - |
| 1714 | \sa QGraphicsView::render() | - |
| 1715 | */ | - |
| 1716 | void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRectF &source, | - |
| 1717 | Qt::AspectRatioMode aspectRatioMode) | - |
| 1718 | { | - |
| 1719 | // ### Switch to using the recursive rendering algorithm instead. | - |
| 1720 | | - |
| 1721 | // Default source rect = scene rect | - |
| 1722 | QRectF sourceRect = source; executed (the execution status of this line is deduced): QRectF sourceRect = source; | - |
| 1723 | if (sourceRect.isNull()) evaluated: sourceRect.isNull()| yes Evaluation Count:8 | yes Evaluation Count:7 |
| 7-8 |
| 1724 | sourceRect = sceneRect(); executed: sourceRect = sceneRect();Execution Count:8 | 8 |
| 1725 | | - |
| 1726 | // Default target rect = device rect | - |
| 1727 | QRectF targetRect = target; executed (the execution status of this line is deduced): QRectF targetRect = target; | - |
| 1728 | if (targetRect.isNull()) { evaluated: targetRect.isNull()| yes Evaluation Count:8 | yes Evaluation Count:7 |
| 7-8 |
| 1729 | if (painter->device()->devType() == QInternal::Picture) partially evaluated: painter->device()->devType() == QInternal::Picture| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 1730 | targetRect = sourceRect; never executed: targetRect = sourceRect; | 0 |
| 1731 | else | - |
| 1732 | targetRect.setRect(0, 0, painter->device()->width(), painter->device()->height()); executed: targetRect.setRect(0, 0, painter->device()->width(), painter->device()->height());Execution Count:8 | 8 |
| 1733 | } | - |
| 1734 | | - |
| 1735 | // Find the ideal x / y scaling ratio to fit \a source into \a target. | - |
| 1736 | qreal xratio = targetRect.width() / sourceRect.width(); executed (the execution status of this line is deduced): qreal xratio = targetRect.width() / sourceRect.width(); | - |
| 1737 | qreal yratio = targetRect.height() / sourceRect.height(); executed (the execution status of this line is deduced): qreal yratio = targetRect.height() / sourceRect.height(); | - |
| 1738 | | - |
| 1739 | // Scale according to the aspect ratio mode. | - |
| 1740 | switch (aspectRatioMode) { | - |
| 1741 | case Qt::KeepAspectRatio: | - |
| 1742 | xratio = yratio = qMin(xratio, yratio); executed (the execution status of this line is deduced): xratio = yratio = qMin(xratio, yratio); | - |
| 1743 | break; executed: break;Execution Count:15 | 15 |
| 1744 | case Qt::KeepAspectRatioByExpanding: | - |
| 1745 | xratio = yratio = qMax(xratio, yratio); never executed (the execution status of this line is deduced): xratio = yratio = qMax(xratio, yratio); | - |
| 1746 | break; | 0 |
| 1747 | case Qt::IgnoreAspectRatio: | - |
| 1748 | break; | 0 |
| 1749 | } | - |
| 1750 | | - |
| 1751 | // Find all items to draw, and reverse the list (we want to draw | - |
| 1752 | // in reverse order). | - |
| 1753 | QList<QGraphicsItem *> itemList = items(sourceRect, Qt::IntersectsItemBoundingRect); executed (the execution status of this line is deduced): QList<QGraphicsItem *> itemList = items(sourceRect, Qt::IntersectsItemBoundingRect); | - |
| 1754 | QGraphicsItem **itemArray = new QGraphicsItem *[itemList.size()]; executed (the execution status of this line is deduced): QGraphicsItem **itemArray = new QGraphicsItem *[itemList.size()]; | - |
| 1755 | int numItems = itemList.size(); executed (the execution status of this line is deduced): int numItems = itemList.size(); | - |
| 1756 | for (int i = 0; i < numItems; ++i) evaluated: i < numItems| yes Evaluation Count:23 | yes Evaluation Count:15 |
| 15-23 |
| 1757 | itemArray[numItems - i - 1] = itemList.at(i); executed: itemArray[numItems - i - 1] = itemList.at(i);Execution Count:23 | 23 |
| 1758 | itemList.clear(); executed (the execution status of this line is deduced): itemList.clear(); | - |
| 1759 | | - |
| 1760 | painter->save(); executed (the execution status of this line is deduced): painter->save(); | - |
| 1761 | | - |
| 1762 | // Transform the painter. | - |
| 1763 | painter->setClipRect(targetRect, Qt::IntersectClip); executed (the execution status of this line is deduced): painter->setClipRect(targetRect, Qt::IntersectClip); | - |
| 1764 | QTransform painterTransform; executed (the execution status of this line is deduced): QTransform painterTransform; | - |
| 1765 | painterTransform *= QTransform() executed (the execution status of this line is deduced): painterTransform *= QTransform() | - |
| 1766 | .translate(targetRect.left(), targetRect.top()) executed (the execution status of this line is deduced): .translate(targetRect.left(), targetRect.top()) | - |
| 1767 | .scale(xratio, yratio) executed (the execution status of this line is deduced): .scale(xratio, yratio) | - |
| 1768 | .translate(-sourceRect.left(), -sourceRect.top()); executed (the execution status of this line is deduced): .translate(-sourceRect.left(), -sourceRect.top()); | - |
| 1769 | painter->setWorldTransform(painterTransform, true); executed (the execution status of this line is deduced): painter->setWorldTransform(painterTransform, true); | - |
| 1770 | | - |
| 1771 | // Two unit vectors. | - |
| 1772 | QLineF v1(0, 0, 1, 0); executed (the execution status of this line is deduced): QLineF v1(0, 0, 1, 0); | - |
| 1773 | QLineF v2(0, 0, 0, 1); executed (the execution status of this line is deduced): QLineF v2(0, 0, 0, 1); | - |
| 1774 | | - |
| 1775 | // Generate the style options | - |
| 1776 | QStyleOptionGraphicsItem *styleOptionArray = new QStyleOptionGraphicsItem[numItems]; executed (the execution status of this line is deduced): QStyleOptionGraphicsItem *styleOptionArray = new QStyleOptionGraphicsItem[numItems]; | - |
| 1777 | for (int i = 0; i < numItems; ++i) evaluated: i < numItems| yes Evaluation Count:23 | yes Evaluation Count:15 |
| 15-23 |
| 1778 | itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], painterTransform, targetRect.toRect()); executed: itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], painterTransform, targetRect.toRect());Execution Count:23 | 23 |
| 1779 | | - |
| 1780 | // Render the scene. | - |
| 1781 | drawBackground(painter, sourceRect); executed (the execution status of this line is deduced): drawBackground(painter, sourceRect); | - |
| 1782 | drawItems(painter, numItems, itemArray, styleOptionArray); executed (the execution status of this line is deduced): drawItems(painter, numItems, itemArray, styleOptionArray); | - |
| 1783 | drawForeground(painter, sourceRect); executed (the execution status of this line is deduced): drawForeground(painter, sourceRect); | - |
| 1784 | | - |
| 1785 | delete [] itemArray; executed (the execution status of this line is deduced): delete [] itemArray; | - |
| 1786 | delete [] styleOptionArray; executed (the execution status of this line is deduced): delete [] styleOptionArray; | - |
| 1787 | | - |
| 1788 | painter->restore(); executed (the execution status of this line is deduced): painter->restore(); | - |
| 1789 | } executed: }Execution Count:15 | 15 |
| 1790 | | - |
| 1791 | /*! | - |
| 1792 | \property QGraphicsScene::itemIndexMethod | - |
| 1793 | \brief the item indexing method. | - |
| 1794 | | - |
| 1795 | QGraphicsScene applies an indexing algorithm to the scene, to speed up | - |
| 1796 | item discovery functions like items() and itemAt(). Indexing is most | - |
| 1797 | efficient for static scenes (i.e., where items don't move around). For | - |
| 1798 | dynamic scenes, or scenes with many animated items, the index bookkeeping | - |
| 1799 | can outweight the fast lookup speeds. | - |
| 1800 | | - |
| 1801 | For the common case, the default index method BspTreeIndex works fine. If | - |
| 1802 | your scene uses many animations and you are experiencing slowness, you can | - |
| 1803 | disable indexing by calling \c setItemIndexMethod(NoIndex). | - |
| 1804 | | - |
| 1805 | \sa bspTreeDepth | - |
| 1806 | */ | - |
| 1807 | QGraphicsScene::ItemIndexMethod QGraphicsScene::itemIndexMethod() const | - |
| 1808 | { | - |
| 1809 | Q_D(const QGraphicsScene); never executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 1810 | return d->indexMethod; never executed: return d->indexMethod; | 0 |
| 1811 | } | - |
| 1812 | void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) | - |
| 1813 | { | - |
| 1814 | Q_D(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 1815 | if (d->indexMethod == method) never evaluated: d->indexMethod == method | 0 |
| 1816 | return; | 0 |
| 1817 | | - |
| 1818 | d->indexMethod = method; never executed (the execution status of this line is deduced): d->indexMethod = method; | - |
| 1819 | | - |
| 1820 | QList<QGraphicsItem *> oldItems = d->index->items(Qt::DescendingOrder); never executed (the execution status of this line is deduced): QList<QGraphicsItem *> oldItems = d->index->items(Qt::DescendingOrder); | - |
| 1821 | delete d->index; never executed (the execution status of this line is deduced): delete d->index; | - |
| 1822 | if (method == BspTreeIndex) never evaluated: method == BspTreeIndex | 0 |
| 1823 | d->index = new QGraphicsSceneBspTreeIndex(this); never executed: d->index = new QGraphicsSceneBspTreeIndex(this); | 0 |
| 1824 | else | - |
| 1825 | d->index = new QGraphicsSceneLinearIndex(this); never executed: d->index = new QGraphicsSceneLinearIndex(this); | 0 |
| 1826 | for (int i = oldItems.size() - 1; i >= 0; --i) | 0 |
| 1827 | d->index->addItem(oldItems.at(i)); never executed: d->index->addItem(oldItems.at(i)); | 0 |
| 1828 | } | 0 |
| 1829 | | - |
| 1830 | /*! | - |
| 1831 | \property QGraphicsScene::bspTreeDepth | - |
| 1832 | \brief the depth of QGraphicsScene's BSP index tree | - |
| 1833 | \since 4.3 | - |
| 1834 | | - |
| 1835 | This property has no effect when NoIndex is used. | - |
| 1836 | | - |
| 1837 | This value determines the depth of QGraphicsScene's BSP tree. The depth | - |
| 1838 | directly affects QGraphicsScene's performance and memory usage; the latter | - |
| 1839 | growing exponentially with the depth of the tree. With an optimal tree | - |
| 1840 | depth, QGraphicsScene can instantly determine the locality of items, even | - |
| 1841 | for scenes with thousands or millions of items. This also greatly improves | - |
| 1842 | rendering performance. | - |
| 1843 | | - |
| 1844 | By default, the value is 0, in which case Qt will guess a reasonable | - |
| 1845 | default depth based on the size, location and number of items in the | - |
| 1846 | scene. If these parameters change frequently, however, you may experience | - |
| 1847 | slowdowns as QGraphicsScene retunes the depth internally. You can avoid | - |
| 1848 | potential slowdowns by fixating the tree depth through setting this | - |
| 1849 | property. | - |
| 1850 | | - |
| 1851 | The depth of the tree and the size of the scene rectangle decide the | - |
| 1852 | granularity of the scene's partitioning. The size of each scene segment is | - |
| 1853 | determined by the following algorithm: | - |
| 1854 | | - |
| 1855 | \snippet code/src_gui_graphicsview_qgraphicsscene.cpp 2 | - |
| 1856 | | - |
| 1857 | The BSP tree has an optimal size when each segment contains between 0 and | - |
| 1858 | 10 items. | - |
| 1859 | | - |
| 1860 | \sa itemIndexMethod | - |
| 1861 | */ | - |
| 1862 | int QGraphicsScene::bspTreeDepth() const | - |
| 1863 | { | - |
| 1864 | Q_D(const QGraphicsScene); never executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 1865 | QGraphicsSceneBspTreeIndex *bspTree = qobject_cast<QGraphicsSceneBspTreeIndex *>(d->index); never executed (the execution status of this line is deduced): QGraphicsSceneBspTreeIndex *bspTree = qobject_cast<QGraphicsSceneBspTreeIndex *>(d->index); | - |
| 1866 | return bspTree ? bspTree->bspTreeDepth() : 0; never executed: return bspTree ? bspTree->bspTreeDepth() : 0; | 0 |
| 1867 | } | - |
| 1868 | void QGraphicsScene::setBspTreeDepth(int depth) | - |
| 1869 | { | - |
| 1870 | Q_D(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 1871 | if (depth < 0) { never evaluated: depth < 0 | 0 |
| 1872 | qWarning("QGraphicsScene::setBspTreeDepth: invalid depth %d ignored; must be >= 0", depth); never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsscene.cpp", 1872, __PRETTY_FUNCTION__).warning("QGraphicsScene::setBspTreeDepth: invalid depth %d ignored; must be >= 0", depth); | - |
| 1873 | return; | 0 |
| 1874 | } | - |
| 1875 | | - |
| 1876 | QGraphicsSceneBspTreeIndex *bspTree = qobject_cast<QGraphicsSceneBspTreeIndex *>(d->index); never executed (the execution status of this line is deduced): QGraphicsSceneBspTreeIndex *bspTree = qobject_cast<QGraphicsSceneBspTreeIndex *>(d->index); | - |
| 1877 | if (!bspTree) { never evaluated: !bspTree | 0 |
| 1878 | qWarning("QGraphicsScene::setBspTreeDepth: can not apply if indexing method is not BSP"); never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsscene.cpp", 1878, __PRETTY_FUNCTION__).warning("QGraphicsScene::setBspTreeDepth: can not apply if indexing method is not BSP"); | - |
| 1879 | return; | 0 |
| 1880 | } | - |
| 1881 | bspTree->setBspTreeDepth(depth); never executed (the execution status of this line is deduced): bspTree->setBspTreeDepth(depth); | - |
| 1882 | } | 0 |
| 1883 | | - |
| 1884 | /*! | - |
| 1885 | \property QGraphicsScene::sortCacheEnabled | - |
| 1886 | \brief whether sort caching is enabled | - |
| 1887 | \since 4.5 | - |
| 1888 | \obsolete | - |
| 1889 | | - |
| 1890 | Since Qt 4.6, this property has no effect. | - |
| 1891 | */ | - |
| 1892 | bool QGraphicsScene::isSortCacheEnabled() const | - |
| 1893 | { | - |
| 1894 | Q_D(const QGraphicsScene); never executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 1895 | return d->sortCacheEnabled; never executed: return d->sortCacheEnabled; | 0 |
| 1896 | } | - |
| 1897 | void QGraphicsScene::setSortCacheEnabled(bool enabled) | - |
| 1898 | { | - |
| 1899 | Q_D(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 1900 | if (d->sortCacheEnabled == enabled) never evaluated: d->sortCacheEnabled == enabled | 0 |
| 1901 | return; | 0 |
| 1902 | d->sortCacheEnabled = enabled; never executed (the execution status of this line is deduced): d->sortCacheEnabled = enabled; | - |
| 1903 | } | 0 |
| 1904 | | - |
| 1905 | /*! | - |
| 1906 | Calculates and returns the bounding rect of all items on the scene. This | - |
| 1907 | function works by iterating over all items, and because of this, it can | - |
| 1908 | be slow for large scenes. | - |
| 1909 | | - |
| 1910 | \sa sceneRect() | - |
| 1911 | */ | - |
| 1912 | QRectF QGraphicsScene::itemsBoundingRect() const | - |
| 1913 | { | - |
| 1914 | // Does not take untransformable items into account. | - |
| 1915 | QRectF boundingRect; executed (the execution status of this line is deduced): QRectF boundingRect; | - |
| 1916 | foreach (QGraphicsItem *item, items()) executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(items())> _container_(items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 1917 | boundingRect |= item->sceneBoundingRect(); executed: boundingRect |= item->sceneBoundingRect();Execution Count:2141 | 2141 |
| 1918 | return boundingRect; executed: return boundingRect;Execution Count:1097 | 1097 |
| 1919 | } | - |
| 1920 | | - |
| 1921 | /*! | - |
| 1922 | Returns an ordered list of all items on the scene. \a order decides the | - |
| 1923 | stacking order. | - |
| 1924 | | - |
| 1925 | \sa addItem(), removeItem(), {QGraphicsItem#Sorting}{Sorting} | - |
| 1926 | */ | - |
| 1927 | QList<QGraphicsItem *> QGraphicsScene::items(Qt::SortOrder order) const | - |
| 1928 | { | - |
| 1929 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 1930 | return d->index->items(order); executed: return d->index->items(order);Execution Count:1679 | 1679 |
| 1931 | } | - |
| 1932 | | - |
| 1933 | /*! | - |
| 1934 | \fn QList<QGraphicsItem *> QGraphicsScene::items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode) const | - |
| 1935 | \obsolete | - |
| 1936 | \since 4.3 | - |
| 1937 | | - |
| 1938 | This convenience function is equivalent to calling items(QRectF(\a x, \a y, \a w, \a h), \a mode). | - |
| 1939 | | - |
| 1940 | This function is deprecated and returns incorrect results if the scene | - |
| 1941 | contains items that ignore transformations. Use the overload that takes | - |
| 1942 | a QTransform instead. | - |
| 1943 | */ | - |
| 1944 | | - |
| 1945 | /*! | - |
| 1946 | \fn QList<QGraphicsItem *> QGraphicsScene::items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const | - |
| 1947 | \overload | - |
| 1948 | \since 4.6 | - |
| 1949 | | - |
| 1950 | \brief Returns all visible items that, depending on \a mode, are | - |
| 1951 | either inside or intersect with the rectangle defined by \a x, \a y, | - |
| 1952 | \a w and \a h, in a list sorted using \a order. In this case, "visible" defines items for which: | - |
| 1953 | isVisible() returns true, effectiveOpacity() returns a value greater than 0.0 | - |
| 1954 | (which is fully transparent) and the parent item does not clip it. | - |
| 1955 | | - |
| 1956 | \a deviceTransform is the transformation that applies to the view, and needs to | - |
| 1957 | be provided if the scene contains items that ignore transformations. | - |
| 1958 | */ | - |
| 1959 | | - |
| 1960 | /*! | - |
| 1961 | \fn QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const | - |
| 1962 | \since 4.6 | - |
| 1963 | | - |
| 1964 | \brief Returns all visible items that, depending on \a mode, are at | - |
| 1965 | the specified \a pos in a list sorted using \a order. In this case, "visible" defines items for which: | - |
| 1966 | isVisible() returns true, effectiveOpacity() returns a value greater than 0.0 | - |
| 1967 | (which is fully transparent) and the parent item does not clip it. | - |
| 1968 | | - |
| 1969 | The default value for \a mode is Qt::IntersectsItemShape; all items whose | - |
| 1970 | exact shape intersects with \a pos are returned. | - |
| 1971 | | - |
| 1972 | \a deviceTransform is the transformation that applies to the view, and needs to | - |
| 1973 | be provided if the scene contains items that ignore transformations. | - |
| 1974 | | - |
| 1975 | \sa itemAt(), {QGraphicsItem#Sorting}{Sorting} | - |
| 1976 | */ | - |
| 1977 | QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos, Qt::ItemSelectionMode mode, | - |
| 1978 | Qt::SortOrder order, const QTransform &deviceTransform) const | - |
| 1979 | { | - |
| 1980 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 1981 | return d->index->items(pos, mode, order, deviceTransform); executed: return d->index->items(pos, mode, order, deviceTransform);Execution Count:67 | 67 |
| 1982 | } | - |
| 1983 | | - |
| 1984 | /*! | - |
| 1985 | \fn QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const | - |
| 1986 | \overload | - |
| 1987 | \since 4.6 | - |
| 1988 | | - |
| 1989 | \brief Returns all visible items that, depending on \a mode, are | - |
| 1990 | either inside or intersect with the specified \a rect, in a | - |
| 1991 | list sorted using \a order. In this case, "visible" defines items for which: | - |
| 1992 | isVisible() returns true, effectiveOpacity() returns a value greater than 0.0 | - |
| 1993 | (which is fully transparent) and the parent item does not clip it. | - |
| 1994 | | - |
| 1995 | The default value for \a mode is Qt::IntersectsItemShape; all items whose | - |
| 1996 | exact shape intersects with or is contained by \a rect are returned. | - |
| 1997 | | - |
| 1998 | \a deviceTransform is the transformation that applies to the view, and needs to | - |
| 1999 | be provided if the scene contains items that ignore transformations. | - |
| 2000 | | - |
| 2001 | \sa itemAt(), {QGraphicsItem#Sorting}{Sorting} | - |
| 2002 | */ | - |
| 2003 | QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rect, Qt::ItemSelectionMode mode, | - |
| 2004 | Qt::SortOrder order, const QTransform &deviceTransform) const | - |
| 2005 | { | - |
| 2006 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 2007 | return d->index->items(rect, mode, order, deviceTransform); executed: return d->index->items(rect, mode, order, deviceTransform);Execution Count:340 | 340 |
| 2008 | } | - |
| 2009 | | - |
| 2010 | /*! | - |
| 2011 | \fn QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const | - |
| 2012 | \overload | - |
| 2013 | \since 4.6 | - |
| 2014 | | - |
| 2015 | \brief Returns all visible items that, depending on \a mode, are | - |
| 2016 | either inside or intersect with the specified \a polygon, in | - |
| 2017 | a list sorted using \a order. In this case, "visible" defines items for which: | - |
| 2018 | isVisible() returns true, effectiveOpacity() returns a value greater than 0.0 | - |
| 2019 | (which is fully transparent) and the parent item does not clip it. | - |
| 2020 | | - |
| 2021 | The default value for \a mode is Qt::IntersectsItemShape; all items whose | - |
| 2022 | exact shape intersects with or is contained by \a polygon are returned. | - |
| 2023 | | - |
| 2024 | \a deviceTransform is the transformation that applies to the view, and needs to | - |
| 2025 | be provided if the scene contains items that ignore transformations. | - |
| 2026 | | - |
| 2027 | \sa itemAt(), {QGraphicsItem#Sorting}{Sorting} | - |
| 2028 | */ | - |
| 2029 | QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, | - |
| 2030 | Qt::SortOrder order, const QTransform &deviceTransform) const | - |
| 2031 | { | - |
| 2032 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 2033 | return d->index->items(polygon, mode, order, deviceTransform); executed: return d->index->items(polygon, mode, order, deviceTransform);Execution Count:11 | 11 |
| 2034 | } | - |
| 2035 | | - |
| 2036 | /*! | - |
| 2037 | \fn QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const | - |
| 2038 | \overload | - |
| 2039 | \since 4.6 | - |
| 2040 | | - |
| 2041 | \brief Returns all visible items that, depending on \a mode, are | - |
| 2042 | either inside or intersect with the specified \a path, in a | - |
| 2043 | list sorted using \a order. In this case, "visible" defines items for which: | - |
| 2044 | isVisible() returns true, effectiveOpacity() returns a value greater than 0.0 | - |
| 2045 | (which is fully transparent) and the parent item does not clip it. | - |
| 2046 | | - |
| 2047 | The default value for \a mode is Qt::IntersectsItemShape; all items whose | - |
| 2048 | exact shape intersects with or is contained by \a path are returned. | - |
| 2049 | | - |
| 2050 | \a deviceTransform is the transformation that applies to the view, and needs to | - |
| 2051 | be provided if the scene contains items that ignore transformations. | - |
| 2052 | | - |
| 2053 | \sa itemAt(), {QGraphicsItem#Sorting}{Sorting} | - |
| 2054 | */ | - |
| 2055 | QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode, | - |
| 2056 | Qt::SortOrder order, const QTransform &deviceTransform) const | - |
| 2057 | { | - |
| 2058 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 2059 | return d->index->items(path, mode, order, deviceTransform); executed: return d->index->items(path, mode, order, deviceTransform);Execution Count:7 | 7 |
| 2060 | } | - |
| 2061 | | - |
| 2062 | /*! | - |
| 2063 | Returns a list of all items that collide with \a item. Collisions are | - |
| 2064 | determined by calling QGraphicsItem::collidesWithItem(); the collision | - |
| 2065 | detection is determined by \a mode. By default, all items whose shape | - |
| 2066 | intersects \a item or is contained inside \a item's shape are returned. | - |
| 2067 | | - |
| 2068 | The items are returned in descending stacking order (i.e., the first item | - |
| 2069 | in the list is the uppermost item, and the last item is the lowermost | - |
| 2070 | item). | - |
| 2071 | | - |
| 2072 | \sa items(), itemAt(), QGraphicsItem::collidesWithItem(), {QGraphicsItem#Sorting}{Sorting} | - |
| 2073 | */ | - |
| 2074 | QList<QGraphicsItem *> QGraphicsScene::collidingItems(const QGraphicsItem *item, | - |
| 2075 | Qt::ItemSelectionMode mode) const | - |
| 2076 | { | - |
| 2077 | Q_D(const QGraphicsScene); never executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 2078 | if (!item) { | 0 |
| 2079 | qWarning("QGraphicsScene::collidingItems: cannot find collisions for null item"); never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsscene.cpp", 2079, __PRETTY_FUNCTION__).warning("QGraphicsScene::collidingItems: cannot find collisions for null item"); | - |
| 2080 | return QList<QGraphicsItem *>(); never executed: return QList<QGraphicsItem *>(); | 0 |
| 2081 | } | - |
| 2082 | | - |
| 2083 | // Does not support ItemIgnoresTransformations. | - |
| 2084 | QList<QGraphicsItem *> tmp; never executed (the execution status of this line is deduced): QList<QGraphicsItem *> tmp; | - |
| 2085 | foreach (QGraphicsItem *itemInVicinity, d->index->estimateItems(item->sceneBoundingRect(), Qt::DescendingOrder)) { never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(d->index->estimateItems(item->sceneBoundingRect(), Qt::DescendingOrder))> _container_(d->index->estimateItems(item->sceneBoundingRect(), Qt::DescendingOrder)); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *itemInVicinity = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 2086 | if (item != itemInVicinity && item->collidesWithItem(itemInVicinity, mode)) never evaluated: item != itemInVicinity never evaluated: item->collidesWithItem(itemInVicinity, mode) | 0 |
| 2087 | tmp << itemInVicinity; never executed: tmp << itemInVicinity; | 0 |
| 2088 | } | 0 |
| 2089 | return tmp; never executed: return tmp; | 0 |
| 2090 | } | - |
| 2091 | | - |
| 2092 | /*! | - |
| 2093 | \fn QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position) const | - |
| 2094 | \overload | - |
| 2095 | \obsolete | - |
| 2096 | | - |
| 2097 | Returns the topmost visible item at the specified \a position, or 0 if | - |
| 2098 | there are no items at this position. | - |
| 2099 | | - |
| 2100 | This function is deprecated and returns incorrect results if the scene | - |
| 2101 | contains items that ignore transformations. Use the overload that takes | - |
| 2102 | a QTransform instead. | - |
| 2103 | | - |
| 2104 | Note: See items() for a definition of which items are considered visible by this function. | - |
| 2105 | | - |
| 2106 | \sa items(), collidingItems(), {QGraphicsItem#Sorting}{Sorting} | - |
| 2107 | */ | - |
| 2108 | | - |
| 2109 | /*! | - |
| 2110 | \since 4.6 | - |
| 2111 | | - |
| 2112 | Returns the topmost visible item at the specified \a position, or 0 | - |
| 2113 | if there are no items at this position. | - |
| 2114 | | - |
| 2115 | \a deviceTransform is the transformation that applies to the view, and needs to | - |
| 2116 | be provided if the scene contains items that ignore transformations. | - |
| 2117 | | - |
| 2118 | Note: See items() for a definition of which items are considered visible by this function. | - |
| 2119 | | - |
| 2120 | \sa items(), collidingItems(), {QGraphicsItem#Sorting}{Sorting} | - |
| 2121 | */ | - |
| 2122 | QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform &deviceTransform) const | - |
| 2123 | { | - |
| 2124 | QList<QGraphicsItem *> itemsAtPoint = items(position, Qt::IntersectsItemShape, never executed (the execution status of this line is deduced): QList<QGraphicsItem *> itemsAtPoint = items(position, Qt::IntersectsItemShape, | - |
| 2125 | Qt::DescendingOrder, deviceTransform); never executed (the execution status of this line is deduced): Qt::DescendingOrder, deviceTransform); | - |
| 2126 | return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first(); never executed: return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first(); | 0 |
| 2127 | } | - |
| 2128 | | - |
| 2129 | /*! | - |
| 2130 | \fn QGraphicsScene::itemAt(qreal x, qreal y, const QTransform &deviceTransform) const | - |
| 2131 | \overload | - |
| 2132 | \since 4.6 | - |
| 2133 | | - |
| 2134 | Returns the topmost visible item at the position specified by (\a x, \a | - |
| 2135 | y), or 0 if there are no items at this position. | - |
| 2136 | | - |
| 2137 | \a deviceTransform is the transformation that applies to the view, and needs to | - |
| 2138 | be provided if the scene contains items that ignore transformations. | - |
| 2139 | | - |
| 2140 | This convenience function is equivalent to calling \c | - |
| 2141 | {itemAt(QPointF(x, y), deviceTransform)}. | - |
| 2142 | | - |
| 2143 | Note: See items() for a definition of which items are considered visible by this function. | - |
| 2144 | */ | - |
| 2145 | | - |
| 2146 | /*! | - |
| 2147 | \fn QGraphicsScene::itemAt(qreal x, qreal y) const | - |
| 2148 | \overload | - |
| 2149 | \obsolete | - |
| 2150 | | - |
| 2151 | Returns the topmost visible item at the position specified by (\a x, \a | - |
| 2152 | y), or 0 if there are no items at this position. | - |
| 2153 | | - |
| 2154 | This convenience function is equivalent to calling \c | - |
| 2155 | {itemAt(QPointF(x, y))}. | - |
| 2156 | | - |
| 2157 | This function is deprecated and returns incorrect results if the scene | - |
| 2158 | contains items that ignore transformations. Use the overload that takes | - |
| 2159 | a QTransform instead. | - |
| 2160 | | - |
| 2161 | Note: See items() for a definition of which items are considered visible by this function. | - |
| 2162 | */ | - |
| 2163 | | - |
| 2164 | /*! | - |
| 2165 | Returns a list of all currently selected items. The items are | - |
| 2166 | returned in no particular order. | - |
| 2167 | | - |
| 2168 | \sa setSelectionArea() | - |
| 2169 | */ | - |
| 2170 | QList<QGraphicsItem *> QGraphicsScene::selectedItems() const | - |
| 2171 | { | - |
| 2172 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 2173 | | - |
| 2174 | // Optimization: Lazily removes items that are not selected. | - |
| 2175 | QGraphicsScene *that = const_cast<QGraphicsScene *>(this); executed (the execution status of this line is deduced): QGraphicsScene *that = const_cast<QGraphicsScene *>(this); | - |
| 2176 | QSet<QGraphicsItem *> actuallySelectedSet; executed (the execution status of this line is deduced): QSet<QGraphicsItem *> actuallySelectedSet; | - |
| 2177 | foreach (QGraphicsItem *item, that->d_func()->selectedItems) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(that->d_func()->selectedItems)> _container_(that->d_func()->selectedItems); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 2178 | if (item->isSelected()) partially evaluated: item->isSelected()| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 2179 | actuallySelectedSet << item; executed: actuallySelectedSet << item;Execution Count:3 | 3 |
| 2180 | } executed: }Execution Count:3 | 3 |
| 2181 | | - |
| 2182 | that->d_func()->selectedItems = actuallySelectedSet; executed (the execution status of this line is deduced): that->d_func()->selectedItems = actuallySelectedSet; | - |
| 2183 | | - |
| 2184 | return d->selectedItems.values(); executed: return d->selectedItems.values();Execution Count:7 | 7 |
| 2185 | } | - |
| 2186 | | - |
| 2187 | /*! | - |
| 2188 | Returns the selection area that was previously set with | - |
| 2189 | setSelectionArea(), or an empty QPainterPath if no selection area has been | - |
| 2190 | set. | - |
| 2191 | | - |
| 2192 | \sa setSelectionArea() | - |
| 2193 | */ | - |
| 2194 | QPainterPath QGraphicsScene::selectionArea() const | - |
| 2195 | { | - |
| 2196 | Q_D(const QGraphicsScene); never executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 2197 | return d->selectionArea; never executed: return d->selectionArea; | 0 |
| 2198 | } | - |
| 2199 | | - |
| 2200 | /*! | - |
| 2201 | \since 4.6 | - |
| 2202 | | - |
| 2203 | Sets the selection area to \a path. All items within this area are | - |
| 2204 | immediately selected, and all items outside are unselected. You can get | - |
| 2205 | the list of all selected items by calling selectedItems(). | - |
| 2206 | | - |
| 2207 | \a deviceTransform is the transformation that applies to the view, and needs to | - |
| 2208 | be provided if the scene contains items that ignore transformations. | - |
| 2209 | | - |
| 2210 | For an item to be selected, it must be marked as \e selectable | - |
| 2211 | (QGraphicsItem::ItemIsSelectable). | - |
| 2212 | | - |
| 2213 | \sa clearSelection(), selectionArea() | - |
| 2214 | */ | - |
| 2215 | void QGraphicsScene::setSelectionArea(const QPainterPath &path, const QTransform &deviceTransform) | - |
| 2216 | { | - |
| 2217 | setSelectionArea(path, Qt::IntersectsItemShape, deviceTransform); never executed (the execution status of this line is deduced): setSelectionArea(path, Qt::IntersectsItemShape, deviceTransform); | - |
| 2218 | } | 0 |
| 2219 | | - |
| 2220 | /*! | - |
| 2221 | \overload | - |
| 2222 | \since 4.6 | - |
| 2223 | | - |
| 2224 | Sets the selection area to \a path using \a mode to determine if items are | - |
| 2225 | included in the selection area. | - |
| 2226 | | - |
| 2227 | \a deviceTransform is the transformation that applies to the view, and needs to | - |
| 2228 | be provided if the scene contains items that ignore transformations. | - |
| 2229 | | - |
| 2230 | \sa clearSelection(), selectionArea() | - |
| 2231 | */ | - |
| 2232 | void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode, | - |
| 2233 | const QTransform &deviceTransform) | - |
| 2234 | { | - |
| 2235 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 2236 | | - |
| 2237 | // Note: with boolean path operations, we can improve performance here | - |
| 2238 | // quite a lot by "growing" the old path instead of replacing it. That | - |
| 2239 | // allows us to only check the intersect area for changes, instead of | - |
| 2240 | // reevaluating the whole path over again. | - |
| 2241 | d->selectionArea = path; executed (the execution status of this line is deduced): d->selectionArea = path; | - |
| 2242 | | - |
| 2243 | QSet<QGraphicsItem *> unselectItems = d->selectedItems; executed (the execution status of this line is deduced): QSet<QGraphicsItem *> unselectItems = d->selectedItems; | - |
| 2244 | | - |
| 2245 | // Disable emitting selectionChanged() for individual items. | - |
| 2246 | ++d->selectionChanging; executed (the execution status of this line is deduced): ++d->selectionChanging; | - |
| 2247 | bool changed = false; executed (the execution status of this line is deduced): bool changed = false; | - |
| 2248 | | - |
| 2249 | // Set all items in path to selected. | - |
| 2250 | foreach (QGraphicsItem *item, items(path, mode, Qt::DescendingOrder, deviceTransform)) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(items(path, mode, Qt::DescendingOrder, deviceTransform))> _container_(items(path, mode, Qt::DescendingOrder, deviceTransform)); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 2251 | if (item->flags() & QGraphicsItem::ItemIsSelectable) { partially evaluated: item->flags() & QGraphicsItem::ItemIsSelectable| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 2252 | if (!item->isSelected()) partially evaluated: !item->isSelected()| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 2253 | changed = true; executed: changed = true;Execution Count:3 | 3 |
| 2254 | unselectItems.remove(item); executed (the execution status of this line is deduced): unselectItems.remove(item); | - |
| 2255 | item->setSelected(true); executed (the execution status of this line is deduced): item->setSelected(true); | - |
| 2256 | } executed: }Execution Count:3 | 3 |
| 2257 | } executed: }Execution Count:3 | 3 |
| 2258 | | - |
| 2259 | // Unselect all items outside path. | - |
| 2260 | foreach (QGraphicsItem *item, unselectItems) { never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(unselectItems)> _container_(unselectItems); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 2261 | item->setSelected(false); never executed (the execution status of this line is deduced): item->setSelected(false); | - |
| 2262 | changed = true; never executed (the execution status of this line is deduced): changed = true; | - |
| 2263 | } | 0 |
| 2264 | | - |
| 2265 | // Reenable emitting selectionChanged() for individual items. | - |
| 2266 | --d->selectionChanging; executed (the execution status of this line is deduced): --d->selectionChanging; | - |
| 2267 | | - |
| 2268 | if (!d->selectionChanging && changed) partially evaluated: !d->selectionChanging| yes Evaluation Count:5 | no Evaluation Count:0 |
evaluated: changed| yes Evaluation Count:3 | yes Evaluation Count:2 |
| 0-5 |
| 2269 | emit selectionChanged(); executed: selectionChanged();Execution Count:3 | 3 |
| 2270 | } executed: }Execution Count:5 | 5 |
| 2271 | | - |
| 2272 | /*! | - |
| 2273 | Clears the current selection. | - |
| 2274 | | - |
| 2275 | \sa setSelectionArea(), selectedItems() | - |
| 2276 | */ | - |
| 2277 | void QGraphicsScene::clearSelection() | - |
| 2278 | { | - |
| 2279 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 2280 | | - |
| 2281 | // Disable emitting selectionChanged | - |
| 2282 | ++d->selectionChanging; executed (the execution status of this line is deduced): ++d->selectionChanging; | - |
| 2283 | bool changed = !d->selectedItems.isEmpty(); executed (the execution status of this line is deduced): bool changed = !d->selectedItems.isEmpty(); | - |
| 2284 | | - |
| 2285 | foreach (QGraphicsItem *item, d->selectedItems) executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(d->selectedItems)> _container_(d->selectedItems); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 2286 | item->setSelected(false); executed: item->setSelected(false);Execution Count:2 | 2 |
| 2287 | d->selectedItems.clear(); executed (the execution status of this line is deduced): d->selectedItems.clear(); | - |
| 2288 | | - |
| 2289 | // Reenable emitting selectionChanged() for individual items. | - |
| 2290 | --d->selectionChanging; executed (the execution status of this line is deduced): --d->selectionChanging; | - |
| 2291 | | - |
| 2292 | if (!d->selectionChanging && changed) partially evaluated: !d->selectionChanging| yes Evaluation Count:11 | no Evaluation Count:0 |
evaluated: changed| yes Evaluation Count:2 | yes Evaluation Count:9 |
| 0-11 |
| 2293 | emit selectionChanged(); executed: selectionChanged();Execution Count:2 | 2 |
| 2294 | } executed: }Execution Count:11 | 11 |
| 2295 | | - |
| 2296 | /*! | - |
| 2297 | \since 4.4 | - |
| 2298 | | - |
| 2299 | Removes and deletes all items from the scene, but otherwise leaves the | - |
| 2300 | state of the scene unchanged. | - |
| 2301 | | - |
| 2302 | \sa addItem() | - |
| 2303 | */ | - |
| 2304 | void QGraphicsScene::clear() | - |
| 2305 | { | - |
| 2306 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 2307 | // NB! We have to clear the index before deleting items; otherwise the | - |
| 2308 | // index might try to access dangling item pointers. | - |
| 2309 | d->index->clear(); executed (the execution status of this line is deduced): d->index->clear(); | - |
| 2310 | // NB! QGraphicsScenePrivate::unregisterTopLevelItem() removes items | - |
| 2311 | while (!d->topLevelItems.isEmpty()) evaluated: !d->topLevelItems.isEmpty()| yes Evaluation Count:770 | yes Evaluation Count:779 |
| 770-779 |
| 2312 | delete d->topLevelItems.first(); executed: delete d->topLevelItems.first();Execution Count:770 | 770 |
| 2313 | Q_ASSERT(d->topLevelItems.isEmpty()); executed (the execution status of this line is deduced): qt_noop(); | - |
| 2314 | d->lastItemCount = 0; executed (the execution status of this line is deduced): d->lastItemCount = 0; | - |
| 2315 | d->allItemsIgnoreHoverEvents = true; executed (the execution status of this line is deduced): d->allItemsIgnoreHoverEvents = true; | - |
| 2316 | d->allItemsUseDefaultCursor = true; executed (the execution status of this line is deduced): d->allItemsUseDefaultCursor = true; | - |
| 2317 | d->allItemsIgnoreTouchEvents = true; executed (the execution status of this line is deduced): d->allItemsIgnoreTouchEvents = true; | - |
| 2318 | } executed: }Execution Count:779 | 779 |
| 2319 | | - |
| 2320 | /*! | - |
| 2321 | Groups all items in \a items into a new QGraphicsItemGroup, and returns a | - |
| 2322 | pointer to the group. The group is created with the common ancestor of \a | - |
| 2323 | items as its parent, and with position (0, 0). The items are all | - |
| 2324 | reparented to the group, and their positions and transformations are | - |
| 2325 | mapped to the group. If \a items is empty, this function will return an | - |
| 2326 | empty top-level QGraphicsItemGroup. | - |
| 2327 | | - |
| 2328 | QGraphicsScene has ownership of the group item; you do not need to delete | - |
| 2329 | it. To dismantle (ungroup) a group, call destroyItemGroup(). | - |
| 2330 | | - |
| 2331 | \sa destroyItemGroup(), QGraphicsItemGroup::addToGroup() | - |
| 2332 | */ | - |
| 2333 | QGraphicsItemGroup *QGraphicsScene::createItemGroup(const QList<QGraphicsItem *> &items) | - |
| 2334 | { | - |
| 2335 | // Build a list of the first item's ancestors | - |
| 2336 | QList<QGraphicsItem *> ancestors; never executed (the execution status of this line is deduced): QList<QGraphicsItem *> ancestors; | - |
| 2337 | int n = 0; never executed (the execution status of this line is deduced): int n = 0; | - |
| 2338 | if (!items.isEmpty()) { never evaluated: !items.isEmpty() | 0 |
| 2339 | QGraphicsItem *parent = items.at(n++); never executed (the execution status of this line is deduced): QGraphicsItem *parent = items.at(n++); | - |
| 2340 | while ((parent = parent->parentItem())) never evaluated: (parent = parent->parentItem()) | 0 |
| 2341 | ancestors.append(parent); never executed: ancestors.append(parent); | 0 |
| 2342 | } | 0 |
| 2343 | | - |
| 2344 | // Find the common ancestor for all items | - |
| 2345 | QGraphicsItem *commonAncestor = 0; never executed (the execution status of this line is deduced): QGraphicsItem *commonAncestor = 0; | - |
| 2346 | if (!ancestors.isEmpty()) { never evaluated: !ancestors.isEmpty() | 0 |
| 2347 | while (n < items.size()) { never evaluated: n < items.size() | 0 |
| 2348 | int commonIndex = -1; never executed (the execution status of this line is deduced): int commonIndex = -1; | - |
| 2349 | QGraphicsItem *parent = items.at(n++); never executed (the execution status of this line is deduced): QGraphicsItem *parent = items.at(n++); | - |
| 2350 | do { | - |
| 2351 | int index = ancestors.indexOf(parent, qMax(0, commonIndex)); never executed (the execution status of this line is deduced): int index = ancestors.indexOf(parent, qMax(0, commonIndex)); | - |
| 2352 | if (index != -1) { never evaluated: index != -1 | 0 |
| 2353 | commonIndex = index; never executed (the execution status of this line is deduced): commonIndex = index; | - |
| 2354 | break; | 0 |
| 2355 | } | - |
| 2356 | } while ((parent = parent->parentItem())); never executed: } never evaluated: (parent = parent->parentItem()) | 0 |
| 2357 | | - |
| 2358 | if (commonIndex == -1) { never evaluated: commonIndex == -1 | 0 |
| 2359 | commonAncestor = 0; never executed (the execution status of this line is deduced): commonAncestor = 0; | - |
| 2360 | break; | 0 |
| 2361 | } | - |
| 2362 | | - |
| 2363 | commonAncestor = ancestors.at(commonIndex); never executed (the execution status of this line is deduced): commonAncestor = ancestors.at(commonIndex); | - |
| 2364 | } | 0 |
| 2365 | } | 0 |
| 2366 | | - |
| 2367 | // Create a new group at that level | - |
| 2368 | QGraphicsItemGroup *group = new QGraphicsItemGroup(commonAncestor); never executed (the execution status of this line is deduced): QGraphicsItemGroup *group = new QGraphicsItemGroup(commonAncestor); | - |
| 2369 | if (!commonAncestor) never evaluated: !commonAncestor | 0 |
| 2370 | addItem(group); never executed: addItem(group); | 0 |
| 2371 | foreach (QGraphicsItem *item, items) never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(items)> _container_(items); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 2372 | group->addToGroup(item); never executed: group->addToGroup(item); | 0 |
| 2373 | return group; never executed: return group; | 0 |
| 2374 | } | - |
| 2375 | | - |
| 2376 | /*! | - |
| 2377 | Reparents all items in \a group to \a group's parent item, then removes \a | - |
| 2378 | group from the scene, and finally deletes it. The items' positions and | - |
| 2379 | transformations are mapped from the group to the group's parent. | - |
| 2380 | | - |
| 2381 | \sa createItemGroup(), QGraphicsItemGroup::removeFromGroup() | - |
| 2382 | */ | - |
| 2383 | void QGraphicsScene::destroyItemGroup(QGraphicsItemGroup *group) | - |
| 2384 | { | - |
| 2385 | foreach (QGraphicsItem *item, group->childItems()) never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(group->childItems())> _container_(group->childItems()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 2386 | group->removeFromGroup(item); never executed: group->removeFromGroup(item); | 0 |
| 2387 | removeItem(group); never executed (the execution status of this line is deduced): removeItem(group); | - |
| 2388 | delete group; never executed (the execution status of this line is deduced): delete group; | - |
| 2389 | } | 0 |
| 2390 | | - |
| 2391 | /*! | - |
| 2392 | Adds or moves the \a item and all its childen to this scene. | - |
| 2393 | This scene takes ownership of the \a item. | - |
| 2394 | | - |
| 2395 | If the item is visible (i.e., QGraphicsItem::isVisible() returns | - |
| 2396 | true), QGraphicsScene will emit changed() once control goes back | - |
| 2397 | to the event loop. | - |
| 2398 | | - |
| 2399 | If the item is already in a different scene, it will first be | - |
| 2400 | removed from its old scene, and then added to this scene as a | - |
| 2401 | top-level. | - |
| 2402 | | - |
| 2403 | QGraphicsScene will send ItemSceneChange notifications to \a item | - |
| 2404 | while it is added to the scene. If item does not currently belong | - |
| 2405 | to a scene, only one notification is sent. If it does belong to | - |
| 2406 | scene already (i.e., it is moved to this scene), QGraphicsScene | - |
| 2407 | will send an addition notification as the item is removed from its | - |
| 2408 | previous scene. | - |
| 2409 | | - |
| 2410 | If the item is a panel, the scene is active, and there is no | - |
| 2411 | active panel in the scene, then the item will be activated. | - |
| 2412 | | - |
| 2413 | \sa removeItem(), addEllipse(), addLine(), addPath(), addPixmap(), | - |
| 2414 | addRect(), addText(), addWidget(), {QGraphicsItem#Sorting}{Sorting} | - |
| 2415 | */ | - |
| 2416 | void QGraphicsScene::addItem(QGraphicsItem *item) | - |
| 2417 | { | - |
| 2418 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 2419 | if (!item) { partially evaluated: !item| no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
| 2420 | qWarning("QGraphicsScene::addItem: cannot add null item"); never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsscene.cpp", 2420, __PRETTY_FUNCTION__).warning("QGraphicsScene::addItem: cannot add null item"); | - |
| 2421 | return; | 0 |
| 2422 | } | - |
| 2423 | if (item->d_ptr->scene == this) { partially evaluated: item->d_ptr->scene == this| no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
| 2424 | qWarning("QGraphicsScene::addItem: item has already been added to this scene"); never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsscene.cpp", 2424, __PRETTY_FUNCTION__).warning("QGraphicsScene::addItem: item has already been added to this scene"); | - |
| 2425 | return; | 0 |
| 2426 | } | - |
| 2427 | // Remove this item from its existing scene | - |
| 2428 | if (QGraphicsScene *oldScene = item->d_ptr->scene) partially evaluated: QGraphicsScene *oldScene = item->d_ptr->scene| no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
| 2429 | oldScene->removeItem(item); never executed: oldScene->removeItem(item); | 0 |
| 2430 | | - |
| 2431 | // Notify the item that its scene is changing, and allow the item to | - |
| 2432 | // react. | - |
| 2433 | const QVariant newSceneVariant(item->itemChange(QGraphicsItem::ItemSceneChange, executed (the execution status of this line is deduced): const QVariant newSceneVariant(item->itemChange(QGraphicsItem::ItemSceneChange, | - |
| 2434 | QVariant::fromValue<QGraphicsScene *>(this))); executed (the execution status of this line is deduced): QVariant::fromValue<QGraphicsScene *>(this))); | - |
| 2435 | QGraphicsScene *targetScene = qvariant_cast<QGraphicsScene *>(newSceneVariant); executed (the execution status of this line is deduced): QGraphicsScene *targetScene = qvariant_cast<QGraphicsScene *>(newSceneVariant); | - |
| 2436 | if (targetScene != this) { partially evaluated: targetScene != this| no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
| 2437 | if (targetScene && item->d_ptr->scene != targetScene) never evaluated: targetScene never evaluated: item->d_ptr->scene != targetScene | 0 |
| 2438 | targetScene->addItem(item); never executed: targetScene->addItem(item); | 0 |
| 2439 | return; | 0 |
| 2440 | } | - |
| 2441 | | - |
| 2442 | // QDeclarativeItems do not rely on initial itemChanged message, as the componentComplete | - |
| 2443 | // function allows far more opportunity for delayed-construction optimization. | - |
| 2444 | if (!item->d_ptr->isDeclarativeItem) { partially evaluated: !item->d_ptr->isDeclarativeItem| yes Evaluation Count:1726 | no Evaluation Count:0 |
| 0-1726 |
| 2445 | if (d->unpolishedItems.isEmpty()) { evaluated: d->unpolishedItems.isEmpty()| yes Evaluation Count:754 | yes Evaluation Count:972 |
| 754-972 |
| 2446 | QMetaMethod method = metaObject()->method(d->polishItemsIndex); executed (the execution status of this line is deduced): QMetaMethod method = metaObject()->method(d->polishItemsIndex); | - |
| 2447 | method.invoke(this, Qt::QueuedConnection); executed (the execution status of this line is deduced): method.invoke(this, Qt::QueuedConnection); | - |
| 2448 | } executed: }Execution Count:754 | 754 |
| 2449 | d->unpolishedItems.append(item); executed (the execution status of this line is deduced): d->unpolishedItems.append(item); | - |
| 2450 | item->d_ptr->pendingPolish = true; executed (the execution status of this line is deduced): item->d_ptr->pendingPolish = true; | - |
| 2451 | } executed: }Execution Count:1726 | 1726 |
| 2452 | | - |
| 2453 | // Detach this item from its parent if the parent's scene is different | - |
| 2454 | // from this scene. | - |
| 2455 | if (QGraphicsItem *itemParent = item->d_ptr->parent) { evaluated: QGraphicsItem *itemParent = item->d_ptr->parent| yes Evaluation Count:753 | yes Evaluation Count:973 |
| 753-973 |
| 2456 | if (itemParent->d_ptr->scene != this) partially evaluated: itemParent->d_ptr->scene != this| no Evaluation Count:0 | yes Evaluation Count:753 |
| 0-753 |
| 2457 | item->setParentItem(0); never executed: item->setParentItem(0); | 0 |
| 2458 | } executed: }Execution Count:753 | 753 |
| 2459 | | - |
| 2460 | // Add the item to this scene | - |
| 2461 | item->d_func()->scene = targetScene; executed (the execution status of this line is deduced): item->d_func()->scene = targetScene; | - |
| 2462 | | - |
| 2463 | // Add the item in the index | - |
| 2464 | d->index->addItem(item); executed (the execution status of this line is deduced): d->index->addItem(item); | - |
| 2465 | | - |
| 2466 | // Add to list of toplevels if this item is a toplevel. | - |
| 2467 | if (!item->d_ptr->parent) evaluated: !item->d_ptr->parent| yes Evaluation Count:973 | yes Evaluation Count:753 |
| 753-973 |
| 2468 | d->registerTopLevelItem(item); executed: d->registerTopLevelItem(item);Execution Count:973 | 973 |
| 2469 | | - |
| 2470 | // Add to list of items that require an update. We cannot assume that the | - |
| 2471 | // item is fully constructed, so calling item->update() can lead to a pure | - |
| 2472 | // virtual function call to boundingRect(). | - |
| 2473 | d->markDirty(item); executed (the execution status of this line is deduced): d->markDirty(item); | - |
| 2474 | d->dirtyGrowingItemsBoundingRect = true; executed (the execution status of this line is deduced): d->dirtyGrowingItemsBoundingRect = true; | - |
| 2475 | | - |
| 2476 | // Disable selectionChanged() for individual items | - |
| 2477 | ++d->selectionChanging; executed (the execution status of this line is deduced): ++d->selectionChanging; | - |
| 2478 | int oldSelectedItemSize = d->selectedItems.size(); executed (the execution status of this line is deduced): int oldSelectedItemSize = d->selectedItems.size(); | - |
| 2479 | | - |
| 2480 | // Enable mouse tracking if the item accepts hover events or has a cursor set. | - |
| 2481 | if (d->allItemsIgnoreHoverEvents && d->itemAcceptsHoverEvents_helper(item)) { evaluated: d->allItemsIgnoreHoverEvents| yes Evaluation Count:923 | yes Evaluation Count:803 |
evaluated: d->itemAcceptsHoverEvents_helper(item)| yes Evaluation Count:185 | yes Evaluation Count:738 |
| 185-923 |
| 2482 | d->allItemsIgnoreHoverEvents = false; executed (the execution status of this line is deduced): d->allItemsIgnoreHoverEvents = false; | - |
| 2483 | d->enableMouseTrackingOnViews(); executed (the execution status of this line is deduced): d->enableMouseTrackingOnViews(); | - |
| 2484 | } executed: }Execution Count:185 | 185 |
| 2485 | #ifndef QT_NO_CURSOR | - |
| 2486 | if (d->allItemsUseDefaultCursor && item->d_ptr->hasCursor) { evaluated: d->allItemsUseDefaultCursor| yes Evaluation Count:1725 | yes Evaluation Count:1 |
evaluated: item->d_ptr->hasCursor| yes Evaluation Count:4 | yes Evaluation Count:1721 |
| 1-1725 |
| 2487 | d->allItemsUseDefaultCursor = false; executed (the execution status of this line is deduced): d->allItemsUseDefaultCursor = false; | - |
| 2488 | if (d->allItemsIgnoreHoverEvents) // already enabled otherwise evaluated: d->allItemsIgnoreHoverEvents| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
| 2489 | d->enableMouseTrackingOnViews(); executed: d->enableMouseTrackingOnViews();Execution Count:3 | 3 |
| 2490 | } executed: }Execution Count:4 | 4 |
| 2491 | #endif //QT_NO_CURSOR | - |
| 2492 | | - |
| 2493 | // Enable touch events if the item accepts touch events. | - |
| 2494 | if (d->allItemsIgnoreTouchEvents && item->d_ptr->acceptTouchEvents) { partially evaluated: d->allItemsIgnoreTouchEvents| yes Evaluation Count:1726 | no Evaluation Count:0 |
partially evaluated: item->d_ptr->acceptTouchEvents| no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
| 2495 | d->allItemsIgnoreTouchEvents = false; never executed (the execution status of this line is deduced): d->allItemsIgnoreTouchEvents = false; | - |
| 2496 | d->enableTouchEventsOnViews(); never executed (the execution status of this line is deduced): d->enableTouchEventsOnViews(); | - |
| 2497 | } | 0 |
| 2498 | | - |
| 2499 | #ifndef QT_NO_GESTURES | - |
| 2500 | foreach (Qt::GestureType gesture, item->d_ptr->gestureContext.keys()) executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(item->d_ptr->gestureContext.keys())> _container_(item->d_ptr->gestureContext.keys()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (Qt::GestureType gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 2501 | d->grabGesture(item, gesture); executed: d->grabGesture(item, gesture);Execution Count:31 | 31 |
| 2502 | #endif | - |
| 2503 | | - |
| 2504 | // Update selection lists | - |
| 2505 | if (item->isSelected()) partially evaluated: item->isSelected()| no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
| 2506 | d->selectedItems << item; never executed: d->selectedItems << item; | 0 |
| 2507 | if (item->isWidget() && item->isVisible() && static_cast<QGraphicsWidget *>(item)->windowType() == Qt::Popup) evaluated: item->isWidget()| yes Evaluation Count:937 | yes Evaluation Count:789 |
evaluated: item->isVisible()| yes Evaluation Count:936 | yes Evaluation Count:1 |
partially evaluated: static_cast<QGraphicsWidget *>(item)->windowType() == Qt::Popup| no Evaluation Count:0 | yes Evaluation Count:936 |
| 0-937 |
| 2508 | d->addPopup(static_cast<QGraphicsWidget *>(item)); never executed: d->addPopup(static_cast<QGraphicsWidget *>(item)); | 0 |
| 2509 | if (item->isPanel() && item->isVisible() && item->panelModality() != QGraphicsItem::NonModal) evaluated: item->isPanel()| yes Evaluation Count:176 | yes Evaluation Count:1550 |
partially evaluated: item->isVisible()| yes Evaluation Count:176 | no Evaluation Count:0 |
evaluated: item->panelModality() != QGraphicsItem::NonModal| yes Evaluation Count:1 | yes Evaluation Count:175 |
| 0-1550 |
| 2510 | d->enterModal(item); executed: d->enterModal(item);Execution Count:1 | 1 |
| 2511 | | - |
| 2512 | // Update creation order focus chain. Make sure to leave the widget's | - |
| 2513 | // internal tab order intact. | - |
| 2514 | if (item->isWidget()) { evaluated: item->isWidget()| yes Evaluation Count:937 | yes Evaluation Count:789 |
| 789-937 |
| 2515 | QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); executed (the execution status of this line is deduced): QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); | - |
| 2516 | if (!d->tabFocusFirst) { evaluated: !d->tabFocusFirst| yes Evaluation Count:200 | yes Evaluation Count:737 |
| 200-737 |
| 2517 | // No first tab focus widget - make this the first tab focus | - |
| 2518 | // widget. | - |
| 2519 | d->tabFocusFirst = widget; executed (the execution status of this line is deduced): d->tabFocusFirst = widget; | - |
| 2520 | } else if (!widget->parentWidget()) { executed: }Execution Count:200 evaluated: !widget->parentWidget()| yes Evaluation Count:6 | yes Evaluation Count:731 |
| 6-731 |
| 2521 | // Adding a widget that is not part of a tab focus chain. | - |
| 2522 | QGraphicsWidget *last = d->tabFocusFirst->d_func()->focusPrev; executed (the execution status of this line is deduced): QGraphicsWidget *last = d->tabFocusFirst->d_func()->focusPrev; | - |
| 2523 | QGraphicsWidget *lastNew = widget->d_func()->focusPrev; executed (the execution status of this line is deduced): QGraphicsWidget *lastNew = widget->d_func()->focusPrev; | - |
| 2524 | last->d_func()->focusNext = widget; executed (the execution status of this line is deduced): last->d_func()->focusNext = widget; | - |
| 2525 | widget->d_func()->focusPrev = last; executed (the execution status of this line is deduced): widget->d_func()->focusPrev = last; | - |
| 2526 | d->tabFocusFirst->d_func()->focusPrev = lastNew; executed (the execution status of this line is deduced): d->tabFocusFirst->d_func()->focusPrev = lastNew; | - |
| 2527 | lastNew->d_func()->focusNext = d->tabFocusFirst; executed (the execution status of this line is deduced): lastNew->d_func()->focusNext = d->tabFocusFirst; | - |
| 2528 | } executed: }Execution Count:6 | 6 |
| 2529 | } | - |
| 2530 | | - |
| 2531 | // Add all children recursively | - |
| 2532 | item->d_ptr->ensureSortedChildren(); executed (the execution status of this line is deduced): item->d_ptr->ensureSortedChildren(); | - |
| 2533 | for (int i = 0; i < item->d_ptr->children.size(); ++i) evaluated: i < item->d_ptr->children.size()| yes Evaluation Count:31 | yes Evaluation Count:1726 |
| 31-1726 |
| 2534 | addItem(item->d_ptr->children.at(i)); executed: addItem(item->d_ptr->children.at(i));Execution Count:31 | 31 |
| 2535 | | - |
| 2536 | // Resolve font and palette. | - |
| 2537 | item->d_ptr->resolveFont(d->font.resolve()); executed (the execution status of this line is deduced): item->d_ptr->resolveFont(d->font.resolve()); | - |
| 2538 | item->d_ptr->resolvePalette(d->palette.resolve()); executed (the execution status of this line is deduced): item->d_ptr->resolvePalette(d->palette.resolve()); | - |
| 2539 | | - |
| 2540 | | - |
| 2541 | // Reenable selectionChanged() for individual items | - |
| 2542 | --d->selectionChanging; executed (the execution status of this line is deduced): --d->selectionChanging; | - |
| 2543 | if (!d->selectionChanging && d->selectedItems.size() != oldSelectedItemSize) evaluated: !d->selectionChanging| yes Evaluation Count:1695 | yes Evaluation Count:31 |
partially evaluated: d->selectedItems.size() != oldSelectedItemSize| no Evaluation Count:0 | yes Evaluation Count:1695 |
| 0-1695 |
| 2544 | emit selectionChanged(); never executed: selectionChanged(); | 0 |
| 2545 | | - |
| 2546 | // Deliver post-change notification | - |
| 2547 | item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant); executed (the execution status of this line is deduced): item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant); | - |
| 2548 | | - |
| 2549 | // Update explicit activation | - |
| 2550 | bool autoActivate = true; executed (the execution status of this line is deduced): bool autoActivate = true; | - |
| 2551 | if (!d->childExplicitActivation && item->d_ptr->explicitActivate) partially evaluated: !d->childExplicitActivation| yes Evaluation Count:1726 | no Evaluation Count:0 |
partially evaluated: item->d_ptr->explicitActivate| no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
| 2552 | d->childExplicitActivation = item->d_ptr->wantsActive ? 1 : 2; never executed: d->childExplicitActivation = item->d_ptr->wantsActive ? 1 : 2; never evaluated: item->d_ptr->wantsActive | 0 |
| 2553 | if (d->childExplicitActivation && item->isPanel()) { partially evaluated: d->childExplicitActivation| no Evaluation Count:0 | yes Evaluation Count:1726 |
never evaluated: item->isPanel() | 0-1726 |
| 2554 | if (d->childExplicitActivation == 1) never evaluated: d->childExplicitActivation == 1 | 0 |
| 2555 | setActivePanel(item); never executed: setActivePanel(item); | 0 |
| 2556 | else | - |
| 2557 | autoActivate = false; never executed: autoActivate = false; | 0 |
| 2558 | d->childExplicitActivation = 0; never executed (the execution status of this line is deduced): d->childExplicitActivation = 0; | - |
| 2559 | } else if (!item->d_ptr->parent) { never executed: } evaluated: !item->d_ptr->parent| yes Evaluation Count:973 | yes Evaluation Count:753 |
| 0-973 |
| 2560 | d->childExplicitActivation = 0; executed (the execution status of this line is deduced): d->childExplicitActivation = 0; | - |
| 2561 | } executed: }Execution Count:973 | 973 |
| 2562 | | - |
| 2563 | // Auto-activate this item's panel if nothing else has been activated | - |
| 2564 | if (autoActivate) { partially evaluated: autoActivate| yes Evaluation Count:1726 | no Evaluation Count:0 |
| 0-1726 |
| 2565 | if (!d->lastActivePanel && !d->activePanel && item->isPanel()) { evaluated: !d->lastActivePanel| yes Evaluation Count:1036 | yes Evaluation Count:690 |
evaluated: !d->activePanel| yes Evaluation Count:1034 | yes Evaluation Count:2 |
evaluated: item->isPanel()| yes Evaluation Count:176 | yes Evaluation Count:858 |
| 2-1036 |
| 2566 | if (isActive()) evaluated: isActive()| yes Evaluation Count:2 | yes Evaluation Count:174 |
| 2-174 |
| 2567 | setActivePanel(item); executed: setActivePanel(item);Execution Count:2 | 2 |
| 2568 | else | - |
| 2569 | d->lastActivePanel = item; executed: d->lastActivePanel = item;Execution Count:174 | 174 |
| 2570 | } | - |
| 2571 | } executed: }Execution Count:1726 | 1726 |
| 2572 | | - |
| 2573 | if (item->d_ptr->flags & QGraphicsItem::ItemSendsScenePositionChanges) partially evaluated: item->d_ptr->flags & QGraphicsItem::ItemSendsScenePositionChanges| no Evaluation Count:0 | yes Evaluation Count:1726 |
| 0-1726 |
| 2574 | d->registerScenePosItem(item); never executed: d->registerScenePosItem(item); | 0 |
| 2575 | | - |
| 2576 | // Ensure that newly added items that have subfocus set, gain | - |
| 2577 | // focus automatically if there isn't a focus item already. | - |
| 2578 | if (!d->focusItem && item != d->lastFocusItem && item->focusItem() == item) evaluated: !d->focusItem| yes Evaluation Count:1725 | yes Evaluation Count:1 |
partially evaluated: item != d->lastFocusItem| yes Evaluation Count:1725 | no Evaluation Count:0 |
partially evaluated: item->focusItem() == item| no Evaluation Count:0 | yes Evaluation Count:1725 |
| 0-1725 |
| 2579 | item->focusItem()->setFocus(); never executed: item->focusItem()->setFocus(); | 0 |
| 2580 | | - |
| 2581 | d->updateInputMethodSensitivityInViews(); executed (the execution status of this line is deduced): d->updateInputMethodSensitivityInViews(); | - |
| 2582 | } executed: }Execution Count:1726 | 1726 |
| 2583 | | - |
| 2584 | /*! | - |
| 2585 | Creates and adds an ellipse item to the scene, and returns the item | - |
| 2586 | pointer. The geometry of the ellipse is defined by \a rect, and its pen | - |
| 2587 | and brush are initialized to \a pen and \a brush. | - |
| 2588 | | - |
| 2589 | Note that the item's geometry is provided in item coordinates, and its | - |
| 2590 | position is initialized to (0, 0). | - |
| 2591 | | - |
| 2592 | If the item is visible (i.e., QGraphicsItem::isVisible() returns true), | - |
| 2593 | QGraphicsScene will emit changed() once control goes back to the event | - |
| 2594 | loop. | - |
| 2595 | | - |
| 2596 | \sa addLine(), addPath(), addPixmap(), addRect(), addText(), addItem(), | - |
| 2597 | addWidget() | - |
| 2598 | */ | - |
| 2599 | QGraphicsEllipseItem *QGraphicsScene::addEllipse(const QRectF &rect, const QPen &pen, const QBrush &brush) | - |
| 2600 | { | - |
| 2601 | QGraphicsEllipseItem *item = new QGraphicsEllipseItem(rect); executed (the execution status of this line is deduced): QGraphicsEllipseItem *item = new QGraphicsEllipseItem(rect); | - |
| 2602 | item->setPen(pen); executed (the execution status of this line is deduced): item->setPen(pen); | - |
| 2603 | item->setBrush(brush); executed (the execution status of this line is deduced): item->setBrush(brush); | - |
| 2604 | addItem(item); executed (the execution status of this line is deduced): addItem(item); | - |
| 2605 | return item; executed: return item;Execution Count:17 | 17 |
| 2606 | } | - |
| 2607 | | - |
| 2608 | /*! | - |
| 2609 | \fn QGraphicsEllipseItem *QGraphicsScene::addEllipse(qreal x, qreal y, qreal w, qreal h, const QPen &pen, const QBrush &brush) | - |
| 2610 | \since 4.3 | - |
| 2611 | | - |
| 2612 | This convenience function is equivalent to calling addEllipse(QRectF(\a x, | - |
| 2613 | \a y, \a w, \a h), \a pen, \a brush). | - |
| 2614 | */ | - |
| 2615 | | - |
| 2616 | /*! | - |
| 2617 | Creates and adds a line item to the scene, and returns the item | - |
| 2618 | pointer. The geometry of the line is defined by \a line, and its pen | - |
| 2619 | is initialized to \a pen. | - |
| 2620 | | - |
| 2621 | Note that the item's geometry is provided in item coordinates, and its | - |
| 2622 | position is initialized to (0, 0). | - |
| 2623 | | - |
| 2624 | If the item is visible (i.e., QGraphicsItem::isVisible() returns true), | - |
| 2625 | QGraphicsScene will emit changed() once control goes back to the event | - |
| 2626 | loop. | - |
| 2627 | | - |
| 2628 | \sa addEllipse(), addPath(), addPixmap(), addRect(), addText(), addItem(), | - |
| 2629 | addWidget() | - |
| 2630 | */ | - |
| 2631 | QGraphicsLineItem *QGraphicsScene::addLine(const QLineF &line, const QPen &pen) | - |
| 2632 | { | - |
| 2633 | QGraphicsLineItem *item = new QGraphicsLineItem(line); executed (the execution status of this line is deduced): QGraphicsLineItem *item = new QGraphicsLineItem(line); | - |
| 2634 | item->setPen(pen); executed (the execution status of this line is deduced): item->setPen(pen); | - |
| 2635 | addItem(item); executed (the execution status of this line is deduced): addItem(item); | - |
| 2636 | return item; executed: return item;Execution Count:4 | 4 |
| 2637 | } | - |
| 2638 | | - |
| 2639 | /*! | - |
| 2640 | \fn QGraphicsLineItem *QGraphicsScene::addLine(qreal x1, qreal y1, qreal x2, qreal y2, const QPen &pen) | - |
| 2641 | \since 4.3 | - |
| 2642 | | - |
| 2643 | This convenience function is equivalent to calling addLine(QLineF(\a x1, | - |
| 2644 | \a y1, \a x2, \a y2), \a pen). | - |
| 2645 | */ | - |
| 2646 | | - |
| 2647 | /*! | - |
| 2648 | Creates and adds a path item to the scene, and returns the item | - |
| 2649 | pointer. The geometry of the path is defined by \a path, and its pen and | - |
| 2650 | brush are initialized to \a pen and \a brush. | - |
| 2651 | | - |
| 2652 | Note that the item's geometry is provided in item coordinates, and its | - |
| 2653 | position is initialized to (0, 0). | - |
| 2654 | | - |
| 2655 | If the item is visible (i.e., QGraphicsItem::isVisible() returns true), | - |
| 2656 | QGraphicsScene will emit changed() once control goes back to the event | - |
| 2657 | loop. | - |
| 2658 | | - |
| 2659 | \sa addEllipse(), addLine(), addPixmap(), addRect(), addText(), addItem(), | - |
| 2660 | addWidget() | - |
| 2661 | */ | - |
| 2662 | QGraphicsPathItem *QGraphicsScene::addPath(const QPainterPath &path, const QPen &pen, const QBrush &brush) | - |
| 2663 | { | - |
| 2664 | QGraphicsPathItem *item = new QGraphicsPathItem(path); never executed (the execution status of this line is deduced): QGraphicsPathItem *item = new QGraphicsPathItem(path); | - |
| 2665 | item->setPen(pen); never executed (the execution status of this line is deduced): item->setPen(pen); | - |
| 2666 | item->setBrush(brush); never executed (the execution status of this line is deduced): item->setBrush(brush); | - |
| 2667 | addItem(item); never executed (the execution status of this line is deduced): addItem(item); | - |
| 2668 | return item; never executed: return item; | 0 |
| 2669 | } | - |
| 2670 | | - |
| 2671 | /*! | - |
| 2672 | Creates and adds a pixmap item to the scene, and returns the item | - |
| 2673 | pointer. The pixmap is defined by \a pixmap. | - |
| 2674 | | - |
| 2675 | Note that the item's geometry is provided in item coordinates, and its | - |
| 2676 | position is initialized to (0, 0). | - |
| 2677 | | - |
| 2678 | If the item is visible (i.e., QGraphicsItem::isVisible() returns true), | - |
| 2679 | QGraphicsScene will emit changed() once control goes back to the event | - |
| 2680 | loop. | - |
| 2681 | | - |
| 2682 | \sa addEllipse(), addLine(), addPath(), addRect(), addText(), addItem(), | - |
| 2683 | addWidget() | - |
| 2684 | */ | - |
| 2685 | QGraphicsPixmapItem *QGraphicsScene::addPixmap(const QPixmap &pixmap) | - |
| 2686 | { | - |
| 2687 | QGraphicsPixmapItem *item = new QGraphicsPixmapItem(pixmap); executed (the execution status of this line is deduced): QGraphicsPixmapItem *item = new QGraphicsPixmapItem(pixmap); | - |
| 2688 | addItem(item); executed (the execution status of this line is deduced): addItem(item); | - |
| 2689 | return item; executed: return item;Execution Count:1 | 1 |
| 2690 | } | - |
| 2691 | | - |
| 2692 | /*! | - |
| 2693 | Creates and adds a polygon item to the scene, and returns the item | - |
| 2694 | pointer. The polygon is defined by \a polygon, and its pen and | - |
| 2695 | brush are initialized to \a pen and \a brush. | - |
| 2696 | | - |
| 2697 | Note that the item's geometry is provided in item coordinates, and its | - |
| 2698 | position is initialized to (0, 0). | - |
| 2699 | | - |
| 2700 | If the item is visible (i.e., QGraphicsItem::isVisible() returns true), | - |
| 2701 | QGraphicsScene will emit changed() once control goes back to the event | - |
| 2702 | loop. | - |
| 2703 | | - |
| 2704 | \sa addEllipse(), addLine(), addPath(), addRect(), addText(), addItem(), | - |
| 2705 | addWidget() | - |
| 2706 | */ | - |
| 2707 | QGraphicsPolygonItem *QGraphicsScene::addPolygon(const QPolygonF &polygon, | - |
| 2708 | const QPen &pen, const QBrush &brush) | - |
| 2709 | { | - |
| 2710 | QGraphicsPolygonItem *item = new QGraphicsPolygonItem(polygon); never executed (the execution status of this line is deduced): QGraphicsPolygonItem *item = new QGraphicsPolygonItem(polygon); | - |
| 2711 | item->setPen(pen); never executed (the execution status of this line is deduced): item->setPen(pen); | - |
| 2712 | item->setBrush(brush); never executed (the execution status of this line is deduced): item->setBrush(brush); | - |
| 2713 | addItem(item); never executed (the execution status of this line is deduced): addItem(item); | - |
| 2714 | return item; never executed: return item; | 0 |
| 2715 | } | - |
| 2716 | | - |
| 2717 | /*! | - |
| 2718 | Creates and adds a rectangle item to the scene, and returns the item | - |
| 2719 | pointer. The geometry of the rectangle is defined by \a rect, and its pen | - |
| 2720 | and brush are initialized to \a pen and \a brush. | - |
| 2721 | | - |
| 2722 | Note that the item's geometry is provided in item coordinates, and its | - |
| 2723 | position is initialized to (0, 0). For example, if a QRect(50, 50, 100, | - |
| 2724 | 100) is added, its top-left corner will be at (50, 50) relative to the | - |
| 2725 | origin in the items coordinate system. | - |
| 2726 | | - |
| 2727 | If the item is visible (i.e., QGraphicsItem::isVisible() returns true), | - |
| 2728 | QGraphicsScene will emit changed() once control goes back to the event | - |
| 2729 | loop. | - |
| 2730 | | - |
| 2731 | \sa addEllipse(), addLine(), addPixmap(), addPixmap(), addText(), | - |
| 2732 | addItem(), addWidget() | - |
| 2733 | */ | - |
| 2734 | QGraphicsRectItem *QGraphicsScene::addRect(const QRectF &rect, const QPen &pen, const QBrush &brush) | - |
| 2735 | { | - |
| 2736 | QGraphicsRectItem *item = new QGraphicsRectItem(rect); executed (the execution status of this line is deduced): QGraphicsRectItem *item = new QGraphicsRectItem(rect); | - |
| 2737 | item->setPen(pen); executed (the execution status of this line is deduced): item->setPen(pen); | - |
| 2738 | item->setBrush(brush); executed (the execution status of this line is deduced): item->setBrush(brush); | - |
| 2739 | addItem(item); executed (the execution status of this line is deduced): addItem(item); | - |
| 2740 | return item; executed: return item;Execution Count:483 | 483 |
| 2741 | } | - |
| 2742 | | - |
| 2743 | /*! | - |
| 2744 | \fn QGraphicsRectItem *QGraphicsScene::addRect(qreal x, qreal y, qreal w, qreal h, const QPen &pen, const QBrush &brush) | - |
| 2745 | \since 4.3 | - |
| 2746 | | - |
| 2747 | This convenience function is equivalent to calling addRect(QRectF(\a x, | - |
| 2748 | \a y, \a w, \a h), \a pen, \a brush). | - |
| 2749 | */ | - |
| 2750 | | - |
| 2751 | /*! | - |
| 2752 | Creates and adds a text item to the scene, and returns the item | - |
| 2753 | pointer. The text string is initialized to \a text, and its font | - |
| 2754 | is initialized to \a font. | - |
| 2755 | | - |
| 2756 | The item's position is initialized to (0, 0). | - |
| 2757 | | - |
| 2758 | If the item is visible (i.e., QGraphicsItem::isVisible() returns true), | - |
| 2759 | QGraphicsScene will emit changed() once control goes back to the event | - |
| 2760 | loop. | - |
| 2761 | | - |
| 2762 | \sa addEllipse(), addLine(), addPixmap(), addPixmap(), addRect(), | - |
| 2763 | addItem(), addWidget() | - |
| 2764 | */ | - |
| 2765 | QGraphicsTextItem *QGraphicsScene::addText(const QString &text, const QFont &font) | - |
| 2766 | { | - |
| 2767 | QGraphicsTextItem *item = new QGraphicsTextItem(text); executed (the execution status of this line is deduced): QGraphicsTextItem *item = new QGraphicsTextItem(text); | - |
| 2768 | item->setFont(font); executed (the execution status of this line is deduced): item->setFont(font); | - |
| 2769 | addItem(item); executed (the execution status of this line is deduced): addItem(item); | - |
| 2770 | return item; executed: return item;Execution Count:103 | 103 |
| 2771 | } | - |
| 2772 | | - |
| 2773 | /*! | - |
| 2774 | Creates and adds a QGraphicsSimpleTextItem to the scene, and returns the | - |
| 2775 | item pointer. The text string is initialized to \a text, and its font is | - |
| 2776 | initialized to \a font. | - |
| 2777 | | - |
| 2778 | The item's position is initialized to (0, 0). | - |
| 2779 | | - |
| 2780 | If the item is visible (i.e., QGraphicsItem::isVisible() returns true), | - |
| 2781 | QGraphicsScene will emit changed() once control goes back to the event | - |
| 2782 | loop. | - |
| 2783 | | - |
| 2784 | \sa addEllipse(), addLine(), addPixmap(), addPixmap(), addRect(), | - |
| 2785 | addItem(), addWidget() | - |
| 2786 | */ | - |
| 2787 | QGraphicsSimpleTextItem *QGraphicsScene::addSimpleText(const QString &text, const QFont &font) | - |
| 2788 | { | - |
| 2789 | QGraphicsSimpleTextItem *item = new QGraphicsSimpleTextItem(text); never executed (the execution status of this line is deduced): QGraphicsSimpleTextItem *item = new QGraphicsSimpleTextItem(text); | - |
| 2790 | item->setFont(font); never executed (the execution status of this line is deduced): item->setFont(font); | - |
| 2791 | addItem(item); never executed (the execution status of this line is deduced): addItem(item); | - |
| 2792 | return item; never executed: return item; | 0 |
| 2793 | } | - |
| 2794 | | - |
| 2795 | /*! | - |
| 2796 | Creates a new QGraphicsProxyWidget for \a widget, adds it to the scene, | - |
| 2797 | and returns a pointer to the proxy. \a wFlags set the default window flags | - |
| 2798 | for the embedding proxy widget. | - |
| 2799 | | - |
| 2800 | The item's position is initialized to (0, 0). | - |
| 2801 | | - |
| 2802 | If the item is visible (i.e., QGraphicsItem::isVisible() returns true), | - |
| 2803 | QGraphicsScene will emit changed() once control goes back to the event | - |
| 2804 | loop. | - |
| 2805 | | - |
| 2806 | Note that widgets with the Qt::WA_PaintOnScreen widget attribute | - |
| 2807 | set and widgets that wrap an external application or controller | - |
| 2808 | are not supported. Examples are QGLWidget and QAxWidget. | - |
| 2809 | | - |
| 2810 | \sa addEllipse(), addLine(), addPixmap(), addPixmap(), addRect(), | - |
| 2811 | addText(), addSimpleText(), addItem() | - |
| 2812 | */ | - |
| 2813 | QGraphicsProxyWidget *QGraphicsScene::addWidget(QWidget *widget, Qt::WindowFlags wFlags) | - |
| 2814 | { | - |
| 2815 | QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(0, wFlags); executed (the execution status of this line is deduced): QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(0, wFlags); | - |
| 2816 | proxy->setWidget(widget); executed (the execution status of this line is deduced): proxy->setWidget(widget); | - |
| 2817 | addItem(proxy); executed (the execution status of this line is deduced): addItem(proxy); | - |
| 2818 | return proxy; executed: return proxy;Execution Count:4 | 4 |
| 2819 | } | - |
| 2820 | | - |
| 2821 | /*! | - |
| 2822 | Removes the item \a item and all its children from the scene. The | - |
| 2823 | ownership of \a item is passed on to the caller (i.e., | - |
| 2824 | QGraphicsScene will no longer delete \a item when destroyed). | - |
| 2825 | | - |
| 2826 | \sa addItem() | - |
| 2827 | */ | - |
| 2828 | void QGraphicsScene::removeItem(QGraphicsItem *item) | - |
| 2829 | { | - |
| 2830 | // ### Refactoring: This function shares much functionality with _q_removeItemLater() | - |
| 2831 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 2832 | if (!item) { partially evaluated: !item| no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
| 2833 | qWarning("QGraphicsScene::removeItem: cannot remove 0-item"); never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsscene.cpp", 2833, __PRETTY_FUNCTION__).warning("QGraphicsScene::removeItem: cannot remove 0-item"); | - |
| 2834 | return; | 0 |
| 2835 | } | - |
| 2836 | if (item->scene() != this) { partially evaluated: item->scene() != this| no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
| 2837 | qWarning("QGraphicsScene::removeItem: item %p's scene (%p)" never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsscene.cpp", 2837, __PRETTY_FUNCTION__).warning("QGraphicsScene::removeItem: item %p's scene (%p)" | - |
| 2838 | " is different from this scene (%p)", never executed (the execution status of this line is deduced): " is different from this scene (%p)", | - |
| 2839 | item, item->scene(), this); never executed (the execution status of this line is deduced): item, item->scene(), this); | - |
| 2840 | return; | 0 |
| 2841 | } | - |
| 2842 | | - |
| 2843 | // Notify the item that it's scene is changing to 0, allowing the item to | - |
| 2844 | // react. | - |
| 2845 | const QVariant newSceneVariant(item->itemChange(QGraphicsItem::ItemSceneChange, executed (the execution status of this line is deduced): const QVariant newSceneVariant(item->itemChange(QGraphicsItem::ItemSceneChange, | - |
| 2846 | QVariant::fromValue<QGraphicsScene *>(0))); executed (the execution status of this line is deduced): QVariant::fromValue<QGraphicsScene *>(0))); | - |
| 2847 | QGraphicsScene *targetScene = qvariant_cast<QGraphicsScene *>(newSceneVariant); executed (the execution status of this line is deduced): QGraphicsScene *targetScene = qvariant_cast<QGraphicsScene *>(newSceneVariant); | - |
| 2848 | if (targetScene != 0 && targetScene != this) { partially evaluated: targetScene != 0| no Evaluation Count:0 | yes Evaluation Count:14 |
never evaluated: targetScene != this | 0-14 |
| 2849 | targetScene->addItem(item); never executed (the execution status of this line is deduced): targetScene->addItem(item); | - |
| 2850 | return; | 0 |
| 2851 | } | - |
| 2852 | | - |
| 2853 | d->removeItemHelper(item); executed (the execution status of this line is deduced): d->removeItemHelper(item); | - |
| 2854 | | - |
| 2855 | // Deliver post-change notification | - |
| 2856 | item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant); executed (the execution status of this line is deduced): item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant); | - |
| 2857 | | - |
| 2858 | d->updateInputMethodSensitivityInViews(); executed (the execution status of this line is deduced): d->updateInputMethodSensitivityInViews(); | - |
| 2859 | } executed: }Execution Count:14 | 14 |
| 2860 | | - |
| 2861 | /*! | - |
| 2862 | When the scene is active, this functions returns the scene's current focus | - |
| 2863 | item, or 0 if no item currently has focus. When the scene is inactive, this | - |
| 2864 | functions returns the item that will gain input focus when the scene becomes | - |
| 2865 | active. | - |
| 2866 | | - |
| 2867 | The focus item receives keyboard input when the scene receives a | - |
| 2868 | key event. | - |
| 2869 | | - |
| 2870 | \sa setFocusItem(), QGraphicsItem::hasFocus(), isActive() | - |
| 2871 | */ | - |
| 2872 | QGraphicsItem *QGraphicsScene::focusItem() const | - |
| 2873 | { | - |
| 2874 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 2875 | return isActive() ? d->focusItem : d->passiveFocusItem; executed: return isActive() ? d->focusItem : d->passiveFocusItem;Execution Count:2804 | 2804 |
| 2876 | } | - |
| 2877 | | - |
| 2878 | /*! | - |
| 2879 | Sets the scene's focus item to \a item, with the focus reason \a | - |
| 2880 | focusReason, after removing focus from any previous item that may have had | - |
| 2881 | focus. | - |
| 2882 | | - |
| 2883 | If \a item is 0, or if it either does not accept focus (i.e., it does not | - |
| 2884 | have the QGraphicsItem::ItemIsFocusable flag enabled), or is not visible | - |
| 2885 | or not enabled, this function only removes focus from any previous | - |
| 2886 | focusitem. | - |
| 2887 | | - |
| 2888 | If item is not 0, and the scene does not currently have focus (i.e., | - |
| 2889 | hasFocus() returns false), this function will call setFocus() | - |
| 2890 | automatically. | - |
| 2891 | | - |
| 2892 | \sa focusItem(), hasFocus(), setFocus() | - |
| 2893 | */ | - |
| 2894 | void QGraphicsScene::setFocusItem(QGraphicsItem *item, Qt::FocusReason focusReason) | - |
| 2895 | { | - |
| 2896 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 2897 | if (item) evaluated: item| yes Evaluation Count:14 | yes Evaluation Count:132 |
| 14-132 |
| 2898 | item->setFocus(focusReason); executed: item->setFocus(focusReason);Execution Count:14 | 14 |
| 2899 | else | - |
| 2900 | d->setFocusItemHelper(item, focusReason); executed: d->setFocusItemHelper(item, focusReason);Execution Count:132 | 132 |
| 2901 | } | - |
| 2902 | | - |
| 2903 | /*! | - |
| 2904 | Returns true if the scene has focus; otherwise returns false. If the scene | - |
| 2905 | has focus, it will will forward key events from QKeyEvent to any item that | - |
| 2906 | has focus. | - |
| 2907 | | - |
| 2908 | \sa setFocus(), setFocusItem() | - |
| 2909 | */ | - |
| 2910 | bool QGraphicsScene::hasFocus() const | - |
| 2911 | { | - |
| 2912 | Q_D(const QGraphicsScene); never executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 2913 | return d->hasFocus; never executed: return d->hasFocus; | 0 |
| 2914 | } | - |
| 2915 | | - |
| 2916 | /*! | - |
| 2917 | Sets focus on the scene by sending a QFocusEvent to the scene, passing \a | - |
| 2918 | focusReason as the reason. If the scene regains focus after having | - |
| 2919 | previously lost it while an item had focus, the last focus item will | - |
| 2920 | receive focus with \a focusReason as the reason. | - |
| 2921 | | - |
| 2922 | If the scene already has focus, this function does nothing. | - |
| 2923 | | - |
| 2924 | \sa hasFocus(), clearFocus(), setFocusItem() | - |
| 2925 | */ | - |
| 2926 | void QGraphicsScene::setFocus(Qt::FocusReason focusReason) | - |
| 2927 | { | - |
| 2928 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 2929 | if (d->hasFocus || !isActive()) evaluated: d->hasFocus| yes Evaluation Count:18 | yes Evaluation Count:20 |
partially evaluated: !isActive()| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 2930 | return; executed: return;Execution Count:18 | 18 |
| 2931 | QFocusEvent event(QEvent::FocusIn, focusReason); executed (the execution status of this line is deduced): QFocusEvent event(QEvent::FocusIn, focusReason); | - |
| 2932 | QCoreApplication::sendEvent(this, &event); executed (the execution status of this line is deduced): QCoreApplication::sendEvent(this, &event); | - |
| 2933 | } executed: }Execution Count:20 | 20 |
| 2934 | | - |
| 2935 | /*! | - |
| 2936 | Clears focus from the scene. If any item has focus when this function is | - |
| 2937 | called, it will lose focus, and regain focus again once the scene regains | - |
| 2938 | focus. | - |
| 2939 | | - |
| 2940 | A scene that does not have focus ignores key events. | - |
| 2941 | | - |
| 2942 | \sa hasFocus(), setFocus(), setFocusItem() | - |
| 2943 | */ | - |
| 2944 | void QGraphicsScene::clearFocus() | - |
| 2945 | { | - |
| 2946 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 2947 | if (d->hasFocus) { partially evaluated: d->hasFocus| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 2948 | d->hasFocus = false; executed (the execution status of this line is deduced): d->hasFocus = false; | - |
| 2949 | d->passiveFocusItem = d->focusItem; executed (the execution status of this line is deduced): d->passiveFocusItem = d->focusItem; | - |
| 2950 | setFocusItem(0, Qt::OtherFocusReason); executed (the execution status of this line is deduced): setFocusItem(0, Qt::OtherFocusReason); | - |
| 2951 | } executed: }Execution Count:8 | 8 |
| 2952 | } executed: }Execution Count:8 | 8 |
| 2953 | | - |
| 2954 | /*! | - |
| 2955 | \property QGraphicsScene::stickyFocus | - |
| 2956 | \brief whether clicking into the scene background will clear focus | - |
| 2957 | | - |
| 2958 | \since 4.6 | - |
| 2959 | | - |
| 2960 | In a QGraphicsScene with stickyFocus set to true, focus will remain | - |
| 2961 | unchanged when the user clicks into the scene background or on an item | - |
| 2962 | that does not accept focus. Otherwise, focus will be cleared. | - |
| 2963 | | - |
| 2964 | By default, this property is false. | - |
| 2965 | | - |
| 2966 | Focus changes in response to a mouse press. You can reimplement | - |
| 2967 | mousePressEvent() in a subclass of QGraphicsScene to toggle this property | - |
| 2968 | based on where the user has clicked. | - |
| 2969 | | - |
| 2970 | \sa clearFocus(), setFocusItem() | - |
| 2971 | */ | - |
| 2972 | void QGraphicsScene::setStickyFocus(bool enabled) | - |
| 2973 | { | - |
| 2974 | Q_D(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 2975 | d->stickyFocus = enabled; never executed (the execution status of this line is deduced): d->stickyFocus = enabled; | - |
| 2976 | } | 0 |
| 2977 | bool QGraphicsScene::stickyFocus() const | - |
| 2978 | { | - |
| 2979 | Q_D(const QGraphicsScene); never executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 2980 | return d->stickyFocus; never executed: return d->stickyFocus; | 0 |
| 2981 | } | - |
| 2982 | | - |
| 2983 | /*! | - |
| 2984 | Returns the current mouse grabber item, or 0 if no item is currently | - |
| 2985 | grabbing the mouse. The mouse grabber item is the item that receives all | - |
| 2986 | mouse events sent to the scene. | - |
| 2987 | | - |
| 2988 | An item becomes a mouse grabber when it receives and accepts a | - |
| 2989 | mouse press event, and it stays the mouse grabber until either of | - |
| 2990 | the following events occur: | - |
| 2991 | | - |
| 2992 | \list | - |
| 2993 | \li If the item receives a mouse release event when there are no other | - |
| 2994 | buttons pressed, it loses the mouse grab. | - |
| 2995 | \li If the item becomes invisible (i.e., someone calls \c {item->setVisible(false)}), | - |
| 2996 | or if it becomes disabled (i.e., someone calls \c {item->setEnabled(false)}), | - |
| 2997 | it loses the mouse grab. | - |
| 2998 | \li If the item is removed from the scene, it loses the mouse grab. | - |
| 2999 | \endlist | - |
| 3000 | | - |
| 3001 | If the item loses its mouse grab, the scene will ignore all mouse events | - |
| 3002 | until a new item grabs the mouse (i.e., until a new item receives a mouse | - |
| 3003 | press event). | - |
| 3004 | */ | - |
| 3005 | QGraphicsItem *QGraphicsScene::mouseGrabberItem() const | - |
| 3006 | { | - |
| 3007 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 3008 | return !d->mouseGrabberItems.isEmpty() ? d->mouseGrabberItems.last() : 0; executed: return !d->mouseGrabberItems.isEmpty() ? d->mouseGrabberItems.last() : 0;Execution Count:2679 | 2679 |
| 3009 | } | - |
| 3010 | | - |
| 3011 | /*! | - |
| 3012 | \property QGraphicsScene::backgroundBrush | - |
| 3013 | \brief the background brush of the scene. | - |
| 3014 | | - |
| 3015 | Set this property to changes the scene's background to a different color, | - |
| 3016 | gradient or texture. The default background brush is Qt::NoBrush. The | - |
| 3017 | background is drawn before (behind) the items. | - |
| 3018 | | - |
| 3019 | Example: | - |
| 3020 | | - |
| 3021 | \snippet code/src_gui_graphicsview_qgraphicsscene.cpp 3 | - |
| 3022 | | - |
| 3023 | QGraphicsScene::render() calls drawBackground() to draw the scene | - |
| 3024 | background. For more detailed control over how the background is drawn, | - |
| 3025 | you can reimplement drawBackground() in a subclass of QGraphicsScene. | - |
| 3026 | */ | - |
| 3027 | QBrush QGraphicsScene::backgroundBrush() const | - |
| 3028 | { | - |
| 3029 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 3030 | return d->backgroundBrush; executed: return d->backgroundBrush;Execution Count:259 | 259 |
| 3031 | } | - |
| 3032 | void QGraphicsScene::setBackgroundBrush(const QBrush &brush) | - |
| 3033 | { | - |
| 3034 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3035 | d->backgroundBrush = brush; executed (the execution status of this line is deduced): d->backgroundBrush = brush; | - |
| 3036 | foreach (QGraphicsView *view, d->views) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(d->views)> _container_(d->views); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 3037 | view->resetCachedContent(); executed (the execution status of this line is deduced): view->resetCachedContent(); | - |
| 3038 | view->viewport()->update(); executed (the execution status of this line is deduced): view->viewport()->update(); | - |
| 3039 | } executed: }Execution Count:153 | 153 |
| 3040 | update(); executed (the execution status of this line is deduced): update(); | - |
| 3041 | } executed: }Execution Count:154 | 154 |
| 3042 | | - |
| 3043 | /*! | - |
| 3044 | \property QGraphicsScene::foregroundBrush | - |
| 3045 | \brief the foreground brush of the scene. | - |
| 3046 | | - |
| 3047 | Change this property to set the scene's foreground to a different | - |
| 3048 | color, gradient or texture. | - |
| 3049 | | - |
| 3050 | The foreground is drawn after (on top of) the items. The default | - |
| 3051 | foreground brush is Qt::NoBrush ( i.e. the foreground is not | - |
| 3052 | drawn). | - |
| 3053 | | - |
| 3054 | Example: | - |
| 3055 | | - |
| 3056 | \snippet code/src_gui_graphicsview_qgraphicsscene.cpp 4 | - |
| 3057 | | - |
| 3058 | QGraphicsScene::render() calls drawForeground() to draw the scene | - |
| 3059 | foreground. For more detailed control over how the foreground is | - |
| 3060 | drawn, you can reimplement the drawForeground() function in a | - |
| 3061 | QGraphicsScene subclass. | - |
| 3062 | */ | - |
| 3063 | QBrush QGraphicsScene::foregroundBrush() const | - |
| 3064 | { | - |
| 3065 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 3066 | return d->foregroundBrush; executed: return d->foregroundBrush;Execution Count:255 | 255 |
| 3067 | } | - |
| 3068 | void QGraphicsScene::setForegroundBrush(const QBrush &brush) | - |
| 3069 | { | - |
| 3070 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3071 | d->foregroundBrush = brush; executed (the execution status of this line is deduced): d->foregroundBrush = brush; | - |
| 3072 | foreach (QGraphicsView *view, views()) executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(views())> _container_(views()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 3073 | view->viewport()->update(); executed: view->viewport()->update();Execution Count:103 | 103 |
| 3074 | update(); executed (the execution status of this line is deduced): update(); | - |
| 3075 | } executed: }Execution Count:103 | 103 |
| 3076 | | - |
| 3077 | /*! | - |
| 3078 | This method is used by input methods to query a set of properties of | - |
| 3079 | the scene to be able to support complex input method operations as support | - |
| 3080 | for surrounding text and reconversions. | - |
| 3081 | | - |
| 3082 | The \a query parameter specifies which property is queried. | - |
| 3083 | | - |
| 3084 | \sa QWidget::inputMethodQuery() | - |
| 3085 | */ | - |
| 3086 | QVariant QGraphicsScene::inputMethodQuery(Qt::InputMethodQuery query) const | - |
| 3087 | { | - |
| 3088 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 3089 | if (!d->focusItem || !(d->focusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)) evaluated: !d->focusItem| yes Evaluation Count:2 | yes Evaluation Count:9 |
partially evaluated: !(d->focusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 3090 | return QVariant(); executed: return QVariant();Execution Count:2 | 2 |
| 3091 | const QTransform matrix = d->focusItem->sceneTransform(); executed (the execution status of this line is deduced): const QTransform matrix = d->focusItem->sceneTransform(); | - |
| 3092 | QVariant value = d->focusItem->inputMethodQuery(query); executed (the execution status of this line is deduced): QVariant value = d->focusItem->inputMethodQuery(query); | - |
| 3093 | if (value.type() == QVariant::RectF) evaluated: value.type() == QVariant::RectF| yes Evaluation Count:2 | yes Evaluation Count:7 |
| 2-7 |
| 3094 | value = matrix.mapRect(value.toRectF()); executed: value = matrix.mapRect(value.toRectF());Execution Count:2 | 2 |
| 3095 | else if (value.type() == QVariant::PointF) partially evaluated: value.type() == QVariant::PointF| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 3096 | value = matrix.map(value.toPointF()); never executed: value = matrix.map(value.toPointF()); | 0 |
| 3097 | else if (value.type() == QVariant::Rect) partially evaluated: value.type() == QVariant::Rect| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 3098 | value = matrix.mapRect(value.toRect()); never executed: value = matrix.mapRect(value.toRect()); | 0 |
| 3099 | else if (value.type() == QVariant::Point) partially evaluated: value.type() == QVariant::Point| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 3100 | value = matrix.map(value.toPoint()); never executed: value = matrix.map(value.toPoint()); | 0 |
| 3101 | return value; executed: return value;Execution Count:9 | 9 |
| 3102 | } | - |
| 3103 | | - |
| 3104 | /*! | - |
| 3105 | \fn void QGraphicsScene::update(const QRectF &rect) | - |
| 3106 | Schedules a redraw of the area \a rect on the scene. | - |
| 3107 | | - |
| 3108 | \sa sceneRect(), changed() | - |
| 3109 | */ | - |
| 3110 | void QGraphicsScene::update(const QRectF &rect) | - |
| 3111 | { | - |
| 3112 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3113 | if (d->updateAll || (rect.isEmpty() && !rect.isNull())) evaluated: d->updateAll| yes Evaluation Count:380 | yes Evaluation Count:1491 |
evaluated: rect.isEmpty()| yes Evaluation Count:1370 | yes Evaluation Count:121 |
partially evaluated: !rect.isNull()| no Evaluation Count:0 | yes Evaluation Count:1370 |
| 0-1491 |
| 3114 | return; executed: return;Execution Count:380 | 380 |
| 3115 | | - |
| 3116 | // Check if anyone's connected; if not, we can send updates directly to | - |
| 3117 | // the views. Otherwise or if there are no views, use old behavior. | - |
| 3118 | bool directUpdates = !(d->isSignalConnected(d->changedSignalIndex)) && !d->views.isEmpty(); evaluated: !(d->isSignalConnected(d->changedSignalIndex))| yes Evaluation Count:1477 | yes Evaluation Count:14 |
evaluated: !d->views.isEmpty()| yes Evaluation Count:160 | yes Evaluation Count:1317 |
| 14-1477 |
| 3119 | if (rect.isNull()) { evaluated: rect.isNull()| yes Evaluation Count:1370 | yes Evaluation Count:121 |
| 121-1370 |
| 3120 | d->updateAll = true; executed (the execution status of this line is deduced): d->updateAll = true; | - |
| 3121 | d->updatedRects.clear(); executed (the execution status of this line is deduced): d->updatedRects.clear(); | - |
| 3122 | if (directUpdates) { evaluated: directUpdates| yes Evaluation Count:54 | yes Evaluation Count:1316 |
| 54-1316 |
| 3123 | // Update all views. | - |
| 3124 | for (int i = 0; i < d->views.size(); ++i) evaluated: i < d->views.size()| yes Evaluation Count:54 | yes Evaluation Count:54 |
| 54 |
| 3125 | d->views.at(i)->d_func()->fullUpdatePending = true; executed: d->views.at(i)->d_func()->fullUpdatePending = true;Execution Count:54 | 54 |
| 3126 | } executed: }Execution Count:54 | 54 |
| 3127 | } else { executed: }Execution Count:1370 | 1370 |
| 3128 | if (directUpdates) { evaluated: directUpdates| yes Evaluation Count:106 | yes Evaluation Count:15 |
| 15-106 |
| 3129 | // Update all views. | - |
| 3130 | for (int i = 0; i < d->views.size(); ++i) { evaluated: i < d->views.size()| yes Evaluation Count:106 | yes Evaluation Count:106 |
| 106 |
| 3131 | QGraphicsView *view = d->views.at(i); executed (the execution status of this line is deduced): QGraphicsView *view = d->views.at(i); | - |
| 3132 | if (view->isTransformed()) partially evaluated: view->isTransformed()| yes Evaluation Count:106 | no Evaluation Count:0 |
| 0-106 |
| 3133 | view->d_func()->updateRectF(view->viewportTransform().mapRect(rect)); executed: view->d_func()->updateRectF(view->viewportTransform().mapRect(rect));Execution Count:106 | 106 |
| 3134 | else | - |
| 3135 | view->d_func()->updateRectF(rect); never executed: view->d_func()->updateRectF(rect); | 0 |
| 3136 | } | - |
| 3137 | } else { executed: }Execution Count:106 | 106 |
| 3138 | d->updatedRects << rect; executed (the execution status of this line is deduced): d->updatedRects << rect; | - |
| 3139 | } executed: }Execution Count:15 | 15 |
| 3140 | } | - |
| 3141 | | - |
| 3142 | if (!d->calledEmitUpdated) { evaluated: !d->calledEmitUpdated| yes Evaluation Count:1385 | yes Evaluation Count:106 |
| 106-1385 |
| 3143 | d->calledEmitUpdated = true; executed (the execution status of this line is deduced): d->calledEmitUpdated = true; | - |
| 3144 | QMetaObject::invokeMethod(this, "_q_emitUpdated", Qt::QueuedConnection); executed (the execution status of this line is deduced): QMetaObject::invokeMethod(this, "_q_emitUpdated", Qt::QueuedConnection); | - |
| 3145 | } executed: }Execution Count:1385 | 1385 |
| 3146 | } executed: }Execution Count:1491 | 1491 |
| 3147 | | - |
| 3148 | /*! | - |
| 3149 | \fn void QGraphicsScene::update(qreal x, qreal y, qreal w, qreal h) | - |
| 3150 | \overload | - |
| 3151 | \since 4.3 | - |
| 3152 | | - |
| 3153 | This function is equivalent to calling update(QRectF(\a x, \a y, \a w, | - |
| 3154 | \a h)); | - |
| 3155 | */ | - |
| 3156 | | - |
| 3157 | /*! | - |
| 3158 | Invalidates and schedules a redraw of the \a layers in \a rect on the | - |
| 3159 | scene. Any cached content in \a layers is unconditionally invalidated and | - |
| 3160 | redrawn. | - |
| 3161 | | - |
| 3162 | You can use this function overload to notify QGraphicsScene of changes to | - |
| 3163 | the background or the foreground of the scene. This function is commonly | - |
| 3164 | used for scenes with tile-based backgrounds to notify changes when | - |
| 3165 | QGraphicsView has enabled | - |
| 3166 | \l{QGraphicsView::CacheBackground}{CacheBackground}. | - |
| 3167 | | - |
| 3168 | Example: | - |
| 3169 | | - |
| 3170 | \snippet code/src_gui_graphicsview_qgraphicsscene.cpp 5 | - |
| 3171 | | - |
| 3172 | Note that QGraphicsView currently supports background caching only (see | - |
| 3173 | QGraphicsView::CacheBackground). This function is equivalent to calling | - |
| 3174 | update() if any layer but BackgroundLayer is passed. | - |
| 3175 | | - |
| 3176 | \sa QGraphicsView::resetCachedContent() | - |
| 3177 | */ | - |
| 3178 | void QGraphicsScene::invalidate(const QRectF &rect, SceneLayers layers) | - |
| 3179 | { | - |
| 3180 | foreach (QGraphicsView *view, views()) never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(views())> _container_(views()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 3181 | view->invalidateScene(rect, layers); never executed: view->invalidateScene(rect, layers); | 0 |
| 3182 | update(rect); never executed (the execution status of this line is deduced): update(rect); | - |
| 3183 | } | 0 |
| 3184 | | - |
| 3185 | /*! | - |
| 3186 | \fn void QGraphicsScene::invalidate(qreal x, qreal y, qreal w, qreal h, SceneLayers layers) | - |
| 3187 | \overload | - |
| 3188 | \since 4.3 | - |
| 3189 | | - |
| 3190 | This convenience function is equivalent to calling invalidate(QRectF(\a x, \a | - |
| 3191 | y, \a w, \a h), \a layers); | - |
| 3192 | */ | - |
| 3193 | | - |
| 3194 | /*! | - |
| 3195 | Returns a list of all the views that display this scene. | - |
| 3196 | | - |
| 3197 | \sa QGraphicsView::scene() | - |
| 3198 | */ | - |
| 3199 | QList <QGraphicsView *> QGraphicsScene::views() const | - |
| 3200 | { | - |
| 3201 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 3202 | return d->views; executed: return d->views;Execution Count:258 | 258 |
| 3203 | } | - |
| 3204 | | - |
| 3205 | /*! | - |
| 3206 | This slot \e advances the scene by one step, by calling | - |
| 3207 | QGraphicsItem::advance() for all items on the scene. This is done in two | - |
| 3208 | phases: in the first phase, all items are notified that the scene is about | - |
| 3209 | to change, and in the second phase all items are notified that they can | - |
| 3210 | move. In the first phase, QGraphicsItem::advance() is called passing a | - |
| 3211 | value of 0 as an argument, and 1 is passed in the second phase. | - |
| 3212 | | - |
| 3213 | Note that you can also use the \l{The Animation Framework}{Animation | - |
| 3214 | Framework} for animations. | - |
| 3215 | | - |
| 3216 | \sa QGraphicsItem::advance(), QTimeLine | - |
| 3217 | */ | - |
| 3218 | void QGraphicsScene::advance() | - |
| 3219 | { | - |
| 3220 | for (int i = 0; i < 2; ++i) { | 0 |
| 3221 | foreach (QGraphicsItem *item, items()) never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(items())> _container_(items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 3222 | item->advance(i); never executed: item->advance(i); | 0 |
| 3223 | } | 0 |
| 3224 | } | 0 |
| 3225 | | - |
| 3226 | /*! | - |
| 3227 | Processes the event \a event, and dispatches it to the respective | - |
| 3228 | event handlers. | - |
| 3229 | | - |
| 3230 | In addition to calling the convenience event handlers, this | - |
| 3231 | function is responsible for converting mouse move events to hover | - |
| 3232 | events for when there is no mouse grabber item. Hover events are | - |
| 3233 | delivered directly to items; there is no convenience function for | - |
| 3234 | them. | - |
| 3235 | | - |
| 3236 | Unlike QWidget, QGraphicsScene does not have the convenience functions | - |
| 3237 | \l{QWidget::}{enterEvent()} and \l{QWidget::}{leaveEvent()}. Use this | - |
| 3238 | function to obtain those events instead. | - |
| 3239 | | - |
| 3240 | \sa contextMenuEvent(), keyPressEvent(), keyReleaseEvent(), | - |
| 3241 | mousePressEvent(), mouseMoveEvent(), mouseReleaseEvent(), | - |
| 3242 | mouseDoubleClickEvent(), focusInEvent(), focusOutEvent() | - |
| 3243 | */ | - |
| 3244 | bool QGraphicsScene::event(QEvent *event) | - |
| 3245 | { | - |
| 3246 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3247 | | - |
| 3248 | switch (event->type()) { | - |
| 3249 | case QEvent::GraphicsSceneMousePress: | - |
| 3250 | case QEvent::GraphicsSceneMouseMove: | - |
| 3251 | case QEvent::GraphicsSceneMouseRelease: | - |
| 3252 | case QEvent::GraphicsSceneMouseDoubleClick: | - |
| 3253 | case QEvent::GraphicsSceneHoverEnter: | - |
| 3254 | case QEvent::GraphicsSceneHoverLeave: | - |
| 3255 | case QEvent::GraphicsSceneHoverMove: | - |
| 3256 | case QEvent::TouchBegin: | - |
| 3257 | case QEvent::TouchUpdate: | - |
| 3258 | case QEvent::TouchEnd: | - |
| 3259 | // Reset the under-mouse list to ensure that this event gets fresh | - |
| 3260 | // item-under-mouse data. Be careful about this list; if people delete | - |
| 3261 | // items from inside event handlers, this list can quickly end up | - |
| 3262 | // having stale pointers in it. We need to clear it before dispatching | - |
| 3263 | // events that use it. | - |
| 3264 | // ### this should only be cleared if we received a new mouse move event, | - |
| 3265 | // which relies on us fixing the replay mechanism in QGraphicsView. | - |
| 3266 | d->cachedItemsUnderMouse.clear(); executed (the execution status of this line is deduced): d->cachedItemsUnderMouse.clear(); | - |
| 3267 | default: | - |
| 3268 | break; executed: break;Execution Count:4316 | 4316 |
| 3269 | } | - |
| 3270 | | - |
| 3271 | switch (event->type()) { | - |
| 3272 | case QEvent::GraphicsSceneDragEnter: | - |
| 3273 | dragEnterEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); never executed (the execution status of this line is deduced): dragEnterEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); | - |
| 3274 | break; | 0 |
| 3275 | case QEvent::GraphicsSceneDragMove: | - |
| 3276 | dragMoveEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); never executed (the execution status of this line is deduced): dragMoveEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); | - |
| 3277 | break; | 0 |
| 3278 | case QEvent::GraphicsSceneDragLeave: | - |
| 3279 | dragLeaveEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); never executed (the execution status of this line is deduced): dragLeaveEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); | - |
| 3280 | break; | 0 |
| 3281 | case QEvent::GraphicsSceneDrop: | - |
| 3282 | dropEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); never executed (the execution status of this line is deduced): dropEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); | - |
| 3283 | break; | 0 |
| 3284 | case QEvent::GraphicsSceneContextMenu: | - |
| 3285 | contextMenuEvent(static_cast<QGraphicsSceneContextMenuEvent *>(event)); executed (the execution status of this line is deduced): contextMenuEvent(static_cast<QGraphicsSceneContextMenuEvent *>(event)); | - |
| 3286 | break; executed: break;Execution Count:100 | 100 |
| 3287 | case QEvent::KeyPress: | - |
| 3288 | if (!d->focusItem) { partially evaluated: !d->focusItem| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 3289 | QKeyEvent *k = static_cast<QKeyEvent *>(event); never executed (the execution status of this line is deduced): QKeyEvent *k = static_cast<QKeyEvent *>(event); | - |
| 3290 | if (k->key() == Qt::Key_Tab || k->key() == Qt::Key_Backtab) { never evaluated: k->key() == Qt::Key_Tab never evaluated: k->key() == Qt::Key_Backtab | 0 |
| 3291 | if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier? never evaluated: !(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier)) | 0 |
| 3292 | bool res = false; never executed (the execution status of this line is deduced): bool res = false; | - |
| 3293 | if (k->key() == Qt::Key_Backtab never evaluated: k->key() == Qt::Key_Backtab | 0 |
| 3294 | || (k->key() == Qt::Key_Tab && (k->modifiers() & Qt::ShiftModifier))) { never evaluated: k->key() == Qt::Key_Tab never evaluated: (k->modifiers() & Qt::ShiftModifier) | 0 |
| 3295 | res = focusNextPrevChild(false); never executed (the execution status of this line is deduced): res = focusNextPrevChild(false); | - |
| 3296 | } else if (k->key() == Qt::Key_Tab) { never executed: } never evaluated: k->key() == Qt::Key_Tab | 0 |
| 3297 | res = focusNextPrevChild(true); never executed (the execution status of this line is deduced): res = focusNextPrevChild(true); | - |
| 3298 | } | 0 |
| 3299 | if (!res) | 0 |
| 3300 | event->ignore(); never executed: event->ignore(); | 0 |
| 3301 | return true; never executed: return true; | 0 |
| 3302 | } | - |
| 3303 | } | 0 |
| 3304 | } | 0 |
| 3305 | keyPressEvent(static_cast<QKeyEvent *>(event)); executed (the execution status of this line is deduced): keyPressEvent(static_cast<QKeyEvent *>(event)); | - |
| 3306 | break; executed: break;Execution Count:1 | 1 |
| 3307 | case QEvent::KeyRelease: | - |
| 3308 | keyReleaseEvent(static_cast<QKeyEvent *>(event)); never executed (the execution status of this line is deduced): keyReleaseEvent(static_cast<QKeyEvent *>(event)); | - |
| 3309 | break; | 0 |
| 3310 | case QEvent::ShortcutOverride: { | - |
| 3311 | QGraphicsItem *parent = focusItem(); executed (the execution status of this line is deduced): QGraphicsItem *parent = focusItem(); | - |
| 3312 | while (parent) { evaluated: parent| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 3313 | d->sendEvent(parent, event); executed (the execution status of this line is deduced): d->sendEvent(parent, event); | - |
| 3314 | if (event->isAccepted()) partially evaluated: event->isAccepted()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 3315 | return true; never executed: return true; | 0 |
| 3316 | parent = parent->parentItem(); executed (the execution status of this line is deduced): parent = parent->parentItem(); | - |
| 3317 | } executed: }Execution Count:1 | 1 |
| 3318 | } | - |
| 3319 | return false; executed: return false;Execution Count:1 | 1 |
| 3320 | case QEvent::GraphicsSceneMouseMove: | - |
| 3321 | { | - |
| 3322 | QGraphicsSceneMouseEvent *mouseEvent = static_cast<QGraphicsSceneMouseEvent *>(event); executed (the execution status of this line is deduced): QGraphicsSceneMouseEvent *mouseEvent = static_cast<QGraphicsSceneMouseEvent *>(event); | - |
| 3323 | d->lastSceneMousePos = mouseEvent->scenePos(); executed (the execution status of this line is deduced): d->lastSceneMousePos = mouseEvent->scenePos(); | - |
| 3324 | mouseMoveEvent(mouseEvent); executed (the execution status of this line is deduced): mouseMoveEvent(mouseEvent); | - |
| 3325 | break; executed: break;Execution Count:57 | 57 |
| 3326 | } | - |
| 3327 | case QEvent::GraphicsSceneMousePress: | - |
| 3328 | mousePressEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); executed (the execution status of this line is deduced): mousePressEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); | - |
| 3329 | break; executed: break;Execution Count:116 | 116 |
| 3330 | case QEvent::GraphicsSceneMouseRelease: | - |
| 3331 | mouseReleaseEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); executed (the execution status of this line is deduced): mouseReleaseEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); | - |
| 3332 | break; executed: break;Execution Count:112 | 112 |
| 3333 | case QEvent::GraphicsSceneMouseDoubleClick: | - |
| 3334 | mouseDoubleClickEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); never executed (the execution status of this line is deduced): mouseDoubleClickEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); | - |
| 3335 | break; | 0 |
| 3336 | case QEvent::GraphicsSceneWheel: | - |
| 3337 | wheelEvent(static_cast<QGraphicsSceneWheelEvent *>(event)); executed (the execution status of this line is deduced): wheelEvent(static_cast<QGraphicsSceneWheelEvent *>(event)); | - |
| 3338 | break; executed: break;Execution Count:2 | 2 |
| 3339 | case QEvent::FocusIn: | - |
| 3340 | focusInEvent(static_cast<QFocusEvent *>(event)); executed (the execution status of this line is deduced): focusInEvent(static_cast<QFocusEvent *>(event)); | - |
| 3341 | break; executed: break;Execution Count:581 | 581 |
| 3342 | case QEvent::FocusOut: | - |
| 3343 | focusOutEvent(static_cast<QFocusEvent *>(event)); executed (the execution status of this line is deduced): focusOutEvent(static_cast<QFocusEvent *>(event)); | - |
| 3344 | break; executed: break;Execution Count:4 | 4 |
| 3345 | case QEvent::GraphicsSceneHoverEnter: | - |
| 3346 | case QEvent::GraphicsSceneHoverLeave: | - |
| 3347 | case QEvent::GraphicsSceneHoverMove: | - |
| 3348 | { | - |
| 3349 | QGraphicsSceneHoverEvent *hoverEvent = static_cast<QGraphicsSceneHoverEvent *>(event); never executed (the execution status of this line is deduced): QGraphicsSceneHoverEvent *hoverEvent = static_cast<QGraphicsSceneHoverEvent *>(event); | - |
| 3350 | d->lastSceneMousePos = hoverEvent->scenePos(); never executed (the execution status of this line is deduced): d->lastSceneMousePos = hoverEvent->scenePos(); | - |
| 3351 | d->dispatchHoverEvent(hoverEvent); never executed (the execution status of this line is deduced): d->dispatchHoverEvent(hoverEvent); | - |
| 3352 | break; | 0 |
| 3353 | } | - |
| 3354 | case QEvent::Leave: | - |
| 3355 | // hackieshly unpacking the viewport pointer from the leave event. | - |
| 3356 | d->leaveScene(reinterpret_cast<QWidget *>(event->d)); executed (the execution status of this line is deduced): d->leaveScene(reinterpret_cast<QWidget *>(event->d)); | - |
| 3357 | break; executed: break;Execution Count:2 | 2 |
| 3358 | case QEvent::GraphicsSceneHelp: | - |
| 3359 | helpEvent(static_cast<QGraphicsSceneHelpEvent *>(event)); never executed (the execution status of this line is deduced): helpEvent(static_cast<QGraphicsSceneHelpEvent *>(event)); | - |
| 3360 | break; | 0 |
| 3361 | case QEvent::InputMethod: | - |
| 3362 | inputMethodEvent(static_cast<QInputMethodEvent *>(event)); executed (the execution status of this line is deduced): inputMethodEvent(static_cast<QInputMethodEvent *>(event)); | - |
| 3363 | break; executed: break;Execution Count:3 | 3 |
| 3364 | case QEvent::WindowActivate: | - |
| 3365 | if (!d->activationRefCount++) { evaluated: !d->activationRefCount++| yes Evaluation Count:567 | yes Evaluation Count:5 |
| 5-567 |
| 3366 | if (d->lastActivePanel) { evaluated: d->lastActivePanel| yes Evaluation Count:14 | yes Evaluation Count:553 |
| 14-553 |
| 3367 | // Activate the last panel. | - |
| 3368 | d->setActivePanelHelper(d->lastActivePanel, true); executed (the execution status of this line is deduced): d->setActivePanelHelper(d->lastActivePanel, true); | - |
| 3369 | } else if (d->tabFocusFirst && d->tabFocusFirst->isPanel()) { executed: }Execution Count:14 evaluated: d->tabFocusFirst| yes Evaluation Count:10 | yes Evaluation Count:543 |
partially evaluated: d->tabFocusFirst->isPanel()| no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-543 |
| 3370 | // Activate the panel of the first item in the tab focus | - |
| 3371 | // chain. | - |
| 3372 | d->setActivePanelHelper(d->tabFocusFirst, true); never executed (the execution status of this line is deduced): d->setActivePanelHelper(d->tabFocusFirst, true); | - |
| 3373 | } else { | 0 |
| 3374 | // Activate all toplevel items. | - |
| 3375 | QEvent event(QEvent::WindowActivate); executed (the execution status of this line is deduced): QEvent event(QEvent::WindowActivate); | - |
| 3376 | foreach (QGraphicsItem *item, items()) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(items())> _container_(items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 3377 | if (item->isVisible() && !item->isPanel() && !item->parentItem()) evaluated: item->isVisible()| yes Evaluation Count:311 | yes Evaluation Count:1 |
partially evaluated: !item->isPanel()| yes Evaluation Count:311 | no Evaluation Count:0 |
evaluated: !item->parentItem()| yes Evaluation Count:283 | yes Evaluation Count:28 |
| 0-311 |
| 3378 | sendEvent(item, &event); executed: sendEvent(item, &event);Execution Count:283 | 283 |
| 3379 | } executed: }Execution Count:312 | 312 |
| 3380 | } executed: }Execution Count:553 | 553 |
| 3381 | } | - |
| 3382 | break; executed: break;Execution Count:572 | 572 |
| 3383 | case QEvent::WindowDeactivate: | - |
| 3384 | if (!--d->activationRefCount) { evaluated: !--d->activationRefCount| yes Evaluation Count:10 | yes Evaluation Count:3 |
| 3-10 |
| 3385 | if (d->activePanel) { partially evaluated: d->activePanel| no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
| 3386 | // Deactivate the active panel (but keep it so we can | - |
| 3387 | // reactivate it later). | - |
| 3388 | QGraphicsItem *lastActivePanel = d->activePanel; never executed (the execution status of this line is deduced): QGraphicsItem *lastActivePanel = d->activePanel; | - |
| 3389 | d->setActivePanelHelper(0, true); never executed (the execution status of this line is deduced): d->setActivePanelHelper(0, true); | - |
| 3390 | d->lastActivePanel = lastActivePanel; never executed (the execution status of this line is deduced): d->lastActivePanel = lastActivePanel; | - |
| 3391 | } else { | 0 |
| 3392 | // Activate all toplevel items. | - |
| 3393 | QEvent event(QEvent::WindowDeactivate); executed (the execution status of this line is deduced): QEvent event(QEvent::WindowDeactivate); | - |
| 3394 | foreach (QGraphicsItem *item, items()) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(items())> _container_(items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 3395 | if (item->isVisible() && !item->isPanel() && !item->parentItem()) partially evaluated: item->isVisible()| yes Evaluation Count:6 | no Evaluation Count:0 |
partially evaluated: !item->isPanel()| yes Evaluation Count:6 | no Evaluation Count:0 |
evaluated: !item->parentItem()| yes Evaluation Count:5 | yes Evaluation Count:1 |
| 0-6 |
| 3396 | sendEvent(item, &event); executed: sendEvent(item, &event);Execution Count:5 | 5 |
| 3397 | } executed: }Execution Count:6 | 6 |
| 3398 | } executed: }Execution Count:10 | 10 |
| 3399 | } | - |
| 3400 | break; executed: break;Execution Count:13 | 13 |
| 3401 | case QEvent::ApplicationFontChange: { | - |
| 3402 | // Resolve the existing scene font. | - |
| 3403 | d->resolveFont(); never executed (the execution status of this line is deduced): d->resolveFont(); | - |
| 3404 | break; | 0 |
| 3405 | } | - |
| 3406 | case QEvent::FontChange: | - |
| 3407 | // Update the entire scene when the font changes. | - |
| 3408 | update(); never executed (the execution status of this line is deduced): update(); | - |
| 3409 | break; | 0 |
| 3410 | case QEvent::ApplicationPaletteChange: { | - |
| 3411 | // Resolve the existing scene palette. | - |
| 3412 | d->resolvePalette(); never executed (the execution status of this line is deduced): d->resolvePalette(); | - |
| 3413 | break; | 0 |
| 3414 | } | - |
| 3415 | case QEvent::PaletteChange: | - |
| 3416 | // Update the entire scene when the palette changes. | - |
| 3417 | update(); never executed (the execution status of this line is deduced): update(); | - |
| 3418 | break; | 0 |
| 3419 | case QEvent::StyleChange: | - |
| 3420 | // Reresolve all widgets' styles. Update all top-level widgets' | - |
| 3421 | // geometries that do not have an explicit style set. | - |
| 3422 | update(); never executed (the execution status of this line is deduced): update(); | - |
| 3423 | break; | 0 |
| 3424 | case QEvent::StyleAnimationUpdate: | - |
| 3425 | // Because QGraphicsItem is not a QObject, QStyle driven | - |
| 3426 | // animations are forced to update the whole scene | - |
| 3427 | update(); never executed (the execution status of this line is deduced): update(); | - |
| 3428 | break; | 0 |
| 3429 | case QEvent::TouchBegin: | - |
| 3430 | case QEvent::TouchUpdate: | - |
| 3431 | case QEvent::TouchEnd: | - |
| 3432 | d->touchEventHandler(static_cast<QTouchEvent *>(event)); never executed (the execution status of this line is deduced): d->touchEventHandler(static_cast<QTouchEvent *>(event)); | - |
| 3433 | break; | 0 |
| 3434 | #ifndef QT_NO_GESTURES | - |
| 3435 | case QEvent::Gesture: | - |
| 3436 | case QEvent::GestureOverride: | - |
| 3437 | d->gestureEventHandler(static_cast<QGestureEvent *>(event)); executed (the execution status of this line is deduced): d->gestureEventHandler(static_cast<QGestureEvent *>(event)); | - |
| 3438 | break; executed: break;Execution Count:144 | 144 |
| 3439 | #endif // QT_NO_GESTURES | - |
| 3440 | default: | - |
| 3441 | return QObject::event(event); executed: return QObject::event(event);Execution Count:2608 | 2608 |
| 3442 | } | - |
| 3443 | return true; executed: return true;Execution Count:1707 | 1707 |
| 3444 | } | - |
| 3445 | | - |
| 3446 | /*! | - |
| 3447 | \reimp | - |
| 3448 | | - |
| 3449 | QGraphicsScene filters QApplication's events to detect palette and font | - |
| 3450 | changes. | - |
| 3451 | */ | - |
| 3452 | bool QGraphicsScene::eventFilter(QObject *watched, QEvent *event) | - |
| 3453 | { | - |
| 3454 | if (watched != qApp) never evaluated: watched != (static_cast<QApplication *>(QCoreApplication::instance())) | 0 |
| 3455 | return false; never executed: return false; | 0 |
| 3456 | | - |
| 3457 | switch (event->type()) { | - |
| 3458 | case QEvent::ApplicationPaletteChange: | - |
| 3459 | QApplication::postEvent(this, new QEvent(QEvent::ApplicationPaletteChange)); never executed (the execution status of this line is deduced): QApplication::postEvent(this, new QEvent(QEvent::ApplicationPaletteChange)); | - |
| 3460 | break; | 0 |
| 3461 | case QEvent::ApplicationFontChange: | - |
| 3462 | QApplication::postEvent(this, new QEvent(QEvent::ApplicationFontChange)); never executed (the execution status of this line is deduced): QApplication::postEvent(this, new QEvent(QEvent::ApplicationFontChange)); | - |
| 3463 | break; | 0 |
| 3464 | default: | - |
| 3465 | break; | 0 |
| 3466 | } | - |
| 3467 | return false; never executed: return false; | 0 |
| 3468 | } | - |
| 3469 | | - |
| 3470 | /*! | - |
| 3471 | This event handler, for event \a contextMenuEvent, can be reimplemented in | - |
| 3472 | a subclass to receive context menu events. The default implementation | - |
| 3473 | forwards the event to the topmost visible item that accepts context menu events at | - |
| 3474 | the position of the event. If no items accept context menu events at this | - |
| 3475 | position, the event is ignored. | - |
| 3476 | | - |
| 3477 | Note: See items() for a definition of which items are considered visible by this function. | - |
| 3478 | | - |
| 3479 | \sa QGraphicsItem::contextMenuEvent() | - |
| 3480 | */ | - |
| 3481 | void QGraphicsScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent) | - |
| 3482 | { | - |
| 3483 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3484 | // Ignore by default. | - |
| 3485 | contextMenuEvent->ignore(); executed (the execution status of this line is deduced): contextMenuEvent->ignore(); | - |
| 3486 | | - |
| 3487 | // Send the event to all items at this position until one item accepts the | - |
| 3488 | // event. | - |
| 3489 | foreach (QGraphicsItem *item, d->itemsAtPosition(contextMenuEvent->screenPos(), executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(d->itemsAtPosition(contextMenuEvent->screenPos(), contextMenuEvent->scenePos(), contextMenuEvent->widget()))> _container_(d->itemsAtPosition(contextMenuEvent->screenPos(), contextMenuEvent->scenePos(), contextMenuEvent->widget())); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 3490 | contextMenuEvent->scenePos(), | - |
| 3491 | contextMenuEvent->widget())) { | - |
| 3492 | contextMenuEvent->setPos(item->d_ptr->genericMapFromScene(contextMenuEvent->scenePos(), executed (the execution status of this line is deduced): contextMenuEvent->setPos(item->d_ptr->genericMapFromScene(contextMenuEvent->scenePos(), | - |
| 3493 | contextMenuEvent->widget())); executed (the execution status of this line is deduced): contextMenuEvent->widget())); | - |
| 3494 | contextMenuEvent->accept(); executed (the execution status of this line is deduced): contextMenuEvent->accept(); | - |
| 3495 | if (!d->sendEvent(item, contextMenuEvent)) partially evaluated: !d->sendEvent(item, contextMenuEvent)| no Evaluation Count:0 | yes Evaluation Count:100 |
| 0-100 |
| 3496 | break; | 0 |
| 3497 | | - |
| 3498 | if (contextMenuEvent->isAccepted()) partially evaluated: contextMenuEvent->isAccepted()| no Evaluation Count:0 | yes Evaluation Count:100 |
| 0-100 |
| 3499 | break; | 0 |
| 3500 | } executed: }Execution Count:100 | 100 |
| 3501 | } executed: }Execution Count:100 | 100 |
| 3502 | | - |
| 3503 | /*! | - |
| 3504 | This event handler, for event \a event, can be reimplemented in a subclass | - |
| 3505 | to receive drag enter events for the scene. | - |
| 3506 | | - |
| 3507 | The default implementation accepts the event and prepares the scene to | - |
| 3508 | accept drag move events. | - |
| 3509 | | - |
| 3510 | \sa QGraphicsItem::dragEnterEvent(), dragMoveEvent(), dragLeaveEvent(), | - |
| 3511 | dropEvent() | - |
| 3512 | */ | - |
| 3513 | void QGraphicsScene::dragEnterEvent(QGraphicsSceneDragDropEvent *event) | - |
| 3514 | { | - |
| 3515 | Q_D(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3516 | d->dragDropItem = 0; never executed (the execution status of this line is deduced): d->dragDropItem = 0; | - |
| 3517 | d->lastDropAction = Qt::IgnoreAction; never executed (the execution status of this line is deduced): d->lastDropAction = Qt::IgnoreAction; | - |
| 3518 | event->accept(); never executed (the execution status of this line is deduced): event->accept(); | - |
| 3519 | } | 0 |
| 3520 | | - |
| 3521 | /*! | - |
| 3522 | This event handler, for event \a event, can be reimplemented in a subclass | - |
| 3523 | to receive drag move events for the scene. | - |
| 3524 | | - |
| 3525 | Note: See items() for a definition of which items are considered visible by this function. | - |
| 3526 | | - |
| 3527 | \sa QGraphicsItem::dragMoveEvent(), dragEnterEvent(), dragLeaveEvent(), | - |
| 3528 | dropEvent() | - |
| 3529 | */ | - |
| 3530 | void QGraphicsScene::dragMoveEvent(QGraphicsSceneDragDropEvent *event) | - |
| 3531 | { | - |
| 3532 | Q_D(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3533 | event->ignore(); never executed (the execution status of this line is deduced): event->ignore(); | - |
| 3534 | | - |
| 3535 | if (!d->mouseGrabberItems.isEmpty()) { never evaluated: !d->mouseGrabberItems.isEmpty() | 0 |
| 3536 | // Mouse grabbers that start drag events lose the mouse grab. | - |
| 3537 | d->clearMouseGrabber(); never executed (the execution status of this line is deduced): d->clearMouseGrabber(); | - |
| 3538 | d->mouseGrabberButtonDownPos.clear(); never executed (the execution status of this line is deduced): d->mouseGrabberButtonDownPos.clear(); | - |
| 3539 | d->mouseGrabberButtonDownScenePos.clear(); never executed (the execution status of this line is deduced): d->mouseGrabberButtonDownScenePos.clear(); | - |
| 3540 | d->mouseGrabberButtonDownScreenPos.clear(); never executed (the execution status of this line is deduced): d->mouseGrabberButtonDownScreenPos.clear(); | - |
| 3541 | } | 0 |
| 3542 | | - |
| 3543 | bool eventDelivered = false; never executed (the execution status of this line is deduced): bool eventDelivered = false; | - |
| 3544 | | - |
| 3545 | // Find the topmost enabled items under the cursor. They are all | - |
| 3546 | // candidates for accepting drag & drop events. | - |
| 3547 | foreach (QGraphicsItem *item, d->itemsAtPosition(event->screenPos(), never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(d->itemsAtPosition(event->screenPos(), event->scenePos(), event->widget()))> _container_(d->itemsAtPosition(event->screenPos(), event->scenePos(), event->widget())); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 3548 | event->scenePos(), | - |
| 3549 | event->widget())) { | - |
| 3550 | if (!item->isEnabled() || !item->acceptDrops()) never evaluated: !item->isEnabled() never evaluated: !item->acceptDrops() | 0 |
| 3551 | continue; never executed: continue; | 0 |
| 3552 | | - |
| 3553 | if (item != d->dragDropItem) { never evaluated: item != d->dragDropItem | 0 |
| 3554 | // Enter the new drag drop item. If it accepts the event, we send | - |
| 3555 | // the leave to the parent item. | - |
| 3556 | QGraphicsSceneDragDropEvent dragEnter(QEvent::GraphicsSceneDragEnter); never executed (the execution status of this line is deduced): QGraphicsSceneDragDropEvent dragEnter(QEvent::GraphicsSceneDragEnter); | - |
| 3557 | d->cloneDragDropEvent(&dragEnter, event); never executed (the execution status of this line is deduced): d->cloneDragDropEvent(&dragEnter, event); | - |
| 3558 | dragEnter.setDropAction(event->proposedAction()); never executed (the execution status of this line is deduced): dragEnter.setDropAction(event->proposedAction()); | - |
| 3559 | d->sendDragDropEvent(item, &dragEnter); never executed (the execution status of this line is deduced): d->sendDragDropEvent(item, &dragEnter); | - |
| 3560 | event->setAccepted(dragEnter.isAccepted()); never executed (the execution status of this line is deduced): event->setAccepted(dragEnter.isAccepted()); | - |
| 3561 | event->setDropAction(dragEnter.dropAction()); never executed (the execution status of this line is deduced): event->setDropAction(dragEnter.dropAction()); | - |
| 3562 | if (!event->isAccepted()) { never evaluated: !event->isAccepted() | 0 |
| 3563 | // Propagate to the item under | - |
| 3564 | continue; never executed: continue; | 0 |
| 3565 | } | - |
| 3566 | | - |
| 3567 | d->lastDropAction = event->dropAction(); never executed (the execution status of this line is deduced): d->lastDropAction = event->dropAction(); | - |
| 3568 | | - |
| 3569 | if (d->dragDropItem) { never evaluated: d->dragDropItem | 0 |
| 3570 | // Leave the last drag drop item. A perfect implementation | - |
| 3571 | // would set the position of this event to the point where | - |
| 3572 | // this event and the last event intersect with the item's | - |
| 3573 | // shape, but that's not easy to do. :-) | - |
| 3574 | QGraphicsSceneDragDropEvent dragLeave(QEvent::GraphicsSceneDragLeave); never executed (the execution status of this line is deduced): QGraphicsSceneDragDropEvent dragLeave(QEvent::GraphicsSceneDragLeave); | - |
| 3575 | d->cloneDragDropEvent(&dragLeave, event); never executed (the execution status of this line is deduced): d->cloneDragDropEvent(&dragLeave, event); | - |
| 3576 | d->sendDragDropEvent(d->dragDropItem, &dragLeave); never executed (the execution status of this line is deduced): d->sendDragDropEvent(d->dragDropItem, &dragLeave); | - |
| 3577 | } | 0 |
| 3578 | | - |
| 3579 | // We've got a new drag & drop item | - |
| 3580 | d->dragDropItem = item; never executed (the execution status of this line is deduced): d->dragDropItem = item; | - |
| 3581 | } | 0 |
| 3582 | | - |
| 3583 | // Send the move event. | - |
| 3584 | event->setDropAction(d->lastDropAction); never executed (the execution status of this line is deduced): event->setDropAction(d->lastDropAction); | - |
| 3585 | event->accept(); never executed (the execution status of this line is deduced): event->accept(); | - |
| 3586 | d->sendDragDropEvent(item, event); never executed (the execution status of this line is deduced): d->sendDragDropEvent(item, event); | - |
| 3587 | if (event->isAccepted()) never evaluated: event->isAccepted() | 0 |
| 3588 | d->lastDropAction = event->dropAction(); never executed: d->lastDropAction = event->dropAction(); | 0 |
| 3589 | eventDelivered = true; never executed (the execution status of this line is deduced): eventDelivered = true; | - |
| 3590 | break; | 0 |
| 3591 | } | - |
| 3592 | | - |
| 3593 | if (!eventDelivered) { never evaluated: !eventDelivered | 0 |
| 3594 | if (d->dragDropItem) { never evaluated: d->dragDropItem | 0 |
| 3595 | // Leave the last drag drop item | - |
| 3596 | QGraphicsSceneDragDropEvent dragLeave(QEvent::GraphicsSceneDragLeave); never executed (the execution status of this line is deduced): QGraphicsSceneDragDropEvent dragLeave(QEvent::GraphicsSceneDragLeave); | - |
| 3597 | d->cloneDragDropEvent(&dragLeave, event); never executed (the execution status of this line is deduced): d->cloneDragDropEvent(&dragLeave, event); | - |
| 3598 | d->sendDragDropEvent(d->dragDropItem, &dragLeave); never executed (the execution status of this line is deduced): d->sendDragDropEvent(d->dragDropItem, &dragLeave); | - |
| 3599 | d->dragDropItem = 0; never executed (the execution status of this line is deduced): d->dragDropItem = 0; | - |
| 3600 | } | 0 |
| 3601 | // Propagate | - |
| 3602 | event->setDropAction(Qt::IgnoreAction); never executed (the execution status of this line is deduced): event->setDropAction(Qt::IgnoreAction); | - |
| 3603 | } | 0 |
| 3604 | } | 0 |
| 3605 | | - |
| 3606 | /*! | - |
| 3607 | This event handler, for event \a event, can be reimplemented in a subclass | - |
| 3608 | to receive drag leave events for the scene. | - |
| 3609 | | - |
| 3610 | \sa QGraphicsItem::dragLeaveEvent(), dragEnterEvent(), dragMoveEvent(), | - |
| 3611 | dropEvent() | - |
| 3612 | */ | - |
| 3613 | void QGraphicsScene::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) | - |
| 3614 | { | - |
| 3615 | Q_D(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3616 | if (d->dragDropItem) { never evaluated: d->dragDropItem | 0 |
| 3617 | // Leave the last drag drop item | - |
| 3618 | d->sendDragDropEvent(d->dragDropItem, event); never executed (the execution status of this line is deduced): d->sendDragDropEvent(d->dragDropItem, event); | - |
| 3619 | d->dragDropItem = 0; never executed (the execution status of this line is deduced): d->dragDropItem = 0; | - |
| 3620 | } | 0 |
| 3621 | } | 0 |
| 3622 | | - |
| 3623 | /*! | - |
| 3624 | This event handler, for event \a event, can be reimplemented in a subclass | - |
| 3625 | to receive drop events for the scene. | - |
| 3626 | | - |
| 3627 | \sa QGraphicsItem::dropEvent(), dragEnterEvent(), dragMoveEvent(), | - |
| 3628 | dragLeaveEvent() | - |
| 3629 | */ | - |
| 3630 | void QGraphicsScene::dropEvent(QGraphicsSceneDragDropEvent *event) | - |
| 3631 | { | - |
| 3632 | Q_UNUSED(event); never executed (the execution status of this line is deduced): (void)event;; | - |
| 3633 | Q_D(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3634 | if (d->dragDropItem) { never evaluated: d->dragDropItem | 0 |
| 3635 | // Drop on the last drag drop item | - |
| 3636 | d->sendDragDropEvent(d->dragDropItem, event); never executed (the execution status of this line is deduced): d->sendDragDropEvent(d->dragDropItem, event); | - |
| 3637 | d->dragDropItem = 0; never executed (the execution status of this line is deduced): d->dragDropItem = 0; | - |
| 3638 | } | 0 |
| 3639 | } | 0 |
| 3640 | | - |
| 3641 | /*! | - |
| 3642 | This event handler, for event \a focusEvent, can be reimplemented in a | - |
| 3643 | subclass to receive focus in events. | - |
| 3644 | | - |
| 3645 | The default implementation sets focus on the scene, and then on the last | - |
| 3646 | focus item. | - |
| 3647 | | - |
| 3648 | \sa QGraphicsItem::focusOutEvent() | - |
| 3649 | */ | - |
| 3650 | void QGraphicsScene::focusInEvent(QFocusEvent *focusEvent) | - |
| 3651 | { | - |
| 3652 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3653 | | - |
| 3654 | d->hasFocus = true; executed (the execution status of this line is deduced): d->hasFocus = true; | - |
| 3655 | switch (focusEvent->reason()) { | - |
| 3656 | case Qt::TabFocusReason: | - |
| 3657 | if (!focusNextPrevChild(true)) never evaluated: !focusNextPrevChild(true) | 0 |
| 3658 | focusEvent->ignore(); never executed: focusEvent->ignore(); | 0 |
| 3659 | break; | 0 |
| 3660 | case Qt::BacktabFocusReason: | - |
| 3661 | if (!focusNextPrevChild(false)) never evaluated: !focusNextPrevChild(false) | 0 |
| 3662 | focusEvent->ignore(); never executed: focusEvent->ignore(); | 0 |
| 3663 | break; | 0 |
| 3664 | default: | - |
| 3665 | if (d->passiveFocusItem) { evaluated: d->passiveFocusItem| yes Evaluation Count:2 | yes Evaluation Count:579 |
| 2-579 |
| 3666 | // Set focus on the last focus item | - |
| 3667 | setFocusItem(d->passiveFocusItem, focusEvent->reason()); executed (the execution status of this line is deduced): setFocusItem(d->passiveFocusItem, focusEvent->reason()); | - |
| 3668 | } executed: }Execution Count:2 | 2 |
| 3669 | break; executed: break;Execution Count:581 | 581 |
| 3670 | } | - |
| 3671 | } executed: }Execution Count:581 | 581 |
| 3672 | | - |
| 3673 | /*! | - |
| 3674 | This event handler, for event \a focusEvent, can be reimplemented in a | - |
| 3675 | subclass to receive focus out events. | - |
| 3676 | | - |
| 3677 | The default implementation removes focus from any focus item, then removes | - |
| 3678 | focus from the scene. | - |
| 3679 | | - |
| 3680 | \sa QGraphicsItem::focusInEvent() | - |
| 3681 | */ | - |
| 3682 | void QGraphicsScene::focusOutEvent(QFocusEvent *focusEvent) | - |
| 3683 | { | - |
| 3684 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3685 | d->hasFocus = false; executed (the execution status of this line is deduced): d->hasFocus = false; | - |
| 3686 | d->passiveFocusItem = d->focusItem; executed (the execution status of this line is deduced): d->passiveFocusItem = d->focusItem; | - |
| 3687 | setFocusItem(0, focusEvent->reason()); executed (the execution status of this line is deduced): setFocusItem(0, focusEvent->reason()); | - |
| 3688 | | - |
| 3689 | // Remove all popups when the scene loses focus. | - |
| 3690 | if (!d->popupWidgets.isEmpty()) partially evaluated: !d->popupWidgets.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 3691 | d->removePopup(d->popupWidgets.first()); never executed: d->removePopup(d->popupWidgets.first()); | 0 |
| 3692 | } executed: }Execution Count:4 | 4 |
| 3693 | | - |
| 3694 | /*! | - |
| 3695 | This event handler, for event \a helpEvent, can be | - |
| 3696 | reimplemented in a subclass to receive help events. The events | - |
| 3697 | are of type QEvent::ToolTip, which are created when a tooltip is | - |
| 3698 | requested. | - |
| 3699 | | - |
| 3700 | The default implementation shows the tooltip of the topmost | - |
| 3701 | visible item, i.e., the item with the highest z-value, at the mouse | - |
| 3702 | cursor position. If no item has a tooltip set, this function | - |
| 3703 | does nothing. | - |
| 3704 | | - |
| 3705 | Note: See items() for a definition of which items are considered visible by this function. | - |
| 3706 | | - |
| 3707 | \sa QGraphicsItem::toolTip(), QGraphicsSceneHelpEvent | - |
| 3708 | */ | - |
| 3709 | void QGraphicsScene::helpEvent(QGraphicsSceneHelpEvent *helpEvent) | - |
| 3710 | { | - |
| 3711 | #ifdef QT_NO_TOOLTIP | - |
| 3712 | Q_UNUSED(helpEvent); | - |
| 3713 | #else | - |
| 3714 | // Find the first item that does tooltips | - |
| 3715 | Q_D(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3716 | QList<QGraphicsItem *> itemsAtPos = d->itemsAtPosition(helpEvent->screenPos(), never executed (the execution status of this line is deduced): QList<QGraphicsItem *> itemsAtPos = d->itemsAtPosition(helpEvent->screenPos(), | - |
| 3717 | helpEvent->scenePos(), never executed (the execution status of this line is deduced): helpEvent->scenePos(), | - |
| 3718 | helpEvent->widget()); never executed (the execution status of this line is deduced): helpEvent->widget()); | - |
| 3719 | QGraphicsItem *toolTipItem = 0; never executed (the execution status of this line is deduced): QGraphicsItem *toolTipItem = 0; | - |
| 3720 | for (int i = 0; i < itemsAtPos.size(); ++i) { never evaluated: i < itemsAtPos.size() | 0 |
| 3721 | QGraphicsItem *tmp = itemsAtPos.at(i); never executed (the execution status of this line is deduced): QGraphicsItem *tmp = itemsAtPos.at(i); | - |
| 3722 | if (tmp->d_func()->isProxyWidget()) { never evaluated: tmp->d_func()->isProxyWidget() | 0 |
| 3723 | // if the item is a proxy widget, the event is forwarded to it | - |
| 3724 | sendEvent(tmp, helpEvent); never executed (the execution status of this line is deduced): sendEvent(tmp, helpEvent); | - |
| 3725 | if (helpEvent->isAccepted()) never evaluated: helpEvent->isAccepted() | 0 |
| 3726 | return; | 0 |
| 3727 | } | 0 |
| 3728 | if (!tmp->toolTip().isEmpty()) { never evaluated: !tmp->toolTip().isEmpty() | 0 |
| 3729 | toolTipItem = tmp; never executed (the execution status of this line is deduced): toolTipItem = tmp; | - |
| 3730 | break; | 0 |
| 3731 | } | - |
| 3732 | } | 0 |
| 3733 | | - |
| 3734 | // Show or hide the tooltip | - |
| 3735 | QString text; never executed (the execution status of this line is deduced): QString text; | - |
| 3736 | QPoint point; never executed (the execution status of this line is deduced): QPoint point; | - |
| 3737 | if (toolTipItem && !toolTipItem->toolTip().isEmpty()) { never evaluated: toolTipItem never evaluated: !toolTipItem->toolTip().isEmpty() | 0 |
| 3738 | text = toolTipItem->toolTip(); never executed (the execution status of this line is deduced): text = toolTipItem->toolTip(); | - |
| 3739 | point = helpEvent->screenPos(); never executed (the execution status of this line is deduced): point = helpEvent->screenPos(); | - |
| 3740 | } | 0 |
| 3741 | QToolTip::showText(point, text, helpEvent->widget()); never executed (the execution status of this line is deduced): QToolTip::showText(point, text, helpEvent->widget()); | - |
| 3742 | helpEvent->setAccepted(!text.isEmpty()); never executed (the execution status of this line is deduced): helpEvent->setAccepted(!text.isEmpty()); | - |
| 3743 | #endif | - |
| 3744 | } | 0 |
| 3745 | | - |
| 3746 | bool QGraphicsScenePrivate::itemAcceptsHoverEvents_helper(const QGraphicsItem *item) const | - |
| 3747 | { | - |
| 3748 | return (item->d_ptr->acceptsHover executed: return (item->d_ptr->acceptsHover || (item->d_ptr->isWidget && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration())) && !item->isBlockedByModalPanel();Execution Count:923 | 923 |
| 3749 | || (item->d_ptr->isWidget executed: return (item->d_ptr->acceptsHover || (item->d_ptr->isWidget && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration())) && !item->isBlockedByModalPanel();Execution Count:923 | 923 |
| 3750 | && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration())) executed: return (item->d_ptr->acceptsHover || (item->d_ptr->isWidget && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration())) && !item->isBlockedByModalPanel();Execution Count:923 | 923 |
| 3751 | && !item->isBlockedByModalPanel(); executed: return (item->d_ptr->acceptsHover || (item->d_ptr->isWidget && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration())) && !item->isBlockedByModalPanel();Execution Count:923 | 923 |
| 3752 | } | - |
| 3753 | | - |
| 3754 | /*! | - |
| 3755 | This event handler, for event \a hoverEvent, can be reimplemented in a | - |
| 3756 | subclass to receive hover enter events. The default implementation | - |
| 3757 | forwards the event to the topmost visible item that accepts hover events at the | - |
| 3758 | scene position from the event. | - |
| 3759 | | - |
| 3760 | Note: See items() for a definition of which items are considered visible by this function. | - |
| 3761 | | - |
| 3762 | \sa QGraphicsItem::hoverEvent(), QGraphicsItem::setAcceptHoverEvents() | - |
| 3763 | */ | - |
| 3764 | bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEvent) | - |
| 3765 | { | - |
| 3766 | if (allItemsIgnoreHoverEvents) partially evaluated: allItemsIgnoreHoverEvents| yes Evaluation Count:263 | no Evaluation Count:0 |
| 0-263 |
| 3767 | return false; executed: return false;Execution Count:263 | 263 |
| 3768 | | - |
| 3769 | // Find the first item that accepts hover events, reusing earlier | - |
| 3770 | // calculated data is possible. | - |
| 3771 | if (cachedItemsUnderMouse.isEmpty()) { never evaluated: cachedItemsUnderMouse.isEmpty() | 0 |
| 3772 | cachedItemsUnderMouse = itemsAtPosition(hoverEvent->screenPos(), never executed (the execution status of this line is deduced): cachedItemsUnderMouse = itemsAtPosition(hoverEvent->screenPos(), | - |
| 3773 | hoverEvent->scenePos(), never executed (the execution status of this line is deduced): hoverEvent->scenePos(), | - |
| 3774 | hoverEvent->widget()); never executed (the execution status of this line is deduced): hoverEvent->widget()); | - |
| 3775 | } | 0 |
| 3776 | | - |
| 3777 | QGraphicsItem *item = 0; never executed (the execution status of this line is deduced): QGraphicsItem *item = 0; | - |
| 3778 | for (int i = 0; i < cachedItemsUnderMouse.size(); ++i) { never evaluated: i < cachedItemsUnderMouse.size() | 0 |
| 3779 | QGraphicsItem *tmp = cachedItemsUnderMouse.at(i); never executed (the execution status of this line is deduced): QGraphicsItem *tmp = cachedItemsUnderMouse.at(i); | - |
| 3780 | if (itemAcceptsHoverEvents_helper(tmp)) { never evaluated: itemAcceptsHoverEvents_helper(tmp) | 0 |
| 3781 | item = tmp; never executed (the execution status of this line is deduced): item = tmp; | - |
| 3782 | break; | 0 |
| 3783 | } | - |
| 3784 | } | 0 |
| 3785 | | - |
| 3786 | // Find the common ancestor item for the new topmost hoverItem and the | - |
| 3787 | // last item in the hoverItem list. | - |
| 3788 | QGraphicsItem *commonAncestorItem = (item && !hoverItems.isEmpty()) ? item->commonAncestorItem(hoverItems.last()) : 0; never evaluated: item never evaluated: !hoverItems.isEmpty() | 0 |
| 3789 | while (commonAncestorItem && !itemAcceptsHoverEvents_helper(commonAncestorItem)) never evaluated: commonAncestorItem never evaluated: !itemAcceptsHoverEvents_helper(commonAncestorItem) | 0 |
| 3790 | commonAncestorItem = commonAncestorItem->parentItem(); never executed: commonAncestorItem = commonAncestorItem->parentItem(); | 0 |
| 3791 | if (commonAncestorItem && commonAncestorItem->panel() != item->panel()) { never evaluated: commonAncestorItem never evaluated: commonAncestorItem->panel() != item->panel() | 0 |
| 3792 | // The common ancestor isn't in the same panel as the two hovered | - |
| 3793 | // items. | - |
| 3794 | commonAncestorItem = 0; never executed (the execution status of this line is deduced): commonAncestorItem = 0; | - |
| 3795 | } | 0 |
| 3796 | | - |
| 3797 | // Check if the common ancestor item is known. | - |
| 3798 | int index = commonAncestorItem ? hoverItems.indexOf(commonAncestorItem) : -1; never evaluated: commonAncestorItem | 0 |
| 3799 | // Send hover leaves to any existing hovered children of the common | - |
| 3800 | // ancestor item. | - |
| 3801 | for (int i = hoverItems.size() - 1; i > index; --i) { never evaluated: i > index | 0 |
| 3802 | QGraphicsItem *lastItem = hoverItems.takeLast(); never executed (the execution status of this line is deduced): QGraphicsItem *lastItem = hoverItems.takeLast(); | - |
| 3803 | if (itemAcceptsHoverEvents_helper(lastItem)) never evaluated: itemAcceptsHoverEvents_helper(lastItem) | 0 |
| 3804 | sendHoverEvent(QEvent::GraphicsSceneHoverLeave, lastItem, hoverEvent); never executed: sendHoverEvent(QEvent::GraphicsSceneHoverLeave, lastItem, hoverEvent); | 0 |
| 3805 | } | 0 |
| 3806 | | - |
| 3807 | // Item is a child of a known item. Generate enter events for the | - |
| 3808 | // missing links. | - |
| 3809 | QList<QGraphicsItem *> parents; never executed (the execution status of this line is deduced): QList<QGraphicsItem *> parents; | - |
| 3810 | QGraphicsItem *parent = item; never executed (the execution status of this line is deduced): QGraphicsItem *parent = item; | - |
| 3811 | while (parent && parent != commonAncestorItem) { never evaluated: parent never evaluated: parent != commonAncestorItem | 0 |
| 3812 | parents.prepend(parent); never executed (the execution status of this line is deduced): parents.prepend(parent); | - |
| 3813 | if (parent->isPanel()) { never evaluated: parent->isPanel() | 0 |
| 3814 | // Stop at the panel - we don't deliver beyond this point. | - |
| 3815 | break; | 0 |
| 3816 | } | - |
| 3817 | parent = parent->parentItem(); never executed (the execution status of this line is deduced): parent = parent->parentItem(); | - |
| 3818 | } | 0 |
| 3819 | for (int i = 0; i < parents.size(); ++i) { never evaluated: i < parents.size() | 0 |
| 3820 | parent = parents.at(i); never executed (the execution status of this line is deduced): parent = parents.at(i); | - |
| 3821 | hoverItems << parent; never executed (the execution status of this line is deduced): hoverItems << parent; | - |
| 3822 | if (itemAcceptsHoverEvents_helper(parent)) never evaluated: itemAcceptsHoverEvents_helper(parent) | 0 |
| 3823 | sendHoverEvent(QEvent::GraphicsSceneHoverEnter, parent, hoverEvent); never executed: sendHoverEvent(QEvent::GraphicsSceneHoverEnter, parent, hoverEvent); | 0 |
| 3824 | } | 0 |
| 3825 | | - |
| 3826 | // Generate a move event for the item itself | - |
| 3827 | if (item | 0 |
| 3828 | && !hoverItems.isEmpty() never evaluated: !hoverItems.isEmpty() | 0 |
| 3829 | && item == hoverItems.last()) { never evaluated: item == hoverItems.last() | 0 |
| 3830 | sendHoverEvent(QEvent::GraphicsSceneHoverMove, item, hoverEvent); never executed (the execution status of this line is deduced): sendHoverEvent(QEvent::GraphicsSceneHoverMove, item, hoverEvent); | - |
| 3831 | return true; never executed: return true; | 0 |
| 3832 | } | - |
| 3833 | return false; never executed: return false; | 0 |
| 3834 | } | - |
| 3835 | | - |
| 3836 | /*! | - |
| 3837 | \internal | - |
| 3838 | | - |
| 3839 | Handles all actions necessary to clean up the scene when the mouse leaves | - |
| 3840 | the view. | - |
| 3841 | */ | - |
| 3842 | void QGraphicsScenePrivate::leaveScene(QWidget *viewport) | - |
| 3843 | { | - |
| 3844 | #ifndef QT_NO_TOOLTIP | - |
| 3845 | QToolTip::hideText(); executed (the execution status of this line is deduced): QToolTip::hideText(); | - |
| 3846 | #endif | - |
| 3847 | QGraphicsView *view = qobject_cast<QGraphicsView *>(viewport->parent()); executed (the execution status of this line is deduced): QGraphicsView *view = qobject_cast<QGraphicsView *>(viewport->parent()); | - |
| 3848 | // Send HoverLeave events to all existing hover items, topmost first. | - |
| 3849 | QGraphicsSceneHoverEvent hoverEvent; executed (the execution status of this line is deduced): QGraphicsSceneHoverEvent hoverEvent; | - |
| 3850 | hoverEvent.setWidget(viewport); executed (the execution status of this line is deduced): hoverEvent.setWidget(viewport); | - |
| 3851 | | - |
| 3852 | if (view) { partially evaluated: view| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 3853 | QPoint cursorPos = QCursor::pos(); executed (the execution status of this line is deduced): QPoint cursorPos = QCursor::pos(); | - |
| 3854 | hoverEvent.setScenePos(view->mapToScene(viewport->mapFromGlobal(cursorPos))); executed (the execution status of this line is deduced): hoverEvent.setScenePos(view->mapToScene(viewport->mapFromGlobal(cursorPos))); | - |
| 3855 | hoverEvent.setLastScenePos(hoverEvent.scenePos()); executed (the execution status of this line is deduced): hoverEvent.setLastScenePos(hoverEvent.scenePos()); | - |
| 3856 | hoverEvent.setScreenPos(cursorPos); executed (the execution status of this line is deduced): hoverEvent.setScreenPos(cursorPos); | - |
| 3857 | hoverEvent.setLastScreenPos(hoverEvent.screenPos()); executed (the execution status of this line is deduced): hoverEvent.setLastScreenPos(hoverEvent.screenPos()); | - |
| 3858 | } executed: }Execution Count:2 | 2 |
| 3859 | | - |
| 3860 | while (!hoverItems.isEmpty()) { partially evaluated: !hoverItems.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 3861 | QGraphicsItem *lastItem = hoverItems.takeLast(); never executed (the execution status of this line is deduced): QGraphicsItem *lastItem = hoverItems.takeLast(); | - |
| 3862 | if (itemAcceptsHoverEvents_helper(lastItem)) never evaluated: itemAcceptsHoverEvents_helper(lastItem) | 0 |
| 3863 | sendHoverEvent(QEvent::GraphicsSceneHoverLeave, lastItem, &hoverEvent); never executed: sendHoverEvent(QEvent::GraphicsSceneHoverLeave, lastItem, &hoverEvent); | 0 |
| 3864 | } | 0 |
| 3865 | } executed: }Execution Count:2 | 2 |
| 3866 | | - |
| 3867 | /*! | - |
| 3868 | This event handler, for event \a keyEvent, can be reimplemented in a | - |
| 3869 | subclass to receive keypress events. The default implementation forwards | - |
| 3870 | the event to current focus item. | - |
| 3871 | | - |
| 3872 | \sa QGraphicsItem::keyPressEvent(), focusItem() | - |
| 3873 | */ | - |
| 3874 | void QGraphicsScene::keyPressEvent(QKeyEvent *keyEvent) | - |
| 3875 | { | - |
| 3876 | // ### Merge this function with keyReleaseEvent; they are identical | - |
| 3877 | // ### (except this comment). | - |
| 3878 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3879 | QGraphicsItem *item = !d->keyboardGrabberItems.isEmpty() ? d->keyboardGrabberItems.last() : 0; partially evaluated: !d->keyboardGrabberItems.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 3880 | if (!item) partially evaluated: !item| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 3881 | item = focusItem(); executed: item = focusItem();Execution Count:1 | 1 |
| 3882 | if (item) { partially evaluated: item| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 3883 | QGraphicsItem *p = item; executed (the execution status of this line is deduced): QGraphicsItem *p = item; | - |
| 3884 | do { | - |
| 3885 | // Accept the event by default | - |
| 3886 | keyEvent->accept(); executed (the execution status of this line is deduced): keyEvent->accept(); | - |
| 3887 | // Send it; QGraphicsItem::keyPressEvent ignores it. If the event | - |
| 3888 | // is filtered out, stop propagating it. | - |
| 3889 | if (p->isBlockedByModalPanel()) partially evaluated: p->isBlockedByModalPanel()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 3890 | break; | 0 |
| 3891 | if (!d->sendEvent(p, keyEvent)) partially evaluated: !d->sendEvent(p, keyEvent)| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 3892 | break; | 0 |
| 3893 | } while (!keyEvent->isAccepted() && !p->isPanel() && (p = p->parentItem())); executed: }Execution Count:1 partially evaluated: !keyEvent->isAccepted()| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: !p->isPanel()| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: (p = p->parentItem())| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 3894 | } else { executed: }Execution Count:1 | 1 |
| 3895 | keyEvent->ignore(); never executed (the execution status of this line is deduced): keyEvent->ignore(); | - |
| 3896 | } | 0 |
| 3897 | } | - |
| 3898 | | - |
| 3899 | /*! | - |
| 3900 | This event handler, for event \a keyEvent, can be reimplemented in a | - |
| 3901 | subclass to receive key release events. The default implementation | - |
| 3902 | forwards the event to current focus item. | - |
| 3903 | | - |
| 3904 | \sa QGraphicsItem::keyReleaseEvent(), focusItem() | - |
| 3905 | */ | - |
| 3906 | void QGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent) | - |
| 3907 | { | - |
| 3908 | // ### Merge this function with keyPressEvent; they are identical (except | - |
| 3909 | // ### this comment). | - |
| 3910 | Q_D(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3911 | QGraphicsItem *item = !d->keyboardGrabberItems.isEmpty() ? d->keyboardGrabberItems.last() : 0; never evaluated: !d->keyboardGrabberItems.isEmpty() | 0 |
| 3912 | if (!item) | 0 |
| 3913 | item = focusItem(); never executed: item = focusItem(); | 0 |
| 3914 | if (item) { | 0 |
| 3915 | QGraphicsItem *p = item; never executed (the execution status of this line is deduced): QGraphicsItem *p = item; | - |
| 3916 | do { | - |
| 3917 | // Accept the event by default | - |
| 3918 | keyEvent->accept(); never executed (the execution status of this line is deduced): keyEvent->accept(); | - |
| 3919 | // Send it; QGraphicsItem::keyPressEvent ignores it. If the event | - |
| 3920 | // is filtered out, stop propagating it. | - |
| 3921 | if (p->isBlockedByModalPanel()) never evaluated: p->isBlockedByModalPanel() | 0 |
| 3922 | break; | 0 |
| 3923 | if (!d->sendEvent(p, keyEvent)) never evaluated: !d->sendEvent(p, keyEvent) | 0 |
| 3924 | break; | 0 |
| 3925 | } while (!keyEvent->isAccepted() && !p->isPanel() && (p = p->parentItem())); never executed: } never evaluated: !keyEvent->isAccepted() never evaluated: !p->isPanel() never evaluated: (p = p->parentItem()) | 0 |
| 3926 | } else { | 0 |
| 3927 | keyEvent->ignore(); never executed (the execution status of this line is deduced): keyEvent->ignore(); | - |
| 3928 | } | 0 |
| 3929 | } | - |
| 3930 | | - |
| 3931 | /*! | - |
| 3932 | This event handler, for event \a mouseEvent, can be reimplemented | - |
| 3933 | in a subclass to receive mouse press events for the scene. | - |
| 3934 | | - |
| 3935 | The default implementation depends on the state of the scene. If | - |
| 3936 | there is a mouse grabber item, then the event is sent to the mouse | - |
| 3937 | grabber. Otherwise, it is forwarded to the topmost visible item that | - |
| 3938 | accepts mouse events at the scene position from the event, and | - |
| 3939 | that item promptly becomes the mouse grabber item. | - |
| 3940 | | - |
| 3941 | If there is no item at the given position on the scene, the | - |
| 3942 | selection area is reset, any focus item loses its input focus, and | - |
| 3943 | the event is then ignored. | - |
| 3944 | | - |
| 3945 | Note: See items() for a definition of which items are considered visible by this function. | - |
| 3946 | | - |
| 3947 | \sa QGraphicsItem::mousePressEvent(), | - |
| 3948 | QGraphicsItem::setAcceptedMouseButtons() | - |
| 3949 | */ | - |
| 3950 | void QGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) | - |
| 3951 | { | - |
| 3952 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3953 | if (d->mouseGrabberItems.isEmpty()) { evaluated: d->mouseGrabberItems.isEmpty()| yes Evaluation Count:115 | yes Evaluation Count:1 |
| 1-115 |
| 3954 | // Dispatch hover events | - |
| 3955 | QGraphicsSceneHoverEvent hover; executed (the execution status of this line is deduced): QGraphicsSceneHoverEvent hover; | - |
| 3956 | _q_hoverFromMouseEvent(&hover, mouseEvent); executed (the execution status of this line is deduced): _q_hoverFromMouseEvent(&hover, mouseEvent); | - |
| 3957 | d->dispatchHoverEvent(&hover); executed (the execution status of this line is deduced): d->dispatchHoverEvent(&hover); | - |
| 3958 | } executed: }Execution Count:115 | 115 |
| 3959 | | - |
| 3960 | d->mousePressEventHandler(mouseEvent); executed (the execution status of this line is deduced): d->mousePressEventHandler(mouseEvent); | - |
| 3961 | } executed: }Execution Count:116 | 116 |
| 3962 | | - |
| 3963 | /*! | - |
| 3964 | This event handler, for event \a mouseEvent, can be reimplemented | - |
| 3965 | in a subclass to receive mouse move events for the scene. | - |
| 3966 | | - |
| 3967 | The default implementation depends on the mouse grabber state. If there is | - |
| 3968 | a mouse grabber item, the event is sent to the mouse grabber. If there | - |
| 3969 | are any items that accept hover events at the current position, the event | - |
| 3970 | is translated into a hover event and accepted; otherwise it's ignored. | - |
| 3971 | | - |
| 3972 | \sa QGraphicsItem::mousePressEvent(), QGraphicsItem::mouseReleaseEvent(), | - |
| 3973 | QGraphicsItem::mouseDoubleClickEvent(), QGraphicsItem::setAcceptedMouseButtons() | - |
| 3974 | */ | - |
| 3975 | void QGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) | - |
| 3976 | { | - |
| 3977 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 3978 | if (d->mouseGrabberItems.isEmpty()) { evaluated: d->mouseGrabberItems.isEmpty()| yes Evaluation Count:56 | yes Evaluation Count:1 |
| 1-56 |
| 3979 | if (mouseEvent->buttons()) evaluated: mouseEvent->buttons()| yes Evaluation Count:14 | yes Evaluation Count:42 |
| 14-42 |
| 3980 | return; executed: return;Execution Count:14 | 14 |
| 3981 | QGraphicsSceneHoverEvent hover; executed (the execution status of this line is deduced): QGraphicsSceneHoverEvent hover; | - |
| 3982 | _q_hoverFromMouseEvent(&hover, mouseEvent); executed (the execution status of this line is deduced): _q_hoverFromMouseEvent(&hover, mouseEvent); | - |
| 3983 | mouseEvent->setAccepted(d->dispatchHoverEvent(&hover)); executed (the execution status of this line is deduced): mouseEvent->setAccepted(d->dispatchHoverEvent(&hover)); | - |
| 3984 | return; executed: return;Execution Count:42 | 42 |
| 3985 | } | - |
| 3986 | | - |
| 3987 | // Forward the event to the mouse grabber | - |
| 3988 | d->sendMouseEvent(mouseEvent); executed (the execution status of this line is deduced): d->sendMouseEvent(mouseEvent); | - |
| 3989 | mouseEvent->accept(); executed (the execution status of this line is deduced): mouseEvent->accept(); | - |
| 3990 | } executed: }Execution Count:1 | 1 |
| 3991 | | - |
| 3992 | /*! | - |
| 3993 | This event handler, for event \a mouseEvent, can be reimplemented | - |
| 3994 | in a subclass to receive mouse release events for the scene. | - |
| 3995 | | - |
| 3996 | The default implementation depends on the mouse grabber state. If | - |
| 3997 | there is no mouse grabber, the event is ignored. Otherwise, if | - |
| 3998 | there is a mouse grabber item, the event is sent to the mouse | - |
| 3999 | grabber. If this mouse release represents the last pressed button | - |
| 4000 | on the mouse, the mouse grabber item then loses the mouse grab. | - |
| 4001 | | - |
| 4002 | \sa QGraphicsItem::mousePressEvent(), QGraphicsItem::mouseMoveEvent(), | - |
| 4003 | QGraphicsItem::mouseDoubleClickEvent(), QGraphicsItem::setAcceptedMouseButtons() | - |
| 4004 | */ | - |
| 4005 | void QGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) | - |
| 4006 | { | - |
| 4007 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 4008 | if (d->mouseGrabberItems.isEmpty()) { evaluated: d->mouseGrabberItems.isEmpty()| yes Evaluation Count:8 | yes Evaluation Count:104 |
| 8-104 |
| 4009 | mouseEvent->ignore(); executed (the execution status of this line is deduced): mouseEvent->ignore(); | - |
| 4010 | return; executed: return;Execution Count:8 | 8 |
| 4011 | } | - |
| 4012 | | - |
| 4013 | // Forward the event to the mouse grabber | - |
| 4014 | d->sendMouseEvent(mouseEvent); executed (the execution status of this line is deduced): d->sendMouseEvent(mouseEvent); | - |
| 4015 | mouseEvent->accept(); executed (the execution status of this line is deduced): mouseEvent->accept(); | - |
| 4016 | | - |
| 4017 | // Reset the mouse grabber when the last mouse button has been released. | - |
| 4018 | if (!mouseEvent->buttons()) { partially evaluated: !mouseEvent->buttons()| yes Evaluation Count:104 | no Evaluation Count:0 |
| 0-104 |
| 4019 | if (!d->mouseGrabberItems.isEmpty()) { partially evaluated: !d->mouseGrabberItems.isEmpty()| yes Evaluation Count:104 | no Evaluation Count:0 |
| 0-104 |
| 4020 | d->lastMouseGrabberItem = d->mouseGrabberItems.last(); executed (the execution status of this line is deduced): d->lastMouseGrabberItem = d->mouseGrabberItems.last(); | - |
| 4021 | if (d->lastMouseGrabberItemHasImplicitMouseGrab) partially evaluated: d->lastMouseGrabberItemHasImplicitMouseGrab| yes Evaluation Count:104 | no Evaluation Count:0 |
| 0-104 |
| 4022 | d->mouseGrabberItems.last()->ungrabMouse(); executed: d->mouseGrabberItems.last()->ungrabMouse();Execution Count:104 | 104 |
| 4023 | } else { executed: }Execution Count:104 | 104 |
| 4024 | d->lastMouseGrabberItem = 0; never executed (the execution status of this line is deduced): d->lastMouseGrabberItem = 0; | - |
| 4025 | } | 0 |
| 4026 | | - |
| 4027 | // Generate a hoverevent | - |
| 4028 | QGraphicsSceneHoverEvent hoverEvent; executed (the execution status of this line is deduced): QGraphicsSceneHoverEvent hoverEvent; | - |
| 4029 | _q_hoverFromMouseEvent(&hoverEvent, mouseEvent); executed (the execution status of this line is deduced): _q_hoverFromMouseEvent(&hoverEvent, mouseEvent); | - |
| 4030 | d->dispatchHoverEvent(&hoverEvent); executed (the execution status of this line is deduced): d->dispatchHoverEvent(&hoverEvent); | - |
| 4031 | } executed: }Execution Count:104 | 104 |
| 4032 | } executed: }Execution Count:104 | 104 |
| 4033 | | - |
| 4034 | /*! | - |
| 4035 | This event handler, for event \a mouseEvent, can be reimplemented | - |
| 4036 | in a subclass to receive mouse doubleclick events for the scene. | - |
| 4037 | | - |
| 4038 | If someone doubleclicks on the scene, the scene will first receive | - |
| 4039 | a mouse press event, followed by a release event (i.e., a click), | - |
| 4040 | then a doubleclick event, and finally a release event. If the | - |
| 4041 | doubleclick event is delivered to a different item than the one | - |
| 4042 | that received the first press and release, it will be delivered as | - |
| 4043 | a press event. However, tripleclick events are not delivered as | - |
| 4044 | doubleclick events in this case. | - |
| 4045 | | - |
| 4046 | The default implementation is similar to mousePressEvent(). | - |
| 4047 | | - |
| 4048 | Note: See items() for a definition of which items are considered visible by this function. | - |
| 4049 | | - |
| 4050 | \sa QGraphicsItem::mousePressEvent(), QGraphicsItem::mouseMoveEvent(), | - |
| 4051 | QGraphicsItem::mouseReleaseEvent(), QGraphicsItem::setAcceptedMouseButtons() | - |
| 4052 | */ | - |
| 4053 | void QGraphicsScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouseEvent) | - |
| 4054 | { | - |
| 4055 | Q_D(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 4056 | d->mousePressEventHandler(mouseEvent); never executed (the execution status of this line is deduced): d->mousePressEventHandler(mouseEvent); | - |
| 4057 | } | 0 |
| 4058 | | - |
| 4059 | /*! | - |
| 4060 | This event handler, for event \a wheelEvent, can be reimplemented in a | - |
| 4061 | subclass to receive mouse wheel events for the scene. | - |
| 4062 | | - |
| 4063 | By default, the event is delivered to the topmost visible item under the | - |
| 4064 | cursor. If ignored, the event propagates to the item beneath, and again | - |
| 4065 | until the event is accepted, or it reaches the scene. If no items accept | - |
| 4066 | the event, it is ignored. | - |
| 4067 | | - |
| 4068 | Note: See items() for a definition of which items are considered visible by this function. | - |
| 4069 | | - |
| 4070 | \sa QGraphicsItem::wheelEvent() | - |
| 4071 | */ | - |
| 4072 | void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent) | - |
| 4073 | { | - |
| 4074 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 4075 | QList<QGraphicsItem *> wheelCandidates = d->itemsAtPosition(wheelEvent->screenPos(), executed (the execution status of this line is deduced): QList<QGraphicsItem *> wheelCandidates = d->itemsAtPosition(wheelEvent->screenPos(), | - |
| 4076 | wheelEvent->scenePos(), executed (the execution status of this line is deduced): wheelEvent->scenePos(), | - |
| 4077 | wheelEvent->widget()); executed (the execution status of this line is deduced): wheelEvent->widget()); | - |
| 4078 | | - |
| 4079 | #ifdef Q_WS_MAC | - |
| 4080 | // On Mac, ignore the event if the first item under the mouse is not the last opened | - |
| 4081 | // popup (or one of its descendant) | - |
| 4082 | if (!d->popupWidgets.isEmpty() && !wheelCandidates.isEmpty() && wheelCandidates.first() != d->popupWidgets.back() && !d->popupWidgets.back()->isAncestorOf(wheelCandidates.first())) { | - |
| 4083 | wheelEvent->accept(); | - |
| 4084 | return; | - |
| 4085 | } | - |
| 4086 | #else | - |
| 4087 | // Find the first popup under the mouse (including the popup's descendants) starting from the last. | - |
| 4088 | // Remove all popups after the one found, or all or them if no popup is under the mouse. | - |
| 4089 | // Then continue with the event. | - |
| 4090 | QList<QGraphicsWidget *>::const_iterator iter = d->popupWidgets.constEnd(); executed (the execution status of this line is deduced): QList<QGraphicsWidget *>::const_iterator iter = d->popupWidgets.constEnd(); | - |
| 4091 | while (--iter >= d->popupWidgets.constBegin() && !wheelCandidates.isEmpty()) { partially evaluated: --iter >= d->popupWidgets.constBegin()| no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: !wheelCandidates.isEmpty() | 0-2 |
| 4092 | if (wheelCandidates.first() == *iter || (*iter)->isAncestorOf(wheelCandidates.first())) never evaluated: wheelCandidates.first() == *iter never evaluated: (*iter)->isAncestorOf(wheelCandidates.first()) | 0 |
| 4093 | break; | 0 |
| 4094 | d->removePopup(*iter); never executed (the execution status of this line is deduced): d->removePopup(*iter); | - |
| 4095 | } | 0 |
| 4096 | #endif | - |
| 4097 | | - |
| 4098 | bool hasSetFocus = false; executed (the execution status of this line is deduced): bool hasSetFocus = false; | - |
| 4099 | foreach (QGraphicsItem *item, wheelCandidates) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(wheelCandidates)> _container_(wheelCandidates); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 4100 | if (!hasSetFocus && item->isEnabled() partially evaluated: !hasSetFocus| yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: item->isEnabled()| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 4101 | && ((item->flags() & QGraphicsItem::ItemIsFocusable) && item->d_ptr->mouseSetsFocus)) { partially evaluated: (item->flags() & QGraphicsItem::ItemIsFocusable)| yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: item->d_ptr->mouseSetsFocus| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 4102 | if (item->isWidget() && static_cast<QGraphicsWidget *>(item)->focusPolicy() == Qt::WheelFocus) { partially evaluated: item->isWidget()| yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: static_cast<QGraphicsWidget *>(item)->focusPolicy() == Qt::WheelFocus| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 4103 | hasSetFocus = true; executed (the execution status of this line is deduced): hasSetFocus = true; | - |
| 4104 | if (item != focusItem()) evaluated: item != focusItem()| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 4105 | setFocusItem(item, Qt::MouseFocusReason); executed: setFocusItem(item, Qt::MouseFocusReason);Execution Count:1 | 1 |
| 4106 | } executed: }Execution Count:2 | 2 |
| 4107 | } executed: }Execution Count:2 | 2 |
| 4108 | | - |
| 4109 | wheelEvent->setPos(item->d_ptr->genericMapFromScene(wheelEvent->scenePos(), executed (the execution status of this line is deduced): wheelEvent->setPos(item->d_ptr->genericMapFromScene(wheelEvent->scenePos(), | - |
| 4110 | wheelEvent->widget())); executed (the execution status of this line is deduced): wheelEvent->widget())); | - |
| 4111 | wheelEvent->accept(); executed (the execution status of this line is deduced): wheelEvent->accept(); | - |
| 4112 | bool isPanel = item->isPanel(); executed (the execution status of this line is deduced): bool isPanel = item->isPanel(); | - |
| 4113 | d->sendEvent(item, wheelEvent); executed (the execution status of this line is deduced): d->sendEvent(item, wheelEvent); | - |
| 4114 | if (isPanel || wheelEvent->isAccepted()) partially evaluated: isPanel| no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: wheelEvent->isAccepted()| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 4115 | break; | 0 |
| 4116 | } executed: }Execution Count:2 | 2 |
| 4117 | } executed: }Execution Count:2 | 2 |
| 4118 | | - |
| 4119 | /*! | - |
| 4120 | This event handler, for event \a event, can be reimplemented in a | - |
| 4121 | subclass to receive input method events for the scene. | - |
| 4122 | | - |
| 4123 | The default implementation forwards the event to the focusItem(). | - |
| 4124 | If no item currently has focus or the current focus item does not | - |
| 4125 | accept input methods, this function does nothing. | - |
| 4126 | | - |
| 4127 | \sa QGraphicsItem::inputMethodEvent() | - |
| 4128 | */ | - |
| 4129 | void QGraphicsScene::inputMethodEvent(QInputMethodEvent *event) | - |
| 4130 | { | - |
| 4131 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 4132 | if (d->focusItem && (d->focusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)) evaluated: d->focusItem| yes Evaluation Count:2 | yes Evaluation Count:1 |
partially evaluated: (d->focusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 4133 | d->sendEvent(d->focusItem, event); executed: d->sendEvent(d->focusItem, event);Execution Count:2 | 2 |
| 4134 | } executed: }Execution Count:3 | 3 |
| 4135 | | - |
| 4136 | /*! | - |
| 4137 | Draws the background of the scene using \a painter, before any items and | - |
| 4138 | the foreground are drawn. Reimplement this function to provide a custom | - |
| 4139 | background for the scene. | - |
| 4140 | | - |
| 4141 | All painting is done in \e scene coordinates. The \a rect | - |
| 4142 | parameter is the exposed rectangle. | - |
| 4143 | | - |
| 4144 | If all you want is to define a color, texture, or gradient for the | - |
| 4145 | background, you can call setBackgroundBrush() instead. | - |
| 4146 | | - |
| 4147 | \sa drawForeground(), drawItems() | - |
| 4148 | */ | - |
| 4149 | void QGraphicsScene::drawBackground(QPainter *painter, const QRectF &rect) | - |
| 4150 | { | - |
| 4151 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 4152 | | - |
| 4153 | if (d->backgroundBrush.style() != Qt::NoBrush) { evaluated: d->backgroundBrush.style() != Qt::NoBrush| yes Evaluation Count:256 | yes Evaluation Count:1758 |
| 256-1758 |
| 4154 | if (d->painterStateProtection) partially evaluated: d->painterStateProtection| yes Evaluation Count:256 | no Evaluation Count:0 |
| 0-256 |
| 4155 | painter->save(); executed: painter->save();Execution Count:256 | 256 |
| 4156 | painter->setBrushOrigin(0, 0); executed (the execution status of this line is deduced): painter->setBrushOrigin(0, 0); | - |
| 4157 | painter->fillRect(rect, backgroundBrush()); executed (the execution status of this line is deduced): painter->fillRect(rect, backgroundBrush()); | - |
| 4158 | if (d->painterStateProtection) partially evaluated: d->painterStateProtection| yes Evaluation Count:256 | no Evaluation Count:0 |
| 0-256 |
| 4159 | painter->restore(); executed: painter->restore();Execution Count:256 | 256 |
| 4160 | } executed: }Execution Count:256 | 256 |
| 4161 | } executed: }Execution Count:2014 | 2014 |
| 4162 | | - |
| 4163 | /*! | - |
| 4164 | Draws the foreground of the scene using \a painter, after the background | - |
| 4165 | and all items have been drawn. Reimplement this function to provide a | - |
| 4166 | custom foreground for the scene. | - |
| 4167 | | - |
| 4168 | All painting is done in \e scene coordinates. The \a rect | - |
| 4169 | parameter is the exposed rectangle. | - |
| 4170 | | - |
| 4171 | If all you want is to define a color, texture or gradient for the | - |
| 4172 | foreground, you can call setForegroundBrush() instead. | - |
| 4173 | | - |
| 4174 | \sa drawBackground(), drawItems() | - |
| 4175 | */ | - |
| 4176 | void QGraphicsScene::drawForeground(QPainter *painter, const QRectF &rect) | - |
| 4177 | { | - |
| 4178 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 4179 | | - |
| 4180 | if (d->foregroundBrush.style() != Qt::NoBrush) { evaluated: d->foregroundBrush.style() != Qt::NoBrush| yes Evaluation Count:252 | yes Evaluation Count:1771 |
| 252-1771 |
| 4181 | if (d->painterStateProtection) partially evaluated: d->painterStateProtection| yes Evaluation Count:252 | no Evaluation Count:0 |
| 0-252 |
| 4182 | painter->save(); executed: painter->save();Execution Count:252 | 252 |
| 4183 | painter->setBrushOrigin(0, 0); executed (the execution status of this line is deduced): painter->setBrushOrigin(0, 0); | - |
| 4184 | painter->fillRect(rect, foregroundBrush()); executed (the execution status of this line is deduced): painter->fillRect(rect, foregroundBrush()); | - |
| 4185 | if (d->painterStateProtection) partially evaluated: d->painterStateProtection| yes Evaluation Count:252 | no Evaluation Count:0 |
| 0-252 |
| 4186 | painter->restore(); executed: painter->restore();Execution Count:252 | 252 |
| 4187 | } executed: }Execution Count:252 | 252 |
| 4188 | } executed: }Execution Count:2023 | 2023 |
| 4189 | | - |
| 4190 | static void _q_paintItem(QGraphicsItem *item, QPainter *painter, | - |
| 4191 | const QStyleOptionGraphicsItem *option, QWidget *widget, | - |
| 4192 | bool useWindowOpacity, bool painterStateProtection) | - |
| 4193 | { | - |
| 4194 | if (!item->isWidget()) { partially evaluated: !item->isWidget()| no Evaluation Count:0 | yes Evaluation Count:245 |
| 0-245 |
| 4195 | item->paint(painter, option, widget); never executed (the execution status of this line is deduced): item->paint(painter, option, widget); | - |
| 4196 | return; | 0 |
| 4197 | } | - |
| 4198 | QGraphicsWidget *widgetItem = static_cast<QGraphicsWidget *>(item); executed (the execution status of this line is deduced): QGraphicsWidget *widgetItem = static_cast<QGraphicsWidget *>(item); | - |
| 4199 | QGraphicsProxyWidget *proxy = qobject_cast<QGraphicsProxyWidget *>(widgetItem); executed (the execution status of this line is deduced): QGraphicsProxyWidget *proxy = qobject_cast<QGraphicsProxyWidget *>(widgetItem); | - |
| 4200 | const qreal windowOpacity = (proxy && proxy->widget() && useWindowOpacity) evaluated: proxy| yes Evaluation Count:8 | yes Evaluation Count:237 |
partially evaluated: proxy->widget()| yes Evaluation Count:8 | no Evaluation Count:0 |
partially evaluated: useWindowOpacity| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-237 |
| 4201 | ? proxy->widget()->windowOpacity() : 1.0; executed (the execution status of this line is deduced): ? proxy->widget()->windowOpacity() : 1.0; | - |
| 4202 | const qreal oldPainterOpacity = painter->opacity(); executed (the execution status of this line is deduced): const qreal oldPainterOpacity = painter->opacity(); | - |
| 4203 | | - |
| 4204 | if (qFuzzyIsNull(windowOpacity)) partially evaluated: qFuzzyIsNull(windowOpacity)| no Evaluation Count:0 | yes Evaluation Count:245 |
| 0-245 |
| 4205 | return; | 0 |
| 4206 | // Set new painter opacity. | - |
| 4207 | if (windowOpacity < 1.0) partially evaluated: windowOpacity < 1.0| no Evaluation Count:0 | yes Evaluation Count:245 |
| 0-245 |
| 4208 | painter->setOpacity(oldPainterOpacity * windowOpacity); never executed: painter->setOpacity(oldPainterOpacity * windowOpacity); | 0 |
| 4209 | | - |
| 4210 | // set layoutdirection on the painter | - |
| 4211 | Qt::LayoutDirection oldLayoutDirection = painter->layoutDirection(); executed (the execution status of this line is deduced): Qt::LayoutDirection oldLayoutDirection = painter->layoutDirection(); | - |
| 4212 | painter->setLayoutDirection(widgetItem->layoutDirection()); executed (the execution status of this line is deduced): painter->setLayoutDirection(widgetItem->layoutDirection()); | - |
| 4213 | | - |
| 4214 | if (widgetItem->isWindow() && widgetItem->windowType() != Qt::Popup && widgetItem->windowType() != Qt::ToolTip evaluated: widgetItem->isWindow()| yes Evaluation Count:29 | yes Evaluation Count:216 |
partially evaluated: widgetItem->windowType() != Qt::Popup| yes Evaluation Count:29 | no Evaluation Count:0 |
partially evaluated: widgetItem->windowType() != Qt::ToolTip| yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-216 |
| 4215 | && !(widgetItem->windowFlags() & Qt::FramelessWindowHint)) { partially evaluated: !(widgetItem->windowFlags() & Qt::FramelessWindowHint)| yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-29 |
| 4216 | if (painterStateProtection) partially evaluated: painterStateProtection| yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-29 |
| 4217 | painter->save(); executed: painter->save();Execution Count:29 | 29 |
| 4218 | widgetItem->paintWindowFrame(painter, option, widget); executed (the execution status of this line is deduced): widgetItem->paintWindowFrame(painter, option, widget); | - |
| 4219 | if (painterStateProtection) partially evaluated: painterStateProtection| yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-29 |
| 4220 | painter->restore(); executed: painter->restore();Execution Count:29 | 29 |
| 4221 | } else if (widgetItem->autoFillBackground()) { executed: }Execution Count:29 partially evaluated: widgetItem->autoFillBackground()| no Evaluation Count:0 | yes Evaluation Count:216 |
| 0-216 |
| 4222 | painter->fillRect(option->exposedRect, widgetItem->palette().window()); never executed (the execution status of this line is deduced): painter->fillRect(option->exposedRect, widgetItem->palette().window()); | - |
| 4223 | } | 0 |
| 4224 | | - |
| 4225 | widgetItem->paint(painter, option, widget); executed (the execution status of this line is deduced): widgetItem->paint(painter, option, widget); | - |
| 4226 | | - |
| 4227 | // Restore layoutdirection on the painter. | - |
| 4228 | painter->setLayoutDirection(oldLayoutDirection); executed (the execution status of this line is deduced): painter->setLayoutDirection(oldLayoutDirection); | - |
| 4229 | // Restore painter opacity. | - |
| 4230 | if (windowOpacity < 1.0) partially evaluated: windowOpacity < 1.0| no Evaluation Count:0 | yes Evaluation Count:245 |
| 0-245 |
| 4231 | painter->setOpacity(oldPainterOpacity); never executed: painter->setOpacity(oldPainterOpacity); | 0 |
| 4232 | } executed: }Execution Count:245 | 245 |
| 4233 | | - |
| 4234 | static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion &pixmapExposed, | - |
| 4235 | const QTransform &itemToPixmap, QPainter::RenderHints renderHints, | - |
| 4236 | const QStyleOptionGraphicsItem *option, bool painterStateProtection) | - |
| 4237 | { | - |
| 4238 | QPixmap subPix; never executed (the execution status of this line is deduced): QPixmap subPix; | - |
| 4239 | QPainter pixmapPainter; never executed (the execution status of this line is deduced): QPainter pixmapPainter; | - |
| 4240 | QRect br = pixmapExposed.boundingRect(); never executed (the execution status of this line is deduced): QRect br = pixmapExposed.boundingRect(); | - |
| 4241 | | - |
| 4242 | // Don't use subpixmap if we get a full update. | - |
| 4243 | if (pixmapExposed.isEmpty() || (pixmapExposed.rectCount() == 1 && br.contains(pix->rect()))) { never evaluated: pixmapExposed.isEmpty() never evaluated: pixmapExposed.rectCount() == 1 never evaluated: br.contains(pix->rect()) | 0 |
| 4244 | pix->fill(Qt::transparent); never executed (the execution status of this line is deduced): pix->fill(Qt::transparent); | - |
| 4245 | pixmapPainter.begin(pix); never executed (the execution status of this line is deduced): pixmapPainter.begin(pix); | - |
| 4246 | } else { | 0 |
| 4247 | subPix = QPixmap(br.size()); never executed (the execution status of this line is deduced): subPix = QPixmap(br.size()); | - |
| 4248 | subPix.fill(Qt::transparent); never executed (the execution status of this line is deduced): subPix.fill(Qt::transparent); | - |
| 4249 | pixmapPainter.begin(&subPix); never executed (the execution status of this line is deduced): pixmapPainter.begin(&subPix); | - |
| 4250 | pixmapPainter.translate(-br.topLeft()); never executed (the execution status of this line is deduced): pixmapPainter.translate(-br.topLeft()); | - |
| 4251 | if (!pixmapExposed.isEmpty()) { never evaluated: !pixmapExposed.isEmpty() | 0 |
| 4252 | // Applied to subPix; paint is adjusted to the coordinate space is | - |
| 4253 | // correct. | - |
| 4254 | pixmapPainter.setClipRegion(pixmapExposed); never executed (the execution status of this line is deduced): pixmapPainter.setClipRegion(pixmapExposed); | - |
| 4255 | } | 0 |
| 4256 | } | 0 |
| 4257 | | - |
| 4258 | pixmapPainter.setRenderHints(pixmapPainter.renderHints(), false); never executed (the execution status of this line is deduced): pixmapPainter.setRenderHints(pixmapPainter.renderHints(), false); | - |
| 4259 | pixmapPainter.setRenderHints(renderHints, true); never executed (the execution status of this line is deduced): pixmapPainter.setRenderHints(renderHints, true); | - |
| 4260 | pixmapPainter.setWorldTransform(itemToPixmap, true); never executed (the execution status of this line is deduced): pixmapPainter.setWorldTransform(itemToPixmap, true); | - |
| 4261 | | - |
| 4262 | // Render. | - |
| 4263 | _q_paintItem(item, &pixmapPainter, option, 0, false, painterStateProtection); never executed (the execution status of this line is deduced): _q_paintItem(item, &pixmapPainter, option, 0, false, painterStateProtection); | - |
| 4264 | pixmapPainter.end(); never executed (the execution status of this line is deduced): pixmapPainter.end(); | - |
| 4265 | | - |
| 4266 | if (!subPix.isNull()) { never evaluated: !subPix.isNull() | 0 |
| 4267 | // Blit the subpixmap into the main pixmap. | - |
| 4268 | pixmapPainter.begin(pix); never executed (the execution status of this line is deduced): pixmapPainter.begin(pix); | - |
| 4269 | pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source); never executed (the execution status of this line is deduced): pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source); | - |
| 4270 | pixmapPainter.setClipRegion(pixmapExposed); never executed (the execution status of this line is deduced): pixmapPainter.setClipRegion(pixmapExposed); | - |
| 4271 | pixmapPainter.drawPixmap(br.topLeft(), subPix); never executed (the execution status of this line is deduced): pixmapPainter.drawPixmap(br.topLeft(), subPix); | - |
| 4272 | pixmapPainter.end(); never executed (the execution status of this line is deduced): pixmapPainter.end(); | - |
| 4273 | } | 0 |
| 4274 | } | 0 |
| 4275 | | - |
| 4276 | // Copied from qpaintengine_vg.cpp | - |
| 4277 | // Returns true for 90, 180, and 270 degree rotations. | - |
| 4278 | static inline bool transformIsSimple(const QTransform& transform) | - |
| 4279 | { | - |
| 4280 | QTransform::TransformationType type = transform.type(); never executed (the execution status of this line is deduced): QTransform::TransformationType type = transform.type(); | - |
| 4281 | if (type <= QTransform::TxScale) { never evaluated: type <= QTransform::TxScale | 0 |
| 4282 | return true; never executed: return true; | 0 |
| 4283 | } else if (type == QTransform::TxRotate) { never evaluated: type == QTransform::TxRotate | 0 |
| 4284 | // Check for 90, and 270 degree rotations. | - |
| 4285 | qreal m11 = transform.m11(); never executed (the execution status of this line is deduced): qreal m11 = transform.m11(); | - |
| 4286 | qreal m12 = transform.m12(); never executed (the execution status of this line is deduced): qreal m12 = transform.m12(); | - |
| 4287 | qreal m21 = transform.m21(); never executed (the execution status of this line is deduced): qreal m21 = transform.m21(); | - |
| 4288 | qreal m22 = transform.m22(); never executed (the execution status of this line is deduced): qreal m22 = transform.m22(); | - |
| 4289 | if (m11 == 0.0f && m22 == 0.0f) { never evaluated: m11 == 0.0f never evaluated: m22 == 0.0f | 0 |
| 4290 | if (m12 == 1.0f && m21 == -1.0f) never evaluated: m12 == 1.0f never evaluated: m21 == -1.0f | 0 |
| 4291 | return true; // 90 degrees. never executed: return true; | 0 |
| 4292 | else if (m12 == -1.0f && m21 == 1.0f) never evaluated: m12 == -1.0f never evaluated: m21 == 1.0f | 0 |
| 4293 | return true; // 270 degrees. never executed: return true; | 0 |
| 4294 | else if (m12 == -1.0f && m21 == -1.0f) never evaluated: m12 == -1.0f never evaluated: m21 == -1.0f | 0 |
| 4295 | return true; // 90 degrees inverted y. never executed: return true; | 0 |
| 4296 | else if (m12 == 1.0f && m21 == 1.0f) never evaluated: m12 == 1.0f never evaluated: m21 == 1.0f | 0 |
| 4297 | return true; // 270 degrees inverted y. never executed: return true; | 0 |
| 4298 | } | - |
| 4299 | } | 0 |
| 4300 | return false; never executed: return false; | 0 |
| 4301 | } | - |
| 4302 | | - |
| 4303 | /*! | - |
| 4304 | \internal | - |
| 4305 | | - |
| 4306 | Draws items directly, or using cache. | - |
| 4307 | */ | - |
| 4308 | void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painter, | - |
| 4309 | const QStyleOptionGraphicsItem *option, QWidget *widget, | - |
| 4310 | bool painterStateProtection) | - |
| 4311 | { | - |
| 4312 | QGraphicsItemPrivate *itemd = item->d_ptr.data(); executed (the execution status of this line is deduced): QGraphicsItemPrivate *itemd = item->d_ptr.data(); | - |
| 4313 | QGraphicsItem::CacheMode cacheMode = QGraphicsItem::CacheMode(itemd->cacheMode); executed (the execution status of this line is deduced): QGraphicsItem::CacheMode cacheMode = QGraphicsItem::CacheMode(itemd->cacheMode); | - |
| 4314 | | - |
| 4315 | // Render directly, using no cache. | - |
| 4316 | if (cacheMode == QGraphicsItem::NoCache partially evaluated: cacheMode == QGraphicsItem::NoCache| yes Evaluation Count:245 | no Evaluation Count:0 |
| 0-245 |
| 4317 | #ifdef Q_WS_X11 | - |
| 4318 | || !X11->use_xrender | - |
| 4319 | #endif | - |
| 4320 | ) { | - |
| 4321 | _q_paintItem(static_cast<QGraphicsWidget *>(item), painter, option, widget, true, painterStateProtection); executed (the execution status of this line is deduced): _q_paintItem(static_cast<QGraphicsWidget *>(item), painter, option, widget, true, painterStateProtection); | - |
| 4322 | return; executed: return;Execution Count:245 | 245 |
| 4323 | } | - |
| 4324 | | - |
| 4325 | const qreal oldPainterOpacity = painter->opacity(); never executed (the execution status of this line is deduced): const qreal oldPainterOpacity = painter->opacity(); | - |
| 4326 | qreal newPainterOpacity = oldPainterOpacity; never executed (the execution status of this line is deduced): qreal newPainterOpacity = oldPainterOpacity; | - |
| 4327 | QGraphicsProxyWidget *proxy = item->isWidget() ? qobject_cast<QGraphicsProxyWidget *>(static_cast<QGraphicsWidget *>(item)) : 0; never evaluated: item->isWidget() | 0 |
| 4328 | if (proxy && proxy->widget()) { never evaluated: proxy never evaluated: proxy->widget() | 0 |
| 4329 | const qreal windowOpacity = proxy->widget()->windowOpacity(); never executed (the execution status of this line is deduced): const qreal windowOpacity = proxy->widget()->windowOpacity(); | - |
| 4330 | if (windowOpacity < 1.0) never evaluated: windowOpacity < 1.0 | 0 |
| 4331 | newPainterOpacity *= windowOpacity; never executed: newPainterOpacity *= windowOpacity; | 0 |
| 4332 | } | 0 |
| 4333 | | - |
| 4334 | // Item's (local) bounding rect | - |
| 4335 | QRectF brect = item->boundingRect(); never executed (the execution status of this line is deduced): QRectF brect = item->boundingRect(); | - |
| 4336 | QRectF adjustedBrect(brect); never executed (the execution status of this line is deduced): QRectF adjustedBrect(brect); | - |
| 4337 | _q_adjustRect(&adjustedBrect); never executed (the execution status of this line is deduced): _q_adjustRect(&adjustedBrect); | - |
| 4338 | if (adjustedBrect.isEmpty()) never evaluated: adjustedBrect.isEmpty() | 0 |
| 4339 | return; | 0 |
| 4340 | | - |
| 4341 | // Fetch the off-screen transparent buffer and exposed area info. | - |
| 4342 | QPixmapCache::Key pixmapKey; never executed (the execution status of this line is deduced): QPixmapCache::Key pixmapKey; | - |
| 4343 | QPixmap pix; never executed (the execution status of this line is deduced): QPixmap pix; | - |
| 4344 | bool pixmapFound; never executed (the execution status of this line is deduced): bool pixmapFound; | - |
| 4345 | QGraphicsItemCache *itemCache = itemd->extraItemCache(); never executed (the execution status of this line is deduced): QGraphicsItemCache *itemCache = itemd->extraItemCache(); | - |
| 4346 | if (cacheMode == QGraphicsItem::ItemCoordinateCache) { never evaluated: cacheMode == QGraphicsItem::ItemCoordinateCache | 0 |
| 4347 | pixmapKey = itemCache->key; never executed (the execution status of this line is deduced): pixmapKey = itemCache->key; | - |
| 4348 | } else { | 0 |
| 4349 | pixmapKey = itemCache->deviceData.value(widget).key; never executed (the execution status of this line is deduced): pixmapKey = itemCache->deviceData.value(widget).key; | - |
| 4350 | } | 0 |
| 4351 | | - |
| 4352 | // Find pixmap in cache. | - |
| 4353 | pixmapFound = QPixmapCache::find(pixmapKey, &pix); never executed (the execution status of this line is deduced): pixmapFound = QPixmapCache::find(pixmapKey, &pix); | - |
| 4354 | | - |
| 4355 | // Render using item coordinate cache mode. | - |
| 4356 | if (cacheMode == QGraphicsItem::ItemCoordinateCache) { never evaluated: cacheMode == QGraphicsItem::ItemCoordinateCache | 0 |
| 4357 | QSize pixmapSize; never executed (the execution status of this line is deduced): QSize pixmapSize; | - |
| 4358 | bool fixedCacheSize = false; never executed (the execution status of this line is deduced): bool fixedCacheSize = false; | - |
| 4359 | QRect br = brect.toAlignedRect(); never executed (the execution status of this line is deduced): QRect br = brect.toAlignedRect(); | - |
| 4360 | if ((fixedCacheSize = itemCache->fixedSize.isValid())) { never evaluated: (fixedCacheSize = itemCache->fixedSize.isValid()) | 0 |
| 4361 | pixmapSize = itemCache->fixedSize; never executed (the execution status of this line is deduced): pixmapSize = itemCache->fixedSize; | - |
| 4362 | } else { | 0 |
| 4363 | pixmapSize = br.size(); never executed (the execution status of this line is deduced): pixmapSize = br.size(); | - |
| 4364 | } | 0 |
| 4365 | | - |
| 4366 | // Create or recreate the pixmap. | - |
| 4367 | int adjust = itemCache->fixedSize.isValid() ? 0 : 2; never evaluated: itemCache->fixedSize.isValid() | 0 |
| 4368 | QSize adjustSize(adjust*2, adjust*2); never executed (the execution status of this line is deduced): QSize adjustSize(adjust*2, adjust*2); | - |
| 4369 | br.adjust(-adjust, -adjust, adjust, adjust); never executed (the execution status of this line is deduced): br.adjust(-adjust, -adjust, adjust, adjust); | - |
| 4370 | if (pix.isNull() || (!fixedCacheSize && (pixmapSize + adjustSize) != pix.size())) { never evaluated: pix.isNull() never evaluated: !fixedCacheSize never evaluated: (pixmapSize + adjustSize) != pix.size() | 0 |
| 4371 | pix = QPixmap(pixmapSize + adjustSize); never executed (the execution status of this line is deduced): pix = QPixmap(pixmapSize + adjustSize); | - |
| 4372 | itemCache->boundingRect = br; never executed (the execution status of this line is deduced): itemCache->boundingRect = br; | - |
| 4373 | itemCache->exposed.clear(); never executed (the execution status of this line is deduced): itemCache->exposed.clear(); | - |
| 4374 | itemCache->allExposed = true; never executed (the execution status of this line is deduced): itemCache->allExposed = true; | - |
| 4375 | } else if (itemCache->boundingRect != br) { never executed: } never evaluated: itemCache->boundingRect != br | 0 |
| 4376 | itemCache->boundingRect = br; never executed (the execution status of this line is deduced): itemCache->boundingRect = br; | - |
| 4377 | itemCache->exposed.clear(); never executed (the execution status of this line is deduced): itemCache->exposed.clear(); | - |
| 4378 | itemCache->allExposed = true; never executed (the execution status of this line is deduced): itemCache->allExposed = true; | - |
| 4379 | } | 0 |
| 4380 | | - |
| 4381 | // Redraw any newly exposed areas. | - |
| 4382 | if (itemCache->allExposed || !itemCache->exposed.isEmpty()) { never evaluated: itemCache->allExposed never evaluated: !itemCache->exposed.isEmpty() | 0 |
| 4383 | | - |
| 4384 | //We know that we will modify the pixmap, removing it from the cache | - |
| 4385 | //will detach the one we have and avoid a deep copy | - |
| 4386 | if (pixmapFound) never evaluated: pixmapFound | 0 |
| 4387 | QPixmapCache::remove(pixmapKey); never executed: QPixmapCache::remove(pixmapKey); | 0 |
| 4388 | | - |
| 4389 | // Fit the item's bounding rect into the pixmap's coordinates. | - |
| 4390 | QTransform itemToPixmap; never executed (the execution status of this line is deduced): QTransform itemToPixmap; | - |
| 4391 | if (fixedCacheSize) { never evaluated: fixedCacheSize | 0 |
| 4392 | const QPointF scale(pixmapSize.width() / brect.width(), pixmapSize.height() / brect.height()); never executed (the execution status of this line is deduced): const QPointF scale(pixmapSize.width() / brect.width(), pixmapSize.height() / brect.height()); | - |
| 4393 | itemToPixmap.scale(scale.x(), scale.y()); never executed (the execution status of this line is deduced): itemToPixmap.scale(scale.x(), scale.y()); | - |
| 4394 | } | 0 |
| 4395 | itemToPixmap.translate(-br.x(), -br.y()); never executed (the execution status of this line is deduced): itemToPixmap.translate(-br.x(), -br.y()); | - |
| 4396 | | - |
| 4397 | // Generate the item's exposedRect and map its list of expose | - |
| 4398 | // rects to device coordinates. | - |
| 4399 | styleOptionTmp = *option; never executed (the execution status of this line is deduced): styleOptionTmp = *option; | - |
| 4400 | QRegion pixmapExposed; never executed (the execution status of this line is deduced): QRegion pixmapExposed; | - |
| 4401 | QRectF exposedRect; never executed (the execution status of this line is deduced): QRectF exposedRect; | - |
| 4402 | if (!itemCache->allExposed) { never evaluated: !itemCache->allExposed | 0 |
| 4403 | for (int i = 0; i < itemCache->exposed.size(); ++i) { never evaluated: i < itemCache->exposed.size() | 0 |
| 4404 | QRectF r = itemCache->exposed.at(i); never executed (the execution status of this line is deduced): QRectF r = itemCache->exposed.at(i); | - |
| 4405 | exposedRect |= r; never executed (the execution status of this line is deduced): exposedRect |= r; | - |
| 4406 | pixmapExposed += itemToPixmap.mapRect(r).toAlignedRect(); never executed (the execution status of this line is deduced): pixmapExposed += itemToPixmap.mapRect(r).toAlignedRect(); | - |
| 4407 | } | 0 |
| 4408 | } else { | 0 |
| 4409 | exposedRect = brect; never executed (the execution status of this line is deduced): exposedRect = brect; | - |
| 4410 | } | 0 |
| 4411 | styleOptionTmp.exposedRect = exposedRect; never executed (the execution status of this line is deduced): styleOptionTmp.exposedRect = exposedRect; | - |
| 4412 | | - |
| 4413 | // Render. | - |
| 4414 | _q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(), never executed (the execution status of this line is deduced): _q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(), | - |
| 4415 | &styleOptionTmp, painterStateProtection); never executed (the execution status of this line is deduced): &styleOptionTmp, painterStateProtection); | - |
| 4416 | | - |
| 4417 | // insert this pixmap into the cache. | - |
| 4418 | itemCache->key = QPixmapCache::insert(pix); never executed (the execution status of this line is deduced): itemCache->key = QPixmapCache::insert(pix); | - |
| 4419 | | - |
| 4420 | // Reset expose data. | - |
| 4421 | itemCache->allExposed = false; never executed (the execution status of this line is deduced): itemCache->allExposed = false; | - |
| 4422 | itemCache->exposed.clear(); never executed (the execution status of this line is deduced): itemCache->exposed.clear(); | - |
| 4423 | } | 0 |
| 4424 | | - |
| 4425 | // Redraw the exposed area using the transformed painter. Depending on | - |
| 4426 | // the hardware, this may be a server-side operation, or an expensive | - |
| 4427 | // qpixmap-image-transform-pixmap roundtrip. | - |
| 4428 | if (newPainterOpacity != oldPainterOpacity) { never evaluated: newPainterOpacity != oldPainterOpacity | 0 |
| 4429 | painter->setOpacity(newPainterOpacity); never executed (the execution status of this line is deduced): painter->setOpacity(newPainterOpacity); | - |
| 4430 | painter->drawPixmap(br.topLeft(), pix); never executed (the execution status of this line is deduced): painter->drawPixmap(br.topLeft(), pix); | - |
| 4431 | painter->setOpacity(oldPainterOpacity); never executed (the execution status of this line is deduced): painter->setOpacity(oldPainterOpacity); | - |
| 4432 | } else { | 0 |
| 4433 | painter->drawPixmap(br.topLeft(), pix); never executed (the execution status of this line is deduced): painter->drawPixmap(br.topLeft(), pix); | - |
| 4434 | } | 0 |
| 4435 | return; | 0 |
| 4436 | } | - |
| 4437 | | - |
| 4438 | // Render using device coordinate cache mode. | - |
| 4439 | if (cacheMode == QGraphicsItem::DeviceCoordinateCache) { never evaluated: cacheMode == QGraphicsItem::DeviceCoordinateCache | 0 |
| 4440 | // Find the item's bounds in device coordinates. | - |
| 4441 | QRectF deviceBounds = painter->worldTransform().mapRect(brect); never executed (the execution status of this line is deduced): QRectF deviceBounds = painter->worldTransform().mapRect(brect); | - |
| 4442 | QRect deviceRect = deviceBounds.toRect().adjusted(-1, -1, 1, 1); never executed (the execution status of this line is deduced): QRect deviceRect = deviceBounds.toRect().adjusted(-1, -1, 1, 1); | - |
| 4443 | if (deviceRect.isEmpty()) never evaluated: deviceRect.isEmpty() | 0 |
| 4444 | return; | 0 |
| 4445 | QRect viewRect = widget ? widget->rect() : QRect(); | 0 |
| 4446 | if (widget && !viewRect.intersects(deviceRect)) never evaluated: widget never evaluated: !viewRect.intersects(deviceRect) | 0 |
| 4447 | return; | 0 |
| 4448 | | - |
| 4449 | // Resort to direct rendering if the device rect exceeds the | - |
| 4450 | // (optional) maximum bounds. (QGraphicsSvgItem uses this). | - |
| 4451 | QSize maximumCacheSize = never executed (the execution status of this line is deduced): QSize maximumCacheSize = | - |
| 4452 | itemd->extra(QGraphicsItemPrivate::ExtraMaxDeviceCoordCacheSize).toSize(); never executed (the execution status of this line is deduced): itemd->extra(QGraphicsItemPrivate::ExtraMaxDeviceCoordCacheSize).toSize(); | - |
| 4453 | if (!maximumCacheSize.isEmpty() never evaluated: !maximumCacheSize.isEmpty() | 0 |
| 4454 | && (deviceRect.width() > maximumCacheSize.width() never evaluated: deviceRect.width() > maximumCacheSize.width() | 0 |
| 4455 | || deviceRect.height() > maximumCacheSize.height())) { never evaluated: deviceRect.height() > maximumCacheSize.height() | 0 |
| 4456 | _q_paintItem(static_cast<QGraphicsWidget *>(item), painter, option, widget, never executed (the execution status of this line is deduced): _q_paintItem(static_cast<QGraphicsWidget *>(item), painter, option, widget, | - |
| 4457 | oldPainterOpacity != newPainterOpacity, painterStateProtection); never executed (the execution status of this line is deduced): oldPainterOpacity != newPainterOpacity, painterStateProtection); | - |
| 4458 | return; | 0 |
| 4459 | } | - |
| 4460 | | - |
| 4461 | // Create or reuse offscreen pixmap, possibly scroll/blit from the old one. | - |
| 4462 | // If the world transform is rotated we always recreate the cache to avoid | - |
| 4463 | // wrong blending. | - |
| 4464 | bool pixModified = false; never executed (the execution status of this line is deduced): bool pixModified = false; | - |
| 4465 | QGraphicsItemCache::DeviceData *deviceData = &itemCache->deviceData[widget]; never executed (the execution status of this line is deduced): QGraphicsItemCache::DeviceData *deviceData = &itemCache->deviceData[widget]; | - |
| 4466 | bool invertable = true; never executed (the execution status of this line is deduced): bool invertable = true; | - |
| 4467 | QTransform diff = deviceData->lastTransform.inverted(&invertable); never executed (the execution status of this line is deduced): QTransform diff = deviceData->lastTransform.inverted(&invertable); | - |
| 4468 | if (invertable) never evaluated: invertable | 0 |
| 4469 | diff *= painter->worldTransform(); never executed: diff *= painter->worldTransform(); | 0 |
| 4470 | deviceData->lastTransform = painter->worldTransform(); never executed (the execution status of this line is deduced): deviceData->lastTransform = painter->worldTransform(); | - |
| 4471 | bool allowPartialCacheExposure = false; never executed (the execution status of this line is deduced): bool allowPartialCacheExposure = false; | - |
| 4472 | bool simpleTransform = invertable && diff.type() <= QTransform::TxTranslate never evaluated: invertable never evaluated: diff.type() <= QTransform::TxTranslate | 0 |
| 4473 | && transformIsSimple(painter->worldTransform()); never evaluated: transformIsSimple(painter->worldTransform()) | 0 |
| 4474 | if (!simpleTransform) { never evaluated: !simpleTransform | 0 |
| 4475 | pixModified = true; never executed (the execution status of this line is deduced): pixModified = true; | - |
| 4476 | itemCache->allExposed = true; never executed (the execution status of this line is deduced): itemCache->allExposed = true; | - |
| 4477 | itemCache->exposed.clear(); never executed (the execution status of this line is deduced): itemCache->exposed.clear(); | - |
| 4478 | deviceData->cacheIndent = QPoint(); never executed (the execution status of this line is deduced): deviceData->cacheIndent = QPoint(); | - |
| 4479 | pix = QPixmap(); never executed (the execution status of this line is deduced): pix = QPixmap(); | - |
| 4480 | } else if (!viewRect.isNull()) { never executed: } never evaluated: !viewRect.isNull() | 0 |
| 4481 | allowPartialCacheExposure = deviceData->cacheIndent != QPoint(); never executed (the execution status of this line is deduced): allowPartialCacheExposure = deviceData->cacheIndent != QPoint(); | - |
| 4482 | } | 0 |
| 4483 | | - |
| 4484 | // Allow partial cache exposure if the device rect isn't fully contained and | - |
| 4485 | // deviceRect is 20% taller or wider than the viewRect. | - |
| 4486 | if (!allowPartialCacheExposure && !viewRect.isNull() && !viewRect.contains(deviceRect)) { never evaluated: !allowPartialCacheExposure never evaluated: !viewRect.isNull() never evaluated: !viewRect.contains(deviceRect) | 0 |
| 4487 | allowPartialCacheExposure = (viewRect.width() * 1.2 < deviceRect.width()) never evaluated: (viewRect.width() * 1.2 < deviceRect.width()) | 0 |
| 4488 | || (viewRect.height() * 1.2 < deviceRect.height()); never evaluated: (viewRect.height() * 1.2 < deviceRect.height()) | 0 |
| 4489 | } | 0 |
| 4490 | | - |
| 4491 | QRegion scrollExposure; never executed (the execution status of this line is deduced): QRegion scrollExposure; | - |
| 4492 | if (allowPartialCacheExposure) { never evaluated: allowPartialCacheExposure | 0 |
| 4493 | // Part of pixmap is drawn. Either device contains viewrect (big | - |
| 4494 | // item covers whole screen) or parts of device are outside the | - |
| 4495 | // viewport. In either case the device rect must be the intersect | - |
| 4496 | // between the two. | - |
| 4497 | int dx = deviceRect.left() < viewRect.left() ? viewRect.left() - deviceRect.left() : 0; never evaluated: deviceRect.left() < viewRect.left() | 0 |
| 4498 | int dy = deviceRect.top() < viewRect.top() ? viewRect.top() - deviceRect.top() : 0; never evaluated: deviceRect.top() < viewRect.top() | 0 |
| 4499 | QPoint newCacheIndent(dx, dy); never executed (the execution status of this line is deduced): QPoint newCacheIndent(dx, dy); | - |
| 4500 | deviceRect &= viewRect; never executed (the execution status of this line is deduced): deviceRect &= viewRect; | - |
| 4501 | | - |
| 4502 | if (pix.isNull()) { never evaluated: pix.isNull() | 0 |
| 4503 | deviceData->cacheIndent = QPoint(); never executed (the execution status of this line is deduced): deviceData->cacheIndent = QPoint(); | - |
| 4504 | itemCache->allExposed = true; never executed (the execution status of this line is deduced): itemCache->allExposed = true; | - |
| 4505 | itemCache->exposed.clear(); never executed (the execution status of this line is deduced): itemCache->exposed.clear(); | - |
| 4506 | pixModified = true; never executed (the execution status of this line is deduced): pixModified = true; | - |
| 4507 | } | 0 |
| 4508 | | - |
| 4509 | // Copy / "scroll" the old pixmap onto the new ole and calculate | - |
| 4510 | // scrolled exposure. | - |
| 4511 | if (newCacheIndent != deviceData->cacheIndent || deviceRect.size() != pix.size()) { never evaluated: newCacheIndent != deviceData->cacheIndent never evaluated: deviceRect.size() != pix.size() | 0 |
| 4512 | QPoint diff = newCacheIndent - deviceData->cacheIndent; never executed (the execution status of this line is deduced): QPoint diff = newCacheIndent - deviceData->cacheIndent; | - |
| 4513 | QPixmap newPix(deviceRect.size()); never executed (the execution status of this line is deduced): QPixmap newPix(deviceRect.size()); | - |
| 4514 | // ### Investigate removing this fill (test with Plasma and | - |
| 4515 | // graphicssystem raster). | - |
| 4516 | newPix.fill(Qt::transparent); never executed (the execution status of this line is deduced): newPix.fill(Qt::transparent); | - |
| 4517 | if (!pix.isNull()) { never evaluated: !pix.isNull() | 0 |
| 4518 | QPainter newPixPainter(&newPix); never executed (the execution status of this line is deduced): QPainter newPixPainter(&newPix); | - |
| 4519 | newPixPainter.drawPixmap(-diff, pix); never executed (the execution status of this line is deduced): newPixPainter.drawPixmap(-diff, pix); | - |
| 4520 | newPixPainter.end(); never executed (the execution status of this line is deduced): newPixPainter.end(); | - |
| 4521 | } | 0 |
| 4522 | QRegion exposed; never executed (the execution status of this line is deduced): QRegion exposed; | - |
| 4523 | exposed += newPix.rect(); never executed (the execution status of this line is deduced): exposed += newPix.rect(); | - |
| 4524 | if (!pix.isNull()) never evaluated: !pix.isNull() | 0 |
| 4525 | exposed -= QRect(-diff, pix.size()); never executed: exposed -= QRect(-diff, pix.size()); | 0 |
| 4526 | scrollExposure = exposed; never executed (the execution status of this line is deduced): scrollExposure = exposed; | - |
| 4527 | | - |
| 4528 | pix = newPix; never executed (the execution status of this line is deduced): pix = newPix; | - |
| 4529 | pixModified = true; never executed (the execution status of this line is deduced): pixModified = true; | - |
| 4530 | } | 0 |
| 4531 | deviceData->cacheIndent = newCacheIndent; never executed (the execution status of this line is deduced): deviceData->cacheIndent = newCacheIndent; | - |
| 4532 | } else { | 0 |
| 4533 | // Full pixmap is drawn. | - |
| 4534 | deviceData->cacheIndent = QPoint(); never executed (the execution status of this line is deduced): deviceData->cacheIndent = QPoint(); | - |
| 4535 | | - |
| 4536 | // Auto-adjust the pixmap size. | - |
| 4537 | if (deviceRect.size() != pix.size()) { never evaluated: deviceRect.size() != pix.size() | 0 |
| 4538 | // exposed needs to cover the whole pixmap | - |
| 4539 | pix = QPixmap(deviceRect.size()); never executed (the execution status of this line is deduced): pix = QPixmap(deviceRect.size()); | - |
| 4540 | pixModified = true; never executed (the execution status of this line is deduced): pixModified = true; | - |
| 4541 | itemCache->allExposed = true; never executed (the execution status of this line is deduced): itemCache->allExposed = true; | - |
| 4542 | itemCache->exposed.clear(); never executed (the execution status of this line is deduced): itemCache->exposed.clear(); | - |
| 4543 | } | 0 |
| 4544 | } | 0 |
| 4545 | | - |
| 4546 | // Check for newly invalidated areas. | - |
| 4547 | if (itemCache->allExposed || !itemCache->exposed.isEmpty() || !scrollExposure.isEmpty()) { never evaluated: itemCache->allExposed never evaluated: !itemCache->exposed.isEmpty() never evaluated: !scrollExposure.isEmpty() | 0 |
| 4548 | //We know that we will modify the pixmap, removing it from the cache | - |
| 4549 | //will detach the one we have and avoid a deep copy | - |
| 4550 | if (pixmapFound) never evaluated: pixmapFound | 0 |
| 4551 | QPixmapCache::remove(pixmapKey); never executed: QPixmapCache::remove(pixmapKey); | 0 |
| 4552 | | - |
| 4553 | // Construct an item-to-pixmap transform. | - |
| 4554 | QPointF p = deviceRect.topLeft(); never executed (the execution status of this line is deduced): QPointF p = deviceRect.topLeft(); | - |
| 4555 | QTransform itemToPixmap = painter->worldTransform(); never executed (the execution status of this line is deduced): QTransform itemToPixmap = painter->worldTransform(); | - |
| 4556 | if (!p.isNull()) never evaluated: !p.isNull() | 0 |
| 4557 | itemToPixmap *= QTransform::fromTranslate(-p.x(), -p.y()); never executed: itemToPixmap *= QTransform::fromTranslate(-p.x(), -p.y()); | 0 |
| 4558 | | - |
| 4559 | // Map the item's logical expose to pixmap coordinates. | - |
| 4560 | QRegion pixmapExposed = scrollExposure; never executed (the execution status of this line is deduced): QRegion pixmapExposed = scrollExposure; | - |
| 4561 | if (!itemCache->allExposed) { never evaluated: !itemCache->allExposed | 0 |
| 4562 | const QVector<QRectF> &exposed = itemCache->exposed; never executed (the execution status of this line is deduced): const QVector<QRectF> &exposed = itemCache->exposed; | - |
| 4563 | for (int i = 0; i < exposed.size(); ++i) never evaluated: i < exposed.size() | 0 |
| 4564 | 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 |
| 4565 | } | 0 |
| 4566 | | - |
| 4567 | // Calculate the style option's exposedRect. | - |
| 4568 | QRectF br; never executed (the execution status of this line is deduced): QRectF br; | - |
| 4569 | if (itemCache->allExposed) { never evaluated: itemCache->allExposed | 0 |
| 4570 | br = item->boundingRect(); never executed (the execution status of this line is deduced): br = item->boundingRect(); | - |
| 4571 | } else { | 0 |
| 4572 | const QVector<QRectF> &exposed = itemCache->exposed; never executed (the execution status of this line is deduced): const QVector<QRectF> &exposed = itemCache->exposed; | - |
| 4573 | for (int i = 0; i < exposed.size(); ++i) never evaluated: i < exposed.size() | 0 |
| 4574 | br |= exposed.at(i); never executed: br |= exposed.at(i); | 0 |
| 4575 | QTransform pixmapToItem = itemToPixmap.inverted(); never executed (the execution status of this line is deduced): QTransform pixmapToItem = itemToPixmap.inverted(); | - |
| 4576 | foreach (const QRect &r, scrollExposure.rects()) never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(scrollExposure.rects())> _container_(scrollExposure.rects()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QRect &r = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 4577 | br |= pixmapToItem.mapRect(r); never executed: br |= pixmapToItem.mapRect(r); | 0 |
| 4578 | } | 0 |
| 4579 | styleOptionTmp = *option; never executed (the execution status of this line is deduced): styleOptionTmp = *option; | - |
| 4580 | styleOptionTmp.exposedRect = br.adjusted(-1, -1, 1, 1); never executed (the execution status of this line is deduced): styleOptionTmp.exposedRect = br.adjusted(-1, -1, 1, 1); | - |
| 4581 | | - |
| 4582 | // Render the exposed areas. | - |
| 4583 | _q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(), never executed (the execution status of this line is deduced): _q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(), | - |
| 4584 | &styleOptionTmp, painterStateProtection); never executed (the execution status of this line is deduced): &styleOptionTmp, painterStateProtection); | - |
| 4585 | | - |
| 4586 | // Reset expose data. | - |
| 4587 | pixModified = true; never executed (the execution status of this line is deduced): pixModified = true; | - |
| 4588 | itemCache->allExposed = false; never executed (the execution status of this line is deduced): itemCache->allExposed = false; | - |
| 4589 | itemCache->exposed.clear(); never executed (the execution status of this line is deduced): itemCache->exposed.clear(); | - |
| 4590 | } | 0 |
| 4591 | | - |
| 4592 | if (pixModified) { never evaluated: pixModified | 0 |
| 4593 | // Insert this pixmap into the cache. | - |
| 4594 | deviceData->key = QPixmapCache::insert(pix); never executed (the execution status of this line is deduced): deviceData->key = QPixmapCache::insert(pix); | - |
| 4595 | } | 0 |
| 4596 | | - |
| 4597 | // Redraw the exposed area using an untransformed painter. This | - |
| 4598 | // effectively becomes a bitblit that does not transform the cache. | - |
| 4599 | QTransform restoreTransform = painter->worldTransform(); never executed (the execution status of this line is deduced): QTransform restoreTransform = painter->worldTransform(); | - |
| 4600 | painter->setWorldTransform(QTransform()); never executed (the execution status of this line is deduced): painter->setWorldTransform(QTransform()); | - |
| 4601 | if (newPainterOpacity != oldPainterOpacity) { never evaluated: newPainterOpacity != oldPainterOpacity | 0 |
| 4602 | painter->setOpacity(newPainterOpacity); never executed (the execution status of this line is deduced): painter->setOpacity(newPainterOpacity); | - |
| 4603 | painter->drawPixmap(deviceRect.topLeft(), pix); never executed (the execution status of this line is deduced): painter->drawPixmap(deviceRect.topLeft(), pix); | - |
| 4604 | painter->setOpacity(oldPainterOpacity); never executed (the execution status of this line is deduced): painter->setOpacity(oldPainterOpacity); | - |
| 4605 | } else { | 0 |
| 4606 | painter->drawPixmap(deviceRect.topLeft(), pix); never executed (the execution status of this line is deduced): painter->drawPixmap(deviceRect.topLeft(), pix); | - |
| 4607 | } | 0 |
| 4608 | painter->setWorldTransform(restoreTransform); never executed (the execution status of this line is deduced): painter->setWorldTransform(restoreTransform); | - |
| 4609 | return; | 0 |
| 4610 | } | - |
| 4611 | } | 0 |
| 4612 | | - |
| 4613 | void QGraphicsScenePrivate::drawItems(QPainter *painter, const QTransform *const viewTransform, | - |
| 4614 | QRegion *exposedRegion, QWidget *widget) | - |
| 4615 | { | - |
| 4616 | // Make sure we don't have unpolished items before we draw. | - |
| 4617 | if (!unpolishedItems.isEmpty()) evaluated: !unpolishedItems.isEmpty()| yes Evaluation Count:6 | yes Evaluation Count:2011 |
| 6-2011 |
| 4618 | _q_polishItems(); executed: _q_polishItems();Execution Count:6 | 6 |
| 4619 | | - |
| 4620 | updateAll = false; executed (the execution status of this line is deduced): updateAll = false; | - |
| 4621 | QRectF exposedSceneRect; executed (the execution status of this line is deduced): QRectF exposedSceneRect; | - |
| 4622 | if (exposedRegion && indexMethod != QGraphicsScene::NoIndex) { partially evaluated: exposedRegion| yes Evaluation Count:2017 | no Evaluation Count:0 |
partially evaluated: indexMethod != QGraphicsScene::NoIndex| yes Evaluation Count:2017 | no Evaluation Count:0 |
| 0-2017 |
| 4623 | exposedSceneRect = exposedRegion->boundingRect().adjusted(-1, -1, 1, 1); executed (the execution status of this line is deduced): exposedSceneRect = exposedRegion->boundingRect().adjusted(-1, -1, 1, 1); | - |
| 4624 | if (viewTransform) evaluated: viewTransform| yes Evaluation Count:1979 | yes Evaluation Count:38 |
| 38-1979 |
| 4625 | exposedSceneRect = viewTransform->inverted().mapRect(exposedSceneRect); executed: exposedSceneRect = viewTransform->inverted().mapRect(exposedSceneRect);Execution Count:1979 | 1979 |
| 4626 | } executed: }Execution Count:2017 | 2017 |
| 4627 | const QList<QGraphicsItem *> tli = index->estimateTopLevelItems(exposedSceneRect, Qt::AscendingOrder); executed (the execution status of this line is deduced): const QList<QGraphicsItem *> tli = index->estimateTopLevelItems(exposedSceneRect, Qt::AscendingOrder); | - |
| 4628 | for (int i = 0; i < tli.size(); ++i) evaluated: i < tli.size()| yes Evaluation Count:3839 | yes Evaluation Count:2017 |
| 2017-3839 |
| 4629 | drawSubtreeRecursive(tli.at(i), painter, viewTransform, exposedRegion, widget); executed: drawSubtreeRecursive(tli.at(i), painter, viewTransform, exposedRegion, widget);Execution Count:3839 | 3839 |
| 4630 | } executed: }Execution Count:2017 | 2017 |
| 4631 | | - |
| 4632 | void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *painter, | - |
| 4633 | const QTransform *const viewTransform, | - |
| 4634 | QRegion *exposedRegion, QWidget *widget, | - |
| 4635 | qreal parentOpacity, const QTransform *const effectTransform) | - |
| 4636 | { | - |
| 4637 | Q_ASSERT(item); executed (the execution status of this line is deduced): qt_noop(); | - |
| 4638 | | - |
| 4639 | if (!item->d_ptr->visible) evaluated: !item->d_ptr->visible| yes Evaluation Count:2 | yes Evaluation Count:4166 |
| 2-4166 |
| 4640 | return; executed: return;Execution Count:2 | 2 |
| 4641 | | - |
| 4642 | const bool itemHasContents = !(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents); executed (the execution status of this line is deduced): const bool itemHasContents = !(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents); | - |
| 4643 | const bool itemHasChildren = !item->d_ptr->children.isEmpty(); executed (the execution status of this line is deduced): const bool itemHasChildren = !item->d_ptr->children.isEmpty(); | - |
| 4644 | if (!itemHasContents && !itemHasChildren) evaluated: !itemHasContents| yes Evaluation Count:8 | yes Evaluation Count:4158 |
partially evaluated: !itemHasChildren| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-4158 |
| 4645 | return; // Item has neither contents nor children!(?) | 0 |
| 4646 | | - |
| 4647 | const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); executed (the execution status of this line is deduced): const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); | - |
| 4648 | const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity); executed (the execution status of this line is deduced): const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity); | - |
| 4649 | if (itemIsFullyTransparent && (!itemHasChildren || item->d_ptr->childrenCombineOpacity())) partially evaluated: itemIsFullyTransparent| no Evaluation Count:0 | yes Evaluation Count:4166 |
never evaluated: !itemHasChildren never evaluated: item->d_ptr->childrenCombineOpacity() | 0-4166 |
| 4650 | return; | 0 |
| 4651 | | - |
| 4652 | QTransform transform(Qt::Uninitialized); executed (the execution status of this line is deduced): QTransform transform(Qt::Uninitialized); | - |
| 4653 | QTransform *transformPtr = 0; executed (the execution status of this line is deduced): QTransform *transformPtr = 0; | - |
| 4654 | bool translateOnlyTransform = false; executed (the execution status of this line is deduced): bool translateOnlyTransform = false; | - |
| 4655 | #define ENSURE_TRANSFORM_PTR \ | - |
| 4656 | if (!transformPtr) { \ | - |
| 4657 | Q_ASSERT(!itemIsUntransformable); \ | - |
| 4658 | if (viewTransform) { \ | - |
| 4659 | transform = item->d_ptr->sceneTransform; \ | - |
| 4660 | transform *= *viewTransform; \ | - |
| 4661 | transformPtr = &transform; \ | - |
| 4662 | } else { \ | - |
| 4663 | transformPtr = &item->d_ptr->sceneTransform; \ | - |
| 4664 | translateOnlyTransform = item->d_ptr->sceneTransformTranslateOnly; \ | - |
| 4665 | } \ | - |
| 4666 | } | - |
| 4667 | | - |
| 4668 | // Update the item's scene transform if the item is transformable; | - |
| 4669 | // otherwise calculate the full transform, | - |
| 4670 | bool wasDirtyParentSceneTransform = false; executed (the execution status of this line is deduced): bool wasDirtyParentSceneTransform = false; | - |
| 4671 | const bool itemIsUntransformable = item->d_ptr->itemIsUntransformable(); executed (the execution status of this line is deduced): const bool itemIsUntransformable = item->d_ptr->itemIsUntransformable(); | - |
| 4672 | if (itemIsUntransformable) { evaluated: itemIsUntransformable| yes Evaluation Count:4 | yes Evaluation Count:4162 |
| 4-4162 |
| 4673 | transform = item->deviceTransform(viewTransform ? *viewTransform : QTransform()); executed (the execution status of this line is deduced): transform = item->deviceTransform(viewTransform ? *viewTransform : QTransform()); | - |
| 4674 | transformPtr = &transform; executed (the execution status of this line is deduced): transformPtr = &transform; | - |
| 4675 | } else if (item->d_ptr->dirtySceneTransform) { executed: }Execution Count:4 evaluated: item->d_ptr->dirtySceneTransform| yes Evaluation Count:285 | yes Evaluation Count:3877 |
| 4-3877 |
| 4676 | item->d_ptr->updateSceneTransformFromParent(); executed (the execution status of this line is deduced): item->d_ptr->updateSceneTransformFromParent(); | - |
| 4677 | Q_ASSERT(!item->d_ptr->dirtySceneTransform); executed (the execution status of this line is deduced): qt_noop(); | - |
| 4678 | wasDirtyParentSceneTransform = true; executed (the execution status of this line is deduced): wasDirtyParentSceneTransform = true; | - |
| 4679 | } executed: }Execution Count:285 | 285 |
| 4680 | | - |
| 4681 | const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); executed (the execution status of this line is deduced): const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); | - |
| 4682 | bool drawItem = itemHasContents && !itemIsFullyTransparent; evaluated: itemHasContents| yes Evaluation Count:4158 | yes Evaluation Count:8 |
partially evaluated: !itemIsFullyTransparent| yes Evaluation Count:4158 | no Evaluation Count:0 |
| 0-4158 |
| 4683 | if (drawItem) { evaluated: drawItem| yes Evaluation Count:4158 | yes Evaluation Count:8 |
| 8-4158 |
| 4684 | const QRectF brect = adjustedItemEffectiveBoundingRect(item); executed (the execution status of this line is deduced): const QRectF brect = adjustedItemEffectiveBoundingRect(item); | - |
| 4685 | ENSURE_TRANSFORM_PTR executed: }Execution Count:3972 executed: }Execution Count:182 evaluated: !transformPtr| yes Evaluation Count:4154 | yes Evaluation Count:4 |
evaluated: viewTransform| yes Evaluation Count:3972 | yes Evaluation Count:182 |
| 4-4154 |
| 4686 | QRect viewBoundingRect = translateOnlyTransform ? brect.translated(transformPtr->dx(), transformPtr->dy()).toAlignedRect() evaluated: translateOnlyTransform| yes Evaluation Count:182 | yes Evaluation Count:3976 |
| 182-3976 |
| 4687 | : transformPtr->mapRect(brect).toAlignedRect(); executed (the execution status of this line is deduced): : transformPtr->mapRect(brect).toAlignedRect(); | - |
| 4688 | viewBoundingRect.adjust(-int(rectAdjust), -int(rectAdjust), rectAdjust, rectAdjust); executed (the execution status of this line is deduced): viewBoundingRect.adjust(-int(rectAdjust), -int(rectAdjust), rectAdjust, rectAdjust); | - |
| 4689 | if (widget) evaluated: widget| yes Evaluation Count:4130 | yes Evaluation Count:28 |
| 28-4130 |
| 4690 | item->d_ptr->paintedViewBoundingRects.insert(widget, viewBoundingRect); executed: item->d_ptr->paintedViewBoundingRects.insert(widget, viewBoundingRect);Execution Count:4130 | 4130 |
| 4691 | drawItem = exposedRegion ? exposedRegion->intersects(viewBoundingRect) evaluated: exposedRegion| yes Evaluation Count:4128 | yes Evaluation Count:30 |
| 30-4128 |
| 4692 | : !viewBoundingRect.normalized().isEmpty(); executed (the execution status of this line is deduced): : !viewBoundingRect.normalized().isEmpty(); | - |
| 4693 | if (!drawItem) { evaluated: !drawItem| yes Evaluation Count:1510 | yes Evaluation Count:2648 |
| 1510-2648 |
| 4694 | if (!itemHasChildren) partially evaluated: !itemHasChildren| yes Evaluation Count:1510 | no Evaluation Count:0 |
| 0-1510 |
| 4695 | return; executed: return;Execution Count:1510 | 1510 |
| 4696 | if (itemClipsChildrenToShape) { never evaluated: itemClipsChildrenToShape | 0 |
| 4697 | if (wasDirtyParentSceneTransform) never evaluated: wasDirtyParentSceneTransform | 0 |
| 4698 | item->d_ptr->invalidateChildrenSceneTransform(); never executed: item->d_ptr->invalidateChildrenSceneTransform(); | 0 |
| 4699 | return; | 0 |
| 4700 | } | - |
| 4701 | } | 0 |
| 4702 | } // else we know for sure this item has children we must process. executed: }Execution Count:2648 | 2648 |
| 4703 | | - |
| 4704 | if (itemHasChildren && itemClipsChildrenToShape) evaluated: itemHasChildren| yes Evaluation Count:95 | yes Evaluation Count:2561 |
evaluated: itemClipsChildrenToShape| yes Evaluation Count:13 | yes Evaluation Count:82 |
| 13-2561 |
| 4705 | ENSURE_TRANSFORM_PTR; executed: }Execution Count:3 never executed: } evaluated: !transformPtr| yes Evaluation Count:3 | yes Evaluation Count:10 |
partially evaluated: viewTransform| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-10 |
| 4706 | | - |
| 4707 | #ifndef QT_NO_GRAPHICSEFFECT | - |
| 4708 | if (item->d_ptr->graphicsEffect && item->d_ptr->graphicsEffect->isEnabled()) { evaluated: item->d_ptr->graphicsEffect| yes Evaluation Count:37 | yes Evaluation Count:2619 |
evaluated: item->d_ptr->graphicsEffect->isEnabled()| yes Evaluation Count:36 | yes Evaluation Count:1 |
| 1-2619 |
| 4709 | ENSURE_TRANSFORM_PTR; never executed: } executed: }Execution Count:4 evaluated: !transformPtr| yes Evaluation Count:4 | yes Evaluation Count:32 |
partially evaluated: viewTransform| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-32 |
| 4710 | QGraphicsItemPaintInfo info(viewTransform, transformPtr, effectTransform, exposedRegion, widget, &styleOptionTmp, executed (the execution status of this line is deduced): QGraphicsItemPaintInfo info(viewTransform, transformPtr, effectTransform, exposedRegion, widget, &styleOptionTmp, | - |
| 4711 | painter, opacity, wasDirtyParentSceneTransform, itemHasContents && !itemIsFullyTransparent); executed (the execution status of this line is deduced): painter, opacity, wasDirtyParentSceneTransform, itemHasContents && !itemIsFullyTransparent); | - |
| 4712 | QGraphicsEffectSource *source = item->d_ptr->graphicsEffect->d_func()->source; executed (the execution status of this line is deduced): QGraphicsEffectSource *source = item->d_ptr->graphicsEffect->d_func()->source; | - |
| 4713 | QGraphicsItemEffectSourcePrivate *sourced = static_cast<QGraphicsItemEffectSourcePrivate *> executed (the execution status of this line is deduced): QGraphicsItemEffectSourcePrivate *sourced = static_cast<QGraphicsItemEffectSourcePrivate *> | - |
| 4714 | (source->d_func()); executed (the execution status of this line is deduced): (source->d_func()); | - |
| 4715 | sourced->info = &info; executed (the execution status of this line is deduced): sourced->info = &info; | - |
| 4716 | const QTransform restoreTransform = painter->worldTransform(); executed (the execution status of this line is deduced): const QTransform restoreTransform = painter->worldTransform(); | - |
| 4717 | if (effectTransform) partially evaluated: effectTransform| no Evaluation Count:0 | yes Evaluation Count:36 |
| 0-36 |
| 4718 | painter->setWorldTransform(*transformPtr * *effectTransform); never executed: painter->setWorldTransform(*transformPtr * *effectTransform); | 0 |
| 4719 | else | - |
| 4720 | painter->setWorldTransform(*transformPtr); executed: painter->setWorldTransform(*transformPtr);Execution Count:36 | 36 |
| 4721 | painter->setOpacity(opacity); executed (the execution status of this line is deduced): painter->setOpacity(opacity); | - |
| 4722 | | - |
| 4723 | if (sourced->currentCachedSystem() != Qt::LogicalCoordinates partially evaluated: sourced->currentCachedSystem() != Qt::LogicalCoordinates| yes Evaluation Count:36 | no Evaluation Count:0 |
| 0-36 |
| 4724 | && sourced->lastEffectTransform != painter->worldTransform()) evaluated: sourced->lastEffectTransform != painter->worldTransform()| yes Evaluation Count:16 | yes Evaluation Count:20 |
| 16-20 |
| 4725 | { | - |
| 4726 | if (sourced->lastEffectTransform.type() <= QTransform::TxTranslate partially evaluated: sourced->lastEffectTransform.type() <= QTransform::TxTranslate| yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
| 4727 | && painter->worldTransform().type() <= QTransform::TxTranslate) evaluated: painter->worldTransform().type() <= QTransform::TxTranslate| yes Evaluation Count:9 | yes Evaluation Count:7 |
| 7-9 |
| 4728 | { | - |
| 4729 | QRectF sourceRect = sourced->boundingRect(Qt::DeviceCoordinates); executed (the execution status of this line is deduced): QRectF sourceRect = sourced->boundingRect(Qt::DeviceCoordinates); | - |
| 4730 | QRect effectRect = sourced->paddedEffectRect(Qt::DeviceCoordinates, sourced->currentCachedMode(), sourceRect); executed (the execution status of this line is deduced): QRect effectRect = sourced->paddedEffectRect(Qt::DeviceCoordinates, sourced->currentCachedMode(), sourceRect); | - |
| 4731 | | - |
| 4732 | sourced->setCachedOffset(effectRect.topLeft()); executed (the execution status of this line is deduced): sourced->setCachedOffset(effectRect.topLeft()); | - |
| 4733 | } else { executed: }Execution Count:9 | 9 |
| 4734 | sourced->invalidateCache(QGraphicsEffectSourcePrivate::TransformChanged); executed (the execution status of this line is deduced): sourced->invalidateCache(QGraphicsEffectSourcePrivate::TransformChanged); | - |
| 4735 | } executed: }Execution Count:7 | 7 |
| 4736 | | - |
| 4737 | sourced->lastEffectTransform = painter->worldTransform(); executed (the execution status of this line is deduced): sourced->lastEffectTransform = painter->worldTransform(); | - |
| 4738 | } executed: }Execution Count:16 | 16 |
| 4739 | | - |
| 4740 | item->d_ptr->graphicsEffect->draw(painter); executed (the execution status of this line is deduced): item->d_ptr->graphicsEffect->draw(painter); | - |
| 4741 | painter->setWorldTransform(restoreTransform); executed (the execution status of this line is deduced): painter->setWorldTransform(restoreTransform); | - |
| 4742 | sourced->info = 0; executed (the execution status of this line is deduced): sourced->info = 0; | - |
| 4743 | } else executed: }Execution Count:36 | 36 |
| 4744 | #endif //QT_NO_GRAPHICSEFFECT | - |
| 4745 | { | - |
| 4746 | draw(item, painter, viewTransform, transformPtr, exposedRegion, widget, opacity, executed (the execution status of this line is deduced): draw(item, painter, viewTransform, transformPtr, exposedRegion, widget, opacity, | - |
| 4747 | effectTransform, wasDirtyParentSceneTransform, drawItem); executed (the execution status of this line is deduced): effectTransform, wasDirtyParentSceneTransform, drawItem); | - |
| 4748 | } executed: }Execution Count:2620 | 2620 |
| 4749 | } | - |
| 4750 | | - |
| 4751 | static inline void setClip(QPainter *painter, QGraphicsItem *item) | - |
| 4752 | { | - |
| 4753 | painter->save(); executed (the execution status of this line is deduced): painter->save(); | - |
| 4754 | QRectF clipRect; executed (the execution status of this line is deduced): QRectF clipRect; | - |
| 4755 | const QPainterPath clipPath(item->shape()); executed (the execution status of this line is deduced): const QPainterPath clipPath(item->shape()); | - |
| 4756 | if (QPathClipper::pathToRect(clipPath, &clipRect)) partially evaluated: QPathClipper::pathToRect(clipPath, &clipRect)| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 4757 | painter->setClipRect(clipRect, Qt::IntersectClip); never executed: painter->setClipRect(clipRect, Qt::IntersectClip); | 0 |
| 4758 | else | - |
| 4759 | painter->setClipPath(clipPath, Qt::IntersectClip); executed: painter->setClipPath(clipPath, Qt::IntersectClip);Execution Count:12 | 12 |
| 4760 | } | - |
| 4761 | | - |
| 4762 | static inline void setWorldTransform(QPainter *painter, const QTransform *const transformPtr, | - |
| 4763 | const QTransform *effectTransform) | - |
| 4764 | { | - |
| 4765 | Q_ASSERT(transformPtr); executed (the execution status of this line is deduced): qt_noop(); | - |
| 4766 | if (effectTransform) evaluated: effectTransform| yes Evaluation Count:20 | yes Evaluation Count:2625 |
| 20-2625 |
| 4767 | painter->setWorldTransform(*transformPtr * *effectTransform); executed: painter->setWorldTransform(*transformPtr * *effectTransform);Execution Count:20 | 20 |
| 4768 | else | - |
| 4769 | painter->setWorldTransform(*transformPtr); executed: painter->setWorldTransform(*transformPtr);Execution Count:2625 | 2625 |
| 4770 | } | - |
| 4771 | | - |
| 4772 | void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const QTransform *const viewTransform, | - |
| 4773 | const QTransform *const transformPtr, QRegion *exposedRegion, QWidget *widget, | - |
| 4774 | qreal opacity, const QTransform *effectTransform, | - |
| 4775 | bool wasDirtyParentSceneTransform, bool drawItem) | - |
| 4776 | { | - |
| 4777 | const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity); executed (the execution status of this line is deduced): const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity); | - |
| 4778 | const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); executed (the execution status of this line is deduced): const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); | - |
| 4779 | const bool itemHasChildren = !item->d_ptr->children.isEmpty(); executed (the execution status of this line is deduced): const bool itemHasChildren = !item->d_ptr->children.isEmpty(); | - |
| 4780 | bool setChildClip = itemClipsChildrenToShape; executed (the execution status of this line is deduced): bool setChildClip = itemClipsChildrenToShape; | - |
| 4781 | bool itemHasChildrenStackedBehind = false; executed (the execution status of this line is deduced): bool itemHasChildrenStackedBehind = false; | - |
| 4782 | | - |
| 4783 | int i = 0; executed (the execution status of this line is deduced): int i = 0; | - |
| 4784 | if (itemHasChildren) { evaluated: itemHasChildren| yes Evaluation Count:94 | yes Evaluation Count:2556 |
| 94-2556 |
| 4785 | if (itemClipsChildrenToShape) evaluated: itemClipsChildrenToShape| yes Evaluation Count:12 | yes Evaluation Count:82 |
| 12-82 |
| 4786 | setWorldTransform(painter, transformPtr, effectTransform); executed: setWorldTransform(painter, transformPtr, effectTransform);Execution Count:12 | 12 |
| 4787 | | - |
| 4788 | item->d_ptr->ensureSortedChildren(); executed (the execution status of this line is deduced): item->d_ptr->ensureSortedChildren(); | - |
| 4789 | // Items with the 'ItemStacksBehindParent' flag are put in front of the list | - |
| 4790 | // so all we have to do is to check the first item. | - |
| 4791 | itemHasChildrenStackedBehind = (item->d_ptr->children.at(0)->d_ptr->flags executed (the execution status of this line is deduced): itemHasChildrenStackedBehind = (item->d_ptr->children.at(0)->d_ptr->flags | - |
| 4792 | & QGraphicsItem::ItemStacksBehindParent); executed (the execution status of this line is deduced): & QGraphicsItem::ItemStacksBehindParent); | - |
| 4793 | | - |
| 4794 | if (itemHasChildrenStackedBehind) { evaluated: itemHasChildrenStackedBehind| yes Evaluation Count:1 | yes Evaluation Count:93 |
| 1-93 |
| 4795 | if (itemClipsChildrenToShape) { partially evaluated: itemClipsChildrenToShape| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 4796 | setClip(painter, item); never executed (the execution status of this line is deduced): setClip(painter, item); | - |
| 4797 | setChildClip = false; never executed (the execution status of this line is deduced): setChildClip = false; | - |
| 4798 | } | 0 |
| 4799 | | - |
| 4800 | // Draw children behind | - |
| 4801 | for (i = 0; i < item->d_ptr->children.size(); ++i) { evaluated: i < item->d_ptr->children.size()| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 4802 | QGraphicsItem *child = item->d_ptr->children.at(i); executed (the execution status of this line is deduced): QGraphicsItem *child = item->d_ptr->children.at(i); | - |
| 4803 | if (wasDirtyParentSceneTransform) partially evaluated: wasDirtyParentSceneTransform| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 4804 | child->d_ptr->dirtySceneTransform = 1; executed: child->d_ptr->dirtySceneTransform = 1;Execution Count:1 | 1 |
| 4805 | if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent)) partially evaluated: !(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent)| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 4806 | break; | 0 |
| 4807 | if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity)) partially evaluated: itemIsFullyTransparent| no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity) | 0-1 |
| 4808 | continue; never executed: continue; | 0 |
| 4809 | drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform); executed (the execution status of this line is deduced): drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform); | - |
| 4810 | } executed: }Execution Count:1 | 1 |
| 4811 | } executed: }Execution Count:1 | 1 |
| 4812 | } executed: }Execution Count:94 | 94 |
| 4813 | | - |
| 4814 | // Draw item | - |
| 4815 | if (drawItem) { evaluated: drawItem| yes Evaluation Count:2642 | yes Evaluation Count:8 |
| 8-2642 |
| 4816 | Q_ASSERT(!itemIsFullyTransparent); executed (the execution status of this line is deduced): qt_noop(); | - |
| 4817 | Q_ASSERT(!(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents)); executed (the execution status of this line is deduced): qt_noop(); | - |
| 4818 | Q_ASSERT(transformPtr); executed (the execution status of this line is deduced): qt_noop(); | - |
| 4819 | item->d_ptr->initStyleOption(&styleOptionTmp, *transformPtr, exposedRegion executed (the execution status of this line is deduced): item->d_ptr->initStyleOption(&styleOptionTmp, *transformPtr, exposedRegion | - |
| 4820 | ? *exposedRegion : QRegion(), exposedRegion == 0); executed (the execution status of this line is deduced): ? *exposedRegion : QRegion(), exposedRegion == 0); | - |
| 4821 | | - |
| 4822 | const bool itemClipsToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsToShape; executed (the execution status of this line is deduced): const bool itemClipsToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsToShape; | - |
| 4823 | bool restorePainterClip = false; executed (the execution status of this line is deduced): bool restorePainterClip = false; | - |
| 4824 | | - |
| 4825 | if (!itemHasChildren || !itemClipsChildrenToShape) { evaluated: !itemHasChildren| yes Evaluation Count:2556 | yes Evaluation Count:86 |
evaluated: !itemClipsChildrenToShape| yes Evaluation Count:77 | yes Evaluation Count:9 |
| 9-2556 |
| 4826 | // Item does not have children or clip children to shape. | - |
| 4827 | setWorldTransform(painter, transformPtr, effectTransform); executed (the execution status of this line is deduced): setWorldTransform(painter, transformPtr, effectTransform); | - |
| 4828 | if ((restorePainterClip = itemClipsToShape)) partially evaluated: (restorePainterClip = itemClipsToShape)| no Evaluation Count:0 | yes Evaluation Count:2633 |
| 0-2633 |
| 4829 | setClip(painter, item); never executed: setClip(painter, item); | 0 |
| 4830 | } else if (itemHasChildrenStackedBehind){ executed: }Execution Count:2633 partially evaluated: itemHasChildrenStackedBehind| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-2633 |
| 4831 | // Item clips children to shape and has children stacked behind, which means | - |
| 4832 | // the painter is already clipped to the item's shape. | - |
| 4833 | if (itemClipsToShape) { never evaluated: itemClipsToShape | 0 |
| 4834 | // The clip is already correct. Ensure correct world transform. | - |
| 4835 | setWorldTransform(painter, transformPtr, effectTransform); never executed (the execution status of this line is deduced): setWorldTransform(painter, transformPtr, effectTransform); | - |
| 4836 | } else { | 0 |
| 4837 | // Remove clip (this also ensures correct world transform). | - |
| 4838 | painter->restore(); never executed (the execution status of this line is deduced): painter->restore(); | - |
| 4839 | setChildClip = true; never executed (the execution status of this line is deduced): setChildClip = true; | - |
| 4840 | } | 0 |
| 4841 | } else if (itemClipsToShape) { partially evaluated: itemClipsToShape| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 4842 | // Item clips children and itself to shape. It does not have hildren stacked | - |
| 4843 | // behind, which means the clip has not yet been set. We set it now and re-use it | - |
| 4844 | // for the children. | - |
| 4845 | setClip(painter, item); never executed (the execution status of this line is deduced): setClip(painter, item); | - |
| 4846 | setChildClip = false; never executed (the execution status of this line is deduced): setChildClip = false; | - |
| 4847 | } | 0 |
| 4848 | | - |
| 4849 | if (painterStateProtection && !restorePainterClip) evaluated: painterStateProtection| yes Evaluation Count:2634 | yes Evaluation Count:8 |
partially evaluated: !restorePainterClip| yes Evaluation Count:2634 | no Evaluation Count:0 |
| 0-2634 |
| 4850 | painter->save(); executed: painter->save();Execution Count:2634 | 2634 |
| 4851 | | - |
| 4852 | painter->setOpacity(opacity); executed (the execution status of this line is deduced): painter->setOpacity(opacity); | - |
| 4853 | if (!item->d_ptr->cacheMode && !item->d_ptr->isWidget) partially evaluated: !item->d_ptr->cacheMode| yes Evaluation Count:2642 | no Evaluation Count:0 |
evaluated: !item->d_ptr->isWidget| yes Evaluation Count:2397 | yes Evaluation Count:245 |
| 0-2642 |
| 4854 | item->paint(painter, &styleOptionTmp, widget); executed: item->paint(painter, &styleOptionTmp, widget);Execution Count:2397 | 2397 |
| 4855 | else | - |
| 4856 | drawItemHelper(item, painter, &styleOptionTmp, widget, painterStateProtection); executed: drawItemHelper(item, painter, &styleOptionTmp, widget, painterStateProtection);Execution Count:245 | 245 |
| 4857 | | - |
| 4858 | if (painterStateProtection || restorePainterClip) evaluated: painterStateProtection| yes Evaluation Count:2634 | yes Evaluation Count:8 |
partially evaluated: restorePainterClip| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-2634 |
| 4859 | painter->restore(); executed: painter->restore();Execution Count:2634 | 2634 |
| 4860 | | - |
| 4861 | static int drawRect = qgetenv("QT_DRAW_SCENE_ITEM_RECTS").toInt(); | - |
| 4862 | if (drawRect) { partially evaluated: drawRect| no Evaluation Count:0 | yes Evaluation Count:2642 |
| 0-2642 |
| 4863 | QPen oldPen = painter->pen(); never executed (the execution status of this line is deduced): QPen oldPen = painter->pen(); | - |
| 4864 | QBrush oldBrush = painter->brush(); never executed (the execution status of this line is deduced): QBrush oldBrush = painter->brush(); | - |
| 4865 | quintptr ptr = reinterpret_cast<quintptr>(item); never executed (the execution status of this line is deduced): quintptr ptr = reinterpret_cast<quintptr>(item); | - |
| 4866 | const QColor color = QColor::fromHsv(ptr % 255, 255, 255); never executed (the execution status of this line is deduced): const QColor color = QColor::fromHsv(ptr % 255, 255, 255); | - |
| 4867 | painter->setPen(color); never executed (the execution status of this line is deduced): painter->setPen(color); | - |
| 4868 | painter->setBrush(Qt::NoBrush); never executed (the execution status of this line is deduced): painter->setBrush(Qt::NoBrush); | - |
| 4869 | painter->drawRect(adjustedItemBoundingRect(item)); never executed (the execution status of this line is deduced): painter->drawRect(adjustedItemBoundingRect(item)); | - |
| 4870 | painter->setPen(oldPen); never executed (the execution status of this line is deduced): painter->setPen(oldPen); | - |
| 4871 | painter->setBrush(oldBrush); never executed (the execution status of this line is deduced): painter->setBrush(oldBrush); | - |
| 4872 | } | 0 |
| 4873 | } executed: }Execution Count:2642 | 2642 |
| 4874 | | - |
| 4875 | // Draw children in front | - |
| 4876 | if (itemHasChildren) { evaluated: itemHasChildren| yes Evaluation Count:94 | yes Evaluation Count:2556 |
| 94-2556 |
| 4877 | if (setChildClip) evaluated: setChildClip| yes Evaluation Count:12 | yes Evaluation Count:82 |
| 12-82 |
| 4878 | setClip(painter, item); executed: setClip(painter, item);Execution Count:12 | 12 |
| 4879 | | - |
| 4880 | for (; i < item->d_ptr->children.size(); ++i) { evaluated: i < item->d_ptr->children.size()| yes Evaluation Count:293 | yes Evaluation Count:94 |
| 94-293 |
| 4881 | QGraphicsItem *child = item->d_ptr->children.at(i); executed (the execution status of this line is deduced): QGraphicsItem *child = item->d_ptr->children.at(i); | - |
| 4882 | if (wasDirtyParentSceneTransform) evaluated: wasDirtyParentSceneTransform| yes Evaluation Count:107 | yes Evaluation Count:186 |
| 107-186 |
| 4883 | child->d_ptr->dirtySceneTransform = 1; executed: child->d_ptr->dirtySceneTransform = 1;Execution Count:107 | 107 |
| 4884 | if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity)) partially evaluated: itemIsFullyTransparent| no Evaluation Count:0 | yes Evaluation Count:293 |
never evaluated: !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity) | 0-293 |
| 4885 | continue; never executed: continue; | 0 |
| 4886 | drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform); executed (the execution status of this line is deduced): drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform); | - |
| 4887 | } executed: }Execution Count:293 | 293 |
| 4888 | | - |
| 4889 | // Restore child clip | - |
| 4890 | if (itemClipsChildrenToShape) evaluated: itemClipsChildrenToShape| yes Evaluation Count:12 | yes Evaluation Count:82 |
| 12-82 |
| 4891 | painter->restore(); executed: painter->restore();Execution Count:12 | 12 |
| 4892 | } executed: }Execution Count:94 | 94 |
| 4893 | } executed: }Execution Count:2650 | 2650 |
| 4894 | | - |
| 4895 | void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, bool invalidateChildren, | - |
| 4896 | bool force, bool ignoreOpacity, bool removingItemFromScene, | - |
| 4897 | bool updateBoundingRect) | - |
| 4898 | { | - |
| 4899 | Q_ASSERT(item); executed (the execution status of this line is deduced): qt_noop(); | - |
| 4900 | if (updateAll) evaluated: updateAll| yes Evaluation Count:5433 | yes Evaluation Count:1499 |
| 1499-5433 |
| 4901 | return; executed: return;Execution Count:5433 | 5433 |
| 4902 | | - |
| 4903 | if (removingItemFromScene && !ignoreOpacity && !item->d_ptr->ignoreOpacity) { evaluated: removingItemFromScene| yes Evaluation Count:564 | yes Evaluation Count:935 |
partially evaluated: !ignoreOpacity| yes Evaluation Count:564 | no Evaluation Count:0 |
partially evaluated: !item->d_ptr->ignoreOpacity| yes Evaluation Count:564 | no Evaluation Count:0 |
| 0-935 |
| 4904 | // If any of the item's ancestors ignore opacity, it means that the opacity | - |
| 4905 | // was set to 0 (and the update request has not yet been processed). That | - |
| 4906 | // also means that we have to ignore the opacity for the item itself; otherwise | - |
| 4907 | // things like: parent->setOpacity(0); scene->removeItem(child) won't work. | - |
| 4908 | // Note that we only do this when removing items from the scene. In all other | - |
| 4909 | // cases the ignoreOpacity bit propagates properly in processDirtyItems, but | - |
| 4910 | // since the item is removed immediately it won't be processed there. | - |
| 4911 | QGraphicsItem *p = item->d_ptr->parent; executed (the execution status of this line is deduced): QGraphicsItem *p = item->d_ptr->parent; | - |
| 4912 | while (p) { evaluated: p| yes Evaluation Count:43 | yes Evaluation Count:564 |
| 43-564 |
| 4913 | if (p->d_ptr->ignoreOpacity) { partially evaluated: p->d_ptr->ignoreOpacity| no Evaluation Count:0 | yes Evaluation Count:43 |
| 0-43 |
| 4914 | item->d_ptr->ignoreOpacity = true; never executed (the execution status of this line is deduced): item->d_ptr->ignoreOpacity = true; | - |
| 4915 | break; | 0 |
| 4916 | } | - |
| 4917 | p = p->d_ptr->parent; executed (the execution status of this line is deduced): p = p->d_ptr->parent; | - |
| 4918 | } executed: }Execution Count:43 | 43 |
| 4919 | } executed: }Execution Count:564 | 564 |
| 4920 | | - |
| 4921 | if (item->d_ptr->discardUpdateRequest(/*ignoreVisibleBit=*/force, evaluated: item->d_ptr->discardUpdateRequest( force, removingItemFromScene || invalidateChildren, ignoreOpacity)| yes Evaluation Count:113 | yes Evaluation Count:1386 |
| 113-1386 |
| 4922 | /*ignoreDirtyBit=*/removingItemFromScene || invalidateChildren, evaluated: item->d_ptr->discardUpdateRequest( force, removingItemFromScene || invalidateChildren, ignoreOpacity)| yes Evaluation Count:113 | yes Evaluation Count:1386 |
| 113-1386 |
| 4923 | /*ignoreOpacity=*/ignoreOpacity)) { evaluated: item->d_ptr->discardUpdateRequest( force, removingItemFromScene || invalidateChildren, ignoreOpacity)| yes Evaluation Count:113 | yes Evaluation Count:1386 |
| 113-1386 |
| 4924 | if (item->d_ptr->dirty) { partially evaluated: item->d_ptr->dirty| yes Evaluation Count:113 | no Evaluation Count:0 |
| 0-113 |
| 4925 | // The item is already marked as dirty and will be processed later. However, | - |
| 4926 | // we have to make sure ignoreVisible and ignoreOpacity are set properly; | - |
| 4927 | // otherwise things like: item->update(); item->hide() (force is now true) | - |
| 4928 | // won't work as expected. | - |
| 4929 | if (force) partially evaluated: force| no Evaluation Count:0 | yes Evaluation Count:113 |
| 0-113 |
| 4930 | item->d_ptr->ignoreVisible = 1; never executed: item->d_ptr->ignoreVisible = 1; | 0 |
| 4931 | if (ignoreOpacity) partially evaluated: ignoreOpacity| no Evaluation Count:0 | yes Evaluation Count:113 |
| 0-113 |
| 4932 | item->d_ptr->ignoreOpacity = 1; never executed: item->d_ptr->ignoreOpacity = 1; | 0 |
| 4933 | } executed: }Execution Count:113 | 113 |
| 4934 | return; executed: return;Execution Count:113 | 113 |
| 4935 | } | - |
| 4936 | | - |
| 4937 | const bool fullItemUpdate = rect.isNull(); executed (the execution status of this line is deduced): const bool fullItemUpdate = rect.isNull(); | - |
| 4938 | if (!fullItemUpdate && rect.isEmpty()) evaluated: !fullItemUpdate| yes Evaluation Count:2 | yes Evaluation Count:1384 |
partially evaluated: rect.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-1384 |
| 4939 | return; | 0 |
| 4940 | | - |
| 4941 | if (!processDirtyItemsEmitted) { evaluated: !processDirtyItemsEmitted| yes Evaluation Count:763 | yes Evaluation Count:623 |
| 623-763 |
| 4942 | QMetaMethod method = q_ptr->metaObject()->method(processDirtyItemsIndex); executed (the execution status of this line is deduced): QMetaMethod method = q_ptr->metaObject()->method(processDirtyItemsIndex); | - |
| 4943 | method.invoke(q_ptr, Qt::QueuedConnection); executed (the execution status of this line is deduced): method.invoke(q_ptr, Qt::QueuedConnection); | - |
| 4944 | // QMetaObject::invokeMethod(q_ptr, "_q_processDirtyItems", Qt::QueuedConnection); | - |
| 4945 | processDirtyItemsEmitted = true; executed (the execution status of this line is deduced): processDirtyItemsEmitted = true; | - |
| 4946 | } executed: }Execution Count:763 | 763 |
| 4947 | | - |
| 4948 | if (removingItemFromScene) { evaluated: removingItemFromScene| yes Evaluation Count:564 | yes Evaluation Count:822 |
| 564-822 |
| 4949 | // Note that this function can be called from the item's destructor, so | - |
| 4950 | // do NOT call any virtual functions on it within this block. | - |
| 4951 | if (isSignalConnected(changedSignalIndex) || views.isEmpty()) { evaluated: isSignalConnected(changedSignalIndex)| yes Evaluation Count:4 | yes Evaluation Count:560 |
evaluated: views.isEmpty()| yes Evaluation Count:510 | yes Evaluation Count:50 |
| 4-560 |
| 4952 | // This block of code is kept for compatibility. Since 4.5, by default | - |
| 4953 | // QGraphicsView does not connect the signal and we use the below | - |
| 4954 | // method of delivering updates. | - |
| 4955 | q_func()->update(); executed (the execution status of this line is deduced): q_func()->update(); | - |
| 4956 | return; executed: return;Execution Count:514 | 514 |
| 4957 | } | - |
| 4958 | | - |
| 4959 | for (int i = 0; i < views.size(); ++i) { evaluated: i < views.size()| yes Evaluation Count:50 | yes Evaluation Count:50 |
| 50 |
| 4960 | QGraphicsViewPrivate *viewPrivate = views.at(i)->d_func(); executed (the execution status of this line is deduced): QGraphicsViewPrivate *viewPrivate = views.at(i)->d_func(); | - |
| 4961 | QRect rect = item->d_ptr->paintedViewBoundingRects.value(viewPrivate->viewport); executed (the execution status of this line is deduced): QRect rect = item->d_ptr->paintedViewBoundingRects.value(viewPrivate->viewport); | - |
| 4962 | rect.translate(viewPrivate->dirtyScrollOffset); executed (the execution status of this line is deduced): rect.translate(viewPrivate->dirtyScrollOffset); | - |
| 4963 | viewPrivate->updateRect(rect); executed (the execution status of this line is deduced): viewPrivate->updateRect(rect); | - |
| 4964 | } executed: }Execution Count:50 | 50 |
| 4965 | return; executed: return;Execution Count:50 | 50 |
| 4966 | } | - |
| 4967 | | - |
| 4968 | bool hasNoContents = item->d_ptr->flags & QGraphicsItem::ItemHasNoContents; executed (the execution status of this line is deduced): bool hasNoContents = item->d_ptr->flags & QGraphicsItem::ItemHasNoContents; | - |
| 4969 | if (!hasNoContents) { evaluated: !hasNoContents| yes Evaluation Count:815 | yes Evaluation Count:7 |
| 7-815 |
| 4970 | item->d_ptr->dirty = 1; executed (the execution status of this line is deduced): item->d_ptr->dirty = 1; | - |
| 4971 | if (fullItemUpdate) evaluated: fullItemUpdate| yes Evaluation Count:813 | yes Evaluation Count:2 |
| 2-813 |
| 4972 | item->d_ptr->fullUpdatePending = 1; executed: item->d_ptr->fullUpdatePending = 1;Execution Count:813 | 813 |
| 4973 | else if (!item->d_ptr->fullUpdatePending) partially evaluated: !item->d_ptr->fullUpdatePending| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 4974 | item->d_ptr->needsRepaint |= rect; executed: item->d_ptr->needsRepaint |= rect;Execution Count:2 | 2 |
| 4975 | } else if (item->d_ptr->graphicsEffect) { evaluated: item->d_ptr->graphicsEffect| yes Evaluation Count:4 | yes Evaluation Count:3 |
| 3-4 |
| 4976 | invalidateChildren = true; executed (the execution status of this line is deduced): invalidateChildren = true; | - |
| 4977 | } executed: }Execution Count:4 | 4 |
| 4978 | | - |
| 4979 | if (invalidateChildren) { evaluated: invalidateChildren| yes Evaluation Count:269 | yes Evaluation Count:553 |
| 269-553 |
| 4980 | item->d_ptr->allChildrenDirty = 1; executed (the execution status of this line is deduced): item->d_ptr->allChildrenDirty = 1; | - |
| 4981 | item->d_ptr->dirtyChildren = 1; executed (the execution status of this line is deduced): item->d_ptr->dirtyChildren = 1; | - |
| 4982 | } executed: }Execution Count:269 | 269 |
| 4983 | | - |
| 4984 | if (force) evaluated: force| yes Evaluation Count:2 | yes Evaluation Count:820 |
| 2-820 |
| 4985 | item->d_ptr->ignoreVisible = 1; executed: item->d_ptr->ignoreVisible = 1;Execution Count:2 | 2 |
| 4986 | if (ignoreOpacity) partially evaluated: ignoreOpacity| no Evaluation Count:0 | yes Evaluation Count:822 |
| 0-822 |
| 4987 | item->d_ptr->ignoreOpacity = 1; never executed: item->d_ptr->ignoreOpacity = 1; | 0 |
| 4988 | | - |
| 4989 | if (!updateBoundingRect) evaluated: !updateBoundingRect| yes Evaluation Count:567 | yes Evaluation Count:255 |
| 255-567 |
| 4990 | item->d_ptr->markParentDirty(); executed: item->d_ptr->markParentDirty();Execution Count:567 | 567 |
| 4991 | } executed: }Execution Count:822 | 822 |
| 4992 | | - |
| 4993 | static inline bool updateHelper(QGraphicsViewPrivate *view, QGraphicsItemPrivate *item, | - |
| 4994 | const QRectF &rect, bool itemIsUntransformable) | - |
| 4995 | { | - |
| 4996 | Q_ASSERT(view); executed (the execution status of this line is deduced): qt_noop(); | - |
| 4997 | Q_ASSERT(item); executed (the execution status of this line is deduced): qt_noop(); | - |
| 4998 | | - |
| 4999 | QGraphicsItem *itemq = static_cast<QGraphicsItem *>(item->q_ptr); executed (the execution status of this line is deduced): QGraphicsItem *itemq = static_cast<QGraphicsItem *>(item->q_ptr); | - |
| 5000 | QGraphicsView *viewq = static_cast<QGraphicsView *>(view->q_ptr); executed (the execution status of this line is deduced): QGraphicsView *viewq = static_cast<QGraphicsView *>(view->q_ptr); | - |
| 5001 | | - |
| 5002 | if (itemIsUntransformable) { partially evaluated: itemIsUntransformable| no Evaluation Count:0 | yes Evaluation Count:354 |
| 0-354 |
| 5003 | const QTransform xform = itemq->deviceTransform(viewq->viewportTransform()); never executed (the execution status of this line is deduced): const QTransform xform = itemq->deviceTransform(viewq->viewportTransform()); | - |
| 5004 | if (!item->hasBoundingRegionGranularity) never evaluated: !item->hasBoundingRegionGranularity | 0 |
| 5005 | return view->updateRectF(xform.mapRect(rect)); never executed: return view->updateRectF(xform.mapRect(rect)); | 0 |
| 5006 | return view->updateRegion(rect, xform); never executed: return view->updateRegion(rect, xform); | 0 |
| 5007 | } | - |
| 5008 | | - |
| 5009 | if (item->sceneTransformTranslateOnly && view->identityMatrix) { evaluated: item->sceneTransformTranslateOnly| yes Evaluation Count:353 | yes Evaluation Count:1 |
evaluated: view->identityMatrix| yes Evaluation Count:248 | yes Evaluation Count:105 |
| 1-353 |
| 5010 | const qreal dx = item->sceneTransform.dx(); executed (the execution status of this line is deduced): const qreal dx = item->sceneTransform.dx(); | - |
| 5011 | const qreal dy = item->sceneTransform.dy(); executed (the execution status of this line is deduced): const qreal dy = item->sceneTransform.dy(); | - |
| 5012 | QRectF r(rect); executed (the execution status of this line is deduced): QRectF r(rect); | - |
| 5013 | r.translate(dx - view->horizontalScroll(), dy - view->verticalScroll()); executed (the execution status of this line is deduced): r.translate(dx - view->horizontalScroll(), dy - view->verticalScroll()); | - |
| 5014 | return view->updateRectF(r); executed: return view->updateRectF(r);Execution Count:248 | 248 |
| 5015 | } | - |
| 5016 | | - |
| 5017 | if (!viewq->isTransformed()) { partially evaluated: !viewq->isTransformed()| no Evaluation Count:0 | yes Evaluation Count:106 |
| 0-106 |
| 5018 | if (!item->hasBoundingRegionGranularity) never evaluated: !item->hasBoundingRegionGranularity | 0 |
| 5019 | return view->updateRectF(item->sceneTransform.mapRect(rect)); never executed: return view->updateRectF(item->sceneTransform.mapRect(rect)); | 0 |
| 5020 | return view->updateRegion(rect, item->sceneTransform); never executed: return view->updateRegion(rect, item->sceneTransform); | 0 |
| 5021 | } | - |
| 5022 | | - |
| 5023 | QTransform xform = item->sceneTransform; executed (the execution status of this line is deduced): QTransform xform = item->sceneTransform; | - |
| 5024 | xform *= viewq->viewportTransform(); executed (the execution status of this line is deduced): xform *= viewq->viewportTransform(); | - |
| 5025 | if (!item->hasBoundingRegionGranularity) partially evaluated: !item->hasBoundingRegionGranularity| yes Evaluation Count:106 | no Evaluation Count:0 |
| 0-106 |
| 5026 | return view->updateRectF(xform.mapRect(rect)); executed: return view->updateRectF(xform.mapRect(rect));Execution Count:106 | 106 |
| 5027 | return view->updateRegion(rect, xform); never executed: return view->updateRegion(rect, xform); | 0 |
| 5028 | } | - |
| 5029 | | - |
| 5030 | void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool dirtyAncestorContainsChildren, | - |
| 5031 | qreal parentOpacity) | - |
| 5032 | { | - |
| 5033 | Q_Q(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScene * const q = q_func(); | - |
| 5034 | Q_ASSERT(item); executed (the execution status of this line is deduced): qt_noop(); | - |
| 5035 | Q_ASSERT(!updateAll); executed (the execution status of this line is deduced): qt_noop(); | - |
| 5036 | | - |
| 5037 | if (!item->d_ptr->dirty && !item->d_ptr->dirtyChildren) { evaluated: !item->d_ptr->dirty| yes Evaluation Count:810 | yes Evaluation Count:379 |
evaluated: !item->d_ptr->dirtyChildren| yes Evaluation Count:776 | yes Evaluation Count:34 |
| 34-810 |
| 5038 | resetDirtyItem(item); executed (the execution status of this line is deduced): resetDirtyItem(item); | - |
| 5039 | return; executed: return;Execution Count:776 | 776 |
| 5040 | } | - |
| 5041 | | - |
| 5042 | const bool itemIsHidden = !item->d_ptr->ignoreVisible && !item->d_ptr->visible; evaluated: !item->d_ptr->ignoreVisible| yes Evaluation Count:412 | yes Evaluation Count:1 |
evaluated: !item->d_ptr->visible| yes Evaluation Count:1 | yes Evaluation Count:411 |
| 1-412 |
| 5043 | if (itemIsHidden) { evaluated: itemIsHidden| yes Evaluation Count:1 | yes Evaluation Count:412 |
| 1-412 |
| 5044 | resetDirtyItem(item, /*recursive=*/true); executed (the execution status of this line is deduced): resetDirtyItem(item, true); | - |
| 5045 | return; executed: return;Execution Count:1 | 1 |
| 5046 | } | - |
| 5047 | | - |
| 5048 | bool itemHasContents = !(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents); executed (the execution status of this line is deduced): bool itemHasContents = !(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents); | - |
| 5049 | const bool itemHasChildren = !item->d_ptr->children.isEmpty(); executed (the execution status of this line is deduced): const bool itemHasChildren = !item->d_ptr->children.isEmpty(); | - |
| 5050 | if (!itemHasContents) { evaluated: !itemHasContents| yes Evaluation Count:7 | yes Evaluation Count:405 |
| 7-405 |
| 5051 | if (!itemHasChildren) { partially evaluated: !itemHasChildren| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 5052 | resetDirtyItem(item); never executed (the execution status of this line is deduced): resetDirtyItem(item); | - |
| 5053 | return; // Item has neither contents nor children!(?) | 0 |
| 5054 | } | - |
| 5055 | if (item->d_ptr->graphicsEffect) evaluated: item->d_ptr->graphicsEffect| yes Evaluation Count:4 | yes Evaluation Count:3 |
| 3-4 |
| 5056 | itemHasContents = true; executed: itemHasContents = true;Execution Count:4 | 4 |
| 5057 | } executed: }Execution Count:7 | 7 |
| 5058 | | - |
| 5059 | const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); executed (the execution status of this line is deduced): const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); | - |
| 5060 | const bool itemIsFullyTransparent = !item->d_ptr->ignoreOpacity partially evaluated: !item->d_ptr->ignoreOpacity| yes Evaluation Count:412 | no Evaluation Count:0 |
| 0-412 |
| 5061 | && QGraphicsItemPrivate::isOpacityNull(opacity); partially evaluated: QGraphicsItemPrivate::isOpacityNull(opacity)| no Evaluation Count:0 | yes Evaluation Count:412 |
| 0-412 |
| 5062 | if (itemIsFullyTransparent && (!itemHasChildren || item->d_ptr->childrenCombineOpacity())) { partially evaluated: itemIsFullyTransparent| no Evaluation Count:0 | yes Evaluation Count:412 |
never evaluated: !itemHasChildren never evaluated: item->d_ptr->childrenCombineOpacity() | 0-412 |
| 5063 | resetDirtyItem(item, /*recursive=*/itemHasChildren); never executed (the execution status of this line is deduced): resetDirtyItem(item, itemHasChildren); | - |
| 5064 | return; | 0 |
| 5065 | } | - |
| 5066 | | - |
| 5067 | bool wasDirtyParentSceneTransform = item->d_ptr->dirtySceneTransform; executed (the execution status of this line is deduced): bool wasDirtyParentSceneTransform = item->d_ptr->dirtySceneTransform; | - |
| 5068 | const bool itemIsUntransformable = item->d_ptr->itemIsUntransformable(); executed (the execution status of this line is deduced): const bool itemIsUntransformable = item->d_ptr->itemIsUntransformable(); | - |
| 5069 | if (wasDirtyParentSceneTransform && !itemIsUntransformable) { evaluated: wasDirtyParentSceneTransform| yes Evaluation Count:162 | yes Evaluation Count:250 |
partially evaluated: !itemIsUntransformable| yes Evaluation Count:162 | no Evaluation Count:0 |
| 0-250 |
| 5070 | item->d_ptr->updateSceneTransformFromParent(); executed (the execution status of this line is deduced): item->d_ptr->updateSceneTransformFromParent(); | - |
| 5071 | Q_ASSERT(!item->d_ptr->dirtySceneTransform); executed (the execution status of this line is deduced): qt_noop(); | - |
| 5072 | } executed: }Execution Count:162 | 162 |
| 5073 | | - |
| 5074 | const bool wasDirtyParentViewBoundingRects = item->d_ptr->paintedViewBoundingRectsNeedRepaint; executed (the execution status of this line is deduced): const bool wasDirtyParentViewBoundingRects = item->d_ptr->paintedViewBoundingRectsNeedRepaint; | - |
| 5075 | if (itemIsFullyTransparent || !itemHasContents || dirtyAncestorContainsChildren) { partially evaluated: itemIsFullyTransparent| no Evaluation Count:0 | yes Evaluation Count:412 |
evaluated: !itemHasContents| yes Evaluation Count:3 | yes Evaluation Count:409 |
evaluated: dirtyAncestorContainsChildren| yes Evaluation Count:3 | yes Evaluation Count:406 |
| 0-412 |
| 5076 | // Make sure we don't process invisible items or items with no content. | - |
| 5077 | item->d_ptr->dirty = 0; executed (the execution status of this line is deduced): item->d_ptr->dirty = 0; | - |
| 5078 | item->d_ptr->fullUpdatePending = 0; executed (the execution status of this line is deduced): item->d_ptr->fullUpdatePending = 0; | - |
| 5079 | // Might have a dirty view bounding rect otherwise. | - |
| 5080 | if (itemIsFullyTransparent || !itemHasContents) partially evaluated: itemIsFullyTransparent| no Evaluation Count:0 | yes Evaluation Count:6 |
evaluated: !itemHasContents| yes Evaluation Count:3 | yes Evaluation Count:3 |
| 0-6 |
| 5081 | item->d_ptr->paintedViewBoundingRectsNeedRepaint = 0; executed: item->d_ptr->paintedViewBoundingRectsNeedRepaint = 0;Execution Count:3 | 3 |
| 5082 | } executed: }Execution Count:6 | 6 |
| 5083 | | - |
| 5084 | if (!hasSceneRect && item->d_ptr->geometryChanged && item->d_ptr->visible) { evaluated: !hasSceneRect| yes Evaluation Count:378 | yes Evaluation Count:34 |
evaluated: item->d_ptr->geometryChanged| yes Evaluation Count:338 | yes Evaluation Count:40 |
partially evaluated: item->d_ptr->visible| yes Evaluation Count:338 | no Evaluation Count:0 |
| 0-378 |
| 5085 | // Update growingItemsBoundingRect. | - |
| 5086 | if (item->d_ptr->sceneTransformTranslateOnly) { evaluated: item->d_ptr->sceneTransformTranslateOnly| yes Evaluation Count:337 | yes Evaluation Count:1 |
| 1-337 |
| 5087 | growingItemsBoundingRect |= item->boundingRect().translated(item->d_ptr->sceneTransform.dx(), executed (the execution status of this line is deduced): growingItemsBoundingRect |= item->boundingRect().translated(item->d_ptr->sceneTransform.dx(), | - |
| 5088 | item->d_ptr->sceneTransform.dy()); executed (the execution status of this line is deduced): item->d_ptr->sceneTransform.dy()); | - |
| 5089 | } else { executed: }Execution Count:337 | 337 |
| 5090 | growingItemsBoundingRect |= item->d_ptr->sceneTransform.mapRect(item->boundingRect()); executed (the execution status of this line is deduced): growingItemsBoundingRect |= item->d_ptr->sceneTransform.mapRect(item->boundingRect()); | - |
| 5091 | } executed: }Execution Count:1 | 1 |
| 5092 | } | - |
| 5093 | | - |
| 5094 | // Process item. | - |
| 5095 | if (item->d_ptr->dirty || item->d_ptr->paintedViewBoundingRectsNeedRepaint) { evaluated: item->d_ptr->dirty| yes Evaluation Count:374 | yes Evaluation Count:38 |
evaluated: item->d_ptr->paintedViewBoundingRectsNeedRepaint| yes Evaluation Count:3 | yes Evaluation Count:35 |
| 3-374 |
| 5096 | const bool useCompatUpdate = views.isEmpty() || isSignalConnected(changedSignalIndex); evaluated: views.isEmpty()| yes Evaluation Count:4 | yes Evaluation Count:373 |
evaluated: isSignalConnected(changedSignalIndex)| yes Evaluation Count:6 | yes Evaluation Count:367 |
| 4-373 |
| 5097 | const QRectF itemBoundingRect = adjustedItemEffectiveBoundingRect(item); executed (the execution status of this line is deduced): const QRectF itemBoundingRect = adjustedItemEffectiveBoundingRect(item); | - |
| 5098 | | - |
| 5099 | if (useCompatUpdate && !itemIsUntransformable && qFuzzyIsNull(item->boundingRegionGranularity())) { evaluated: useCompatUpdate| yes Evaluation Count:10 | yes Evaluation Count:367 |
partially evaluated: !itemIsUntransformable| yes Evaluation Count:10 | no Evaluation Count:0 |
partially evaluated: qFuzzyIsNull(item->boundingRegionGranularity())| yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-367 |
| 5100 | // This block of code is kept for compatibility. Since 4.5, by default | - |
| 5101 | // QGraphicsView does not connect the signal and we use the below | - |
| 5102 | // method of delivering updates. | - |
| 5103 | if (item->d_ptr->sceneTransformTranslateOnly) { partially evaluated: item->d_ptr->sceneTransformTranslateOnly| yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
| 5104 | q->update(itemBoundingRect.translated(item->d_ptr->sceneTransform.dx(), executed (the execution status of this line is deduced): q->update(itemBoundingRect.translated(item->d_ptr->sceneTransform.dx(), | - |
| 5105 | item->d_ptr->sceneTransform.dy())); executed (the execution status of this line is deduced): item->d_ptr->sceneTransform.dy())); | - |
| 5106 | } else { executed: }Execution Count:10 | 10 |
| 5107 | QRectF rect = item->d_ptr->sceneTransform.mapRect(itemBoundingRect); never executed (the execution status of this line is deduced): QRectF rect = item->d_ptr->sceneTransform.mapRect(itemBoundingRect); | - |
| 5108 | if (!rect.isEmpty()) never evaluated: !rect.isEmpty() | 0 |
| 5109 | q->update(rect); never executed: q->update(rect); | 0 |
| 5110 | } | 0 |
| 5111 | } else { | - |
| 5112 | QRectF dirtyRect; executed (the execution status of this line is deduced): QRectF dirtyRect; | - |
| 5113 | bool uninitializedDirtyRect = true; executed (the execution status of this line is deduced): bool uninitializedDirtyRect = true; | - |
| 5114 | | - |
| 5115 | for (int j = 0; j < views.size(); ++j) { evaluated: j < views.size()| yes Evaluation Count:367 | yes Evaluation Count:367 |
| 367 |
| 5116 | QGraphicsView *view = views.at(j); executed (the execution status of this line is deduced): QGraphicsView *view = views.at(j); | - |
| 5117 | QGraphicsViewPrivate *viewPrivate = view->d_func(); executed (the execution status of this line is deduced): QGraphicsViewPrivate *viewPrivate = view->d_func(); | - |
| 5118 | QRect &paintedViewBoundingRect = item->d_ptr->paintedViewBoundingRects[viewPrivate->viewport]; executed (the execution status of this line is deduced): QRect &paintedViewBoundingRect = item->d_ptr->paintedViewBoundingRects[viewPrivate->viewport]; | - |
| 5119 | if (viewPrivate->fullUpdatePending evaluated: viewPrivate->fullUpdatePending| yes Evaluation Count:11 | yes Evaluation Count:356 |
| 11-356 |
| 5120 | || viewPrivate->viewportUpdateMode == QGraphicsView::NoViewportUpdate) { evaluated: viewPrivate->viewportUpdateMode == QGraphicsView::NoViewportUpdate| yes Evaluation Count:1 | yes Evaluation Count:355 |
| 1-355 |
| 5121 | // Okay, if we have a full update pending or no viewport update, this item's | - |
| 5122 | // paintedViewBoundingRect will be updated correctly in the next paintEvent if | - |
| 5123 | // it is inside the viewport, but for now we can pretend that it is outside. | - |
| 5124 | paintedViewBoundingRect = QRect(-1, -1, -1, -1); executed (the execution status of this line is deduced): paintedViewBoundingRect = QRect(-1, -1, -1, -1); | - |
| 5125 | continue; executed: continue;Execution Count:12 | 12 |
| 5126 | } | - |
| 5127 | | - |
| 5128 | if (item->d_ptr->paintedViewBoundingRectsNeedRepaint) { evaluated: item->d_ptr->paintedViewBoundingRectsNeedRepaint| yes Evaluation Count:315 | yes Evaluation Count:40 |
| 40-315 |
| 5129 | paintedViewBoundingRect.translate(viewPrivate->dirtyScrollOffset); executed (the execution status of this line is deduced): paintedViewBoundingRect.translate(viewPrivate->dirtyScrollOffset); | - |
| 5130 | if (!viewPrivate->updateRect(paintedViewBoundingRect)) evaluated: !viewPrivate->updateRect(paintedViewBoundingRect)| yes Evaluation Count:10 | yes Evaluation Count:305 |
| 10-305 |
| 5131 | paintedViewBoundingRect = QRect(-1, -1, -1, -1); // Outside viewport. executed: paintedViewBoundingRect = QRect(-1, -1, -1, -1);Execution Count:10 | 10 |
| 5132 | } executed: }Execution Count:315 | 315 |
| 5133 | | - |
| 5134 | if (!item->d_ptr->dirty) evaluated: !item->d_ptr->dirty| yes Evaluation Count:1 | yes Evaluation Count:354 |
| 1-354 |
| 5135 | continue; executed: continue;Execution Count:1 | 1 |
| 5136 | | - |
| 5137 | if (!item->d_ptr->paintedViewBoundingRectsNeedRepaint evaluated: !item->d_ptr->paintedViewBoundingRectsNeedRepaint| yes Evaluation Count:40 | yes Evaluation Count:314 |
| 40-314 |
| 5138 | && paintedViewBoundingRect.x() == -1 && paintedViewBoundingRect.y() == -1 partially evaluated: paintedViewBoundingRect.x() == -1| no Evaluation Count:0 | yes Evaluation Count:40 |
never evaluated: paintedViewBoundingRect.y() == -1 | 0-40 |
| 5139 | && paintedViewBoundingRect.width() == -1 && paintedViewBoundingRect.height() == -1) { never evaluated: paintedViewBoundingRect.width() == -1 never evaluated: paintedViewBoundingRect.height() == -1 | 0 |
| 5140 | continue; // Outside viewport. never executed: continue; | 0 |
| 5141 | } | - |
| 5142 | | - |
| 5143 | if (uninitializedDirtyRect) { partially evaluated: uninitializedDirtyRect| yes Evaluation Count:354 | no Evaluation Count:0 |
| 0-354 |
| 5144 | dirtyRect = itemBoundingRect; executed (the execution status of this line is deduced): dirtyRect = itemBoundingRect; | - |
| 5145 | if (!item->d_ptr->fullUpdatePending) { partially evaluated: !item->d_ptr->fullUpdatePending| no Evaluation Count:0 | yes Evaluation Count:354 |
| 0-354 |
| 5146 | _q_adjustRect(&item->d_ptr->needsRepaint); never executed (the execution status of this line is deduced): _q_adjustRect(&item->d_ptr->needsRepaint); | - |
| 5147 | dirtyRect &= item->d_ptr->needsRepaint; never executed (the execution status of this line is deduced): dirtyRect &= item->d_ptr->needsRepaint; | - |
| 5148 | } | 0 |
| 5149 | uninitializedDirtyRect = false; executed (the execution status of this line is deduced): uninitializedDirtyRect = false; | - |
| 5150 | } executed: }Execution Count:354 | 354 |
| 5151 | | - |
| 5152 | if (dirtyRect.isEmpty()) partially evaluated: dirtyRect.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:354 |
| 0-354 |
| 5153 | continue; // Discard updates outside the bounding rect. never executed: continue; | 0 |
| 5154 | | - |
| 5155 | if (!updateHelper(viewPrivate, item->d_ptr.data(), dirtyRect, itemIsUntransformable) evaluated: !updateHelper(viewPrivate, item->d_ptr.data(), dirtyRect, itemIsUntransformable)| yes Evaluation Count:5 | yes Evaluation Count:349 |
| 5-349 |
| 5156 | && item->d_ptr->paintedViewBoundingRectsNeedRepaint) { partially evaluated: item->d_ptr->paintedViewBoundingRectsNeedRepaint| yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
| 5157 | paintedViewBoundingRect = QRect(-1, -1, -1, -1); // Outside viewport. executed (the execution status of this line is deduced): paintedViewBoundingRect = QRect(-1, -1, -1, -1); | - |
| 5158 | } executed: }Execution Count:5 | 5 |
| 5159 | } executed: }Execution Count:354 | 354 |
| 5160 | } executed: }Execution Count:367 | 367 |
| 5161 | } | - |
| 5162 | | - |
| 5163 | // Process children. | - |
| 5164 | if (itemHasChildren && item->d_ptr->dirtyChildren) { evaluated: itemHasChildren| yes Evaluation Count:58 | yes Evaluation Count:354 |
evaluated: item->d_ptr->dirtyChildren| yes Evaluation Count:57 | yes Evaluation Count:1 |
| 1-354 |
| 5165 | const bool itemClipsChildrenToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape; executed (the execution status of this line is deduced): const bool itemClipsChildrenToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape; | - |
| 5166 | // Items with no content are threated as 'dummy' items which means they are never drawn and | - |
| 5167 | // 'processed', so the painted view bounding rect is never up-to-date. This means that whenever | - |
| 5168 | // such an item changes geometry, its children have to take care of the update regardless | - |
| 5169 | // of whether the item clips children to shape or not. | - |
| 5170 | const bool bypassUpdateClip = !itemHasContents && wasDirtyParentViewBoundingRects; evaluated: !itemHasContents| yes Evaluation Count:3 | yes Evaluation Count:54 |
evaluated: wasDirtyParentViewBoundingRects| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-54 |
| 5171 | if (itemClipsChildrenToShape && !bypassUpdateClip) { evaluated: itemClipsChildrenToShape| yes Evaluation Count:8 | yes Evaluation Count:49 |
evaluated: !bypassUpdateClip| yes Evaluation Count:7 | yes Evaluation Count:1 |
| 1-49 |
| 5172 | // Make sure child updates are clipped to the item's bounding rect. | - |
| 5173 | for (int i = 0; i < views.size(); ++i) evaluated: i < views.size()| yes Evaluation Count:7 | yes Evaluation Count:7 |
| 7 |
| 5174 | views.at(i)->d_func()->setUpdateClip(item); executed: views.at(i)->d_func()->setUpdateClip(item);Execution Count:7 | 7 |
| 5175 | } executed: }Execution Count:7 | 7 |
| 5176 | if (!dirtyAncestorContainsChildren) { evaluated: !dirtyAncestorContainsChildren| yes Evaluation Count:56 | yes Evaluation Count:1 |
| 1-56 |
| 5177 | dirtyAncestorContainsChildren = item->d_ptr->fullUpdatePending evaluated: item->d_ptr->fullUpdatePending| yes Evaluation Count:21 | yes Evaluation Count:35 |
| 21-35 |
| 5178 | && itemClipsChildrenToShape; evaluated: itemClipsChildrenToShape| yes Evaluation Count:2 | yes Evaluation Count:19 |
| 2-19 |
| 5179 | } executed: }Execution Count:56 | 56 |
| 5180 | const bool allChildrenDirty = item->d_ptr->allChildrenDirty; executed (the execution status of this line is deduced): const bool allChildrenDirty = item->d_ptr->allChildrenDirty; | - |
| 5181 | const bool parentIgnoresVisible = item->d_ptr->ignoreVisible; executed (the execution status of this line is deduced): const bool parentIgnoresVisible = item->d_ptr->ignoreVisible; | - |
| 5182 | const bool parentIgnoresOpacity = item->d_ptr->ignoreOpacity; executed (the execution status of this line is deduced): const bool parentIgnoresOpacity = item->d_ptr->ignoreOpacity; | - |
| 5183 | for (int i = 0; i < item->d_ptr->children.size(); ++i) { evaluated: i < item->d_ptr->children.size()| yes Evaluation Count:178 | yes Evaluation Count:57 |
| 57-178 |
| 5184 | QGraphicsItem *child = item->d_ptr->children.at(i); executed (the execution status of this line is deduced): QGraphicsItem *child = item->d_ptr->children.at(i); | - |
| 5185 | if (wasDirtyParentSceneTransform) evaluated: wasDirtyParentSceneTransform| yes Evaluation Count:5 | yes Evaluation Count:173 |
| 5-173 |
| 5186 | child->d_ptr->dirtySceneTransform = 1; executed: child->d_ptr->dirtySceneTransform = 1;Execution Count:5 | 5 |
| 5187 | if (wasDirtyParentViewBoundingRects) evaluated: wasDirtyParentViewBoundingRects| yes Evaluation Count:85 | yes Evaluation Count:93 |
| 85-93 |
| 5188 | child->d_ptr->paintedViewBoundingRectsNeedRepaint = 1; executed: child->d_ptr->paintedViewBoundingRectsNeedRepaint = 1;Execution Count:85 | 85 |
| 5189 | if (parentIgnoresVisible) partially evaluated: parentIgnoresVisible| no Evaluation Count:0 | yes Evaluation Count:178 |
| 0-178 |
| 5190 | child->d_ptr->ignoreVisible = 1; never executed: child->d_ptr->ignoreVisible = 1; | 0 |
| 5191 | if (parentIgnoresOpacity) partially evaluated: parentIgnoresOpacity| no Evaluation Count:0 | yes Evaluation Count:178 |
| 0-178 |
| 5192 | child->d_ptr->ignoreOpacity = 1; never executed: child->d_ptr->ignoreOpacity = 1; | 0 |
| 5193 | if (allChildrenDirty) { evaluated: allChildrenDirty| yes Evaluation Count:20 | yes Evaluation Count:158 |
| 20-158 |
| 5194 | child->d_ptr->dirty = 1; executed (the execution status of this line is deduced): child->d_ptr->dirty = 1; | - |
| 5195 | child->d_ptr->fullUpdatePending = 1; executed (the execution status of this line is deduced): child->d_ptr->fullUpdatePending = 1; | - |
| 5196 | child->d_ptr->dirtyChildren = 1; executed (the execution status of this line is deduced): child->d_ptr->dirtyChildren = 1; | - |
| 5197 | child->d_ptr->allChildrenDirty = 1; executed (the execution status of this line is deduced): child->d_ptr->allChildrenDirty = 1; | - |
| 5198 | } executed: }Execution Count:20 | 20 |
| 5199 | processDirtyItemsRecursive(child, dirtyAncestorContainsChildren, opacity); executed (the execution status of this line is deduced): processDirtyItemsRecursive(child, dirtyAncestorContainsChildren, opacity); | - |
| 5200 | } executed: }Execution Count:178 | 178 |
| 5201 | | - |
| 5202 | if (itemClipsChildrenToShape) { evaluated: itemClipsChildrenToShape| yes Evaluation Count:8 | yes Evaluation Count:49 |
| 8-49 |
| 5203 | // Reset updateClip. | - |
| 5204 | for (int i = 0; i < views.size(); ++i) evaluated: i < views.size()| yes Evaluation Count:8 | yes Evaluation Count:8 |
| 8 |
| 5205 | views.at(i)->d_func()->setUpdateClip(0); executed: views.at(i)->d_func()->setUpdateClip(0);Execution Count:8 | 8 |
| 5206 | } executed: }Execution Count:8 | 8 |
| 5207 | } else if (wasDirtyParentSceneTransform) { executed: }Execution Count:57 evaluated: wasDirtyParentSceneTransform| yes Evaluation Count:157 | yes Evaluation Count:198 |
| 57-198 |
| 5208 | item->d_ptr->invalidateChildrenSceneTransform(); executed (the execution status of this line is deduced): item->d_ptr->invalidateChildrenSceneTransform(); | - |
| 5209 | } executed: }Execution Count:157 | 157 |
| 5210 | | - |
| 5211 | resetDirtyItem(item); executed (the execution status of this line is deduced): resetDirtyItem(item); | - |
| 5212 | } executed: }Execution Count:412 | 412 |
| 5213 | | - |
| 5214 | /*! | - |
| 5215 | \obsolete | - |
| 5216 | | - |
| 5217 | Paints the given \a items using the provided \a painter, after the | - |
| 5218 | background has been drawn, and before the foreground has been | - |
| 5219 | drawn. All painting is done in \e scene coordinates. Before | - |
| 5220 | drawing each item, the painter must be transformed using | - |
| 5221 | QGraphicsItem::sceneTransform(). | - |
| 5222 | | - |
| 5223 | The \a options parameter is the list of style option objects for | - |
| 5224 | each item in \a items. The \a numItems parameter is the number of | - |
| 5225 | items in \a items and options in \a options. The \a widget | - |
| 5226 | parameter is optional; if specified, it should point to the widget | - |
| 5227 | that is being painted on. | - |
| 5228 | | - |
| 5229 | The default implementation prepares the painter matrix, and calls | - |
| 5230 | QGraphicsItem::paint() on all items. Reimplement this function to | - |
| 5231 | provide custom painting of all items for the scene; gaining | - |
| 5232 | complete control over how each item is drawn. In some cases this | - |
| 5233 | can increase drawing performance significantly. | - |
| 5234 | | - |
| 5235 | Example: | - |
| 5236 | | - |
| 5237 | \snippet graphicssceneadditemsnippet.cpp 0 | - |
| 5238 | | - |
| 5239 | Since Qt 4.6, this function is not called anymore unless | - |
| 5240 | the QGraphicsView::IndirectPainting flag is given as an Optimization | - |
| 5241 | flag. | - |
| 5242 | | - |
| 5243 | \sa drawBackground(), drawForeground() | - |
| 5244 | */ | - |
| 5245 | void QGraphicsScene::drawItems(QPainter *painter, | - |
| 5246 | int numItems, | - |
| 5247 | QGraphicsItem *items[], | - |
| 5248 | const QStyleOptionGraphicsItem options[], QWidget *widget) | - |
| 5249 | { | - |
| 5250 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 5251 | // Make sure we don't have unpolished items before we draw. | - |
| 5252 | if (!d->unpolishedItems.isEmpty()) evaluated: !d->unpolishedItems.isEmpty()| yes Evaluation Count:7 | yes Evaluation Count:13 |
| 7-13 |
| 5253 | d->_q_polishItems(); executed: d->_q_polishItems();Execution Count:7 | 7 |
| 5254 | | - |
| 5255 | const qreal opacity = painter->opacity(); executed (the execution status of this line is deduced): const qreal opacity = painter->opacity(); | - |
| 5256 | QTransform viewTransform = painter->worldTransform(); executed (the execution status of this line is deduced): QTransform viewTransform = painter->worldTransform(); | - |
| 5257 | Q_UNUSED(options); executed (the execution status of this line is deduced): (void)options;; | - |
| 5258 | | - |
| 5259 | // Determine view, expose and flags. | - |
| 5260 | QGraphicsView *view = widget ? qobject_cast<QGraphicsView *>(widget->parentWidget()) : 0; evaluated: widget| yes Evaluation Count:4 | yes Evaluation Count:16 |
| 4-16 |
| 5261 | QRegion *expose = 0; executed (the execution status of this line is deduced): QRegion *expose = 0; | - |
| 5262 | const quint32 oldRectAdjust = d->rectAdjust; executed (the execution status of this line is deduced): const quint32 oldRectAdjust = d->rectAdjust; | - |
| 5263 | if (view) { evaluated: view| yes Evaluation Count:4 | yes Evaluation Count:16 |
| 4-16 |
| 5264 | d->updateAll = false; executed (the execution status of this line is deduced): d->updateAll = false; | - |
| 5265 | expose = &view->d_func()->exposedRegion; executed (the execution status of this line is deduced): expose = &view->d_func()->exposedRegion; | - |
| 5266 | if (view->d_func()->optimizationFlags & QGraphicsView::DontAdjustForAntialiasing) partially evaluated: view->d_func()->optimizationFlags & QGraphicsView::DontAdjustForAntialiasing| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 5267 | d->rectAdjust = 1; never executed: d->rectAdjust = 1; | 0 |
| 5268 | else | - |
| 5269 | d->rectAdjust = 2; executed: d->rectAdjust = 2;Execution Count:4 | 4 |
| 5270 | } | - |
| 5271 | | - |
| 5272 | // Find all toplevels, they are already sorted. | - |
| 5273 | QList<QGraphicsItem *> topLevelItems; executed (the execution status of this line is deduced): QList<QGraphicsItem *> topLevelItems; | - |
| 5274 | for (int i = 0; i < numItems; ++i) { evaluated: i < numItems| yes Evaluation Count:35 | yes Evaluation Count:20 |
| 20-35 |
| 5275 | QGraphicsItem *item = items[i]->topLevelItem(); executed (the execution status of this line is deduced): QGraphicsItem *item = items[i]->topLevelItem(); | - |
| 5276 | if (!item->d_ptr->itemDiscovered) { partially evaluated: !item->d_ptr->itemDiscovered| yes Evaluation Count:35 | no Evaluation Count:0 |
| 0-35 |
| 5277 | topLevelItems << item; executed (the execution status of this line is deduced): topLevelItems << item; | - |
| 5278 | item->d_ptr->itemDiscovered = 1; executed (the execution status of this line is deduced): item->d_ptr->itemDiscovered = 1; | - |
| 5279 | d->drawSubtreeRecursive(item, painter, &viewTransform, expose, widget); executed (the execution status of this line is deduced): d->drawSubtreeRecursive(item, painter, &viewTransform, expose, widget); | - |
| 5280 | } executed: }Execution Count:35 | 35 |
| 5281 | } executed: }Execution Count:35 | 35 |
| 5282 | | - |
| 5283 | d->rectAdjust = oldRectAdjust; executed (the execution status of this line is deduced): d->rectAdjust = oldRectAdjust; | - |
| 5284 | // Reset discovery bits. | - |
| 5285 | for (int i = 0; i < topLevelItems.size(); ++i) evaluated: i < topLevelItems.size()| yes Evaluation Count:35 | yes Evaluation Count:20 |
| 20-35 |
| 5286 | topLevelItems.at(i)->d_ptr->itemDiscovered = 0; executed: topLevelItems.at(i)->d_ptr->itemDiscovered = 0;Execution Count:35 | 35 |
| 5287 | | - |
| 5288 | painter->setWorldTransform(viewTransform); executed (the execution status of this line is deduced): painter->setWorldTransform(viewTransform); | - |
| 5289 | painter->setOpacity(opacity); executed (the execution status of this line is deduced): painter->setOpacity(opacity); | - |
| 5290 | } executed: }Execution Count:20 | 20 |
| 5291 | | - |
| 5292 | /*! | - |
| 5293 | \since 4.4 | - |
| 5294 | | - |
| 5295 | Finds a new widget to give the keyboard focus to, as appropriate for Tab | - |
| 5296 | and Shift+Tab, and returns true if it can find a new widget, or false if | - |
| 5297 | it cannot. If \a next is true, this function searches forward; if \a next | - |
| 5298 | is false, it searches backward. | - |
| 5299 | | - |
| 5300 | You can reimplement this function in a subclass of QGraphicsScene to | - |
| 5301 | provide fine-grained control over how tab focus passes inside your | - |
| 5302 | scene. The default implementation is based on the tab focus chain defined | - |
| 5303 | by QGraphicsWidget::setTabOrder(). | - |
| 5304 | */ | - |
| 5305 | bool QGraphicsScene::focusNextPrevChild(bool next) | - |
| 5306 | { | - |
| 5307 | Q_D(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 5308 | | - |
| 5309 | QGraphicsItem *item = focusItem(); never executed (the execution status of this line is deduced): QGraphicsItem *item = focusItem(); | - |
| 5310 | if (item && !item->isWidget()) { never evaluated: item never evaluated: !item->isWidget() | 0 |
| 5311 | // Tab out of the scene. | - |
| 5312 | return false; never executed: return false; | 0 |
| 5313 | } | - |
| 5314 | if (!item) { | 0 |
| 5315 | if (d->lastFocusItem && !d->lastFocusItem->isWidget()) { never evaluated: d->lastFocusItem never evaluated: !d->lastFocusItem->isWidget() | 0 |
| 5316 | // Restore focus to the last focusable non-widget item that had | - |
| 5317 | // focus. | - |
| 5318 | setFocusItem(d->lastFocusItem, next ? Qt::TabFocusReason : Qt::BacktabFocusReason); never executed (the execution status of this line is deduced): setFocusItem(d->lastFocusItem, next ? Qt::TabFocusReason : Qt::BacktabFocusReason); | - |
| 5319 | return true; never executed: return true; | 0 |
| 5320 | } | - |
| 5321 | } | 0 |
| 5322 | if (!d->tabFocusFirst) { never evaluated: !d->tabFocusFirst | 0 |
| 5323 | // No widgets... | - |
| 5324 | return false; never executed: return false; | 0 |
| 5325 | } | - |
| 5326 | | - |
| 5327 | // The item must be a widget. | - |
| 5328 | QGraphicsWidget *widget = 0; never executed (the execution status of this line is deduced): QGraphicsWidget *widget = 0; | - |
| 5329 | if (!item) { | 0 |
| 5330 | widget = next ? d->tabFocusFirst : d->tabFocusFirst->d_func()->focusPrev; | 0 |
| 5331 | } else { | 0 |
| 5332 | QGraphicsWidget *test = static_cast<QGraphicsWidget *>(item); never executed (the execution status of this line is deduced): QGraphicsWidget *test = static_cast<QGraphicsWidget *>(item); | - |
| 5333 | widget = next ? test->d_func()->focusNext : test->d_func()->focusPrev; | 0 |
| 5334 | if ((next && widget == d->tabFocusFirst) || (!next && widget == d->tabFocusFirst->d_func()->focusPrev)) never evaluated: next never evaluated: widget == d->tabFocusFirst never evaluated: !next never evaluated: widget == d->tabFocusFirst->d_func()->focusPrev | 0 |
| 5335 | return false; never executed: return false; | 0 |
| 5336 | } | 0 |
| 5337 | QGraphicsWidget *widgetThatHadFocus = widget; never executed (the execution status of this line is deduced): QGraphicsWidget *widgetThatHadFocus = widget; | - |
| 5338 | | - |
| 5339 | // Run around the focus chain until we find a widget that can take tab focus. | - |
| 5340 | do { | - |
| 5341 | if (widget->flags() & QGraphicsItem::ItemIsFocusable never evaluated: widget->flags() & QGraphicsItem::ItemIsFocusable | 0 |
| 5342 | && widget->isEnabled() && widget->isVisibleTo(0) never evaluated: widget->isEnabled() never evaluated: widget->isVisibleTo(0) | 0 |
| 5343 | && (widget->focusPolicy() & Qt::TabFocus) never evaluated: (widget->focusPolicy() & Qt::TabFocus) | 0 |
| 5344 | && (!item || !item->isPanel() || item->isAncestorOf(widget)) never evaluated: !item never evaluated: !item->isPanel() never evaluated: item->isAncestorOf(widget) | 0 |
| 5345 | ) { | - |
| 5346 | setFocusItem(widget, next ? Qt::TabFocusReason : Qt::BacktabFocusReason); never executed (the execution status of this line is deduced): setFocusItem(widget, next ? Qt::TabFocusReason : Qt::BacktabFocusReason); | - |
| 5347 | return true; never executed: return true; | 0 |
| 5348 | } | - |
| 5349 | widget = next ? widget->d_func()->focusNext : widget->d_func()->focusPrev; | 0 |
| 5350 | if ((next && widget == d->tabFocusFirst) || (!next && widget == d->tabFocusFirst->d_func()->focusPrev)) never evaluated: next never evaluated: widget == d->tabFocusFirst never evaluated: !next never evaluated: widget == d->tabFocusFirst->d_func()->focusPrev | 0 |
| 5351 | return false; never executed: return false; | 0 |
| 5352 | } while (widget != widgetThatHadFocus); never executed: } never evaluated: widget != widgetThatHadFocus | 0 |
| 5353 | | - |
| 5354 | return false; never executed: return false; | 0 |
| 5355 | } | - |
| 5356 | | - |
| 5357 | /*! | - |
| 5358 | \fn QGraphicsScene::changed(const QList<QRectF> ®ion) | - |
| 5359 | | - |
| 5360 | This signal is emitted by QGraphicsScene when control reaches the | - |
| 5361 | event loop, if the scene content changes. The \a region parameter | - |
| 5362 | contains a list of scene rectangles that indicate the area that | - |
| 5363 | has been changed. | - |
| 5364 | | - |
| 5365 | \sa QGraphicsView::updateScene() | - |
| 5366 | */ | - |
| 5367 | | - |
| 5368 | /*! | - |
| 5369 | \fn QGraphicsScene::sceneRectChanged(const QRectF &rect) | - |
| 5370 | | - |
| 5371 | This signal is emitted by QGraphicsScene whenever the scene rect changes. | - |
| 5372 | The \a rect parameter is the new scene rectangle. | - |
| 5373 | | - |
| 5374 | \sa QGraphicsView::updateSceneRect() | - |
| 5375 | */ | - |
| 5376 | | - |
| 5377 | /*! | - |
| 5378 | \fn QGraphicsScene::selectionChanged() | - |
| 5379 | \since 4.3 | - |
| 5380 | | - |
| 5381 | This signal is emitted by QGraphicsScene whenever the selection | - |
| 5382 | changes. You can call selectedItems() to get the new list of selected | - |
| 5383 | items. | - |
| 5384 | | - |
| 5385 | The selection changes whenever an item is selected or unselected, a | - |
| 5386 | selection area is set, cleared or otherwise changed, if a preselected item | - |
| 5387 | is added to the scene, or if a selected item is removed from the scene. | - |
| 5388 | | - |
| 5389 | QGraphicsScene emits this signal only once for group selection operations. | - |
| 5390 | For example, if you set a selection area, select or unselect a | - |
| 5391 | QGraphicsItemGroup, or if you add or remove from the scene a parent item | - |
| 5392 | that contains several selected items, selectionChanged() is emitted only | - |
| 5393 | once after the operation has completed (instead of once for each item). | - |
| 5394 | | - |
| 5395 | \sa setSelectionArea(), selectedItems(), QGraphicsItem::setSelected() | - |
| 5396 | */ | - |
| 5397 | | - |
| 5398 | /*! | - |
| 5399 | \since 4.4 | - |
| 5400 | | - |
| 5401 | Returns the scene's style, or the same as QApplication::style() if the | - |
| 5402 | scene has not been explicitly assigned a style. | - |
| 5403 | | - |
| 5404 | \sa setStyle() | - |
| 5405 | */ | - |
| 5406 | QStyle *QGraphicsScene::style() const | - |
| 5407 | { | - |
| 5408 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 5409 | // ### This function, and the use of styles in general, is non-reentrant. | - |
| 5410 | return d->style ? d->style : QApplication::style(); executed: return d->style ? d->style : QApplication::style();Execution Count:2387 | 2387 |
| 5411 | } | - |
| 5412 | | - |
| 5413 | /*! | - |
| 5414 | \since 4.4 | - |
| 5415 | | - |
| 5416 | Sets or replaces the style of the scene to \a style, and reparents the | - |
| 5417 | style to this scene. Any previously assigned style is deleted. The scene's | - |
| 5418 | style defaults to QApplication::style(), and serves as the default for all | - |
| 5419 | QGraphicsWidget items in the scene. | - |
| 5420 | | - |
| 5421 | Changing the style, either directly by calling this function, or | - |
| 5422 | indirectly by calling QApplication::setStyle(), will automatically update | - |
| 5423 | the style for all widgets in the scene that do not have a style explicitly | - |
| 5424 | assigned to them. | - |
| 5425 | | - |
| 5426 | If \a style is 0, QGraphicsScene will revert to QApplication::style(). | - |
| 5427 | | - |
| 5428 | \sa style() | - |
| 5429 | */ | - |
| 5430 | void QGraphicsScene::setStyle(QStyle *style) | - |
| 5431 | { | - |
| 5432 | Q_D(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 5433 | // ### This function, and the use of styles in general, is non-reentrant. | - |
| 5434 | if (style == d->style) never evaluated: style == d->style | 0 |
| 5435 | return; | 0 |
| 5436 | | - |
| 5437 | // Delete the old style, | - |
| 5438 | delete d->style; never executed (the execution status of this line is deduced): delete d->style; | - |
| 5439 | if ((d->style = style)) never evaluated: (d->style = style) | 0 |
| 5440 | d->style->setParent(this); never executed: d->style->setParent(this); | 0 |
| 5441 | | - |
| 5442 | // Notify the scene. | - |
| 5443 | QEvent event(QEvent::StyleChange); never executed (the execution status of this line is deduced): QEvent event(QEvent::StyleChange); | - |
| 5444 | QApplication::sendEvent(this, &event); never executed (the execution status of this line is deduced): QApplication::sendEvent(this, &event); | - |
| 5445 | | - |
| 5446 | // Notify all widgets that don't have a style explicitly set. | - |
| 5447 | foreach (QGraphicsItem *item, items()) { never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(items())> _container_(items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 5448 | if (item->isWidget()) { never evaluated: item->isWidget() | 0 |
| 5449 | QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); never executed (the execution status of this line is deduced): QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); | - |
| 5450 | if (!widget->testAttribute(Qt::WA_SetStyle)) never evaluated: !widget->testAttribute(Qt::WA_SetStyle) | 0 |
| 5451 | QApplication::sendEvent(widget, &event); never executed: QApplication::sendEvent(widget, &event); | 0 |
| 5452 | } | 0 |
| 5453 | } | 0 |
| 5454 | } | 0 |
| 5455 | | - |
| 5456 | /*! | - |
| 5457 | \property QGraphicsScene::font | - |
| 5458 | \since 4.4 | - |
| 5459 | \brief the scene's default font | - |
| 5460 | | - |
| 5461 | This property provides the scene's font. The scene font defaults to, | - |
| 5462 | and resolves all its entries from, QApplication::font. | - |
| 5463 | | - |
| 5464 | If the scene's font changes, either directly through setFont() or | - |
| 5465 | indirectly when the application font changes, QGraphicsScene first | - |
| 5466 | sends itself a \l{QEvent::FontChange}{FontChange} event, and it then | - |
| 5467 | sends \l{QEvent::FontChange}{FontChange} events to all top-level | - |
| 5468 | widget items in the scene. These items respond by resolving their own | - |
| 5469 | fonts to the scene, and they then notify their children, who again | - |
| 5470 | notify their children, and so on, until all widget items have updated | - |
| 5471 | their fonts. | - |
| 5472 | | - |
| 5473 | Changing the scene font, (directly or indirectly through | - |
| 5474 | QApplication::setFont(),) automatically schedules a redraw the entire | - |
| 5475 | scene. | - |
| 5476 | | - |
| 5477 | \sa QWidget::font, QApplication::setFont(), palette, style() | - |
| 5478 | */ | - |
| 5479 | QFont QGraphicsScene::font() const | - |
| 5480 | { | - |
| 5481 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 5482 | return d->font; executed: return d->font;Execution Count:208 | 208 |
| 5483 | } | - |
| 5484 | void QGraphicsScene::setFont(const QFont &font) | - |
| 5485 | { | - |
| 5486 | Q_D(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 5487 | QFont naturalFont = QApplication::font(); never executed (the execution status of this line is deduced): QFont naturalFont = QApplication::font(); | - |
| 5488 | naturalFont.resolve(0); never executed (the execution status of this line is deduced): naturalFont.resolve(0); | - |
| 5489 | QFont resolvedFont = font.resolve(naturalFont); never executed (the execution status of this line is deduced): QFont resolvedFont = font.resolve(naturalFont); | - |
| 5490 | d->setFont_helper(resolvedFont); never executed (the execution status of this line is deduced): d->setFont_helper(resolvedFont); | - |
| 5491 | } | 0 |
| 5492 | | - |
| 5493 | /*! | - |
| 5494 | \property QGraphicsScene::palette | - |
| 5495 | \since 4.4 | - |
| 5496 | \brief the scene's default palette | - |
| 5497 | | - |
| 5498 | This property provides the scene's palette. The scene palette defaults to, | - |
| 5499 | and resolves all its entries from, QApplication::palette. | - |
| 5500 | | - |
| 5501 | If the scene's palette changes, either directly through setPalette() or | - |
| 5502 | indirectly when the application palette changes, QGraphicsScene first | - |
| 5503 | sends itself a \l{QEvent::PaletteChange}{PaletteChange} event, and it then | - |
| 5504 | sends \l{QEvent::PaletteChange}{PaletteChange} events to all top-level | - |
| 5505 | widget items in the scene. These items respond by resolving their own | - |
| 5506 | palettes to the scene, and they then notify their children, who again | - |
| 5507 | notify their children, and so on, until all widget items have updated | - |
| 5508 | their palettes. | - |
| 5509 | | - |
| 5510 | Changing the scene palette, (directly or indirectly through | - |
| 5511 | QApplication::setPalette(),) automatically schedules a redraw the entire | - |
| 5512 | scene. | - |
| 5513 | | - |
| 5514 | \sa QWidget::palette, QApplication::setPalette(), font, style() | - |
| 5515 | */ | - |
| 5516 | QPalette QGraphicsScene::palette() const | - |
| 5517 | { | - |
| 5518 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 5519 | return d->palette; executed: return d->palette;Execution Count:206 | 206 |
| 5520 | } | - |
| 5521 | void QGraphicsScene::setPalette(const QPalette &palette) | - |
| 5522 | { | - |
| 5523 | Q_D(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 5524 | QPalette naturalPalette = QApplication::palette(); never executed (the execution status of this line is deduced): QPalette naturalPalette = QApplication::palette(); | - |
| 5525 | naturalPalette.resolve(0); never executed (the execution status of this line is deduced): naturalPalette.resolve(0); | - |
| 5526 | QPalette resolvedPalette = palette.resolve(naturalPalette); never executed (the execution status of this line is deduced): QPalette resolvedPalette = palette.resolve(naturalPalette); | - |
| 5527 | d->setPalette_helper(resolvedPalette); never executed (the execution status of this line is deduced): d->setPalette_helper(resolvedPalette); | - |
| 5528 | } | 0 |
| 5529 | | - |
| 5530 | /*! | - |
| 5531 | \since 4.6 | - |
| 5532 | | - |
| 5533 | Returns true if the scene is active (e.g., it's viewed by | - |
| 5534 | at least one QGraphicsView that is active); otherwise returns false. | - |
| 5535 | | - |
| 5536 | \sa QGraphicsItem::isActive(), QWidget::isActiveWindow() | - |
| 5537 | */ | - |
| 5538 | bool QGraphicsScene::isActive() const | - |
| 5539 | { | - |
| 5540 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 5541 | return d->activationRefCount > 0; executed: return d->activationRefCount > 0;Execution Count:11153 | 11153 |
| 5542 | } | - |
| 5543 | | - |
| 5544 | /*! | - |
| 5545 | \since 4.6 | - |
| 5546 | Returns the current active panel, or 0 if no panel is currently active. | - |
| 5547 | | - |
| 5548 | \sa QGraphicsScene::setActivePanel() | - |
| 5549 | */ | - |
| 5550 | QGraphicsItem *QGraphicsScene::activePanel() const | - |
| 5551 | { | - |
| 5552 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 5553 | return d->activePanel; executed: return d->activePanel;Execution Count:117 | 117 |
| 5554 | } | - |
| 5555 | | - |
| 5556 | /*! | - |
| 5557 | \since 4.6 | - |
| 5558 | Activates \a item, which must be an item in this scene. You | - |
| 5559 | can also pass 0 for \a item, in which case QGraphicsScene will | - |
| 5560 | deactivate any currently active panel. | - |
| 5561 | | - |
| 5562 | If the scene is currently inactive, \a item remains inactive until the | - |
| 5563 | scene becomes active (or, ir \a item is 0, no item will be activated). | - |
| 5564 | | - |
| 5565 | \sa activePanel(), isActive(), QGraphicsItem::isActive() | - |
| 5566 | */ | - |
| 5567 | void QGraphicsScene::setActivePanel(QGraphicsItem *item) | - |
| 5568 | { | - |
| 5569 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 5570 | d->setActivePanelHelper(item, false); executed (the execution status of this line is deduced): d->setActivePanelHelper(item, false); | - |
| 5571 | } executed: }Execution Count:5 | 5 |
| 5572 | | - |
| 5573 | /*! | - |
| 5574 | \since 4.4 | - |
| 5575 | | - |
| 5576 | Returns the current active window, or 0 if no window is currently | - |
| 5577 | active. | - |
| 5578 | | - |
| 5579 | \sa QGraphicsScene::setActiveWindow() | - |
| 5580 | */ | - |
| 5581 | QGraphicsWidget *QGraphicsScene::activeWindow() const | - |
| 5582 | { | - |
| 5583 | Q_D(const QGraphicsScene); executed (the execution status of this line is deduced): const QGraphicsScenePrivate * const d = d_func(); | - |
| 5584 | if (d->activePanel && d->activePanel->isWindow()) partially evaluated: d->activePanel| no Evaluation Count:0 | yes Evaluation Count:115 |
never evaluated: d->activePanel->isWindow() | 0-115 |
| 5585 | return static_cast<QGraphicsWidget *>(d->activePanel); never executed: return static_cast<QGraphicsWidget *>(d->activePanel); | 0 |
| 5586 | return 0; executed: return 0;Execution Count:115 | 115 |
| 5587 | } | - |
| 5588 | | - |
| 5589 | /*! | - |
| 5590 | \since 4.4 | - |
| 5591 | Activates \a widget, which must be a widget in this scene. You can also | - |
| 5592 | pass 0 for \a widget, in which case QGraphicsScene will deactivate any | - |
| 5593 | currently active window. | - |
| 5594 | | - |
| 5595 | \sa activeWindow(), QGraphicsWidget::isActiveWindow() | - |
| 5596 | */ | - |
| 5597 | void QGraphicsScene::setActiveWindow(QGraphicsWidget *widget) | - |
| 5598 | { | - |
| 5599 | if (widget && widget->scene() != this) { never evaluated: widget never evaluated: widget->scene() != this | 0 |
| 5600 | qWarning("QGraphicsScene::setActiveWindow: widget %p must be part of this scene", never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsscene.cpp", 5600, __PRETTY_FUNCTION__).warning("QGraphicsScene::setActiveWindow: widget %p must be part of this scene", | - |
| 5601 | widget); never executed (the execution status of this line is deduced): widget); | - |
| 5602 | return; | 0 |
| 5603 | } | - |
| 5604 | | - |
| 5605 | // Activate the widget's panel (all windows are panels). | - |
| 5606 | QGraphicsItem *panel = widget ? widget->panel() : 0; | 0 |
| 5607 | setActivePanel(panel); never executed (the execution status of this line is deduced): setActivePanel(panel); | - |
| 5608 | | - |
| 5609 | // Raise | - |
| 5610 | if (panel) { | 0 |
| 5611 | QList<QGraphicsItem *> siblingWindows; never executed (the execution status of this line is deduced): QList<QGraphicsItem *> siblingWindows; | - |
| 5612 | QGraphicsItem *parent = panel->parentItem(); never executed (the execution status of this line is deduced): QGraphicsItem *parent = panel->parentItem(); | - |
| 5613 | // Raise ### inefficient for toplevels | - |
| 5614 | foreach (QGraphicsItem *sibling, parent ? parent->childItems() : items()) { never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(parent ? parent->childItems() : items())> _container_(parent ? parent->childItems() : items()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *sibling = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 5615 | if (sibling != panel && sibling->isWindow()) never evaluated: sibling != panel never evaluated: sibling->isWindow() | 0 |
| 5616 | siblingWindows << sibling; never executed: siblingWindows << sibling; | 0 |
| 5617 | } | 0 |
| 5618 | | - |
| 5619 | // Find the highest z value. | - |
| 5620 | qreal z = panel->zValue(); never executed (the execution status of this line is deduced): qreal z = panel->zValue(); | - |
| 5621 | for (int i = 0; i < siblingWindows.size(); ++i) never evaluated: i < siblingWindows.size() | 0 |
| 5622 | z = qMax(z, siblingWindows.at(i)->zValue()); never executed: z = qMax(z, siblingWindows.at(i)->zValue()); | 0 |
| 5623 | | - |
| 5624 | // This will probably never overflow. | - |
| 5625 | const qreal litt = qreal(0.001); never executed (the execution status of this line is deduced): const qreal litt = qreal(0.001); | - |
| 5626 | panel->setZValue(z + litt); never executed (the execution status of this line is deduced): panel->setZValue(z + litt); | - |
| 5627 | } | 0 |
| 5628 | } | 0 |
| 5629 | | - |
| 5630 | /*! | - |
| 5631 | \since 4.6 | - |
| 5632 | | - |
| 5633 | Sends event \a event to item \a item through possible event filters. | - |
| 5634 | | - |
| 5635 | The event is sent only if the item is enabled. | - |
| 5636 | | - |
| 5637 | Returns \c false if the event was filtered or if the item is disabled. | - |
| 5638 | Otherwise returns the value that was returned from the event handler. | - |
| 5639 | | - |
| 5640 | \sa QGraphicsItem::sceneEvent(), QGraphicsItem::sceneEventFilter() | - |
| 5641 | */ | - |
| 5642 | bool QGraphicsScene::sendEvent(QGraphicsItem *item, QEvent *event) | - |
| 5643 | { | - |
| 5644 | Q_D(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScenePrivate * const d = d_func(); | - |
| 5645 | if (!item) { partially evaluated: !item| no Evaluation Count:0 | yes Evaluation Count:634 |
| 0-634 |
| 5646 | qWarning("QGraphicsScene::sendEvent: cannot send event to a null item"); never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsscene.cpp", 5646, __PRETTY_FUNCTION__).warning("QGraphicsScene::sendEvent: cannot send event to a null item"); | - |
| 5647 | return false; never executed: return false; | 0 |
| 5648 | } | - |
| 5649 | if (item->scene() != this) { partially evaluated: item->scene() != this| no Evaluation Count:0 | yes Evaluation Count:634 |
| 0-634 |
| 5650 | qWarning("QGraphicsScene::sendEvent: item %p's scene (%p)" never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsscene.cpp", 5650, __PRETTY_FUNCTION__).warning("QGraphicsScene::sendEvent: item %p's scene (%p)" | - |
| 5651 | " is different from this scene (%p)", never executed (the execution status of this line is deduced): " is different from this scene (%p)", | - |
| 5652 | item, item->scene(), this); never executed (the execution status of this line is deduced): item, item->scene(), this); | - |
| 5653 | return false; never executed: return false; | 0 |
| 5654 | } | - |
| 5655 | return d->sendEvent(item, event); executed: return d->sendEvent(item, event);Execution Count:634 | 634 |
| 5656 | } | - |
| 5657 | | - |
| 5658 | void QGraphicsScenePrivate::addView(QGraphicsView *view) | - |
| 5659 | { | - |
| 5660 | views << view; executed (the execution status of this line is deduced): views << view; | - |
| 5661 | #ifndef QT_NO_GESTURES | - |
| 5662 | foreach (Qt::GestureType gesture, grabbedGestures.keys()) never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(grabbedGestures.keys())> _container_(grabbedGestures.keys()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (Qt::GestureType gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 5663 | view->viewport()->grabGesture(gesture); never executed: view->viewport()->grabGesture(gesture); | 0 |
| 5664 | #endif | - |
| 5665 | } executed: }Execution Count:786 | 786 |
| 5666 | | - |
| 5667 | void QGraphicsScenePrivate::removeView(QGraphicsView *view) | - |
| 5668 | { | - |
| 5669 | views.removeAll(view); executed (the execution status of this line is deduced): views.removeAll(view); | - |
| 5670 | } executed: }Execution Count:22 | 22 |
| 5671 | | - |
| 5672 | void QGraphicsScenePrivate::updateTouchPointsForItem(QGraphicsItem *item, QTouchEvent *touchEvent) | - |
| 5673 | { | - |
| 5674 | QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints(); never executed (the execution status of this line is deduced): QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints(); | - |
| 5675 | for (int i = 0; i < touchPoints.count(); ++i) { never evaluated: i < touchPoints.count() | 0 |
| 5676 | QTouchEvent::TouchPoint &touchPoint = touchPoints[i]; never executed (the execution status of this line is deduced): QTouchEvent::TouchPoint &touchPoint = touchPoints[i]; | - |
| 5677 | touchPoint.setRect(item->mapFromScene(touchPoint.sceneRect()).boundingRect()); never executed (the execution status of this line is deduced): touchPoint.setRect(item->mapFromScene(touchPoint.sceneRect()).boundingRect()); | - |
| 5678 | touchPoint.setStartPos(item->d_ptr->genericMapFromScene(touchPoint.startScenePos(), static_cast<QWidget *>(touchEvent->target()))); never executed (the execution status of this line is deduced): touchPoint.setStartPos(item->d_ptr->genericMapFromScene(touchPoint.startScenePos(), static_cast<QWidget *>(touchEvent->target()))); | - |
| 5679 | touchPoint.setLastPos(item->d_ptr->genericMapFromScene(touchPoint.lastScenePos(), static_cast<QWidget *>(touchEvent->target()))); never executed (the execution status of this line is deduced): touchPoint.setLastPos(item->d_ptr->genericMapFromScene(touchPoint.lastScenePos(), static_cast<QWidget *>(touchEvent->target()))); | - |
| 5680 | } | 0 |
| 5681 | touchEvent->setTouchPoints(touchPoints); never executed (the execution status of this line is deduced): touchEvent->setTouchPoints(touchPoints); | - |
| 5682 | } | 0 |
| 5683 | | - |
| 5684 | int QGraphicsScenePrivate::findClosestTouchPointId(const QPointF &scenePos) | - |
| 5685 | { | - |
| 5686 | int closestTouchPointId = -1; never executed (the execution status of this line is deduced): int closestTouchPointId = -1; | - |
| 5687 | qreal closestDistance = qreal(0.); never executed (the execution status of this line is deduced): qreal closestDistance = qreal(0.); | - |
| 5688 | foreach (const QTouchEvent::TouchPoint &touchPoint, sceneCurrentTouchPoints) { never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(sceneCurrentTouchPoints)> _container_(sceneCurrentTouchPoints); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QTouchEvent::TouchPoint &touchPoint = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 5689 | qreal distance = QLineF(scenePos, touchPoint.scenePos()).length(); never executed (the execution status of this line is deduced): qreal distance = QLineF(scenePos, touchPoint.scenePos()).length(); | - |
| 5690 | if (closestTouchPointId == -1|| distance < closestDistance) { never evaluated: closestTouchPointId == -1 never evaluated: distance < closestDistance | 0 |
| 5691 | closestTouchPointId = touchPoint.id(); never executed (the execution status of this line is deduced): closestTouchPointId = touchPoint.id(); | - |
| 5692 | closestDistance = distance; never executed (the execution status of this line is deduced): closestDistance = distance; | - |
| 5693 | } | 0 |
| 5694 | } | 0 |
| 5695 | return closestTouchPointId; never executed: return closestTouchPointId; | 0 |
| 5696 | } | - |
| 5697 | | - |
| 5698 | void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent) | - |
| 5699 | { | - |
| 5700 | typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints; never executed (the execution status of this line is deduced): typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints; | - |
| 5701 | QHash<QGraphicsItem *, StatesAndTouchPoints> itemsNeedingEvents; never executed (the execution status of this line is deduced): QHash<QGraphicsItem *, StatesAndTouchPoints> itemsNeedingEvents; | - |
| 5702 | | - |
| 5703 | for (int i = 0; i < sceneTouchEvent->touchPoints().count(); ++i) { never evaluated: i < sceneTouchEvent->touchPoints().count() | 0 |
| 5704 | const QTouchEvent::TouchPoint &touchPoint = sceneTouchEvent->touchPoints().at(i); never executed (the execution status of this line is deduced): const QTouchEvent::TouchPoint &touchPoint = sceneTouchEvent->touchPoints().at(i); | - |
| 5705 | | - |
| 5706 | // update state | - |
| 5707 | QGraphicsItem *item = 0; never executed (the execution status of this line is deduced): QGraphicsItem *item = 0; | - |
| 5708 | if (touchPoint.state() == Qt::TouchPointPressed) { never evaluated: touchPoint.state() == Qt::TouchPointPressed | 0 |
| 5709 | if (sceneTouchEvent->device()->type() == QTouchDevice::TouchPad) { never evaluated: sceneTouchEvent->device()->type() == QTouchDevice::TouchPad | 0 |
| 5710 | // on touch-pad devices, send all touch points to the same item | - |
| 5711 | item = itemForTouchPointId.isEmpty() never evaluated: itemForTouchPointId.isEmpty() | 0 |
| 5712 | ? 0 never executed (the execution status of this line is deduced): ? 0 | - |
| 5713 | : itemForTouchPointId.constBegin().value(); never executed (the execution status of this line is deduced): : itemForTouchPointId.constBegin().value(); | - |
| 5714 | } | 0 |
| 5715 | | - |
| 5716 | if (!item) { | 0 |
| 5717 | // determine which item this touch point will go to | - |
| 5718 | cachedItemsUnderMouse = itemsAtPosition(touchPoint.screenPos().toPoint(), never executed (the execution status of this line is deduced): cachedItemsUnderMouse = itemsAtPosition(touchPoint.screenPos().toPoint(), | - |
| 5719 | touchPoint.scenePos(), never executed (the execution status of this line is deduced): touchPoint.scenePos(), | - |
| 5720 | static_cast<QWidget *>(sceneTouchEvent->target())); never executed (the execution status of this line is deduced): static_cast<QWidget *>(sceneTouchEvent->target())); | - |
| 5721 | item = cachedItemsUnderMouse.isEmpty() ? 0 : cachedItemsUnderMouse.first(); never evaluated: cachedItemsUnderMouse.isEmpty() | 0 |
| 5722 | } | 0 |
| 5723 | | - |
| 5724 | if (sceneTouchEvent->device()->type() == QTouchDevice::TouchScreen) { never evaluated: sceneTouchEvent->device()->type() == QTouchDevice::TouchScreen | 0 |
| 5725 | // on touch-screens, combine this touch point with the closest one we find | - |
| 5726 | int closestTouchPointId = findClosestTouchPointId(touchPoint.scenePos()); never executed (the execution status of this line is deduced): int closestTouchPointId = findClosestTouchPointId(touchPoint.scenePos()); | - |
| 5727 | QGraphicsItem *closestItem = itemForTouchPointId.value(closestTouchPointId); never executed (the execution status of this line is deduced): QGraphicsItem *closestItem = itemForTouchPointId.value(closestTouchPointId); | - |
| 5728 | if (!item || (closestItem && cachedItemsUnderMouse.contains(closestItem))) never evaluated: !item never evaluated: closestItem never evaluated: cachedItemsUnderMouse.contains(closestItem) | 0 |
| 5729 | item = closestItem; never executed: item = closestItem; | 0 |
| 5730 | } | 0 |
| 5731 | if (!item) | 0 |
| 5732 | continue; never executed: continue; | 0 |
| 5733 | | - |
| 5734 | itemForTouchPointId.insert(touchPoint.id(), item); never executed (the execution status of this line is deduced): itemForTouchPointId.insert(touchPoint.id(), item); | - |
| 5735 | sceneCurrentTouchPoints.insert(touchPoint.id(), touchPoint); never executed (the execution status of this line is deduced): sceneCurrentTouchPoints.insert(touchPoint.id(), touchPoint); | - |
| 5736 | } else if (touchPoint.state() == Qt::TouchPointReleased) { never executed: } never evaluated: touchPoint.state() == Qt::TouchPointReleased | 0 |
| 5737 | item = itemForTouchPointId.take(touchPoint.id()); never executed (the execution status of this line is deduced): item = itemForTouchPointId.take(touchPoint.id()); | - |
| 5738 | if (!item) | 0 |
| 5739 | continue; never executed: continue; | 0 |
| 5740 | | - |
| 5741 | sceneCurrentTouchPoints.remove(touchPoint.id()); never executed (the execution status of this line is deduced): sceneCurrentTouchPoints.remove(touchPoint.id()); | - |
| 5742 | } else { | 0 |
| 5743 | item = itemForTouchPointId.value(touchPoint.id()); never executed (the execution status of this line is deduced): item = itemForTouchPointId.value(touchPoint.id()); | - |
| 5744 | if (!item) | 0 |
| 5745 | continue; never executed: continue; | 0 |
| 5746 | Q_ASSERT(sceneCurrentTouchPoints.contains(touchPoint.id())); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 5747 | sceneCurrentTouchPoints[touchPoint.id()] = touchPoint; never executed (the execution status of this line is deduced): sceneCurrentTouchPoints[touchPoint.id()] = touchPoint; | - |
| 5748 | } | 0 |
| 5749 | | - |
| 5750 | StatesAndTouchPoints &statesAndTouchPoints = itemsNeedingEvents[item]; never executed (the execution status of this line is deduced): StatesAndTouchPoints &statesAndTouchPoints = itemsNeedingEvents[item]; | - |
| 5751 | statesAndTouchPoints.first |= touchPoint.state(); never executed (the execution status of this line is deduced): statesAndTouchPoints.first |= touchPoint.state(); | - |
| 5752 | statesAndTouchPoints.second.append(touchPoint); never executed (the execution status of this line is deduced): statesAndTouchPoints.second.append(touchPoint); | - |
| 5753 | } | 0 |
| 5754 | | - |
| 5755 | if (itemsNeedingEvents.isEmpty()) { never evaluated: itemsNeedingEvents.isEmpty() | 0 |
| 5756 | sceneTouchEvent->accept(); never executed (the execution status of this line is deduced): sceneTouchEvent->accept(); | - |
| 5757 | return; | 0 |
| 5758 | } | - |
| 5759 | | - |
| 5760 | bool ignoreSceneTouchEvent = true; never executed (the execution status of this line is deduced): bool ignoreSceneTouchEvent = true; | - |
| 5761 | QHash<QGraphicsItem *, StatesAndTouchPoints>::ConstIterator it = itemsNeedingEvents.constBegin(); never executed (the execution status of this line is deduced): QHash<QGraphicsItem *, StatesAndTouchPoints>::ConstIterator it = itemsNeedingEvents.constBegin(); | - |
| 5762 | const QHash<QGraphicsItem *, StatesAndTouchPoints>::ConstIterator end = itemsNeedingEvents.constEnd(); never executed (the execution status of this line is deduced): const QHash<QGraphicsItem *, StatesAndTouchPoints>::ConstIterator end = itemsNeedingEvents.constEnd(); | - |
| 5763 | for (; it != end; ++it) { never evaluated: it != end | 0 |
| 5764 | QGraphicsItem *item = it.key(); never executed (the execution status of this line is deduced): QGraphicsItem *item = it.key(); | - |
| 5765 | | - |
| 5766 | (void) item->isBlockedByModalPanel(&item); never executed (the execution status of this line is deduced): (void) item->isBlockedByModalPanel(&item); | - |
| 5767 | | - |
| 5768 | // determine event type from the state mask | - |
| 5769 | QEvent::Type eventType; never executed (the execution status of this line is deduced): QEvent::Type eventType; | - |
| 5770 | switch (it.value().first) { | - |
| 5771 | case Qt::TouchPointPressed: | - |
| 5772 | // all touch points have pressed state | - |
| 5773 | eventType = QEvent::TouchBegin; never executed (the execution status of this line is deduced): eventType = QEvent::TouchBegin; | - |
| 5774 | break; | 0 |
| 5775 | case Qt::TouchPointReleased: | - |
| 5776 | // all touch points have released state | - |
| 5777 | eventType = QEvent::TouchEnd; never executed (the execution status of this line is deduced): eventType = QEvent::TouchEnd; | - |
| 5778 | break; | 0 |
| 5779 | case Qt::TouchPointStationary: | - |
| 5780 | // don't send the event if nothing changed | - |
| 5781 | continue; never executed: continue; | 0 |
| 5782 | default: | - |
| 5783 | // all other combinations | - |
| 5784 | eventType = QEvent::TouchUpdate; never executed (the execution status of this line is deduced): eventType = QEvent::TouchUpdate; | - |
| 5785 | break; | 0 |
| 5786 | } | - |
| 5787 | | - |
| 5788 | QTouchEvent touchEvent(eventType); never executed (the execution status of this line is deduced): QTouchEvent touchEvent(eventType); | - |
| 5789 | touchEvent.setWindow(sceneTouchEvent->window()); never executed (the execution status of this line is deduced): touchEvent.setWindow(sceneTouchEvent->window()); | - |
| 5790 | touchEvent.setTarget(sceneTouchEvent->target()); never executed (the execution status of this line is deduced): touchEvent.setTarget(sceneTouchEvent->target()); | - |
| 5791 | touchEvent.setDevice(sceneTouchEvent->device()); never executed (the execution status of this line is deduced): touchEvent.setDevice(sceneTouchEvent->device()); | - |
| 5792 | touchEvent.setModifiers(sceneTouchEvent->modifiers()); never executed (the execution status of this line is deduced): touchEvent.setModifiers(sceneTouchEvent->modifiers()); | - |
| 5793 | touchEvent.setTouchPointStates(it.value().first); never executed (the execution status of this line is deduced): touchEvent.setTouchPointStates(it.value().first); | - |
| 5794 | touchEvent.setTouchPoints(it.value().second); never executed (the execution status of this line is deduced): touchEvent.setTouchPoints(it.value().second); | - |
| 5795 | touchEvent.setTimestamp(sceneTouchEvent->timestamp()); never executed (the execution status of this line is deduced): touchEvent.setTimestamp(sceneTouchEvent->timestamp()); | - |
| 5796 | | - |
| 5797 | switch (touchEvent.type()) { | - |
| 5798 | case QEvent::TouchBegin: | - |
| 5799 | { | - |
| 5800 | // if the TouchBegin handler recurses, we assume that means the event | - |
| 5801 | // has been implicitly accepted and continue to send touch events | - |
| 5802 | item->d_ptr->acceptedTouchBeginEvent = true; never executed (the execution status of this line is deduced): item->d_ptr->acceptedTouchBeginEvent = true; | - |
| 5803 | bool res = sendTouchBeginEvent(item, &touchEvent) never evaluated: sendTouchBeginEvent(item, &touchEvent) | 0 |
| 5804 | && touchEvent.isAccepted(); never evaluated: touchEvent.isAccepted() | 0 |
| 5805 | if (!res) { | 0 |
| 5806 | // forget about these touch points, we didn't handle them | - |
| 5807 | for (int i = 0; i < touchEvent.touchPoints().count(); ++i) { never evaluated: i < touchEvent.touchPoints().count() | 0 |
| 5808 | const QTouchEvent::TouchPoint &touchPoint = touchEvent.touchPoints().at(i); never executed (the execution status of this line is deduced): const QTouchEvent::TouchPoint &touchPoint = touchEvent.touchPoints().at(i); | - |
| 5809 | itemForTouchPointId.remove(touchPoint.id()); never executed (the execution status of this line is deduced): itemForTouchPointId.remove(touchPoint.id()); | - |
| 5810 | sceneCurrentTouchPoints.remove(touchPoint.id()); never executed (the execution status of this line is deduced): sceneCurrentTouchPoints.remove(touchPoint.id()); | - |
| 5811 | } | 0 |
| 5812 | ignoreSceneTouchEvent = false; never executed (the execution status of this line is deduced): ignoreSceneTouchEvent = false; | - |
| 5813 | } | 0 |
| 5814 | break; | 0 |
| 5815 | } | - |
| 5816 | default: | - |
| 5817 | if (item->d_ptr->acceptedTouchBeginEvent) { never evaluated: item->d_ptr->acceptedTouchBeginEvent | 0 |
| 5818 | updateTouchPointsForItem(item, &touchEvent); never executed (the execution status of this line is deduced): updateTouchPointsForItem(item, &touchEvent); | - |
| 5819 | (void) sendEvent(item, &touchEvent); never executed (the execution status of this line is deduced): (void) sendEvent(item, &touchEvent); | - |
| 5820 | ignoreSceneTouchEvent = false; never executed (the execution status of this line is deduced): ignoreSceneTouchEvent = false; | - |
| 5821 | } | 0 |
| 5822 | break; | 0 |
| 5823 | } | - |
| 5824 | } | 0 |
| 5825 | sceneTouchEvent->setAccepted(ignoreSceneTouchEvent); never executed (the execution status of this line is deduced): sceneTouchEvent->setAccepted(ignoreSceneTouchEvent); | - |
| 5826 | } | 0 |
| 5827 | | - |
| 5828 | bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEvent *touchEvent) | - |
| 5829 | { | - |
| 5830 | Q_Q(QGraphicsScene); never executed (the execution status of this line is deduced): QGraphicsScene * const q = q_func(); | - |
| 5831 | | - |
| 5832 | if (cachedItemsUnderMouse.isEmpty() || cachedItemsUnderMouse.first() != origin) { never evaluated: cachedItemsUnderMouse.isEmpty() never evaluated: cachedItemsUnderMouse.first() != origin | 0 |
| 5833 | const QTouchEvent::TouchPoint &firstTouchPoint = touchEvent->touchPoints().first(); never executed (the execution status of this line is deduced): const QTouchEvent::TouchPoint &firstTouchPoint = touchEvent->touchPoints().first(); | - |
| 5834 | cachedItemsUnderMouse = itemsAtPosition(firstTouchPoint.screenPos().toPoint(), never executed (the execution status of this line is deduced): cachedItemsUnderMouse = itemsAtPosition(firstTouchPoint.screenPos().toPoint(), | - |
| 5835 | firstTouchPoint.scenePos(), never executed (the execution status of this line is deduced): firstTouchPoint.scenePos(), | - |
| 5836 | static_cast<QWidget *>(touchEvent->target())); never executed (the execution status of this line is deduced): static_cast<QWidget *>(touchEvent->target())); | - |
| 5837 | } | 0 |
| 5838 | | - |
| 5839 | // Set focus on the topmost enabled item that can take focus. | - |
| 5840 | bool setFocus = false; never executed (the execution status of this line is deduced): bool setFocus = false; | - |
| 5841 | | - |
| 5842 | foreach (QGraphicsItem *item, cachedItemsUnderMouse) { never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(cachedItemsUnderMouse)> _container_(cachedItemsUnderMouse); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 5843 | if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable) && item->d_ptr->mouseSetsFocus)) { never evaluated: item->isEnabled() never evaluated: (item->flags() & QGraphicsItem::ItemIsFocusable) never evaluated: item->d_ptr->mouseSetsFocus | 0 |
| 5844 | if (!item->isWidget() || ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus) { never evaluated: !item->isWidget() never evaluated: ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus | 0 |
| 5845 | setFocus = true; never executed (the execution status of this line is deduced): setFocus = true; | - |
| 5846 | if (item != q->focusItem()) never evaluated: item != q->focusItem() | 0 |
| 5847 | q->setFocusItem(item, Qt::MouseFocusReason); never executed: q->setFocusItem(item, Qt::MouseFocusReason); | 0 |
| 5848 | break; | 0 |
| 5849 | } | - |
| 5850 | } | 0 |
| 5851 | if (item->isPanel()) never evaluated: item->isPanel() | 0 |
| 5852 | break; | 0 |
| 5853 | if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation) never evaluated: item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation | 0 |
| 5854 | break; | 0 |
| 5855 | if (item->d_ptr->flags & QGraphicsItem::ItemStopsFocusHandling) { never evaluated: item->d_ptr->flags & QGraphicsItem::ItemStopsFocusHandling | 0 |
| 5856 | // Make sure we don't clear focus. | - |
| 5857 | setFocus = true; never executed (the execution status of this line is deduced): setFocus = true; | - |
| 5858 | break; | 0 |
| 5859 | } | - |
| 5860 | } | 0 |
| 5861 | | - |
| 5862 | // If nobody could take focus, clear it. | - |
| 5863 | if (!stickyFocus && !setFocus) never evaluated: !stickyFocus never evaluated: !setFocus | 0 |
| 5864 | q->setFocusItem(0, Qt::MouseFocusReason); never executed: q->setFocusItem(0, Qt::MouseFocusReason); | 0 |
| 5865 | | - |
| 5866 | bool res = false; never executed (the execution status of this line is deduced): bool res = false; | - |
| 5867 | bool eventAccepted = touchEvent->isAccepted(); never executed (the execution status of this line is deduced): bool eventAccepted = touchEvent->isAccepted(); | - |
| 5868 | foreach (QGraphicsItem *item, cachedItemsUnderMouse) { never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(cachedItemsUnderMouse)> _container_(cachedItemsUnderMouse); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 5869 | // first, try to deliver the touch event | - |
| 5870 | updateTouchPointsForItem(item, touchEvent); never executed (the execution status of this line is deduced): updateTouchPointsForItem(item, touchEvent); | - |
| 5871 | bool acceptTouchEvents = item->acceptTouchEvents(); never executed (the execution status of this line is deduced): bool acceptTouchEvents = item->acceptTouchEvents(); | - |
| 5872 | touchEvent->setAccepted(acceptTouchEvents); never executed (the execution status of this line is deduced): touchEvent->setAccepted(acceptTouchEvents); | - |
| 5873 | res = acceptTouchEvents && sendEvent(item, touchEvent); never evaluated: acceptTouchEvents never evaluated: sendEvent(item, touchEvent) | 0 |
| 5874 | eventAccepted = touchEvent->isAccepted(); never executed (the execution status of this line is deduced): eventAccepted = touchEvent->isAccepted(); | - |
| 5875 | if (itemForTouchPointId.value(touchEvent->touchPoints().first().id()) == 0) { never evaluated: itemForTouchPointId.value(touchEvent->touchPoints().first().id()) == 0 | 0 |
| 5876 | // item was deleted | - |
| 5877 | item = 0; never executed (the execution status of this line is deduced): item = 0; | - |
| 5878 | } else { | 0 |
| 5879 | item->d_ptr->acceptedTouchBeginEvent = (res && eventAccepted); never evaluated: res never evaluated: eventAccepted | 0 |
| 5880 | } | 0 |
| 5881 | touchEvent->spont = false; never executed (the execution status of this line is deduced): touchEvent->spont = false; | - |
| 5882 | if (res && eventAccepted) { never evaluated: res never evaluated: eventAccepted | 0 |
| 5883 | // the first item to accept the TouchBegin gets an implicit grab. | - |
| 5884 | for (int i = 0; i < touchEvent->touchPoints().count(); ++i) { never evaluated: i < touchEvent->touchPoints().count() | 0 |
| 5885 | const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().at(i); never executed (the execution status of this line is deduced): const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().at(i); | - |
| 5886 | itemForTouchPointId[touchPoint.id()] = item; // can be zero never executed (the execution status of this line is deduced): itemForTouchPointId[touchPoint.id()] = item; | - |
| 5887 | } | 0 |
| 5888 | break; | 0 |
| 5889 | } | - |
| 5890 | if (item && item->isPanel()) never evaluated: item never evaluated: item->isPanel() | 0 |
| 5891 | break; | 0 |
| 5892 | } | 0 |
| 5893 | | - |
| 5894 | touchEvent->setAccepted(eventAccepted); never executed (the execution status of this line is deduced): touchEvent->setAccepted(eventAccepted); | - |
| 5895 | return res; never executed: return res; | 0 |
| 5896 | } | - |
| 5897 | | - |
| 5898 | void QGraphicsScenePrivate::enableTouchEventsOnViews() | - |
| 5899 | { | - |
| 5900 | foreach (QGraphicsView *view, views) never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(views)> _container_(views); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 5901 | view->viewport()->setAttribute(Qt::WA_AcceptTouchEvents, true); never executed: view->viewport()->setAttribute(Qt::WA_AcceptTouchEvents, true); | 0 |
| 5902 | } | 0 |
| 5903 | | - |
| 5904 | void QGraphicsScenePrivate::updateInputMethodSensitivityInViews() | - |
| 5905 | { | - |
| 5906 | for (int i = 0; i < views.size(); ++i) evaluated: i < views.size()| yes Evaluation Count:1389 | yes Evaluation Count:1764 |
| 1389-1764 |
| 5907 | views.at(i)->d_func()->updateInputMethodSensitivity(); executed: views.at(i)->d_func()->updateInputMethodSensitivity();Execution Count:1389 | 1389 |
| 5908 | } executed: }Execution Count:1764 | 1764 |
| 5909 | | - |
| 5910 | void QGraphicsScenePrivate::enterModal(QGraphicsItem *panel, QGraphicsItem::PanelModality previousModality) | - |
| 5911 | { | - |
| 5912 | Q_Q(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScene * const q = q_func(); | - |
| 5913 | Q_ASSERT(panel && panel->isPanel()); executed (the execution status of this line is deduced): qt_noop(); | - |
| 5914 | | - |
| 5915 | QGraphicsItem::PanelModality panelModality = panel->d_ptr->panelModality; executed (the execution status of this line is deduced): QGraphicsItem::PanelModality panelModality = panel->d_ptr->panelModality; | - |
| 5916 | if (previousModality != QGraphicsItem::NonModal) { evaluated: previousModality != QGraphicsItem::NonModal| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
| 5917 | // the panel is changing from one modality type to another... temporarily set it back so | - |
| 5918 | // that blockedPanels is populated correctly | - |
| 5919 | panel->d_ptr->panelModality = previousModality; executed (the execution status of this line is deduced): panel->d_ptr->panelModality = previousModality; | - |
| 5920 | } executed: }Execution Count:1 | 1 |
| 5921 | | - |
| 5922 | QSet<QGraphicsItem *> blockedPanels; executed (the execution status of this line is deduced): QSet<QGraphicsItem *> blockedPanels; | - |
| 5923 | QList<QGraphicsItem *> items = q->items(); // ### store panels separately executed (the execution status of this line is deduced): QList<QGraphicsItem *> items = q->items(); | - |
| 5924 | for (int i = 0; i < items.count(); ++i) { evaluated: i < items.count()| yes Evaluation Count:10 | yes Evaluation Count:3 |
| 3-10 |
| 5925 | QGraphicsItem *item = items.at(i); executed (the execution status of this line is deduced): QGraphicsItem *item = items.at(i); | - |
| 5926 | if (item->isPanel() && item->isBlockedByModalPanel()) evaluated: item->isPanel()| yes Evaluation Count:3 | yes Evaluation Count:7 |
partially evaluated: item->isBlockedByModalPanel()| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-7 |
| 5927 | blockedPanels.insert(item); never executed: blockedPanels.insert(item); | 0 |
| 5928 | } executed: }Execution Count:10 | 10 |
| 5929 | // blockedPanels contains all currently blocked panels | - |
| 5930 | | - |
| 5931 | if (previousModality != QGraphicsItem::NonModal) { evaluated: previousModality != QGraphicsItem::NonModal| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
| 5932 | // reset the modality to the proper value, since we changed it above | - |
| 5933 | panel->d_ptr->panelModality = panelModality; executed (the execution status of this line is deduced): panel->d_ptr->panelModality = panelModality; | - |
| 5934 | // remove this panel so that it will be reinserted at the front of the stack | - |
| 5935 | modalPanels.removeAll(panel); executed (the execution status of this line is deduced): modalPanels.removeAll(panel); | - |
| 5936 | } executed: }Execution Count:1 | 1 |
| 5937 | | - |
| 5938 | modalPanels.prepend(panel); executed (the execution status of this line is deduced): modalPanels.prepend(panel); | - |
| 5939 | | - |
| 5940 | if (!hoverItems.isEmpty()) { partially evaluated: !hoverItems.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 5941 | // send GraphicsSceneHoverLeave events to newly blocked hoverItems | - |
| 5942 | QGraphicsSceneHoverEvent hoverEvent; never executed (the execution status of this line is deduced): QGraphicsSceneHoverEvent hoverEvent; | - |
| 5943 | hoverEvent.setScenePos(lastSceneMousePos); never executed (the execution status of this line is deduced): hoverEvent.setScenePos(lastSceneMousePos); | - |
| 5944 | dispatchHoverEvent(&hoverEvent); never executed (the execution status of this line is deduced): dispatchHoverEvent(&hoverEvent); | - |
| 5945 | } | 0 |
| 5946 | | - |
| 5947 | if (!mouseGrabberItems.isEmpty() && lastMouseGrabberItemHasImplicitMouseGrab) { partially evaluated: !mouseGrabberItems.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:3 |
never evaluated: lastMouseGrabberItemHasImplicitMouseGrab | 0-3 |
| 5948 | QGraphicsItem *item = mouseGrabberItems.last(); never executed (the execution status of this line is deduced): QGraphicsItem *item = mouseGrabberItems.last(); | - |
| 5949 | if (item->isBlockedByModalPanel()) never evaluated: item->isBlockedByModalPanel() | 0 |
| 5950 | ungrabMouse(item, /*itemIsDying =*/ false); never executed: ungrabMouse(item, false); | 0 |
| 5951 | } | 0 |
| 5952 | | - |
| 5953 | QEvent windowBlockedEvent(QEvent::WindowBlocked); executed (the execution status of this line is deduced): QEvent windowBlockedEvent(QEvent::WindowBlocked); | - |
| 5954 | QEvent windowUnblockedEvent(QEvent::WindowUnblocked); executed (the execution status of this line is deduced): QEvent windowUnblockedEvent(QEvent::WindowUnblocked); | - |
| 5955 | for (int i = 0; i < items.count(); ++i) { evaluated: i < items.count()| yes Evaluation Count:10 | yes Evaluation Count:3 |
| 3-10 |
| 5956 | QGraphicsItem *item = items.at(i); executed (the execution status of this line is deduced): QGraphicsItem *item = items.at(i); | - |
| 5957 | if (item->isPanel()) { evaluated: item->isPanel()| yes Evaluation Count:3 | yes Evaluation Count:7 |
| 3-7 |
| 5958 | if (!blockedPanels.contains(item) && item->isBlockedByModalPanel()) { partially evaluated: !blockedPanels.contains(item)| yes Evaluation Count:3 | no Evaluation Count:0 |
partially evaluated: item->isBlockedByModalPanel()| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 5959 | // send QEvent::WindowBlocked to newly blocked panels | - |
| 5960 | sendEvent(item, &windowBlockedEvent); never executed (the execution status of this line is deduced): sendEvent(item, &windowBlockedEvent); | - |
| 5961 | } else if (blockedPanels.contains(item) && !item->isBlockedByModalPanel()) { never executed: } partially evaluated: blockedPanels.contains(item)| no Evaluation Count:0 | yes Evaluation Count:3 |
never evaluated: !item->isBlockedByModalPanel() | 0-3 |
| 5962 | // send QEvent::WindowUnblocked to unblocked panels when downgrading | - |
| 5963 | // a panel from SceneModal to PanelModal | - |
| 5964 | sendEvent(item, &windowUnblockedEvent); never executed (the execution status of this line is deduced): sendEvent(item, &windowUnblockedEvent); | - |
| 5965 | } | 0 |
| 5966 | } | - |
| 5967 | } executed: }Execution Count:10 | 10 |
| 5968 | } executed: }Execution Count:3 | 3 |
| 5969 | | - |
| 5970 | void QGraphicsScenePrivate::leaveModal(QGraphicsItem *panel) | - |
| 5971 | { | - |
| 5972 | Q_Q(QGraphicsScene); executed (the execution status of this line is deduced): QGraphicsScene * const q = q_func(); | - |
| 5973 | Q_ASSERT(panel && panel->isPanel()); executed (the execution status of this line is deduced): qt_noop(); | - |
| 5974 | | - |
| 5975 | QSet<QGraphicsItem *> blockedPanels; executed (the execution status of this line is deduced): QSet<QGraphicsItem *> blockedPanels; | - |
| 5976 | QList<QGraphicsItem *> items = q->items(); // ### same as above executed (the execution status of this line is deduced): QList<QGraphicsItem *> items = q->items(); | - |
| 5977 | for (int i = 0; i < items.count(); ++i) { partially evaluated: i < items.count()| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 5978 | QGraphicsItem *item = items.at(i); never executed (the execution status of this line is deduced): QGraphicsItem *item = items.at(i); | - |
| 5979 | if (item->isPanel() && item->isBlockedByModalPanel()) never evaluated: item->isPanel() never evaluated: item->isBlockedByModalPanel() | 0 |
| 5980 | blockedPanels.insert(item); never executed: blockedPanels.insert(item); | 0 |
| 5981 | } | 0 |
| 5982 | | - |
| 5983 | modalPanels.removeAll(panel); executed (the execution status of this line is deduced): modalPanels.removeAll(panel); | - |
| 5984 | | - |
| 5985 | QEvent e(QEvent::WindowUnblocked); executed (the execution status of this line is deduced): QEvent e(QEvent::WindowUnblocked); | - |
| 5986 | for (int i = 0; i < items.count(); ++i) { partially evaluated: i < items.count()| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 5987 | QGraphicsItem *item = items.at(i); never executed (the execution status of this line is deduced): QGraphicsItem *item = items.at(i); | - |
| 5988 | if (item->isPanel() && blockedPanels.contains(item) && !item->isBlockedByModalPanel()) never evaluated: item->isPanel() never evaluated: blockedPanels.contains(item) never evaluated: !item->isBlockedByModalPanel() | 0 |
| 5989 | sendEvent(item, &e); never executed: sendEvent(item, &e); | 0 |
| 5990 | } | 0 |
| 5991 | | - |
| 5992 | // send GraphicsSceneHoverEnter events to newly unblocked items | - |
| 5993 | QGraphicsSceneHoverEvent hoverEvent; executed (the execution status of this line is deduced): QGraphicsSceneHoverEvent hoverEvent; | - |
| 5994 | hoverEvent.setScenePos(lastSceneMousePos); executed (the execution status of this line is deduced): hoverEvent.setScenePos(lastSceneMousePos); | - |
| 5995 | dispatchHoverEvent(&hoverEvent); executed (the execution status of this line is deduced): dispatchHoverEvent(&hoverEvent); | - |
| 5996 | } executed: }Execution Count:2 | 2 |
| 5997 | | - |
| 5998 | #ifndef QT_NO_GESTURES | - |
| 5999 | void QGraphicsScenePrivate::gestureTargetsAtHotSpots(const QSet<QGesture *> &gestures, | - |
| 6000 | Qt::GestureFlag flag, | - |
| 6001 | QHash<QGraphicsObject *, QSet<QGesture *> > *targets, | - |
| 6002 | QSet<QGraphicsObject *> *itemsSet, | - |
| 6003 | QSet<QGesture *> *normal, | - |
| 6004 | QSet<QGesture *> *conflicts) | - |
| 6005 | { | - |
| 6006 | QSet<QGesture *> normalGestures; // that are not in conflicted state. executed (the execution status of this line is deduced): QSet<QGesture *> normalGestures; | - |
| 6007 | foreach (QGesture *gesture, gestures) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(gestures)> _container_(gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 6008 | if (!gesture->hasHotSpot()) partially evaluated: !gesture->hasHotSpot()| no Evaluation Count:0 | yes Evaluation Count:67 |
| 0-67 |
| 6009 | continue; never executed: continue; | 0 |
| 6010 | const Qt::GestureType gestureType = gesture->gestureType(); executed (the execution status of this line is deduced): const Qt::GestureType gestureType = gesture->gestureType(); | - |
| 6011 | QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), gesture->d_func()->sceneHotSpot, 0); executed (the execution status of this line is deduced): QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), gesture->d_func()->sceneHotSpot, 0); | - |
| 6012 | for (int j = 0; j < items.size(); ++j) { evaluated: j < items.size()| yes Evaluation Count:142 | yes Evaluation Count:63 |
| 63-142 |
| 6013 | QGraphicsItem *item = items.at(j); executed (the execution status of this line is deduced): QGraphicsItem *item = items.at(j); | - |
| 6014 | | - |
| 6015 | // Check if the item is blocked by a modal panel and use it as | - |
| 6016 | // a target instead of this item. | - |
| 6017 | (void) item->isBlockedByModalPanel(&item); executed (the execution status of this line is deduced): (void) item->isBlockedByModalPanel(&item); | - |
| 6018 | | - |
| 6019 | if (QGraphicsObject *itemobj = item->toGraphicsObject()) { partially evaluated: QGraphicsObject *itemobj = item->toGraphicsObject()| yes Evaluation Count:142 | no Evaluation Count:0 |
| 0-142 |
| 6020 | QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); executed (the execution status of this line is deduced): QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); | - |
| 6021 | QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it = executed (the execution status of this line is deduced): QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it = | - |
| 6022 | d->gestureContext.constFind(gestureType); executed (the execution status of this line is deduced): d->gestureContext.constFind(gestureType); | - |
| 6023 | if (it != d->gestureContext.constEnd() && (!flag || (it.value() & flag))) { evaluated: it != d->gestureContext.constEnd()| yes Evaluation Count:117 | yes Evaluation Count:25 |
evaluated: !flag| yes Evaluation Count:67 | yes Evaluation Count:50 |
evaluated: (it.value() & flag)| yes Evaluation Count:8 | yes Evaluation Count:42 |
| 8-117 |
| 6024 | if (normalGestures.contains(gesture)) { evaluated: normalGestures.contains(gesture)| yes Evaluation Count:26 | yes Evaluation Count:49 |
| 26-49 |
| 6025 | normalGestures.remove(gesture); executed (the execution status of this line is deduced): normalGestures.remove(gesture); | - |
| 6026 | if (conflicts) evaluated: conflicts| yes Evaluation Count:24 | yes Evaluation Count:2 |
| 2-24 |
| 6027 | conflicts->insert(gesture); executed: conflicts->insert(gesture);Execution Count:24 | 24 |
| 6028 | } else { executed: }Execution Count:26 | 26 |
| 6029 | normalGestures.insert(gesture); executed (the execution status of this line is deduced): normalGestures.insert(gesture); | - |
| 6030 | } executed: }Execution Count:49 | 49 |
| 6031 | if (targets) partially evaluated: targets| yes Evaluation Count:75 | no Evaluation Count:0 |
| 0-75 |
| 6032 | (*targets)[itemobj].insert(gesture); executed: (*targets)[itemobj].insert(gesture);Execution Count:75 | 75 |
| 6033 | if (itemsSet) evaluated: itemsSet| yes Evaluation Count:8 | yes Evaluation Count:67 |
| 8-67 |
| 6034 | (*itemsSet).insert(itemobj); executed: (*itemsSet).insert(itemobj);Execution Count:8 | 8 |
| 6035 | } executed: }Execution Count:75 | 75 |
| 6036 | } executed: }Execution Count:142 | 142 |
| 6037 | // Don't propagate through panels. | - |
| 6038 | if (item->isPanel()) evaluated: item->isPanel()| yes Evaluation Count:4 | yes Evaluation Count:138 |
| 4-138 |
| 6039 | break; executed: break;Execution Count:4 | 4 |
| 6040 | } executed: }Execution Count:138 | 138 |
| 6041 | } executed: }Execution Count:67 | 67 |
| 6042 | if (normal) evaluated: normal| yes Evaluation Count:39 | yes Evaluation Count:30 |
| 30-39 |
| 6043 | *normal = normalGestures; executed: *normal = normalGestures;Execution Count:39 | 39 |
| 6044 | } executed: }Execution Count:69 | 69 |
| 6045 | | - |
| 6046 | void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) | - |
| 6047 | { | - |
| 6048 | QWidget *viewport = event->widget(); executed (the execution status of this line is deduced): QWidget *viewport = event->widget(); | - |
| 6049 | if (!viewport) partially evaluated: !viewport| no Evaluation Count:0 | yes Evaluation Count:144 |
| 0-144 |
| 6050 | return; | 0 |
| 6051 | QGraphicsView *graphicsView = qobject_cast<QGraphicsView *>(viewport->parent()); executed (the execution status of this line is deduced): QGraphicsView *graphicsView = qobject_cast<QGraphicsView *>(viewport->parent()); | - |
| 6052 | if (!graphicsView) partially evaluated: !graphicsView| no Evaluation Count:0 | yes Evaluation Count:144 |
| 0-144 |
| 6053 | return; | 0 |
| 6054 | | - |
| 6055 | QList<QGesture *> allGestures = event->gestures(); executed (the execution status of this line is deduced): QList<QGesture *> allGestures = event->gestures(); | - |
| 6056 | DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6056, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "Gestures:" << allGestures; partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:144 |
| 0-144 |
| 6057 | << "Gestures:" << allGestures; never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6056, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "Gestures:" << allGestures; | 0 |
| 6058 | | - |
| 6059 | QSet<QGesture *> startedGestures; executed (the execution status of this line is deduced): QSet<QGesture *> startedGestures; | - |
| 6060 | QPoint delta = viewport->mapFromGlobal(QPoint()); executed (the execution status of this line is deduced): QPoint delta = viewport->mapFromGlobal(QPoint()); | - |
| 6061 | QTransform toScene = QTransform::fromTranslate(delta.x(), delta.y()) executed (the execution status of this line is deduced): QTransform toScene = QTransform::fromTranslate(delta.x(), delta.y()) | - |
| 6062 | * graphicsView->viewportTransform().inverted(); executed (the execution status of this line is deduced): * graphicsView->viewportTransform().inverted(); | - |
| 6063 | foreach (QGesture *gesture, allGestures) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(allGestures)> _container_(allGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 6064 | // cache scene coordinates of the hot spot | - |
| 6065 | if (gesture->hasHotSpot()) { partially evaluated: gesture->hasHotSpot()| yes Evaluation Count:146 | no Evaluation Count:0 |
| 0-146 |
| 6066 | gesture->d_func()->sceneHotSpot = toScene.map(gesture->hotSpot()); executed (the execution status of this line is deduced): gesture->d_func()->sceneHotSpot = toScene.map(gesture->hotSpot()); | - |
| 6067 | } else { executed: }Execution Count:146 | 146 |
| 6068 | gesture->d_func()->sceneHotSpot = QPointF(); never executed (the execution status of this line is deduced): gesture->d_func()->sceneHotSpot = QPointF(); | - |
| 6069 | } | 0 |
| 6070 | | - |
| 6071 | QGraphicsObject *target = gestureTargets.value(gesture, 0); executed (the execution status of this line is deduced): QGraphicsObject *target = gestureTargets.value(gesture, 0); | - |
| 6072 | if (!target) { evaluated: !target| yes Evaluation Count:44 | yes Evaluation Count:102 |
| 44-102 |
| 6073 | // when we are not in started mode but don't have a target | - |
| 6074 | // then the only one interested in gesture is the view/scene | - |
| 6075 | if (gesture->state() == Qt::GestureStarted) evaluated: gesture->state() == Qt::GestureStarted| yes Evaluation Count:40 | yes Evaluation Count:4 |
| 4-40 |
| 6076 | startedGestures.insert(gesture); executed: startedGestures.insert(gesture);Execution Count:40 | 40 |
| 6077 | } executed: }Execution Count:44 | 44 |
| 6078 | } executed: }Execution Count:146 | 146 |
| 6079 | | - |
| 6080 | if (!startedGestures.isEmpty()) { evaluated: !startedGestures.isEmpty()| yes Evaluation Count:39 | yes Evaluation Count:105 |
| 39-105 |
| 6081 | QSet<QGesture *> normalGestures; // that have just one target executed (the execution status of this line is deduced): QSet<QGesture *> normalGestures; | - |
| 6082 | QSet<QGesture *> conflictedGestures; // that have multiple possible targets executed (the execution status of this line is deduced): QSet<QGesture *> conflictedGestures; | - |
| 6083 | gestureTargetsAtHotSpots(startedGestures, Qt::GestureFlag(0), &cachedItemGestures, 0, executed (the execution status of this line is deduced): gestureTargetsAtHotSpots(startedGestures, Qt::GestureFlag(0), &cachedItemGestures, 0, | - |
| 6084 | &normalGestures, &conflictedGestures); executed (the execution status of this line is deduced): &normalGestures, &conflictedGestures); | - |
| 6085 | cachedTargetItems = cachedItemGestures.keys(); executed (the execution status of this line is deduced): cachedTargetItems = cachedItemGestures.keys(); | - |
| 6086 | std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); executed (the execution status of this line is deduced): std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); | - |
| 6087 | DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6087, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "Normal gestures:" << normalGestures << "Conflicting gestures:" << conflictedGestures; partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:39 |
| 0-39 |
| 6088 | << "Normal gestures:" << normalGestures never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6087, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "Normal gestures:" << normalGestures << "Conflicting gestures:" << conflictedGestures; | 0 |
| 6089 | << "Conflicting gestures:" << conflictedGestures; never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6087, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "Normal gestures:" << normalGestures << "Conflicting gestures:" << conflictedGestures; | 0 |
| 6090 | | - |
| 6091 | // deliver conflicted gestures as override events AND remember | - |
| 6092 | // initial gesture targets | - |
| 6093 | if (!conflictedGestures.isEmpty()) { evaluated: !conflictedGestures.isEmpty()| yes Evaluation Count:22 | yes Evaluation Count:17 |
| 17-22 |
| 6094 | for (int i = 0; i < cachedTargetItems.size(); ++i) { evaluated: i < cachedTargetItems.size()| yes Evaluation Count:48 | yes Evaluation Count:20 |
| 20-48 |
| 6095 | QPointer<QGraphicsObject> item = cachedTargetItems.at(i); executed (the execution status of this line is deduced): QPointer<QGraphicsObject> item = cachedTargetItems.at(i); | - |
| 6096 | | - |
| 6097 | // get gestures to deliver to the current item | - |
| 6098 | QSet<QGesture *> gestures = conflictedGestures & cachedItemGestures.value(item.data()); executed (the execution status of this line is deduced): QSet<QGesture *> gestures = conflictedGestures & cachedItemGestures.value(item.data()); | - |
| 6099 | if (gestures.isEmpty()) partially evaluated: gestures.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:48 |
| 0-48 |
| 6100 | continue; never executed: continue; | 0 |
| 6101 | | - |
| 6102 | DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6102, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering override to" << item.data() << gestures; partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:48 |
| 0-48 |
| 6103 | << "delivering override to" never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6102, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering override to" << item.data() << gestures; | 0 |
| 6104 | << item.data() << gestures; never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6102, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering override to" << item.data() << gestures; | 0 |
| 6105 | // send gesture override | - |
| 6106 | QGestureEvent ev(gestures.toList()); executed (the execution status of this line is deduced): QGestureEvent ev(gestures.toList()); | - |
| 6107 | ev.t = QEvent::GestureOverride; executed (the execution status of this line is deduced): ev.t = QEvent::GestureOverride; | - |
| 6108 | ev.setWidget(event->widget()); executed (the execution status of this line is deduced): ev.setWidget(event->widget()); | - |
| 6109 | // mark event and individual gestures as ignored | - |
| 6110 | ev.ignore(); executed (the execution status of this line is deduced): ev.ignore(); | - |
| 6111 | foreach(QGesture *g, gestures) executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(gestures)> _container_(gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 6112 | ev.setAccepted(g, false); executed: ev.setAccepted(g, false);Execution Count:48 | 48 |
| 6113 | sendEvent(item.data(), &ev); executed (the execution status of this line is deduced): sendEvent(item.data(), &ev); | - |
| 6114 | // mark all accepted gestures to deliver them as normal gesture events | - |
| 6115 | foreach (QGesture *g, gestures) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(gestures)> _container_(gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 6116 | if (ev.isAccepted() || ev.isAccepted(g)) { evaluated: ev.isAccepted()| yes Evaluation Count:2 | yes Evaluation Count:46 |
partially evaluated: ev.isAccepted(g)| no Evaluation Count:0 | yes Evaluation Count:46 |
| 0-46 |
| 6117 | conflictedGestures.remove(g); executed (the execution status of this line is deduced): conflictedGestures.remove(g); | - |
| 6118 | // mark the item as a gesture target | - |
| 6119 | if (item) { partially evaluated: item| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 6120 | gestureTargets.insert(g, item.data()); executed (the execution status of this line is deduced): gestureTargets.insert(g, item.data()); | - |
| 6121 | QHash<QGraphicsObject *, QSet<QGesture *> >::iterator it, e; executed (the execution status of this line is deduced): QHash<QGraphicsObject *, QSet<QGesture *> >::iterator it, e; | - |
| 6122 | it = cachedItemGestures.begin(); executed (the execution status of this line is deduced): it = cachedItemGestures.begin(); | - |
| 6123 | e = cachedItemGestures.end(); executed (the execution status of this line is deduced): e = cachedItemGestures.end(); | - |
| 6124 | for(; it != e; ++it) evaluated: it != e| yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-4 |
| 6125 | it.value().remove(g); executed: it.value().remove(g);Execution Count:4 | 4 |
| 6126 | cachedItemGestures[item.data()].insert(g); executed (the execution status of this line is deduced): cachedItemGestures[item.data()].insert(g); | - |
| 6127 | } executed: }Execution Count:2 | 2 |
| 6128 | DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6128, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "override was accepted:" << g << item.data(); partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 6129 | << "override was accepted:" never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6128, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "override was accepted:" << g << item.data(); | 0 |
| 6130 | << g << item.data(); never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6128, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "override was accepted:" << g << item.data(); | 0 |
| 6131 | } executed: }Execution Count:2 | 2 |
| 6132 | // remember the first item that received the override event | - |
| 6133 | // as it most likely become a target if no one else accepts | - |
| 6134 | // the override event | - |
| 6135 | if (!gestureTargets.contains(g) && item) evaluated: !gestureTargets.contains(g)| yes Evaluation Count:21 | yes Evaluation Count:27 |
partially evaluated: item| yes Evaluation Count:21 | no Evaluation Count:0 |
| 0-27 |
| 6136 | gestureTargets.insert(g, item.data()); executed: gestureTargets.insert(g, item.data());Execution Count:21 | 21 |
| 6137 | | - |
| 6138 | } executed: }Execution Count:48 | 48 |
| 6139 | if (conflictedGestures.isEmpty()) evaluated: conflictedGestures.isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:46 |
| 2-46 |
| 6140 | break; executed: break;Execution Count:2 | 2 |
| 6141 | } executed: }Execution Count:46 | 46 |
| 6142 | } executed: }Execution Count:22 | 22 |
| 6143 | // remember the initial target item for each gesture that was not in | - |
| 6144 | // the conflicted state. | - |
| 6145 | if (!normalGestures.isEmpty()) { evaluated: !normalGestures.isEmpty()| yes Evaluation Count:18 | yes Evaluation Count:21 |
| 18-21 |
| 6146 | for (int i = 0; i < cachedTargetItems.size() && !normalGestures.isEmpty(); ++i) { evaluated: i < cachedTargetItems.size()| yes Evaluation Count:21 | yes Evaluation Count:18 |
partially evaluated: !normalGestures.isEmpty()| yes Evaluation Count:21 | no Evaluation Count:0 |
| 0-21 |
| 6147 | QGraphicsObject *item = cachedTargetItems.at(i); executed (the execution status of this line is deduced): QGraphicsObject *item = cachedTargetItems.at(i); | - |
| 6148 | | - |
| 6149 | // get gestures to deliver to the current item | - |
| 6150 | foreach (QGesture *g, cachedItemGestures.value(item)) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(cachedItemGestures.value(item))> _container_(cachedItemGestures.value(item)); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 6151 | if (!gestureTargets.contains(g)) { evaluated: !gestureTargets.contains(g)| yes Evaluation Count:18 | yes Evaluation Count:3 |
| 3-18 |
| 6152 | gestureTargets.insert(g, item); executed (the execution status of this line is deduced): gestureTargets.insert(g, item); | - |
| 6153 | normalGestures.remove(g); executed (the execution status of this line is deduced): normalGestures.remove(g); | - |
| 6154 | } executed: }Execution Count:18 | 18 |
| 6155 | } executed: }Execution Count:21 | 21 |
| 6156 | } executed: }Execution Count:21 | 21 |
| 6157 | } executed: }Execution Count:18 | 18 |
| 6158 | } executed: }Execution Count:39 | 39 |
| 6159 | | - |
| 6160 | | - |
| 6161 | // deliver all gesture events | - |
| 6162 | QSet<QGesture *> undeliveredGestures; executed (the execution status of this line is deduced): QSet<QGesture *> undeliveredGestures; | - |
| 6163 | QSet<QGesture *> parentPropagatedGestures; executed (the execution status of this line is deduced): QSet<QGesture *> parentPropagatedGestures; | - |
| 6164 | foreach (QGesture *gesture, allGestures) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(allGestures)> _container_(allGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 6165 | if (QGraphicsObject *target = gestureTargets.value(gesture, 0)) { evaluated: QGraphicsObject *target = gestureTargets.value(gesture, 0)| yes Evaluation Count:142 | yes Evaluation Count:4 |
| 4-142 |
| 6166 | cachedItemGestures[target].insert(gesture); executed (the execution status of this line is deduced): cachedItemGestures[target].insert(gesture); | - |
| 6167 | cachedTargetItems.append(target); executed (the execution status of this line is deduced): cachedTargetItems.append(target); | - |
| 6168 | undeliveredGestures.insert(gesture); executed (the execution status of this line is deduced): undeliveredGestures.insert(gesture); | - |
| 6169 | QGraphicsItemPrivate *d = target->QGraphicsItem::d_func(); executed (the execution status of this line is deduced): QGraphicsItemPrivate *d = target->QGraphicsItem::d_func(); | - |
| 6170 | const Qt::GestureFlags flags = d->gestureContext.value(gesture->gestureType()); executed (the execution status of this line is deduced): const Qt::GestureFlags flags = d->gestureContext.value(gesture->gestureType()); | - |
| 6171 | if (flags & Qt::IgnoredGesturesPropagateToParent) evaluated: flags & Qt::IgnoredGesturesPropagateToParent| yes Evaluation Count:4 | yes Evaluation Count:138 |
| 4-138 |
| 6172 | parentPropagatedGestures.insert(gesture); executed: parentPropagatedGestures.insert(gesture);Execution Count:4 | 4 |
| 6173 | } else { executed: }Execution Count:142 | 142 |
| 6174 | DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6174, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "no target for" << gesture << "at" << gesture->hotSpot() << gesture->d_func()->sceneHotSpot; partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 6175 | << "no target for" << gesture << "at" never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6174, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "no target for" << gesture << "at" << gesture->hotSpot() << gesture->d_func()->sceneHotSpot; | 0 |
| 6176 | << gesture->hotSpot() << gesture->d_func()->sceneHotSpot; never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6174, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "no target for" << gesture << "at" << gesture->hotSpot() << gesture->d_func()->sceneHotSpot; | 0 |
| 6177 | } executed: }Execution Count:4 | 4 |
| 6178 | } | - |
| 6179 | std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); executed (the execution status of this line is deduced): std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); | - |
| 6180 | for (int i = 0; i < cachedTargetItems.size(); ++i) { evaluated: i < cachedTargetItems.size()| yes Evaluation Count:189 | yes Evaluation Count:32 |
| 32-189 |
| 6181 | QPointer<QGraphicsObject> receiver = cachedTargetItems.at(i); executed (the execution status of this line is deduced): QPointer<QGraphicsObject> receiver = cachedTargetItems.at(i); | - |
| 6182 | QSet<QGesture *> gestures = executed (the execution status of this line is deduced): QSet<QGesture *> gestures = | - |
| 6183 | undeliveredGestures & cachedItemGestures.value(receiver.data()); executed (the execution status of this line is deduced): undeliveredGestures & cachedItemGestures.value(receiver.data()); | - |
| 6184 | gestures -= cachedAlreadyDeliveredGestures.value(receiver.data()); executed (the execution status of this line is deduced): gestures -= cachedAlreadyDeliveredGestures.value(receiver.data()); | - |
| 6185 | | - |
| 6186 | if (gestures.isEmpty()) evaluated: gestures.isEmpty()| yes Evaluation Count:32 | yes Evaluation Count:157 |
| 32-157 |
| 6187 | continue; executed: continue;Execution Count:32 | 32 |
| 6188 | | - |
| 6189 | cachedAlreadyDeliveredGestures[receiver.data()] += gestures; executed (the execution status of this line is deduced): cachedAlreadyDeliveredGestures[receiver.data()] += gestures; | - |
| 6190 | const bool isPanel = receiver.data()->isPanel(); executed (the execution status of this line is deduced): const bool isPanel = receiver.data()->isPanel(); | - |
| 6191 | | - |
| 6192 | DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6192, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering to" << receiver.data() << gestures; partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:157 |
| 0-157 |
| 6193 | << "delivering to" never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6192, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering to" << receiver.data() << gestures; | 0 |
| 6194 | << receiver.data() << gestures; never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6192, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering to" << receiver.data() << gestures; | 0 |
| 6195 | QGestureEvent ev(gestures.toList()); executed (the execution status of this line is deduced): QGestureEvent ev(gestures.toList()); | - |
| 6196 | ev.setWidget(event->widget()); executed (the execution status of this line is deduced): ev.setWidget(event->widget()); | - |
| 6197 | sendEvent(receiver.data(), &ev); executed (the execution status of this line is deduced): sendEvent(receiver.data(), &ev); | - |
| 6198 | QSet<QGesture *> ignoredGestures; executed (the execution status of this line is deduced): QSet<QGesture *> ignoredGestures; | - |
| 6199 | foreach (QGesture *g, gestures) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(gestures)> _container_(gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 6200 | if (!ev.isAccepted() && !ev.isAccepted(g)) { evaluated: !ev.isAccepted()| yes Evaluation Count:43 | yes Evaluation Count:114 |
partially evaluated: !ev.isAccepted(g)| yes Evaluation Count:43 | no Evaluation Count:0 |
| 0-114 |
| 6201 | // if the gesture was ignored by its target, we will update the | - |
| 6202 | // targetItems list with a possible target items (items that | - |
| 6203 | // want to receive partial gestures). | - |
| 6204 | // ### won't work if the target was destroyed in the event | - |
| 6205 | // we will just stop delivering it. | - |
| 6206 | if (receiver && receiver.data() == gestureTargets.value(g, 0)) evaluated: receiver| yes Evaluation Count:42 | yes Evaluation Count:1 |
evaluated: receiver.data() == gestureTargets.value(g, 0)| yes Evaluation Count:30 | yes Evaluation Count:12 |
| 1-42 |
| 6207 | ignoredGestures.insert(g); executed: ignoredGestures.insert(g);Execution Count:30 | 30 |
| 6208 | } else { executed: }Execution Count:43 | 43 |
| 6209 | if (receiver && g->state() == Qt::GestureStarted) { evaluated: receiver| yes Evaluation Count:113 | yes Evaluation Count:1 |
evaluated: g->state() == Qt::GestureStarted| yes Evaluation Count:35 | yes Evaluation Count:78 |
| 1-113 |
| 6210 | // someone accepted the propagated initial GestureStarted | - |
| 6211 | // event, let it be the new target for all following events. | - |
| 6212 | gestureTargets[g] = receiver.data(); executed (the execution status of this line is deduced): gestureTargets[g] = receiver.data(); | - |
| 6213 | } executed: }Execution Count:35 | 35 |
| 6214 | undeliveredGestures.remove(g); executed (the execution status of this line is deduced): undeliveredGestures.remove(g); | - |
| 6215 | } executed: }Execution Count:114 | 114 |
| 6216 | } | - |
| 6217 | if (undeliveredGestures.isEmpty()) evaluated: undeliveredGestures.isEmpty()| yes Evaluation Count:112 | yes Evaluation Count:45 |
| 45-112 |
| 6218 | break; executed: break;Execution Count:112 | 112 |
| 6219 | | - |
| 6220 | // ignoredGestures list is only filled when delivering to the gesture | - |
| 6221 | // target item, so it is safe to assume item == target. | - |
| 6222 | if (!ignoredGestures.isEmpty() && !isPanel) { evaluated: !ignoredGestures.isEmpty()| yes Evaluation Count:30 | yes Evaluation Count:15 |
partially evaluated: !isPanel| yes Evaluation Count:30 | no Evaluation Count:0 |
| 0-30 |
| 6223 | // look for new potential targets for gestures that were ignored | - |
| 6224 | // and should be propagated. | - |
| 6225 | | - |
| 6226 | QSet<QGraphicsObject *> targetsSet = cachedTargetItems.toSet(); executed (the execution status of this line is deduced): QSet<QGraphicsObject *> targetsSet = cachedTargetItems.toSet(); | - |
| 6227 | | - |
| 6228 | if (receiver) { partially evaluated: receiver| yes Evaluation Count:30 | no Evaluation Count:0 |
| 0-30 |
| 6229 | // first if the gesture should be propagated to parents only | - |
| 6230 | for (QSet<QGesture *>::iterator it = ignoredGestures.begin(); executed (the execution status of this line is deduced): for (QSet<QGesture *>::iterator it = ignoredGestures.begin(); | - |
| 6231 | it != ignoredGestures.end();) { evaluated: it != ignoredGestures.end()| yes Evaluation Count:30 | yes Evaluation Count:30 |
| 30 |
| 6232 | if (parentPropagatedGestures.contains(*it)) { evaluated: parentPropagatedGestures.contains(*it)| yes Evaluation Count:3 | yes Evaluation Count:27 |
| 3-27 |
| 6233 | QGesture *gesture = *it; executed (the execution status of this line is deduced): QGesture *gesture = *it; | - |
| 6234 | const Qt::GestureType gestureType = gesture->gestureType(); executed (the execution status of this line is deduced): const Qt::GestureType gestureType = gesture->gestureType(); | - |
| 6235 | QGraphicsItem *item = receiver.data(); executed (the execution status of this line is deduced): QGraphicsItem *item = receiver.data(); | - |
| 6236 | while (item) { evaluated: item| yes Evaluation Count:9 | yes Evaluation Count:3 |
| 3-9 |
| 6237 | if (QGraphicsObject *obj = item->toGraphicsObject()) { partially evaluated: QGraphicsObject *obj = item->toGraphicsObject()| yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
| 6238 | if (item->d_func()->gestureContext.contains(gestureType)) { partially evaluated: item->d_func()->gestureContext.contains(gestureType)| yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
| 6239 | targetsSet.insert(obj); executed (the execution status of this line is deduced): targetsSet.insert(obj); | - |
| 6240 | cachedItemGestures[obj].insert(gesture); executed (the execution status of this line is deduced): cachedItemGestures[obj].insert(gesture); | - |
| 6241 | } executed: }Execution Count:9 | 9 |
| 6242 | } executed: }Execution Count:9 | 9 |
| 6243 | if (item->isPanel()) partially evaluated: item->isPanel()| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 6244 | break; | 0 |
| 6245 | item = item->parentItem(); executed (the execution status of this line is deduced): item = item->parentItem(); | - |
| 6246 | } executed: }Execution Count:9 | 9 |
| 6247 | | - |
| 6248 | it = ignoredGestures.erase(it); executed (the execution status of this line is deduced): it = ignoredGestures.erase(it); | - |
| 6249 | continue; executed: continue;Execution Count:3 | 3 |
| 6250 | } | - |
| 6251 | ++it; executed (the execution status of this line is deduced): ++it; | - |
| 6252 | } executed: }Execution Count:27 | 27 |
| 6253 | } executed: }Execution Count:30 | 30 |
| 6254 | | - |
| 6255 | gestureTargetsAtHotSpots(ignoredGestures, Qt::ReceivePartialGestures, executed (the execution status of this line is deduced): gestureTargetsAtHotSpots(ignoredGestures, Qt::ReceivePartialGestures, | - |
| 6256 | &cachedItemGestures, &targetsSet, 0, 0); executed (the execution status of this line is deduced): &cachedItemGestures, &targetsSet, 0, 0); | - |
| 6257 | | - |
| 6258 | cachedTargetItems = targetsSet.toList(); executed (the execution status of this line is deduced): cachedTargetItems = targetsSet.toList(); | - |
| 6259 | std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); executed (the execution status of this line is deduced): std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); | - |
| 6260 | DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6260, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "new targets:" << cachedTargetItems; partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:30 |
| 0-30 |
| 6261 | << "new targets:" << cachedTargetItems; never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6260, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "new targets:" << cachedTargetItems; | 0 |
| 6262 | i = -1; // start delivery again executed (the execution status of this line is deduced): i = -1; | - |
| 6263 | continue; executed: continue;Execution Count:30 | 30 |
| 6264 | } | - |
| 6265 | } executed: }Execution Count:15 | 15 |
| 6266 | | - |
| 6267 | foreach (QGesture *g, startedGestures) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(startedGestures)> _container_(startedGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 6268 | if (g->gestureCancelPolicy() == QGesture::CancelAllInContext) { evaluated: g->gestureCancelPolicy() == QGesture::CancelAllInContext| yes Evaluation Count:2 | yes Evaluation Count:38 |
| 2-38 |
| 6269 | DEBUG() << "lets try to cancel some"; never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6269, __PRETTY_FUNCTION__).debug() << "lets try to cancel some"; partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 6270 | // find gestures in context in Qt::GestureStarted or Qt::GestureUpdated state and cancel them | - |
| 6271 | cancelGesturesForChildren(g); executed (the execution status of this line is deduced): cancelGesturesForChildren(g); | - |
| 6272 | } executed: }Execution Count:2 | 2 |
| 6273 | } executed: }Execution Count:40 | 40 |
| 6274 | | - |
| 6275 | // forget about targets for gestures that have ended | - |
| 6276 | foreach (QGesture *g, allGestures) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(allGestures)> _container_(allGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 6277 | switch (g->state()) { | - |
| 6278 | case Qt::GestureFinished: | - |
| 6279 | case Qt::GestureCanceled: | - |
| 6280 | gestureTargets.remove(g); executed (the execution status of this line is deduced): gestureTargets.remove(g); | - |
| 6281 | break; executed: break;Execution Count:38 | 38 |
| 6282 | default: | - |
| 6283 | break; executed: break;Execution Count:108 | 108 |
| 6284 | } | - |
| 6285 | } executed: }Execution Count:146 | 146 |
| 6286 | | - |
| 6287 | cachedTargetItems.clear(); executed (the execution status of this line is deduced): cachedTargetItems.clear(); | - |
| 6288 | cachedItemGestures.clear(); executed (the execution status of this line is deduced): cachedItemGestures.clear(); | - |
| 6289 | cachedAlreadyDeliveredGestures.clear(); executed (the execution status of this line is deduced): cachedAlreadyDeliveredGestures.clear(); | - |
| 6290 | } executed: }Execution Count:144 | 144 |
| 6291 | | - |
| 6292 | void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original) | - |
| 6293 | { | - |
| 6294 | Q_ASSERT(original); executed (the execution status of this line is deduced): qt_noop(); | - |
| 6295 | QGraphicsItem *originalItem = gestureTargets.value(original); executed (the execution status of this line is deduced): QGraphicsItem *originalItem = gestureTargets.value(original); | - |
| 6296 | if (originalItem == 0) // we only act on accepted gestures, which implies it has a target. partially evaluated: originalItem == 0| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 6297 | return; | 0 |
| 6298 | | - |
| 6299 | // iterate over all active gestures and for each find the owner | - |
| 6300 | // if the owner is part of our sub-hierarchy, cancel it. | - |
| 6301 | | - |
| 6302 | QSet<QGesture *> canceledGestures; executed (the execution status of this line is deduced): QSet<QGesture *> canceledGestures; | - |
| 6303 | QHash<QGesture *, QGraphicsObject *>::Iterator iter = gestureTargets.begin(); executed (the execution status of this line is deduced): QHash<QGesture *, QGraphicsObject *>::Iterator iter = gestureTargets.begin(); | - |
| 6304 | while (iter != gestureTargets.end()) { evaluated: iter != gestureTargets.end()| yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-4 |
| 6305 | QGraphicsObject *item = iter.value(); executed (the execution status of this line is deduced): QGraphicsObject *item = iter.value(); | - |
| 6306 | // note that we don't touch the gestures for our originalItem | - |
| 6307 | if (item != originalItem && originalItem->isAncestorOf(item)) { evaluated: item != originalItem| yes Evaluation Count:2 | yes Evaluation Count:2 |
partially evaluated: originalItem->isAncestorOf(item)| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 6308 | DEBUG() << " found a gesture to cancel" << iter.key(); never executed: QMessageLogger("graphicsview/qgraphicsscene.cpp", 6308, __PRETTY_FUNCTION__).debug() << " found a gesture to cancel" << iter.key(); partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 6309 | iter.key()->d_func()->state = Qt::GestureCanceled; executed (the execution status of this line is deduced): iter.key()->d_func()->state = Qt::GestureCanceled; | - |
| 6310 | canceledGestures << iter.key(); executed (the execution status of this line is deduced): canceledGestures << iter.key(); | - |
| 6311 | } executed: }Execution Count:2 | 2 |
| 6312 | ++iter; executed (the execution status of this line is deduced): ++iter; | - |
| 6313 | } executed: }Execution Count:4 | 4 |
| 6314 | | - |
| 6315 | // sort them per target item by cherry picking from almostCanceledGestures and delivering | - |
| 6316 | QSet<QGesture *> almostCanceledGestures = canceledGestures; executed (the execution status of this line is deduced): QSet<QGesture *> almostCanceledGestures = canceledGestures; | - |
| 6317 | QSet<QGesture *>::Iterator setIter; executed (the execution status of this line is deduced): QSet<QGesture *>::Iterator setIter; | - |
| 6318 | while (!almostCanceledGestures.isEmpty()) { evaluated: !almostCanceledGestures.isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
| 6319 | QGraphicsObject *target = 0; executed (the execution status of this line is deduced): QGraphicsObject *target = 0; | - |
| 6320 | QSet<QGesture*> gestures; executed (the execution status of this line is deduced): QSet<QGesture*> gestures; | - |
| 6321 | setIter = almostCanceledGestures.begin(); executed (the execution status of this line is deduced): setIter = almostCanceledGestures.begin(); | - |
| 6322 | // sort per target item | - |
| 6323 | while (setIter != almostCanceledGestures.end()) { evaluated: setIter != almostCanceledGestures.end()| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
| 6324 | QGraphicsObject *item = gestureTargets.value(*setIter); executed (the execution status of this line is deduced): QGraphicsObject *item = gestureTargets.value(*setIter); | - |
| 6325 | if (target == 0) partially evaluated: target == 0| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 6326 | target = item; executed: target = item;Execution Count:2 | 2 |
| 6327 | if (target == item) { partially evaluated: target == item| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 6328 | gestures << *setIter; executed (the execution status of this line is deduced): gestures << *setIter; | - |
| 6329 | setIter = almostCanceledGestures.erase(setIter); executed (the execution status of this line is deduced): setIter = almostCanceledGestures.erase(setIter); | - |
| 6330 | } else { executed: }Execution Count:2 | 2 |
| 6331 | ++setIter; never executed (the execution status of this line is deduced): ++setIter; | - |
| 6332 | } | 0 |
| 6333 | } | - |
| 6334 | Q_ASSERT(target); executed (the execution status of this line is deduced): qt_noop(); | - |
| 6335 | | - |
| 6336 | QList<QGesture *> list = gestures.toList(); executed (the execution status of this line is deduced): QList<QGesture *> list = gestures.toList(); | - |
| 6337 | QGestureEvent ev(list); executed (the execution status of this line is deduced): QGestureEvent ev(list); | - |
| 6338 | sendEvent(target, &ev); executed (the execution status of this line is deduced): sendEvent(target, &ev); | - |
| 6339 | | - |
| 6340 | foreach (QGesture *g, list) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(list)> _container_(list); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 6341 | if (ev.isAccepted() || ev.isAccepted(g)) partially evaluated: ev.isAccepted()| yes Evaluation Count:2 | no Evaluation Count:0 |
never evaluated: ev.isAccepted(g) | 0-2 |
| 6342 | gestures.remove(g); executed: gestures.remove(g);Execution Count:2 | 2 |
| 6343 | } executed: }Execution Count:2 | 2 |
| 6344 | | - |
| 6345 | foreach (QGesture *g, gestures) { never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(gestures)> _container_(gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 6346 | if (!g->hasHotSpot()) never evaluated: !g->hasHotSpot() | 0 |
| 6347 | continue; never executed: continue; | 0 |
| 6348 | | - |
| 6349 | QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), g->d_func()->sceneHotSpot, 0); never executed (the execution status of this line is deduced): QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), g->d_func()->sceneHotSpot, 0); | - |
| 6350 | for (int j = 0; j < items.size(); ++j) { never evaluated: j < items.size() | 0 |
| 6351 | QGraphicsObject *item = items.at(j)->toGraphicsObject(); never executed (the execution status of this line is deduced): QGraphicsObject *item = items.at(j)->toGraphicsObject(); | - |
| 6352 | if (!item) | 0 |
| 6353 | continue; never executed: continue; | 0 |
| 6354 | QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); never executed (the execution status of this line is deduced): QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); | - |
| 6355 | if (d->gestureContext.contains(g->gestureType())) { never evaluated: d->gestureContext.contains(g->gestureType()) | 0 |
| 6356 | QList<QGesture *> list; never executed (the execution status of this line is deduced): QList<QGesture *> list; | - |
| 6357 | list << g; never executed (the execution status of this line is deduced): list << g; | - |
| 6358 | QGestureEvent ev(list); never executed (the execution status of this line is deduced): QGestureEvent ev(list); | - |
| 6359 | sendEvent(item, &ev); never executed (the execution status of this line is deduced): sendEvent(item, &ev); | - |
| 6360 | if (ev.isAccepted() || ev.isAccepted(g)) never evaluated: ev.isAccepted() never evaluated: ev.isAccepted(g) | 0 |
| 6361 | break; // successfully delivered | 0 |
| 6362 | } | 0 |
| 6363 | } | 0 |
| 6364 | } | 0 |
| 6365 | } executed: }Execution Count:2 | 2 |
| 6366 | | - |
| 6367 | QGestureManager *gestureManager = QApplicationPrivate::instance()->gestureManager; executed (the execution status of this line is deduced): QGestureManager *gestureManager = QApplicationPrivate::instance()->gestureManager; | - |
| 6368 | Q_ASSERT(gestureManager); // it would be very odd if we got called without a manager. executed (the execution status of this line is deduced): qt_noop(); | - |
| 6369 | for (setIter = canceledGestures.begin(); setIter != canceledGestures.end(); ++setIter) { evaluated: setIter != canceledGestures.end()| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
| 6370 | gestureManager->recycle(*setIter); executed (the execution status of this line is deduced): gestureManager->recycle(*setIter); | - |
| 6371 | gestureTargets.remove(*setIter); executed (the execution status of this line is deduced): gestureTargets.remove(*setIter); | - |
| 6372 | } executed: }Execution Count:2 | 2 |
| 6373 | } executed: }Execution Count:2 | 2 |
| 6374 | | - |
| 6375 | void QGraphicsScenePrivate::grabGesture(QGraphicsItem *, Qt::GestureType gesture) | - |
| 6376 | { | - |
| 6377 | (void)QGestureManager::instance(); // create a gesture manager executed (the execution status of this line is deduced): (void)QGestureManager::instance(); | - |
| 6378 | if (!grabbedGestures[gesture]++) { evaluated: !grabbedGestures[gesture]++| yes Evaluation Count:26 | yes Evaluation Count:26 |
| 26 |
| 6379 | foreach (QGraphicsView *view, views) executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(views)> _container_(views); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 6380 | view->viewport()->grabGesture(gesture); executed: view->viewport()->grabGesture(gesture);Execution Count:26 | 26 |
| 6381 | } executed: }Execution Count:26 | 26 |
| 6382 | } executed: }Execution Count:52 | 52 |
| 6383 | | - |
| 6384 | void QGraphicsScenePrivate::ungrabGesture(QGraphicsItem *item, Qt::GestureType gesture) | - |
| 6385 | { | - |
| 6386 | // we know this can only be an object | - |
| 6387 | Q_ASSERT(item->d_ptr->isObject); executed (the execution status of this line is deduced): qt_noop(); | - |
| 6388 | QGraphicsObject *obj = static_cast<QGraphicsObject *>(item); executed (the execution status of this line is deduced): QGraphicsObject *obj = static_cast<QGraphicsObject *>(item); | - |
| 6389 | QGestureManager::instance()->cleanupCachedGestures(obj, gesture); executed (the execution status of this line is deduced): QGestureManager::instance()->cleanupCachedGestures(obj, gesture); | - |
| 6390 | if (!--grabbedGestures[gesture]) { evaluated: !--grabbedGestures[gesture]| yes Evaluation Count:24 | yes Evaluation Count:26 |
| 24-26 |
| 6391 | foreach (QGraphicsView *view, views) executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(views)> _container_(views); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsView *view = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 6392 | view->viewport()->ungrabGesture(gesture); executed: view->viewport()->ungrabGesture(gesture);Execution Count:1 | 1 |
| 6393 | } executed: }Execution Count:24 | 24 |
| 6394 | } executed: }Execution Count:50 | 50 |
| 6395 | #endif // QT_NO_GESTURES | - |
| 6396 | | - |
| 6397 | QT_END_NAMESPACE | - |
| 6398 | | - |
| 6399 | #include "moc_qgraphicsscene.cpp" | - |
| 6400 | | - |
| 6401 | #endif // QT_NO_GRAPHICSVIEW | - |
| 6402 | | - |
| | |