| 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 | static const int QGRAPHICSVIEW_REGION_RECT_THRESHOLD = 50; | - |
| 43 | | - |
| 44 | static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime < 2^9 | - |
| 45 | | - |
| 46 | /*! | - |
| 47 | \class QGraphicsView | - |
| 48 | \brief The QGraphicsView class provides a widget for displaying the | - |
| 49 | contents of a QGraphicsScene. | - |
| 50 | \since 4.2 | - |
| 51 | \ingroup graphicsview-api | - |
| 52 | \inmodule QtWidgets | - |
| 53 | | - |
| 54 | QGraphicsView visualizes the contents of a QGraphicsScene in a scrollable | - |
| 55 | viewport. To create a scene with geometrical items, see QGraphicsScene's | - |
| 56 | documentation. QGraphicsView is part of the \l{Graphics View Framework}. | - |
| 57 | | - |
| 58 | To visualize a scene, you start by constructing a QGraphicsView object, | - |
| 59 | passing the address of the scene you want to visualize to QGraphicsView's | - |
| 60 | constructor. Alternatively, you can call setScene() to set the scene at a | - |
| 61 | later point. After you call show(), the view will by default scroll to the | - |
| 62 | center of the scene and display any items that are visible at this | - |
| 63 | point. For example: | - |
| 64 | | - |
| 65 | \snippet code/src_gui_graphicsview_qgraphicsview.cpp 0 | - |
| 66 | | - |
| 67 | You can explicitly scroll to any position on the scene by using the | - |
| 68 | scroll bars, or by calling centerOn(). By passing a point to centerOn(), | - |
| 69 | QGraphicsView will scroll its viewport to ensure that the point is | - |
| 70 | centered in the view. An overload is provided for scrolling to a | - |
| 71 | QGraphicsItem, in which case QGraphicsView will see to that the center of | - |
| 72 | the item is centered in the view. If all you want is to ensure that a | - |
| 73 | certain area is visible, (but not necessarily centered,) you can call | - |
| 74 | ensureVisible() instead. | - |
| 75 | | - |
| 76 | QGraphicsView can be used to visualize a whole scene, or only parts of it. | - |
| 77 | The visualized area is by default detected automatically when the view is | - |
| 78 | displayed for the first time (by calling | - |
| 79 | QGraphicsScene::itemsBoundingRect()). To set the visualized area rectangle | - |
| 80 | yourself, you can call setSceneRect(). This will adjust the scroll bars' | - |
| 81 | ranges appropriately. Note that although the scene supports a virtually | - |
| 82 | unlimited size, the range of the scroll bars will never exceed the range of | - |
| 83 | an integer (INT_MIN, INT_MAX). | - |
| 84 | | - |
| 85 | QGraphicsView visualizes the scene by calling render(). By default, the | - |
| 86 | items are drawn onto the viewport by using a regular QPainter, and using | - |
| 87 | default render hints. To change the default render hints that | - |
| 88 | QGraphicsView passes to QPainter when painting items, you can call | - |
| 89 | setRenderHints(). | - |
| 90 | | - |
| 91 | By default, QGraphicsView provides a regular QWidget for the viewport | - |
| 92 | widget. You can access this widget by calling viewport(), or you can | - |
| 93 | replace it by calling setViewport(). To render using OpenGL, simply call | - |
| 94 | setViewport(new QGLWidget). QGraphicsView takes ownership of the viewport | - |
| 95 | widget. | - |
| 96 | | - |
| 97 | QGraphicsView supports affine transformations, using QTransform. You can | - |
| 98 | either pass a matrix to setTransform(), or you can call one of the | - |
| 99 | convenience functions rotate(), scale(), translate() or shear(). The most | - |
| 100 | two common transformations are scaling, which is used to implement | - |
| 101 | zooming, and rotation. QGraphicsView keeps the center of the view fixed | - |
| 102 | during a transformation. Because of the scene alignment (setAligment()), | - |
| 103 | translating the view will have no visual impact. | - |
| 104 | | - |
| 105 | You can interact with the items on the scene by using the mouse and | - |
| 106 | keyboard. QGraphicsView translates the mouse and key events into \e scene | - |
| 107 | events, (events that inherit QGraphicsSceneEvent,), and forward them to | - |
| 108 | the visualized scene. In the end, it's the individual item that handles | - |
| 109 | the events and reacts to them. For example, if you click on a selectable | - |
| 110 | item, the item will typically let the scene know that it has been | - |
| 111 | selected, and it will also redraw itself to display a selection | - |
| 112 | rectangle. Similiary, if you click and drag the mouse to move a movable | - |
| 113 | item, it's the item that handles the mouse moves and moves itself. Item | - |
| 114 | interaction is enabled by default, and you can toggle it by calling | - |
| 115 | setInteractive(). | - |
| 116 | | - |
| 117 | You can also provide your own custom scene interaction, by creating a | - |
| 118 | subclass of QGraphicsView, and reimplementing the mouse and key event | - |
| 119 | handlers. To simplify how you programmatically interact with items in the | - |
| 120 | view, QGraphicsView provides the mapping functions mapToScene() and | - |
| 121 | mapFromScene(), and the item accessors items() and itemAt(). These | - |
| 122 | functions allow you to map points, rectangles, polygons and paths between | - |
| 123 | view coordinates and scene coordinates, and to find items on the scene | - |
| 124 | using view coordinates. | - |
| 125 | | - |
| 126 | \image graphicsview-view.png | - |
| 127 | | - |
| 128 | \sa QGraphicsScene, QGraphicsItem, QGraphicsSceneEvent | - |
| 129 | */ | - |
| 130 | | - |
| 131 | /*! | - |
| 132 | \enum QGraphicsView::ViewportAnchor | - |
| 133 | | - |
| 134 | This enums describe the possible anchors that QGraphicsView can | - |
| 135 | use when the user resizes the view or when the view is | - |
| 136 | transformed. | - |
| 137 | | - |
| 138 | \value NoAnchor No anchor, i.e. the view leaves the scene's | - |
| 139 | position unchanged. | - |
| 140 | \value AnchorViewCenter The scene point at the center of the view | - |
| 141 | is used as the anchor. | - |
| 142 | \value AnchorUnderMouse The point under the mouse is used as the anchor. | - |
| 143 | | - |
| 144 | \sa resizeAnchor, transformationAnchor | - |
| 145 | */ | - |
| 146 | | - |
| 147 | /*! | - |
| 148 | \enum QGraphicsView::ViewportUpdateMode | - |
| 149 | | - |
| 150 | \since 4.3 | - |
| 151 | | - |
| 152 | This enum describes how QGraphicsView updates its viewport when the scene | - |
| 153 | contents change or are exposed. | - |
| 154 | | - |
| 155 | \value FullViewportUpdate When any visible part of the scene changes or is | - |
| 156 | reexposed, QGraphicsView will update the entire viewport. This approach is | - |
| 157 | fastest when QGraphicsView spends more time figuring out what to draw than | - |
| 158 | it would spend drawing (e.g., when very many small items are repeatedly | - |
| 159 | updated). This is the preferred update mode for viewports that do not | - |
| 160 | support partial updates, such as QGLWidget, and for viewports that need to | - |
| 161 | disable scroll optimization. | - |
| 162 | | - |
| 163 | \value MinimalViewportUpdate QGraphicsView will determine the minimal | - |
| 164 | viewport region that requires a redraw, minimizing the time spent drawing | - |
| 165 | by avoiding a redraw of areas that have not changed. This is | - |
| 166 | QGraphicsView's default mode. Although this approach provides the best | - |
| 167 | performance in general, if there are many small visible changes on the | - |
| 168 | scene, QGraphicsView might end up spending more time finding the minimal | - |
| 169 | approach than it will spend drawing. | - |
| 170 | | - |
| 171 | \value SmartViewportUpdate QGraphicsView will attempt to find an optimal | - |
| 172 | update mode by analyzing the areas that require a redraw. | - |
| 173 | | - |
| 174 | \value BoundingRectViewportUpdate The bounding rectangle of all changes in | - |
| 175 | the viewport will be redrawn. This mode has the advantage that | - |
| 176 | QGraphicsView searches only one region for changes, minimizing time spent | - |
| 177 | determining what needs redrawing. The disadvantage is that areas that have | - |
| 178 | not changed also need to be redrawn. | - |
| 179 | | - |
| 180 | \value NoViewportUpdate QGraphicsView will never update its viewport when | - |
| 181 | the scene changes; the user is expected to control all updates. This mode | - |
| 182 | disables all (potentially slow) item visibility testing in QGraphicsView, | - |
| 183 | and is suitable for scenes that either require a fixed frame rate, or where | - |
| 184 | the viewport is otherwise updated externally. | - |
| 185 | | - |
| 186 | \sa viewportUpdateMode | - |
| 187 | */ | - |
| 188 | | - |
| 189 | /*! | - |
| 190 | \enum QGraphicsView::OptimizationFlag | - |
| 191 | | - |
| 192 | \since 4.3 | - |
| 193 | | - |
| 194 | This enum describes flags that you can enable to improve rendering | - |
| 195 | performance in QGraphicsView. By default, none of these flags are set. | - |
| 196 | Note that setting a flag usually imposes a side effect, and this effect | - |
| 197 | can vary between paint devices and platforms. | - |
| 198 | | - |
| 199 | \value DontClipPainter This value is obsolete and has no effect. | - |
| 200 | | - |
| 201 | \value DontSavePainterState When rendering, QGraphicsView protects the | - |
| 202 | painter state (see QPainter::save()) when rendering the background or | - |
| 203 | foreground, and when rendering each item. This allows you to leave the | - |
| 204 | painter in an altered state (i.e., you can call QPainter::setPen() or | - |
| 205 | QPainter::setBrush() without restoring the state after painting). However, | - |
| 206 | if the items consistently do restore the state, you should enable this | - |
| 207 | flag to prevent QGraphicsView from doing the same. | - |
| 208 | | - |
| 209 | \value DontAdjustForAntialiasing Disables QGraphicsView's antialiasing | - |
| 210 | auto-adjustment of exposed areas. Items that render antialiased lines on | - |
| 211 | the boundaries of their QGraphicsItem::boundingRect() can end up rendering | - |
| 212 | parts of the line outside. To prevent rendering artifacts, QGraphicsView | - |
| 213 | expands all exposed regions by 2 pixels in all directions. If you enable | - |
| 214 | this flag, QGraphicsView will no longer perform these adjustments, | - |
| 215 | minimizing the areas that require redrawing, which improves performance. A | - |
| 216 | common side effect is that items that do draw with antialiasing can leave | - |
| 217 | painting traces behind on the scene as they are moved. | - |
| 218 | | - |
| 219 | \value IndirectPainting Since Qt 4.6, restore the old painting algorithm | - |
| 220 | that calls QGraphicsView::drawItems() and QGraphicsScene::drawItems(). | - |
| 221 | To be used only for compatibility with old code. | - |
| 222 | */ | - |
| 223 | | - |
| 224 | /*! | - |
| 225 | \enum QGraphicsView::CacheModeFlag | - |
| 226 | | - |
| 227 | This enum describes the flags that you can set for a QGraphicsView's cache | - |
| 228 | mode. | - |
| 229 | | - |
| 230 | \value CacheNone All painting is done directly onto the viewport. | - |
| 231 | | - |
| 232 | \value CacheBackground The background is cached. This affects both custom | - |
| 233 | backgrounds, and backgrounds based on the backgroundBrush property. When | - |
| 234 | this flag is enabled, QGraphicsView will allocate one pixmap with the full | - |
| 235 | size of the viewport. | - |
| 236 | | - |
| 237 | \sa cacheMode | - |
| 238 | */ | - |
| 239 | | - |
| 240 | /*! | - |
| 241 | \enum QGraphicsView::DragMode | - |
| 242 | | - |
| 243 | This enum describes the default action for the view when pressing and | - |
| 244 | dragging the mouse over the viewport. | - |
| 245 | | - |
| 246 | \value NoDrag Nothing happens; the mouse event is ignored. | - |
| 247 | | - |
| 248 | \value ScrollHandDrag The cursor changes into a pointing hand, and | - |
| 249 | dragging the mouse around will scroll the scrolbars. This mode works both | - |
| 250 | in \l{QGraphicsView::interactive}{interactive} and non-interactive mode. | - |
| 251 | | - |
| 252 | \value RubberBandDrag A rubber band will appear. Dragging the mouse will | - |
| 253 | set the rubber band geometry, and all items covered by the rubber band are | - |
| 254 | selected. This mode is disabled for non-interactive views. | - |
| 255 | | - |
| 256 | \sa dragMode, QGraphicsScene::setSelectionArea() | - |
| 257 | */ | - |
| 258 | | - |
| 259 | #include "qgraphicsview.h" | - |
| 260 | #include "qgraphicsview_p.h" | - |
| 261 | | - |
| 262 | #ifndef QT_NO_GRAPHICSVIEW | - |
| 263 | | - |
| 264 | #include "qgraphicsitem.h" | - |
| 265 | #include "qgraphicsitem_p.h" | - |
| 266 | #include "qgraphicsscene.h" | - |
| 267 | #include "qgraphicsscene_p.h" | - |
| 268 | #include "qgraphicssceneevent.h" | - |
| 269 | #include "qgraphicswidget.h" | - |
| 270 | | - |
| 271 | #include <QtCore/qdatetime.h> | - |
| 272 | #include <QtCore/qdebug.h> | - |
| 273 | #include <QtCore/qmath.h> | - |
| 274 | #include <QtCore/qscopedvaluerollback.h> | - |
| 275 | #include <QtWidgets/qapplication.h> | - |
| 276 | #include <QtWidgets/qdesktopwidget.h> | - |
| 277 | #include <QtGui/qevent.h> | - |
| 278 | #include <QtWidgets/qlayout.h> | - |
| 279 | #include <QtGui/qtransform.h> | - |
| 280 | #include <QtGui/qmatrix.h> | - |
| 281 | #include <QtGui/qpainter.h> | - |
| 282 | #include <QtWidgets/qscrollbar.h> | - |
| 283 | #include <QtWidgets/qstyleoption.h> | - |
| 284 | | - |
| 285 | #include <private/qevent_p.h> | - |
| 286 | | - |
| 287 | QT_BEGIN_NAMESPACE | - |
| 288 | | - |
| 289 | bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); | - |
| 290 | | - |
| 291 | inline int q_round_bound(qreal d) //### (int)(qreal) INT_MAX != INT_MAX for single precision | - |
| 292 | { | - |
| 293 | if (d <= (qreal) INT_MIN) evaluated: d <= (qreal) (-2147483647 - 1)| yes Evaluation Count:2 | yes Evaluation Count:14810 |
| 2-14810 |
| 294 | return INT_MIN; executed: return (-2147483647 - 1);Execution Count:2 | 2 |
| 295 | else if (d >= (qreal) INT_MAX) evaluated: d >= (qreal) 2147483647| yes Evaluation Count:2 | yes Evaluation Count:14808 |
| 2-14808 |
| 296 | return INT_MAX; executed: return 2147483647;Execution Count:2 | 2 |
| 297 | return d >= 0.0 ? int(d + 0.5) : int(d - int(d-1) + 0.5) + int(d-1); executed: return d >= 0.0 ? int(d + 0.5) : int(d - int(d-1) + 0.5) + int(d-1);Execution Count:14808 | 14808 |
| 298 | } | - |
| 299 | | - |
| 300 | void QGraphicsViewPrivate::translateTouchEvent(QGraphicsViewPrivate *d, QTouchEvent *touchEvent) | - |
| 301 | { | - |
| 302 | QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints(); never executed (the execution status of this line is deduced): QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints(); | - |
| 303 | for (int i = 0; i < touchPoints.count(); ++i) { never evaluated: i < touchPoints.count() | 0 |
| 304 | QTouchEvent::TouchPoint &touchPoint = touchPoints[i]; never executed (the execution status of this line is deduced): QTouchEvent::TouchPoint &touchPoint = touchPoints[i]; | - |
| 305 | // the scene will set the item local pos, startPos, lastPos, and rect before delivering to | - |
| 306 | // an item, but for now those functions are returning the view's local coordinates | - |
| 307 | touchPoint.setSceneRect(d->mapToScene(touchPoint.rect())); never executed (the execution status of this line is deduced): touchPoint.setSceneRect(d->mapToScene(touchPoint.rect())); | - |
| 308 | touchPoint.setStartScenePos(d->mapToScene(touchPoint.startPos())); never executed (the execution status of this line is deduced): touchPoint.setStartScenePos(d->mapToScene(touchPoint.startPos())); | - |
| 309 | touchPoint.setLastScenePos(d->mapToScene(touchPoint.lastPos())); never executed (the execution status of this line is deduced): touchPoint.setLastScenePos(d->mapToScene(touchPoint.lastPos())); | - |
| 310 | | - |
| 311 | // screenPos, startScreenPos, lastScreenPos, and screenRect are already set | - |
| 312 | } | 0 |
| 313 | | - |
| 314 | touchEvent->setTouchPoints(touchPoints); never executed (the execution status of this line is deduced): touchEvent->setTouchPoints(touchPoints); | - |
| 315 | } | 0 |
| 316 | | - |
| 317 | /*! | - |
| 318 | \internal | - |
| 319 | */ | - |
| 320 | QGraphicsViewPrivate::QGraphicsViewPrivate() | - |
| 321 | : renderHints(QPainter::TextAntialiasing), | - |
| 322 | dragMode(QGraphicsView::NoDrag), | - |
| 323 | sceneInteractionAllowed(true), hasSceneRect(false), | - |
| 324 | connectedToScene(false), | - |
| 325 | useLastMouseEvent(false), | - |
| 326 | identityMatrix(true), | - |
| 327 | dirtyScroll(true), | - |
| 328 | accelerateScrolling(true), | - |
| 329 | keepLastCenterPoint(true), | - |
| 330 | transforming(false), | - |
| 331 | handScrolling(false), | - |
| 332 | mustAllocateStyleOptions(false), | - |
| 333 | mustResizeBackgroundPixmap(true), | - |
| 334 | fullUpdatePending(true), | - |
| 335 | hasUpdateClip(false), | - |
| 336 | mousePressButton(Qt::NoButton), | - |
| 337 | leftIndent(0), topIndent(0), | - |
| 338 | lastMouseEvent(QEvent::None, QPointF(), QPointF(), QPointF(), Qt::NoButton, 0, 0), | - |
| 339 | alignment(Qt::AlignCenter), | - |
| 340 | transformationAnchor(QGraphicsView::AnchorViewCenter), resizeAnchor(QGraphicsView::NoAnchor), | - |
| 341 | viewportUpdateMode(QGraphicsView::MinimalViewportUpdate), | - |
| 342 | optimizationFlags(0), | - |
| 343 | scene(0), | - |
| 344 | #ifndef QT_NO_RUBBERBAND | - |
| 345 | rubberBanding(false), | - |
| 346 | rubberBandSelectionMode(Qt::IntersectsItemShape), | - |
| 347 | #endif | - |
| 348 | handScrollMotions(0), cacheMode(0), | - |
| 349 | #ifndef QT_NO_CURSOR | - |
| 350 | hasStoredOriginalCursor(false), | - |
| 351 | #endif | - |
| 352 | lastDragDropEvent(0), | - |
| 353 | updateSceneSlotReimplementedChecked(false) | - |
| 354 | { | - |
| 355 | styleOptions.reserve(QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS); executed (the execution status of this line is deduced): styleOptions.reserve(QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS); | - |
| 356 | } executed: }Execution Count:799 | 799 |
| 357 | | - |
| 358 | /*! | - |
| 359 | \internal | - |
| 360 | */ | - |
| 361 | void QGraphicsViewPrivate::recalculateContentSize() | - |
| 362 | { | - |
| 363 | Q_Q(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsView * const q = q_func(); | - |
| 364 | | - |
| 365 | QSize maxSize = q->maximumViewportSize(); executed (the execution status of this line is deduced): QSize maxSize = q->maximumViewportSize(); | - |
| 366 | int width = maxSize.width(); executed (the execution status of this line is deduced): int width = maxSize.width(); | - |
| 367 | int height = maxSize.height(); executed (the execution status of this line is deduced): int height = maxSize.height(); | - |
| 368 | QRectF viewRect = matrix.mapRect(q->sceneRect()); executed (the execution status of this line is deduced): QRectF viewRect = matrix.mapRect(q->sceneRect()); | - |
| 369 | | - |
| 370 | bool frameOnlyAround = (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)); executed (the execution status of this line is deduced): bool frameOnlyAround = (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)); | - |
| 371 | if (frameOnlyAround) { partially evaluated: frameOnlyAround| no Evaluation Count:0 | yes Evaluation Count:3703 |
| 0-3703 |
| 372 | if (hbarpolicy == Qt::ScrollBarAlwaysOn) never evaluated: hbarpolicy == Qt::ScrollBarAlwaysOn | 0 |
| 373 | height -= frameWidth * 2; never executed: height -= frameWidth * 2; | 0 |
| 374 | if (vbarpolicy == Qt::ScrollBarAlwaysOn) never evaluated: vbarpolicy == Qt::ScrollBarAlwaysOn | 0 |
| 375 | width -= frameWidth * 2; never executed: width -= frameWidth * 2; | 0 |
| 376 | } | 0 |
| 377 | | - |
| 378 | // Adjust the maximum width and height of the viewport based on the width | - |
| 379 | // of visible scroll bars. | - |
| 380 | int scrollBarExtent = q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q); executed (the execution status of this line is deduced): int scrollBarExtent = q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q); | - |
| 381 | if (frameOnlyAround) partially evaluated: frameOnlyAround| no Evaluation Count:0 | yes Evaluation Count:3703 |
| 0-3703 |
| 382 | scrollBarExtent += frameWidth * 2; never executed: scrollBarExtent += frameWidth * 2; | 0 |
| 383 | | - |
| 384 | // We do not need to subtract the width scrollbars whose policy is | - |
| 385 | // Qt::ScrollBarAlwaysOn, this was already done by maximumViewportSize(). | - |
| 386 | bool useHorizontalScrollBar = (viewRect.width() > width) && hbarpolicy == Qt::ScrollBarAsNeeded; evaluated: (viewRect.width() > width)| yes Evaluation Count:702 | yes Evaluation Count:3001 |
evaluated: hbarpolicy == Qt::ScrollBarAsNeeded| yes Evaluation Count:414 | yes Evaluation Count:288 |
| 288-3001 |
| 387 | bool useVerticalScrollBar = (viewRect.height() > height) && vbarpolicy == Qt::ScrollBarAsNeeded; evaluated: (viewRect.height() > height)| yes Evaluation Count:876 | yes Evaluation Count:2827 |
evaluated: vbarpolicy == Qt::ScrollBarAsNeeded| yes Evaluation Count:612 | yes Evaluation Count:264 |
| 264-2827 |
| 388 | if (useHorizontalScrollBar && vbarpolicy == Qt::ScrollBarAsNeeded) { evaluated: useHorizontalScrollBar| yes Evaluation Count:414 | yes Evaluation Count:3289 |
partially evaluated: vbarpolicy == Qt::ScrollBarAsNeeded| yes Evaluation Count:414 | no Evaluation Count:0 |
| 0-3289 |
| 389 | if (viewRect.height() > height - scrollBarExtent) evaluated: viewRect.height() > height - scrollBarExtent| yes Evaluation Count:393 | yes Evaluation Count:21 |
| 21-393 |
| 390 | useVerticalScrollBar = true; executed: useVerticalScrollBar = true;Execution Count:393 | 393 |
| 391 | } executed: }Execution Count:414 | 414 |
| 392 | if (useVerticalScrollBar && hbarpolicy == Qt::ScrollBarAsNeeded) { evaluated: useVerticalScrollBar| yes Evaluation Count:626 | yes Evaluation Count:3077 |
partially evaluated: hbarpolicy == Qt::ScrollBarAsNeeded| yes Evaluation Count:626 | no Evaluation Count:0 |
| 0-3077 |
| 393 | if (viewRect.width() > width - scrollBarExtent) evaluated: viewRect.width() > width - scrollBarExtent| yes Evaluation Count:407 | yes Evaluation Count:219 |
| 219-407 |
| 394 | useHorizontalScrollBar = true; executed: useHorizontalScrollBar = true;Execution Count:407 | 407 |
| 395 | } executed: }Execution Count:626 | 626 |
| 396 | if (useHorizontalScrollBar) evaluated: useHorizontalScrollBar| yes Evaluation Count:428 | yes Evaluation Count:3275 |
| 428-3275 |
| 397 | height -= scrollBarExtent; executed: height -= scrollBarExtent;Execution Count:428 | 428 |
| 398 | if (useVerticalScrollBar) evaluated: useVerticalScrollBar| yes Evaluation Count:626 | yes Evaluation Count:3077 |
| 626-3077 |
| 399 | width -= scrollBarExtent; executed: width -= scrollBarExtent;Execution Count:626 | 626 |
| 400 | | - |
| 401 | // Setting the ranges of these scroll bars can/will cause the values to | - |
| 402 | // change, and scrollContentsBy() will be called correspondingly. This | - |
| 403 | // will reset the last center point. | - |
| 404 | QPointF savedLastCenterPoint = lastCenterPoint; executed (the execution status of this line is deduced): QPointF savedLastCenterPoint = lastCenterPoint; | - |
| 405 | | - |
| 406 | // Remember the former indent settings | - |
| 407 | qreal oldLeftIndent = leftIndent; executed (the execution status of this line is deduced): qreal oldLeftIndent = leftIndent; | - |
| 408 | qreal oldTopIndent = topIndent; executed (the execution status of this line is deduced): qreal oldTopIndent = topIndent; | - |
| 409 | | - |
| 410 | // If the whole scene fits horizontally, we center the scene horizontally, | - |
| 411 | // and ignore the horizontal scroll bars. | - |
| 412 | int left = q_round_bound(viewRect.left()); executed (the execution status of this line is deduced): int left = q_round_bound(viewRect.left()); | - |
| 413 | int right = q_round_bound(viewRect.right() - width); executed (the execution status of this line is deduced): int right = q_round_bound(viewRect.right() - width); | - |
| 414 | if (left >= right) { evaluated: left >= right| yes Evaluation Count:2987 | yes Evaluation Count:716 |
| 716-2987 |
| 415 | hbar->setRange(0, 0); executed (the execution status of this line is deduced): hbar->setRange(0, 0); | - |
| 416 | | - |
| 417 | switch (alignment & Qt::AlignHorizontal_Mask) { | - |
| 418 | case Qt::AlignLeft: | - |
| 419 | leftIndent = -viewRect.left(); executed (the execution status of this line is deduced): leftIndent = -viewRect.left(); | - |
| 420 | break; executed: break;Execution Count:14 | 14 |
| 421 | case Qt::AlignRight: | - |
| 422 | leftIndent = width - viewRect.width() - viewRect.left() - 1; executed (the execution status of this line is deduced): leftIndent = width - viewRect.width() - viewRect.left() - 1; | - |
| 423 | break; executed: break;Execution Count:16 | 16 |
| 424 | case Qt::AlignHCenter: | - |
| 425 | default: | - |
| 426 | leftIndent = width / 2 - (viewRect.left() + viewRect.right()) / 2; executed (the execution status of this line is deduced): leftIndent = width / 2 - (viewRect.left() + viewRect.right()) / 2; | - |
| 427 | break; executed: break;Execution Count:2957 | 2957 |
| 428 | } | - |
| 429 | } else { executed: }Execution Count:2987 | 2987 |
| 430 | hbar->setRange(left, right); executed (the execution status of this line is deduced): hbar->setRange(left, right); | - |
| 431 | hbar->setPageStep(width); executed (the execution status of this line is deduced): hbar->setPageStep(width); | - |
| 432 | hbar->setSingleStep(width / 20); executed (the execution status of this line is deduced): hbar->setSingleStep(width / 20); | - |
| 433 | leftIndent = 0; executed (the execution status of this line is deduced): leftIndent = 0; | - |
| 434 | } executed: }Execution Count:716 | 716 |
| 435 | | - |
| 436 | // If the whole scene fits vertically, we center the scene vertically, and | - |
| 437 | // ignore the vertical scroll bars. | - |
| 438 | int top = q_round_bound(viewRect.top()); executed (the execution status of this line is deduced): int top = q_round_bound(viewRect.top()); | - |
| 439 | int bottom = q_round_bound(viewRect.bottom() - height); executed (the execution status of this line is deduced): int bottom = q_round_bound(viewRect.bottom() - height); | - |
| 440 | if (top >= bottom) { evaluated: top >= bottom| yes Evaluation Count:2813 | yes Evaluation Count:890 |
| 890-2813 |
| 441 | vbar->setRange(0, 0); executed (the execution status of this line is deduced): vbar->setRange(0, 0); | - |
| 442 | | - |
| 443 | switch (alignment & Qt::AlignVertical_Mask) { | - |
| 444 | case Qt::AlignTop: | - |
| 445 | topIndent = -viewRect.top(); executed (the execution status of this line is deduced): topIndent = -viewRect.top(); | - |
| 446 | break; executed: break;Execution Count:16 | 16 |
| 447 | case Qt::AlignBottom: | - |
| 448 | topIndent = height - viewRect.height() - viewRect.top() - 1; executed (the execution status of this line is deduced): topIndent = height - viewRect.height() - viewRect.top() - 1; | - |
| 449 | break; executed: break;Execution Count:14 | 14 |
| 450 | case Qt::AlignVCenter: | - |
| 451 | default: | - |
| 452 | topIndent = height / 2 - (viewRect.top() + viewRect.bottom()) / 2; executed (the execution status of this line is deduced): topIndent = height / 2 - (viewRect.top() + viewRect.bottom()) / 2; | - |
| 453 | break; executed: break;Execution Count:2783 | 2783 |
| 454 | } | - |
| 455 | } else { executed: }Execution Count:2813 | 2813 |
| 456 | vbar->setRange(top, bottom); executed (the execution status of this line is deduced): vbar->setRange(top, bottom); | - |
| 457 | vbar->setPageStep(height); executed (the execution status of this line is deduced): vbar->setPageStep(height); | - |
| 458 | vbar->setSingleStep(height / 20); executed (the execution status of this line is deduced): vbar->setSingleStep(height / 20); | - |
| 459 | topIndent = 0; executed (the execution status of this line is deduced): topIndent = 0; | - |
| 460 | } executed: }Execution Count:890 | 890 |
| 461 | | - |
| 462 | // Restorethe center point from before the ranges changed. | - |
| 463 | lastCenterPoint = savedLastCenterPoint; executed (the execution status of this line is deduced): lastCenterPoint = savedLastCenterPoint; | - |
| 464 | | - |
| 465 | // Issue a full update if the indents change. | - |
| 466 | // ### If the transform is still the same, we can get away with just a | - |
| 467 | // scroll instead. | - |
| 468 | if (oldLeftIndent != leftIndent || oldTopIndent != topIndent) { evaluated: oldLeftIndent != leftIndent| yes Evaluation Count:2305 | yes Evaluation Count:1398 |
evaluated: oldTopIndent != topIndent| yes Evaluation Count:85 | yes Evaluation Count:1313 |
| 85-2305 |
| 469 | dirtyScroll = true; executed (the execution status of this line is deduced): dirtyScroll = true; | - |
| 470 | updateAll(); executed (the execution status of this line is deduced): updateAll(); | - |
| 471 | } else if (q->isRightToLeft() && !leftIndent) { executed: }Execution Count:2390 evaluated: q->isRightToLeft()| yes Evaluation Count:4 | yes Evaluation Count:1309 |
partially evaluated: !leftIndent| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-2390 |
| 472 | // In reverse mode, the horizontal scroll always changes after the content | - |
| 473 | // size has changed, as the scroll is calculated by summing the min and | - |
| 474 | // max values of the range and subtracting the current value. In normal | - |
| 475 | // mode the scroll remains unchanged unless the indent has changed. | - |
| 476 | dirtyScroll = true; executed (the execution status of this line is deduced): dirtyScroll = true; | - |
| 477 | } executed: }Execution Count:4 | 4 |
| 478 | | - |
| 479 | if (cacheMode & QGraphicsView::CacheBackground) { partially evaluated: cacheMode & QGraphicsView::CacheBackground| no Evaluation Count:0 | yes Evaluation Count:3703 |
| 0-3703 |
| 480 | // Invalidate the background pixmap | - |
| 481 | mustResizeBackgroundPixmap = true; never executed (the execution status of this line is deduced): mustResizeBackgroundPixmap = true; | - |
| 482 | } | 0 |
| 483 | } executed: }Execution Count:3703 | 3703 |
| 484 | | - |
| 485 | /*! | - |
| 486 | \internal | - |
| 487 | */ | - |
| 488 | void QGraphicsViewPrivate::centerView(QGraphicsView::ViewportAnchor anchor) | - |
| 489 | { | - |
| 490 | Q_Q(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsView * const q = q_func(); | - |
| 491 | switch (anchor) { | - |
| 492 | case QGraphicsView::AnchorUnderMouse: { | - |
| 493 | if (q->underMouse()) { evaluated: q->underMouse()| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 494 | // Last scene pos: lastMouseMoveScenePoint | - |
| 495 | // Current mouse pos: | - |
| 496 | QPointF transformationDiff = q->mapToScene(viewport->rect().center()) executed (the execution status of this line is deduced): QPointF transformationDiff = q->mapToScene(viewport->rect().center()) | - |
| 497 | - q->mapToScene(viewport->mapFromGlobal(QCursor::pos())); executed (the execution status of this line is deduced): - q->mapToScene(viewport->mapFromGlobal(QCursor::pos())); | - |
| 498 | q->centerOn(lastMouseMoveScenePoint + transformationDiff); executed (the execution status of this line is deduced): q->centerOn(lastMouseMoveScenePoint + transformationDiff); | - |
| 499 | } else { executed: }Execution Count:1 | 1 |
| 500 | q->centerOn(lastCenterPoint); executed (the execution status of this line is deduced): q->centerOn(lastCenterPoint); | - |
| 501 | } executed: }Execution Count:1 | 1 |
| 502 | break; executed: break;Execution Count:2 | 2 |
| 503 | } | - |
| 504 | case QGraphicsView::AnchorViewCenter: | - |
| 505 | q->centerOn(lastCenterPoint); executed (the execution status of this line is deduced): q->centerOn(lastCenterPoint); | - |
| 506 | break; executed: break;Execution Count:1165 | 1165 |
| 507 | case QGraphicsView::NoAnchor: | - |
| 508 | break; executed: break;Execution Count:926 | 926 |
| 509 | } | - |
| 510 | } executed: }Execution Count:2093 | 2093 |
| 511 | | - |
| 512 | /*! | - |
| 513 | \internal | - |
| 514 | */ | - |
| 515 | void QGraphicsViewPrivate::updateLastCenterPoint() | - |
| 516 | { | - |
| 517 | Q_Q(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsView * const q = q_func(); | - |
| 518 | lastCenterPoint = q->mapToScene(viewport->rect().center()); executed (the execution status of this line is deduced): lastCenterPoint = q->mapToScene(viewport->rect().center()); | - |
| 519 | } executed: }Execution Count:2598 | 2598 |
| 520 | | - |
| 521 | /*! | - |
| 522 | \internal | - |
| 523 | | - |
| 524 | Returns the horizontal scroll value (the X value of the left edge of the | - |
| 525 | viewport). | - |
| 526 | */ | - |
| 527 | qint64 QGraphicsViewPrivate::horizontalScroll() const | - |
| 528 | { | - |
| 529 | if (dirtyScroll) evaluated: dirtyScroll| yes Evaluation Count:2555 | yes Evaluation Count:473161 |
| 2555-473161 |
| 530 | const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); executed: const_cast<QGraphicsViewPrivate *>(this)->updateScroll();Execution Count:2555 | 2555 |
| 531 | return scrollX; executed: return scrollX;Execution Count:475716 | 475716 |
| 532 | } | - |
| 533 | | - |
| 534 | /*! | - |
| 535 | \internal | - |
| 536 | | - |
| 537 | Returns the vertical scroll value (the X value of the top edge of the | - |
| 538 | viewport). | - |
| 539 | */ | - |
| 540 | qint64 QGraphicsViewPrivate::verticalScroll() const | - |
| 541 | { | - |
| 542 | if (dirtyScroll) evaluated: dirtyScroll| yes Evaluation Count:692 | yes Evaluation Count:473569 |
| 692-473569 |
| 543 | const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); executed: const_cast<QGraphicsViewPrivate *>(this)->updateScroll();Execution Count:692 | 692 |
| 544 | return scrollY; executed: return scrollY;Execution Count:474261 | 474261 |
| 545 | } | - |
| 546 | | - |
| 547 | /*! | - |
| 548 | \internal | - |
| 549 | | - |
| 550 | Maps the given rectangle to the scene using QTransform::mapRect() | - |
| 551 | */ | - |
| 552 | QRectF QGraphicsViewPrivate::mapRectToScene(const QRect &rect) const | - |
| 553 | { | - |
| 554 | if (dirtyScroll) partially evaluated: dirtyScroll| no Evaluation Count:0 | yes Evaluation Count:89 |
| 0-89 |
| 555 | const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); never executed: const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); | 0 |
| 556 | QRectF scrolled = QRectF(rect.translated(scrollX, scrollY)); executed (the execution status of this line is deduced): QRectF scrolled = QRectF(rect.translated(scrollX, scrollY)); | - |
| 557 | return identityMatrix ? scrolled : matrix.inverted().mapRect(scrolled); executed: return identityMatrix ? scrolled : matrix.inverted().mapRect(scrolled);Execution Count:89 | 89 |
| 558 | } | - |
| 559 | | - |
| 560 | | - |
| 561 | /*! | - |
| 562 | \internal | - |
| 563 | | - |
| 564 | Maps the given rectangle from the scene using QTransform::mapRect() | - |
| 565 | */ | - |
| 566 | QRectF QGraphicsViewPrivate::mapRectFromScene(const QRectF &rect) const | - |
| 567 | { | - |
| 568 | if (dirtyScroll) evaluated: dirtyScroll| yes Evaluation Count:5 | yes Evaluation Count:86 |
| 5-86 |
| 569 | const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); executed: const_cast<QGraphicsViewPrivate *>(this)->updateScroll();Execution Count:5 | 5 |
| 570 | return (identityMatrix ? rect : matrix.mapRect(rect)).translated(-scrollX, -scrollY); executed: return (identityMatrix ? rect : matrix.mapRect(rect)).translated(-scrollX, -scrollY);Execution Count:91 | 91 |
| 571 | } | - |
| 572 | | - |
| 573 | /*! | - |
| 574 | \internal | - |
| 575 | */ | - |
| 576 | void QGraphicsViewPrivate::updateScroll() | - |
| 577 | { | - |
| 578 | Q_Q(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsView * const q = q_func(); | - |
| 579 | scrollX = qint64(-leftIndent); executed (the execution status of this line is deduced): scrollX = qint64(-leftIndent); | - |
| 580 | if (q->isRightToLeft()) { evaluated: q->isRightToLeft()| yes Evaluation Count:6 | yes Evaluation Count:3246 |
| 6-3246 |
| 581 | if (!leftIndent) { partially evaluated: !leftIndent| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 582 | scrollX += hbar->minimum(); executed (the execution status of this line is deduced): scrollX += hbar->minimum(); | - |
| 583 | scrollX += hbar->maximum(); executed (the execution status of this line is deduced): scrollX += hbar->maximum(); | - |
| 584 | scrollX -= hbar->value(); executed (the execution status of this line is deduced): scrollX -= hbar->value(); | - |
| 585 | } executed: }Execution Count:6 | 6 |
| 586 | } else { executed: }Execution Count:6 | 6 |
| 587 | scrollX += hbar->value(); executed (the execution status of this line is deduced): scrollX += hbar->value(); | - |
| 588 | } executed: }Execution Count:3246 | 3246 |
| 589 | | - |
| 590 | scrollY = qint64(vbar->value() - topIndent); executed (the execution status of this line is deduced): scrollY = qint64(vbar->value() - topIndent); | - |
| 591 | | - |
| 592 | dirtyScroll = false; executed (the execution status of this line is deduced): dirtyScroll = false; | - |
| 593 | } executed: }Execution Count:3252 | 3252 |
| 594 | | - |
| 595 | /*! | - |
| 596 | \internal | - |
| 597 | */ | - |
| 598 | void QGraphicsViewPrivate::replayLastMouseEvent() | - |
| 599 | { | - |
| 600 | if (!useLastMouseEvent || !scene) evaluated: !useLastMouseEvent| yes Evaluation Count:2822 | yes Evaluation Count:23 |
evaluated: !scene| yes Evaluation Count:8 | yes Evaluation Count:15 |
| 8-2822 |
| 601 | return; executed: return;Execution Count:2830 | 2830 |
| 602 | mouseMoveEventHandler(&lastMouseEvent); executed (the execution status of this line is deduced): mouseMoveEventHandler(&lastMouseEvent); | - |
| 603 | } executed: }Execution Count:15 | 15 |
| 604 | | - |
| 605 | /*! | - |
| 606 | \internal | - |
| 607 | */ | - |
| 608 | void QGraphicsViewPrivate::storeMouseEvent(QMouseEvent *event) | - |
| 609 | { | - |
| 610 | useLastMouseEvent = true; executed (the execution status of this line is deduced): useLastMouseEvent = true; | - |
| 611 | lastMouseEvent = QMouseEvent(QEvent::MouseMove, event->localPos(), event->windowPos(), event->screenPos(), executed (the execution status of this line is deduced): lastMouseEvent = QMouseEvent(QEvent::MouseMove, event->localPos(), event->windowPos(), event->screenPos(), | - |
| 612 | event->button(), event->buttons(), event->modifiers()); executed (the execution status of this line is deduced): event->button(), event->buttons(), event->modifiers()); | - |
| 613 | } executed: }Execution Count:548 | 548 |
| 614 | | - |
| 615 | void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event) | - |
| 616 | { | - |
| 617 | Q_Q(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsView * const q = q_func(); | - |
| 618 | | - |
| 619 | #ifndef QT_NO_RUBBERBAND | - |
| 620 | updateRubberBand(event); executed (the execution status of this line is deduced): updateRubberBand(event); | - |
| 621 | #endif | - |
| 622 | | - |
| 623 | storeMouseEvent(event); executed (the execution status of this line is deduced): storeMouseEvent(event); | - |
| 624 | lastMouseEvent.setAccepted(false); executed (the execution status of this line is deduced): lastMouseEvent.setAccepted(false); | - |
| 625 | | - |
| 626 | if (!sceneInteractionAllowed) evaluated: !sceneInteractionAllowed| yes Evaluation Count:16 | yes Evaluation Count:83 |
| 16-83 |
| 627 | return; executed: return;Execution Count:16 | 16 |
| 628 | if (handScrolling) evaluated: handScrolling| yes Evaluation Count:24 | yes Evaluation Count:59 |
| 24-59 |
| 629 | return; executed: return;Execution Count:24 | 24 |
| 630 | if (!scene) evaluated: !scene| yes Evaluation Count:2 | yes Evaluation Count:57 |
| 2-57 |
| 631 | return; executed: return;Execution Count:2 | 2 |
| 632 | | - |
| 633 | QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove); executed (the execution status of this line is deduced): QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove); | - |
| 634 | mouseEvent.setWidget(viewport); executed (the execution status of this line is deduced): mouseEvent.setWidget(viewport); | - |
| 635 | mouseEvent.setButtonDownScenePos(mousePressButton, mousePressScenePoint); executed (the execution status of this line is deduced): mouseEvent.setButtonDownScenePos(mousePressButton, mousePressScenePoint); | - |
| 636 | mouseEvent.setButtonDownScreenPos(mousePressButton, mousePressScreenPoint); executed (the execution status of this line is deduced): mouseEvent.setButtonDownScreenPos(mousePressButton, mousePressScreenPoint); | - |
| 637 | mouseEvent.setScenePos(q->mapToScene(event->pos())); executed (the execution status of this line is deduced): mouseEvent.setScenePos(q->mapToScene(event->pos())); | - |
| 638 | mouseEvent.setScreenPos(event->globalPos()); executed (the execution status of this line is deduced): mouseEvent.setScreenPos(event->globalPos()); | - |
| 639 | mouseEvent.setLastScenePos(lastMouseMoveScenePoint); executed (the execution status of this line is deduced): mouseEvent.setLastScenePos(lastMouseMoveScenePoint); | - |
| 640 | mouseEvent.setLastScreenPos(lastMouseMoveScreenPoint); executed (the execution status of this line is deduced): mouseEvent.setLastScreenPos(lastMouseMoveScreenPoint); | - |
| 641 | mouseEvent.setButtons(event->buttons()); executed (the execution status of this line is deduced): mouseEvent.setButtons(event->buttons()); | - |
| 642 | mouseEvent.setButton(event->button()); executed (the execution status of this line is deduced): mouseEvent.setButton(event->button()); | - |
| 643 | mouseEvent.setModifiers(event->modifiers()); executed (the execution status of this line is deduced): mouseEvent.setModifiers(event->modifiers()); | - |
| 644 | lastMouseMoveScenePoint = mouseEvent.scenePos(); executed (the execution status of this line is deduced): lastMouseMoveScenePoint = mouseEvent.scenePos(); | - |
| 645 | lastMouseMoveScreenPoint = mouseEvent.screenPos(); executed (the execution status of this line is deduced): lastMouseMoveScreenPoint = mouseEvent.screenPos(); | - |
| 646 | mouseEvent.setAccepted(false); executed (the execution status of this line is deduced): mouseEvent.setAccepted(false); | - |
| 647 | if (event->spontaneous()) evaluated: event->spontaneous()| yes Evaluation Count:18 | yes Evaluation Count:39 |
| 18-39 |
| 648 | qt_sendSpontaneousEvent(scene, &mouseEvent); executed: qt_sendSpontaneousEvent(scene, &mouseEvent);Execution Count:18 | 18 |
| 649 | else | - |
| 650 | QApplication::sendEvent(scene, &mouseEvent); executed: QApplication::sendEvent(scene, &mouseEvent);Execution Count:39 | 39 |
| 651 | | - |
| 652 | // Remember whether the last event was accepted or not. | - |
| 653 | lastMouseEvent.setAccepted(mouseEvent.isAccepted()); executed (the execution status of this line is deduced): lastMouseEvent.setAccepted(mouseEvent.isAccepted()); | - |
| 654 | | - |
| 655 | if (mouseEvent.isAccepted() && mouseEvent.buttons() != 0) { evaluated: mouseEvent.isAccepted()| yes Evaluation Count:1 | yes Evaluation Count:56 |
partially evaluated: mouseEvent.buttons() != 0| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-56 |
| 656 | // The event was delivered to a mouse grabber; the press is likely to | - |
| 657 | // have set a cursor, and we must not change it. | - |
| 658 | return; executed: return;Execution Count:1 | 1 |
| 659 | } | - |
| 660 | | - |
| 661 | #ifndef QT_NO_CURSOR | - |
| 662 | // If all the items ignore hover events, we don't look-up any items | - |
| 663 | // in QGraphicsScenePrivate::dispatchHoverEvent, hence the | - |
| 664 | // cachedItemsUnderMouse list will be empty. We therefore do the look-up | - |
| 665 | // for cursor items here if not all items use the default cursor. | - |
| 666 | if (scene->d_func()->allItemsIgnoreHoverEvents && !scene->d_func()->allItemsUseDefaultCursor partially evaluated: scene->d_func()->allItemsIgnoreHoverEvents| yes Evaluation Count:56 | no Evaluation Count:0 |
evaluated: !scene->d_func()->allItemsUseDefaultCursor| yes Evaluation Count:37 | yes Evaluation Count:19 |
| 0-56 |
| 667 | && scene->d_func()->cachedItemsUnderMouse.isEmpty()) { partially evaluated: scene->d_func()->cachedItemsUnderMouse.isEmpty()| yes Evaluation Count:37 | no Evaluation Count:0 |
| 0-37 |
| 668 | scene->d_func()->cachedItemsUnderMouse = scene->d_func()->itemsAtPosition(mouseEvent.screenPos(), executed (the execution status of this line is deduced): scene->d_func()->cachedItemsUnderMouse = scene->d_func()->itemsAtPosition(mouseEvent.screenPos(), | - |
| 669 | mouseEvent.scenePos(), executed (the execution status of this line is deduced): mouseEvent.scenePos(), | - |
| 670 | mouseEvent.widget()); executed (the execution status of this line is deduced): mouseEvent.widget()); | - |
| 671 | } executed: }Execution Count:37 | 37 |
| 672 | // Find the topmost item under the mouse with a cursor. | - |
| 673 | foreach (QGraphicsItem *item, scene->d_func()->cachedItemsUnderMouse) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(scene->d_func()->cachedItemsUnderMouse)> _container_(scene->d_func()->cachedItemsUnderMouse); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 674 | if (item->hasCursor()) { evaluated: item->hasCursor()| yes Evaluation Count:20 | yes Evaluation Count:4 |
| 4-20 |
| 675 | _q_setViewportCursor(item->cursor()); executed (the execution status of this line is deduced): _q_setViewportCursor(item->cursor()); | - |
| 676 | return; executed: return;Execution Count:20 | 20 |
| 677 | } | - |
| 678 | } executed: }Execution Count:4 | 4 |
| 679 | | - |
| 680 | // No items with cursors found; revert to the view cursor. | - |
| 681 | if (hasStoredOriginalCursor) { evaluated: hasStoredOriginalCursor| yes Evaluation Count:6 | yes Evaluation Count:30 |
| 6-30 |
| 682 | // Restore the original viewport cursor. | - |
| 683 | hasStoredOriginalCursor = false; executed (the execution status of this line is deduced): hasStoredOriginalCursor = false; | - |
| 684 | viewport->setCursor(originalCursor); executed (the execution status of this line is deduced): viewport->setCursor(originalCursor); | - |
| 685 | } executed: }Execution Count:6 | 6 |
| 686 | #endif | - |
| 687 | } executed: }Execution Count:36 | 36 |
| 688 | | - |
| 689 | /*! | - |
| 690 | \internal | - |
| 691 | */ | - |
| 692 | #ifndef QT_NO_RUBBERBAND | - |
| 693 | QRegion QGraphicsViewPrivate::rubberBandRegion(const QWidget *widget, const QRect &rect) const | - |
| 694 | { | - |
| 695 | QStyleHintReturnMask mask; executed (the execution status of this line is deduced): QStyleHintReturnMask mask; | - |
| 696 | QStyleOptionRubberBand option; executed (the execution status of this line is deduced): QStyleOptionRubberBand option; | - |
| 697 | option.initFrom(widget); executed (the execution status of this line is deduced): option.initFrom(widget); | - |
| 698 | option.rect = rect; executed (the execution status of this line is deduced): option.rect = rect; | - |
| 699 | option.opaque = false; executed (the execution status of this line is deduced): option.opaque = false; | - |
| 700 | option.shape = QRubberBand::Rectangle; executed (the execution status of this line is deduced): option.shape = QRubberBand::Rectangle; | - |
| 701 | | - |
| 702 | QRegion tmp; executed (the execution status of this line is deduced): QRegion tmp; | - |
| 703 | tmp += rect; executed (the execution status of this line is deduced): tmp += rect; | - |
| 704 | if (widget->style()->styleHint(QStyle::SH_RubberBand_Mask, &option, widget, &mask)) partially evaluated: widget->style()->styleHint(QStyle::SH_RubberBand_Mask, &option, widget, &mask)| yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
| 705 | tmp &= mask.region; executed: tmp &= mask.region;Execution Count:13 | 13 |
| 706 | return tmp; executed: return tmp;Execution Count:13 | 13 |
| 707 | } | - |
| 708 | | - |
| 709 | void QGraphicsViewPrivate::updateRubberBand(QMouseEvent *event) | - |
| 710 | { | - |
| 711 | Q_Q(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsView * const q = q_func(); | - |
| 712 | if (dragMode == QGraphicsView::RubberBandDrag && sceneInteractionAllowed) { evaluated: dragMode == QGraphicsView::RubberBandDrag| yes Evaluation Count:7 | yes Evaluation Count:92 |
partially evaluated: sceneInteractionAllowed| yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-92 |
| 713 | storeMouseEvent(event); executed (the execution status of this line is deduced): storeMouseEvent(event); | - |
| 714 | if (rubberBanding) { partially evaluated: rubberBanding| yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
| 715 | // Check for enough drag distance | - |
| 716 | if ((mousePressViewPoint - event->pos()).manhattanLength() partially evaluated: (mousePressViewPoint - event->pos()).manhattanLength() < QApplication::startDragDistance()| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 717 | < QApplication::startDragDistance()) { partially evaluated: (mousePressViewPoint - event->pos()).manhattanLength() < QApplication::startDragDistance()| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 718 | return; | 0 |
| 719 | } | - |
| 720 | | - |
| 721 | // Update old rubberband | - |
| 722 | if (viewportUpdateMode != QGraphicsView::NoViewportUpdate && !rubberBandRect.isEmpty()) { partially evaluated: viewportUpdateMode != QGraphicsView::NoViewportUpdate| yes Evaluation Count:7 | no Evaluation Count:0 |
evaluated: !rubberBandRect.isEmpty()| yes Evaluation Count:4 | yes Evaluation Count:3 |
| 0-7 |
| 723 | if (viewportUpdateMode != QGraphicsView::FullViewportUpdate) partially evaluated: viewportUpdateMode != QGraphicsView::FullViewportUpdate| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 724 | q->viewport()->update(rubberBandRegion(q->viewport(), rubberBandRect)); executed: q->viewport()->update(rubberBandRegion(q->viewport(), rubberBandRect));Execution Count:4 | 4 |
| 725 | else | - |
| 726 | updateAll(); never executed: updateAll(); | 0 |
| 727 | } | - |
| 728 | | - |
| 729 | // Stop rubber banding if the user has let go of all buttons (even | - |
| 730 | // if we didn't get the release events). | - |
| 731 | if (!event->buttons()) { partially evaluated: !event->buttons()| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 732 | rubberBanding = false; never executed (the execution status of this line is deduced): rubberBanding = false; | - |
| 733 | rubberBandRect = QRect(); never executed (the execution status of this line is deduced): rubberBandRect = QRect(); | - |
| 734 | return; | 0 |
| 735 | } | - |
| 736 | | - |
| 737 | // Update rubberband position | - |
| 738 | const QPoint mp = q->mapFromScene(mousePressScenePoint); executed (the execution status of this line is deduced): const QPoint mp = q->mapFromScene(mousePressScenePoint); | - |
| 739 | const QPoint ep = event->pos(); executed (the execution status of this line is deduced): const QPoint ep = event->pos(); | - |
| 740 | rubberBandRect = QRect(qMin(mp.x(), ep.x()), qMin(mp.y(), ep.y()), executed (the execution status of this line is deduced): rubberBandRect = QRect(qMin(mp.x(), ep.x()), qMin(mp.y(), ep.y()), | - |
| 741 | qAbs(mp.x() - ep.x()) + 1, qAbs(mp.y() - ep.y()) + 1); executed (the execution status of this line is deduced): qAbs(mp.x() - ep.x()) + 1, qAbs(mp.y() - ep.y()) + 1); | - |
| 742 | | - |
| 743 | // Update new rubberband | - |
| 744 | if (viewportUpdateMode != QGraphicsView::NoViewportUpdate){ partially evaluated: viewportUpdateMode != QGraphicsView::NoViewportUpdate| yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
| 745 | if (viewportUpdateMode != QGraphicsView::FullViewportUpdate) partially evaluated: viewportUpdateMode != QGraphicsView::FullViewportUpdate| yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
| 746 | q->viewport()->update(rubberBandRegion(q->viewport(), rubberBandRect)); executed: q->viewport()->update(rubberBandRegion(q->viewport(), rubberBandRect));Execution Count:7 | 7 |
| 747 | else | - |
| 748 | updateAll(); never executed: updateAll(); | 0 |
| 749 | } | - |
| 750 | // Set the new selection area | - |
| 751 | QPainterPath selectionArea; executed (the execution status of this line is deduced): QPainterPath selectionArea; | - |
| 752 | selectionArea.addPolygon(mapToScene(rubberBandRect)); executed (the execution status of this line is deduced): selectionArea.addPolygon(mapToScene(rubberBandRect)); | - |
| 753 | selectionArea.closeSubpath(); executed (the execution status of this line is deduced): selectionArea.closeSubpath(); | - |
| 754 | if (scene) evaluated: scene| yes Evaluation Count:5 | yes Evaluation Count:2 |
| 2-5 |
| 755 | scene->setSelectionArea(selectionArea, rubberBandSelectionMode, executed: scene->setSelectionArea(selectionArea, rubberBandSelectionMode, q->viewportTransform());Execution Count:5 | 5 |
| 756 | q->viewportTransform()); executed: scene->setSelectionArea(selectionArea, rubberBandSelectionMode, q->viewportTransform());Execution Count:5 | 5 |
| 757 | } executed: }Execution Count:7 | 7 |
| 758 | } executed: }Execution Count:7 | 7 |
| 759 | } executed: }Execution Count:99 | 99 |
| 760 | #endif | - |
| 761 | | - |
| 762 | /*! | - |
| 763 | \internal | - |
| 764 | */ | - |
| 765 | #ifndef QT_NO_CURSOR | - |
| 766 | void QGraphicsViewPrivate::_q_setViewportCursor(const QCursor &cursor) | - |
| 767 | { | - |
| 768 | if (!hasStoredOriginalCursor) { evaluated: !hasStoredOriginalCursor| yes Evaluation Count:7 | yes Evaluation Count:14 |
| 7-14 |
| 769 | hasStoredOriginalCursor = true; executed (the execution status of this line is deduced): hasStoredOriginalCursor = true; | - |
| 770 | originalCursor = viewport->cursor(); executed (the execution status of this line is deduced): originalCursor = viewport->cursor(); | - |
| 771 | } executed: }Execution Count:7 | 7 |
| 772 | viewport->setCursor(cursor); executed (the execution status of this line is deduced): viewport->setCursor(cursor); | - |
| 773 | } executed: }Execution Count:21 | 21 |
| 774 | #endif | - |
| 775 | | - |
| 776 | /*! | - |
| 777 | \internal | - |
| 778 | */ | - |
| 779 | #ifndef QT_NO_CURSOR | - |
| 780 | void QGraphicsViewPrivate::_q_unsetViewportCursor() | - |
| 781 | { | - |
| 782 | Q_Q(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsView * const q = q_func(); | - |
| 783 | foreach (QGraphicsItem *item, q->items(lastMouseEvent.pos())) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(q->items(lastMouseEvent.pos()))> _container_(q->items(lastMouseEvent.pos())); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem *item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 784 | if (item->hasCursor()) { partially evaluated: item->hasCursor()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 785 | _q_setViewportCursor(item->cursor()); never executed (the execution status of this line is deduced): _q_setViewportCursor(item->cursor()); | - |
| 786 | return; | 0 |
| 787 | } | - |
| 788 | } executed: }Execution Count:1 | 1 |
| 789 | | - |
| 790 | // Restore the original viewport cursor. | - |
| 791 | if (hasStoredOriginalCursor) { partially evaluated: hasStoredOriginalCursor| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 792 | hasStoredOriginalCursor = false; never executed (the execution status of this line is deduced): hasStoredOriginalCursor = false; | - |
| 793 | if (dragMode == QGraphicsView::ScrollHandDrag) never evaluated: dragMode == QGraphicsView::ScrollHandDrag | 0 |
| 794 | viewport->setCursor(Qt::OpenHandCursor); never executed: viewport->setCursor(Qt::OpenHandCursor); | 0 |
| 795 | else | - |
| 796 | viewport->setCursor(originalCursor); never executed: viewport->setCursor(originalCursor); | 0 |
| 797 | } | - |
| 798 | } executed: }Execution Count:1 | 1 |
| 799 | #endif | - |
| 800 | | - |
| 801 | /*! | - |
| 802 | \internal | - |
| 803 | */ | - |
| 804 | void QGraphicsViewPrivate::storeDragDropEvent(const QGraphicsSceneDragDropEvent *event) | - |
| 805 | { | - |
| 806 | delete lastDragDropEvent; never executed (the execution status of this line is deduced): delete lastDragDropEvent; | - |
| 807 | lastDragDropEvent = new QGraphicsSceneDragDropEvent(event->type()); never executed (the execution status of this line is deduced): lastDragDropEvent = new QGraphicsSceneDragDropEvent(event->type()); | - |
| 808 | lastDragDropEvent->setScenePos(event->scenePos()); never executed (the execution status of this line is deduced): lastDragDropEvent->setScenePos(event->scenePos()); | - |
| 809 | lastDragDropEvent->setScreenPos(event->screenPos()); never executed (the execution status of this line is deduced): lastDragDropEvent->setScreenPos(event->screenPos()); | - |
| 810 | lastDragDropEvent->setButtons(event->buttons()); never executed (the execution status of this line is deduced): lastDragDropEvent->setButtons(event->buttons()); | - |
| 811 | lastDragDropEvent->setModifiers(event->modifiers()); never executed (the execution status of this line is deduced): lastDragDropEvent->setModifiers(event->modifiers()); | - |
| 812 | lastDragDropEvent->setPossibleActions(event->possibleActions()); never executed (the execution status of this line is deduced): lastDragDropEvent->setPossibleActions(event->possibleActions()); | - |
| 813 | lastDragDropEvent->setProposedAction(event->proposedAction()); never executed (the execution status of this line is deduced): lastDragDropEvent->setProposedAction(event->proposedAction()); | - |
| 814 | lastDragDropEvent->setDropAction(event->dropAction()); never executed (the execution status of this line is deduced): lastDragDropEvent->setDropAction(event->dropAction()); | - |
| 815 | lastDragDropEvent->setMimeData(event->mimeData()); never executed (the execution status of this line is deduced): lastDragDropEvent->setMimeData(event->mimeData()); | - |
| 816 | lastDragDropEvent->setWidget(event->widget()); never executed (the execution status of this line is deduced): lastDragDropEvent->setWidget(event->widget()); | - |
| 817 | lastDragDropEvent->setSource(event->source()); never executed (the execution status of this line is deduced): lastDragDropEvent->setSource(event->source()); | - |
| 818 | } | 0 |
| 819 | | - |
| 820 | /*! | - |
| 821 | \internal | - |
| 822 | */ | - |
| 823 | void QGraphicsViewPrivate::populateSceneDragDropEvent(QGraphicsSceneDragDropEvent *dest, | - |
| 824 | QDropEvent *source) | - |
| 825 | { | - |
| 826 | #ifndef QT_NO_DRAGANDDROP | - |
| 827 | Q_Q(QGraphicsView); never executed (the execution status of this line is deduced): QGraphicsView * const q = q_func(); | - |
| 828 | dest->setScenePos(q->mapToScene(source->pos())); never executed (the execution status of this line is deduced): dest->setScenePos(q->mapToScene(source->pos())); | - |
| 829 | dest->setScreenPos(q->mapToGlobal(source->pos())); never executed (the execution status of this line is deduced): dest->setScreenPos(q->mapToGlobal(source->pos())); | - |
| 830 | dest->setButtons(source->mouseButtons()); never executed (the execution status of this line is deduced): dest->setButtons(source->mouseButtons()); | - |
| 831 | dest->setModifiers(source->keyboardModifiers()); never executed (the execution status of this line is deduced): dest->setModifiers(source->keyboardModifiers()); | - |
| 832 | dest->setPossibleActions(source->possibleActions()); never executed (the execution status of this line is deduced): dest->setPossibleActions(source->possibleActions()); | - |
| 833 | dest->setProposedAction(source->proposedAction()); never executed (the execution status of this line is deduced): dest->setProposedAction(source->proposedAction()); | - |
| 834 | dest->setDropAction(source->dropAction()); never executed (the execution status of this line is deduced): dest->setDropAction(source->dropAction()); | - |
| 835 | dest->setMimeData(source->mimeData()); never executed (the execution status of this line is deduced): dest->setMimeData(source->mimeData()); | - |
| 836 | dest->setWidget(viewport); never executed (the execution status of this line is deduced): dest->setWidget(viewport); | - |
| 837 | dest->setSource(qobject_cast<QWidget *>(source->source())); never executed (the execution status of this line is deduced): dest->setSource(qobject_cast<QWidget *>(source->source())); | - |
| 838 | #else | - |
| 839 | Q_UNUSED(dest) | - |
| 840 | Q_UNUSED(source) | - |
| 841 | #endif | - |
| 842 | } | 0 |
| 843 | | - |
| 844 | /*! | - |
| 845 | \internal | - |
| 846 | */ | - |
| 847 | QRect QGraphicsViewPrivate::mapToViewRect(const QGraphicsItem *item, const QRectF &rect) const | - |
| 848 | { | - |
| 849 | Q_Q(const QGraphicsView); never executed (the execution status of this line is deduced): const QGraphicsView * const q = q_func(); | - |
| 850 | if (dirtyScroll) never evaluated: dirtyScroll | 0 |
| 851 | const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); never executed: const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); | 0 |
| 852 | | - |
| 853 | if (item->d_ptr->itemIsUntransformable()) { never evaluated: item->d_ptr->itemIsUntransformable() | 0 |
| 854 | QTransform itv = item->deviceTransform(q->viewportTransform()); never executed (the execution status of this line is deduced): QTransform itv = item->deviceTransform(q->viewportTransform()); | - |
| 855 | return itv.mapRect(rect).toAlignedRect(); never executed: return itv.mapRect(rect).toAlignedRect(); | 0 |
| 856 | } | - |
| 857 | | - |
| 858 | // Translate-only | - |
| 859 | // COMBINE | - |
| 860 | QPointF offset; never executed (the execution status of this line is deduced): QPointF offset; | - |
| 861 | const QGraphicsItem *parentItem = item; never executed (the execution status of this line is deduced): const QGraphicsItem *parentItem = item; | - |
| 862 | const QGraphicsItemPrivate *itemd; never executed (the execution status of this line is deduced): const QGraphicsItemPrivate *itemd; | - |
| 863 | do { | - |
| 864 | itemd = parentItem->d_ptr.data(); never executed (the execution status of this line is deduced): itemd = parentItem->d_ptr.data(); | - |
| 865 | if (itemd->transformData) never evaluated: itemd->transformData | 0 |
| 866 | break; | 0 |
| 867 | offset += itemd->pos; never executed (the execution status of this line is deduced): offset += itemd->pos; | - |
| 868 | } while ((parentItem = itemd->parent)); never executed: } never evaluated: (parentItem = itemd->parent) | 0 |
| 869 | | - |
| 870 | QRectF baseRect = rect.translated(offset.x(), offset.y()); never executed (the execution status of this line is deduced): QRectF baseRect = rect.translated(offset.x(), offset.y()); | - |
| 871 | if (!parentItem) { never evaluated: !parentItem | 0 |
| 872 | if (identityMatrix) { never evaluated: identityMatrix | 0 |
| 873 | baseRect.translate(-scrollX, -scrollY); never executed (the execution status of this line is deduced): baseRect.translate(-scrollX, -scrollY); | - |
| 874 | return baseRect.toAlignedRect(); never executed: return baseRect.toAlignedRect(); | 0 |
| 875 | } | - |
| 876 | return matrix.mapRect(baseRect).translated(-scrollX, -scrollY).toAlignedRect(); never executed: return matrix.mapRect(baseRect).translated(-scrollX, -scrollY).toAlignedRect(); | 0 |
| 877 | } | - |
| 878 | | - |
| 879 | QTransform tr = parentItem->sceneTransform(); never executed (the execution status of this line is deduced): QTransform tr = parentItem->sceneTransform(); | - |
| 880 | if (!identityMatrix) never evaluated: !identityMatrix | 0 |
| 881 | tr *= matrix; never executed: tr *= matrix; | 0 |
| 882 | QRectF r = tr.mapRect(baseRect); never executed (the execution status of this line is deduced): QRectF r = tr.mapRect(baseRect); | - |
| 883 | r.translate(-scrollX, -scrollY); never executed (the execution status of this line is deduced): r.translate(-scrollX, -scrollY); | - |
| 884 | return r.toAlignedRect(); never executed: return r.toAlignedRect(); | 0 |
| 885 | } | - |
| 886 | | - |
| 887 | /*! | - |
| 888 | \internal | - |
| 889 | */ | - |
| 890 | QRegion QGraphicsViewPrivate::mapToViewRegion(const QGraphicsItem *item, const QRectF &rect) const | - |
| 891 | { | - |
| 892 | Q_Q(const QGraphicsView); never executed (the execution status of this line is deduced): const QGraphicsView * const q = q_func(); | - |
| 893 | if (dirtyScroll) never evaluated: dirtyScroll | 0 |
| 894 | const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); never executed: const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); | 0 |
| 895 | | - |
| 896 | // Accurate bounding region | - |
| 897 | QTransform itv = item->deviceTransform(q->viewportTransform()); never executed (the execution status of this line is deduced): QTransform itv = item->deviceTransform(q->viewportTransform()); | - |
| 898 | return item->boundingRegion(itv) & itv.mapRect(rect).toAlignedRect(); never executed: return item->boundingRegion(itv) & itv.mapRect(rect).toAlignedRect(); | 0 |
| 899 | } | - |
| 900 | | - |
| 901 | /*! | - |
| 902 | \internal | - |
| 903 | */ | - |
| 904 | void QGraphicsViewPrivate::processPendingUpdates() | - |
| 905 | { | - |
| 906 | if (!scene) partially evaluated: !scene| no Evaluation Count:0 | yes Evaluation Count:965 |
| 0-965 |
| 907 | return; | 0 |
| 908 | | - |
| 909 | if (fullUpdatePending) { evaluated: fullUpdatePending| yes Evaluation Count:759 | yes Evaluation Count:206 |
| 206-759 |
| 910 | viewport->update(); executed (the execution status of this line is deduced): viewport->update(); | - |
| 911 | } else if (viewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate) { executed: }Execution Count:759 partially evaluated: viewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate| no Evaluation Count:0 | yes Evaluation Count:206 |
| 0-759 |
| 912 | viewport->update(dirtyBoundingRect); never executed (the execution status of this line is deduced): viewport->update(dirtyBoundingRect); | - |
| 913 | } else { | 0 |
| 914 | viewport->update(dirtyRegion); // Already adjusted in updateRect/Region. executed (the execution status of this line is deduced): viewport->update(dirtyRegion); | - |
| 915 | } executed: }Execution Count:206 | 206 |
| 916 | | - |
| 917 | dirtyBoundingRect = QRect(); executed (the execution status of this line is deduced): dirtyBoundingRect = QRect(); | - |
| 918 | dirtyRegion = QRegion(); executed (the execution status of this line is deduced): dirtyRegion = QRegion(); | - |
| 919 | } executed: }Execution Count:965 | 965 |
| 920 | | - |
| 921 | static inline bool intersectsViewport(const QRect &r, int width, int height) | - |
| 922 | { return !(r.left() > width) && !(r.right() < 0) && !(r.top() >= height) && !(r.bottom() < 0); } executed: return !(r.left() > width) && !(r.right() < 0) && !(r.top() >= height) && !(r.bottom() < 0);Execution Count:824 | 824 |
| 923 | | - |
| 924 | static inline bool containsViewport(const QRect &r, int width, int height) | - |
| 925 | { return r.left() <= 0 && r.top() <= 0 && r.right() >= width - 1 && r.bottom() >= height - 1; } never executed: return r.left() <= 0 && r.top() <= 0 && r.right() >= width - 1 && r.bottom() >= height - 1; | 0 |
| 926 | | - |
| 927 | static inline void QRect_unite(QRect *rect, const QRect &other) | - |
| 928 | { | - |
| 929 | if (rect->isEmpty()) { never evaluated: rect->isEmpty() | 0 |
| 930 | *rect = other; never executed (the execution status of this line is deduced): *rect = other; | - |
| 931 | } else { | 0 |
| 932 | rect->setCoords(qMin(rect->left(), other.left()), qMin(rect->top(), other.top()), never executed (the execution status of this line is deduced): rect->setCoords(qMin(rect->left(), other.left()), qMin(rect->top(), other.top()), | - |
| 933 | qMax(rect->right(), other.right()), qMax(rect->bottom(), other.bottom())); never executed (the execution status of this line is deduced): qMax(rect->right(), other.right()), qMax(rect->bottom(), other.bottom())); | - |
| 934 | } | 0 |
| 935 | } | - |
| 936 | | - |
| 937 | /* | - |
| 938 | Calling this function results in update rects being clipped to the item's | - |
| 939 | bounding rect. Note that updates prior to this function call is not clipped. | - |
| 940 | The clip is removed by passing 0. | - |
| 941 | */ | - |
| 942 | void QGraphicsViewPrivate::setUpdateClip(QGraphicsItem *item) | - |
| 943 | { | - |
| 944 | Q_Q(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsView * const q = q_func(); | - |
| 945 | // We simply ignore the request if the update mode is either FullViewportUpdate | - |
| 946 | // or NoViewportUpdate; in that case there's no point in clipping anything. | - |
| 947 | if (!item || viewportUpdateMode == QGraphicsView::NoViewportUpdate evaluated: !item| yes Evaluation Count:8 | yes Evaluation Count:7 |
partially evaluated: viewportUpdateMode == QGraphicsView::NoViewportUpdate| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-8 |
| 948 | || viewportUpdateMode == QGraphicsView::FullViewportUpdate) { partially evaluated: viewportUpdateMode == QGraphicsView::FullViewportUpdate| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 949 | hasUpdateClip = false; executed (the execution status of this line is deduced): hasUpdateClip = false; | - |
| 950 | return; executed: return;Execution Count:8 | 8 |
| 951 | } | - |
| 952 | | - |
| 953 | // Calculate the clip (item's bounding rect in view coordinates). | - |
| 954 | // Optimized version of: | - |
| 955 | // QRect clip = item->deviceTransform(q->viewportTransform()) | - |
| 956 | // .mapRect(item->boundingRect()).toAlignedRect(); | - |
| 957 | QRect clip; executed (the execution status of this line is deduced): QRect clip; | - |
| 958 | if (item->d_ptr->itemIsUntransformable()) { partially evaluated: item->d_ptr->itemIsUntransformable()| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 959 | QTransform xform = item->deviceTransform(q->viewportTransform()); never executed (the execution status of this line is deduced): QTransform xform = item->deviceTransform(q->viewportTransform()); | - |
| 960 | clip = xform.mapRect(item->boundingRect()).toAlignedRect(); never executed (the execution status of this line is deduced): clip = xform.mapRect(item->boundingRect()).toAlignedRect(); | - |
| 961 | } else if (item->d_ptr->sceneTransformTranslateOnly && identityMatrix) { never executed: } partially evaluated: item->d_ptr->sceneTransformTranslateOnly| yes Evaluation Count:7 | no Evaluation Count:0 |
partially evaluated: identityMatrix| yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
| 962 | QRectF r(item->boundingRect()); executed (the execution status of this line is deduced): QRectF r(item->boundingRect()); | - |
| 963 | r.translate(item->d_ptr->sceneTransform.dx() - horizontalScroll(), executed (the execution status of this line is deduced): r.translate(item->d_ptr->sceneTransform.dx() - horizontalScroll(), | - |
| 964 | item->d_ptr->sceneTransform.dy() - verticalScroll()); executed (the execution status of this line is deduced): item->d_ptr->sceneTransform.dy() - verticalScroll()); | - |
| 965 | clip = r.toAlignedRect(); executed (the execution status of this line is deduced): clip = r.toAlignedRect(); | - |
| 966 | } else if (!q->isTransformed()) { executed: }Execution Count:7 never evaluated: !q->isTransformed() | 0-7 |
| 967 | clip = item->d_ptr->sceneTransform.mapRect(item->boundingRect()).toAlignedRect(); never executed (the execution status of this line is deduced): clip = item->d_ptr->sceneTransform.mapRect(item->boundingRect()).toAlignedRect(); | - |
| 968 | } else { | 0 |
| 969 | QTransform xform = item->d_ptr->sceneTransform; never executed (the execution status of this line is deduced): QTransform xform = item->d_ptr->sceneTransform; | - |
| 970 | xform *= q->viewportTransform(); never executed (the execution status of this line is deduced): xform *= q->viewportTransform(); | - |
| 971 | clip = xform.mapRect(item->boundingRect()).toAlignedRect(); never executed (the execution status of this line is deduced): clip = xform.mapRect(item->boundingRect()).toAlignedRect(); | - |
| 972 | } | 0 |
| 973 | | - |
| 974 | if (hasUpdateClip) { evaluated: hasUpdateClip| yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
| 975 | // Intersect with old clip. | - |
| 976 | updateClip &= clip; executed (the execution status of this line is deduced): updateClip &= clip; | - |
| 977 | } else { executed: }Execution Count:2 | 2 |
| 978 | updateClip = clip; executed (the execution status of this line is deduced): updateClip = clip; | - |
| 979 | hasUpdateClip = true; executed (the execution status of this line is deduced): hasUpdateClip = true; | - |
| 980 | } executed: }Execution Count:5 | 5 |
| 981 | } | - |
| 982 | | - |
| 983 | bool QGraphicsViewPrivate::updateRegion(const QRectF &rect, const QTransform &xform) | - |
| 984 | { | - |
| 985 | if (rect.isEmpty()) never evaluated: rect.isEmpty() | 0 |
| 986 | return false; never executed: return false; | 0 |
| 987 | | - |
| 988 | if (viewportUpdateMode != QGraphicsView::MinimalViewportUpdate never evaluated: viewportUpdateMode != QGraphicsView::MinimalViewportUpdate | 0 |
| 989 | && viewportUpdateMode != QGraphicsView::SmartViewportUpdate) { never evaluated: viewportUpdateMode != QGraphicsView::SmartViewportUpdate | 0 |
| 990 | // No point in updating with QRegion granularity; use the rect instead. | - |
| 991 | return updateRectF(xform.mapRect(rect)); never executed: return updateRectF(xform.mapRect(rect)); | 0 |
| 992 | } | - |
| 993 | | - |
| 994 | // Update mode is either Minimal or Smart, so we have to do a potentially slow operation, | - |
| 995 | // which is clearly documented here: QGraphicsItem::setBoundingRegionGranularity. | - |
| 996 | const QRegion region = xform.map(QRegion(rect.toAlignedRect())); never executed (the execution status of this line is deduced): const QRegion region = xform.map(QRegion(rect.toAlignedRect())); | - |
| 997 | QRect viewRect = region.boundingRect(); never executed (the execution status of this line is deduced): QRect viewRect = region.boundingRect(); | - |
| 998 | const bool dontAdjustForAntialiasing = optimizationFlags & QGraphicsView::DontAdjustForAntialiasing; never executed (the execution status of this line is deduced): const bool dontAdjustForAntialiasing = optimizationFlags & QGraphicsView::DontAdjustForAntialiasing; | - |
| 999 | if (dontAdjustForAntialiasing) never evaluated: dontAdjustForAntialiasing | 0 |
| 1000 | viewRect.adjust(-1, -1, 1, 1); never executed: viewRect.adjust(-1, -1, 1, 1); | 0 |
| 1001 | else | - |
| 1002 | viewRect.adjust(-2, -2, 2, 2); never executed: viewRect.adjust(-2, -2, 2, 2); | 0 |
| 1003 | if (!intersectsViewport(viewRect, viewport->width(), viewport->height())) never evaluated: !intersectsViewport(viewRect, viewport->width(), viewport->height()) | 0 |
| 1004 | return false; // Update region for sure outside viewport. never executed: return false; | 0 |
| 1005 | | - |
| 1006 | const QVector<QRect> &rects = region.rects(); never executed (the execution status of this line is deduced): const QVector<QRect> &rects = region.rects(); | - |
| 1007 | for (int i = 0; i < rects.size(); ++i) { never evaluated: i < rects.size() | 0 |
| 1008 | viewRect = rects.at(i); never executed (the execution status of this line is deduced): viewRect = rects.at(i); | - |
| 1009 | if (dontAdjustForAntialiasing) never evaluated: dontAdjustForAntialiasing | 0 |
| 1010 | viewRect.adjust(-1, -1, 1, 1); never executed: viewRect.adjust(-1, -1, 1, 1); | 0 |
| 1011 | else | - |
| 1012 | viewRect.adjust(-2, -2, 2, 2); never executed: viewRect.adjust(-2, -2, 2, 2); | 0 |
| 1013 | if (hasUpdateClip) never evaluated: hasUpdateClip | 0 |
| 1014 | viewRect &= updateClip; never executed: viewRect &= updateClip; | 0 |
| 1015 | dirtyRegion += viewRect; never executed (the execution status of this line is deduced): dirtyRegion += viewRect; | - |
| 1016 | } | 0 |
| 1017 | | - |
| 1018 | return true; never executed: return true; | 0 |
| 1019 | } | - |
| 1020 | | - |
| 1021 | // NB! Assumes the rect 'r' is already aligned and adjusted for antialiasing. | - |
| 1022 | // For QRectF use updateRectF(const QRectF &) to ensure proper adjustments. | - |
| 1023 | bool QGraphicsViewPrivate::updateRect(const QRect &r) | - |
| 1024 | { | - |
| 1025 | if (fullUpdatePending || viewportUpdateMode == QGraphicsView::NoViewportUpdate evaluated: fullUpdatePending| yes Evaluation Count:5 | yes Evaluation Count:827 |
evaluated: viewportUpdateMode == QGraphicsView::NoViewportUpdate| yes Evaluation Count:3 | yes Evaluation Count:824 |
| 3-827 |
| 1026 | || !intersectsViewport(r, viewport->width(), viewport->height())) { evaluated: !intersectsViewport(r, viewport->width(), viewport->height())| yes Evaluation Count:28 | yes Evaluation Count:796 |
| 28-796 |
| 1027 | return false; executed: return false;Execution Count:36 | 36 |
| 1028 | } | - |
| 1029 | | - |
| 1030 | switch (viewportUpdateMode) { | - |
| 1031 | case QGraphicsView::FullViewportUpdate: | - |
| 1032 | fullUpdatePending = true; executed (the execution status of this line is deduced): fullUpdatePending = true; | - |
| 1033 | viewport->update(); executed (the execution status of this line is deduced): viewport->update(); | - |
| 1034 | break; executed: break;Execution Count:1 | 1 |
| 1035 | case QGraphicsView::BoundingRectViewportUpdate: | - |
| 1036 | if (hasUpdateClip) never evaluated: hasUpdateClip | 0 |
| 1037 | QRect_unite(&dirtyBoundingRect, r & updateClip); never executed: QRect_unite(&dirtyBoundingRect, r & updateClip); | 0 |
| 1038 | else | - |
| 1039 | QRect_unite(&dirtyBoundingRect, r); never executed: QRect_unite(&dirtyBoundingRect, r); | 0 |
| 1040 | if (containsViewport(dirtyBoundingRect, viewport->width(), viewport->height())) { never evaluated: containsViewport(dirtyBoundingRect, viewport->width(), viewport->height()) | 0 |
| 1041 | fullUpdatePending = true; never executed (the execution status of this line is deduced): fullUpdatePending = true; | - |
| 1042 | viewport->update(); never executed (the execution status of this line is deduced): viewport->update(); | - |
| 1043 | } | 0 |
| 1044 | break; | 0 |
| 1045 | case QGraphicsView::SmartViewportUpdate: // ### DEPRECATE | - |
| 1046 | case QGraphicsView::MinimalViewportUpdate: | - |
| 1047 | if (hasUpdateClip) evaluated: hasUpdateClip| yes Evaluation Count:2 | yes Evaluation Count:793 |
| 2-793 |
| 1048 | dirtyRegion += r & updateClip; executed: dirtyRegion += r & updateClip;Execution Count:2 | 2 |
| 1049 | else | - |
| 1050 | dirtyRegion += r; executed: dirtyRegion += r;Execution Count:793 | 793 |
| 1051 | break; executed: break;Execution Count:795 | 795 |
| 1052 | default: | - |
| 1053 | break; | 0 |
| 1054 | } | - |
| 1055 | | - |
| 1056 | return true; executed: return true;Execution Count:796 | 796 |
| 1057 | } | - |
| 1058 | | - |
| 1059 | QStyleOptionGraphicsItem *QGraphicsViewPrivate::allocStyleOptionsArray(int numItems) | - |
| 1060 | { | - |
| 1061 | if (mustAllocateStyleOptions || (numItems > styleOptions.capacity())) partially evaluated: mustAllocateStyleOptions| no Evaluation Count:0 | yes Evaluation Count:7 |
partially evaluated: (numItems > styleOptions.capacity())| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 1062 | // too many items, let's allocate on-the-fly | - |
| 1063 | return new QStyleOptionGraphicsItem[numItems]; never executed: return new QStyleOptionGraphicsItem[numItems]; | 0 |
| 1064 | | - |
| 1065 | // expand only whenever necessary | - |
| 1066 | if (numItems > styleOptions.size()) evaluated: numItems > styleOptions.size()| yes Evaluation Count:4 | yes Evaluation Count:3 |
| 3-4 |
| 1067 | styleOptions.resize(numItems); executed: styleOptions.resize(numItems);Execution Count:4 | 4 |
| 1068 | | - |
| 1069 | mustAllocateStyleOptions = true; executed (the execution status of this line is deduced): mustAllocateStyleOptions = true; | - |
| 1070 | return styleOptions.data(); executed: return styleOptions.data();Execution Count:7 | 7 |
| 1071 | } | - |
| 1072 | | - |
| 1073 | void QGraphicsViewPrivate::freeStyleOptionsArray(QStyleOptionGraphicsItem *array) | - |
| 1074 | { | - |
| 1075 | mustAllocateStyleOptions = false; executed (the execution status of this line is deduced): mustAllocateStyleOptions = false; | - |
| 1076 | if (array != styleOptions.data()) partially evaluated: array != styleOptions.data()| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 1077 | delete [] array; never executed: delete [] array; | 0 |
| 1078 | } executed: }Execution Count:7 | 7 |
| 1079 | | - |
| 1080 | extern QPainterPath qt_regionToPath(const QRegion ®ion); | - |
| 1081 | | - |
| 1082 | /*! | - |
| 1083 | ### Adjustments in findItems: mapToScene(QRect) forces us to adjust the | - |
| 1084 | input rectangle by (0, 0, 1, 1), because it uses QRect::bottomRight() | - |
| 1085 | (etc) when mapping the rectangle to a polygon (which is _wrong_). In | - |
| 1086 | addition, as QGraphicsItem::boundingRect() is defined in logical space, | - |
| 1087 | but the default pen for QPainter is cosmetic with a width of 0, QPainter | - |
| 1088 | is at risk of painting 1 pixel outside the bounding rect. Therefore we | - |
| 1089 | must search for items with an adjustment of (-1, -1, 1, 1). | - |
| 1090 | */ | - |
| 1091 | QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedRegion, bool *allItems, | - |
| 1092 | const QTransform &viewTransform) const | - |
| 1093 | { | - |
| 1094 | Q_Q(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsView * const q = q_func(); | - |
| 1095 | | - |
| 1096 | // Step 1) If all items are contained within the expose region, then | - |
| 1097 | // return a list of all visible items. ### the scene's growing bounding | - |
| 1098 | // rect does not take into account untransformable items. | - |
| 1099 | const QRectF exposedRegionSceneBounds = q->mapToScene(exposedRegion.boundingRect().adjusted(-1, -1, 1, 1)) executed (the execution status of this line is deduced): const QRectF exposedRegionSceneBounds = q->mapToScene(exposedRegion.boundingRect().adjusted(-1, -1, 1, 1)) | - |
| 1100 | .boundingRect(); executed (the execution status of this line is deduced): .boundingRect(); | - |
| 1101 | if (exposedRegionSceneBounds.contains(scene->sceneRect())) { partially evaluated: exposedRegionSceneBounds.contains(scene->sceneRect())| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 1102 | Q_ASSERT(allItems); executed (the execution status of this line is deduced): qt_noop(); | - |
| 1103 | *allItems = true; executed (the execution status of this line is deduced): *allItems = true; | - |
| 1104 | | - |
| 1105 | // All items are guaranteed within the exposed region. | - |
| 1106 | return scene->items(Qt::AscendingOrder); executed: return scene->items(Qt::AscendingOrder);Execution Count:6 | 6 |
| 1107 | } | - |
| 1108 | | - |
| 1109 | // Step 2) If the expose region is a simple rect and the view is only | - |
| 1110 | // translated or scaled, search for items using | - |
| 1111 | // QGraphicsScene::items(QRectF). | - |
| 1112 | bool simpleRectLookup = exposedRegion.rectCount() == 1 && matrix.type() <= QTransform::TxScale; never evaluated: exposedRegion.rectCount() == 1 never evaluated: matrix.type() <= QTransform::TxScale | 0 |
| 1113 | if (simpleRectLookup) { never evaluated: simpleRectLookup | 0 |
| 1114 | return scene->items(exposedRegionSceneBounds, never executed: return scene->items(exposedRegionSceneBounds, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, viewTransform); | 0 |
| 1115 | Qt::IntersectsItemBoundingRect, never executed: return scene->items(exposedRegionSceneBounds, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, viewTransform); | 0 |
| 1116 | Qt::AscendingOrder, viewTransform); never executed: return scene->items(exposedRegionSceneBounds, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, viewTransform); | 0 |
| 1117 | } | - |
| 1118 | | - |
| 1119 | // If the region is complex or the view has a complex transform, adjust | - |
| 1120 | // the expose region, convert it to a path, and then search for items | - |
| 1121 | // using QGraphicsScene::items(QPainterPath); | - |
| 1122 | QRegion adjustedRegion; never executed (the execution status of this line is deduced): QRegion adjustedRegion; | - |
| 1123 | foreach (const QRect &r, exposedRegion.rects()) never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(exposedRegion.rects())> _container_(exposedRegion.rects()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QRect &r = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 1124 | adjustedRegion += r.adjusted(-1, -1, 1, 1); never executed: adjustedRegion += r.adjusted(-1, -1, 1, 1); | 0 |
| 1125 | | - |
| 1126 | const QPainterPath exposedScenePath(q->mapToScene(qt_regionToPath(adjustedRegion))); never executed (the execution status of this line is deduced): const QPainterPath exposedScenePath(q->mapToScene(qt_regionToPath(adjustedRegion))); | - |
| 1127 | return scene->items(exposedScenePath, Qt::IntersectsItemBoundingRect, never executed: return scene->items(exposedScenePath, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, viewTransform); | 0 |
| 1128 | Qt::AscendingOrder, viewTransform); never executed: return scene->items(exposedScenePath, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, viewTransform); | 0 |
| 1129 | } | - |
| 1130 | | - |
| 1131 | /*! | - |
| 1132 | \internal | - |
| 1133 | | - |
| 1134 | Enables input methods for the view if and only if the current focus item of | - |
| 1135 | the scene accepts input methods. Call function whenever that condition has | - |
| 1136 | potentially changed. | - |
| 1137 | */ | - |
| 1138 | void QGraphicsViewPrivate::updateInputMethodSensitivity() | - |
| 1139 | { | - |
| 1140 | Q_Q(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsView * const q = q_func(); | - |
| 1141 | QGraphicsItem *focusItem = 0; executed (the execution status of this line is deduced): QGraphicsItem *focusItem = 0; | - |
| 1142 | bool enabled = scene && (focusItem = scene->focusItem()) evaluated: scene| yes Evaluation Count:2736 | yes Evaluation Count:33 |
evaluated: (focusItem = scene->focusItem())| yes Evaluation Count:17 | yes Evaluation Count:2719 |
| 17-2736 |
| 1143 | && (focusItem->d_ptr->flags & QGraphicsItem::ItemAcceptsInputMethod); evaluated: (focusItem->d_ptr->flags & QGraphicsItem::ItemAcceptsInputMethod)| yes Evaluation Count:11 | yes Evaluation Count:6 |
| 6-11 |
| 1144 | q->setAttribute(Qt::WA_InputMethodEnabled, enabled); executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_InputMethodEnabled, enabled); | - |
| 1145 | q->viewport()->setAttribute(Qt::WA_InputMethodEnabled, enabled); executed (the execution status of this line is deduced): q->viewport()->setAttribute(Qt::WA_InputMethodEnabled, enabled); | - |
| 1146 | | - |
| 1147 | if (!enabled) { evaluated: !enabled| yes Evaluation Count:2758 | yes Evaluation Count:11 |
| 11-2758 |
| 1148 | q->setInputMethodHints(0); executed (the execution status of this line is deduced): q->setInputMethodHints(0); | - |
| 1149 | return; executed: return;Execution Count:2758 | 2758 |
| 1150 | } | - |
| 1151 | | - |
| 1152 | QGraphicsProxyWidget *proxy = focusItem->d_ptr->isWidget && focusItem->d_ptr->isProxyWidget() partially evaluated: focusItem->d_ptr->isWidget| no Evaluation Count:0 | yes Evaluation Count:11 |
never evaluated: focusItem->d_ptr->isProxyWidget() | 0-11 |
| 1153 | ? static_cast<QGraphicsProxyWidget *>(focusItem) : 0; never executed (the execution status of this line is deduced): ? static_cast<QGraphicsProxyWidget *>(focusItem) : 0; | - |
| 1154 | if (!proxy) { partially evaluated: !proxy| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 1155 | q->setInputMethodHints(focusItem->inputMethodHints()); executed (the execution status of this line is deduced): q->setInputMethodHints(focusItem->inputMethodHints()); | - |
| 1156 | } else if (QWidget *widget = proxy->widget()) { executed: }Execution Count:11 never evaluated: QWidget *widget = proxy->widget() | 0-11 |
| 1157 | if (QWidget *fw = widget->focusWidget()) never evaluated: QWidget *fw = widget->focusWidget() | 0 |
| 1158 | widget = fw; never executed: widget = fw; | 0 |
| 1159 | q->setInputMethodHints(widget->inputMethodHints()); never executed (the execution status of this line is deduced): q->setInputMethodHints(widget->inputMethodHints()); | - |
| 1160 | } else { | 0 |
| 1161 | q->setInputMethodHints(0); never executed (the execution status of this line is deduced): q->setInputMethodHints(0); | - |
| 1162 | } | 0 |
| 1163 | } | - |
| 1164 | | - |
| 1165 | /*! | - |
| 1166 | Constructs a QGraphicsView. \a parent is passed to QWidget's constructor. | - |
| 1167 | */ | - |
| 1168 | QGraphicsView::QGraphicsView(QWidget *parent) | - |
| 1169 | : QAbstractScrollArea(*new QGraphicsViewPrivate, parent) | - |
| 1170 | { | - |
| 1171 | setViewport(0); executed (the execution status of this line is deduced): setViewport(0); | - |
| 1172 | setAcceptDrops(true); executed (the execution status of this line is deduced): setAcceptDrops(true); | - |
| 1173 | setBackgroundRole(QPalette::Base); executed (the execution status of this line is deduced): setBackgroundRole(QPalette::Base); | - |
| 1174 | // Investigate leaving these disabled by default. | - |
| 1175 | setAttribute(Qt::WA_InputMethodEnabled); executed (the execution status of this line is deduced): setAttribute(Qt::WA_InputMethodEnabled); | - |
| 1176 | viewport()->setAttribute(Qt::WA_InputMethodEnabled); executed (the execution status of this line is deduced): viewport()->setAttribute(Qt::WA_InputMethodEnabled); | - |
| 1177 | } executed: }Execution Count:45 | 45 |
| 1178 | | - |
| 1179 | /*! | - |
| 1180 | Constructs a QGraphicsView and sets the visualized scene to \a | - |
| 1181 | scene. \a parent is passed to QWidget's constructor. | - |
| 1182 | */ | - |
| 1183 | QGraphicsView::QGraphicsView(QGraphicsScene *scene, QWidget *parent) | - |
| 1184 | : QAbstractScrollArea(*new QGraphicsViewPrivate, parent) | - |
| 1185 | { | - |
| 1186 | setScene(scene); executed (the execution status of this line is deduced): setScene(scene); | - |
| 1187 | setViewport(0); executed (the execution status of this line is deduced): setViewport(0); | - |
| 1188 | setAcceptDrops(true); executed (the execution status of this line is deduced): setAcceptDrops(true); | - |
| 1189 | setBackgroundRole(QPalette::Base); executed (the execution status of this line is deduced): setBackgroundRole(QPalette::Base); | - |
| 1190 | // Investigate leaving these disabled by default. | - |
| 1191 | setAttribute(Qt::WA_InputMethodEnabled); executed (the execution status of this line is deduced): setAttribute(Qt::WA_InputMethodEnabled); | - |
| 1192 | viewport()->setAttribute(Qt::WA_InputMethodEnabled); executed (the execution status of this line is deduced): viewport()->setAttribute(Qt::WA_InputMethodEnabled); | - |
| 1193 | } executed: }Execution Count:754 | 754 |
| 1194 | | - |
| 1195 | /*! | - |
| 1196 | \internal | - |
| 1197 | */ | - |
| 1198 | QGraphicsView::QGraphicsView(QGraphicsViewPrivate &dd, QWidget *parent) | - |
| 1199 | : QAbstractScrollArea(dd, parent) | - |
| 1200 | { | - |
| 1201 | setViewport(0); never executed (the execution status of this line is deduced): setViewport(0); | - |
| 1202 | setAcceptDrops(true); never executed (the execution status of this line is deduced): setAcceptDrops(true); | - |
| 1203 | setBackgroundRole(QPalette::Base); never executed (the execution status of this line is deduced): setBackgroundRole(QPalette::Base); | - |
| 1204 | // Investigate leaving these disabled by default. | - |
| 1205 | setAttribute(Qt::WA_InputMethodEnabled); never executed (the execution status of this line is deduced): setAttribute(Qt::WA_InputMethodEnabled); | - |
| 1206 | viewport()->setAttribute(Qt::WA_InputMethodEnabled); never executed (the execution status of this line is deduced): viewport()->setAttribute(Qt::WA_InputMethodEnabled); | - |
| 1207 | } | 0 |
| 1208 | | - |
| 1209 | /*! | - |
| 1210 | Destructs the QGraphicsView object. | - |
| 1211 | */ | - |
| 1212 | QGraphicsView::~QGraphicsView() | - |
| 1213 | { | - |
| 1214 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1215 | if (d->scene) evaluated: d->scene| yes Evaluation Count:761 | yes Evaluation Count:31 |
| 31-761 |
| 1216 | d->scene->d_func()->views.removeAll(this); executed: d->scene->d_func()->views.removeAll(this);Execution Count:761 | 761 |
| 1217 | delete d->lastDragDropEvent; executed (the execution status of this line is deduced): delete d->lastDragDropEvent; | - |
| 1218 | } executed: }Execution Count:792 | 792 |
| 1219 | | - |
| 1220 | /*! | - |
| 1221 | \reimp | - |
| 1222 | */ | - |
| 1223 | QSize QGraphicsView::sizeHint() const | - |
| 1224 | { | - |
| 1225 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 1226 | if (d->scene) { evaluated: d->scene| yes Evaluation Count:210 | yes Evaluation Count:46 |
| 46-210 |
| 1227 | QSizeF baseSize = d->matrix.mapRect(sceneRect()).size(); executed (the execution status of this line is deduced): QSizeF baseSize = d->matrix.mapRect(sceneRect()).size(); | - |
| 1228 | baseSize += QSizeF(d->frameWidth * 2, d->frameWidth * 2); executed (the execution status of this line is deduced): baseSize += QSizeF(d->frameWidth * 2, d->frameWidth * 2); | - |
| 1229 | return baseSize.boundedTo((3 * QApplication::desktop()->size()) / 4).toSize(); executed: return baseSize.boundedTo((3 * QApplication::desktop()->size()) / 4).toSize();Execution Count:210 | 210 |
| 1230 | } | - |
| 1231 | return QAbstractScrollArea::sizeHint(); executed: return QAbstractScrollArea::sizeHint();Execution Count:46 | 46 |
| 1232 | } | - |
| 1233 | | - |
| 1234 | /*! | - |
| 1235 | \property QGraphicsView::renderHints | - |
| 1236 | \brief the default render hints for the view | - |
| 1237 | | - |
| 1238 | These hints are | - |
| 1239 | used to initialize QPainter before each visible item is drawn. QPainter | - |
| 1240 | uses render hints to toggle rendering features such as antialiasing and | - |
| 1241 | smooth pixmap transformation. | - |
| 1242 | | - |
| 1243 | QPainter::TextAntialiasing is enabled by default. | - |
| 1244 | | - |
| 1245 | Example: | - |
| 1246 | | - |
| 1247 | \snippet code/src_gui_graphicsview_qgraphicsview.cpp 1 | - |
| 1248 | */ | - |
| 1249 | QPainter::RenderHints QGraphicsView::renderHints() const | - |
| 1250 | { | - |
| 1251 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 1252 | return d->renderHints; executed: return d->renderHints;Execution Count:15 | 15 |
| 1253 | } | - |
| 1254 | void QGraphicsView::setRenderHints(QPainter::RenderHints hints) | - |
| 1255 | { | - |
| 1256 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1257 | if (hints == d->renderHints) partially evaluated: hints == d->renderHints| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 1258 | return; | 0 |
| 1259 | d->renderHints = hints; executed (the execution status of this line is deduced): d->renderHints = hints; | - |
| 1260 | d->updateAll(); executed (the execution status of this line is deduced): d->updateAll(); | - |
| 1261 | } executed: }Execution Count:3 | 3 |
| 1262 | | - |
| 1263 | /*! | - |
| 1264 | If \a enabled is true, the render hint \a hint is enabled; otherwise it | - |
| 1265 | is disabled. | - |
| 1266 | | - |
| 1267 | \sa renderHints | - |
| 1268 | */ | - |
| 1269 | void QGraphicsView::setRenderHint(QPainter::RenderHint hint, bool enabled) | - |
| 1270 | { | - |
| 1271 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1272 | QPainter::RenderHints oldHints = d->renderHints; executed (the execution status of this line is deduced): QPainter::RenderHints oldHints = d->renderHints; | - |
| 1273 | if (enabled) evaluated: enabled| yes Evaluation Count:402 | yes Evaluation Count:21 |
| 21-402 |
| 1274 | d->renderHints |= hint; executed: d->renderHints |= hint;Execution Count:402 | 402 |
| 1275 | else | - |
| 1276 | d->renderHints &= ~hint; executed: d->renderHints &= ~hint;Execution Count:21 | 21 |
| 1277 | if (oldHints != d->renderHints) evaluated: oldHints != d->renderHints| yes Evaluation Count:403 | yes Evaluation Count:20 |
| 20-403 |
| 1278 | d->updateAll(); executed: d->updateAll();Execution Count:403 | 403 |
| 1279 | } executed: }Execution Count:423 | 423 |
| 1280 | | - |
| 1281 | /*! | - |
| 1282 | \property QGraphicsView::alignment | - |
| 1283 | \brief the alignment of the scene in the view when the whole | - |
| 1284 | scene is visible. | - |
| 1285 | | - |
| 1286 | If the whole scene is visible in the view, (i.e., there are no visible | - |
| 1287 | scroll bars,) the view's alignment will decide where the scene will be | - |
| 1288 | rendered in the view. For example, if the alignment is Qt::AlignCenter, | - |
| 1289 | which is default, the scene will be centered in the view, and if the | - |
| 1290 | alignment is (Qt::AlignLeft | Qt::AlignTop), the scene will be rendered in | - |
| 1291 | the top-left corner of the view. | - |
| 1292 | */ | - |
| 1293 | Qt::Alignment QGraphicsView::alignment() const | - |
| 1294 | { | - |
| 1295 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 1296 | return d->alignment; executed: return d->alignment;Execution Count:9 | 9 |
| 1297 | } | - |
| 1298 | void QGraphicsView::setAlignment(Qt::Alignment alignment) | - |
| 1299 | { | - |
| 1300 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1301 | if (d->alignment != alignment) { partially evaluated: d->alignment != alignment| yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
| 1302 | d->alignment = alignment; executed (the execution status of this line is deduced): d->alignment = alignment; | - |
| 1303 | d->recalculateContentSize(); executed (the execution status of this line is deduced): d->recalculateContentSize(); | - |
| 1304 | } executed: }Execution Count:15 | 15 |
| 1305 | } executed: }Execution Count:15 | 15 |
| 1306 | | - |
| 1307 | /*! | - |
| 1308 | \property QGraphicsView::transformationAnchor | - |
| 1309 | \brief how the view should position the scene during transformations. | - |
| 1310 | | - |
| 1311 | QGraphicsView uses this property to decide how to position the scene in | - |
| 1312 | the viewport when the transformation matrix changes, and the coordinate | - |
| 1313 | system of the view is transformed. The default behavior, AnchorViewCenter, | - |
| 1314 | ensures that the scene point at the center of the view remains unchanged | - |
| 1315 | during transformations (e.g., when rotating, the scene will appear to | - |
| 1316 | rotate around the center of the view). | - |
| 1317 | | - |
| 1318 | Note that the effect of this property is noticeable when only a part of the | - |
| 1319 | scene is visible (i.e., when there are scroll bars). Otherwise, if the | - |
| 1320 | whole scene fits in the view, QGraphicsScene uses the view \l alignment to | - |
| 1321 | position the scene in the view. | - |
| 1322 | | - |
| 1323 | \sa alignment, resizeAnchor | - |
| 1324 | */ | - |
| 1325 | QGraphicsView::ViewportAnchor QGraphicsView::transformationAnchor() const | - |
| 1326 | { | - |
| 1327 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 1328 | return d->transformationAnchor; executed: return d->transformationAnchor;Execution Count:2 | 2 |
| 1329 | } | - |
| 1330 | void QGraphicsView::setTransformationAnchor(ViewportAnchor anchor) | - |
| 1331 | { | - |
| 1332 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1333 | d->transformationAnchor = anchor; executed (the execution status of this line is deduced): d->transformationAnchor = anchor; | - |
| 1334 | | - |
| 1335 | // Ensure mouse tracking is enabled in the case we are using AnchorUnderMouse | - |
| 1336 | // in order to have up-to-date information for centering the view. | - |
| 1337 | if (d->transformationAnchor == AnchorUnderMouse) evaluated: d->transformationAnchor == AnchorUnderMouse| yes Evaluation Count:5 | yes Evaluation Count:12 |
| 5-12 |
| 1338 | d->viewport->setMouseTracking(true); executed: d->viewport->setMouseTracking(true);Execution Count:5 | 5 |
| 1339 | } executed: }Execution Count:17 | 17 |
| 1340 | | - |
| 1341 | /*! | - |
| 1342 | \property QGraphicsView::resizeAnchor | - |
| 1343 | \brief how the view should position the scene when the view is resized. | - |
| 1344 | | - |
| 1345 | QGraphicsView uses this property to decide how to position the scene in | - |
| 1346 | the viewport when the viewport widget's size changes. The default | - |
| 1347 | behavior, NoAnchor, leaves the scene's position unchanged during a resize; | - |
| 1348 | the top-left corner of the view will appear to be anchored while resizing. | - |
| 1349 | | - |
| 1350 | Note that the effect of this property is noticeable when only a part of the | - |
| 1351 | scene is visible (i.e., when there are scroll bars). Otherwise, if the | - |
| 1352 | whole scene fits in the view, QGraphicsScene uses the view \l alignment to | - |
| 1353 | position the scene in the view. | - |
| 1354 | | - |
| 1355 | \sa alignment, transformationAnchor | - |
| 1356 | */ | - |
| 1357 | QGraphicsView::ViewportAnchor QGraphicsView::resizeAnchor() const | - |
| 1358 | { | - |
| 1359 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 1360 | return d->resizeAnchor; executed: return d->resizeAnchor;Execution Count:2 | 2 |
| 1361 | } | - |
| 1362 | void QGraphicsView::setResizeAnchor(ViewportAnchor anchor) | - |
| 1363 | { | - |
| 1364 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1365 | d->resizeAnchor = anchor; executed (the execution status of this line is deduced): d->resizeAnchor = anchor; | - |
| 1366 | | - |
| 1367 | // Ensure mouse tracking is enabled in the case we are using AnchorUnderMouse | - |
| 1368 | // in order to have up-to-date information for centering the view. | - |
| 1369 | if (d->resizeAnchor == AnchorUnderMouse) evaluated: d->resizeAnchor == AnchorUnderMouse| yes Evaluation Count:4 | yes Evaluation Count:11 |
| 4-11 |
| 1370 | d->viewport->setMouseTracking(true); executed: d->viewport->setMouseTracking(true);Execution Count:4 | 4 |
| 1371 | } executed: }Execution Count:15 | 15 |
| 1372 | | - |
| 1373 | /*! | - |
| 1374 | \property QGraphicsView::viewportUpdateMode | - |
| 1375 | \brief how the viewport should update its contents. | - |
| 1376 | | - |
| 1377 | \since 4.3 | - |
| 1378 | | - |
| 1379 | QGraphicsView uses this property to decide how to update areas of the | - |
| 1380 | scene that have been reexposed or changed. Usually you do not need to | - |
| 1381 | modify this property, but there are some cases where doing so can improve | - |
| 1382 | rendering performance. See the ViewportUpdateMode documentation for | - |
| 1383 | specific details. | - |
| 1384 | | - |
| 1385 | The default value is MinimalViewportUpdate, where QGraphicsView will | - |
| 1386 | update as small an area of the viewport as possible when the contents | - |
| 1387 | change. | - |
| 1388 | | - |
| 1389 | \sa ViewportUpdateMode, cacheMode | - |
| 1390 | */ | - |
| 1391 | QGraphicsView::ViewportUpdateMode QGraphicsView::viewportUpdateMode() const | - |
| 1392 | { | - |
| 1393 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 1394 | return d->viewportUpdateMode; executed: return d->viewportUpdateMode;Execution Count:4 | 4 |
| 1395 | } | - |
| 1396 | void QGraphicsView::setViewportUpdateMode(ViewportUpdateMode mode) | - |
| 1397 | { | - |
| 1398 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1399 | d->viewportUpdateMode = mode; executed (the execution status of this line is deduced): d->viewportUpdateMode = mode; | - |
| 1400 | } executed: }Execution Count:5 | 5 |
| 1401 | | - |
| 1402 | /*! | - |
| 1403 | \property QGraphicsView::optimizationFlags | - |
| 1404 | \brief flags that can be used to tune QGraphicsView's performance. | - |
| 1405 | | - |
| 1406 | \since 4.3 | - |
| 1407 | | - |
| 1408 | QGraphicsView uses clipping, extra bounding rect adjustments, and certain | - |
| 1409 | other aids to improve rendering quality and performance for the common | - |
| 1410 | case graphics scene. However, depending on the target platform, the scene, | - |
| 1411 | and the viewport in use, some of these operations can degrade performance. | - |
| 1412 | | - |
| 1413 | The effect varies from flag to flag; see the OptimizationFlags | - |
| 1414 | documentation for details. | - |
| 1415 | | - |
| 1416 | By default, no optimization flags are enabled. | - |
| 1417 | | - |
| 1418 | \sa setOptimizationFlag() | - |
| 1419 | */ | - |
| 1420 | QGraphicsView::OptimizationFlags QGraphicsView::optimizationFlags() const | - |
| 1421 | { | - |
| 1422 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 1423 | return d->optimizationFlags; executed: return d->optimizationFlags;Execution Count:8 | 8 |
| 1424 | } | - |
| 1425 | void QGraphicsView::setOptimizationFlags(OptimizationFlags flags) | - |
| 1426 | { | - |
| 1427 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1428 | d->optimizationFlags = flags; executed (the execution status of this line is deduced): d->optimizationFlags = flags; | - |
| 1429 | } executed: }Execution Count:2 | 2 |
| 1430 | | - |
| 1431 | /*! | - |
| 1432 | Enables \a flag if \a enabled is true; otherwise disables \a flag. | - |
| 1433 | | - |
| 1434 | \sa optimizationFlags | - |
| 1435 | */ | - |
| 1436 | void QGraphicsView::setOptimizationFlag(OptimizationFlag flag, bool enabled) | - |
| 1437 | { | - |
| 1438 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1439 | if (enabled) evaluated: enabled| yes Evaluation Count:30 | yes Evaluation Count:20 |
| 20-30 |
| 1440 | d->optimizationFlags |= flag; executed: d->optimizationFlags |= flag;Execution Count:30 | 30 |
| 1441 | else | - |
| 1442 | d->optimizationFlags &= ~flag; executed: d->optimizationFlags &= ~flag;Execution Count:20 | 20 |
| 1443 | } | - |
| 1444 | | - |
| 1445 | /*! | - |
| 1446 | \property QGraphicsView::dragMode | - |
| 1447 | \brief the behavior for dragging the mouse over the scene while | - |
| 1448 | the left mouse button is pressed. | - |
| 1449 | | - |
| 1450 | This property defines what should happen when the user clicks on the scene | - |
| 1451 | background and drags the mouse (e.g., scrolling the viewport contents | - |
| 1452 | using a pointing hand cursor, or selecting multiple items with a rubber | - |
| 1453 | band). The default value, NoDrag, does nothing. | - |
| 1454 | | - |
| 1455 | This behavior only affects mouse clicks that are not handled by any item. | - |
| 1456 | You can define a custom behavior by creating a subclass of QGraphicsView | - |
| 1457 | and reimplementing mouseMoveEvent(). | - |
| 1458 | */ | - |
| 1459 | QGraphicsView::DragMode QGraphicsView::dragMode() const | - |
| 1460 | { | - |
| 1461 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 1462 | return d->dragMode; executed: return d->dragMode;Execution Count:14 | 14 |
| 1463 | } | - |
| 1464 | void QGraphicsView::setDragMode(DragMode mode) | - |
| 1465 | { | - |
| 1466 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1467 | if (d->dragMode == mode) partially evaluated: d->dragMode == mode| no Evaluation Count:0 | yes Evaluation Count:11 |
| 0-11 |
| 1468 | return; | 0 |
| 1469 | | - |
| 1470 | #ifndef QT_NO_CURSOR | - |
| 1471 | if (d->dragMode == ScrollHandDrag) evaluated: d->dragMode == ScrollHandDrag| yes Evaluation Count:2 | yes Evaluation Count:9 |
| 2-9 |
| 1472 | viewport()->unsetCursor(); executed: viewport()->unsetCursor();Execution Count:2 | 2 |
| 1473 | #endif | - |
| 1474 | | - |
| 1475 | // If dragMode is unset while dragging, e.g. via a keyEvent, we | - |
| 1476 | // don't unset the handScrolling state. When enabling scrolling | - |
| 1477 | // again the mouseMoveEvent will automatically start scrolling, | - |
| 1478 | // without a mousePress | - |
| 1479 | if (d->dragMode == ScrollHandDrag && mode == NoDrag && d->handScrolling) evaluated: d->dragMode == ScrollHandDrag| yes Evaluation Count:2 | yes Evaluation Count:9 |
partially evaluated: mode == NoDrag| yes Evaluation Count:2 | no Evaluation Count:0 |
evaluated: d->handScrolling| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 0-9 |
| 1480 | d->handScrolling = false; executed: d->handScrolling = false;Execution Count:1 | 1 |
| 1481 | | - |
| 1482 | d->dragMode = mode; executed (the execution status of this line is deduced): d->dragMode = mode; | - |
| 1483 | | - |
| 1484 | #ifndef QT_NO_CURSOR | - |
| 1485 | if (d->dragMode == ScrollHandDrag) { evaluated: d->dragMode == ScrollHandDrag| yes Evaluation Count:6 | yes Evaluation Count:5 |
| 5-6 |
| 1486 | // Forget the stored viewport cursor when we enter scroll hand drag mode. | - |
| 1487 | d->hasStoredOriginalCursor = false; executed (the execution status of this line is deduced): d->hasStoredOriginalCursor = false; | - |
| 1488 | viewport()->setCursor(Qt::OpenHandCursor); executed (the execution status of this line is deduced): viewport()->setCursor(Qt::OpenHandCursor); | - |
| 1489 | } executed: }Execution Count:6 | 6 |
| 1490 | #endif | - |
| 1491 | } executed: }Execution Count:11 | 11 |
| 1492 | | - |
| 1493 | #ifndef QT_NO_RUBBERBAND | - |
| 1494 | /*! | - |
| 1495 | \property QGraphicsView::rubberBandSelectionMode | - |
| 1496 | \brief the behavior for selecting items with a rubber band selection rectangle. | - |
| 1497 | \since 4.3 | - |
| 1498 | | - |
| 1499 | This property defines how items are selected when using the RubberBandDrag | - |
| 1500 | drag mode. | - |
| 1501 | | - |
| 1502 | The default value is Qt::IntersectsItemShape; all items whose shape | - |
| 1503 | intersects with or is contained by the rubber band are selected. | - |
| 1504 | | - |
| 1505 | \sa dragMode, items() | - |
| 1506 | */ | - |
| 1507 | Qt::ItemSelectionMode QGraphicsView::rubberBandSelectionMode() const | - |
| 1508 | { | - |
| 1509 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 1510 | return d->rubberBandSelectionMode; executed: return d->rubberBandSelectionMode;Execution Count:2 | 2 |
| 1511 | } | - |
| 1512 | void QGraphicsView::setRubberBandSelectionMode(Qt::ItemSelectionMode mode) | - |
| 1513 | { | - |
| 1514 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1515 | d->rubberBandSelectionMode = mode; executed (the execution status of this line is deduced): d->rubberBandSelectionMode = mode; | - |
| 1516 | } executed: }Execution Count:1 | 1 |
| 1517 | #endif | - |
| 1518 | | - |
| 1519 | /*! | - |
| 1520 | \property QGraphicsView::cacheMode | - |
| 1521 | \brief which parts of the view are cached | - |
| 1522 | | - |
| 1523 | QGraphicsView can cache pre-rendered content in a QPixmap, which is then | - |
| 1524 | drawn onto the viewport. The purpose of such caching is to speed up the | - |
| 1525 | total rendering time for areas that are slow to render. Texture, gradient | - |
| 1526 | and alpha blended backgrounds, for example, can be notibly slow to render; | - |
| 1527 | especially with a transformed view. The CacheBackground flag enables | - |
| 1528 | caching of the view's background. For example: | - |
| 1529 | | - |
| 1530 | \snippet code/src_gui_graphicsview_qgraphicsview.cpp 2 | - |
| 1531 | | - |
| 1532 | The cache is invalidated every time the view is transformed. However, when | - |
| 1533 | scrolling, only partial invalidation is required. | - |
| 1534 | | - |
| 1535 | By default, nothing is cached. | - |
| 1536 | | - |
| 1537 | \sa resetCachedContent(), QPixmapCache | - |
| 1538 | */ | - |
| 1539 | QGraphicsView::CacheMode QGraphicsView::cacheMode() const | - |
| 1540 | { | - |
| 1541 | Q_D(const QGraphicsView); never executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 1542 | return d->cacheMode; never executed: return d->cacheMode; | 0 |
| 1543 | } | - |
| 1544 | void QGraphicsView::setCacheMode(CacheMode mode) | - |
| 1545 | { | - |
| 1546 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1547 | if (mode == d->cacheMode) partially evaluated: mode == d->cacheMode| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1548 | return; | 0 |
| 1549 | d->cacheMode = mode; executed (the execution status of this line is deduced): d->cacheMode = mode; | - |
| 1550 | resetCachedContent(); executed (the execution status of this line is deduced): resetCachedContent(); | - |
| 1551 | } executed: }Execution Count:1 | 1 |
| 1552 | | - |
| 1553 | /*! | - |
| 1554 | Resets any cached content. Calling this function will clear | - |
| 1555 | QGraphicsView's cache. If the current cache mode is \l CacheNone, this | - |
| 1556 | function does nothing. | - |
| 1557 | | - |
| 1558 | This function is called automatically for you when the backgroundBrush or | - |
| 1559 | QGraphicsScene::backgroundBrush properties change; you only need to call | - |
| 1560 | this function if you have reimplemented QGraphicsScene::drawBackground() | - |
| 1561 | or QGraphicsView::drawBackground() to draw a custom background, and need | - |
| 1562 | to trigger a full redraw. | - |
| 1563 | | - |
| 1564 | \sa cacheMode() | - |
| 1565 | */ | - |
| 1566 | void QGraphicsView::resetCachedContent() | - |
| 1567 | { | - |
| 1568 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1569 | if (d->cacheMode == CacheNone) evaluated: d->cacheMode == CacheNone| yes Evaluation Count:153 | yes Evaluation Count:1 |
| 1-153 |
| 1570 | return; executed: return;Execution Count:153 | 153 |
| 1571 | | - |
| 1572 | if (d->cacheMode & CacheBackground) { partially evaluated: d->cacheMode & CacheBackground| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 1573 | // Background caching is enabled. | - |
| 1574 | d->mustResizeBackgroundPixmap = true; executed (the execution status of this line is deduced): d->mustResizeBackgroundPixmap = true; | - |
| 1575 | d->updateAll(); executed (the execution status of this line is deduced): d->updateAll(); | - |
| 1576 | } else if (d->mustResizeBackgroundPixmap) { executed: }Execution Count:1 never evaluated: d->mustResizeBackgroundPixmap | 0-1 |
| 1577 | // Background caching is disabled. | - |
| 1578 | // Cleanup, free some resources. | - |
| 1579 | d->mustResizeBackgroundPixmap = false; never executed (the execution status of this line is deduced): d->mustResizeBackgroundPixmap = false; | - |
| 1580 | d->backgroundPixmap = QPixmap(); never executed (the execution status of this line is deduced): d->backgroundPixmap = QPixmap(); | - |
| 1581 | d->backgroundPixmapExposed = QRegion(); never executed (the execution status of this line is deduced): d->backgroundPixmapExposed = QRegion(); | - |
| 1582 | } | 0 |
| 1583 | } | - |
| 1584 | | - |
| 1585 | /*! | - |
| 1586 | Invalidates and schedules a redraw of \a layers inside \a rect. \a rect is | - |
| 1587 | in scene coordinates. Any cached content for \a layers inside \a rect is | - |
| 1588 | unconditionally invalidated and redrawn. | - |
| 1589 | | - |
| 1590 | You can call this function to notify QGraphicsView of changes to the | - |
| 1591 | background or the foreground of the scene. It is commonly used for scenes | - |
| 1592 | with tile-based backgrounds to notify changes when QGraphicsView has | - |
| 1593 | enabled background caching. | - |
| 1594 | | - |
| 1595 | Note that QGraphicsView currently supports background caching only (see | - |
| 1596 | QGraphicsView::CacheBackground). This function is equivalent to calling update() if any | - |
| 1597 | layer but QGraphicsScene::BackgroundLayer is passed. | - |
| 1598 | | - |
| 1599 | \sa QGraphicsScene::invalidate(), update() | - |
| 1600 | */ | - |
| 1601 | void QGraphicsView::invalidateScene(const QRectF &rect, QGraphicsScene::SceneLayers layers) | - |
| 1602 | { | - |
| 1603 | Q_D(QGraphicsView); never executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1604 | if ((layers & QGraphicsScene::BackgroundLayer) && !d->mustResizeBackgroundPixmap) { never evaluated: (layers & QGraphicsScene::BackgroundLayer) never evaluated: !d->mustResizeBackgroundPixmap | 0 |
| 1605 | QRect viewRect = mapFromScene(rect).boundingRect(); never executed (the execution status of this line is deduced): QRect viewRect = mapFromScene(rect).boundingRect(); | - |
| 1606 | if (viewport()->rect().intersects(viewRect)) { never evaluated: viewport()->rect().intersects(viewRect) | 0 |
| 1607 | // The updated background area is exposed; schedule this area for | - |
| 1608 | // redrawing. | - |
| 1609 | d->backgroundPixmapExposed += viewRect; never executed (the execution status of this line is deduced): d->backgroundPixmapExposed += viewRect; | - |
| 1610 | if (d->scene) never evaluated: d->scene | 0 |
| 1611 | d->scene->update(rect); never executed: d->scene->update(rect); | 0 |
| 1612 | } | 0 |
| 1613 | } | 0 |
| 1614 | } | 0 |
| 1615 | | - |
| 1616 | /*! | - |
| 1617 | \property QGraphicsView::interactive | - |
| 1618 | \brief whether the view allowed scene interaction. | - |
| 1619 | | - |
| 1620 | If enabled, this view is set to allow scene interaction. Otherwise, this | - |
| 1621 | view will not allow interaction, and any mouse or key events are ignored | - |
| 1622 | (i.e., it will act as a read-only view). | - |
| 1623 | | - |
| 1624 | By default, this property is true. | - |
| 1625 | */ | - |
| 1626 | bool QGraphicsView::isInteractive() const | - |
| 1627 | { | - |
| 1628 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 1629 | return d->sceneInteractionAllowed; executed: return d->sceneInteractionAllowed;Execution Count:5 | 5 |
| 1630 | } | - |
| 1631 | void QGraphicsView::setInteractive(bool allowed) | - |
| 1632 | { | - |
| 1633 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1634 | d->sceneInteractionAllowed = allowed; executed (the execution status of this line is deduced): d->sceneInteractionAllowed = allowed; | - |
| 1635 | } executed: }Execution Count:3 | 3 |
| 1636 | | - |
| 1637 | /*! | - |
| 1638 | Returns a pointer to the scene that is currently visualized in the | - |
| 1639 | view. If no scene is currently visualized, 0 is returned. | - |
| 1640 | | - |
| 1641 | \sa setScene() | - |
| 1642 | */ | - |
| 1643 | QGraphicsScene *QGraphicsView::scene() const | - |
| 1644 | { | - |
| 1645 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 1646 | return d->scene; executed: return d->scene;Execution Count:32 | 32 |
| 1647 | } | - |
| 1648 | | - |
| 1649 | /*! | - |
| 1650 | Sets the current scene to \a scene. If \a scene is already being | - |
| 1651 | viewed, this function does nothing. | - |
| 1652 | | - |
| 1653 | When a scene is set on a view, the QGraphicsScene::changed() signal | - |
| 1654 | is automatically connected to this view's updateScene() slot, and the | - |
| 1655 | view's scroll bars are adjusted to fit the size of the scene. | - |
| 1656 | | - |
| 1657 | The view does not take ownership of \a scene. | - |
| 1658 | */ | - |
| 1659 | void QGraphicsView::setScene(QGraphicsScene *scene) | - |
| 1660 | { | - |
| 1661 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1662 | if (d->scene == scene) evaluated: d->scene == scene| yes Evaluation Count:28 | yes Evaluation Count:806 |
| 28-806 |
| 1663 | return; executed: return;Execution Count:28 | 28 |
| 1664 | | - |
| 1665 | // Always update the viewport when the scene changes. | - |
| 1666 | d->updateAll(); executed (the execution status of this line is deduced): d->updateAll(); | - |
| 1667 | | - |
| 1668 | // Remove the previously assigned scene. | - |
| 1669 | if (d->scene) { evaluated: d->scene| yes Evaluation Count:22 | yes Evaluation Count:784 |
| 22-784 |
| 1670 | disconnect(d->scene, SIGNAL(changed(QList<QRectF>)), executed (the execution status of this line is deduced): disconnect(d->scene, "2""changed(QList<QRectF>)", | - |
| 1671 | this, SLOT(updateScene(QList<QRectF>))); executed (the execution status of this line is deduced): this, "1""updateScene(QList<QRectF>)"); | - |
| 1672 | disconnect(d->scene, SIGNAL(sceneRectChanged(QRectF)), executed (the execution status of this line is deduced): disconnect(d->scene, "2""sceneRectChanged(QRectF)", | - |
| 1673 | this, SLOT(updateSceneRect(QRectF))); executed (the execution status of this line is deduced): this, "1""updateSceneRect(QRectF)"); | - |
| 1674 | d->scene->d_func()->removeView(this); executed (the execution status of this line is deduced): d->scene->d_func()->removeView(this); | - |
| 1675 | d->connectedToScene = false; executed (the execution status of this line is deduced): d->connectedToScene = false; | - |
| 1676 | | - |
| 1677 | if (isActiveWindow() && isVisible()) { evaluated: isActiveWindow()| yes Evaluation Count:10 | yes Evaluation Count:12 |
partially evaluated: isVisible()| yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-12 |
| 1678 | QEvent windowDeactivate(QEvent::WindowDeactivate); executed (the execution status of this line is deduced): QEvent windowDeactivate(QEvent::WindowDeactivate); | - |
| 1679 | QApplication::sendEvent(d->scene, &windowDeactivate); executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, &windowDeactivate); | - |
| 1680 | } executed: }Execution Count:10 | 10 |
| 1681 | if(hasFocus()) evaluated: hasFocus()| yes Evaluation Count:8 | yes Evaluation Count:14 |
| 8-14 |
| 1682 | d->scene->clearFocus(); executed: d->scene->clearFocus();Execution Count:8 | 8 |
| 1683 | } executed: }Execution Count:22 | 22 |
| 1684 | | - |
| 1685 | // Assign the new scene and update the contents (scrollbars, etc.)). | - |
| 1686 | if ((d->scene = scene)) { evaluated: (d->scene = scene)| yes Evaluation Count:786 | yes Evaluation Count:20 |
| 20-786 |
| 1687 | connect(d->scene, SIGNAL(sceneRectChanged(QRectF)), executed (the execution status of this line is deduced): connect(d->scene, "2""sceneRectChanged(QRectF)", | - |
| 1688 | this, SLOT(updateSceneRect(QRectF))); executed (the execution status of this line is deduced): this, "1""updateSceneRect(QRectF)"); | - |
| 1689 | d->updateSceneSlotReimplementedChecked = false; executed (the execution status of this line is deduced): d->updateSceneSlotReimplementedChecked = false; | - |
| 1690 | d->scene->d_func()->addView(this); executed (the execution status of this line is deduced): d->scene->d_func()->addView(this); | - |
| 1691 | d->recalculateContentSize(); executed (the execution status of this line is deduced): d->recalculateContentSize(); | - |
| 1692 | d->lastCenterPoint = sceneRect().center(); executed (the execution status of this line is deduced): d->lastCenterPoint = sceneRect().center(); | - |
| 1693 | d->keepLastCenterPoint = true; executed (the execution status of this line is deduced): d->keepLastCenterPoint = true; | - |
| 1694 | // We are only interested in mouse tracking if items accept | - |
| 1695 | // hover events or use non-default cursors. | - |
| 1696 | if (!d->scene->d_func()->allItemsIgnoreHoverEvents evaluated: !d->scene->d_func()->allItemsIgnoreHoverEvents| yes Evaluation Count:6 | yes Evaluation Count:780 |
| 6-780 |
| 1697 | || !d->scene->d_func()->allItemsUseDefaultCursor) { evaluated: !d->scene->d_func()->allItemsUseDefaultCursor| yes Evaluation Count:3 | yes Evaluation Count:777 |
| 3-777 |
| 1698 | d->viewport->setMouseTracking(true); executed (the execution status of this line is deduced): d->viewport->setMouseTracking(true); | - |
| 1699 | } executed: }Execution Count:9 | 9 |
| 1700 | | - |
| 1701 | // enable touch events if any items is interested in them | - |
| 1702 | if (!d->scene->d_func()->allItemsIgnoreTouchEvents) partially evaluated: !d->scene->d_func()->allItemsIgnoreTouchEvents| no Evaluation Count:0 | yes Evaluation Count:786 |
| 0-786 |
| 1703 | d->viewport->setAttribute(Qt::WA_AcceptTouchEvents); never executed: d->viewport->setAttribute(Qt::WA_AcceptTouchEvents); | 0 |
| 1704 | | - |
| 1705 | if (isActiveWindow() && isVisible()) { evaluated: isActiveWindow()| yes Evaluation Count:7 | yes Evaluation Count:779 |
partially evaluated: isVisible()| yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-779 |
| 1706 | QEvent windowActivate(QEvent::WindowActivate); executed (the execution status of this line is deduced): QEvent windowActivate(QEvent::WindowActivate); | - |
| 1707 | QApplication::sendEvent(d->scene, &windowActivate); executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, &windowActivate); | - |
| 1708 | } executed: }Execution Count:7 | 7 |
| 1709 | } else { executed: }Execution Count:786 | 786 |
| 1710 | d->recalculateContentSize(); executed (the execution status of this line is deduced): d->recalculateContentSize(); | - |
| 1711 | } executed: }Execution Count:20 | 20 |
| 1712 | | - |
| 1713 | d->updateInputMethodSensitivity(); executed (the execution status of this line is deduced): d->updateInputMethodSensitivity(); | - |
| 1714 | | - |
| 1715 | if (d->scene && hasFocus()) evaluated: d->scene| yes Evaluation Count:786 | yes Evaluation Count:20 |
evaluated: hasFocus()| yes Evaluation Count:6 | yes Evaluation Count:780 |
| 6-786 |
| 1716 | d->scene->setFocus(); executed: d->scene->setFocus();Execution Count:6 | 6 |
| 1717 | } executed: }Execution Count:806 | 806 |
| 1718 | | - |
| 1719 | /*! | - |
| 1720 | \property QGraphicsView::sceneRect | - |
| 1721 | \brief the area of the scene visualized by this view. | - |
| 1722 | | - |
| 1723 | The scene rectangle defines the extent of the scene, and in the view's case, | - |
| 1724 | this means the area of the scene that you can navigate using the scroll | - |
| 1725 | bars. | - |
| 1726 | | - |
| 1727 | If unset, or if a null QRectF is set, this property has the same value as | - |
| 1728 | QGraphicsScene::sceneRect, and it changes with | - |
| 1729 | QGraphicsScene::sceneRect. Otherwise, the view's scene rect is unaffected | - |
| 1730 | by the scene. | - |
| 1731 | | - |
| 1732 | Note that, although the scene supports a virtually unlimited size, the | - |
| 1733 | range of the scroll bars will never exceed the range of an integer | - |
| 1734 | (INT_MIN, INT_MAX). When the scene is larger than the scroll bars' values, | - |
| 1735 | you can choose to use translate() to navigate the scene instead. | - |
| 1736 | | - |
| 1737 | By default, this property contains a rectangle at the origin with zero | - |
| 1738 | width and height. | - |
| 1739 | | - |
| 1740 | \sa QGraphicsScene::sceneRect | - |
| 1741 | */ | - |
| 1742 | QRectF QGraphicsView::sceneRect() const | - |
| 1743 | { | - |
| 1744 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 1745 | if (d->hasSceneRect) evaluated: d->hasSceneRect| yes Evaluation Count:170 | yes Evaluation Count:4552 |
| 170-4552 |
| 1746 | return d->sceneRect; executed: return d->sceneRect;Execution Count:170 | 170 |
| 1747 | if (d->scene) evaluated: d->scene| yes Evaluation Count:4498 | yes Evaluation Count:54 |
| 54-4498 |
| 1748 | return d->scene->sceneRect(); executed: return d->scene->sceneRect();Execution Count:4498 | 4498 |
| 1749 | return QRectF(); executed: return QRectF();Execution Count:54 | 54 |
| 1750 | } | - |
| 1751 | void QGraphicsView::setSceneRect(const QRectF &rect) | - |
| 1752 | { | - |
| 1753 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1754 | d->hasSceneRect = !rect.isNull(); executed (the execution status of this line is deduced): d->hasSceneRect = !rect.isNull(); | - |
| 1755 | d->sceneRect = rect; executed (the execution status of this line is deduced): d->sceneRect = rect; | - |
| 1756 | d->recalculateContentSize(); executed (the execution status of this line is deduced): d->recalculateContentSize(); | - |
| 1757 | } executed: }Execution Count:49 | 49 |
| 1758 | | - |
| 1759 | /*! | - |
| 1760 | Returns the current transformation matrix for the view. If no current | - |
| 1761 | transformation is set, the identity matrix is returned. | - |
| 1762 | | - |
| 1763 | \sa setMatrix(), transform(), rotate(), scale(), shear(), translate() | - |
| 1764 | */ | - |
| 1765 | QMatrix QGraphicsView::matrix() const | - |
| 1766 | { | - |
| 1767 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 1768 | return d->matrix.toAffine(); executed: return d->matrix.toAffine();Execution Count:10 | 10 |
| 1769 | } | - |
| 1770 | | - |
| 1771 | /*! | - |
| 1772 | Sets the view's current transformation matrix to \a matrix. | - |
| 1773 | | - |
| 1774 | If \a combine is true, then \a matrix is combined with the current matrix; | - |
| 1775 | otherwise, \a matrix \e replaces the current matrix. \a combine is false | - |
| 1776 | by default. | - |
| 1777 | | - |
| 1778 | The transformation matrix tranforms the scene into view coordinates. Using | - |
| 1779 | the default transformation, provided by the identity matrix, one pixel in | - |
| 1780 | the view represents one unit in the scene (e.g., a 10x10 rectangular item | - |
| 1781 | is drawn using 10x10 pixels in the view). If a 2x2 scaling matrix is | - |
| 1782 | applied, the scene will be drawn in 1:2 (e.g., a 10x10 rectangular item is | - |
| 1783 | then drawn using 20x20 pixels in the view). | - |
| 1784 | | - |
| 1785 | Example: | - |
| 1786 | | - |
| 1787 | \snippet code/src_gui_graphicsview_qgraphicsview.cpp 3 | - |
| 1788 | | - |
| 1789 | To simplify interation with items using a transformed view, QGraphicsView | - |
| 1790 | provides mapTo... and mapFrom... functions that can translate between | - |
| 1791 | scene and view coordinates. For example, you can call mapToScene() to map | - |
| 1792 | a view coordinate to a floating point scene coordinate, or mapFromScene() | - |
| 1793 | to map from floating point scene coordinates to view coordinates. | - |
| 1794 | | - |
| 1795 | \sa matrix(), setTransform(), rotate(), scale(), shear(), translate() | - |
| 1796 | */ | - |
| 1797 | void QGraphicsView::setMatrix(const QMatrix &matrix, bool combine) | - |
| 1798 | { | - |
| 1799 | setTransform(QTransform(matrix), combine); executed (the execution status of this line is deduced): setTransform(QTransform(matrix), combine); | - |
| 1800 | } executed: }Execution Count:8 | 8 |
| 1801 | | - |
| 1802 | /*! | - |
| 1803 | Resets the view transformation matrix to the identity matrix. | - |
| 1804 | | - |
| 1805 | \sa resetTransform() | - |
| 1806 | */ | - |
| 1807 | void QGraphicsView::resetMatrix() | - |
| 1808 | { | - |
| 1809 | resetTransform(); executed (the execution status of this line is deduced): resetTransform(); | - |
| 1810 | } executed: }Execution Count:1 | 1 |
| 1811 | | - |
| 1812 | /*! | - |
| 1813 | Rotates the current view transformation \a angle degrees clockwise. | - |
| 1814 | | - |
| 1815 | \sa setTransform(), transform(), scale(), shear(), translate() | - |
| 1816 | */ | - |
| 1817 | void QGraphicsView::rotate(qreal angle) | - |
| 1818 | { | - |
| 1819 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1820 | QTransform matrix = d->matrix; executed (the execution status of this line is deduced): QTransform matrix = d->matrix; | - |
| 1821 | matrix.rotate(angle); executed (the execution status of this line is deduced): matrix.rotate(angle); | - |
| 1822 | setTransform(matrix); executed (the execution status of this line is deduced): setTransform(matrix); | - |
| 1823 | } executed: }Execution Count:245 | 245 |
| 1824 | | - |
| 1825 | /*! | - |
| 1826 | Scales the current view transformation by (\a sx, \a sy). | - |
| 1827 | | - |
| 1828 | \sa setTransform(), transform(), rotate(), shear(), translate() | - |
| 1829 | */ | - |
| 1830 | void QGraphicsView::scale(qreal sx, qreal sy) | - |
| 1831 | { | - |
| 1832 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1833 | QTransform matrix = d->matrix; executed (the execution status of this line is deduced): QTransform matrix = d->matrix; | - |
| 1834 | matrix.scale(sx, sy); executed (the execution status of this line is deduced): matrix.scale(sx, sy); | - |
| 1835 | setTransform(matrix); executed (the execution status of this line is deduced): setTransform(matrix); | - |
| 1836 | } executed: }Execution Count:76 | 76 |
| 1837 | | - |
| 1838 | /*! | - |
| 1839 | Shears the current view transformation by (\a sh, \a sv). | - |
| 1840 | | - |
| 1841 | \sa setTransform(), transform(), rotate(), scale(), translate() | - |
| 1842 | */ | - |
| 1843 | void QGraphicsView::shear(qreal sh, qreal sv) | - |
| 1844 | { | - |
| 1845 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1846 | QTransform matrix = d->matrix; executed (the execution status of this line is deduced): QTransform matrix = d->matrix; | - |
| 1847 | matrix.shear(sh, sv); executed (the execution status of this line is deduced): matrix.shear(sh, sv); | - |
| 1848 | setTransform(matrix); executed (the execution status of this line is deduced): setTransform(matrix); | - |
| 1849 | } executed: }Execution Count:7 | 7 |
| 1850 | | - |
| 1851 | /*! | - |
| 1852 | Translates the current view transformation by (\a dx, \a dy). | - |
| 1853 | | - |
| 1854 | \sa setTransform(), transform(), rotate(), shear() | - |
| 1855 | */ | - |
| 1856 | void QGraphicsView::translate(qreal dx, qreal dy) | - |
| 1857 | { | - |
| 1858 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1859 | QTransform matrix = d->matrix; executed (the execution status of this line is deduced): QTransform matrix = d->matrix; | - |
| 1860 | matrix.translate(dx, dy); executed (the execution status of this line is deduced): matrix.translate(dx, dy); | - |
| 1861 | setTransform(matrix); executed (the execution status of this line is deduced): setTransform(matrix); | - |
| 1862 | } executed: }Execution Count:12 | 12 |
| 1863 | | - |
| 1864 | /*! | - |
| 1865 | Scrolls the contents of the viewport to ensure that the scene | - |
| 1866 | coordinate \a pos, is centered in the view. | - |
| 1867 | | - |
| 1868 | Because \a pos is a floating point coordinate, and the scroll bars operate | - |
| 1869 | on integer coordinates, the centering is only an approximation. | - |
| 1870 | | - |
| 1871 | \note If the item is close to or outside the border, it will be visible | - |
| 1872 | in the view, but not centered. | - |
| 1873 | | - |
| 1874 | \sa ensureVisible() | - |
| 1875 | */ | - |
| 1876 | void QGraphicsView::centerOn(const QPointF &pos) | - |
| 1877 | { | - |
| 1878 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1879 | qreal width = viewport()->width(); executed (the execution status of this line is deduced): qreal width = viewport()->width(); | - |
| 1880 | qreal height = viewport()->height(); executed (the execution status of this line is deduced): qreal height = viewport()->height(); | - |
| 1881 | QPointF viewPoint = d->matrix.map(pos); executed (the execution status of this line is deduced): QPointF viewPoint = d->matrix.map(pos); | - |
| 1882 | QPointF oldCenterPoint = pos; executed (the execution status of this line is deduced): QPointF oldCenterPoint = pos; | - |
| 1883 | | - |
| 1884 | if (!d->leftIndent) { evaluated: !d->leftIndent| yes Evaluation Count:743 | yes Evaluation Count:1019 |
| 743-1019 |
| 1885 | if (isRightToLeft()) { evaluated: isRightToLeft()| yes Evaluation Count:1 | yes Evaluation Count:742 |
| 1-742 |
| 1886 | qint64 horizontal = 0; executed (the execution status of this line is deduced): qint64 horizontal = 0; | - |
| 1887 | horizontal += horizontalScrollBar()->minimum(); executed (the execution status of this line is deduced): horizontal += horizontalScrollBar()->minimum(); | - |
| 1888 | horizontal += horizontalScrollBar()->maximum(); executed (the execution status of this line is deduced): horizontal += horizontalScrollBar()->maximum(); | - |
| 1889 | horizontal -= int(viewPoint.x() - width / 2.0); executed (the execution status of this line is deduced): horizontal -= int(viewPoint.x() - width / 2.0); | - |
| 1890 | horizontalScrollBar()->setValue(horizontal); executed (the execution status of this line is deduced): horizontalScrollBar()->setValue(horizontal); | - |
| 1891 | } else { executed: }Execution Count:1 | 1 |
| 1892 | horizontalScrollBar()->setValue(int(viewPoint.x() - width / 2.0)); executed (the execution status of this line is deduced): horizontalScrollBar()->setValue(int(viewPoint.x() - width / 2.0)); | - |
| 1893 | } executed: }Execution Count:742 | 742 |
| 1894 | } | - |
| 1895 | if (!d->topIndent) evaluated: !d->topIndent| yes Evaluation Count:901 | yes Evaluation Count:861 |
| 861-901 |
| 1896 | verticalScrollBar()->setValue(int(viewPoint.y() - height / 2.0)); executed: verticalScrollBar()->setValue(int(viewPoint.y() - height / 2.0));Execution Count:901 | 901 |
| 1897 | d->lastCenterPoint = oldCenterPoint; executed (the execution status of this line is deduced): d->lastCenterPoint = oldCenterPoint; | - |
| 1898 | } executed: }Execution Count:1762 | 1762 |
| 1899 | | - |
| 1900 | /*! | - |
| 1901 | \fn QGraphicsView::centerOn(qreal x, qreal y) | - |
| 1902 | \overload | - |
| 1903 | | - |
| 1904 | This function is provided for convenience. It's equivalent to calling | - |
| 1905 | centerOn(QPointF(\a x, \a y)). | - |
| 1906 | */ | - |
| 1907 | | - |
| 1908 | /*! | - |
| 1909 | \overload | - |
| 1910 | | - |
| 1911 | Scrolls the contents of the viewport to ensure that \a item | - |
| 1912 | is centered in the view. | - |
| 1913 | | - |
| 1914 | \sa ensureVisible() | - |
| 1915 | */ | - |
| 1916 | void QGraphicsView::centerOn(const QGraphicsItem *item) | - |
| 1917 | { | - |
| 1918 | centerOn(item->sceneBoundingRect().center()); executed (the execution status of this line is deduced): centerOn(item->sceneBoundingRect().center()); | - |
| 1919 | } executed: }Execution Count:14 | 14 |
| 1920 | | - |
| 1921 | /*! | - |
| 1922 | Scrolls the contents of the viewport so that the scene rectangle \a rect | - |
| 1923 | is visible, with margins specified in pixels by \a xmargin and \a | - |
| 1924 | ymargin. If the specified rect cannot be reached, the contents are | - |
| 1925 | scrolled to the nearest valid position. The default value for both margins | - |
| 1926 | is 50 pixels. | - |
| 1927 | | - |
| 1928 | \sa centerOn() | - |
| 1929 | */ | - |
| 1930 | void QGraphicsView::ensureVisible(const QRectF &rect, int xmargin, int ymargin) | - |
| 1931 | { | - |
| 1932 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 1933 | qreal width = viewport()->width(); executed (the execution status of this line is deduced): qreal width = viewport()->width(); | - |
| 1934 | qreal height = viewport()->height(); executed (the execution status of this line is deduced): qreal height = viewport()->height(); | - |
| 1935 | QRectF viewRect = d->matrix.mapRect(rect); executed (the execution status of this line is deduced): QRectF viewRect = d->matrix.mapRect(rect); | - |
| 1936 | | - |
| 1937 | qreal left = d->horizontalScroll(); executed (the execution status of this line is deduced): qreal left = d->horizontalScroll(); | - |
| 1938 | qreal right = left + width; executed (the execution status of this line is deduced): qreal right = left + width; | - |
| 1939 | qreal top = d->verticalScroll(); executed (the execution status of this line is deduced): qreal top = d->verticalScroll(); | - |
| 1940 | qreal bottom = top + height; executed (the execution status of this line is deduced): qreal bottom = top + height; | - |
| 1941 | | - |
| 1942 | if (viewRect.left() <= left + xmargin) { evaluated: viewRect.left() <= left + xmargin| yes Evaluation Count:278 | yes Evaluation Count:257 |
| 257-278 |
| 1943 | // need to scroll from the left | - |
| 1944 | if (!d->leftIndent) evaluated: !d->leftIndent| yes Evaluation Count:259 | yes Evaluation Count:19 |
| 19-259 |
| 1945 | horizontalScrollBar()->setValue(int(viewRect.left() - xmargin - 0.5)); executed: horizontalScrollBar()->setValue(int(viewRect.left() - xmargin - 0.5));Execution Count:259 | 259 |
| 1946 | } executed: }Execution Count:278 | 278 |
| 1947 | if (viewRect.right() >= right - xmargin) { evaluated: viewRect.right() >= right - xmargin| yes Evaluation Count:269 | yes Evaluation Count:266 |
| 266-269 |
| 1948 | // need to scroll from the right | - |
| 1949 | if (!d->leftIndent) evaluated: !d->leftIndent| yes Evaluation Count:250 | yes Evaluation Count:19 |
| 19-250 |
| 1950 | horizontalScrollBar()->setValue(int(viewRect.right() - width + xmargin + 0.5)); executed: horizontalScrollBar()->setValue(int(viewRect.right() - width + xmargin + 0.5));Execution Count:250 | 250 |
| 1951 | } executed: }Execution Count:269 | 269 |
| 1952 | if (viewRect.top() <= top + ymargin) { evaluated: viewRect.top() <= top + ymargin| yes Evaluation Count:271 | yes Evaluation Count:264 |
| 264-271 |
| 1953 | // need to scroll from the top | - |
| 1954 | if (!d->topIndent) evaluated: !d->topIndent| yes Evaluation Count:265 | yes Evaluation Count:6 |
| 6-265 |
| 1955 | verticalScrollBar()->setValue(int(viewRect.top() - ymargin - 0.5)); executed: verticalScrollBar()->setValue(int(viewRect.top() - ymargin - 0.5));Execution Count:265 | 265 |
| 1956 | } executed: }Execution Count:271 | 271 |
| 1957 | if (viewRect.bottom() >= bottom - ymargin) { evaluated: viewRect.bottom() >= bottom - ymargin| yes Evaluation Count:279 | yes Evaluation Count:256 |
| 256-279 |
| 1958 | // need to scroll from the bottom | - |
| 1959 | if (!d->topIndent) evaluated: !d->topIndent| yes Evaluation Count:273 | yes Evaluation Count:6 |
| 6-273 |
| 1960 | verticalScrollBar()->setValue(int(viewRect.bottom() - height + ymargin + 0.5)); executed: verticalScrollBar()->setValue(int(viewRect.bottom() - height + ymargin + 0.5));Execution Count:273 | 273 |
| 1961 | } executed: }Execution Count:279 | 279 |
| 1962 | } executed: }Execution Count:535 | 535 |
| 1963 | | - |
| 1964 | /*! | - |
| 1965 | \fn QGraphicsView::ensureVisible(qreal x, qreal y, qreal w, qreal h, | - |
| 1966 | int xmargin, int ymargin) | - |
| 1967 | \overload | - |
| 1968 | | - |
| 1969 | This function is provided for convenience. It's equivalent to calling | - |
| 1970 | ensureVisible(QRectF(\a x, \a y, \a w, \a h), \a xmargin, \a ymargin). | - |
| 1971 | */ | - |
| 1972 | | - |
| 1973 | /*! | - |
| 1974 | \overload | - |
| 1975 | | - |
| 1976 | Scrolls the contents of the viewport so that the center of item \a item is | - |
| 1977 | visible, with margins specified in pixels by \a xmargin and \a ymargin. If | - |
| 1978 | the specified point cannot be reached, the contents are scrolled to the | - |
| 1979 | nearest valid position. The default value for both margins is 50 pixels. | - |
| 1980 | | - |
| 1981 | \sa centerOn() | - |
| 1982 | */ | - |
| 1983 | void QGraphicsView::ensureVisible(const QGraphicsItem *item, int xmargin, int ymargin) | - |
| 1984 | { | - |
| 1985 | ensureVisible(item->sceneBoundingRect(), xmargin, ymargin); never executed (the execution status of this line is deduced): ensureVisible(item->sceneBoundingRect(), xmargin, ymargin); | - |
| 1986 | } | 0 |
| 1987 | | - |
| 1988 | /*! | - |
| 1989 | Scales the view matrix and scrolls the scroll bars to ensure that the | - |
| 1990 | scene rectangle \a rect fits inside the viewport. \a rect must be inside | - |
| 1991 | the scene rect; otherwise, fitInView() cannot guarantee that the whole | - |
| 1992 | rect is visible. | - |
| 1993 | | - |
| 1994 | This function keeps the view's rotation, translation, or shear. The view | - |
| 1995 | is scaled according to \a aspectRatioMode. \a rect will be centered in the | - |
| 1996 | view if it does not fit tightly. | - |
| 1997 | | - |
| 1998 | It's common to call fitInView() from inside a reimplementation of | - |
| 1999 | resizeEvent(), to ensure that the whole scene, or parts of the scene, | - |
| 2000 | scales automatically to fit the new size of the viewport as the view is | - |
| 2001 | resized. Note though, that calling fitInView() from inside resizeEvent() | - |
| 2002 | can lead to unwanted resize recursion, if the new transformation toggles | - |
| 2003 | the automatic state of the scrollbars. You can toggle the scrollbar | - |
| 2004 | policies to always on or always off to prevent this (see | - |
| 2005 | horizontalScrollBarPolicy() and verticalScrollBarPolicy()). | - |
| 2006 | | - |
| 2007 | If \a rect is empty, or if the viewport is too small, this | - |
| 2008 | function will do nothing. | - |
| 2009 | | - |
| 2010 | \sa setTransform(), ensureVisible(), centerOn() | - |
| 2011 | */ | - |
| 2012 | void QGraphicsView::fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRatioMode) | - |
| 2013 | { | - |
| 2014 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 2015 | if (!d->scene || rect.isNull()) partially evaluated: !d->scene| no Evaluation Count:0 | yes Evaluation Count:7 |
partially evaluated: rect.isNull()| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 2016 | return; | 0 |
| 2017 | | - |
| 2018 | // Reset the view scale to 1:1. | - |
| 2019 | QRectF unity = d->matrix.mapRect(QRectF(0, 0, 1, 1)); executed (the execution status of this line is deduced): QRectF unity = d->matrix.mapRect(QRectF(0, 0, 1, 1)); | - |
| 2020 | if (unity.isEmpty()) evaluated: unity.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:6 |
| 1-6 |
| 2021 | return; executed: return;Execution Count:1 | 1 |
| 2022 | scale(1 / unity.width(), 1 / unity.height()); executed (the execution status of this line is deduced): scale(1 / unity.width(), 1 / unity.height()); | - |
| 2023 | | - |
| 2024 | // Find the ideal x / y scaling ratio to fit \a rect in the view. | - |
| 2025 | int margin = 2; executed (the execution status of this line is deduced): int margin = 2; | - |
| 2026 | QRectF viewRect = viewport()->rect().adjusted(margin, margin, -margin, -margin); executed (the execution status of this line is deduced): QRectF viewRect = viewport()->rect().adjusted(margin, margin, -margin, -margin); | - |
| 2027 | if (viewRect.isEmpty()) evaluated: viewRect.isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:4 |
| 2-4 |
| 2028 | return; executed: return;Execution Count:2 | 2 |
| 2029 | QRectF sceneRect = d->matrix.mapRect(rect); executed (the execution status of this line is deduced): QRectF sceneRect = d->matrix.mapRect(rect); | - |
| 2030 | if (sceneRect.isEmpty()) partially evaluated: sceneRect.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 2031 | return; | 0 |
| 2032 | qreal xratio = viewRect.width() / sceneRect.width(); executed (the execution status of this line is deduced): qreal xratio = viewRect.width() / sceneRect.width(); | - |
| 2033 | qreal yratio = viewRect.height() / sceneRect.height(); executed (the execution status of this line is deduced): qreal yratio = viewRect.height() / sceneRect.height(); | - |
| 2034 | | - |
| 2035 | // Respect the aspect ratio mode. | - |
| 2036 | switch (aspectRatioMode) { | - |
| 2037 | case Qt::KeepAspectRatio: | - |
| 2038 | xratio = yratio = qMin(xratio, yratio); executed (the execution status of this line is deduced): xratio = yratio = qMin(xratio, yratio); | - |
| 2039 | break; executed: break;Execution Count:1 | 1 |
| 2040 | case Qt::KeepAspectRatioByExpanding: | - |
| 2041 | xratio = yratio = qMax(xratio, yratio); executed (the execution status of this line is deduced): xratio = yratio = qMax(xratio, yratio); | - |
| 2042 | break; executed: break;Execution Count:1 | 1 |
| 2043 | case Qt::IgnoreAspectRatio: | - |
| 2044 | break; executed: break;Execution Count:2 | 2 |
| 2045 | } | - |
| 2046 | | - |
| 2047 | // Scale and center on the center of \a rect. | - |
| 2048 | scale(xratio, yratio); executed (the execution status of this line is deduced): scale(xratio, yratio); | - |
| 2049 | centerOn(rect.center()); executed (the execution status of this line is deduced): centerOn(rect.center()); | - |
| 2050 | } executed: }Execution Count:4 | 4 |
| 2051 | | - |
| 2052 | /*! | - |
| 2053 | \fn void QGraphicsView::fitInView(qreal x, qreal y, qreal w, qreal h, | - |
| 2054 | Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio) | - |
| 2055 | | - |
| 2056 | \overload | - |
| 2057 | | - |
| 2058 | This convenience function is equivalent to calling | - |
| 2059 | fitInView(QRectF(\a x, \a y, \a w, \a h), \a aspectRatioMode). | - |
| 2060 | | - |
| 2061 | \sa ensureVisible(), centerOn() | - |
| 2062 | */ | - |
| 2063 | | - |
| 2064 | /*! | - |
| 2065 | \overload | - |
| 2066 | | - |
| 2067 | Ensures that \a item fits tightly inside the view, scaling the view | - |
| 2068 | according to \a aspectRatioMode. | - |
| 2069 | | - |
| 2070 | \sa ensureVisible(), centerOn() | - |
| 2071 | */ | - |
| 2072 | void QGraphicsView::fitInView(const QGraphicsItem *item, Qt::AspectRatioMode aspectRatioMode) | - |
| 2073 | { | - |
| 2074 | QPainterPath path = item->isClipped() ? item->clipPath() : item->shape(); partially evaluated: item->isClipped()| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 2075 | if (item->d_ptr->hasTranslateOnlySceneTransform()) { partially evaluated: item->d_ptr->hasTranslateOnlySceneTransform()| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 2076 | path.translate(item->d_ptr->sceneTransform.dx(), item->d_ptr->sceneTransform.dy()); never executed (the execution status of this line is deduced): path.translate(item->d_ptr->sceneTransform.dx(), item->d_ptr->sceneTransform.dy()); | - |
| 2077 | fitInView(path.boundingRect(), aspectRatioMode); never executed (the execution status of this line is deduced): fitInView(path.boundingRect(), aspectRatioMode); | - |
| 2078 | } else { | 0 |
| 2079 | fitInView(item->d_ptr->sceneTransform.map(path).boundingRect(), aspectRatioMode); executed (the execution status of this line is deduced): fitInView(item->d_ptr->sceneTransform.map(path).boundingRect(), aspectRatioMode); | - |
| 2080 | } executed: }Execution Count:3 | 3 |
| 2081 | } | - |
| 2082 | | - |
| 2083 | /*! | - |
| 2084 | Renders the \a source rect, which is in view coordinates, from the scene | - |
| 2085 | into \a target, which is in paint device coordinates, using \a | - |
| 2086 | painter. This function is useful for capturing the contents of the view | - |
| 2087 | onto a paint device, such as a QImage (e.g., to take a screenshot), or for | - |
| 2088 | printing to QPrinter. For example: | - |
| 2089 | | - |
| 2090 | \snippet code/src_gui_graphicsview_qgraphicsview.cpp 4 | - |
| 2091 | | - |
| 2092 | If \a source is a null rect, this function will use viewport()->rect() to | - |
| 2093 | determine what to draw. If \a target is a null rect, the full dimensions | - |
| 2094 | of \a painter's paint device (e.g., for a QPrinter, the page size) will be | - |
| 2095 | used. | - |
| 2096 | | - |
| 2097 | The source rect contents will be transformed according to \a | - |
| 2098 | aspectRatioMode to fit into the target rect. By default, the aspect ratio | - |
| 2099 | is kept, and \a source is scaled to fit in \a target. | - |
| 2100 | | - |
| 2101 | \sa QGraphicsScene::render() | - |
| 2102 | */ | - |
| 2103 | void QGraphicsView::render(QPainter *painter, const QRectF &target, const QRect &source, | - |
| 2104 | Qt::AspectRatioMode aspectRatioMode) | - |
| 2105 | { | - |
| 2106 | // ### Switch to using the recursive rendering algorithm instead. | - |
| 2107 | | - |
| 2108 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 2109 | if (!d->scene || !(painter && painter->isActive())) partially evaluated: !d->scene| no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: painter| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: painter->isActive()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 2110 | return; | 0 |
| 2111 | | - |
| 2112 | // Default source rect = viewport rect | - |
| 2113 | QRect sourceRect = source; executed (the execution status of this line is deduced): QRect sourceRect = source; | - |
| 2114 | if (source.isNull()) partially evaluated: source.isNull()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 2115 | sourceRect = viewport()->rect(); executed: sourceRect = viewport()->rect();Execution Count:1 | 1 |
| 2116 | | - |
| 2117 | // Default target rect = device rect | - |
| 2118 | QRectF targetRect = target; executed (the execution status of this line is deduced): QRectF targetRect = target; | - |
| 2119 | if (target.isNull()) { partially evaluated: target.isNull()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 2120 | if (painter->device()->devType() == QInternal::Picture) partially evaluated: painter->device()->devType() == QInternal::Picture| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 2121 | targetRect = sourceRect; never executed: targetRect = sourceRect; | 0 |
| 2122 | else | - |
| 2123 | targetRect.setRect(0, 0, painter->device()->width(), painter->device()->height()); executed: targetRect.setRect(0, 0, painter->device()->width(), painter->device()->height());Execution Count:1 | 1 |
| 2124 | } | - |
| 2125 | | - |
| 2126 | // Find the ideal x / y scaling ratio to fit \a source into \a target. | - |
| 2127 | qreal xratio = targetRect.width() / sourceRect.width(); executed (the execution status of this line is deduced): qreal xratio = targetRect.width() / sourceRect.width(); | - |
| 2128 | qreal yratio = targetRect.height() / sourceRect.height(); executed (the execution status of this line is deduced): qreal yratio = targetRect.height() / sourceRect.height(); | - |
| 2129 | | - |
| 2130 | // Scale according to the aspect ratio mode. | - |
| 2131 | switch (aspectRatioMode) { | - |
| 2132 | case Qt::KeepAspectRatio: | - |
| 2133 | xratio = yratio = qMin(xratio, yratio); executed (the execution status of this line is deduced): xratio = yratio = qMin(xratio, yratio); | - |
| 2134 | break; executed: break;Execution Count:1 | 1 |
| 2135 | case Qt::KeepAspectRatioByExpanding: | - |
| 2136 | xratio = yratio = qMax(xratio, yratio); never executed (the execution status of this line is deduced): xratio = yratio = qMax(xratio, yratio); | - |
| 2137 | break; | 0 |
| 2138 | case Qt::IgnoreAspectRatio: | - |
| 2139 | break; | 0 |
| 2140 | } | - |
| 2141 | | - |
| 2142 | // Find all items to draw, and reverse the list (we want to draw | - |
| 2143 | // in reverse order). | - |
| 2144 | QPolygonF sourceScenePoly = mapToScene(sourceRect.adjusted(-1, -1, 1, 1)); executed (the execution status of this line is deduced): QPolygonF sourceScenePoly = mapToScene(sourceRect.adjusted(-1, -1, 1, 1)); | - |
| 2145 | QList<QGraphicsItem *> itemList = d->scene->items(sourceScenePoly, executed (the execution status of this line is deduced): QList<QGraphicsItem *> itemList = d->scene->items(sourceScenePoly, | - |
| 2146 | Qt::IntersectsItemBoundingRect); executed (the execution status of this line is deduced): Qt::IntersectsItemBoundingRect); | - |
| 2147 | QGraphicsItem **itemArray = new QGraphicsItem *[itemList.size()]; executed (the execution status of this line is deduced): QGraphicsItem **itemArray = new QGraphicsItem *[itemList.size()]; | - |
| 2148 | int numItems = itemList.size(); executed (the execution status of this line is deduced): int numItems = itemList.size(); | - |
| 2149 | for (int i = 0; i < numItems; ++i) evaluated: i < numItems| yes Evaluation Count:4 | yes Evaluation Count:1 |
| 1-4 |
| 2150 | itemArray[numItems - i - 1] = itemList.at(i); executed: itemArray[numItems - i - 1] = itemList.at(i);Execution Count:4 | 4 |
| 2151 | itemList.clear(); executed (the execution status of this line is deduced): itemList.clear(); | - |
| 2152 | | - |
| 2153 | // Setup painter matrix. | - |
| 2154 | QTransform moveMatrix = QTransform::fromTranslate(-d->horizontalScroll(), -d->verticalScroll()); executed (the execution status of this line is deduced): QTransform moveMatrix = QTransform::fromTranslate(-d->horizontalScroll(), -d->verticalScroll()); | - |
| 2155 | QTransform painterMatrix = d->matrix * moveMatrix; executed (the execution status of this line is deduced): QTransform painterMatrix = d->matrix * moveMatrix; | - |
| 2156 | painterMatrix *= QTransform() executed (the execution status of this line is deduced): painterMatrix *= QTransform() | - |
| 2157 | .translate(targetRect.left(), targetRect.top()) executed (the execution status of this line is deduced): .translate(targetRect.left(), targetRect.top()) | - |
| 2158 | .scale(xratio, yratio) executed (the execution status of this line is deduced): .scale(xratio, yratio) | - |
| 2159 | .translate(-sourceRect.left(), -sourceRect.top()); executed (the execution status of this line is deduced): .translate(-sourceRect.left(), -sourceRect.top()); | - |
| 2160 | | - |
| 2161 | // Generate the style options | - |
| 2162 | QStyleOptionGraphicsItem *styleOptionArray = d->allocStyleOptionsArray(numItems); executed (the execution status of this line is deduced): QStyleOptionGraphicsItem *styleOptionArray = d->allocStyleOptionsArray(numItems); | - |
| 2163 | for (int i = 0; i < numItems; ++i) evaluated: i < numItems| yes Evaluation Count:4 | yes Evaluation Count:1 |
| 1-4 |
| 2164 | itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], painterMatrix, targetRect.toRect()); executed: itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], painterMatrix, targetRect.toRect());Execution Count:4 | 4 |
| 2165 | | - |
| 2166 | painter->save(); executed (the execution status of this line is deduced): painter->save(); | - |
| 2167 | | - |
| 2168 | // Clip in device coordinates to avoid QRegion transformations. | - |
| 2169 | painter->setClipRect(targetRect); executed (the execution status of this line is deduced): painter->setClipRect(targetRect); | - |
| 2170 | QPainterPath path; executed (the execution status of this line is deduced): QPainterPath path; | - |
| 2171 | path.addPolygon(sourceScenePoly); executed (the execution status of this line is deduced): path.addPolygon(sourceScenePoly); | - |
| 2172 | path.closeSubpath(); executed (the execution status of this line is deduced): path.closeSubpath(); | - |
| 2173 | painter->setClipPath(painterMatrix.map(path), Qt::IntersectClip); executed (the execution status of this line is deduced): painter->setClipPath(painterMatrix.map(path), Qt::IntersectClip); | - |
| 2174 | | - |
| 2175 | // Transform the painter. | - |
| 2176 | painter->setTransform(painterMatrix, true); executed (the execution status of this line is deduced): painter->setTransform(painterMatrix, true); | - |
| 2177 | | - |
| 2178 | // Render the scene. | - |
| 2179 | QRectF sourceSceneRect = sourceScenePoly.boundingRect(); executed (the execution status of this line is deduced): QRectF sourceSceneRect = sourceScenePoly.boundingRect(); | - |
| 2180 | drawBackground(painter, sourceSceneRect); executed (the execution status of this line is deduced): drawBackground(painter, sourceSceneRect); | - |
| 2181 | drawItems(painter, numItems, itemArray, styleOptionArray); executed (the execution status of this line is deduced): drawItems(painter, numItems, itemArray, styleOptionArray); | - |
| 2182 | drawForeground(painter, sourceSceneRect); executed (the execution status of this line is deduced): drawForeground(painter, sourceSceneRect); | - |
| 2183 | | - |
| 2184 | delete [] itemArray; executed (the execution status of this line is deduced): delete [] itemArray; | - |
| 2185 | d->freeStyleOptionsArray(styleOptionArray); executed (the execution status of this line is deduced): d->freeStyleOptionsArray(styleOptionArray); | - |
| 2186 | | - |
| 2187 | painter->restore(); executed (the execution status of this line is deduced): painter->restore(); | - |
| 2188 | } executed: }Execution Count:1 | 1 |
| 2189 | | - |
| 2190 | /*! | - |
| 2191 | Returns a list of all the items in the associated scene, in descending | - |
| 2192 | stacking order (i.e., the first item in the returned list is the uppermost | - |
| 2193 | item). | - |
| 2194 | | - |
| 2195 | \sa QGraphicsScene::items(), {QGraphicsItem#Sorting}{Sorting} | - |
| 2196 | */ | - |
| 2197 | QList<QGraphicsItem *> QGraphicsView::items() const | - |
| 2198 | { | - |
| 2199 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 2200 | if (!d->scene) partially evaluated: !d->scene| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 2201 | return QList<QGraphicsItem *>(); executed: return QList<QGraphicsItem *>();Execution Count:1 | 1 |
| 2202 | return d->scene->items(); never executed: return d->scene->items(); | 0 |
| 2203 | } | - |
| 2204 | | - |
| 2205 | /*! | - |
| 2206 | Returns a list of all the items at the position \a pos in the view. The | - |
| 2207 | items are listed in descending stacking order (i.e., the first item in the | - |
| 2208 | list is the uppermost item, and the last item is the lowermost item). \a | - |
| 2209 | pos is in viewport coordinates. | - |
| 2210 | | - |
| 2211 | This function is most commonly called from within mouse event handlers in | - |
| 2212 | a subclass in QGraphicsView. \a pos is in untransformed viewport | - |
| 2213 | coordinates, just like QMouseEvent::pos(). | - |
| 2214 | | - |
| 2215 | \snippet code/src_gui_graphicsview_qgraphicsview.cpp 5 | - |
| 2216 | | - |
| 2217 | \sa QGraphicsScene::items(), {QGraphicsItem#Sorting}{Sorting} | - |
| 2218 | */ | - |
| 2219 | QList<QGraphicsItem *> QGraphicsView::items(const QPoint &pos) const | - |
| 2220 | { | - |
| 2221 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 2222 | if (!d->scene) evaluated: !d->scene| yes Evaluation Count:2 | yes Evaluation Count:72 |
| 2-72 |
| 2223 | return QList<QGraphicsItem *>(); executed: return QList<QGraphicsItem *>();Execution Count:2 | 2 |
| 2224 | // ### Unify these two, and use the items(QPointF) version in | - |
| 2225 | // QGraphicsScene instead. The scene items function could use the viewport | - |
| 2226 | // transform to map the point to a rect/polygon. | - |
| 2227 | if ((d->identityMatrix || d->matrix.type() <= QTransform::TxScale)) { evaluated: d->identityMatrix| yes Evaluation Count:40 | yes Evaluation Count:32 |
evaluated: d->matrix.type() <= QTransform::TxScale| yes Evaluation Count:31 | yes Evaluation Count:1 |
| 1-40 |
| 2228 | // Use the rect version | - |
| 2229 | QTransform xinv = viewportTransform().inverted(); executed (the execution status of this line is deduced): QTransform xinv = viewportTransform().inverted(); | - |
| 2230 | return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)), executed: return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform());Execution Count:71 | 71 |
| 2231 | Qt::IntersectsItemShape, executed: return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform());Execution Count:71 | 71 |
| 2232 | Qt::DescendingOrder, executed: return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform());Execution Count:71 | 71 |
| 2233 | viewportTransform()); executed: return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform());Execution Count:71 | 71 |
| 2234 | } | - |
| 2235 | // Use the polygon version | - |
| 2236 | return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1), executed: return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform());Execution Count:1 | 1 |
| 2237 | Qt::IntersectsItemShape, executed: return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform());Execution Count:1 | 1 |
| 2238 | Qt::DescendingOrder, executed: return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform());Execution Count:1 | 1 |
| 2239 | viewportTransform()); executed: return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform());Execution Count:1 | 1 |
| 2240 | } | - |
| 2241 | | - |
| 2242 | /*! | - |
| 2243 | \fn QGraphicsView::items(int x, int y) const | - |
| 2244 | | - |
| 2245 | This function is provided for convenience. It's equivalent to calling | - |
| 2246 | items(QPoint(\a x, \a y)). | - |
| 2247 | */ | - |
| 2248 | | - |
| 2249 | /*! | - |
| 2250 | \overload | - |
| 2251 | | - |
| 2252 | Returns a list of all the items that, depending on \a mode, are either | - |
| 2253 | contained by or intersect with \a rect. \a rect is in viewport | - |
| 2254 | coordinates. | - |
| 2255 | | - |
| 2256 | The default value for \a mode is Qt::IntersectsItemShape; all items whose | - |
| 2257 | exact shape intersects with or is contained by \a rect are returned. | - |
| 2258 | | - |
| 2259 | The items are sorted in descending stacking order (i.e., the first item in | - |
| 2260 | the returned list is the uppermost item). | - |
| 2261 | | - |
| 2262 | \sa itemAt(), items(), mapToScene(), {QGraphicsItem#Sorting}{Sorting} | - |
| 2263 | */ | - |
| 2264 | QList<QGraphicsItem *> QGraphicsView::items(const QRect &rect, Qt::ItemSelectionMode mode) const | - |
| 2265 | { | - |
| 2266 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 2267 | if (!d->scene) evaluated: !d->scene| yes Evaluation Count:2 | yes Evaluation Count:6 |
| 2-6 |
| 2268 | return QList<QGraphicsItem *>(); executed: return QList<QGraphicsItem *>();Execution Count:2 | 2 |
| 2269 | return d->scene->items(mapToScene(rect), mode, Qt::DescendingOrder, viewportTransform()); executed: return d->scene->items(mapToScene(rect), mode, Qt::DescendingOrder, viewportTransform());Execution Count:6 | 6 |
| 2270 | } | - |
| 2271 | | - |
| 2272 | /*! | - |
| 2273 | \fn QList<QGraphicsItem *> QGraphicsView::items(int x, int y, int w, int h, Qt::ItemSelectionMode mode) const | - |
| 2274 | \since 4.3 | - |
| 2275 | | - |
| 2276 | This convenience function is equivalent to calling items(QRectF(\a x, \a | - |
| 2277 | y, \a w, \a h), \a mode). | - |
| 2278 | */ | - |
| 2279 | | - |
| 2280 | /*! | - |
| 2281 | \overload | - |
| 2282 | | - |
| 2283 | Returns a list of all the items that, depending on \a mode, are either | - |
| 2284 | contained by or intersect with \a polygon. \a polygon is in viewport | - |
| 2285 | coordinates. | - |
| 2286 | | - |
| 2287 | The default value for \a mode is Qt::IntersectsItemShape; all items whose | - |
| 2288 | exact shape intersects with or is contained by \a polygon are returned. | - |
| 2289 | | - |
| 2290 | The items are sorted by descending stacking order (i.e., the first item in | - |
| 2291 | the returned list is the uppermost item). | - |
| 2292 | | - |
| 2293 | \sa itemAt(), items(), mapToScene(), {QGraphicsItem#Sorting}{Sorting} | - |
| 2294 | */ | - |
| 2295 | QList<QGraphicsItem *> QGraphicsView::items(const QPolygon &polygon, Qt::ItemSelectionMode mode) const | - |
| 2296 | { | - |
| 2297 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 2298 | if (!d->scene) evaluated: !d->scene| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
| 2299 | return QList<QGraphicsItem *>(); executed: return QList<QGraphicsItem *>();Execution Count:2 | 2 |
| 2300 | return d->scene->items(mapToScene(polygon), mode, Qt::DescendingOrder, viewportTransform()); executed: return d->scene->items(mapToScene(polygon), mode, Qt::DescendingOrder, viewportTransform());Execution Count:2 | 2 |
| 2301 | } | - |
| 2302 | | - |
| 2303 | /*! | - |
| 2304 | \overload | - |
| 2305 | | - |
| 2306 | Returns a list of all the items that, depending on \a mode, are either | - |
| 2307 | contained by or intersect with \a path. \a path is in viewport | - |
| 2308 | coordinates. | - |
| 2309 | | - |
| 2310 | The default value for \a mode is Qt::IntersectsItemShape; all items whose | - |
| 2311 | exact shape intersects with or is contained by \a path are returned. | - |
| 2312 | | - |
| 2313 | \sa itemAt(), items(), mapToScene(), {QGraphicsItem#Sorting}{Sorting} | - |
| 2314 | */ | - |
| 2315 | QList<QGraphicsItem *> QGraphicsView::items(const QPainterPath &path, Qt::ItemSelectionMode mode) const | - |
| 2316 | { | - |
| 2317 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 2318 | if (!d->scene) evaluated: !d->scene| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
| 2319 | return QList<QGraphicsItem *>(); executed: return QList<QGraphicsItem *>();Execution Count:2 | 2 |
| 2320 | return d->scene->items(mapToScene(path), mode, Qt::DescendingOrder, viewportTransform()); executed: return d->scene->items(mapToScene(path), mode, Qt::DescendingOrder, viewportTransform());Execution Count:2 | 2 |
| 2321 | } | - |
| 2322 | | - |
| 2323 | /*! | - |
| 2324 | Returns the item at position \a pos, which is in viewport coordinates. | - |
| 2325 | If there are several items at this position, this function returns | - |
| 2326 | the topmost item. | - |
| 2327 | | - |
| 2328 | Example: | - |
| 2329 | | - |
| 2330 | \snippet code/src_gui_graphicsview_qgraphicsview.cpp 6 | - |
| 2331 | | - |
| 2332 | \sa items(), {QGraphicsItem#Sorting}{Sorting} | - |
| 2333 | */ | - |
| 2334 | QGraphicsItem *QGraphicsView::itemAt(const QPoint &pos) const | - |
| 2335 | { | - |
| 2336 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 2337 | if (!d->scene) evaluated: !d->scene| yes Evaluation Count:2 | yes Evaluation Count:50 |
| 2-50 |
| 2338 | return 0; executed: return 0;Execution Count:2 | 2 |
| 2339 | QList<QGraphicsItem *> itemsAtPos = items(pos); executed (the execution status of this line is deduced): QList<QGraphicsItem *> itemsAtPos = items(pos); | - |
| 2340 | return itemsAtPos.isEmpty() ? 0 : itemsAtPos.first(); executed: return itemsAtPos.isEmpty() ? 0 : itemsAtPos.first();Execution Count:50 | 50 |
| 2341 | } | - |
| 2342 | | - |
| 2343 | /*! | - |
| 2344 | \overload | - |
| 2345 | \fn QGraphicsItem *QGraphicsView::itemAt(int x, int y) const | - |
| 2346 | | - |
| 2347 | This function is provided for convenience. It's equivalent to | - |
| 2348 | calling itemAt(QPoint(\a x, \a y)). | - |
| 2349 | */ | - |
| 2350 | | - |
| 2351 | /*! | - |
| 2352 | Returns the viewport coordinate \a point mapped to scene coordinates. | - |
| 2353 | | - |
| 2354 | Note: It can be useful to map the whole rectangle covered by the pixel at | - |
| 2355 | \a point instead of the point itself. To do this, you can call | - |
| 2356 | mapToScene(QRect(\a point, QSize(2, 2))). | - |
| 2357 | | - |
| 2358 | \sa mapFromScene() | - |
| 2359 | */ | - |
| 2360 | QPointF QGraphicsView::mapToScene(const QPoint &point) const | - |
| 2361 | { | - |
| 2362 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 2363 | QPointF p = point; executed (the execution status of this line is deduced): QPointF p = point; | - |
| 2364 | p.rx() += d->horizontalScroll(); executed (the execution status of this line is deduced): p.rx() += d->horizontalScroll(); | - |
| 2365 | p.ry() += d->verticalScroll(); executed (the execution status of this line is deduced): p.ry() += d->verticalScroll(); | - |
| 2366 | return d->identityMatrix ? p : d->matrix.inverted().map(p); executed: return d->identityMatrix ? p : d->matrix.inverted().map(p);Execution Count:237441 | 237441 |
| 2367 | } | - |
| 2368 | | - |
| 2369 | /*! | - |
| 2370 | \fn QGraphicsView::mapToScene(int x, int y) const | - |
| 2371 | | - |
| 2372 | This function is provided for convenience. It's equivalent to calling | - |
| 2373 | mapToScene(QPoint(\a x, \a y)). | - |
| 2374 | */ | - |
| 2375 | | - |
| 2376 | /*! | - |
| 2377 | Returns the viewport rectangle \a rect mapped to a scene coordinate | - |
| 2378 | polygon. | - |
| 2379 | | - |
| 2380 | \sa mapFromScene() | - |
| 2381 | */ | - |
| 2382 | QPolygonF QGraphicsView::mapToScene(const QRect &rect) const | - |
| 2383 | { | - |
| 2384 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 2385 | if (!rect.isValid()) evaluated: !rect.isValid()| yes Evaluation Count:3 | yes Evaluation Count:2044 |
| 3-2044 |
| 2386 | return QPolygonF(); executed: return QPolygonF();Execution Count:3 | 3 |
| 2387 | | - |
| 2388 | QPointF scrollOffset(d->horizontalScroll(), d->verticalScroll()); executed (the execution status of this line is deduced): QPointF scrollOffset(d->horizontalScroll(), d->verticalScroll()); | - |
| 2389 | QRect r = rect.adjusted(0, 0, 1, 1); executed (the execution status of this line is deduced): QRect r = rect.adjusted(0, 0, 1, 1); | - |
| 2390 | QPointF tl = scrollOffset + r.topLeft(); executed (the execution status of this line is deduced): QPointF tl = scrollOffset + r.topLeft(); | - |
| 2391 | QPointF tr = scrollOffset + r.topRight(); executed (the execution status of this line is deduced): QPointF tr = scrollOffset + r.topRight(); | - |
| 2392 | QPointF br = scrollOffset + r.bottomRight(); executed (the execution status of this line is deduced): QPointF br = scrollOffset + r.bottomRight(); | - |
| 2393 | QPointF bl = scrollOffset + r.bottomLeft(); executed (the execution status of this line is deduced): QPointF bl = scrollOffset + r.bottomLeft(); | - |
| 2394 | | - |
| 2395 | QPolygonF poly(4); executed (the execution status of this line is deduced): QPolygonF poly(4); | - |
| 2396 | if (!d->identityMatrix) { evaluated: !d->identityMatrix| yes Evaluation Count:891 | yes Evaluation Count:1153 |
| 891-1153 |
| 2397 | QTransform x = d->matrix.inverted(); executed (the execution status of this line is deduced): QTransform x = d->matrix.inverted(); | - |
| 2398 | poly[0] = x.map(tl); executed (the execution status of this line is deduced): poly[0] = x.map(tl); | - |
| 2399 | poly[1] = x.map(tr); executed (the execution status of this line is deduced): poly[1] = x.map(tr); | - |
| 2400 | poly[2] = x.map(br); executed (the execution status of this line is deduced): poly[2] = x.map(br); | - |
| 2401 | poly[3] = x.map(bl); executed (the execution status of this line is deduced): poly[3] = x.map(bl); | - |
| 2402 | } else { executed: }Execution Count:891 | 891 |
| 2403 | poly[0] = tl; executed (the execution status of this line is deduced): poly[0] = tl; | - |
| 2404 | poly[1] = tr; executed (the execution status of this line is deduced): poly[1] = tr; | - |
| 2405 | poly[2] = br; executed (the execution status of this line is deduced): poly[2] = br; | - |
| 2406 | poly[3] = bl; executed (the execution status of this line is deduced): poly[3] = bl; | - |
| 2407 | } executed: }Execution Count:1153 | 1153 |
| 2408 | return poly; executed: return poly;Execution Count:2044 | 2044 |
| 2409 | } | - |
| 2410 | | - |
| 2411 | /*! | - |
| 2412 | \fn QGraphicsView::mapToScene(int x, int y, int w, int h) const | - |
| 2413 | | - |
| 2414 | This function is provided for convenience. It's equivalent to calling | - |
| 2415 | mapToScene(QRect(\a x, \a y, \a w, \a h)). | - |
| 2416 | */ | - |
| 2417 | | - |
| 2418 | /*! | - |
| 2419 | Returns the viewport polygon \a polygon mapped to a scene coordinate | - |
| 2420 | polygon. | - |
| 2421 | | - |
| 2422 | \sa mapFromScene() | - |
| 2423 | */ | - |
| 2424 | QPolygonF QGraphicsView::mapToScene(const QPolygon &polygon) const | - |
| 2425 | { | - |
| 2426 | QPolygonF poly; executed (the execution status of this line is deduced): QPolygonF poly; | - |
| 2427 | foreach (const QPoint &point, polygon) executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(polygon)> _container_(polygon); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QPoint &point = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 2428 | poly << mapToScene(point); executed: poly << mapToScene(point);Execution Count:12 | 12 |
| 2429 | return poly; executed: return poly;Execution Count:4 | 4 |
| 2430 | } | - |
| 2431 | | - |
| 2432 | /*! | - |
| 2433 | Returns the viewport painter path \a path mapped to a scene coordinate | - |
| 2434 | painter path. | - |
| 2435 | | - |
| 2436 | \sa mapFromScene() | - |
| 2437 | */ | - |
| 2438 | QPainterPath QGraphicsView::mapToScene(const QPainterPath &path) const | - |
| 2439 | { | - |
| 2440 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 2441 | QTransform matrix = QTransform::fromTranslate(d->horizontalScroll(), d->verticalScroll()); executed (the execution status of this line is deduced): QTransform matrix = QTransform::fromTranslate(d->horizontalScroll(), d->verticalScroll()); | - |
| 2442 | matrix *= d->matrix.inverted(); executed (the execution status of this line is deduced): matrix *= d->matrix.inverted(); | - |
| 2443 | return matrix.map(path); executed: return matrix.map(path);Execution Count:3 | 3 |
| 2444 | } | - |
| 2445 | | - |
| 2446 | /*! | - |
| 2447 | Returns the scene coordinate \a point to viewport coordinates. | - |
| 2448 | | - |
| 2449 | \sa mapToScene() | - |
| 2450 | */ | - |
| 2451 | QPoint QGraphicsView::mapFromScene(const QPointF &point) const | - |
| 2452 | { | - |
| 2453 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 2454 | QPointF p = d->identityMatrix ? point : d->matrix.map(point); evaluated: d->identityMatrix| yes Evaluation Count:230563 | yes Evaluation Count:568 |
| 568-230563 |
| 2455 | p.rx() -= d->horizontalScroll(); executed (the execution status of this line is deduced): p.rx() -= d->horizontalScroll(); | - |
| 2456 | p.ry() -= d->verticalScroll(); executed (the execution status of this line is deduced): p.ry() -= d->verticalScroll(); | - |
| 2457 | return p.toPoint(); executed: return p.toPoint();Execution Count:231131 | 231131 |
| 2458 | } | - |
| 2459 | | - |
| 2460 | /*! | - |
| 2461 | \fn QGraphicsView::mapFromScene(qreal x, qreal y) const | - |
| 2462 | | - |
| 2463 | This function is provided for convenience. It's equivalent to | - |
| 2464 | calling mapFromScene(QPointF(\a x, \a y)). | - |
| 2465 | */ | - |
| 2466 | | - |
| 2467 | /*! | - |
| 2468 | Returns the scene rectangle \a rect to a viewport coordinate | - |
| 2469 | polygon. | - |
| 2470 | | - |
| 2471 | \sa mapToScene() | - |
| 2472 | */ | - |
| 2473 | QPolygon QGraphicsView::mapFromScene(const QRectF &rect) const | - |
| 2474 | { | - |
| 2475 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 2476 | QPointF tl; executed (the execution status of this line is deduced): QPointF tl; | - |
| 2477 | QPointF tr; executed (the execution status of this line is deduced): QPointF tr; | - |
| 2478 | QPointF br; executed (the execution status of this line is deduced): QPointF br; | - |
| 2479 | QPointF bl; executed (the execution status of this line is deduced): QPointF bl; | - |
| 2480 | if (!d->identityMatrix) { evaluated: !d->identityMatrix| yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
| 2481 | const QTransform &x = d->matrix; executed (the execution status of this line is deduced): const QTransform &x = d->matrix; | - |
| 2482 | tl = x.map(rect.topLeft()); executed (the execution status of this line is deduced): tl = x.map(rect.topLeft()); | - |
| 2483 | tr = x.map(rect.topRight()); executed (the execution status of this line is deduced): tr = x.map(rect.topRight()); | - |
| 2484 | br = x.map(rect.bottomRight()); executed (the execution status of this line is deduced): br = x.map(rect.bottomRight()); | - |
| 2485 | bl = x.map(rect.bottomLeft()); executed (the execution status of this line is deduced): bl = x.map(rect.bottomLeft()); | - |
| 2486 | } else { executed: }Execution Count:2 | 2 |
| 2487 | tl = rect.topLeft(); executed (the execution status of this line is deduced): tl = rect.topLeft(); | - |
| 2488 | tr = rect.topRight(); executed (the execution status of this line is deduced): tr = rect.topRight(); | - |
| 2489 | br = rect.bottomRight(); executed (the execution status of this line is deduced): br = rect.bottomRight(); | - |
| 2490 | bl = rect.bottomLeft(); executed (the execution status of this line is deduced): bl = rect.bottomLeft(); | - |
| 2491 | } executed: }Execution Count:5 | 5 |
| 2492 | QPointF scrollOffset(d->horizontalScroll(), d->verticalScroll()); executed (the execution status of this line is deduced): QPointF scrollOffset(d->horizontalScroll(), d->verticalScroll()); | - |
| 2493 | tl -= scrollOffset; executed (the execution status of this line is deduced): tl -= scrollOffset; | - |
| 2494 | tr -= scrollOffset; executed (the execution status of this line is deduced): tr -= scrollOffset; | - |
| 2495 | br -= scrollOffset; executed (the execution status of this line is deduced): br -= scrollOffset; | - |
| 2496 | bl -= scrollOffset; executed (the execution status of this line is deduced): bl -= scrollOffset; | - |
| 2497 | | - |
| 2498 | QPolygon poly(4); executed (the execution status of this line is deduced): QPolygon poly(4); | - |
| 2499 | poly[0] = tl.toPoint(); executed (the execution status of this line is deduced): poly[0] = tl.toPoint(); | - |
| 2500 | poly[1] = tr.toPoint(); executed (the execution status of this line is deduced): poly[1] = tr.toPoint(); | - |
| 2501 | poly[2] = br.toPoint(); executed (the execution status of this line is deduced): poly[2] = br.toPoint(); | - |
| 2502 | poly[3] = bl.toPoint(); executed (the execution status of this line is deduced): poly[3] = bl.toPoint(); | - |
| 2503 | return poly; executed: return poly;Execution Count:7 | 7 |
| 2504 | } | - |
| 2505 | | - |
| 2506 | /*! | - |
| 2507 | \fn QGraphicsView::mapFromScene(qreal x, qreal y, qreal w, qreal h) const | - |
| 2508 | | - |
| 2509 | This function is provided for convenience. It's equivalent to | - |
| 2510 | calling mapFromScene(QRectF(\a x, \a y, \a w, \a h)). | - |
| 2511 | */ | - |
| 2512 | | - |
| 2513 | /*! | - |
| 2514 | Returns the scene coordinate polygon \a polygon to a viewport coordinate | - |
| 2515 | polygon. | - |
| 2516 | | - |
| 2517 | \sa mapToScene() | - |
| 2518 | */ | - |
| 2519 | QPolygon QGraphicsView::mapFromScene(const QPolygonF &polygon) const | - |
| 2520 | { | - |
| 2521 | QPolygon poly; executed (the execution status of this line is deduced): QPolygon poly; | - |
| 2522 | foreach (const QPointF &point, polygon) executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(polygon)> _container_(polygon); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QPointF &point = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 2523 | poly << mapFromScene(point); executed: poly << mapFromScene(point);Execution Count:4 | 4 |
| 2524 | return poly; executed: return poly;Execution Count:2 | 2 |
| 2525 | } | - |
| 2526 | | - |
| 2527 | /*! | - |
| 2528 | Returns the scene coordinate painter path \a path to a viewport coordinate | - |
| 2529 | painter path. | - |
| 2530 | | - |
| 2531 | \sa mapToScene() | - |
| 2532 | */ | - |
| 2533 | QPainterPath QGraphicsView::mapFromScene(const QPainterPath &path) const | - |
| 2534 | { | - |
| 2535 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 2536 | QTransform matrix = d->matrix; executed (the execution status of this line is deduced): QTransform matrix = d->matrix; | - |
| 2537 | matrix *= QTransform::fromTranslate(-d->horizontalScroll(), -d->verticalScroll()); executed (the execution status of this line is deduced): matrix *= QTransform::fromTranslate(-d->horizontalScroll(), -d->verticalScroll()); | - |
| 2538 | return matrix.map(path); executed: return matrix.map(path);Execution Count:1 | 1 |
| 2539 | } | - |
| 2540 | | - |
| 2541 | /*! | - |
| 2542 | \reimp | - |
| 2543 | */ | - |
| 2544 | QVariant QGraphicsView::inputMethodQuery(Qt::InputMethodQuery query) const | - |
| 2545 | { | - |
| 2546 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 2547 | if (!d->scene) partially evaluated: !d->scene| no Evaluation Count:0 | yes Evaluation Count:11 |
| 0-11 |
| 2548 | return QVariant(); never executed: return QVariant(); | 0 |
| 2549 | | - |
| 2550 | QVariant value = d->scene->inputMethodQuery(query); executed (the execution status of this line is deduced): QVariant value = d->scene->inputMethodQuery(query); | - |
| 2551 | if (value.type() == QVariant::RectF) evaluated: value.type() == QVariant::RectF| yes Evaluation Count:2 | yes Evaluation Count:9 |
| 2-9 |
| 2552 | value = d->mapRectFromScene(value.toRectF()); executed: value = d->mapRectFromScene(value.toRectF());Execution Count:2 | 2 |
| 2553 | else if (value.type() == QVariant::PointF) partially evaluated: value.type() == QVariant::PointF| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 2554 | value = mapFromScene(value.toPointF()); never executed: value = mapFromScene(value.toPointF()); | 0 |
| 2555 | else if (value.type() == QVariant::Rect) partially evaluated: value.type() == QVariant::Rect| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 2556 | value = d->mapRectFromScene(value.toRect()).toRect(); never executed: value = d->mapRectFromScene(value.toRect()).toRect(); | 0 |
| 2557 | else if (value.type() == QVariant::Point) partially evaluated: value.type() == QVariant::Point| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 2558 | value = mapFromScene(value.toPoint()); never executed: value = mapFromScene(value.toPoint()); | 0 |
| 2559 | return value; executed: return value;Execution Count:11 | 11 |
| 2560 | } | - |
| 2561 | | - |
| 2562 | /*! | - |
| 2563 | \property QGraphicsView::backgroundBrush | - |
| 2564 | \brief the background brush of the scene. | - |
| 2565 | | - |
| 2566 | This property sets the background brush for the scene in this view. It is | - |
| 2567 | used to override the scene's own background, and defines the behavior of | - |
| 2568 | drawBackground(). To provide custom background drawing for this view, you | - |
| 2569 | can reimplement drawBackground() instead. | - |
| 2570 | | - |
| 2571 | By default, this property contains a brush with the Qt::NoBrush pattern. | - |
| 2572 | | - |
| 2573 | \sa QGraphicsScene::backgroundBrush, foregroundBrush | - |
| 2574 | */ | - |
| 2575 | QBrush QGraphicsView::backgroundBrush() const | - |
| 2576 | { | - |
| 2577 | Q_D(const QGraphicsView); never executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 2578 | return d->backgroundBrush; never executed: return d->backgroundBrush; | 0 |
| 2579 | } | - |
| 2580 | void QGraphicsView::setBackgroundBrush(const QBrush &brush) | - |
| 2581 | { | - |
| 2582 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 2583 | d->backgroundBrush = brush; executed (the execution status of this line is deduced): d->backgroundBrush = brush; | - |
| 2584 | d->updateAll(); executed (the execution status of this line is deduced): d->updateAll(); | - |
| 2585 | | - |
| 2586 | if (d->cacheMode & CacheBackground) { partially evaluated: d->cacheMode & CacheBackground| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 2587 | // Invalidate the background pixmap | - |
| 2588 | d->mustResizeBackgroundPixmap = true; never executed (the execution status of this line is deduced): d->mustResizeBackgroundPixmap = true; | - |
| 2589 | } | 0 |
| 2590 | } executed: }Execution Count:2 | 2 |
| 2591 | | - |
| 2592 | /*! | - |
| 2593 | \property QGraphicsView::foregroundBrush | - |
| 2594 | \brief the foreground brush of the scene. | - |
| 2595 | | - |
| 2596 | This property sets the foreground brush for the scene in this view. It is | - |
| 2597 | used to override the scene's own foreground, and defines the behavior of | - |
| 2598 | drawForeground(). To provide custom foreground drawing for this view, you | - |
| 2599 | can reimplement drawForeground() instead. | - |
| 2600 | | - |
| 2601 | By default, this property contains a brush with the Qt::NoBrush pattern. | - |
| 2602 | | - |
| 2603 | \sa QGraphicsScene::foregroundBrush, backgroundBrush | - |
| 2604 | */ | - |
| 2605 | QBrush QGraphicsView::foregroundBrush() const | - |
| 2606 | { | - |
| 2607 | Q_D(const QGraphicsView); never executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 2608 | return d->foregroundBrush; never executed: return d->foregroundBrush; | 0 |
| 2609 | } | - |
| 2610 | void QGraphicsView::setForegroundBrush(const QBrush &brush) | - |
| 2611 | { | - |
| 2612 | Q_D(QGraphicsView); never executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 2613 | d->foregroundBrush = brush; never executed (the execution status of this line is deduced): d->foregroundBrush = brush; | - |
| 2614 | d->updateAll(); never executed (the execution status of this line is deduced): d->updateAll(); | - |
| 2615 | } | 0 |
| 2616 | | - |
| 2617 | /*! | - |
| 2618 | Schedules an update of the scene rectangles \a rects. | - |
| 2619 | | - |
| 2620 | \sa QGraphicsScene::changed() | - |
| 2621 | */ | - |
| 2622 | void QGraphicsView::updateScene(const QList<QRectF> &rects) | - |
| 2623 | { | - |
| 2624 | // ### Note: Since 4.5, this slot is only called if the user explicitly | - |
| 2625 | // establishes a connection between the scene and the view, as the scene | - |
| 2626 | // and view are no longer connected. We need to keep it working (basically | - |
| 2627 | // leave it as it is), but the new delivery path is through | - |
| 2628 | // QGraphicsScenePrivate::itemUpdate(). | - |
| 2629 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 2630 | if (d->fullUpdatePending || d->viewportUpdateMode == QGraphicsView::NoViewportUpdate) evaluated: d->fullUpdatePending| yes Evaluation Count:12 | yes Evaluation Count:12 |
partially evaluated: d->viewportUpdateMode == QGraphicsView::NoViewportUpdate| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 2631 | return; executed: return;Execution Count:12 | 12 |
| 2632 | | - |
| 2633 | // Extract and reset dirty scene rect info. | - |
| 2634 | QVector<QRect> dirtyViewportRects; executed (the execution status of this line is deduced): QVector<QRect> dirtyViewportRects; | - |
| 2635 | const QVector<QRect> &dirtyRects = d->dirtyRegion.rects(); executed (the execution status of this line is deduced): const QVector<QRect> &dirtyRects = d->dirtyRegion.rects(); | - |
| 2636 | for (int i = 0; i < dirtyRects.size(); ++i) partially evaluated: i < dirtyRects.size()| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 2637 | dirtyViewportRects += dirtyRects.at(i); never executed: dirtyViewportRects += dirtyRects.at(i); | 0 |
| 2638 | d->dirtyRegion = QRegion(); executed (the execution status of this line is deduced): d->dirtyRegion = QRegion(); | - |
| 2639 | d->dirtyBoundingRect = QRect(); executed (the execution status of this line is deduced): d->dirtyBoundingRect = QRect(); | - |
| 2640 | | - |
| 2641 | bool fullUpdate = !d->accelerateScrolling || d->viewportUpdateMode == QGraphicsView::FullViewportUpdate; partially evaluated: !d->accelerateScrolling| no Evaluation Count:0 | yes Evaluation Count:12 |
partially evaluated: d->viewportUpdateMode == QGraphicsView::FullViewportUpdate| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 2642 | bool boundingRectUpdate = (d->viewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate) partially evaluated: (d->viewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate)| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 2643 | || (d->viewportUpdateMode == QGraphicsView::SmartViewportUpdate partially evaluated: d->viewportUpdateMode == QGraphicsView::SmartViewportUpdate| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 2644 | && ((dirtyViewportRects.size() + rects.size()) >= QGRAPHICSVIEW_REGION_RECT_THRESHOLD)); never evaluated: ((dirtyViewportRects.size() + rects.size()) >= QGRAPHICSVIEW_REGION_RECT_THRESHOLD) | 0 |
| 2645 | | - |
| 2646 | QRegion updateRegion; executed (the execution status of this line is deduced): QRegion updateRegion; | - |
| 2647 | QRect boundingRect; executed (the execution status of this line is deduced): QRect boundingRect; | - |
| 2648 | QRect viewportRect = viewport()->rect(); executed (the execution status of this line is deduced): QRect viewportRect = viewport()->rect(); | - |
| 2649 | bool redraw = false; executed (the execution status of this line is deduced): bool redraw = false; | - |
| 2650 | QTransform transform = viewportTransform(); executed (the execution status of this line is deduced): QTransform transform = viewportTransform(); | - |
| 2651 | | - |
| 2652 | // Convert scene rects to viewport rects. | - |
| 2653 | foreach (const QRectF &rect, rects) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(rects)> _container_(rects); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QRectF &rect = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 2654 | QRect xrect = transform.mapRect(rect).toAlignedRect(); executed (the execution status of this line is deduced): QRect xrect = transform.mapRect(rect).toAlignedRect(); | - |
| 2655 | if (!(d->optimizationFlags & DontAdjustForAntialiasing)) evaluated: !(d->optimizationFlags & DontAdjustForAntialiasing)| yes Evaluation Count:6 | yes Evaluation Count:4 |
| 4-6 |
| 2656 | xrect.adjust(-2, -2, 2, 2); executed: xrect.adjust(-2, -2, 2, 2);Execution Count:6 | 6 |
| 2657 | else | - |
| 2658 | xrect.adjust(-1, -1, 1, 1); executed: xrect.adjust(-1, -1, 1, 1);Execution Count:4 | 4 |
| 2659 | if (!viewportRect.intersects(xrect)) partially evaluated: !viewportRect.intersects(xrect)| no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
| 2660 | continue; never executed: continue; | 0 |
| 2661 | dirtyViewportRects << xrect; executed (the execution status of this line is deduced): dirtyViewportRects << xrect; | - |
| 2662 | } executed: }Execution Count:10 | 10 |
| 2663 | | - |
| 2664 | foreach (const QRect &rect, dirtyViewportRects) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(dirtyViewportRects)> _container_(dirtyViewportRects); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QRect &rect = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 2665 | // Add the exposed rect to the update region. In rect update | - |
| 2666 | // mode, we only count the bounding rect of items. | - |
| 2667 | if (!boundingRectUpdate) { partially evaluated: !boundingRectUpdate| yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
| 2668 | updateRegion += rect; executed (the execution status of this line is deduced): updateRegion += rect; | - |
| 2669 | } else { executed: }Execution Count:10 | 10 |
| 2670 | boundingRect |= rect; never executed (the execution status of this line is deduced): boundingRect |= rect; | - |
| 2671 | } | 0 |
| 2672 | redraw = true; executed (the execution status of this line is deduced): redraw = true; | - |
| 2673 | if (fullUpdate) { partially evaluated: fullUpdate| no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
| 2674 | // If fullUpdate is true and we found a visible dirty rect, | - |
| 2675 | // we're done. | - |
| 2676 | break; | 0 |
| 2677 | } | - |
| 2678 | } executed: }Execution Count:10 | 10 |
| 2679 | | - |
| 2680 | if (!redraw) evaluated: !redraw| yes Evaluation Count:4 | yes Evaluation Count:8 |
| 4-8 |
| 2681 | return; executed: return;Execution Count:4 | 4 |
| 2682 | | - |
| 2683 | if (fullUpdate) partially evaluated: fullUpdate| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 2684 | viewport()->update(); never executed: viewport()->update(); | 0 |
| 2685 | else if (boundingRectUpdate) partially evaluated: boundingRectUpdate| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 2686 | viewport()->update(boundingRect); never executed: viewport()->update(boundingRect); | 0 |
| 2687 | else | - |
| 2688 | viewport()->update(updateRegion); executed: viewport()->update(updateRegion);Execution Count:8 | 8 |
| 2689 | } | - |
| 2690 | | - |
| 2691 | /*! | - |
| 2692 | Notifies QGraphicsView that the scene's scene rect has changed. \a rect | - |
| 2693 | is the new scene rect. If the view already has an explicitly set scene | - |
| 2694 | rect, this function does nothing. | - |
| 2695 | | - |
| 2696 | \sa sceneRect, QGraphicsScene::sceneRectChanged() | - |
| 2697 | */ | - |
| 2698 | void QGraphicsView::updateSceneRect(const QRectF &rect) | - |
| 2699 | { | - |
| 2700 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 2701 | if (!d->hasSceneRect) { evaluated: !d->hasSceneRect| yes Evaluation Count:740 | yes Evaluation Count:12 |
| 12-740 |
| 2702 | d->sceneRect = rect; executed (the execution status of this line is deduced): d->sceneRect = rect; | - |
| 2703 | d->recalculateContentSize(); executed (the execution status of this line is deduced): d->recalculateContentSize(); | - |
| 2704 | } executed: }Execution Count:740 | 740 |
| 2705 | } executed: }Execution Count:752 | 752 |
| 2706 | | - |
| 2707 | /*! | - |
| 2708 | This slot is called by QAbstractScrollArea after setViewport() has been | - |
| 2709 | called. Reimplement this function in a subclass of QGraphicsView to | - |
| 2710 | initialize the new viewport \a widget before it is used. | - |
| 2711 | | - |
| 2712 | \sa setViewport() | - |
| 2713 | */ | - |
| 2714 | void QGraphicsView::setupViewport(QWidget *widget) | - |
| 2715 | { | - |
| 2716 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 2717 | | - |
| 2718 | if (!widget) { partially evaluated: !widget| no Evaluation Count:0 | yes Evaluation Count:807 |
| 0-807 |
| 2719 | qWarning("QGraphicsView::setupViewport: cannot initialize null widget"); never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsview.cpp", 2719, __PRETTY_FUNCTION__).warning("QGraphicsView::setupViewport: cannot initialize null widget"); | - |
| 2720 | return; | 0 |
| 2721 | } | - |
| 2722 | | - |
| 2723 | const bool isGLWidget = widget->inherits("QGLWidget"); executed (the execution status of this line is deduced): const bool isGLWidget = widget->inherits("QGLWidget"); | - |
| 2724 | | - |
| 2725 | d->accelerateScrolling = !(isGLWidget); executed (the execution status of this line is deduced): d->accelerateScrolling = !(isGLWidget); | - |
| 2726 | | - |
| 2727 | widget->setFocusPolicy(Qt::StrongFocus); executed (the execution status of this line is deduced): widget->setFocusPolicy(Qt::StrongFocus); | - |
| 2728 | | - |
| 2729 | if (!isGLWidget) { partially evaluated: !isGLWidget| yes Evaluation Count:807 | no Evaluation Count:0 |
| 0-807 |
| 2730 | // autoFillBackground enables scroll acceleration. | - |
| 2731 | widget->setAutoFillBackground(true); executed (the execution status of this line is deduced): widget->setAutoFillBackground(true); | - |
| 2732 | } executed: }Execution Count:807 | 807 |
| 2733 | | - |
| 2734 | // We are only interested in mouse tracking if items | - |
| 2735 | // accept hover events or use non-default cursors or if | - |
| 2736 | // AnchorUnderMouse is used as transformation or resize anchor. | - |
| 2737 | if ((d->scene && (!d->scene->d_func()->allItemsIgnoreHoverEvents evaluated: d->scene| yes Evaluation Count:733 | yes Evaluation Count:74 |
evaluated: !d->scene->d_func()->allItemsIgnoreHoverEvents| yes Evaluation Count:8 | yes Evaluation Count:725 |
| 8-733 |
| 2738 | || !d->scene->d_func()->allItemsUseDefaultCursor)) evaluated: !d->scene->d_func()->allItemsUseDefaultCursor| yes Evaluation Count:3 | yes Evaluation Count:722 |
| 3-722 |
| 2739 | || d->transformationAnchor == AnchorUnderMouse evaluated: d->transformationAnchor == AnchorUnderMouse| yes Evaluation Count:1 | yes Evaluation Count:795 |
| 1-795 |
| 2740 | || d->resizeAnchor == AnchorUnderMouse) { evaluated: d->resizeAnchor == AnchorUnderMouse| yes Evaluation Count:1 | yes Evaluation Count:794 |
| 1-794 |
| 2741 | widget->setMouseTracking(true); executed (the execution status of this line is deduced): widget->setMouseTracking(true); | - |
| 2742 | } executed: }Execution Count:13 | 13 |
| 2743 | | - |
| 2744 | // enable touch events if any items is interested in them | - |
| 2745 | if (d->scene && !d->scene->d_func()->allItemsIgnoreTouchEvents) evaluated: d->scene| yes Evaluation Count:733 | yes Evaluation Count:74 |
partially evaluated: !d->scene->d_func()->allItemsIgnoreTouchEvents| no Evaluation Count:0 | yes Evaluation Count:733 |
| 0-733 |
| 2746 | widget->setAttribute(Qt::WA_AcceptTouchEvents); never executed: widget->setAttribute(Qt::WA_AcceptTouchEvents); | 0 |
| 2747 | | - |
| 2748 | #ifndef QT_NO_GESTURES | - |
| 2749 | if (d->scene) { evaluated: d->scene| yes Evaluation Count:733 | yes Evaluation Count:74 |
| 74-733 |
| 2750 | foreach (Qt::GestureType gesture, d->scene->d_func()->grabbedGestures.keys()) executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(d->scene->d_func()->grabbedGestures.keys())> _container_(d->scene->d_func()->grabbedGestures.keys()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (Qt::GestureType gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
| 2751 | widget->grabGesture(gesture); executed: widget->grabGesture(gesture);Execution Count:1 | 1 |
| 2752 | } executed: }Execution Count:733 | 733 |
| 2753 | #endif | - |
| 2754 | | - |
| 2755 | widget->setAcceptDrops(acceptDrops()); executed (the execution status of this line is deduced): widget->setAcceptDrops(acceptDrops()); | - |
| 2756 | } executed: }Execution Count:807 | 807 |
| 2757 | | - |
| 2758 | /*! | - |
| 2759 | \reimp | - |
| 2760 | */ | - |
| 2761 | bool QGraphicsView::event(QEvent *event) | - |
| 2762 | { | - |
| 2763 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 2764 | | - |
| 2765 | if (d->sceneInteractionAllowed) { evaluated: d->sceneInteractionAllowed| yes Evaluation Count:21900 | yes Evaluation Count:12 |
| 12-21900 |
| 2766 | switch (event->type()) { | - |
| 2767 | case QEvent::ShortcutOverride: | - |
| 2768 | if (d->scene) evaluated: d->scene| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 2769 | return QApplication::sendEvent(d->scene, event); executed: return QApplication::sendEvent(d->scene, event);Execution Count:1 | 1 |
| 2770 | break; executed: break;Execution Count:1 | 1 |
| 2771 | case QEvent::KeyPress: | - |
| 2772 | if (d->scene) { partially evaluated: d->scene| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 2773 | QKeyEvent *k = static_cast<QKeyEvent *>(event); executed (the execution status of this line is deduced): QKeyEvent *k = static_cast<QKeyEvent *>(event); | - |
| 2774 | if (k->key() == Qt::Key_Tab || k->key() == Qt::Key_Backtab) { partially evaluated: k->key() == Qt::Key_Tab| no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: k->key() == Qt::Key_Backtab| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 2775 | // Send the key events to the scene. This will invoke the | - |
| 2776 | // scene's tab focus handling, and if the event is | - |
| 2777 | // accepted, we return (prevent further event delivery), | - |
| 2778 | // and the base implementation will call QGraphicsView's | - |
| 2779 | // focusNextPrevChild() function. If the event is ignored, | - |
| 2780 | // we fall back to standard tab focus handling. | - |
| 2781 | QApplication::sendEvent(d->scene, event); never executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, event); | - |
| 2782 | if (event->isAccepted()) never evaluated: event->isAccepted() | 0 |
| 2783 | return true; never executed: return true; | 0 |
| 2784 | // Ensure the event doesn't propagate just because the | - |
| 2785 | // scene ignored it. If the event propagates, then tab | - |
| 2786 | // handling will be called twice (this and parent). | - |
| 2787 | event->accept(); never executed (the execution status of this line is deduced): event->accept(); | - |
| 2788 | } | 0 |
| 2789 | } executed: }Execution Count:1 | 1 |
| 2790 | break; executed: break;Execution Count:1 | 1 |
| 2791 | default: | - |
| 2792 | break; executed: break;Execution Count:21897 | 21897 |
| 2793 | } | - |
| 2794 | } executed: }Execution Count:21899 | 21899 |
| 2795 | | - |
| 2796 | return QAbstractScrollArea::event(event); executed: return QAbstractScrollArea::event(event);Execution Count:21911 | 21911 |
| 2797 | } | - |
| 2798 | | - |
| 2799 | /*! | - |
| 2800 | \reimp | - |
| 2801 | */ | - |
| 2802 | bool QGraphicsView::viewportEvent(QEvent *event) | - |
| 2803 | { | - |
| 2804 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 2805 | if (!d->scene) evaluated: !d->scene| yes Evaluation Count:288 | yes Evaluation Count:10474 |
| 288-10474 |
| 2806 | return QAbstractScrollArea::viewportEvent(event); executed: return QAbstractScrollArea::viewportEvent(event);Execution Count:288 | 288 |
| 2807 | | - |
| 2808 | switch (event->type()) { | - |
| 2809 | case QEvent::Enter: | - |
| 2810 | QApplication::sendEvent(d->scene, event); executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, event); | - |
| 2811 | break; executed: break;Execution Count:500 | 500 |
| 2812 | case QEvent::WindowActivate: | - |
| 2813 | QApplication::sendEvent(d->scene, event); executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, event); | - |
| 2814 | break; executed: break;Execution Count:562 | 562 |
| 2815 | case QEvent::WindowDeactivate: | - |
| 2816 | // ### This is a temporary fix for until we get proper mouse | - |
| 2817 | // grab events. mouseGrabberItem should be set to 0 if we lose | - |
| 2818 | // the mouse grab. | - |
| 2819 | // Remove all popups when the scene loses focus. | - |
| 2820 | if (!d->scene->d_func()->popupWidgets.isEmpty()) partially evaluated: !d->scene->d_func()->popupWidgets.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 2821 | d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.first()); never executed: d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.first()); | 0 |
| 2822 | QApplication::sendEvent(d->scene, event); executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, event); | - |
| 2823 | break; executed: break;Execution Count:3 | 3 |
| 2824 | case QEvent::Show: | - |
| 2825 | if (d->scene && isActiveWindow()) { partially evaluated: d->scene| yes Evaluation Count:722 | no Evaluation Count:0 |
evaluated: isActiveWindow()| yes Evaluation Count:3 | yes Evaluation Count:719 |
| 0-722 |
| 2826 | QEvent windowActivate(QEvent::WindowActivate); executed (the execution status of this line is deduced): QEvent windowActivate(QEvent::WindowActivate); | - |
| 2827 | QApplication::sendEvent(d->scene, &windowActivate); executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, &windowActivate); | - |
| 2828 | } executed: }Execution Count:3 | 3 |
| 2829 | break; executed: break;Execution Count:722 | 722 |
| 2830 | case QEvent::Hide: | - |
| 2831 | // spontaneous event will generate a WindowDeactivate. | - |
| 2832 | if (!event->spontaneous() && d->scene && isActiveWindow()) { partially evaluated: !event->spontaneous()| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: d->scene| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: isActiveWindow()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 2833 | QEvent windowDeactivate(QEvent::WindowDeactivate); never executed (the execution status of this line is deduced): QEvent windowDeactivate(QEvent::WindowDeactivate); | - |
| 2834 | QApplication::sendEvent(d->scene, &windowDeactivate); never executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, &windowDeactivate); | - |
| 2835 | } | 0 |
| 2836 | break; executed: break;Execution Count:1 | 1 |
| 2837 | case QEvent::Leave: { | - |
| 2838 | // ### This is a temporary fix for until we get proper mouse grab | - |
| 2839 | // events. activeMouseGrabberItem should be set to 0 if we lose the | - |
| 2840 | // mouse grab. | - |
| 2841 | if ((QApplication::activePopupWidget() && QApplication::activePopupWidget() != window()) partially evaluated: QApplication::activePopupWidget()| no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: QApplication::activePopupWidget() != window() | 0-2 |
| 2842 | || (QApplication::activeModalWidget() && QApplication::activeModalWidget() != window()) partially evaluated: QApplication::activeModalWidget()| no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: QApplication::activeModalWidget() != window() | 0-2 |
| 2843 | || (QApplication::activeWindow() != window())) { partially evaluated: (QApplication::activeWindow() != window())| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 2844 | if (!d->scene->d_func()->popupWidgets.isEmpty()) never evaluated: !d->scene->d_func()->popupWidgets.isEmpty() | 0 |
| 2845 | d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.first()); never executed: d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.first()); | 0 |
| 2846 | } | 0 |
| 2847 | d->useLastMouseEvent = false; executed (the execution status of this line is deduced): d->useLastMouseEvent = false; | - |
| 2848 | // a hack to pass a viewport pointer to the scene inside the leave event | - |
| 2849 | Q_ASSERT(event->d == 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 2850 | QScopedValueRollback<QEventPrivate *> rb(event->d); executed (the execution status of this line is deduced): QScopedValueRollback<QEventPrivate *> rb(event->d); | - |
| 2851 | event->d = reinterpret_cast<QEventPrivate *>(viewport()); executed (the execution status of this line is deduced): event->d = reinterpret_cast<QEventPrivate *>(viewport()); | - |
| 2852 | QApplication::sendEvent(d->scene, event); executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, event); | - |
| 2853 | break; executed: break;Execution Count:2 | 2 |
| 2854 | } | - |
| 2855 | #ifndef QT_NO_TOOLTIP | - |
| 2856 | case QEvent::ToolTip: { | - |
| 2857 | QHelpEvent *toolTip = static_cast<QHelpEvent *>(event); never executed (the execution status of this line is deduced): QHelpEvent *toolTip = static_cast<QHelpEvent *>(event); | - |
| 2858 | QGraphicsSceneHelpEvent helpEvent(QEvent::GraphicsSceneHelp); never executed (the execution status of this line is deduced): QGraphicsSceneHelpEvent helpEvent(QEvent::GraphicsSceneHelp); | - |
| 2859 | helpEvent.setWidget(viewport()); never executed (the execution status of this line is deduced): helpEvent.setWidget(viewport()); | - |
| 2860 | helpEvent.setScreenPos(toolTip->globalPos()); never executed (the execution status of this line is deduced): helpEvent.setScreenPos(toolTip->globalPos()); | - |
| 2861 | helpEvent.setScenePos(mapToScene(toolTip->pos())); never executed (the execution status of this line is deduced): helpEvent.setScenePos(mapToScene(toolTip->pos())); | - |
| 2862 | QApplication::sendEvent(d->scene, &helpEvent); never executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, &helpEvent); | - |
| 2863 | toolTip->setAccepted(helpEvent.isAccepted()); never executed (the execution status of this line is deduced): toolTip->setAccepted(helpEvent.isAccepted()); | - |
| 2864 | return true; never executed: return true; | 0 |
| 2865 | } | - |
| 2866 | #endif | - |
| 2867 | case QEvent::Paint: | - |
| 2868 | // Reset full update | - |
| 2869 | d->fullUpdatePending = false; executed (the execution status of this line is deduced): d->fullUpdatePending = false; | - |
| 2870 | d->dirtyScrollOffset = QPoint(); executed (the execution status of this line is deduced): d->dirtyScrollOffset = QPoint(); | - |
| 2871 | if (d->scene) { partially evaluated: d->scene| yes Evaluation Count:2023 | no Evaluation Count:0 |
| 0-2023 |
| 2872 | // Check if this view reimplements the updateScene slot; if it | - |
| 2873 | // does, we can't do direct update delivery and have to fall back | - |
| 2874 | // to connecting the changed signal. | - |
| 2875 | if (!d->updateSceneSlotReimplementedChecked) { evaluated: !d->updateSceneSlotReimplementedChecked| yes Evaluation Count:568 | yes Evaluation Count:1455 |
| 568-1455 |
| 2876 | d->updateSceneSlotReimplementedChecked = true; executed (the execution status of this line is deduced): d->updateSceneSlotReimplementedChecked = true; | - |
| 2877 | const QMetaObject *mo = metaObject(); executed (the execution status of this line is deduced): const QMetaObject *mo = metaObject(); | - |
| 2878 | if (mo != &QGraphicsView::staticMetaObject) { evaluated: mo != &QGraphicsView::staticMetaObject| yes Evaluation Count:43 | yes Evaluation Count:525 |
| 43-525 |
| 2879 | if (mo->indexOfSlot("updateScene(QList<QRectF>)") partially evaluated: mo->indexOfSlot("updateScene(QList<QRectF>)") != QGraphicsView::staticMetaObject.indexOfSlot("updateScene(QList<QRectF>)")| no Evaluation Count:0 | yes Evaluation Count:43 |
| 0-43 |
| 2880 | != QGraphicsView::staticMetaObject.indexOfSlot("updateScene(QList<QRectF>)")) { partially evaluated: mo->indexOfSlot("updateScene(QList<QRectF>)") != QGraphicsView::staticMetaObject.indexOfSlot("updateScene(QList<QRectF>)")| no Evaluation Count:0 | yes Evaluation Count:43 |
| 0-43 |
| 2881 | connect(d->scene, SIGNAL(changed(QList<QRectF>)), never executed (the execution status of this line is deduced): connect(d->scene, "2""changed(QList<QRectF>)", | - |
| 2882 | this, SLOT(updateScene(QList<QRectF>))); never executed (the execution status of this line is deduced): this, "1""updateScene(QList<QRectF>)"); | - |
| 2883 | } | 0 |
| 2884 | } executed: }Execution Count:43 | 43 |
| 2885 | } executed: }Execution Count:568 | 568 |
| 2886 | } executed: }Execution Count:2023 | 2023 |
| 2887 | break; executed: break;Execution Count:2023 | 2023 |
| 2888 | case QEvent::TouchBegin: | - |
| 2889 | case QEvent::TouchUpdate: | - |
| 2890 | case QEvent::TouchEnd: | - |
| 2891 | { | - |
| 2892 | if (!isEnabled()) never evaluated: !isEnabled() | 0 |
| 2893 | return false; never executed: return false; | 0 |
| 2894 | | - |
| 2895 | if (d->scene && d->sceneInteractionAllowed) { never evaluated: d->scene never evaluated: d->sceneInteractionAllowed | 0 |
| 2896 | // Convert and deliver the touch event to the scene. | - |
| 2897 | QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event); never executed (the execution status of this line is deduced): QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event); | - |
| 2898 | touchEvent->setTarget(viewport()); never executed (the execution status of this line is deduced): touchEvent->setTarget(viewport()); | - |
| 2899 | QGraphicsViewPrivate::translateTouchEvent(d, touchEvent); never executed (the execution status of this line is deduced): QGraphicsViewPrivate::translateTouchEvent(d, touchEvent); | - |
| 2900 | (void) QApplication::sendEvent(d->scene, touchEvent); never executed (the execution status of this line is deduced): (void) QApplication::sendEvent(d->scene, touchEvent); | - |
| 2901 | } | 0 |
| 2902 | | - |
| 2903 | return true; never executed: return true; | 0 |
| 2904 | } | - |
| 2905 | #ifndef QT_NO_GESTURES | - |
| 2906 | case QEvent::Gesture: | - |
| 2907 | case QEvent::GestureOverride: | - |
| 2908 | { | - |
| 2909 | if (!isEnabled()) partially evaluated: !isEnabled()| no Evaluation Count:0 | yes Evaluation Count:144 |
| 0-144 |
| 2910 | return false; never executed: return false; | 0 |
| 2911 | | - |
| 2912 | if (d->scene && d->sceneInteractionAllowed) { partially evaluated: d->scene| yes Evaluation Count:144 | no Evaluation Count:0 |
partially evaluated: d->sceneInteractionAllowed| yes Evaluation Count:144 | no Evaluation Count:0 |
| 0-144 |
| 2913 | QGestureEvent *gestureEvent = static_cast<QGestureEvent *>(event); executed (the execution status of this line is deduced): QGestureEvent *gestureEvent = static_cast<QGestureEvent *>(event); | - |
| 2914 | gestureEvent->setWidget(viewport()); executed (the execution status of this line is deduced): gestureEvent->setWidget(viewport()); | - |
| 2915 | (void) QApplication::sendEvent(d->scene, gestureEvent); executed (the execution status of this line is deduced): (void) QApplication::sendEvent(d->scene, gestureEvent); | - |
| 2916 | } executed: }Execution Count:144 | 144 |
| 2917 | return true; executed: return true;Execution Count:144 | 144 |
| 2918 | } | - |
| 2919 | #endif // QT_NO_GESTURES | - |
| 2920 | default: | - |
| 2921 | break; executed: break;Execution Count:6517 | 6517 |
| 2922 | } | - |
| 2923 | | - |
| 2924 | return QAbstractScrollArea::viewportEvent(event); executed: return QAbstractScrollArea::viewportEvent(event);Execution Count:10330 | 10330 |
| 2925 | } | - |
| 2926 | | - |
| 2927 | #ifndef QT_NO_CONTEXTMENU | - |
| 2928 | /*! | - |
| 2929 | \reimp | - |
| 2930 | */ | - |
| 2931 | void QGraphicsView::contextMenuEvent(QContextMenuEvent *event) | - |
| 2932 | { | - |
| 2933 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 2934 | if (!d->scene || !d->sceneInteractionAllowed) partially evaluated: !d->scene| no Evaluation Count:0 | yes Evaluation Count:200 |
evaluated: !d->sceneInteractionAllowed| yes Evaluation Count:100 | yes Evaluation Count:100 |
| 0-200 |
| 2935 | return; executed: return;Execution Count:100 | 100 |
| 2936 | | - |
| 2937 | d->mousePressViewPoint = event->pos(); executed (the execution status of this line is deduced): d->mousePressViewPoint = event->pos(); | - |
| 2938 | d->mousePressScenePoint = mapToScene(d->mousePressViewPoint); executed (the execution status of this line is deduced): d->mousePressScenePoint = mapToScene(d->mousePressViewPoint); | - |
| 2939 | d->mousePressScreenPoint = event->globalPos(); executed (the execution status of this line is deduced): d->mousePressScreenPoint = event->globalPos(); | - |
| 2940 | d->lastMouseMoveScenePoint = d->mousePressScenePoint; executed (the execution status of this line is deduced): d->lastMouseMoveScenePoint = d->mousePressScenePoint; | - |
| 2941 | d->lastMouseMoveScreenPoint = d->mousePressScreenPoint; executed (the execution status of this line is deduced): d->lastMouseMoveScreenPoint = d->mousePressScreenPoint; | - |
| 2942 | | - |
| 2943 | QGraphicsSceneContextMenuEvent contextEvent(QEvent::GraphicsSceneContextMenu); executed (the execution status of this line is deduced): QGraphicsSceneContextMenuEvent contextEvent(QEvent::GraphicsSceneContextMenu); | - |
| 2944 | contextEvent.setWidget(viewport()); executed (the execution status of this line is deduced): contextEvent.setWidget(viewport()); | - |
| 2945 | contextEvent.setScenePos(d->mousePressScenePoint); executed (the execution status of this line is deduced): contextEvent.setScenePos(d->mousePressScenePoint); | - |
| 2946 | contextEvent.setScreenPos(d->mousePressScreenPoint); executed (the execution status of this line is deduced): contextEvent.setScreenPos(d->mousePressScreenPoint); | - |
| 2947 | contextEvent.setModifiers(event->modifiers()); executed (the execution status of this line is deduced): contextEvent.setModifiers(event->modifiers()); | - |
| 2948 | contextEvent.setReason((QGraphicsSceneContextMenuEvent::Reason)(event->reason())); executed (the execution status of this line is deduced): contextEvent.setReason((QGraphicsSceneContextMenuEvent::Reason)(event->reason())); | - |
| 2949 | contextEvent.setAccepted(event->isAccepted()); executed (the execution status of this line is deduced): contextEvent.setAccepted(event->isAccepted()); | - |
| 2950 | QApplication::sendEvent(d->scene, &contextEvent); executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, &contextEvent); | - |
| 2951 | event->setAccepted(contextEvent.isAccepted()); executed (the execution status of this line is deduced): event->setAccepted(contextEvent.isAccepted()); | - |
| 2952 | } executed: }Execution Count:100 | 100 |
| 2953 | #endif // QT_NO_CONTEXTMENU | - |
| 2954 | | - |
| 2955 | /*! | - |
| 2956 | \reimp | - |
| 2957 | */ | - |
| 2958 | void QGraphicsView::dropEvent(QDropEvent *event) | - |
| 2959 | { | - |
| 2960 | #ifndef QT_NO_DRAGANDDROP | - |
| 2961 | Q_D(QGraphicsView); never executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 2962 | if (!d->scene || !d->sceneInteractionAllowed) never evaluated: !d->scene never evaluated: !d->sceneInteractionAllowed | 0 |
| 2963 | return; | 0 |
| 2964 | | - |
| 2965 | // Generate a scene event. | - |
| 2966 | QGraphicsSceneDragDropEvent sceneEvent(QEvent::GraphicsSceneDrop); never executed (the execution status of this line is deduced): QGraphicsSceneDragDropEvent sceneEvent(QEvent::GraphicsSceneDrop); | - |
| 2967 | d->populateSceneDragDropEvent(&sceneEvent, event); never executed (the execution status of this line is deduced): d->populateSceneDragDropEvent(&sceneEvent, event); | - |
| 2968 | | - |
| 2969 | // Send it to the scene. | - |
| 2970 | QApplication::sendEvent(d->scene, &sceneEvent); never executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, &sceneEvent); | - |
| 2971 | | - |
| 2972 | // Accept the originating event if the scene accepted the scene event. | - |
| 2973 | event->setAccepted(sceneEvent.isAccepted()); never executed (the execution status of this line is deduced): event->setAccepted(sceneEvent.isAccepted()); | - |
| 2974 | if (sceneEvent.isAccepted()) never evaluated: sceneEvent.isAccepted() | 0 |
| 2975 | event->setDropAction(sceneEvent.dropAction()); never executed: event->setDropAction(sceneEvent.dropAction()); | 0 |
| 2976 | | - |
| 2977 | delete d->lastDragDropEvent; never executed (the execution status of this line is deduced): delete d->lastDragDropEvent; | - |
| 2978 | d->lastDragDropEvent = 0; never executed (the execution status of this line is deduced): d->lastDragDropEvent = 0; | - |
| 2979 | | - |
| 2980 | #else | - |
| 2981 | Q_UNUSED(event) | - |
| 2982 | #endif | - |
| 2983 | } | 0 |
| 2984 | | - |
| 2985 | /*! | - |
| 2986 | \reimp | - |
| 2987 | */ | - |
| 2988 | void QGraphicsView::dragEnterEvent(QDragEnterEvent *event) | - |
| 2989 | { | - |
| 2990 | #ifndef QT_NO_DRAGANDDROP | - |
| 2991 | Q_D(QGraphicsView); never executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 2992 | if (!d->scene || !d->sceneInteractionAllowed) never evaluated: !d->scene never evaluated: !d->sceneInteractionAllowed | 0 |
| 2993 | return; | 0 |
| 2994 | | - |
| 2995 | // Disable replaying of mouse move events. | - |
| 2996 | d->useLastMouseEvent = false; never executed (the execution status of this line is deduced): d->useLastMouseEvent = false; | - |
| 2997 | | - |
| 2998 | // Generate a scene event. | - |
| 2999 | QGraphicsSceneDragDropEvent sceneEvent(QEvent::GraphicsSceneDragEnter); never executed (the execution status of this line is deduced): QGraphicsSceneDragDropEvent sceneEvent(QEvent::GraphicsSceneDragEnter); | - |
| 3000 | d->populateSceneDragDropEvent(&sceneEvent, event); never executed (the execution status of this line is deduced): d->populateSceneDragDropEvent(&sceneEvent, event); | - |
| 3001 | | - |
| 3002 | // Store it for later use. | - |
| 3003 | d->storeDragDropEvent(&sceneEvent); never executed (the execution status of this line is deduced): d->storeDragDropEvent(&sceneEvent); | - |
| 3004 | | - |
| 3005 | // Send it to the scene. | - |
| 3006 | QApplication::sendEvent(d->scene, &sceneEvent); never executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, &sceneEvent); | - |
| 3007 | | - |
| 3008 | // Accept the originating event if the scene accepted the scene event. | - |
| 3009 | if (sceneEvent.isAccepted()) { never evaluated: sceneEvent.isAccepted() | 0 |
| 3010 | event->setAccepted(true); never executed (the execution status of this line is deduced): event->setAccepted(true); | - |
| 3011 | event->setDropAction(sceneEvent.dropAction()); never executed (the execution status of this line is deduced): event->setDropAction(sceneEvent.dropAction()); | - |
| 3012 | } | 0 |
| 3013 | #else | - |
| 3014 | Q_UNUSED(event) | - |
| 3015 | #endif | - |
| 3016 | } | 0 |
| 3017 | | - |
| 3018 | /*! | - |
| 3019 | \reimp | - |
| 3020 | */ | - |
| 3021 | void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *event) | - |
| 3022 | { | - |
| 3023 | #ifndef QT_NO_DRAGANDDROP | - |
| 3024 | Q_D(QGraphicsView); never executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3025 | if (!d->scene || !d->sceneInteractionAllowed) never evaluated: !d->scene never evaluated: !d->sceneInteractionAllowed | 0 |
| 3026 | return; | 0 |
| 3027 | if (!d->lastDragDropEvent) { never evaluated: !d->lastDragDropEvent | 0 |
| 3028 | qWarning("QGraphicsView::dragLeaveEvent: drag leave received before drag enter"); never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgraphicsview.cpp", 3028, __PRETTY_FUNCTION__).warning("QGraphicsView::dragLeaveEvent: drag leave received before drag enter"); | - |
| 3029 | return; | 0 |
| 3030 | } | - |
| 3031 | | - |
| 3032 | // Generate a scene event. | - |
| 3033 | QGraphicsSceneDragDropEvent sceneEvent(QEvent::GraphicsSceneDragLeave); never executed (the execution status of this line is deduced): QGraphicsSceneDragDropEvent sceneEvent(QEvent::GraphicsSceneDragLeave); | - |
| 3034 | sceneEvent.setScenePos(d->lastDragDropEvent->scenePos()); never executed (the execution status of this line is deduced): sceneEvent.setScenePos(d->lastDragDropEvent->scenePos()); | - |
| 3035 | sceneEvent.setScreenPos(d->lastDragDropEvent->screenPos()); never executed (the execution status of this line is deduced): sceneEvent.setScreenPos(d->lastDragDropEvent->screenPos()); | - |
| 3036 | sceneEvent.setButtons(d->lastDragDropEvent->buttons()); never executed (the execution status of this line is deduced): sceneEvent.setButtons(d->lastDragDropEvent->buttons()); | - |
| 3037 | sceneEvent.setModifiers(d->lastDragDropEvent->modifiers()); never executed (the execution status of this line is deduced): sceneEvent.setModifiers(d->lastDragDropEvent->modifiers()); | - |
| 3038 | sceneEvent.setPossibleActions(d->lastDragDropEvent->possibleActions()); never executed (the execution status of this line is deduced): sceneEvent.setPossibleActions(d->lastDragDropEvent->possibleActions()); | - |
| 3039 | sceneEvent.setProposedAction(d->lastDragDropEvent->proposedAction()); never executed (the execution status of this line is deduced): sceneEvent.setProposedAction(d->lastDragDropEvent->proposedAction()); | - |
| 3040 | sceneEvent.setDropAction(d->lastDragDropEvent->dropAction()); never executed (the execution status of this line is deduced): sceneEvent.setDropAction(d->lastDragDropEvent->dropAction()); | - |
| 3041 | sceneEvent.setMimeData(d->lastDragDropEvent->mimeData()); never executed (the execution status of this line is deduced): sceneEvent.setMimeData(d->lastDragDropEvent->mimeData()); | - |
| 3042 | sceneEvent.setWidget(d->lastDragDropEvent->widget()); never executed (the execution status of this line is deduced): sceneEvent.setWidget(d->lastDragDropEvent->widget()); | - |
| 3043 | sceneEvent.setSource(d->lastDragDropEvent->source()); never executed (the execution status of this line is deduced): sceneEvent.setSource(d->lastDragDropEvent->source()); | - |
| 3044 | delete d->lastDragDropEvent; never executed (the execution status of this line is deduced): delete d->lastDragDropEvent; | - |
| 3045 | d->lastDragDropEvent = 0; never executed (the execution status of this line is deduced): d->lastDragDropEvent = 0; | - |
| 3046 | | - |
| 3047 | // Send it to the scene. | - |
| 3048 | QApplication::sendEvent(d->scene, &sceneEvent); never executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, &sceneEvent); | - |
| 3049 | | - |
| 3050 | // Accept the originating event if the scene accepted the scene event. | - |
| 3051 | if (sceneEvent.isAccepted()) never evaluated: sceneEvent.isAccepted() | 0 |
| 3052 | event->setAccepted(true); never executed: event->setAccepted(true); | 0 |
| 3053 | #else | - |
| 3054 | Q_UNUSED(event) | - |
| 3055 | #endif | - |
| 3056 | } | 0 |
| 3057 | | - |
| 3058 | /*! | - |
| 3059 | \reimp | - |
| 3060 | */ | - |
| 3061 | void QGraphicsView::dragMoveEvent(QDragMoveEvent *event) | - |
| 3062 | { | - |
| 3063 | #ifndef QT_NO_DRAGANDDROP | - |
| 3064 | Q_D(QGraphicsView); never executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3065 | if (!d->scene || !d->sceneInteractionAllowed) never evaluated: !d->scene never evaluated: !d->sceneInteractionAllowed | 0 |
| 3066 | return; | 0 |
| 3067 | | - |
| 3068 | // Generate a scene event. | - |
| 3069 | QGraphicsSceneDragDropEvent sceneEvent(QEvent::GraphicsSceneDragMove); never executed (the execution status of this line is deduced): QGraphicsSceneDragDropEvent sceneEvent(QEvent::GraphicsSceneDragMove); | - |
| 3070 | d->populateSceneDragDropEvent(&sceneEvent, event); never executed (the execution status of this line is deduced): d->populateSceneDragDropEvent(&sceneEvent, event); | - |
| 3071 | | - |
| 3072 | // Store it for later use. | - |
| 3073 | d->storeDragDropEvent(&sceneEvent); never executed (the execution status of this line is deduced): d->storeDragDropEvent(&sceneEvent); | - |
| 3074 | | - |
| 3075 | // Send it to the scene. | - |
| 3076 | QApplication::sendEvent(d->scene, &sceneEvent); never executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, &sceneEvent); | - |
| 3077 | | - |
| 3078 | // Ignore the originating event if the scene ignored the scene event. | - |
| 3079 | event->setAccepted(sceneEvent.isAccepted()); never executed (the execution status of this line is deduced): event->setAccepted(sceneEvent.isAccepted()); | - |
| 3080 | if (sceneEvent.isAccepted()) never evaluated: sceneEvent.isAccepted() | 0 |
| 3081 | event->setDropAction(sceneEvent.dropAction()); never executed: event->setDropAction(sceneEvent.dropAction()); | 0 |
| 3082 | #else | - |
| 3083 | Q_UNUSED(event) | - |
| 3084 | #endif | - |
| 3085 | } | 0 |
| 3086 | | - |
| 3087 | /*! | - |
| 3088 | \reimp | - |
| 3089 | */ | - |
| 3090 | void QGraphicsView::focusInEvent(QFocusEvent *event) | - |
| 3091 | { | - |
| 3092 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3093 | d->updateInputMethodSensitivity(); executed (the execution status of this line is deduced): d->updateInputMethodSensitivity(); | - |
| 3094 | QAbstractScrollArea::focusInEvent(event); executed (the execution status of this line is deduced): QAbstractScrollArea::focusInEvent(event); | - |
| 3095 | if (d->scene) evaluated: d->scene| yes Evaluation Count:561 | yes Evaluation Count:13 |
| 13-561 |
| 3096 | QApplication::sendEvent(d->scene, event); executed: QApplication::sendEvent(d->scene, event);Execution Count:561 | 561 |
| 3097 | // Pass focus on if the scene cannot accept focus. | - |
| 3098 | if (!d->scene || !event->isAccepted()) evaluated: !d->scene| yes Evaluation Count:13 | yes Evaluation Count:561 |
partially evaluated: !event->isAccepted()| no Evaluation Count:0 | yes Evaluation Count:561 |
| 0-561 |
| 3099 | QAbstractScrollArea::focusInEvent(event); executed: QAbstractScrollArea::focusInEvent(event);Execution Count:13 | 13 |
| 3100 | } executed: }Execution Count:574 | 574 |
| 3101 | | - |
| 3102 | /*! | - |
| 3103 | \reimp | - |
| 3104 | */ | - |
| 3105 | bool QGraphicsView::focusNextPrevChild(bool next) | - |
| 3106 | { | - |
| 3107 | return QAbstractScrollArea::focusNextPrevChild(next); never executed: return QAbstractScrollArea::focusNextPrevChild(next); | 0 |
| 3108 | } | - |
| 3109 | | - |
| 3110 | /*! | - |
| 3111 | \reimp | - |
| 3112 | */ | - |
| 3113 | void QGraphicsView::focusOutEvent(QFocusEvent *event) | - |
| 3114 | { | - |
| 3115 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3116 | QAbstractScrollArea::focusOutEvent(event); executed (the execution status of this line is deduced): QAbstractScrollArea::focusOutEvent(event); | - |
| 3117 | if (d->scene) evaluated: d->scene| yes Evaluation Count:4 | yes Evaluation Count:6 |
| 4-6 |
| 3118 | QApplication::sendEvent(d->scene, event); executed: QApplication::sendEvent(d->scene, event);Execution Count:4 | 4 |
| 3119 | } executed: }Execution Count:10 | 10 |
| 3120 | | - |
| 3121 | /*! | - |
| 3122 | \reimp | - |
| 3123 | */ | - |
| 3124 | void QGraphicsView::keyPressEvent(QKeyEvent *event) | - |
| 3125 | { | - |
| 3126 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3127 | if (!d->scene || !d->sceneInteractionAllowed) { partially evaluated: !d->scene| no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: !d->sceneInteractionAllowed| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 3128 | QAbstractScrollArea::keyPressEvent(event); never executed (the execution status of this line is deduced): QAbstractScrollArea::keyPressEvent(event); | - |
| 3129 | return; | 0 |
| 3130 | } | - |
| 3131 | QApplication::sendEvent(d->scene, event); executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, event); | - |
| 3132 | if (!event->isAccepted()) partially evaluated: !event->isAccepted()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 3133 | QAbstractScrollArea::keyPressEvent(event); executed: QAbstractScrollArea::keyPressEvent(event);Execution Count:1 | 1 |
| 3134 | } executed: }Execution Count:1 | 1 |
| 3135 | | - |
| 3136 | /*! | - |
| 3137 | \reimp | - |
| 3138 | */ | - |
| 3139 | void QGraphicsView::keyReleaseEvent(QKeyEvent *event) | - |
| 3140 | { | - |
| 3141 | Q_D(QGraphicsView); never executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3142 | if (!d->scene || !d->sceneInteractionAllowed) never evaluated: !d->scene never evaluated: !d->sceneInteractionAllowed | 0 |
| 3143 | return; | 0 |
| 3144 | QApplication::sendEvent(d->scene, event); never executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, event); | - |
| 3145 | if (!event->isAccepted()) never evaluated: !event->isAccepted() | 0 |
| 3146 | QAbstractScrollArea::keyReleaseEvent(event); never executed: QAbstractScrollArea::keyReleaseEvent(event); | 0 |
| 3147 | } | 0 |
| 3148 | | - |
| 3149 | /*! | - |
| 3150 | \reimp | - |
| 3151 | */ | - |
| 3152 | void QGraphicsView::mouseDoubleClickEvent(QMouseEvent *event) | - |
| 3153 | { | - |
| 3154 | Q_D(QGraphicsView); never executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3155 | if (!d->scene || !d->sceneInteractionAllowed) never evaluated: !d->scene never evaluated: !d->sceneInteractionAllowed | 0 |
| 3156 | return; | 0 |
| 3157 | | - |
| 3158 | d->storeMouseEvent(event); never executed (the execution status of this line is deduced): d->storeMouseEvent(event); | - |
| 3159 | d->mousePressViewPoint = event->pos(); never executed (the execution status of this line is deduced): d->mousePressViewPoint = event->pos(); | - |
| 3160 | d->mousePressScenePoint = mapToScene(d->mousePressViewPoint); never executed (the execution status of this line is deduced): d->mousePressScenePoint = mapToScene(d->mousePressViewPoint); | - |
| 3161 | d->mousePressScreenPoint = event->globalPos(); never executed (the execution status of this line is deduced): d->mousePressScreenPoint = event->globalPos(); | - |
| 3162 | d->lastMouseMoveScenePoint = d->mousePressScenePoint; never executed (the execution status of this line is deduced): d->lastMouseMoveScenePoint = d->mousePressScenePoint; | - |
| 3163 | d->lastMouseMoveScreenPoint = d->mousePressScreenPoint; never executed (the execution status of this line is deduced): d->lastMouseMoveScreenPoint = d->mousePressScreenPoint; | - |
| 3164 | d->mousePressButton = event->button(); never executed (the execution status of this line is deduced): d->mousePressButton = event->button(); | - |
| 3165 | | - |
| 3166 | QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseDoubleClick); never executed (the execution status of this line is deduced): QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseDoubleClick); | - |
| 3167 | mouseEvent.setWidget(viewport()); never executed (the execution status of this line is deduced): mouseEvent.setWidget(viewport()); | - |
| 3168 | mouseEvent.setButtonDownScenePos(d->mousePressButton, d->mousePressScenePoint); never executed (the execution status of this line is deduced): mouseEvent.setButtonDownScenePos(d->mousePressButton, d->mousePressScenePoint); | - |
| 3169 | mouseEvent.setButtonDownScreenPos(d->mousePressButton, d->mousePressScreenPoint); never executed (the execution status of this line is deduced): mouseEvent.setButtonDownScreenPos(d->mousePressButton, d->mousePressScreenPoint); | - |
| 3170 | mouseEvent.setScenePos(mapToScene(d->mousePressViewPoint)); never executed (the execution status of this line is deduced): mouseEvent.setScenePos(mapToScene(d->mousePressViewPoint)); | - |
| 3171 | mouseEvent.setScreenPos(d->mousePressScreenPoint); never executed (the execution status of this line is deduced): mouseEvent.setScreenPos(d->mousePressScreenPoint); | - |
| 3172 | mouseEvent.setLastScenePos(d->lastMouseMoveScenePoint); never executed (the execution status of this line is deduced): mouseEvent.setLastScenePos(d->lastMouseMoveScenePoint); | - |
| 3173 | mouseEvent.setLastScreenPos(d->lastMouseMoveScreenPoint); never executed (the execution status of this line is deduced): mouseEvent.setLastScreenPos(d->lastMouseMoveScreenPoint); | - |
| 3174 | mouseEvent.setButtons(event->buttons()); never executed (the execution status of this line is deduced): mouseEvent.setButtons(event->buttons()); | - |
| 3175 | mouseEvent.setButtons(event->buttons()); never executed (the execution status of this line is deduced): mouseEvent.setButtons(event->buttons()); | - |
| 3176 | mouseEvent.setAccepted(false); never executed (the execution status of this line is deduced): mouseEvent.setAccepted(false); | - |
| 3177 | mouseEvent.setButton(event->button()); never executed (the execution status of this line is deduced): mouseEvent.setButton(event->button()); | - |
| 3178 | mouseEvent.setModifiers(event->modifiers()); never executed (the execution status of this line is deduced): mouseEvent.setModifiers(event->modifiers()); | - |
| 3179 | if (event->spontaneous()) never evaluated: event->spontaneous() | 0 |
| 3180 | qt_sendSpontaneousEvent(d->scene, &mouseEvent); never executed: qt_sendSpontaneousEvent(d->scene, &mouseEvent); | 0 |
| 3181 | else | - |
| 3182 | QApplication::sendEvent(d->scene, &mouseEvent); never executed: QApplication::sendEvent(d->scene, &mouseEvent); | 0 |
| 3183 | } | - |
| 3184 | | - |
| 3185 | /*! | - |
| 3186 | \reimp | - |
| 3187 | */ | - |
| 3188 | void QGraphicsView::mousePressEvent(QMouseEvent *event) | - |
| 3189 | { | - |
| 3190 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3191 | | - |
| 3192 | // Store this event for replaying, finding deltas, and for | - |
| 3193 | // scroll-dragging; even in non-interactive mode, scroll hand dragging is | - |
| 3194 | // allowed, so we store the event at the very top of this function. | - |
| 3195 | d->storeMouseEvent(event); executed (the execution status of this line is deduced): d->storeMouseEvent(event); | - |
| 3196 | d->lastMouseEvent.setAccepted(false); executed (the execution status of this line is deduced): d->lastMouseEvent.setAccepted(false); | - |
| 3197 | | - |
| 3198 | if (d->sceneInteractionAllowed) { evaluated: d->sceneInteractionAllowed| yes Evaluation Count:119 | yes Evaluation Count:104 |
| 104-119 |
| 3199 | // Store some of the event's button-down data. | - |
| 3200 | d->mousePressViewPoint = event->pos(); executed (the execution status of this line is deduced): d->mousePressViewPoint = event->pos(); | - |
| 3201 | d->mousePressScenePoint = mapToScene(d->mousePressViewPoint); executed (the execution status of this line is deduced): d->mousePressScenePoint = mapToScene(d->mousePressViewPoint); | - |
| 3202 | d->mousePressScreenPoint = event->globalPos(); executed (the execution status of this line is deduced): d->mousePressScreenPoint = event->globalPos(); | - |
| 3203 | d->lastMouseMoveScenePoint = d->mousePressScenePoint; executed (the execution status of this line is deduced): d->lastMouseMoveScenePoint = d->mousePressScenePoint; | - |
| 3204 | d->lastMouseMoveScreenPoint = d->mousePressScreenPoint; executed (the execution status of this line is deduced): d->lastMouseMoveScreenPoint = d->mousePressScreenPoint; | - |
| 3205 | d->mousePressButton = event->button(); executed (the execution status of this line is deduced): d->mousePressButton = event->button(); | - |
| 3206 | | - |
| 3207 | if (d->scene) { evaluated: d->scene| yes Evaluation Count:116 | yes Evaluation Count:3 |
| 3-116 |
| 3208 | // Convert and deliver the mouse event to the scene. | - |
| 3209 | QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMousePress); executed (the execution status of this line is deduced): QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMousePress); | - |
| 3210 | mouseEvent.setWidget(viewport()); executed (the execution status of this line is deduced): mouseEvent.setWidget(viewport()); | - |
| 3211 | mouseEvent.setButtonDownScenePos(d->mousePressButton, d->mousePressScenePoint); executed (the execution status of this line is deduced): mouseEvent.setButtonDownScenePos(d->mousePressButton, d->mousePressScenePoint); | - |
| 3212 | mouseEvent.setButtonDownScreenPos(d->mousePressButton, d->mousePressScreenPoint); executed (the execution status of this line is deduced): mouseEvent.setButtonDownScreenPos(d->mousePressButton, d->mousePressScreenPoint); | - |
| 3213 | mouseEvent.setScenePos(d->mousePressScenePoint); executed (the execution status of this line is deduced): mouseEvent.setScenePos(d->mousePressScenePoint); | - |
| 3214 | mouseEvent.setScreenPos(d->mousePressScreenPoint); executed (the execution status of this line is deduced): mouseEvent.setScreenPos(d->mousePressScreenPoint); | - |
| 3215 | mouseEvent.setLastScenePos(d->lastMouseMoveScenePoint); executed (the execution status of this line is deduced): mouseEvent.setLastScenePos(d->lastMouseMoveScenePoint); | - |
| 3216 | mouseEvent.setLastScreenPos(d->lastMouseMoveScreenPoint); executed (the execution status of this line is deduced): mouseEvent.setLastScreenPos(d->lastMouseMoveScreenPoint); | - |
| 3217 | mouseEvent.setButtons(event->buttons()); executed (the execution status of this line is deduced): mouseEvent.setButtons(event->buttons()); | - |
| 3218 | mouseEvent.setButton(event->button()); executed (the execution status of this line is deduced): mouseEvent.setButton(event->button()); | - |
| 3219 | mouseEvent.setModifiers(event->modifiers()); executed (the execution status of this line is deduced): mouseEvent.setModifiers(event->modifiers()); | - |
| 3220 | mouseEvent.setAccepted(false); executed (the execution status of this line is deduced): mouseEvent.setAccepted(false); | - |
| 3221 | if (event->spontaneous()) evaluated: event->spontaneous()| yes Evaluation Count:3 | yes Evaluation Count:113 |
| 3-113 |
| 3222 | qt_sendSpontaneousEvent(d->scene, &mouseEvent); executed: qt_sendSpontaneousEvent(d->scene, &mouseEvent);Execution Count:3 | 3 |
| 3223 | else | - |
| 3224 | QApplication::sendEvent(d->scene, &mouseEvent); executed: QApplication::sendEvent(d->scene, &mouseEvent);Execution Count:113 | 113 |
| 3225 | | - |
| 3226 | // Update the original mouse event accepted state. | - |
| 3227 | bool isAccepted = mouseEvent.isAccepted(); executed (the execution status of this line is deduced): bool isAccepted = mouseEvent.isAccepted(); | - |
| 3228 | event->setAccepted(isAccepted); executed (the execution status of this line is deduced): event->setAccepted(isAccepted); | - |
| 3229 | | - |
| 3230 | // Update the last mouse event accepted state. | - |
| 3231 | d->lastMouseEvent.setAccepted(isAccepted); executed (the execution status of this line is deduced): d->lastMouseEvent.setAccepted(isAccepted); | - |
| 3232 | | - |
| 3233 | if (isAccepted) evaluated: isAccepted| yes Evaluation Count:105 | yes Evaluation Count:11 |
| 11-105 |
| 3234 | return; executed: return;Execution Count:105 | 105 |
| 3235 | } executed: }Execution Count:11 | 11 |
| 3236 | } executed: }Execution Count:14 | 14 |
| 3237 | | - |
| 3238 | #ifndef QT_NO_RUBBERBAND | - |
| 3239 | if (d->dragMode == QGraphicsView::RubberBandDrag && !d->rubberBanding) { evaluated: d->dragMode == QGraphicsView::RubberBandDrag| yes Evaluation Count:5 | yes Evaluation Count:113 |
evaluated: !d->rubberBanding| yes Evaluation Count:4 | yes Evaluation Count:1 |
| 1-113 |
| 3240 | if (d->sceneInteractionAllowed) { partially evaluated: d->sceneInteractionAllowed| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 3241 | // Rubberbanding is only allowed in interactive mode. | - |
| 3242 | event->accept(); executed (the execution status of this line is deduced): event->accept(); | - |
| 3243 | d->rubberBanding = true; executed (the execution status of this line is deduced): d->rubberBanding = true; | - |
| 3244 | d->rubberBandRect = QRect(); executed (the execution status of this line is deduced): d->rubberBandRect = QRect(); | - |
| 3245 | if (d->scene) { evaluated: d->scene| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
| 3246 | // Initiating a rubber band always clears the selection. | - |
| 3247 | d->scene->clearSelection(); executed (the execution status of this line is deduced): d->scene->clearSelection(); | - |
| 3248 | } executed: }Execution Count:3 | 3 |
| 3249 | } executed: }Execution Count:4 | 4 |
| 3250 | } else executed: }Execution Count:4 | 4 |
| 3251 | #endif | - |
| 3252 | if (d->dragMode == QGraphicsView::ScrollHandDrag && event->button() == Qt::LeftButton) { evaluated: d->dragMode == QGraphicsView::ScrollHandDrag| yes Evaluation Count:9 | yes Evaluation Count:105 |
partially evaluated: event->button() == Qt::LeftButton| yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-105 |
| 3253 | // Left-button press in scroll hand mode initiates hand scrolling. | - |
| 3254 | event->accept(); executed (the execution status of this line is deduced): event->accept(); | - |
| 3255 | d->handScrolling = true; executed (the execution status of this line is deduced): d->handScrolling = true; | - |
| 3256 | d->handScrollMotions = 0; executed (the execution status of this line is deduced): d->handScrollMotions = 0; | - |
| 3257 | #ifndef QT_NO_CURSOR | - |
| 3258 | viewport()->setCursor(Qt::ClosedHandCursor); executed (the execution status of this line is deduced): viewport()->setCursor(Qt::ClosedHandCursor); | - |
| 3259 | #endif | - |
| 3260 | } executed: }Execution Count:9 | 9 |
| 3261 | } | - |
| 3262 | | - |
| 3263 | /*! | - |
| 3264 | \reimp | - |
| 3265 | */ | - |
| 3266 | void QGraphicsView::mouseMoveEvent(QMouseEvent *event) | - |
| 3267 | { | - |
| 3268 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3269 | | - |
| 3270 | if (d->dragMode == QGraphicsView::ScrollHandDrag) { evaluated: d->dragMode == QGraphicsView::ScrollHandDrag| yes Evaluation Count:43 | yes Evaluation Count:41 |
| 41-43 |
| 3271 | if (d->handScrolling) { evaluated: d->handScrolling| yes Evaluation Count:32 | yes Evaluation Count:11 |
| 11-32 |
| 3272 | QScrollBar *hBar = horizontalScrollBar(); executed (the execution status of this line is deduced): QScrollBar *hBar = horizontalScrollBar(); | - |
| 3273 | QScrollBar *vBar = verticalScrollBar(); executed (the execution status of this line is deduced): QScrollBar *vBar = verticalScrollBar(); | - |
| 3274 | QPoint delta = event->pos() - d->lastMouseEvent.pos(); executed (the execution status of this line is deduced): QPoint delta = event->pos() - d->lastMouseEvent.pos(); | - |
| 3275 | hBar->setValue(hBar->value() + (isRightToLeft() ? delta.x() : -delta.x())); executed (the execution status of this line is deduced): hBar->setValue(hBar->value() + (isRightToLeft() ? delta.x() : -delta.x())); | - |
| 3276 | vBar->setValue(vBar->value() - delta.y()); executed (the execution status of this line is deduced): vBar->setValue(vBar->value() - delta.y()); | - |
| 3277 | | - |
| 3278 | // Detect how much we've scrolled to disambiguate scrolling from | - |
| 3279 | // clicking. | - |
| 3280 | ++d->handScrollMotions; executed (the execution status of this line is deduced): ++d->handScrollMotions; | - |
| 3281 | } executed: }Execution Count:32 | 32 |
| 3282 | } executed: }Execution Count:43 | 43 |
| 3283 | | - |
| 3284 | d->mouseMoveEventHandler(event); executed (the execution status of this line is deduced): d->mouseMoveEventHandler(event); | - |
| 3285 | } executed: }Execution Count:84 | 84 |
| 3286 | | - |
| 3287 | /*! | - |
| 3288 | \reimp | - |
| 3289 | */ | - |
| 3290 | void QGraphicsView::mouseReleaseEvent(QMouseEvent *event) | - |
| 3291 | { | - |
| 3292 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3293 | | - |
| 3294 | #ifndef QT_NO_RUBBERBAND | - |
| 3295 | if (d->dragMode == QGraphicsView::RubberBandDrag && d->sceneInteractionAllowed && !event->buttons()) { evaluated: d->dragMode == QGraphicsView::RubberBandDrag| yes Evaluation Count:4 | yes Evaluation Count:215 |
partially evaluated: d->sceneInteractionAllowed| yes Evaluation Count:4 | no Evaluation Count:0 |
evaluated: !event->buttons()| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 0-215 |
| 3296 | if (d->rubberBanding) { partially evaluated: d->rubberBanding| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 3297 | if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate){ partially evaluated: d->viewportUpdateMode != QGraphicsView::NoViewportUpdate| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 3298 | if (d->viewportUpdateMode != FullViewportUpdate) partially evaluated: d->viewportUpdateMode != FullViewportUpdate| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 3299 | viewport()->update(d->rubberBandRegion(viewport(), d->rubberBandRect)); executed: viewport()->update(d->rubberBandRegion(viewport(), d->rubberBandRect));Execution Count:2 | 2 |
| 3300 | else | - |
| 3301 | d->updateAll(); never executed: d->updateAll(); | 0 |
| 3302 | } | - |
| 3303 | d->rubberBanding = false; executed (the execution status of this line is deduced): d->rubberBanding = false; | - |
| 3304 | d->rubberBandRect = QRect(); executed (the execution status of this line is deduced): d->rubberBandRect = QRect(); | - |
| 3305 | } executed: }Execution Count:2 | 2 |
| 3306 | } else executed: }Execution Count:2 | 2 |
| 3307 | #endif | - |
| 3308 | if (d->dragMode == QGraphicsView::ScrollHandDrag && event->button() == Qt::LeftButton) { evaluated: d->dragMode == QGraphicsView::ScrollHandDrag| yes Evaluation Count:8 | yes Evaluation Count:209 |
partially evaluated: event->button() == Qt::LeftButton| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-209 |
| 3309 | #ifndef QT_NO_CURSOR | - |
| 3310 | // Restore the open hand cursor. ### There might be items | - |
| 3311 | // under the mouse that have a valid cursor at this time, so | - |
| 3312 | // we could repeat the steps from mouseMoveEvent(). | - |
| 3313 | viewport()->setCursor(Qt::OpenHandCursor); executed (the execution status of this line is deduced): viewport()->setCursor(Qt::OpenHandCursor); | - |
| 3314 | #endif | - |
| 3315 | d->handScrolling = false; executed (the execution status of this line is deduced): d->handScrolling = false; | - |
| 3316 | | - |
| 3317 | if (d->scene && d->sceneInteractionAllowed && !d->lastMouseEvent.isAccepted() && d->handScrollMotions <= 6) { evaluated: d->scene| yes Evaluation Count:4 | yes Evaluation Count:4 |
evaluated: d->sceneInteractionAllowed| yes Evaluation Count:2 | yes Evaluation Count:2 |
partially evaluated: !d->lastMouseEvent.isAccepted()| yes Evaluation Count:2 | no Evaluation Count:0 |
evaluated: d->handScrollMotions <= 6| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 0-4 |
| 3318 | // If we've detected very little motion during the hand drag, and | - |
| 3319 | // no item accepted the last event, we'll interpret that as a | - |
| 3320 | // click to the scene, and reset the selection. | - |
| 3321 | d->scene->clearSelection(); executed (the execution status of this line is deduced): d->scene->clearSelection(); | - |
| 3322 | } executed: }Execution Count:1 | 1 |
| 3323 | } executed: }Execution Count:8 | 8 |
| 3324 | | - |
| 3325 | d->storeMouseEvent(event); executed (the execution status of this line is deduced): d->storeMouseEvent(event); | - |
| 3326 | | - |
| 3327 | if (!d->sceneInteractionAllowed) evaluated: !d->sceneInteractionAllowed| yes Evaluation Count:104 | yes Evaluation Count:115 |
| 104-115 |
| 3328 | return; executed: return;Execution Count:104 | 104 |
| 3329 | | - |
| 3330 | if (!d->scene) evaluated: !d->scene| yes Evaluation Count:3 | yes Evaluation Count:112 |
| 3-112 |
| 3331 | return; executed: return;Execution Count:3 | 3 |
| 3332 | | - |
| 3333 | QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseRelease); executed (the execution status of this line is deduced): QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseRelease); | - |
| 3334 | mouseEvent.setWidget(viewport()); executed (the execution status of this line is deduced): mouseEvent.setWidget(viewport()); | - |
| 3335 | mouseEvent.setButtonDownScenePos(d->mousePressButton, d->mousePressScenePoint); executed (the execution status of this line is deduced): mouseEvent.setButtonDownScenePos(d->mousePressButton, d->mousePressScenePoint); | - |
| 3336 | mouseEvent.setButtonDownScreenPos(d->mousePressButton, d->mousePressScreenPoint); executed (the execution status of this line is deduced): mouseEvent.setButtonDownScreenPos(d->mousePressButton, d->mousePressScreenPoint); | - |
| 3337 | mouseEvent.setScenePos(mapToScene(event->pos())); executed (the execution status of this line is deduced): mouseEvent.setScenePos(mapToScene(event->pos())); | - |
| 3338 | mouseEvent.setScreenPos(event->globalPos()); executed (the execution status of this line is deduced): mouseEvent.setScreenPos(event->globalPos()); | - |
| 3339 | mouseEvent.setLastScenePos(d->lastMouseMoveScenePoint); executed (the execution status of this line is deduced): mouseEvent.setLastScenePos(d->lastMouseMoveScenePoint); | - |
| 3340 | mouseEvent.setLastScreenPos(d->lastMouseMoveScreenPoint); executed (the execution status of this line is deduced): mouseEvent.setLastScreenPos(d->lastMouseMoveScreenPoint); | - |
| 3341 | mouseEvent.setButtons(event->buttons()); executed (the execution status of this line is deduced): mouseEvent.setButtons(event->buttons()); | - |
| 3342 | mouseEvent.setButton(event->button()); executed (the execution status of this line is deduced): mouseEvent.setButton(event->button()); | - |
| 3343 | mouseEvent.setModifiers(event->modifiers()); executed (the execution status of this line is deduced): mouseEvent.setModifiers(event->modifiers()); | - |
| 3344 | mouseEvent.setAccepted(false); executed (the execution status of this line is deduced): mouseEvent.setAccepted(false); | - |
| 3345 | if (event->spontaneous()) evaluated: event->spontaneous()| yes Evaluation Count:3 | yes Evaluation Count:109 |
| 3-109 |
| 3346 | qt_sendSpontaneousEvent(d->scene, &mouseEvent); executed: qt_sendSpontaneousEvent(d->scene, &mouseEvent);Execution Count:3 | 3 |
| 3347 | else | - |
| 3348 | QApplication::sendEvent(d->scene, &mouseEvent); executed: QApplication::sendEvent(d->scene, &mouseEvent);Execution Count:109 | 109 |
| 3349 | | - |
| 3350 | // Update the last mouse event selected state. | - |
| 3351 | d->lastMouseEvent.setAccepted(mouseEvent.isAccepted()); executed (the execution status of this line is deduced): d->lastMouseEvent.setAccepted(mouseEvent.isAccepted()); | - |
| 3352 | | - |
| 3353 | #ifndef QT_NO_CURSOR | - |
| 3354 | if (mouseEvent.isAccepted() && mouseEvent.buttons() == 0 && viewport()->testAttribute(Qt::WA_SetCursor)) { evaluated: mouseEvent.isAccepted()| yes Evaluation Count:104 | yes Evaluation Count:8 |
partially evaluated: mouseEvent.buttons() == 0| yes Evaluation Count:104 | no Evaluation Count:0 |
evaluated: viewport()->testAttribute(Qt::WA_SetCursor)| yes Evaluation Count:1 | yes Evaluation Count:103 |
| 0-104 |
| 3355 | // The last mouse release on the viewport will trigger clearing the cursor. | - |
| 3356 | d->_q_unsetViewportCursor(); executed (the execution status of this line is deduced): d->_q_unsetViewportCursor(); | - |
| 3357 | } executed: }Execution Count:1 | 1 |
| 3358 | #endif | - |
| 3359 | } executed: }Execution Count:112 | 112 |
| 3360 | | - |
| 3361 | #ifndef QT_NO_WHEELEVENT | - |
| 3362 | /*! | - |
| 3363 | \reimp | - |
| 3364 | */ | - |
| 3365 | void QGraphicsView::wheelEvent(QWheelEvent *event) | - |
| 3366 | { | - |
| 3367 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3368 | if (!d->scene || !d->sceneInteractionAllowed) { partially evaluated: !d->scene| no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: !d->sceneInteractionAllowed| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 3369 | QAbstractScrollArea::wheelEvent(event); never executed (the execution status of this line is deduced): QAbstractScrollArea::wheelEvent(event); | - |
| 3370 | return; | 0 |
| 3371 | } | - |
| 3372 | | - |
| 3373 | event->ignore(); executed (the execution status of this line is deduced): event->ignore(); | - |
| 3374 | | - |
| 3375 | QGraphicsSceneWheelEvent wheelEvent(QEvent::GraphicsSceneWheel); executed (the execution status of this line is deduced): QGraphicsSceneWheelEvent wheelEvent(QEvent::GraphicsSceneWheel); | - |
| 3376 | wheelEvent.setWidget(viewport()); executed (the execution status of this line is deduced): wheelEvent.setWidget(viewport()); | - |
| 3377 | wheelEvent.setScenePos(mapToScene(event->pos())); executed (the execution status of this line is deduced): wheelEvent.setScenePos(mapToScene(event->pos())); | - |
| 3378 | wheelEvent.setScreenPos(event->globalPos()); executed (the execution status of this line is deduced): wheelEvent.setScreenPos(event->globalPos()); | - |
| 3379 | wheelEvent.setButtons(event->buttons()); executed (the execution status of this line is deduced): wheelEvent.setButtons(event->buttons()); | - |
| 3380 | wheelEvent.setModifiers(event->modifiers()); executed (the execution status of this line is deduced): wheelEvent.setModifiers(event->modifiers()); | - |
| 3381 | wheelEvent.setDelta(event->delta()); executed (the execution status of this line is deduced): wheelEvent.setDelta(event->delta()); | - |
| 3382 | wheelEvent.setOrientation(event->orientation()); executed (the execution status of this line is deduced): wheelEvent.setOrientation(event->orientation()); | - |
| 3383 | wheelEvent.setAccepted(false); executed (the execution status of this line is deduced): wheelEvent.setAccepted(false); | - |
| 3384 | QApplication::sendEvent(d->scene, &wheelEvent); executed (the execution status of this line is deduced): QApplication::sendEvent(d->scene, &wheelEvent); | - |
| 3385 | event->setAccepted(wheelEvent.isAccepted()); executed (the execution status of this line is deduced): event->setAccepted(wheelEvent.isAccepted()); | - |
| 3386 | if (!event->isAccepted()) partially evaluated: !event->isAccepted()| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 3387 | QAbstractScrollArea::wheelEvent(event); executed: QAbstractScrollArea::wheelEvent(event);Execution Count:2 | 2 |
| 3388 | } executed: }Execution Count:2 | 2 |
| 3389 | #endif // QT_NO_WHEELEVENT | - |
| 3390 | | - |
| 3391 | /*! | - |
| 3392 | \reimp | - |
| 3393 | */ | - |
| 3394 | void QGraphicsView::paintEvent(QPaintEvent *event) | - |
| 3395 | { | - |
| 3396 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3397 | if (!d->scene) { evaluated: !d->scene| yes Evaluation Count:20 | yes Evaluation Count:2023 |
| 20-2023 |
| 3398 | QAbstractScrollArea::paintEvent(event); executed (the execution status of this line is deduced): QAbstractScrollArea::paintEvent(event); | - |
| 3399 | return; executed: return;Execution Count:20 | 20 |
| 3400 | } | - |
| 3401 | | - |
| 3402 | // Set up painter state protection. | - |
| 3403 | d->scene->d_func()->painterStateProtection = !(d->optimizationFlags & DontSavePainterState); executed (the execution status of this line is deduced): d->scene->d_func()->painterStateProtection = !(d->optimizationFlags & DontSavePainterState); | - |
| 3404 | | - |
| 3405 | // Determine the exposed region | - |
| 3406 | d->exposedRegion = event->region(); executed (the execution status of this line is deduced): d->exposedRegion = event->region(); | - |
| 3407 | QRectF exposedSceneRect = mapToScene(d->exposedRegion.boundingRect()).boundingRect(); executed (the execution status of this line is deduced): QRectF exposedSceneRect = mapToScene(d->exposedRegion.boundingRect()).boundingRect(); | - |
| 3408 | | - |
| 3409 | // Set up the painter | - |
| 3410 | QPainter painter(viewport()); executed (the execution status of this line is deduced): QPainter painter(viewport()); | - |
| 3411 | #ifndef QT_NO_RUBBERBAND | - |
| 3412 | if (d->rubberBanding && !d->rubberBandRect.isEmpty()) evaluated: d->rubberBanding| yes Evaluation Count:3 | yes Evaluation Count:2020 |
partially evaluated: !d->rubberBandRect.isEmpty()| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-2020 |
| 3413 | painter.save(); executed: painter.save();Execution Count:3 | 3 |
| 3414 | #endif | - |
| 3415 | // Set up render hints | - |
| 3416 | painter.setRenderHints(painter.renderHints(), false); executed (the execution status of this line is deduced): painter.setRenderHints(painter.renderHints(), false); | - |
| 3417 | painter.setRenderHints(d->renderHints, true); executed (the execution status of this line is deduced): painter.setRenderHints(d->renderHints, true); | - |
| 3418 | | - |
| 3419 | // Set up viewport transform | - |
| 3420 | const bool viewTransformed = isTransformed(); executed (the execution status of this line is deduced): const bool viewTransformed = isTransformed(); | - |
| 3421 | if (viewTransformed) evaluated: viewTransformed| yes Evaluation Count:1985 | yes Evaluation Count:38 |
| 38-1985 |
| 3422 | painter.setWorldTransform(viewportTransform()); executed: painter.setWorldTransform(viewportTransform());Execution Count:1985 | 1985 |
| 3423 | const QTransform viewTransform = painter.worldTransform(); executed (the execution status of this line is deduced): const QTransform viewTransform = painter.worldTransform(); | - |
| 3424 | | - |
| 3425 | // Draw background | - |
| 3426 | if ((d->cacheMode & CacheBackground) evaluated: (d->cacheMode & CacheBackground)| yes Evaluation Count:1 | yes Evaluation Count:2022 |
| 1-2022 |
| 3427 | #ifdef Q_WS_X11 | - |
| 3428 | && X11->use_xrender | - |
| 3429 | #endif | - |
| 3430 | ) { | - |
| 3431 | // Recreate the background pixmap, and flag the whole background as | - |
| 3432 | // exposed. | - |
| 3433 | if (d->mustResizeBackgroundPixmap) { partially evaluated: d->mustResizeBackgroundPixmap| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 3434 | d->backgroundPixmap = QPixmap(viewport()->size()); executed (the execution status of this line is deduced): d->backgroundPixmap = QPixmap(viewport()->size()); | - |
| 3435 | QBrush bgBrush = viewport()->palette().brush(viewport()->backgroundRole()); executed (the execution status of this line is deduced): QBrush bgBrush = viewport()->palette().brush(viewport()->backgroundRole()); | - |
| 3436 | if (!bgBrush.isOpaque()) partially evaluated: !bgBrush.isOpaque()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 3437 | d->backgroundPixmap.fill(Qt::transparent); never executed: d->backgroundPixmap.fill(Qt::transparent); | 0 |
| 3438 | QPainter p(&d->backgroundPixmap); executed (the execution status of this line is deduced): QPainter p(&d->backgroundPixmap); | - |
| 3439 | p.fillRect(0, 0, d->backgroundPixmap.width(), d->backgroundPixmap.height(), bgBrush); executed (the execution status of this line is deduced): p.fillRect(0, 0, d->backgroundPixmap.width(), d->backgroundPixmap.height(), bgBrush); | - |
| 3440 | d->backgroundPixmapExposed = QRegion(viewport()->rect()); executed (the execution status of this line is deduced): d->backgroundPixmapExposed = QRegion(viewport()->rect()); | - |
| 3441 | d->mustResizeBackgroundPixmap = false; executed (the execution status of this line is deduced): d->mustResizeBackgroundPixmap = false; | - |
| 3442 | } executed: }Execution Count:1 | 1 |
| 3443 | | - |
| 3444 | // Redraw exposed areas | - |
| 3445 | if (!d->backgroundPixmapExposed.isEmpty()) { partially evaluated: !d->backgroundPixmapExposed.isEmpty()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 3446 | QPainter backgroundPainter(&d->backgroundPixmap); executed (the execution status of this line is deduced): QPainter backgroundPainter(&d->backgroundPixmap); | - |
| 3447 | backgroundPainter.setClipRegion(d->backgroundPixmapExposed, Qt::ReplaceClip); executed (the execution status of this line is deduced): backgroundPainter.setClipRegion(d->backgroundPixmapExposed, Qt::ReplaceClip); | - |
| 3448 | if (viewTransformed) partially evaluated: viewTransformed| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 3449 | backgroundPainter.setTransform(viewTransform); executed: backgroundPainter.setTransform(viewTransform);Execution Count:1 | 1 |
| 3450 | QRectF backgroundExposedSceneRect = mapToScene(d->backgroundPixmapExposed.boundingRect()).boundingRect(); executed (the execution status of this line is deduced): QRectF backgroundExposedSceneRect = mapToScene(d->backgroundPixmapExposed.boundingRect()).boundingRect(); | - |
| 3451 | drawBackground(&backgroundPainter, backgroundExposedSceneRect); executed (the execution status of this line is deduced): drawBackground(&backgroundPainter, backgroundExposedSceneRect); | - |
| 3452 | d->backgroundPixmapExposed = QRegion(); executed (the execution status of this line is deduced): d->backgroundPixmapExposed = QRegion(); | - |
| 3453 | } executed: }Execution Count:1 | 1 |
| 3454 | | - |
| 3455 | // Blit the background from the background pixmap | - |
| 3456 | if (viewTransformed) { partially evaluated: viewTransformed| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 3457 | painter.setWorldTransform(QTransform()); executed (the execution status of this line is deduced): painter.setWorldTransform(QTransform()); | - |
| 3458 | painter.drawPixmap(QPoint(), d->backgroundPixmap); executed (the execution status of this line is deduced): painter.drawPixmap(QPoint(), d->backgroundPixmap); | - |
| 3459 | painter.setWorldTransform(viewTransform); executed (the execution status of this line is deduced): painter.setWorldTransform(viewTransform); | - |
| 3460 | } else { executed: }Execution Count:1 | 1 |
| 3461 | painter.drawPixmap(QPoint(), d->backgroundPixmap); never executed (the execution status of this line is deduced): painter.drawPixmap(QPoint(), d->backgroundPixmap); | - |
| 3462 | } | 0 |
| 3463 | } else { | - |
| 3464 | if (!(d->optimizationFlags & DontSavePainterState)) evaluated: !(d->optimizationFlags & DontSavePainterState)| yes Evaluation Count:2016 | yes Evaluation Count:6 |
| 6-2016 |
| 3465 | painter.save(); executed: painter.save();Execution Count:2016 | 2016 |
| 3466 | drawBackground(&painter, exposedSceneRect); executed (the execution status of this line is deduced): drawBackground(&painter, exposedSceneRect); | - |
| 3467 | if (!(d->optimizationFlags & DontSavePainterState)) evaluated: !(d->optimizationFlags & DontSavePainterState)| yes Evaluation Count:2016 | yes Evaluation Count:6 |
| 6-2016 |
| 3468 | painter.restore(); executed: painter.restore();Execution Count:2016 | 2016 |
| 3469 | } executed: }Execution Count:2022 | 2022 |
| 3470 | | - |
| 3471 | // Items | - |
| 3472 | if (!(d->optimizationFlags & IndirectPainting)) { evaluated: !(d->optimizationFlags & IndirectPainting)| yes Evaluation Count:2017 | yes Evaluation Count:6 |
| 6-2017 |
| 3473 | const quint32 oldRectAdjust = d->scene->d_func()->rectAdjust; executed (the execution status of this line is deduced): const quint32 oldRectAdjust = d->scene->d_func()->rectAdjust; | - |
| 3474 | if (d->optimizationFlags & QGraphicsView::DontAdjustForAntialiasing) evaluated: d->optimizationFlags & QGraphicsView::DontAdjustForAntialiasing| yes Evaluation Count:42 | yes Evaluation Count:1975 |
| 42-1975 |
| 3475 | d->scene->d_func()->rectAdjust = 1; executed: d->scene->d_func()->rectAdjust = 1;Execution Count:42 | 42 |
| 3476 | else | - |
| 3477 | d->scene->d_func()->rectAdjust = 2; executed: d->scene->d_func()->rectAdjust = 2;Execution Count:1975 | 1975 |
| 3478 | d->scene->d_func()->drawItems(&painter, viewTransformed ? &viewTransform : 0, executed (the execution status of this line is deduced): d->scene->d_func()->drawItems(&painter, viewTransformed ? &viewTransform : 0, | - |
| 3479 | &d->exposedRegion, viewport()); executed (the execution status of this line is deduced): &d->exposedRegion, viewport()); | - |
| 3480 | d->scene->d_func()->rectAdjust = oldRectAdjust; executed (the execution status of this line is deduced): d->scene->d_func()->rectAdjust = oldRectAdjust; | - |
| 3481 | // Make sure the painter's world transform is restored correctly when | - |
| 3482 | // drawing without painter state protection (DontSavePainterState). | - |
| 3483 | // We only change the worldTransform() so there's no need to do a full-blown | - |
| 3484 | // save() and restore(). Also note that we don't have to do this in case of | - |
| 3485 | // IndirectPainting (the else branch), because in that case we always save() | - |
| 3486 | // and restore() in QGraphicsScene::drawItems(). | - |
| 3487 | if (!d->scene->d_func()->painterStateProtection) evaluated: !d->scene->d_func()->painterStateProtection| yes Evaluation Count:4 | yes Evaluation Count:2013 |
| 4-2013 |
| 3488 | painter.setOpacity(1.0); executed: painter.setOpacity(1.0);Execution Count:4 | 4 |
| 3489 | painter.setWorldTransform(viewTransform); executed (the execution status of this line is deduced): painter.setWorldTransform(viewTransform); | - |
| 3490 | } else { executed: }Execution Count:2017 | 2017 |
| 3491 | // Make sure we don't have unpolished items before we draw | - |
| 3492 | if (!d->scene->d_func()->unpolishedItems.isEmpty()) partially evaluated: !d->scene->d_func()->unpolishedItems.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 3493 | d->scene->d_func()->_q_polishItems(); never executed: d->scene->d_func()->_q_polishItems(); | 0 |
| 3494 | // We reset updateAll here (after we've issued polish events) | - |
| 3495 | // so that we can discard update requests coming from polishEvent(). | - |
| 3496 | d->scene->d_func()->updateAll = false; executed (the execution status of this line is deduced): d->scene->d_func()->updateAll = false; | - |
| 3497 | | - |
| 3498 | // Find all exposed items | - |
| 3499 | bool allItems = false; executed (the execution status of this line is deduced): bool allItems = false; | - |
| 3500 | QList<QGraphicsItem *> itemList = d->findItems(d->exposedRegion, &allItems, viewTransform); executed (the execution status of this line is deduced): QList<QGraphicsItem *> itemList = d->findItems(d->exposedRegion, &allItems, viewTransform); | - |
| 3501 | if (!itemList.isEmpty()) { partially evaluated: !itemList.isEmpty()| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 3502 | // Generate the style options. | - |
| 3503 | const int numItems = itemList.size(); executed (the execution status of this line is deduced): const int numItems = itemList.size(); | - |
| 3504 | QGraphicsItem **itemArray = &itemList[0]; // Relies on QList internals, but is perfectly valid. executed (the execution status of this line is deduced): QGraphicsItem **itemArray = &itemList[0]; | - |
| 3505 | QStyleOptionGraphicsItem *styleOptionArray = d->allocStyleOptionsArray(numItems); executed (the execution status of this line is deduced): QStyleOptionGraphicsItem *styleOptionArray = d->allocStyleOptionsArray(numItems); | - |
| 3506 | QTransform transform(Qt::Uninitialized); executed (the execution status of this line is deduced): QTransform transform(Qt::Uninitialized); | - |
| 3507 | for (int i = 0; i < numItems; ++i) { evaluated: i < numItems| yes Evaluation Count:10 | yes Evaluation Count:6 |
| 6-10 |
| 3508 | QGraphicsItem *item = itemArray[i]; executed (the execution status of this line is deduced): QGraphicsItem *item = itemArray[i]; | - |
| 3509 | QGraphicsItemPrivate *itemd = item->d_ptr.data(); executed (the execution status of this line is deduced): QGraphicsItemPrivate *itemd = item->d_ptr.data(); | - |
| 3510 | itemd->initStyleOption(&styleOptionArray[i], viewTransform, d->exposedRegion, allItems); executed (the execution status of this line is deduced): itemd->initStyleOption(&styleOptionArray[i], viewTransform, d->exposedRegion, allItems); | - |
| 3511 | // Cache the item's area in view coordinates. | - |
| 3512 | // Note that we have to do this here in case the base class implementation | - |
| 3513 | // (QGraphicsScene::drawItems) is not called. If it is, we'll do this | - |
| 3514 | // operation twice, but that's the price one has to pay for using indirect | - |
| 3515 | // painting :-/. | - |
| 3516 | const QRectF brect = adjustedItemEffectiveBoundingRect(item); executed (the execution status of this line is deduced): const QRectF brect = adjustedItemEffectiveBoundingRect(item); | - |
| 3517 | if (!itemd->itemIsUntransformable()) { partially evaluated: !itemd->itemIsUntransformable()| yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
| 3518 | transform = item->sceneTransform(); executed (the execution status of this line is deduced): transform = item->sceneTransform(); | - |
| 3519 | if (viewTransformed) partially evaluated: viewTransformed| yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
| 3520 | transform *= viewTransform; executed: transform *= viewTransform;Execution Count:10 | 10 |
| 3521 | } else { executed: }Execution Count:10 | 10 |
| 3522 | transform = item->deviceTransform(viewTransform); never executed (the execution status of this line is deduced): transform = item->deviceTransform(viewTransform); | - |
| 3523 | } | 0 |
| 3524 | itemd->paintedViewBoundingRects.insert(d->viewport, transform.mapRect(brect).toRect()); executed (the execution status of this line is deduced): itemd->paintedViewBoundingRects.insert(d->viewport, transform.mapRect(brect).toRect()); | - |
| 3525 | } executed: }Execution Count:10 | 10 |
| 3526 | // Draw the items. | - |
| 3527 | drawItems(&painter, numItems, itemArray, styleOptionArray); executed (the execution status of this line is deduced): drawItems(&painter, numItems, itemArray, styleOptionArray); | - |
| 3528 | d->freeStyleOptionsArray(styleOptionArray); executed (the execution status of this line is deduced): d->freeStyleOptionsArray(styleOptionArray); | - |
| 3529 | } executed: }Execution Count:6 | 6 |
| 3530 | } executed: }Execution Count:6 | 6 |
| 3531 | | - |
| 3532 | // Foreground | - |
| 3533 | drawForeground(&painter, exposedSceneRect); executed (the execution status of this line is deduced): drawForeground(&painter, exposedSceneRect); | - |
| 3534 | | - |
| 3535 | #ifndef QT_NO_RUBBERBAND | - |
| 3536 | // Rubberband | - |
| 3537 | if (d->rubberBanding && !d->rubberBandRect.isEmpty()) { evaluated: d->rubberBanding| yes Evaluation Count:3 | yes Evaluation Count:2020 |
partially evaluated: !d->rubberBandRect.isEmpty()| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-2020 |
| 3538 | painter.restore(); executed (the execution status of this line is deduced): painter.restore(); | - |
| 3539 | QStyleOptionRubberBand option; executed (the execution status of this line is deduced): QStyleOptionRubberBand option; | - |
| 3540 | option.initFrom(viewport()); executed (the execution status of this line is deduced): option.initFrom(viewport()); | - |
| 3541 | option.rect = d->rubberBandRect; executed (the execution status of this line is deduced): option.rect = d->rubberBandRect; | - |
| 3542 | option.shape = QRubberBand::Rectangle; executed (the execution status of this line is deduced): option.shape = QRubberBand::Rectangle; | - |
| 3543 | | - |
| 3544 | QStyleHintReturnMask mask; executed (the execution status of this line is deduced): QStyleHintReturnMask mask; | - |
| 3545 | if (viewport()->style()->styleHint(QStyle::SH_RubberBand_Mask, &option, viewport(), &mask)) { partially evaluated: viewport()->style()->styleHint(QStyle::SH_RubberBand_Mask, &option, viewport(), &mask)| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 3546 | // painter clipping for masked rubberbands | - |
| 3547 | painter.setClipRegion(mask.region, Qt::IntersectClip); executed (the execution status of this line is deduced): painter.setClipRegion(mask.region, Qt::IntersectClip); | - |
| 3548 | } executed: }Execution Count:3 | 3 |
| 3549 | | - |
| 3550 | viewport()->style()->drawControl(QStyle::CE_RubberBand, &option, &painter, viewport()); executed (the execution status of this line is deduced): viewport()->style()->drawControl(QStyle::CE_RubberBand, &option, &painter, viewport()); | - |
| 3551 | } executed: }Execution Count:3 | 3 |
| 3552 | #endif | - |
| 3553 | | - |
| 3554 | painter.end(); executed (the execution status of this line is deduced): painter.end(); | - |
| 3555 | | - |
| 3556 | // Restore painter state protection. | - |
| 3557 | d->scene->d_func()->painterStateProtection = true; executed (the execution status of this line is deduced): d->scene->d_func()->painterStateProtection = true; | - |
| 3558 | } executed: }Execution Count:2023 | 2023 |
| 3559 | | - |
| 3560 | /*! | - |
| 3561 | \reimp | - |
| 3562 | */ | - |
| 3563 | void QGraphicsView::resizeEvent(QResizeEvent *event) | - |
| 3564 | { | - |
| 3565 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3566 | // Save the last center point - the resize may scroll the view, which | - |
| 3567 | // changes the center point. | - |
| 3568 | QPointF oldLastCenterPoint = d->lastCenterPoint; executed (the execution status of this line is deduced): QPointF oldLastCenterPoint = d->lastCenterPoint; | - |
| 3569 | | - |
| 3570 | QAbstractScrollArea::resizeEvent(event); executed (the execution status of this line is deduced): QAbstractScrollArea::resizeEvent(event); | - |
| 3571 | d->recalculateContentSize(); executed (the execution status of this line is deduced): d->recalculateContentSize(); | - |
| 3572 | | - |
| 3573 | // Restore the center point again. | - |
| 3574 | if (d->resizeAnchor == NoAnchor && !d->keepLastCenterPoint) { evaluated: d->resizeAnchor == NoAnchor| yes Evaluation Count:911 | yes Evaluation Count:9 |
evaluated: !d->keepLastCenterPoint| yes Evaluation Count:176 | yes Evaluation Count:735 |
| 9-911 |
| 3575 | d->updateLastCenterPoint(); executed (the execution status of this line is deduced): d->updateLastCenterPoint(); | - |
| 3576 | } else { executed: }Execution Count:176 | 176 |
| 3577 | d->lastCenterPoint = oldLastCenterPoint; executed (the execution status of this line is deduced): d->lastCenterPoint = oldLastCenterPoint; | - |
| 3578 | } executed: }Execution Count:744 | 744 |
| 3579 | d->centerView(d->resizeAnchor); executed (the execution status of this line is deduced): d->centerView(d->resizeAnchor); | - |
| 3580 | d->keepLastCenterPoint = false; executed (the execution status of this line is deduced): d->keepLastCenterPoint = false; | - |
| 3581 | | - |
| 3582 | if (d->cacheMode & CacheBackground) { partially evaluated: d->cacheMode & CacheBackground| no Evaluation Count:0 | yes Evaluation Count:920 |
| 0-920 |
| 3583 | // Invalidate the background pixmap | - |
| 3584 | d->mustResizeBackgroundPixmap = true; never executed (the execution status of this line is deduced): d->mustResizeBackgroundPixmap = true; | - |
| 3585 | } | 0 |
| 3586 | } executed: }Execution Count:920 | 920 |
| 3587 | | - |
| 3588 | /*! | - |
| 3589 | \reimp | - |
| 3590 | */ | - |
| 3591 | void QGraphicsView::scrollContentsBy(int dx, int dy) | - |
| 3592 | { | - |
| 3593 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3594 | d->dirtyScroll = true; executed (the execution status of this line is deduced): d->dirtyScroll = true; | - |
| 3595 | if (d->transforming) evaluated: d->transforming| yes Evaluation Count:326 | yes Evaluation Count:2413 |
| 326-2413 |
| 3596 | return; executed: return;Execution Count:326 | 326 |
| 3597 | if (isRightToLeft()) evaluated: isRightToLeft()| yes Evaluation Count:5 | yes Evaluation Count:2408 |
| 5-2408 |
| 3598 | dx = -dx; executed: dx = -dx;Execution Count:5 | 5 |
| 3599 | | - |
| 3600 | if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate) { partially evaluated: d->viewportUpdateMode != QGraphicsView::NoViewportUpdate| yes Evaluation Count:2413 | no Evaluation Count:0 |
| 0-2413 |
| 3601 | if (d->viewportUpdateMode != QGraphicsView::FullViewportUpdate) { partially evaluated: d->viewportUpdateMode != QGraphicsView::FullViewportUpdate| yes Evaluation Count:2413 | no Evaluation Count:0 |
| 0-2413 |
| 3602 | if (d->accelerateScrolling) { partially evaluated: d->accelerateScrolling| yes Evaluation Count:2413 | no Evaluation Count:0 |
| 0-2413 |
| 3603 | #ifndef QT_NO_RUBBERBAND | - |
| 3604 | // Update new and old rubberband regions | - |
| 3605 | if (!d->rubberBandRect.isEmpty()) { partially evaluated: !d->rubberBandRect.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:2413 |
| 0-2413 |
| 3606 | QRegion rubberBandRegion(d->rubberBandRegion(viewport(), d->rubberBandRect)); never executed (the execution status of this line is deduced): QRegion rubberBandRegion(d->rubberBandRegion(viewport(), d->rubberBandRect)); | - |
| 3607 | rubberBandRegion += rubberBandRegion.translated(-dx, -dy); never executed (the execution status of this line is deduced): rubberBandRegion += rubberBandRegion.translated(-dx, -dy); | - |
| 3608 | viewport()->update(rubberBandRegion); never executed (the execution status of this line is deduced): viewport()->update(rubberBandRegion); | - |
| 3609 | } | 0 |
| 3610 | #endif | - |
| 3611 | d->dirtyScrollOffset.rx() += dx; executed (the execution status of this line is deduced): d->dirtyScrollOffset.rx() += dx; | - |
| 3612 | d->dirtyScrollOffset.ry() += dy; executed (the execution status of this line is deduced): d->dirtyScrollOffset.ry() += dy; | - |
| 3613 | d->dirtyRegion.translate(dx, dy); executed (the execution status of this line is deduced): d->dirtyRegion.translate(dx, dy); | - |
| 3614 | viewport()->scroll(dx, dy); executed (the execution status of this line is deduced): viewport()->scroll(dx, dy); | - |
| 3615 | } else { executed: }Execution Count:2413 | 2413 |
| 3616 | d->updateAll(); never executed (the execution status of this line is deduced): d->updateAll(); | - |
| 3617 | } | 0 |
| 3618 | } else { | - |
| 3619 | d->updateAll(); never executed (the execution status of this line is deduced): d->updateAll(); | - |
| 3620 | } | 0 |
| 3621 | } | - |
| 3622 | | - |
| 3623 | d->updateLastCenterPoint(); executed (the execution status of this line is deduced): d->updateLastCenterPoint(); | - |
| 3624 | | - |
| 3625 | if ((d->cacheMode & CacheBackground) partially evaluated: (d->cacheMode & CacheBackground)| no Evaluation Count:0 | yes Evaluation Count:2413 |
| 0-2413 |
| 3626 | #ifdef Q_WS_X11 | - |
| 3627 | && X11->use_xrender | - |
| 3628 | #endif | - |
| 3629 | ) { | - |
| 3630 | // Scroll the background pixmap | - |
| 3631 | QRegion exposed; never executed (the execution status of this line is deduced): QRegion exposed; | - |
| 3632 | if (!d->backgroundPixmap.isNull()) never evaluated: !d->backgroundPixmap.isNull() | 0 |
| 3633 | d->backgroundPixmap.scroll(dx, dy, d->backgroundPixmap.rect(), &exposed); never executed: d->backgroundPixmap.scroll(dx, dy, d->backgroundPixmap.rect(), &exposed); | 0 |
| 3634 | | - |
| 3635 | // Invalidate the background pixmap | - |
| 3636 | d->backgroundPixmapExposed.translate(dx, dy); never executed (the execution status of this line is deduced): d->backgroundPixmapExposed.translate(dx, dy); | - |
| 3637 | d->backgroundPixmapExposed += exposed; never executed (the execution status of this line is deduced): d->backgroundPixmapExposed += exposed; | - |
| 3638 | } | 0 |
| 3639 | | - |
| 3640 | // Always replay on scroll. | - |
| 3641 | if (d->sceneInteractionAllowed) evaluated: d->sceneInteractionAllowed| yes Evaluation Count:2397 | yes Evaluation Count:16 |
| 16-2397 |
| 3642 | d->replayLastMouseEvent(); executed: d->replayLastMouseEvent();Execution Count:2397 | 2397 |
| 3643 | } executed: }Execution Count:2413 | 2413 |
| 3644 | | - |
| 3645 | /*! | - |
| 3646 | \reimp | - |
| 3647 | */ | - |
| 3648 | void QGraphicsView::showEvent(QShowEvent *event) | - |
| 3649 | { | - |
| 3650 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3651 | d->recalculateContentSize(); executed (the execution status of this line is deduced): d->recalculateContentSize(); | - |
| 3652 | d->centerView(d->transformationAnchor); executed (the execution status of this line is deduced): d->centerView(d->transformationAnchor); | - |
| 3653 | QAbstractScrollArea::showEvent(event); executed (the execution status of this line is deduced): QAbstractScrollArea::showEvent(event); | - |
| 3654 | } executed: }Execution Count:734 | 734 |
| 3655 | | - |
| 3656 | /*! | - |
| 3657 | \reimp | - |
| 3658 | */ | - |
| 3659 | void QGraphicsView::inputMethodEvent(QInputMethodEvent *event) | - |
| 3660 | { | - |
| 3661 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3662 | if (d->scene) partially evaluated: d->scene| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 3663 | QApplication::sendEvent(d->scene, event); executed: QApplication::sendEvent(d->scene, event);Execution Count:3 | 3 |
| 3664 | } executed: }Execution Count:3 | 3 |
| 3665 | | - |
| 3666 | /*! | - |
| 3667 | Draws the background of the scene using \a painter, before any items and | - |
| 3668 | the foreground are drawn. Reimplement this function to provide a custom | - |
| 3669 | background for this view. | - |
| 3670 | | - |
| 3671 | If all you want is to define a color, texture or gradient for the | - |
| 3672 | background, you can call setBackgroundBrush() instead. | - |
| 3673 | | - |
| 3674 | All painting is done in \e scene coordinates. \a rect is the exposed | - |
| 3675 | rectangle. | - |
| 3676 | | - |
| 3677 | The default implementation fills \a rect using the view's backgroundBrush. | - |
| 3678 | If no such brush is defined (the default), the scene's drawBackground() | - |
| 3679 | function is called instead. | - |
| 3680 | | - |
| 3681 | \sa drawForeground(), QGraphicsScene::drawBackground() | - |
| 3682 | */ | - |
| 3683 | void QGraphicsView::drawBackground(QPainter *painter, const QRectF &rect) | - |
| 3684 | { | - |
| 3685 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3686 | if (d->scene && d->backgroundBrush.style() == Qt::NoBrush) { partially evaluated: d->scene| yes Evaluation Count:2020 | no Evaluation Count:0 |
evaluated: d->backgroundBrush.style() == Qt::NoBrush| yes Evaluation Count:2017 | yes Evaluation Count:3 |
| 0-2020 |
| 3687 | d->scene->drawBackground(painter, rect); executed (the execution status of this line is deduced): d->scene->drawBackground(painter, rect); | - |
| 3688 | return; executed: return;Execution Count:2017 | 2017 |
| 3689 | } | - |
| 3690 | | - |
| 3691 | painter->fillRect(rect, d->backgroundBrush); executed (the execution status of this line is deduced): painter->fillRect(rect, d->backgroundBrush); | - |
| 3692 | } executed: }Execution Count:3 | 3 |
| 3693 | | - |
| 3694 | /*! | - |
| 3695 | Draws the foreground of the scene using \a painter, after the background | - |
| 3696 | and all items are drawn. Reimplement this function to provide a custom | - |
| 3697 | foreground for this view. | - |
| 3698 | | - |
| 3699 | If all you want is to define a color, texture or gradient for the | - |
| 3700 | foreground, you can call setForegroundBrush() instead. | - |
| 3701 | | - |
| 3702 | All painting is done in \e scene coordinates. \a rect is the exposed | - |
| 3703 | rectangle. | - |
| 3704 | | - |
| 3705 | The default implementation fills \a rect using the view's foregroundBrush. | - |
| 3706 | If no such brush is defined (the default), the scene's drawForeground() | - |
| 3707 | function is called instead. | - |
| 3708 | | - |
| 3709 | \sa drawBackground(), QGraphicsScene::drawForeground() | - |
| 3710 | */ | - |
| 3711 | void QGraphicsView::drawForeground(QPainter *painter, const QRectF &rect) | - |
| 3712 | { | - |
| 3713 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3714 | if (d->scene && d->foregroundBrush.style() == Qt::NoBrush) { partially evaluated: d->scene| yes Evaluation Count:2024 | no Evaluation Count:0 |
partially evaluated: d->foregroundBrush.style() == Qt::NoBrush| yes Evaluation Count:2024 | no Evaluation Count:0 |
| 0-2024 |
| 3715 | d->scene->drawForeground(painter, rect); executed (the execution status of this line is deduced): d->scene->drawForeground(painter, rect); | - |
| 3716 | return; executed: return;Execution Count:2024 | 2024 |
| 3717 | } | - |
| 3718 | | - |
| 3719 | painter->fillRect(rect, d->foregroundBrush); never executed (the execution status of this line is deduced): painter->fillRect(rect, d->foregroundBrush); | - |
| 3720 | } | 0 |
| 3721 | | - |
| 3722 | /*! | - |
| 3723 | \obsolete | - |
| 3724 | | - |
| 3725 | Draws the items \a items in the scene using \a painter, after the | - |
| 3726 | background and before the foreground are drawn. \a numItems is the number | - |
| 3727 | of items in \a items and options in \a options. \a options is a list of | - |
| 3728 | styleoptions; one for each item. Reimplement this function to provide | - |
| 3729 | custom item drawing for this view. | - |
| 3730 | | - |
| 3731 | The default implementation calls the scene's drawItems() function. | - |
| 3732 | | - |
| 3733 | Since Qt 4.6, this function is not called anymore unless | - |
| 3734 | the QGraphicsView::IndirectPainting flag is given as an Optimization | - |
| 3735 | flag. | - |
| 3736 | | - |
| 3737 | \sa drawForeground(), drawBackground(), QGraphicsScene::drawItems() | - |
| 3738 | */ | - |
| 3739 | void QGraphicsView::drawItems(QPainter *painter, int numItems, | - |
| 3740 | QGraphicsItem *items[], | - |
| 3741 | const QStyleOptionGraphicsItem options[]) | - |
| 3742 | { | - |
| 3743 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3744 | if (d->scene) { partially evaluated: d->scene| yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
| 3745 | QWidget *widget = painter->device() == viewport() ? viewport() : 0; evaluated: painter->device() == viewport()| yes Evaluation Count:6 | yes Evaluation Count:1 |
| 1-6 |
| 3746 | d->scene->drawItems(painter, numItems, items, options, widget); executed (the execution status of this line is deduced): d->scene->drawItems(painter, numItems, items, options, widget); | - |
| 3747 | } executed: }Execution Count:7 | 7 |
| 3748 | } executed: }Execution Count:7 | 7 |
| 3749 | | - |
| 3750 | /*! | - |
| 3751 | Returns the current transformation matrix for the view. If no current | - |
| 3752 | transformation is set, the identity matrix is returned. | - |
| 3753 | | - |
| 3754 | \sa setTransform(), rotate(), scale(), shear(), translate() | - |
| 3755 | */ | - |
| 3756 | QTransform QGraphicsView::transform() const | - |
| 3757 | { | - |
| 3758 | Q_D(const QGraphicsView); never executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 3759 | return d->matrix; never executed: return d->matrix; | 0 |
| 3760 | } | - |
| 3761 | | - |
| 3762 | /*! | - |
| 3763 | Returns a matrix that maps viewport coordinates to scene coordinates. | - |
| 3764 | | - |
| 3765 | \sa mapToScene(), mapFromScene() | - |
| 3766 | */ | - |
| 3767 | QTransform QGraphicsView::viewportTransform() const | - |
| 3768 | { | - |
| 3769 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 3770 | QTransform moveMatrix = QTransform::fromTranslate(-d->horizontalScroll(), -d->verticalScroll()); executed (the execution status of this line is deduced): QTransform moveMatrix = QTransform::fromTranslate(-d->horizontalScroll(), -d->verticalScroll()); | - |
| 3771 | return d->identityMatrix ? moveMatrix : d->matrix * moveMatrix; executed: return d->identityMatrix ? moveMatrix : d->matrix * moveMatrix;Execution Count:2790 | 2790 |
| 3772 | } | - |
| 3773 | | - |
| 3774 | /*! | - |
| 3775 | \since 4.6 | - |
| 3776 | | - |
| 3777 | Returns true if the view is transformed (i.e., a non-identity transform | - |
| 3778 | has been assigned, or the scrollbars are adjusted). | - |
| 3779 | | - |
| 3780 | \sa setTransform(), horizontalScrollBar(), verticalScrollBar() | - |
| 3781 | */ | - |
| 3782 | bool QGraphicsView::isTransformed() const | - |
| 3783 | { | - |
| 3784 | Q_D(const QGraphicsView); executed (the execution status of this line is deduced): const QGraphicsViewPrivate * const d = d_func(); | - |
| 3785 | return !d->identityMatrix || d->horizontalScroll() || d->verticalScroll(); executed: return !d->identityMatrix || d->horizontalScroll() || d->verticalScroll();Execution Count:2489 | 2489 |
| 3786 | } | - |
| 3787 | | - |
| 3788 | /*! | - |
| 3789 | Sets the view's current transformation matrix to \a matrix. | - |
| 3790 | | - |
| 3791 | If \a combine is true, then \a matrix is combined with the current matrix; | - |
| 3792 | otherwise, \a matrix \e replaces the current matrix. \a combine is false | - |
| 3793 | by default. | - |
| 3794 | | - |
| 3795 | The transformation matrix tranforms the scene into view coordinates. Using | - |
| 3796 | the default transformation, provided by the identity matrix, one pixel in | - |
| 3797 | the view represents one unit in the scene (e.g., a 10x10 rectangular item | - |
| 3798 | is drawn using 10x10 pixels in the view). If a 2x2 scaling matrix is | - |
| 3799 | applied, the scene will be drawn in 1:2 (e.g., a 10x10 rectangular item is | - |
| 3800 | then drawn using 20x20 pixels in the view). | - |
| 3801 | | - |
| 3802 | Example: | - |
| 3803 | | - |
| 3804 | \snippet code/src_gui_graphicsview_qgraphicsview.cpp 7 | - |
| 3805 | | - |
| 3806 | To simplify interation with items using a transformed view, QGraphicsView | - |
| 3807 | provides mapTo... and mapFrom... functions that can translate between | - |
| 3808 | scene and view coordinates. For example, you can call mapToScene() to map | - |
| 3809 | a view coordiate to a floating point scene coordinate, or mapFromScene() | - |
| 3810 | to map from floating point scene coordinates to view coordinates. | - |
| 3811 | | - |
| 3812 | \sa transform(), rotate(), scale(), shear(), translate() | - |
| 3813 | */ | - |
| 3814 | void QGraphicsView::setTransform(const QTransform &matrix, bool combine ) | - |
| 3815 | { | - |
| 3816 | Q_D(QGraphicsView); executed (the execution status of this line is deduced): QGraphicsViewPrivate * const d = d_func(); | - |
| 3817 | QTransform oldMatrix = d->matrix; executed (the execution status of this line is deduced): QTransform oldMatrix = d->matrix; | - |
| 3818 | if (!combine) evaluated: !combine| yes Evaluation Count:742 | yes Evaluation Count:5 |
| 5-742 |
| 3819 | d->matrix = matrix; executed: d->matrix = matrix;Execution Count:742 | 742 |
| 3820 | else | - |
| 3821 | d->matrix = matrix * d->matrix; executed: d->matrix = matrix * d->matrix;Execution Count:5 | 5 |
| 3822 | if (oldMatrix == d->matrix) evaluated: oldMatrix == d->matrix| yes Evaluation Count:299 | yes Evaluation Count:448 |
| 299-448 |
| 3823 | return; executed: return;Execution Count:299 | 299 |
| 3824 | | - |
| 3825 | d->identityMatrix = d->matrix.isIdentity(); executed (the execution status of this line is deduced): d->identityMatrix = d->matrix.isIdentity(); | - |
| 3826 | d->transforming = true; executed (the execution status of this line is deduced): d->transforming = true; | - |
| 3827 | if (d->scene) { evaluated: d->scene| yes Evaluation Count:439 | yes Evaluation Count:9 |
| 9-439 |
| 3828 | d->recalculateContentSize(); executed (the execution status of this line is deduced): d->recalculateContentSize(); | - |
| 3829 | d->centerView(d->transformationAnchor); executed (the execution status of this line is deduced): d->centerView(d->transformationAnchor); | - |
| 3830 | } else { executed: }Execution Count:439 | 439 |
| 3831 | d->updateLastCenterPoint(); executed (the execution status of this line is deduced): d->updateLastCenterPoint(); | - |
| 3832 | } executed: }Execution Count:9 | 9 |
| 3833 | | - |
| 3834 | if (d->sceneInteractionAllowed) partially evaluated: d->sceneInteractionAllowed| yes Evaluation Count:448 | no Evaluation Count:0 |
| 0-448 |
| 3835 | d->replayLastMouseEvent(); executed: d->replayLastMouseEvent();Execution Count:448 | 448 |
| 3836 | d->transforming = false; executed (the execution status of this line is deduced): d->transforming = false; | - |
| 3837 | | - |
| 3838 | // Any matrix operation requires a full update. | - |
| 3839 | d->updateAll(); executed (the execution status of this line is deduced): d->updateAll(); | - |
| 3840 | } executed: }Execution Count:448 | 448 |
| 3841 | | - |
| 3842 | /*! | - |
| 3843 | Resets the view transformation to the identity matrix. | - |
| 3844 | | - |
| 3845 | \sa transform(), setTransform() | - |
| 3846 | */ | - |
| 3847 | void QGraphicsView::resetTransform() | - |
| 3848 | { | - |
| 3849 | setTransform(QTransform()); executed (the execution status of this line is deduced): setTransform(QTransform()); | - |
| 3850 | } executed: }Execution Count:1 | 1 |
| 3851 | | - |
| 3852 | QPointF QGraphicsViewPrivate::mapToScene(const QPointF &point) const | - |
| 3853 | { | - |
| 3854 | QPointF p = point; never executed (the execution status of this line is deduced): QPointF p = point; | - |
| 3855 | p.rx() += horizontalScroll(); never executed (the execution status of this line is deduced): p.rx() += horizontalScroll(); | - |
| 3856 | p.ry() += verticalScroll(); never executed (the execution status of this line is deduced): p.ry() += verticalScroll(); | - |
| 3857 | return identityMatrix ? p : matrix.inverted().map(p); never executed: return identityMatrix ? p : matrix.inverted().map(p); | 0 |
| 3858 | } | - |
| 3859 | | - |
| 3860 | QRectF QGraphicsViewPrivate::mapToScene(const QRectF &rect) const | - |
| 3861 | { | - |
| 3862 | QPointF scrollOffset(horizontalScroll(), verticalScroll()); executed (the execution status of this line is deduced): QPointF scrollOffset(horizontalScroll(), verticalScroll()); | - |
| 3863 | QPointF tl = scrollOffset + rect.topLeft(); executed (the execution status of this line is deduced): QPointF tl = scrollOffset + rect.topLeft(); | - |
| 3864 | QPointF tr = scrollOffset + rect.topRight(); executed (the execution status of this line is deduced): QPointF tr = scrollOffset + rect.topRight(); | - |
| 3865 | QPointF br = scrollOffset + rect.bottomRight(); executed (the execution status of this line is deduced): QPointF br = scrollOffset + rect.bottomRight(); | - |
| 3866 | QPointF bl = scrollOffset + rect.bottomLeft(); executed (the execution status of this line is deduced): QPointF bl = scrollOffset + rect.bottomLeft(); | - |
| 3867 | | - |
| 3868 | QPolygonF poly(4); executed (the execution status of this line is deduced): QPolygonF poly(4); | - |
| 3869 | if (!identityMatrix) { partially evaluated: !identityMatrix| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 3870 | QTransform x = matrix.inverted(); never executed (the execution status of this line is deduced): QTransform x = matrix.inverted(); | - |
| 3871 | poly[0] = x.map(tl); never executed (the execution status of this line is deduced): poly[0] = x.map(tl); | - |
| 3872 | poly[1] = x.map(tr); never executed (the execution status of this line is deduced): poly[1] = x.map(tr); | - |
| 3873 | poly[2] = x.map(br); never executed (the execution status of this line is deduced): poly[2] = x.map(br); | - |
| 3874 | poly[3] = x.map(bl); never executed (the execution status of this line is deduced): poly[3] = x.map(bl); | - |
| 3875 | } else { | 0 |
| 3876 | poly[0] = tl; executed (the execution status of this line is deduced): poly[0] = tl; | - |
| 3877 | poly[1] = tr; executed (the execution status of this line is deduced): poly[1] = tr; | - |
| 3878 | poly[2] = br; executed (the execution status of this line is deduced): poly[2] = br; | - |
| 3879 | poly[3] = bl; executed (the execution status of this line is deduced): poly[3] = bl; | - |
| 3880 | } executed: }Execution Count:7 | 7 |
| 3881 | return poly.boundingRect(); executed: return poly.boundingRect();Execution Count:7 | 7 |
| 3882 | } | - |
| 3883 | | - |
| 3884 | QT_END_NAMESPACE | - |
| 3885 | | - |
| 3886 | #include "moc_qgraphicsview.cpp" | - |
| 3887 | | - |
| 3888 | #endif // QT_NO_GRAPHICSVIEW | - |
| 3889 | | - |
| | |