| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/graphicsview/qgraphicsscene.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||||||||
| 10 | bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); | - | ||||||||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||||||||
| 12 | static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraphicsSceneMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||||||||
| 13 | { | - | ||||||||||||||||||||||||||||||
| 14 | hover->setWidget(mouseEvent->widget()); | - | ||||||||||||||||||||||||||||||
| 15 | hover->setPos(mouseEvent->pos()); | - | ||||||||||||||||||||||||||||||
| 16 | hover->setScenePos(mouseEvent->scenePos()); | - | ||||||||||||||||||||||||||||||
| 17 | hover->setScreenPos(mouseEvent->screenPos()); | - | ||||||||||||||||||||||||||||||
| 18 | hover->setLastPos(mouseEvent->lastPos()); | - | ||||||||||||||||||||||||||||||
| 19 | hover->setLastScenePos(mouseEvent->lastScenePos()); | - | ||||||||||||||||||||||||||||||
| 20 | hover->setLastScreenPos(mouseEvent->lastScreenPos()); | - | ||||||||||||||||||||||||||||||
| 21 | hover->setModifiers(mouseEvent->modifiers()); | - | ||||||||||||||||||||||||||||||
| 22 | hover->setAccepted(mouseEvent->isAccepted()); | - | ||||||||||||||||||||||||||||||
| 23 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 24 | - | |||||||||||||||||||||||||||||||
| 25 | - | |||||||||||||||||||||||||||||||
| 26 | - | |||||||||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||||||||
| 28 | QGraphicsScenePrivate::QGraphicsScenePrivate() | - | ||||||||||||||||||||||||||||||
| 29 | : indexMethod(QGraphicsScene::BspTreeIndex), | - | ||||||||||||||||||||||||||||||
| 30 | index(0), | - | ||||||||||||||||||||||||||||||
| 31 | lastItemCount(0), | - | ||||||||||||||||||||||||||||||
| 32 | hasSceneRect(false), | - | ||||||||||||||||||||||||||||||
| 33 | dirtyGrowingItemsBoundingRect(true), | - | ||||||||||||||||||||||||||||||
| 34 | updateAll(false), | - | ||||||||||||||||||||||||||||||
| 35 | calledEmitUpdated(false), | - | ||||||||||||||||||||||||||||||
| 36 | processDirtyItemsEmitted(false), | - | ||||||||||||||||||||||||||||||
| 37 | needSortTopLevelItems(true), | - | ||||||||||||||||||||||||||||||
| 38 | holesInTopLevelSiblingIndex(false), | - | ||||||||||||||||||||||||||||||
| 39 | topLevelSequentialOrdering(true), | - | ||||||||||||||||||||||||||||||
| 40 | scenePosDescendantsUpdatePending(false), | - | ||||||||||||||||||||||||||||||
| 41 | stickyFocus(false), | - | ||||||||||||||||||||||||||||||
| 42 | hasFocus(false), | - | ||||||||||||||||||||||||||||||
| 43 | lastMouseGrabberItemHasImplicitMouseGrab(false), | - | ||||||||||||||||||||||||||||||
| 44 | allItemsIgnoreHoverEvents(true), | - | ||||||||||||||||||||||||||||||
| 45 | allItemsUseDefaultCursor(true), | - | ||||||||||||||||||||||||||||||
| 46 | painterStateProtection(true), | - | ||||||||||||||||||||||||||||||
| 47 | sortCacheEnabled(false), | - | ||||||||||||||||||||||||||||||
| 48 | allItemsIgnoreTouchEvents(true), | - | ||||||||||||||||||||||||||||||
| 49 | minimumRenderSize(0.0), | - | ||||||||||||||||||||||||||||||
| 50 | selectionChanging(0), | - | ||||||||||||||||||||||||||||||
| 51 | rectAdjust(2), | - | ||||||||||||||||||||||||||||||
| 52 | focusItem(0), | - | ||||||||||||||||||||||||||||||
| 53 | lastFocusItem(0), | - | ||||||||||||||||||||||||||||||
| 54 | passiveFocusItem(0), | - | ||||||||||||||||||||||||||||||
| 55 | tabFocusFirst(0), | - | ||||||||||||||||||||||||||||||
| 56 | activePanel(0), | - | ||||||||||||||||||||||||||||||
| 57 | lastActivePanel(0), | - | ||||||||||||||||||||||||||||||
| 58 | activationRefCount(0), | - | ||||||||||||||||||||||||||||||
| 59 | childExplicitActivation(0), | - | ||||||||||||||||||||||||||||||
| 60 | lastMouseGrabberItem(0), | - | ||||||||||||||||||||||||||||||
| 61 | dragDropItem(0), | - | ||||||||||||||||||||||||||||||
| 62 | enterWidget(0), | - | ||||||||||||||||||||||||||||||
| 63 | lastDropAction(Qt::IgnoreAction), | - | ||||||||||||||||||||||||||||||
| 64 | style(0) | - | ||||||||||||||||||||||||||||||
| 65 | { | - | ||||||||||||||||||||||||||||||
| 66 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 67 | - | |||||||||||||||||||||||||||||||
| 68 | - | |||||||||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||||||||
| 71 | void QGraphicsScenePrivate::init() | - | ||||||||||||||||||||||||||||||
| 72 | { | - | ||||||||||||||||||||||||||||||
| 73 | QGraphicsScene * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 74 | - | |||||||||||||||||||||||||||||||
| 75 | index = new QGraphicsSceneBspTreeIndex(q); | - | ||||||||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||||||||
| 78 | changedSignalIndex = signalIndex("changed(QList<QRectF>)"); | - | ||||||||||||||||||||||||||||||
| 79 | processDirtyItemsIndex = q->metaObject()->indexOfSlot("_q_processDirtyItems()"); | - | ||||||||||||||||||||||||||||||
| 80 | polishItemsIndex = q->metaObject()->indexOfSlot("_q_polishItems()"); | - | ||||||||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||||||||
| 82 | (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->scene_list.append(q); | - | ||||||||||||||||||||||||||||||
| 83 | q->update(); | - | ||||||||||||||||||||||||||||||
| 84 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 85 | - | |||||||||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||||||||
| 87 | - | |||||||||||||||||||||||||||||||
| 88 | - | |||||||||||||||||||||||||||||||
| 89 | QGraphicsScenePrivate *QGraphicsScenePrivate::get(QGraphicsScene *q) | - | ||||||||||||||||||||||||||||||
| 90 | { | - | ||||||||||||||||||||||||||||||
| 91 | return never executed: q->d_func();return q->d_func();never executed: return q->d_func(); | 0 | ||||||||||||||||||||||||||||||
| 92 | } | - | ||||||||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||||||||
| 94 | void QGraphicsScenePrivate::_q_emitUpdated() | - | ||||||||||||||||||||||||||||||
| 95 | { | - | ||||||||||||||||||||||||||||||
| 96 | QGraphicsScene * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 97 | calledEmitUpdated = false; | - | ||||||||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||||||||
| 99 | if (dirtyGrowingItemsBoundingRect
| 0 | ||||||||||||||||||||||||||||||
| 100 | if (!hasSceneRect
| 0 | ||||||||||||||||||||||||||||||
| 101 | const QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect; | - | ||||||||||||||||||||||||||||||
| 102 | growingItemsBoundingRect |= q->itemsBoundingRect(); | - | ||||||||||||||||||||||||||||||
| 103 | if (oldGrowingItemsBoundingRect != growingItemsBoundingRect
| 0 | ||||||||||||||||||||||||||||||
| 104 | q->sceneRectChanged(growingItemsBoundingRect); never executed: q->sceneRectChanged(growingItemsBoundingRect); | 0 | ||||||||||||||||||||||||||||||
| 105 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 106 | dirtyGrowingItemsBoundingRect = false; | - | ||||||||||||||||||||||||||||||
| 107 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||||||||
| 110 | - | |||||||||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||||||||
| 113 | if (isSignalConnected(changedSignalIndex)
| 0 | ||||||||||||||||||||||||||||||
| 114 | for (int i = 0; i < views.size()
| 0 | ||||||||||||||||||||||||||||||
| 115 | QGraphicsView *view = views.at(i); | - | ||||||||||||||||||||||||||||||
| 116 | if (!view->d_func()->connectedToScene
| 0 | ||||||||||||||||||||||||||||||
| 117 | view->d_func()->connectedToScene = true; | - | ||||||||||||||||||||||||||||||
| 118 | q->connect(q, qFlagLocation("2""changed(QList<QRectF>)" "\0" __FILE__ ":" "363"), | - | ||||||||||||||||||||||||||||||
| 119 | views.at(i), qFlagLocation("1""updateScene(QList<QRectF>)" "\0" __FILE__ ":" "364")); | - | ||||||||||||||||||||||||||||||
| 120 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 121 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 122 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 123 | if (views.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 124 | updateAll = false; | - | ||||||||||||||||||||||||||||||
| 125 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 126 | } | - | ||||||||||||||||||||||||||||||
| 127 | for (int i = 0; i < views.size()
| 0 | ||||||||||||||||||||||||||||||
| 128 | views.at(i)->d_func()->processPendingUpdates(); never executed: views.at(i)->d_func()->processPendingUpdates(); | 0 | ||||||||||||||||||||||||||||||
| 129 | - | |||||||||||||||||||||||||||||||
| 130 | for (int i = 0; i < views.size()
| 0 | ||||||||||||||||||||||||||||||
| 131 | views.at(i)->d_func()->dispatchPendingUpdateRequests(); never executed: views.at(i)->d_func()->dispatchPendingUpdateRequests(); | 0 | ||||||||||||||||||||||||||||||
| 132 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 133 | } | - | ||||||||||||||||||||||||||||||
| 134 | - | |||||||||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||||||||
| 136 | QList<QRectF> oldUpdatedRects; | - | ||||||||||||||||||||||||||||||
| 137 | oldUpdatedRects = updateAll
| 0 | ||||||||||||||||||||||||||||||
| 138 | updateAll = false; | - | ||||||||||||||||||||||||||||||
| 139 | updatedRects.clear(); | - | ||||||||||||||||||||||||||||||
| 140 | q->changed(oldUpdatedRects); | - | ||||||||||||||||||||||||||||||
| 141 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||||||||
| 143 | - | |||||||||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||||||||
| 147 | - | |||||||||||||||||||||||||||||||
| 148 | void QGraphicsScenePrivate::registerTopLevelItem(QGraphicsItem *item) | - | ||||||||||||||||||||||||||||||
| 149 | { | - | ||||||||||||||||||||||||||||||
| 150 | ensureSequentialTopLevelSiblingIndexes(); | - | ||||||||||||||||||||||||||||||
| 151 | needSortTopLevelItems = true; | - | ||||||||||||||||||||||||||||||
| 152 | item->d_ptr->siblingIndex = topLevelItems.size(); | - | ||||||||||||||||||||||||||||||
| 153 | topLevelItems.append(item); | - | ||||||||||||||||||||||||||||||
| 154 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 155 | - | |||||||||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||||||||
| 158 | - | |||||||||||||||||||||||||||||||
| 159 | - | |||||||||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||||||||
| 161 | void QGraphicsScenePrivate::unregisterTopLevelItem(QGraphicsItem *item) | - | ||||||||||||||||||||||||||||||
| 162 | { | - | ||||||||||||||||||||||||||||||
| 163 | if (!holesInTopLevelSiblingIndex
| 0 | ||||||||||||||||||||||||||||||
| 164 | holesInTopLevelSiblingIndex = item->d_ptr->siblingIndex != topLevelItems.size() - 1; never executed: holesInTopLevelSiblingIndex = item->d_ptr->siblingIndex != topLevelItems.size() - 1; | 0 | ||||||||||||||||||||||||||||||
| 165 | if (topLevelSequentialOrdering
| 0 | ||||||||||||||||||||||||||||||
| 166 | topLevelItems.removeAt(item->d_ptr->siblingIndex); never executed: topLevelItems.removeAt(item->d_ptr->siblingIndex); | 0 | ||||||||||||||||||||||||||||||
| 167 | else | - | ||||||||||||||||||||||||||||||
| 168 | topLevelItems.removeOne(item); never executed: topLevelItems.removeOne(item); | 0 | ||||||||||||||||||||||||||||||
| 169 | - | |||||||||||||||||||||||||||||||
| 170 | - | |||||||||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||||||||
| 172 | item->d_ptr->siblingIndex = -1; | - | ||||||||||||||||||||||||||||||
| 173 | if (topLevelSequentialOrdering
| 0 | ||||||||||||||||||||||||||||||
| 174 | topLevelSequentialOrdering = !holesInTopLevelSiblingIndex; never executed: topLevelSequentialOrdering = !holesInTopLevelSiblingIndex; | 0 | ||||||||||||||||||||||||||||||
| 175 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 176 | - | |||||||||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||||||||
| 178 | - | |||||||||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||||||||
| 180 | void QGraphicsScenePrivate::_q_polishItems() | - | ||||||||||||||||||||||||||||||
| 181 | { | - | ||||||||||||||||||||||||||||||
| 182 | if (unpolishedItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 183 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||||||||
| 185 | const QVariant booleanTrueVariant(true); | - | ||||||||||||||||||||||||||||||
| 186 | QGraphicsItem *item = 0; | - | ||||||||||||||||||||||||||||||
| 187 | QGraphicsItemPrivate *itemd = 0; | - | ||||||||||||||||||||||||||||||
| 188 | const int oldUnpolishedCount = unpolishedItems.count(); | - | ||||||||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||||||||
| 190 | for (int i = 0; i < oldUnpolishedCount
| 0 | ||||||||||||||||||||||||||||||
| 191 | item = unpolishedItems.at(i); | - | ||||||||||||||||||||||||||||||
| 192 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 193 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 194 | itemd = item->d_ptr.data(); | - | ||||||||||||||||||||||||||||||
| 195 | itemd->pendingPolish = false; | - | ||||||||||||||||||||||||||||||
| 196 | if (!itemd->explicitlyHidden
| 0 | ||||||||||||||||||||||||||||||
| 197 | item->itemChange(QGraphicsItem::ItemVisibleChange, booleanTrueVariant); | - | ||||||||||||||||||||||||||||||
| 198 | item->itemChange(QGraphicsItem::ItemVisibleHasChanged, booleanTrueVariant); | - | ||||||||||||||||||||||||||||||
| 199 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 200 | if (itemd->isWidget
| 0 | ||||||||||||||||||||||||||||||
| 201 | QEvent event(QEvent::Polish); | - | ||||||||||||||||||||||||||||||
| 202 | QApplication::sendEvent((QGraphicsWidget *)item, &event); | - | ||||||||||||||||||||||||||||||
| 203 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 204 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 205 | - | |||||||||||||||||||||||||||||||
| 206 | if (unpolishedItems.count() == oldUnpolishedCount
| 0 | ||||||||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||||||||
| 208 | unpolishedItems.clear(); | - | ||||||||||||||||||||||||||||||
| 209 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 210 | - | |||||||||||||||||||||||||||||||
| 211 | unpolishedItems.remove(0, oldUnpolishedCount); | - | ||||||||||||||||||||||||||||||
| 212 | unpolishedItems.squeeze(); | - | ||||||||||||||||||||||||||||||
| 213 | QMetaObject::invokeMethod(q_ptr, "_q_polishItems", Qt::QueuedConnection); | - | ||||||||||||||||||||||||||||||
| 214 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 215 | } | - | ||||||||||||||||||||||||||||||
| 216 | - | |||||||||||||||||||||||||||||||
| 217 | void QGraphicsScenePrivate::_q_processDirtyItems() | - | ||||||||||||||||||||||||||||||
| 218 | { | - | ||||||||||||||||||||||||||||||
| 219 | processDirtyItemsEmitted = false; | - | ||||||||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||||||||
| 221 | if (updateAll
| 0 | ||||||||||||||||||||||||||||||
| 222 | ((!(calledEmitUpdated)) ? qt_assert("calledEmitUpdated",__FILE__,467) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||||||||
| 225 | for (int i = 0; i < topLevelItems.size()
| 0 | ||||||||||||||||||||||||||||||
| 226 | resetDirtyItem(topLevelItems.at(i), true); never executed: resetDirtyItem(topLevelItems.at(i), true); | 0 | ||||||||||||||||||||||||||||||
| 227 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 228 | } | - | ||||||||||||||||||||||||||||||
| 229 | - | |||||||||||||||||||||||||||||||
| 230 | const bool wasPendingSceneUpdate = calledEmitUpdated; | - | ||||||||||||||||||||||||||||||
| 231 | const QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect; | - | ||||||||||||||||||||||||||||||
| 232 | - | |||||||||||||||||||||||||||||||
| 233 | - | |||||||||||||||||||||||||||||||
| 234 | for (int i = 0; i < topLevelItems.size()
| 0 | ||||||||||||||||||||||||||||||
| 235 | processDirtyItemsRecursive(topLevelItems.at(i)); never executed: processDirtyItemsRecursive(topLevelItems.at(i)); | 0 | ||||||||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||||||||
| 237 | dirtyGrowingItemsBoundingRect = false; | - | ||||||||||||||||||||||||||||||
| 238 | if (!hasSceneRect
| 0 | ||||||||||||||||||||||||||||||
| 239 | q_func()->sceneRectChanged(growingItemsBoundingRect); never executed: q_func()->sceneRectChanged(growingItemsBoundingRect); | 0 | ||||||||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||||||||
| 241 | if (wasPendingSceneUpdate
| 0 | ||||||||||||||||||||||||||||||
| 242 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||||||||
| 244 | for (int i = 0; i < views.size()
| 0 | ||||||||||||||||||||||||||||||
| 245 | views.at(i)->d_func()->processPendingUpdates(); never executed: views.at(i)->d_func()->processPendingUpdates(); | 0 | ||||||||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||||||||
| 247 | if (calledEmitUpdated
| 0 | ||||||||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||||||||
| 249 | - | |||||||||||||||||||||||||||||||
| 250 | - | |||||||||||||||||||||||||||||||
| 251 | _q_emitUpdated(); | - | ||||||||||||||||||||||||||||||
| 252 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 253 | - | |||||||||||||||||||||||||||||||
| 254 | - | |||||||||||||||||||||||||||||||
| 255 | for (int i = 0; i < views.size()
| 0 | ||||||||||||||||||||||||||||||
| 256 | views.at(i)->d_func()->dispatchPendingUpdateRequests(); never executed: views.at(i)->d_func()->dispatchPendingUpdateRequests(); | 0 | ||||||||||||||||||||||||||||||
| 257 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 258 | - | |||||||||||||||||||||||||||||||
| 259 | - | |||||||||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||||||||
| 262 | void QGraphicsScenePrivate::setScenePosItemEnabled(QGraphicsItem *item, bool enabled) | - | ||||||||||||||||||||||||||||||
| 263 | { | - | ||||||||||||||||||||||||||||||
| 264 | QGraphicsItem *p = item->d_ptr->parent; | - | ||||||||||||||||||||||||||||||
| 265 | while (p
| 0 | ||||||||||||||||||||||||||||||
| 266 | p->d_ptr->scenePosDescendants = enabled; | - | ||||||||||||||||||||||||||||||
| 267 | p = p->d_ptr->parent; | - | ||||||||||||||||||||||||||||||
| 268 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 269 | if (!enabled
| 0 | ||||||||||||||||||||||||||||||
| 270 | scenePosDescendantsUpdatePending = true; | - | ||||||||||||||||||||||||||||||
| 271 | QMetaObject::invokeMethod(q_func(), "_q_updateScenePosDescendants", Qt::QueuedConnection); | - | ||||||||||||||||||||||||||||||
| 272 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 273 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 274 | - | |||||||||||||||||||||||||||||||
| 275 | - | |||||||||||||||||||||||||||||||
| 276 | - | |||||||||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||||||||
| 278 | void QGraphicsScenePrivate::registerScenePosItem(QGraphicsItem *item) | - | ||||||||||||||||||||||||||||||
| 279 | { | - | ||||||||||||||||||||||||||||||
| 280 | scenePosItems.insert(item); | - | ||||||||||||||||||||||||||||||
| 281 | setScenePosItemEnabled(item, true); | - | ||||||||||||||||||||||||||||||
| 282 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 283 | - | |||||||||||||||||||||||||||||||
| 284 | - | |||||||||||||||||||||||||||||||
| 285 | - | |||||||||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||||||||
| 287 | void QGraphicsScenePrivate::unregisterScenePosItem(QGraphicsItem *item) | - | ||||||||||||||||||||||||||||||
| 288 | { | - | ||||||||||||||||||||||||||||||
| 289 | scenePosItems.remove(item); | - | ||||||||||||||||||||||||||||||
| 290 | setScenePosItemEnabled(item, false); | - | ||||||||||||||||||||||||||||||
| 291 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||||||||
| 295 | - | |||||||||||||||||||||||||||||||
| 296 | void QGraphicsScenePrivate::_q_updateScenePosDescendants() | - | ||||||||||||||||||||||||||||||
| 297 | { | - | ||||||||||||||||||||||||||||||
| 298 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(scenePosItems)>::type> _container_((scenePosItems)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 299 | QGraphicsItem *p = item->d_ptr->parent; | - | ||||||||||||||||||||||||||||||
| 300 | while (p
| 0 | ||||||||||||||||||||||||||||||
| 301 | p->d_ptr->scenePosDescendants = 1; | - | ||||||||||||||||||||||||||||||
| 302 | p = p->d_ptr->parent; | - | ||||||||||||||||||||||||||||||
| 303 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 304 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 305 | scenePosDescendantsUpdatePending = false; | - | ||||||||||||||||||||||||||||||
| 306 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 307 | void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) | - | ||||||||||||||||||||||||||||||
| 308 | { | - | ||||||||||||||||||||||||||||||
| 309 | QGraphicsScene * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 310 | - | |||||||||||||||||||||||||||||||
| 311 | - | |||||||||||||||||||||||||||||||
| 312 | item->clearFocus(); | - | ||||||||||||||||||||||||||||||
| 313 | - | |||||||||||||||||||||||||||||||
| 314 | markDirty(item, QRectF(), false, false, | - | ||||||||||||||||||||||||||||||
| 315 | false, true); | - | ||||||||||||||||||||||||||||||
| 316 | - | |||||||||||||||||||||||||||||||
| 317 | if (item->d_ptr->inDestructor
| 0 | ||||||||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||||||||
| 319 | index->deleteItem(item); | - | ||||||||||||||||||||||||||||||
| 320 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 321 | - | |||||||||||||||||||||||||||||||
| 322 | - | |||||||||||||||||||||||||||||||
| 323 | index->removeItem(item); | - | ||||||||||||||||||||||||||||||
| 324 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 325 | - | |||||||||||||||||||||||||||||||
| 326 | item->d_ptr->clearSubFocus(); | - | ||||||||||||||||||||||||||||||
| 327 | - | |||||||||||||||||||||||||||||||
| 328 | if (item->flags() & QGraphicsItem::ItemSendsScenePositionChanges
| 0 | ||||||||||||||||||||||||||||||
| 329 | unregisterScenePosItem(item); never executed: unregisterScenePosItem(item); | 0 | ||||||||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||||||||
| 331 | QGraphicsScene *oldScene = item->d_func()->scene; | - | ||||||||||||||||||||||||||||||
| 332 | item->d_func()->scene = 0; | - | ||||||||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||||||||
| 336 | if (!item->d_ptr->inDestructor
| 0 | ||||||||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||||||||
| 338 | for (int i = 0; i < item->d_ptr->children.size()
| 0 | ||||||||||||||||||||||||||||||
| 339 | q->removeItem(item->d_ptr->children.at(i)); never executed: q->removeItem(item->d_ptr->children.at(i)); | 0 | ||||||||||||||||||||||||||||||
| 340 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 341 | - | |||||||||||||||||||||||||||||||
| 342 | if (!item->d_ptr->inDestructor
| 0 | ||||||||||||||||||||||||||||||
| 343 | QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); | - | ||||||||||||||||||||||||||||||
| 344 | widget->d_func()->fixFocusChainBeforeReparenting(0, oldScene, 0); | - | ||||||||||||||||||||||||||||||
| 345 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||||||||
| 348 | item->d_ptr->resetFocusProxy(); | - | ||||||||||||||||||||||||||||||
| 349 | - | |||||||||||||||||||||||||||||||
| 350 | - | |||||||||||||||||||||||||||||||
| 351 | if (QGraphicsItem *parentItem = item->parentItem()
| 0 | ||||||||||||||||||||||||||||||
| 352 | if (parentItem->scene()
| 0 | ||||||||||||||||||||||||||||||
| 353 | ((!(parentItem->scene() == q)) ? qt_assert_x("QGraphicsScene::removeItem", "Parent item's scene is different from this item's scene", | - | ||||||||||||||||||||||||||||||
| 354 | __FILE__ | - | ||||||||||||||||||||||||||||||
| 355 | , | - | ||||||||||||||||||||||||||||||
| 356 | 612 | - | ||||||||||||||||||||||||||||||
| 357 | ) : qt_noop()) | - | ||||||||||||||||||||||||||||||
| 358 | ; | - | ||||||||||||||||||||||||||||||
| 359 | item->setParentItem(0); | - | ||||||||||||||||||||||||||||||
| 360 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 361 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 362 | unregisterTopLevelItem(item); | - | ||||||||||||||||||||||||||||||
| 363 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||||||||
| 366 | if (item == focusItem
| 0 | ||||||||||||||||||||||||||||||
| 367 | focusItem = 0; never executed: focusItem = 0; | 0 | ||||||||||||||||||||||||||||||
| 368 | if (item == lastFocusItem
| 0 | ||||||||||||||||||||||||||||||
| 369 | lastFocusItem = 0; never executed: lastFocusItem = 0; | 0 | ||||||||||||||||||||||||||||||
| 370 | if (item == passiveFocusItem
| 0 | ||||||||||||||||||||||||||||||
| 371 | passiveFocusItem = 0; never executed: passiveFocusItem = 0; | 0 | ||||||||||||||||||||||||||||||
| 372 | if (item == activePanel
| 0 | ||||||||||||||||||||||||||||||
| 373 | - | |||||||||||||||||||||||||||||||
| 374 | activePanel = 0; | - | ||||||||||||||||||||||||||||||
| 375 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 376 | if (item == lastActivePanel
| 0 | ||||||||||||||||||||||||||||||
| 377 | lastActivePanel = 0; never executed: lastActivePanel = 0; | 0 | ||||||||||||||||||||||||||||||
| 378 | - | |||||||||||||||||||||||||||||||
| 379 | - | |||||||||||||||||||||||||||||||
| 380 | if (item == tabFocusFirst
| 0 | ||||||||||||||||||||||||||||||
| 381 | QGraphicsWidgetPrivate *wd = tabFocusFirst->d_func(); | - | ||||||||||||||||||||||||||||||
| 382 | if (wd->focusNext
| 0 | ||||||||||||||||||||||||||||||
| 383 | tabFocusFirst = wd->focusNext; never executed: tabFocusFirst = wd->focusNext; | 0 | ||||||||||||||||||||||||||||||
| 384 | else | - | ||||||||||||||||||||||||||||||
| 385 | tabFocusFirst = 0; never executed: tabFocusFirst = 0; | 0 | ||||||||||||||||||||||||||||||
| 386 | } | - | ||||||||||||||||||||||||||||||
| 387 | - | |||||||||||||||||||||||||||||||
| 388 | - | |||||||||||||||||||||||||||||||
| 389 | { | - | ||||||||||||||||||||||||||||||
| 390 | QMap<int, QGraphicsItem *>::iterator it = itemForTouchPointId.begin(); | - | ||||||||||||||||||||||||||||||
| 391 | while (it != itemForTouchPointId.end()
| 0 | ||||||||||||||||||||||||||||||
| 392 | if (it.value() == item
| 0 | ||||||||||||||||||||||||||||||
| 393 | sceneCurrentTouchPoints.remove(it.key()); | - | ||||||||||||||||||||||||||||||
| 394 | it = itemForTouchPointId.erase(it); | - | ||||||||||||||||||||||||||||||
| 395 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 396 | ++it; | - | ||||||||||||||||||||||||||||||
| 397 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 398 | } | - | ||||||||||||||||||||||||||||||
| 399 | } | - | ||||||||||||||||||||||||||||||
| 400 | - | |||||||||||||||||||||||||||||||
| 401 | - | |||||||||||||||||||||||||||||||
| 402 | ++selectionChanging; | - | ||||||||||||||||||||||||||||||
| 403 | int oldSelectedItemsSize = selectedItems.size(); | - | ||||||||||||||||||||||||||||||
| 404 | - | |||||||||||||||||||||||||||||||
| 405 | - | |||||||||||||||||||||||||||||||
| 406 | selectedItems.remove(item); | - | ||||||||||||||||||||||||||||||
| 407 | hoverItems.removeAll(item); | - | ||||||||||||||||||||||||||||||
| 408 | cachedItemsUnderMouse.removeAll(item); | - | ||||||||||||||||||||||||||||||
| 409 | if (item->d_ptr->pendingPolish
| 0 | ||||||||||||||||||||||||||||||
| 410 | const int unpolishedIndex = unpolishedItems.indexOf(item); | - | ||||||||||||||||||||||||||||||
| 411 | if (unpolishedIndex != -1
| 0 | ||||||||||||||||||||||||||||||
| 412 | unpolishedItems[unpolishedIndex] = 0; never executed: unpolishedItems[unpolishedIndex] = 0; | 0 | ||||||||||||||||||||||||||||||
| 413 | item->d_ptr->pendingPolish = false; | - | ||||||||||||||||||||||||||||||
| 414 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 415 | resetDirtyItem(item); | - | ||||||||||||||||||||||||||||||
| 416 | - | |||||||||||||||||||||||||||||||
| 417 | - | |||||||||||||||||||||||||||||||
| 418 | QMultiMap<QGraphicsItem*, QGraphicsItem*>::iterator iterator = sceneEventFilters.begin(); | - | ||||||||||||||||||||||||||||||
| 419 | while (iterator != sceneEventFilters.end()
| 0 | ||||||||||||||||||||||||||||||
| 420 | if (iterator.value() == item
| 0 | ||||||||||||||||||||||||||||||
| 421 | iterator = sceneEventFilters.erase(iterator); never executed: iterator = sceneEventFilters.erase(iterator); | 0 | ||||||||||||||||||||||||||||||
| 422 | else | - | ||||||||||||||||||||||||||||||
| 423 | ++ never executed: iterator;++iterator;never executed: ++iterator; | 0 | ||||||||||||||||||||||||||||||
| 424 | } | - | ||||||||||||||||||||||||||||||
| 425 | - | |||||||||||||||||||||||||||||||
| 426 | if (item->isPanel()
| 0 | ||||||||||||||||||||||||||||||
| 427 | leaveModal(item); never executed: leaveModal(item); | 0 | ||||||||||||||||||||||||||||||
| 428 | - | |||||||||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||||||||
| 430 | if (mouseGrabberItems.contains(item)
| 0 | ||||||||||||||||||||||||||||||
| 431 | ungrabMouse(item, item->d_ptr->inDestructor); never executed: ungrabMouse(item, item->d_ptr->inDestructor); | 0 | ||||||||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||||||||
| 434 | if (keyboardGrabberItems.contains(item)
| 0 | ||||||||||||||||||||||||||||||
| 435 | ungrabKeyboard(item, item->d_ptr->inDestructor); never executed: ungrabKeyboard(item, item->d_ptr->inDestructor); | 0 | ||||||||||||||||||||||||||||||
| 436 | - | |||||||||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||||||||
| 438 | if (item == lastMouseGrabberItem
| 0 | ||||||||||||||||||||||||||||||
| 439 | lastMouseGrabberItem = 0; never executed: lastMouseGrabberItem = 0; | 0 | ||||||||||||||||||||||||||||||
| 440 | - | |||||||||||||||||||||||||||||||
| 441 | - | |||||||||||||||||||||||||||||||
| 442 | if (item == dragDropItem
| 0 | ||||||||||||||||||||||||||||||
| 443 | dragDropItem = 0; never executed: dragDropItem = 0; | 0 | ||||||||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||||||||
| 446 | --selectionChanging; | - | ||||||||||||||||||||||||||||||
| 447 | if (!selectionChanging
| 0 | ||||||||||||||||||||||||||||||
| 448 | q->selectionChanged(); never executed: q->selectionChanged(); | 0 | ||||||||||||||||||||||||||||||
| 449 | - | |||||||||||||||||||||||||||||||
| 450 | - | |||||||||||||||||||||||||||||||
| 451 | QHash<QGesture *, QGraphicsObject *>::iterator it; | - | ||||||||||||||||||||||||||||||
| 452 | for (it = gestureTargets.begin(); it != gestureTargets.end()
| 0 | ||||||||||||||||||||||||||||||
| 453 | if (it.value() == item
| 0 | ||||||||||||||||||||||||||||||
| 454 | it = gestureTargets.erase(it); never executed: it = gestureTargets.erase(it); | 0 | ||||||||||||||||||||||||||||||
| 455 | else | - | ||||||||||||||||||||||||||||||
| 456 | ++ never executed: it;++it;never executed: ++it; | 0 | ||||||||||||||||||||||||||||||
| 457 | } | - | ||||||||||||||||||||||||||||||
| 458 | - | |||||||||||||||||||||||||||||||
| 459 | if (QGraphicsObject *dummy = item->toGraphicsObject()
| 0 | ||||||||||||||||||||||||||||||
| 460 | cachedTargetItems.removeOne(dummy); | - | ||||||||||||||||||||||||||||||
| 461 | cachedItemGestures.remove(dummy); | - | ||||||||||||||||||||||||||||||
| 462 | cachedAlreadyDeliveredGestures.remove(dummy); | - | ||||||||||||||||||||||||||||||
| 463 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 464 | - | |||||||||||||||||||||||||||||||
| 465 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(item->d_ptr->gestureContext.keys())>::type> _container_((item->d_ptr->gestureContext.keys())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (Qt::GestureType gesture = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 466 | ungrabGesture(item, gesture); never executed: ungrabGesture(item, gesture); | 0 | ||||||||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||||||||
| 468 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 469 | - | |||||||||||||||||||||||||||||||
| 470 | - | |||||||||||||||||||||||||||||||
| 471 | - | |||||||||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||||||||
| 473 | void QGraphicsScenePrivate::setActivePanelHelper(QGraphicsItem *item, bool duringActivationEvent) | - | ||||||||||||||||||||||||||||||
| 474 | { | - | ||||||||||||||||||||||||||||||
| 475 | QGraphicsScene * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 476 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 477 | QMessageLogger(__FILE__, 731, __PRETTY_FUNCTION__).warning("QGraphicsScene::setActivePanel: item %p must be part of this scene", | - | ||||||||||||||||||||||||||||||
| 478 | item); | - | ||||||||||||||||||||||||||||||
| 479 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 480 | } | - | ||||||||||||||||||||||||||||||
| 481 | - | |||||||||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||||||||
| 483 | q->setFocus(Qt::ActiveWindowFocusReason); | - | ||||||||||||||||||||||||||||||
| 484 | - | |||||||||||||||||||||||||||||||
| 485 | - | |||||||||||||||||||||||||||||||
| 486 | QGraphicsItem *panel = item
| 0 | ||||||||||||||||||||||||||||||
| 487 | lastActivePanel = panel
| 0 | ||||||||||||||||||||||||||||||
| 488 | if (panel == activePanel
| 0 | ||||||||||||||||||||||||||||||
| 489 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 490 | - | |||||||||||||||||||||||||||||||
| 491 | QGraphicsItem *oldFocusItem = focusItem; | - | ||||||||||||||||||||||||||||||
| 492 | - | |||||||||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||||||||
| 494 | if (activePanel
| 0 | ||||||||||||||||||||||||||||||
| 495 | if (QGraphicsItem *fi = activePanel->focusItem()
| 0 | ||||||||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||||||||
| 497 | if (fi == q->focusItem()
| 0 | ||||||||||||||||||||||||||||||
| 498 | setFocusItemHelper(0, Qt::ActiveWindowFocusReason, false); never executed: setFocusItemHelper(0, Qt::ActiveWindowFocusReason, false); | 0 | ||||||||||||||||||||||||||||||
| 499 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 500 | - | |||||||||||||||||||||||||||||||
| 501 | QEvent event(QEvent::WindowDeactivate); | - | ||||||||||||||||||||||||||||||
| 502 | q->sendEvent(activePanel, &event); | - | ||||||||||||||||||||||||||||||
| 503 | } never executed: else if (panelend of block
| 0 | ||||||||||||||||||||||||||||||
| 504 | - | |||||||||||||||||||||||||||||||
| 505 | QEvent event(QEvent::WindowDeactivate); | - | ||||||||||||||||||||||||||||||
| 506 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(q->items())>::type> _container_((q->items())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 507 | if (item->isVisible()
| 0 | ||||||||||||||||||||||||||||||
| 508 | q->sendEvent(item, &event); never executed: q->sendEvent(item, &event); | 0 | ||||||||||||||||||||||||||||||
| 509 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 510 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 511 | - | |||||||||||||||||||||||||||||||
| 512 | - | |||||||||||||||||||||||||||||||
| 513 | activePanel = panel; | - | ||||||||||||||||||||||||||||||
| 514 | QEvent event(QEvent::ActivationChange); | - | ||||||||||||||||||||||||||||||
| 515 | QApplication::sendEvent(q, &event); | - | ||||||||||||||||||||||||||||||
| 516 | - | |||||||||||||||||||||||||||||||
| 517 | - | |||||||||||||||||||||||||||||||
| 518 | if (panel
| 0 | ||||||||||||||||||||||||||||||
| 519 | QEvent event(QEvent::WindowActivate); | - | ||||||||||||||||||||||||||||||
| 520 | q->sendEvent(panel, &event); | - | ||||||||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||||||||
| 522 | - | |||||||||||||||||||||||||||||||
| 523 | - | |||||||||||||||||||||||||||||||
| 524 | - | |||||||||||||||||||||||||||||||
| 525 | if (QGraphicsItem *focusItem = panel->focusItem()
| 0 | ||||||||||||||||||||||||||||||
| 526 | setFocusItemHelper(focusItem, Qt::ActiveWindowFocusReason, false); | - | ||||||||||||||||||||||||||||||
| 527 | } never executed: else if (panel->flags() & QGraphicsItem::ItemIsFocusableend of block
| 0 | ||||||||||||||||||||||||||||||
| 528 | setFocusItemHelper(panel, Qt::ActiveWindowFocusReason, false); | - | ||||||||||||||||||||||||||||||
| 529 | } never executed: else if (panel->isWidget()end of block
| 0 | ||||||||||||||||||||||||||||||
| 530 | QGraphicsWidget *fw = static_cast<QGraphicsWidget *>(panel)->d_func()->focusNext; | - | ||||||||||||||||||||||||||||||
| 531 | do { | - | ||||||||||||||||||||||||||||||
| 532 | if (fw->focusPolicy() & Qt::TabFocus
| 0 | ||||||||||||||||||||||||||||||
| 533 | setFocusItemHelper(fw, Qt::ActiveWindowFocusReason, false); | - | ||||||||||||||||||||||||||||||
| 534 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 535 | } | - | ||||||||||||||||||||||||||||||
| 536 | fw = fw->d_func()->focusNext; | - | ||||||||||||||||||||||||||||||
| 537 | } never executed: while (fw != panelend of block
| 0 | ||||||||||||||||||||||||||||||
| 538 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 539 | } never executed: else if (q->isActive()end of block
| 0 | ||||||||||||||||||||||||||||||
| 540 | - | |||||||||||||||||||||||||||||||
| 541 | QEvent event(QEvent::WindowActivate); | - | ||||||||||||||||||||||||||||||
| 542 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(q->items())>::type> _container_((q->items())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 543 | if (item->isVisible()
| 0 | ||||||||||||||||||||||||||||||
| 544 | q->sendEvent(item, &event); never executed: q->sendEvent(item, &event); | 0 | ||||||||||||||||||||||||||||||
| 545 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 546 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 547 | - | |||||||||||||||||||||||||||||||
| 548 | q->focusItemChanged(focusItem, oldFocusItem, Qt::ActiveWindowFocusReason); | - | ||||||||||||||||||||||||||||||
| 549 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 550 | void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, | - | ||||||||||||||||||||||||||||||
| 551 | Qt::FocusReason focusReason, | - | ||||||||||||||||||||||||||||||
| 552 | bool emitFocusChanged) | - | ||||||||||||||||||||||||||||||
| 553 | { | - | ||||||||||||||||||||||||||||||
| 554 | QGraphicsScene * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 555 | if (item == focusItem
| 0 | ||||||||||||||||||||||||||||||
| 556 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||||||||
| 558 | - | |||||||||||||||||||||||||||||||
| 559 | - | |||||||||||||||||||||||||||||||
| 560 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 561 | || !item->isVisible()
| 0 | ||||||||||||||||||||||||||||||
| 562 | item = 0; | - | ||||||||||||||||||||||||||||||
| 563 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 564 | - | |||||||||||||||||||||||||||||||
| 565 | - | |||||||||||||||||||||||||||||||
| 566 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 567 | q->setFocus(focusReason); | - | ||||||||||||||||||||||||||||||
| 568 | if (item == focusItem
| 0 | ||||||||||||||||||||||||||||||
| 569 | if (emitFocusChanged
| 0 | ||||||||||||||||||||||||||||||
| 570 | q->focusItemChanged(focusItem, (QGraphicsItem *)0, focusReason); never executed: q->focusItemChanged(focusItem, (QGraphicsItem *)0, focusReason); | 0 | ||||||||||||||||||||||||||||||
| 571 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 572 | } | - | ||||||||||||||||||||||||||||||
| 573 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||||||||
| 575 | QGraphicsItem *oldFocusItem = focusItem; | - | ||||||||||||||||||||||||||||||
| 576 | if (focusItem
| 0 | ||||||||||||||||||||||||||||||
| 577 | lastFocusItem = focusItem; | - | ||||||||||||||||||||||||||||||
| 578 | - | |||||||||||||||||||||||||||||||
| 579 | - | |||||||||||||||||||||||||||||||
| 580 | if (lastFocusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod
| 0 | ||||||||||||||||||||||||||||||
| 581 | - | |||||||||||||||||||||||||||||||
| 582 | - | |||||||||||||||||||||||||||||||
| 583 | - | |||||||||||||||||||||||||||||||
| 584 | - | |||||||||||||||||||||||||||||||
| 585 | if ((static_cast<
| 0 | ||||||||||||||||||||||||||||||
| 586 | QGuiApplication::inputMethod()->commit(); never executed: QGuiApplication::inputMethod()->commit(); | 0 | ||||||||||||||||||||||||||||||
| 587 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 588 | - | |||||||||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||||||||
| 590 | focusItem = 0; | - | ||||||||||||||||||||||||||||||
| 591 | QFocusEvent event(QEvent::FocusOut, focusReason); | - | ||||||||||||||||||||||||||||||
| 592 | sendEvent(lastFocusItem, &event); | - | ||||||||||||||||||||||||||||||
| 593 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 594 | - | |||||||||||||||||||||||||||||||
| 595 | - | |||||||||||||||||||||||||||||||
| 596 | - | |||||||||||||||||||||||||||||||
| 597 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 598 | item = 0; never executed: item = 0; | 0 | ||||||||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||||||||
| 600 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 601 | focusItem = item; never executed: focusItem = item; | 0 | ||||||||||||||||||||||||||||||
| 602 | updateInputMethodSensitivityInViews(); | - | ||||||||||||||||||||||||||||||
| 603 | - | |||||||||||||||||||||||||||||||
| 604 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 605 | QFocusEvent event(QEvent::FocusIn, focusReason); | - | ||||||||||||||||||||||||||||||
| 606 | sendEvent(item, &event); | - | ||||||||||||||||||||||||||||||
| 607 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 608 | - | |||||||||||||||||||||||||||||||
| 609 | if (emitFocusChanged
| 0 | ||||||||||||||||||||||||||||||
| 610 | q->focusItemChanged(focusItem, oldFocusItem, focusReason); never executed: q->focusItemChanged(focusItem, oldFocusItem, focusReason); | 0 | ||||||||||||||||||||||||||||||
| 611 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 612 | - | |||||||||||||||||||||||||||||||
| 613 | - | |||||||||||||||||||||||||||||||
| 614 | - | |||||||||||||||||||||||||||||||
| 615 | - | |||||||||||||||||||||||||||||||
| 616 | void QGraphicsScenePrivate::addPopup(QGraphicsWidget *widget) | - | ||||||||||||||||||||||||||||||
| 617 | { | - | ||||||||||||||||||||||||||||||
| 618 | ((!(widget)) ? qt_assert("widget",__FILE__,883) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 619 | ((!(!popupWidgets.contains(widget))) ? qt_assert("!popupWidgets.contains(widget)",__FILE__,884) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 620 | popupWidgets << widget; | - | ||||||||||||||||||||||||||||||
| 621 | if (QGraphicsWidget *focusWidget = widget->focusWidget()
| 0 | ||||||||||||||||||||||||||||||
| 622 | focusWidget->setFocus(Qt::PopupFocusReason); | - | ||||||||||||||||||||||||||||||
| 623 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 624 | grabKeyboard((QGraphicsItem *)widget); | - | ||||||||||||||||||||||||||||||
| 625 | if (focusItem
| 0 | ||||||||||||||||||||||||||||||
| 626 | QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); | - | ||||||||||||||||||||||||||||||
| 627 | sendEvent(focusItem, &event); | - | ||||||||||||||||||||||||||||||
| 628 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 629 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 630 | grabMouse((QGraphicsItem *)widget); | - | ||||||||||||||||||||||||||||||
| 631 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 632 | void QGraphicsScenePrivate::removePopup(QGraphicsWidget *widget, bool itemIsDying) | - | ||||||||||||||||||||||||||||||
| 633 | { | - | ||||||||||||||||||||||||||||||
| 634 | ((!(widget)) ? qt_assert("widget",__FILE__,909) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 635 | int index = popupWidgets.indexOf(widget); | - | ||||||||||||||||||||||||||||||
| 636 | ((!(index != -1)) ? qt_assert("index != -1",__FILE__,911) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 637 | - | |||||||||||||||||||||||||||||||
| 638 | for (int i = popupWidgets.size() - 1; i >= index
| 0 | ||||||||||||||||||||||||||||||
| 639 | QGraphicsWidget *widget = popupWidgets.takeLast(); | - | ||||||||||||||||||||||||||||||
| 640 | ungrabMouse(widget, itemIsDying); | - | ||||||||||||||||||||||||||||||
| 641 | if (focusItem
| 0 | ||||||||||||||||||||||||||||||
| 642 | QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason); | - | ||||||||||||||||||||||||||||||
| 643 | sendEvent(focusItem, &event); | - | ||||||||||||||||||||||||||||||
| 644 | } never executed: else if (keyboardGrabberItems.contains(static_cast<QGraphicsItem *>(widget))end of block
| 0 | ||||||||||||||||||||||||||||||
| 645 | ungrabKeyboard(static_cast<QGraphicsItem *>(widget), itemIsDying); | - | ||||||||||||||||||||||||||||||
| 646 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 647 | if (!itemIsDying
| 0 | ||||||||||||||||||||||||||||||
| 648 | widget->QGraphicsItem::d_ptr->setVisibleHelper(false, false); | - | ||||||||||||||||||||||||||||||
| 649 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 650 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 651 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 652 | - | |||||||||||||||||||||||||||||||
| 653 | - | |||||||||||||||||||||||||||||||
| 654 | - | |||||||||||||||||||||||||||||||
| 655 | - | |||||||||||||||||||||||||||||||
| 656 | void QGraphicsScenePrivate::grabMouse(QGraphicsItem *item, bool implicit) | - | ||||||||||||||||||||||||||||||
| 657 | { | - | ||||||||||||||||||||||||||||||
| 658 | - | |||||||||||||||||||||||||||||||
| 659 | if (mouseGrabberItems.contains(item)
| 0 | ||||||||||||||||||||||||||||||
| 660 | if (mouseGrabberItems.last() == item
| 0 | ||||||||||||||||||||||||||||||
| 661 | ((!(!implicit)) ? qt_assert("!implicit",__FILE__,936) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 662 | if (!lastMouseGrabberItemHasImplicitMouseGrab
| 0 | ||||||||||||||||||||||||||||||
| 663 | QMessageLogger(__FILE__, 938, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabMouse: already a mouse grabber"); | - | ||||||||||||||||||||||||||||||
| 664 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 665 | - | |||||||||||||||||||||||||||||||
| 666 | lastMouseGrabberItemHasImplicitMouseGrab = false; | - | ||||||||||||||||||||||||||||||
| 667 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 668 | } else { | - | ||||||||||||||||||||||||||||||
| 669 | QMessageLogger(__FILE__, 944, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabMouse: already blocked by mouse grabber: %p", | - | ||||||||||||||||||||||||||||||
| 670 | mouseGrabberItems.last()); | - | ||||||||||||||||||||||||||||||
| 671 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 672 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 673 | } | - | ||||||||||||||||||||||||||||||
| 674 | - | |||||||||||||||||||||||||||||||
| 675 | - | |||||||||||||||||||||||||||||||
| 676 | if (!mouseGrabberItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 677 | QGraphicsItem *last = mouseGrabberItems.last(); | - | ||||||||||||||||||||||||||||||
| 678 | if (lastMouseGrabberItemHasImplicitMouseGrab
| 0 | ||||||||||||||||||||||||||||||
| 679 | - | |||||||||||||||||||||||||||||||
| 680 | last->ungrabMouse(); | - | ||||||||||||||||||||||||||||||
| 681 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 682 | - | |||||||||||||||||||||||||||||||
| 683 | QEvent ungrabEvent(QEvent::UngrabMouse); | - | ||||||||||||||||||||||||||||||
| 684 | sendEvent(last, &ungrabEvent); | - | ||||||||||||||||||||||||||||||
| 685 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 686 | } | - | ||||||||||||||||||||||||||||||
| 687 | - | |||||||||||||||||||||||||||||||
| 688 | mouseGrabberItems << item; | - | ||||||||||||||||||||||||||||||
| 689 | lastMouseGrabberItemHasImplicitMouseGrab = implicit; | - | ||||||||||||||||||||||||||||||
| 690 | - | |||||||||||||||||||||||||||||||
| 691 | - | |||||||||||||||||||||||||||||||
| 692 | QEvent grabEvent(QEvent::GrabMouse); | - | ||||||||||||||||||||||||||||||
| 693 | sendEvent(item, &grabEvent); | - | ||||||||||||||||||||||||||||||
| 694 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 695 | - | |||||||||||||||||||||||||||||||
| 696 | - | |||||||||||||||||||||||||||||||
| 697 | - | |||||||||||||||||||||||||||||||
| 698 | - | |||||||||||||||||||||||||||||||
| 699 | void QGraphicsScenePrivate::ungrabMouse(QGraphicsItem *item, bool itemIsDying) | - | ||||||||||||||||||||||||||||||
| 700 | { | - | ||||||||||||||||||||||||||||||
| 701 | int index = mouseGrabberItems.indexOf(item); | - | ||||||||||||||||||||||||||||||
| 702 | if (index == -1
| 0 | ||||||||||||||||||||||||||||||
| 703 | QMessageLogger(__FILE__, 978, __PRETTY_FUNCTION__).warning("QGraphicsItem::ungrabMouse: not a mouse grabber"); | - | ||||||||||||||||||||||||||||||
| 704 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 705 | } | - | ||||||||||||||||||||||||||||||
| 706 | - | |||||||||||||||||||||||||||||||
| 707 | if (item != mouseGrabberItems.last()
| 0 | ||||||||||||||||||||||||||||||
| 708 | - | |||||||||||||||||||||||||||||||
| 709 | - | |||||||||||||||||||||||||||||||
| 710 | ungrabMouse(mouseGrabberItems.at(index + 1), itemIsDying); | - | ||||||||||||||||||||||||||||||
| 711 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 712 | if (!popupWidgets.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 713 | - | |||||||||||||||||||||||||||||||
| 714 | - | |||||||||||||||||||||||||||||||
| 715 | - | |||||||||||||||||||||||||||||||
| 716 | removePopup(popupWidgets.constLast(), itemIsDying); | - | ||||||||||||||||||||||||||||||
| 717 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 718 | } | - | ||||||||||||||||||||||||||||||
| 719 | - | |||||||||||||||||||||||||||||||
| 720 | - | |||||||||||||||||||||||||||||||
| 721 | if (!itemIsDying
| 0 | ||||||||||||||||||||||||||||||
| 722 | QEvent event(QEvent::UngrabMouse); | - | ||||||||||||||||||||||||||||||
| 723 | sendEvent(item, &event); | - | ||||||||||||||||||||||||||||||
| 724 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 725 | - | |||||||||||||||||||||||||||||||
| 726 | - | |||||||||||||||||||||||||||||||
| 727 | - | |||||||||||||||||||||||||||||||
| 728 | - | |||||||||||||||||||||||||||||||
| 729 | - | |||||||||||||||||||||||||||||||
| 730 | mouseGrabberItems.takeLast(); | - | ||||||||||||||||||||||||||||||
| 731 | lastMouseGrabberItemHasImplicitMouseGrab = false; | - | ||||||||||||||||||||||||||||||
| 732 | - | |||||||||||||||||||||||||||||||
| 733 | - | |||||||||||||||||||||||||||||||
| 734 | - | |||||||||||||||||||||||||||||||
| 735 | - | |||||||||||||||||||||||||||||||
| 736 | if (!itemIsDying
| 0 | ||||||||||||||||||||||||||||||
| 737 | QGraphicsItem *last = mouseGrabberItems.last(); | - | ||||||||||||||||||||||||||||||
| 738 | QEvent event(QEvent::GrabMouse); | - | ||||||||||||||||||||||||||||||
| 739 | sendEvent(last, &event); | - | ||||||||||||||||||||||||||||||
| 740 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 741 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 742 | - | |||||||||||||||||||||||||||||||
| 743 | - | |||||||||||||||||||||||||||||||
| 744 | - | |||||||||||||||||||||||||||||||
| 745 | - | |||||||||||||||||||||||||||||||
| 746 | void QGraphicsScenePrivate::clearMouseGrabber() | - | ||||||||||||||||||||||||||||||
| 747 | { | - | ||||||||||||||||||||||||||||||
| 748 | if (!mouseGrabberItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 749 | mouseGrabberItems.first()->ungrabMouse(); never executed: mouseGrabberItems.first()->ungrabMouse(); | 0 | ||||||||||||||||||||||||||||||
| 750 | lastMouseGrabberItem = 0; | - | ||||||||||||||||||||||||||||||
| 751 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 752 | - | |||||||||||||||||||||||||||||||
| 753 | - | |||||||||||||||||||||||||||||||
| 754 | - | |||||||||||||||||||||||||||||||
| 755 | - | |||||||||||||||||||||||||||||||
| 756 | void QGraphicsScenePrivate::grabKeyboard(QGraphicsItem *item) | - | ||||||||||||||||||||||||||||||
| 757 | { | - | ||||||||||||||||||||||||||||||
| 758 | if (keyboardGrabberItems.contains(item)
| 0 | ||||||||||||||||||||||||||||||
| 759 | if (keyboardGrabberItems.last() == item
| 0 | ||||||||||||||||||||||||||||||
| 760 | QMessageLogger(__FILE__, 1035, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabKeyboard: already a keyboard grabber"); never executed: QMessageLogger(__FILE__, 1035, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabKeyboard: already a keyboard grabber"); | 0 | ||||||||||||||||||||||||||||||
| 761 | else | - | ||||||||||||||||||||||||||||||
| 762 | QMessageLogger(__FILE__, 1037, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabKeyboard: already blocked by keyboard grabber: %p", never executed: QMessageLogger(__FILE__, 1037, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabKeyboard: already blocked by keyboard grabber: %p", keyboardGrabberItems.last()); | 0 | ||||||||||||||||||||||||||||||
| 763 | keyboardGrabberItems.last()); never executed: QMessageLogger(__FILE__, 1037, __PRETTY_FUNCTION__).warning("QGraphicsItem::grabKeyboard: already blocked by keyboard grabber: %p", keyboardGrabberItems.last()); | 0 | ||||||||||||||||||||||||||||||
| 764 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 765 | } | - | ||||||||||||||||||||||||||||||
| 766 | - | |||||||||||||||||||||||||||||||
| 767 | - | |||||||||||||||||||||||||||||||
| 768 | if (!keyboardGrabberItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 769 | - | |||||||||||||||||||||||||||||||
| 770 | QEvent ungrabEvent(QEvent::UngrabKeyboard); | - | ||||||||||||||||||||||||||||||
| 771 | sendEvent(keyboardGrabberItems.last(), &ungrabEvent); | - | ||||||||||||||||||||||||||||||
| 772 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 773 | - | |||||||||||||||||||||||||||||||
| 774 | keyboardGrabberItems << item; | - | ||||||||||||||||||||||||||||||
| 775 | - | |||||||||||||||||||||||||||||||
| 776 | - | |||||||||||||||||||||||||||||||
| 777 | QEvent grabEvent(QEvent::GrabKeyboard); | - | ||||||||||||||||||||||||||||||
| 778 | sendEvent(item, &grabEvent); | - | ||||||||||||||||||||||||||||||
| 779 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 780 | - | |||||||||||||||||||||||||||||||
| 781 | - | |||||||||||||||||||||||||||||||
| 782 | - | |||||||||||||||||||||||||||||||
| 783 | - | |||||||||||||||||||||||||||||||
| 784 | void QGraphicsScenePrivate::ungrabKeyboard(QGraphicsItem *item, bool itemIsDying) | - | ||||||||||||||||||||||||||||||
| 785 | { | - | ||||||||||||||||||||||||||||||
| 786 | int index = keyboardGrabberItems.lastIndexOf(item); | - | ||||||||||||||||||||||||||||||
| 787 | if (index == -1
| 0 | ||||||||||||||||||||||||||||||
| 788 | QMessageLogger(__FILE__, 1063, __PRETTY_FUNCTION__).warning("QGraphicsItem::ungrabKeyboard: not a keyboard grabber"); | - | ||||||||||||||||||||||||||||||
| 789 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 790 | } | - | ||||||||||||||||||||||||||||||
| 791 | if (item != keyboardGrabberItems.last()
| 0 | ||||||||||||||||||||||||||||||
| 792 | - | |||||||||||||||||||||||||||||||
| 793 | - | |||||||||||||||||||||||||||||||
| 794 | ungrabKeyboard(keyboardGrabberItems.at(index + 1), itemIsDying); | - | ||||||||||||||||||||||||||||||
| 795 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 796 | - | |||||||||||||||||||||||||||||||
| 797 | - | |||||||||||||||||||||||||||||||
| 798 | if (!itemIsDying
| 0 | ||||||||||||||||||||||||||||||
| 799 | QEvent event(QEvent::UngrabKeyboard); | - | ||||||||||||||||||||||||||||||
| 800 | sendEvent(item, &event); | - | ||||||||||||||||||||||||||||||
| 801 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 802 | - | |||||||||||||||||||||||||||||||
| 803 | - | |||||||||||||||||||||||||||||||
| 804 | keyboardGrabberItems.takeLast(); | - | ||||||||||||||||||||||||||||||
| 805 | - | |||||||||||||||||||||||||||||||
| 806 | - | |||||||||||||||||||||||||||||||
| 807 | if (!itemIsDying
| 0 | ||||||||||||||||||||||||||||||
| 808 | QGraphicsItem *last = keyboardGrabberItems.last(); | - | ||||||||||||||||||||||||||||||
| 809 | QEvent event(QEvent::GrabKeyboard); | - | ||||||||||||||||||||||||||||||
| 810 | sendEvent(last, &event); | - | ||||||||||||||||||||||||||||||
| 811 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 812 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 813 | - | |||||||||||||||||||||||||||||||
| 814 | - | |||||||||||||||||||||||||||||||
| 815 | - | |||||||||||||||||||||||||||||||
| 816 | - | |||||||||||||||||||||||||||||||
| 817 | void QGraphicsScenePrivate::clearKeyboardGrabber() | - | ||||||||||||||||||||||||||||||
| 818 | { | - | ||||||||||||||||||||||||||||||
| 819 | if (!keyboardGrabberItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 820 | ungrabKeyboard(keyboardGrabberItems.first()); never executed: ungrabKeyboard(keyboardGrabberItems.first()); | 0 | ||||||||||||||||||||||||||||||
| 821 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 822 | - | |||||||||||||||||||||||||||||||
| 823 | void QGraphicsScenePrivate::enableMouseTrackingOnViews() | - | ||||||||||||||||||||||||||||||
| 824 | { | - | ||||||||||||||||||||||||||||||
| 825 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(views)>::type> _container_((views)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsView *view = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 826 | view->viewport()->setMouseTracking(true); never executed: view->viewport()->setMouseTracking(true); | 0 | ||||||||||||||||||||||||||||||
| 827 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 828 | - | |||||||||||||||||||||||||||||||
| 829 | - | |||||||||||||||||||||||||||||||
| 830 | - | |||||||||||||||||||||||||||||||
| 831 | - | |||||||||||||||||||||||||||||||
| 832 | QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &screenPos, | - | ||||||||||||||||||||||||||||||
| 833 | const QPointF &scenePos, | - | ||||||||||||||||||||||||||||||
| 834 | QWidget *widget) const | - | ||||||||||||||||||||||||||||||
| 835 | { | - | ||||||||||||||||||||||||||||||
| 836 | const QGraphicsScene * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 837 | QGraphicsView *view = widget
| 0 | ||||||||||||||||||||||||||||||
| 838 | if (!view
| 0 | ||||||||||||||||||||||||||||||
| 839 | return never executed: q->items(scenePos, Qt::IntersectsItemShape, Qt::DescendingOrder, QTransform());return q->items(scenePos, Qt::IntersectsItemShape, Qt::DescendingOrder, QTransform());never executed: return q->items(scenePos, Qt::IntersectsItemShape, Qt::DescendingOrder, QTransform()); | 0 | ||||||||||||||||||||||||||||||
| 840 | - | |||||||||||||||||||||||||||||||
| 841 | const QRectF pointRect(QPointF(widget->mapFromGlobal(screenPos)), QSizeF(1, 1)); | - | ||||||||||||||||||||||||||||||
| 842 | if (!view->isTransformed()
| 0 | ||||||||||||||||||||||||||||||
| 843 | return never executed: q->items(pointRect, Qt::IntersectsItemShape, Qt::DescendingOrder);return q->items(pointRect, Qt::IntersectsItemShape, Qt::DescendingOrder);never executed: return q->items(pointRect, Qt::IntersectsItemShape, Qt::DescendingOrder); | 0 | ||||||||||||||||||||||||||||||
| 844 | - | |||||||||||||||||||||||||||||||
| 845 | const QTransform viewTransform = view->viewportTransform(); | - | ||||||||||||||||||||||||||||||
| 846 | if (viewTransform.type() <= QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 847 | return never executed: q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape,return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape, Qt::DescendingOrder, viewTransform);never executed: return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape, Qt::DescendingOrder, viewTransform); | 0 | ||||||||||||||||||||||||||||||
| 848 | Qt::DescendingOrder, viewTransform); never executed: return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape, Qt::DescendingOrder, viewTransform); | 0 | ||||||||||||||||||||||||||||||
| 849 | } | - | ||||||||||||||||||||||||||||||
| 850 | return never executed: q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape,return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape, Qt::DescendingOrder, viewTransform);never executed: return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape, Qt::DescendingOrder, viewTransform); | 0 | ||||||||||||||||||||||||||||||
| 851 | Qt::DescendingOrder, viewTransform); never executed: return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape, Qt::DescendingOrder, viewTransform); | 0 | ||||||||||||||||||||||||||||||
| 852 | } | - | ||||||||||||||||||||||||||||||
| 853 | - | |||||||||||||||||||||||||||||||
| 854 | - | |||||||||||||||||||||||||||||||
| 855 | - | |||||||||||||||||||||||||||||||
| 856 | - | |||||||||||||||||||||||||||||||
| 857 | void QGraphicsScenePrivate::storeMouseButtonsForMouseGrabber(QGraphicsSceneMouseEvent *event) | - | ||||||||||||||||||||||||||||||
| 858 | { | - | ||||||||||||||||||||||||||||||
| 859 | for (int i = 0x1; i <= 0x10
| 0 | ||||||||||||||||||||||||||||||
| 860 | if (event->buttons() & i
| 0 | ||||||||||||||||||||||||||||||
| 861 | mouseGrabberButtonDownPos.insert(Qt::MouseButton(i), | - | ||||||||||||||||||||||||||||||
| 862 | mouseGrabberItems.last()->d_ptr->genericMapFromScene(event->scenePos(), | - | ||||||||||||||||||||||||||||||
| 863 | event->widget())); | - | ||||||||||||||||||||||||||||||
| 864 | mouseGrabberButtonDownScenePos.insert(Qt::MouseButton(i), event->scenePos()); | - | ||||||||||||||||||||||||||||||
| 865 | mouseGrabberButtonDownScreenPos.insert(Qt::MouseButton(i), event->screenPos()); | - | ||||||||||||||||||||||||||||||
| 866 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 867 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 868 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 869 | - | |||||||||||||||||||||||||||||||
| 870 | - | |||||||||||||||||||||||||||||||
| 871 | - | |||||||||||||||||||||||||||||||
| 872 | - | |||||||||||||||||||||||||||||||
| 873 | void QGraphicsScenePrivate::installSceneEventFilter(QGraphicsItem *watched, QGraphicsItem *filter) | - | ||||||||||||||||||||||||||||||
| 874 | { | - | ||||||||||||||||||||||||||||||
| 875 | sceneEventFilters.insert(watched, filter); | - | ||||||||||||||||||||||||||||||
| 876 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 877 | - | |||||||||||||||||||||||||||||||
| 878 | - | |||||||||||||||||||||||||||||||
| 879 | - | |||||||||||||||||||||||||||||||
| 880 | - | |||||||||||||||||||||||||||||||
| 881 | void QGraphicsScenePrivate::removeSceneEventFilter(QGraphicsItem *watched, QGraphicsItem *filter) | - | ||||||||||||||||||||||||||||||
| 882 | { | - | ||||||||||||||||||||||||||||||
| 883 | if (!sceneEventFilters.contains(watched)
| 0 | ||||||||||||||||||||||||||||||
| 884 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 885 | - | |||||||||||||||||||||||||||||||
| 886 | QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator it = sceneEventFilters.lowerBound(watched); | - | ||||||||||||||||||||||||||||||
| 887 | QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator end = sceneEventFilters.upperBound(watched); | - | ||||||||||||||||||||||||||||||
| 888 | do { | - | ||||||||||||||||||||||||||||||
| 889 | if (it.value() == filter
| 0 | ||||||||||||||||||||||||||||||
| 890 | it = sceneEventFilters.erase(it); never executed: it = sceneEventFilters.erase(it); | 0 | ||||||||||||||||||||||||||||||
| 891 | else | - | ||||||||||||||||||||||||||||||
| 892 | ++ never executed: it;++it;never executed: ++it; | 0 | ||||||||||||||||||||||||||||||
| 893 | } while (it != end
| 0 | ||||||||||||||||||||||||||||||
| 894 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 895 | - | |||||||||||||||||||||||||||||||
| 896 | - | |||||||||||||||||||||||||||||||
| 897 | - | |||||||||||||||||||||||||||||||
| 898 | - | |||||||||||||||||||||||||||||||
| 899 | bool QGraphicsScenePrivate::filterDescendantEvent(QGraphicsItem *item, QEvent *event) | - | ||||||||||||||||||||||||||||||
| 900 | { | - | ||||||||||||||||||||||||||||||
| 901 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 902 | QGraphicsItem *parent = item->parentItem(); | - | ||||||||||||||||||||||||||||||
| 903 | while (parent
| 0 | ||||||||||||||||||||||||||||||
| 904 | if (parent->d_ptr->filtersDescendantEvents
| 0 | ||||||||||||||||||||||||||||||
| 905 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 906 | if (!(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorFiltersChildEvents)
| 0 | ||||||||||||||||||||||||||||||
| 907 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 908 | parent = parent->parentItem(); | - | ||||||||||||||||||||||||||||||
| 909 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 910 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 911 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 912 | } | - | ||||||||||||||||||||||||||||||
| 913 | - | |||||||||||||||||||||||||||||||
| 914 | - | |||||||||||||||||||||||||||||||
| 915 | - | |||||||||||||||||||||||||||||||
| 916 | - | |||||||||||||||||||||||||||||||
| 917 | bool QGraphicsScenePrivate::filterEvent(QGraphicsItem *item, QEvent *event) | - | ||||||||||||||||||||||||||||||
| 918 | { | - | ||||||||||||||||||||||||||||||
| 919 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 920 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 921 | - | |||||||||||||||||||||||||||||||
| 922 | QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator it = sceneEventFilters.lowerBound(item); | - | ||||||||||||||||||||||||||||||
| 923 | QMultiMap<QGraphicsItem *, QGraphicsItem *>::Iterator end = sceneEventFilters.upperBound(item); | - | ||||||||||||||||||||||||||||||
| 924 | while (it != end
| 0 | ||||||||||||||||||||||||||||||
| 925 | - | |||||||||||||||||||||||||||||||
| 926 | if (it.value()->sceneEventFilter(it.key(), event)
| 0 | ||||||||||||||||||||||||||||||
| 927 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 928 | ++it; | - | ||||||||||||||||||||||||||||||
| 929 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 930 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 931 | } | - | ||||||||||||||||||||||||||||||
| 932 | bool QGraphicsScenePrivate::sendEvent(QGraphicsItem *item, QEvent *event) | - | ||||||||||||||||||||||||||||||
| 933 | { | - | ||||||||||||||||||||||||||||||
| 934 | if (QGraphicsObject *object = item->toGraphicsObject()
| 0 | ||||||||||||||||||||||||||||||
| 935 | - | |||||||||||||||||||||||||||||||
| 936 | QGestureManager *gestureManager = QApplicationPrivate::instance()->gestureManager; | - | ||||||||||||||||||||||||||||||
| 937 | if (gestureManager
| 0 | ||||||||||||||||||||||||||||||
| 938 | if (gestureManager->filterEvent(object, event)
| 0 | ||||||||||||||||||||||||||||||
| 939 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 940 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 941 | - | |||||||||||||||||||||||||||||||
| 942 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 943 | - | |||||||||||||||||||||||||||||||
| 944 | if (filterEvent(item, event)
| 0 | ||||||||||||||||||||||||||||||
| 945 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 946 | if (filterDescendantEvent(item, event)
| 0 | ||||||||||||||||||||||||||||||
| 947 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 948 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 949 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 950 | if (QGraphicsObject *o = item->toGraphicsObject()
| 0 | ||||||||||||||||||||||||||||||
| 951 | bool spont = event->spontaneous(); | - | ||||||||||||||||||||||||||||||
| 952 | if (spont
| 0 | ||||||||||||||||||||||||||||||
| 953 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 954 | event->spont = spont; | - | ||||||||||||||||||||||||||||||
| 955 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 956 | return never executed: item->sceneEvent(event);return item->sceneEvent(event);never executed: return item->sceneEvent(event); | 0 | ||||||||||||||||||||||||||||||
| 957 | } | - | ||||||||||||||||||||||||||||||
| 958 | - | |||||||||||||||||||||||||||||||
| 959 | - | |||||||||||||||||||||||||||||||
| 960 | - | |||||||||||||||||||||||||||||||
| 961 | - | |||||||||||||||||||||||||||||||
| 962 | void QGraphicsScenePrivate::cloneDragDropEvent(QGraphicsSceneDragDropEvent *dest, | - | ||||||||||||||||||||||||||||||
| 963 | QGraphicsSceneDragDropEvent *source) | - | ||||||||||||||||||||||||||||||
| 964 | { | - | ||||||||||||||||||||||||||||||
| 965 | dest->setWidget(source->widget()); | - | ||||||||||||||||||||||||||||||
| 966 | dest->setPos(source->pos()); | - | ||||||||||||||||||||||||||||||
| 967 | dest->setScenePos(source->scenePos()); | - | ||||||||||||||||||||||||||||||
| 968 | dest->setScreenPos(source->screenPos()); | - | ||||||||||||||||||||||||||||||
| 969 | dest->setButtons(source->buttons()); | - | ||||||||||||||||||||||||||||||
| 970 | dest->setModifiers(source->modifiers()); | - | ||||||||||||||||||||||||||||||
| 971 | dest->setPossibleActions(source->possibleActions()); | - | ||||||||||||||||||||||||||||||
| 972 | dest->setProposedAction(source->proposedAction()); | - | ||||||||||||||||||||||||||||||
| 973 | dest->setDropAction(source->dropAction()); | - | ||||||||||||||||||||||||||||||
| 974 | dest->setSource(source->source()); | - | ||||||||||||||||||||||||||||||
| 975 | dest->setMimeData(source->mimeData()); | - | ||||||||||||||||||||||||||||||
| 976 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 977 | - | |||||||||||||||||||||||||||||||
| 978 | - | |||||||||||||||||||||||||||||||
| 979 | - | |||||||||||||||||||||||||||||||
| 980 | - | |||||||||||||||||||||||||||||||
| 981 | void QGraphicsScenePrivate::sendDragDropEvent(QGraphicsItem *item, | - | ||||||||||||||||||||||||||||||
| 982 | QGraphicsSceneDragDropEvent *dragDropEvent) | - | ||||||||||||||||||||||||||||||
| 983 | { | - | ||||||||||||||||||||||||||||||
| 984 | dragDropEvent->setPos(item->d_ptr->genericMapFromScene(dragDropEvent->scenePos(), dragDropEvent->widget())); | - | ||||||||||||||||||||||||||||||
| 985 | sendEvent(item, dragDropEvent); | - | ||||||||||||||||||||||||||||||
| 986 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 987 | - | |||||||||||||||||||||||||||||||
| 988 | - | |||||||||||||||||||||||||||||||
| 989 | - | |||||||||||||||||||||||||||||||
| 990 | - | |||||||||||||||||||||||||||||||
| 991 | void QGraphicsScenePrivate::sendHoverEvent(QEvent::Type type, QGraphicsItem *item, | - | ||||||||||||||||||||||||||||||
| 992 | QGraphicsSceneHoverEvent *hoverEvent) | - | ||||||||||||||||||||||||||||||
| 993 | { | - | ||||||||||||||||||||||||||||||
| 994 | QGraphicsSceneHoverEvent event(type); | - | ||||||||||||||||||||||||||||||
| 995 | event.setWidget(hoverEvent->widget()); | - | ||||||||||||||||||||||||||||||
| 996 | event.setPos(item->d_ptr->genericMapFromScene(hoverEvent->scenePos(), hoverEvent->widget())); | - | ||||||||||||||||||||||||||||||
| 997 | event.setScenePos(hoverEvent->scenePos()); | - | ||||||||||||||||||||||||||||||
| 998 | event.setScreenPos(hoverEvent->screenPos()); | - | ||||||||||||||||||||||||||||||
| 999 | event.setLastPos(item->d_ptr->genericMapFromScene(hoverEvent->lastScenePos(), hoverEvent->widget())); | - | ||||||||||||||||||||||||||||||
| 1000 | event.setLastScenePos(hoverEvent->lastScenePos()); | - | ||||||||||||||||||||||||||||||
| 1001 | event.setLastScreenPos(hoverEvent->lastScreenPos()); | - | ||||||||||||||||||||||||||||||
| 1002 | event.setModifiers(hoverEvent->modifiers()); | - | ||||||||||||||||||||||||||||||
| 1003 | sendEvent(item, &event); | - | ||||||||||||||||||||||||||||||
| 1004 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1005 | - | |||||||||||||||||||||||||||||||
| 1006 | - | |||||||||||||||||||||||||||||||
| 1007 | - | |||||||||||||||||||||||||||||||
| 1008 | - | |||||||||||||||||||||||||||||||
| 1009 | void QGraphicsScenePrivate::sendMouseEvent(QGraphicsSceneMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||||||||
| 1010 | { | - | ||||||||||||||||||||||||||||||
| 1011 | if (mouseEvent->button() == 0
| 0 | ||||||||||||||||||||||||||||||
| 1012 | - | |||||||||||||||||||||||||||||||
| 1013 | - | |||||||||||||||||||||||||||||||
| 1014 | clearMouseGrabber(); | - | ||||||||||||||||||||||||||||||
| 1015 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1016 | } | - | ||||||||||||||||||||||||||||||
| 1017 | - | |||||||||||||||||||||||||||||||
| 1018 | QGraphicsItem *item = mouseGrabberItems.last(); | - | ||||||||||||||||||||||||||||||
| 1019 | if (item->isBlockedByModalPanel()
| 0 | ||||||||||||||||||||||||||||||
| 1020 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1021 | - | |||||||||||||||||||||||||||||||
| 1022 | for (int i = 0x1; i <= 0x10
| 0 | ||||||||||||||||||||||||||||||
| 1023 | Qt::MouseButton button = Qt::MouseButton(i); | - | ||||||||||||||||||||||||||||||
| 1024 | mouseEvent->setButtonDownPos(button, mouseGrabberButtonDownPos.value(button, item->d_ptr->genericMapFromScene(mouseEvent->scenePos(), mouseEvent->widget()))); | - | ||||||||||||||||||||||||||||||
| 1025 | mouseEvent->setButtonDownScenePos(button, mouseGrabberButtonDownScenePos.value(button, mouseEvent->scenePos())); | - | ||||||||||||||||||||||||||||||
| 1026 | mouseEvent->setButtonDownScreenPos(button, mouseGrabberButtonDownScreenPos.value(button, mouseEvent->screenPos())); | - | ||||||||||||||||||||||||||||||
| 1027 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1028 | mouseEvent->setPos(item->d_ptr->genericMapFromScene(mouseEvent->scenePos(), mouseEvent->widget())); | - | ||||||||||||||||||||||||||||||
| 1029 | mouseEvent->setLastPos(item->d_ptr->genericMapFromScene(mouseEvent->lastScenePos(), mouseEvent->widget())); | - | ||||||||||||||||||||||||||||||
| 1030 | sendEvent(item, mouseEvent); | - | ||||||||||||||||||||||||||||||
| 1031 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1032 | - | |||||||||||||||||||||||||||||||
| 1033 | - | |||||||||||||||||||||||||||||||
| 1034 | - | |||||||||||||||||||||||||||||||
| 1035 | - | |||||||||||||||||||||||||||||||
| 1036 | void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||||||||
| 1037 | { | - | ||||||||||||||||||||||||||||||
| 1038 | QGraphicsScene * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 1039 | - | |||||||||||||||||||||||||||||||
| 1040 | - | |||||||||||||||||||||||||||||||
| 1041 | mouseEvent->ignore(); | - | ||||||||||||||||||||||||||||||
| 1042 | - | |||||||||||||||||||||||||||||||
| 1043 | - | |||||||||||||||||||||||||||||||
| 1044 | if (!mouseGrabberItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 1045 | if (mouseGrabberItems.last()->isBlockedByModalPanel()
| 0 | ||||||||||||||||||||||||||||||
| 1046 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1047 | - | |||||||||||||||||||||||||||||||
| 1048 | - | |||||||||||||||||||||||||||||||
| 1049 | sendMouseEvent(mouseEvent); | - | ||||||||||||||||||||||||||||||
| 1050 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1051 | } | - | ||||||||||||||||||||||||||||||
| 1052 | - | |||||||||||||||||||||||||||||||
| 1053 | - | |||||||||||||||||||||||||||||||
| 1054 | - | |||||||||||||||||||||||||||||||
| 1055 | if (cachedItemsUnderMouse.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 1056 | cachedItemsUnderMouse = itemsAtPosition(mouseEvent->screenPos(), | - | ||||||||||||||||||||||||||||||
| 1057 | mouseEvent->scenePos(), | - | ||||||||||||||||||||||||||||||
| 1058 | mouseEvent->widget()); | - | ||||||||||||||||||||||||||||||
| 1059 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1060 | - | |||||||||||||||||||||||||||||||
| 1061 | - | |||||||||||||||||||||||||||||||
| 1062 | QGraphicsItem *topItem = cachedItemsUnderMouse.value(0); | - | ||||||||||||||||||||||||||||||
| 1063 | QGraphicsWidget *newActiveWindow = topItem
| 0 | ||||||||||||||||||||||||||||||
| 1064 | if (newActiveWindow
| 0 | ||||||||||||||||||||||||||||||
| 1065 | - | |||||||||||||||||||||||||||||||
| 1066 | newActiveWindow = topItem
| 0 | ||||||||||||||||||||||||||||||
| 1067 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1068 | - | |||||||||||||||||||||||||||||||
| 1069 | if (newActiveWindow != q->activeWindow()
| 0 | ||||||||||||||||||||||||||||||
| 1070 | q->setActiveWindow(newActiveWindow); never executed: q->setActiveWindow(newActiveWindow); | 0 | ||||||||||||||||||||||||||||||
| 1071 | - | |||||||||||||||||||||||||||||||
| 1072 | - | |||||||||||||||||||||||||||||||
| 1073 | bool setFocus = false; | - | ||||||||||||||||||||||||||||||
| 1074 | - | |||||||||||||||||||||||||||||||
| 1075 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(cachedItemsUnderMouse)>::type> _container_((cachedItemsUnderMouse)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 1076 | if (item->isBlockedByModalPanel()
| 0 | ||||||||||||||||||||||||||||||
| 1077 | || (
| 0 | ||||||||||||||||||||||||||||||
| 1078 | - | |||||||||||||||||||||||||||||||
| 1079 | setFocus = true; | - | ||||||||||||||||||||||||||||||
| 1080 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1081 | } | - | ||||||||||||||||||||||||||||||
| 1082 | if (item->isEnabled()
| 0 | ||||||||||||||||||||||||||||||
| 1083 | if (!item->isWidget()
| 0 | ||||||||||||||||||||||||||||||
| 1084 | setFocus = true; | - | ||||||||||||||||||||||||||||||
| 1085 | if (item != q->focusItem()
| 0 | ||||||||||||||||||||||||||||||
| 1086 | q->setFocusItem(item, Qt::MouseFocusReason); never executed: q->setFocusItem(item, Qt::MouseFocusReason); | 0 | ||||||||||||||||||||||||||||||
| 1087 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1088 | } | - | ||||||||||||||||||||||||||||||
| 1089 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1090 | if (item->isPanel()
| 0 | ||||||||||||||||||||||||||||||
| 1091 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1092 | if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation
| 0 | ||||||||||||||||||||||||||||||
| 1093 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1094 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1095 | - | |||||||||||||||||||||||||||||||
| 1096 | - | |||||||||||||||||||||||||||||||
| 1097 | bool sceneModality = false; | - | ||||||||||||||||||||||||||||||
| 1098 | for (int i = 0; i < modalPanels.size()
| 0 | ||||||||||||||||||||||||||||||
| 1099 | if (modalPanels.at(i)->panelModality() == QGraphicsItem::SceneModal
| 0 | ||||||||||||||||||||||||||||||
| 1100 | sceneModality = true; | - | ||||||||||||||||||||||||||||||
| 1101 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1102 | } | - | ||||||||||||||||||||||||||||||
| 1103 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1104 | - | |||||||||||||||||||||||||||||||
| 1105 | - | |||||||||||||||||||||||||||||||
| 1106 | if (!stickyFocus
| 0 | ||||||||||||||||||||||||||||||
| 1107 | q->setFocusItem(0, Qt::MouseFocusReason); never executed: q->setFocusItem(0, Qt::MouseFocusReason); | 0 | ||||||||||||||||||||||||||||||
| 1108 | - | |||||||||||||||||||||||||||||||
| 1109 | - | |||||||||||||||||||||||||||||||
| 1110 | if (sceneModality
| 0 | ||||||||||||||||||||||||||||||
| 1111 | cachedItemsUnderMouse << modalPanels.first(); never executed: cachedItemsUnderMouse << modalPanels.first(); | 0 | ||||||||||||||||||||||||||||||
| 1112 | - | |||||||||||||||||||||||||||||||
| 1113 | - | |||||||||||||||||||||||||||||||
| 1114 | - | |||||||||||||||||||||||||||||||
| 1115 | - | |||||||||||||||||||||||||||||||
| 1116 | - | |||||||||||||||||||||||||||||||
| 1117 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(cachedItemsUnderMouse)>::type> _container_((cachedItemsUnderMouse)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 1118 | if (!(item->acceptedMouseButtons() & mouseEvent->button())
| 0 | ||||||||||||||||||||||||||||||
| 1119 | - | |||||||||||||||||||||||||||||||
| 1120 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 1121 | } | - | ||||||||||||||||||||||||||||||
| 1122 | - | |||||||||||||||||||||||||||||||
| 1123 | - | |||||||||||||||||||||||||||||||
| 1124 | - | |||||||||||||||||||||||||||||||
| 1125 | (void) item->isBlockedByModalPanel(&item); | - | ||||||||||||||||||||||||||||||
| 1126 | - | |||||||||||||||||||||||||||||||
| 1127 | grabMouse(item, true); | - | ||||||||||||||||||||||||||||||
| 1128 | mouseEvent->accept(); | - | ||||||||||||||||||||||||||||||
| 1129 | - | |||||||||||||||||||||||||||||||
| 1130 | - | |||||||||||||||||||||||||||||||
| 1131 | bool disabled = !item->isEnabled(); | - | ||||||||||||||||||||||||||||||
| 1132 | bool isPanel = item->isPanel(); | - | ||||||||||||||||||||||||||||||
| 1133 | if (mouseEvent->type() == QEvent::GraphicsSceneMouseDoubleClick
| 0 | ||||||||||||||||||||||||||||||
| 1134 | && item != lastMouseGrabberItem
| 0 | ||||||||||||||||||||||||||||||
| 1135 | - | |||||||||||||||||||||||||||||||
| 1136 | - | |||||||||||||||||||||||||||||||
| 1137 | - | |||||||||||||||||||||||||||||||
| 1138 | - | |||||||||||||||||||||||||||||||
| 1139 | QGraphicsSceneMouseEvent mousePress(QEvent::GraphicsSceneMousePress); | - | ||||||||||||||||||||||||||||||
| 1140 | mousePress.spont = mouseEvent->spont; | - | ||||||||||||||||||||||||||||||
| 1141 | mousePress.accept(); | - | ||||||||||||||||||||||||||||||
| 1142 | mousePress.setButton(mouseEvent->button()); | - | ||||||||||||||||||||||||||||||
| 1143 | mousePress.setButtons(mouseEvent->buttons()); | - | ||||||||||||||||||||||||||||||
| 1144 | mousePress.setScreenPos(mouseEvent->screenPos()); | - | ||||||||||||||||||||||||||||||
| 1145 | mousePress.setScenePos(mouseEvent->scenePos()); | - | ||||||||||||||||||||||||||||||
| 1146 | mousePress.setModifiers(mouseEvent->modifiers()); | - | ||||||||||||||||||||||||||||||
| 1147 | mousePress.setWidget(mouseEvent->widget()); | - | ||||||||||||||||||||||||||||||
| 1148 | mousePress.setButtonDownPos(mouseEvent->button(), | - | ||||||||||||||||||||||||||||||
| 1149 | mouseEvent->buttonDownPos(mouseEvent->button())); | - | ||||||||||||||||||||||||||||||
| 1150 | mousePress.setButtonDownScenePos(mouseEvent->button(), | - | ||||||||||||||||||||||||||||||
| 1151 | mouseEvent->buttonDownScenePos(mouseEvent->button())); | - | ||||||||||||||||||||||||||||||
| 1152 | mousePress.setButtonDownScreenPos(mouseEvent->button(), | - | ||||||||||||||||||||||||||||||
| 1153 | mouseEvent->buttonDownScreenPos(mouseEvent->button())); | - | ||||||||||||||||||||||||||||||
| 1154 | sendMouseEvent(&mousePress); | - | ||||||||||||||||||||||||||||||
| 1155 | mouseEvent->setAccepted(mousePress.isAccepted()); | - | ||||||||||||||||||||||||||||||
| 1156 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1157 | sendMouseEvent(mouseEvent); | - | ||||||||||||||||||||||||||||||
| 1158 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1159 | - | |||||||||||||||||||||||||||||||
| 1160 | bool dontSendUngrabEvents = mouseGrabberItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 1161 | if (disabled
| 0 | ||||||||||||||||||||||||||||||
| 1162 | ungrabMouse(item, dontSendUngrabEvents); | - | ||||||||||||||||||||||||||||||
| 1163 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1164 | } | - | ||||||||||||||||||||||||||||||
| 1165 | if (mouseEvent->isAccepted()
| 0 | ||||||||||||||||||||||||||||||
| 1166 | if (!mouseGrabberItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 1167 | storeMouseButtonsForMouseGrabber(mouseEvent); never executed: storeMouseButtonsForMouseGrabber(mouseEvent); | 0 | ||||||||||||||||||||||||||||||
| 1168 | lastMouseGrabberItem = item; | - | ||||||||||||||||||||||||||||||
| 1169 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1170 | } | - | ||||||||||||||||||||||||||||||
| 1171 | ungrabMouse(item, dontSendUngrabEvents); | - | ||||||||||||||||||||||||||||||
| 1172 | - | |||||||||||||||||||||||||||||||
| 1173 | - | |||||||||||||||||||||||||||||||
| 1174 | if (isPanel
| 0 | ||||||||||||||||||||||||||||||
| 1175 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1176 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1177 | - | |||||||||||||||||||||||||||||||
| 1178 | - | |||||||||||||||||||||||||||||||
| 1179 | - | |||||||||||||||||||||||||||||||
| 1180 | - | |||||||||||||||||||||||||||||||
| 1181 | - | |||||||||||||||||||||||||||||||
| 1182 | if (!mouseEvent->isAccepted()
| 0 | ||||||||||||||||||||||||||||||
| 1183 | clearMouseGrabber(); | - | ||||||||||||||||||||||||||||||
| 1184 | - | |||||||||||||||||||||||||||||||
| 1185 | QGraphicsView *view = mouseEvent->widget()
| 0 | ||||||||||||||||||||||||||||||
| 1186 | bool dontClearSelection = view
| 0 | ||||||||||||||||||||||||||||||
| 1187 | bool extendSelection = (mouseEvent->modifiers() & Qt::ControlModifier) != 0; | - | ||||||||||||||||||||||||||||||
| 1188 | dontClearSelection |= extendSelection; | - | ||||||||||||||||||||||||||||||
| 1189 | if (!dontClearSelection
| 0 | ||||||||||||||||||||||||||||||
| 1190 | - | |||||||||||||||||||||||||||||||
| 1191 | - | |||||||||||||||||||||||||||||||
| 1192 | - | |||||||||||||||||||||||||||||||
| 1193 | q->clearSelection(); | - | ||||||||||||||||||||||||||||||
| 1194 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1195 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1196 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1197 | void QGraphicsScenePrivate::ensureSequentialTopLevelSiblingIndexes() | - | ||||||||||||||||||||||||||||||
| 1198 | { | - | ||||||||||||||||||||||||||||||
| 1199 | if (!topLevelSequentialOrdering
| 0 | ||||||||||||||||||||||||||||||
| 1200 | std::sort(topLevelItems.begin(), topLevelItems.end(), QGraphicsItemPrivate::insertionOrder); | - | ||||||||||||||||||||||||||||||
| 1201 | topLevelSequentialOrdering = true; | - | ||||||||||||||||||||||||||||||
| 1202 | needSortTopLevelItems = 1; | - | ||||||||||||||||||||||||||||||
| 1203 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1204 | if (holesInTopLevelSiblingIndex
| 0 | ||||||||||||||||||||||||||||||
| 1205 | holesInTopLevelSiblingIndex = 0; | - | ||||||||||||||||||||||||||||||
| 1206 | for (int i = 0; i < topLevelItems.size()
| 0 | ||||||||||||||||||||||||||||||
| 1207 | topLevelItems[i]->d_ptr->siblingIndex = i; never executed: topLevelItems[i]->d_ptr->siblingIndex = i; | 0 | ||||||||||||||||||||||||||||||
| 1208 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1209 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1210 | - | |||||||||||||||||||||||||||||||
| 1211 | - | |||||||||||||||||||||||||||||||
| 1212 | - | |||||||||||||||||||||||||||||||
| 1213 | - | |||||||||||||||||||||||||||||||
| 1214 | - | |||||||||||||||||||||||||||||||
| 1215 | - | |||||||||||||||||||||||||||||||
| 1216 | - | |||||||||||||||||||||||||||||||
| 1217 | void QGraphicsScenePrivate::setFont_helper(const QFont &font) | - | ||||||||||||||||||||||||||||||
| 1218 | { | - | ||||||||||||||||||||||||||||||
| 1219 | if (this->font == font
| 0 | ||||||||||||||||||||||||||||||
| 1220 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1221 | updateFont(font); | - | ||||||||||||||||||||||||||||||
| 1222 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1223 | - | |||||||||||||||||||||||||||||||
| 1224 | - | |||||||||||||||||||||||||||||||
| 1225 | - | |||||||||||||||||||||||||||||||
| 1226 | - | |||||||||||||||||||||||||||||||
| 1227 | - | |||||||||||||||||||||||||||||||
| 1228 | - | |||||||||||||||||||||||||||||||
| 1229 | - | |||||||||||||||||||||||||||||||
| 1230 | void QGraphicsScenePrivate::resolveFont() | - | ||||||||||||||||||||||||||||||
| 1231 | { | - | ||||||||||||||||||||||||||||||
| 1232 | QFont naturalFont = QApplication::font(); | - | ||||||||||||||||||||||||||||||
| 1233 | naturalFont.resolve(0); | - | ||||||||||||||||||||||||||||||
| 1234 | QFont resolvedFont = font.resolve(naturalFont); | - | ||||||||||||||||||||||||||||||
| 1235 | updateFont(resolvedFont); | - | ||||||||||||||||||||||||||||||
| 1236 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1237 | - | |||||||||||||||||||||||||||||||
| 1238 | - | |||||||||||||||||||||||||||||||
| 1239 | - | |||||||||||||||||||||||||||||||
| 1240 | - | |||||||||||||||||||||||||||||||
| 1241 | - | |||||||||||||||||||||||||||||||
| 1242 | - | |||||||||||||||||||||||||||||||
| 1243 | - | |||||||||||||||||||||||||||||||
| 1244 | void QGraphicsScenePrivate::updateFont(const QFont &font) | - | ||||||||||||||||||||||||||||||
| 1245 | { | - | ||||||||||||||||||||||||||||||
| 1246 | QGraphicsScene * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 1247 | - | |||||||||||||||||||||||||||||||
| 1248 | - | |||||||||||||||||||||||||||||||
| 1249 | this->font = font; | - | ||||||||||||||||||||||||||||||
| 1250 | - | |||||||||||||||||||||||||||||||
| 1251 | - | |||||||||||||||||||||||||||||||
| 1252 | - | |||||||||||||||||||||||||||||||
| 1253 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(q->items())>::type> _container_((q->items())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 1254 | if (!item->parentItem()
| 0 | ||||||||||||||||||||||||||||||
| 1255 | - | |||||||||||||||||||||||||||||||
| 1256 | - | |||||||||||||||||||||||||||||||
| 1257 | - | |||||||||||||||||||||||||||||||
| 1258 | item->d_ptr->resolveFont(font.resolve()); | - | ||||||||||||||||||||||||||||||
| 1259 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1260 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1261 | - | |||||||||||||||||||||||||||||||
| 1262 | - | |||||||||||||||||||||||||||||||
| 1263 | QEvent event(QEvent::FontChange); | - | ||||||||||||||||||||||||||||||
| 1264 | QApplication::sendEvent(q, &event); | - | ||||||||||||||||||||||||||||||
| 1265 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1266 | - | |||||||||||||||||||||||||||||||
| 1267 | - | |||||||||||||||||||||||||||||||
| 1268 | - | |||||||||||||||||||||||||||||||
| 1269 | - | |||||||||||||||||||||||||||||||
| 1270 | - | |||||||||||||||||||||||||||||||
| 1271 | - | |||||||||||||||||||||||||||||||
| 1272 | - | |||||||||||||||||||||||||||||||
| 1273 | void QGraphicsScenePrivate::setPalette_helper(const QPalette &palette) | - | ||||||||||||||||||||||||||||||
| 1274 | { | - | ||||||||||||||||||||||||||||||
| 1275 | if (this->palette == palette
| 0 | ||||||||||||||||||||||||||||||
| 1276 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1277 | updatePalette(palette); | - | ||||||||||||||||||||||||||||||
| 1278 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1279 | - | |||||||||||||||||||||||||||||||
| 1280 | - | |||||||||||||||||||||||||||||||
| 1281 | - | |||||||||||||||||||||||||||||||
| 1282 | - | |||||||||||||||||||||||||||||||
| 1283 | - | |||||||||||||||||||||||||||||||
| 1284 | - | |||||||||||||||||||||||||||||||
| 1285 | - | |||||||||||||||||||||||||||||||
| 1286 | void QGraphicsScenePrivate::resolvePalette() | - | ||||||||||||||||||||||||||||||
| 1287 | { | - | ||||||||||||||||||||||||||||||
| 1288 | QPalette naturalPalette = QApplication::palette(); | - | ||||||||||||||||||||||||||||||
| 1289 | naturalPalette.resolve(0); | - | ||||||||||||||||||||||||||||||
| 1290 | QPalette resolvedPalette = palette.resolve(naturalPalette); | - | ||||||||||||||||||||||||||||||
| 1291 | updatePalette(resolvedPalette); | - | ||||||||||||||||||||||||||||||
| 1292 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1293 | - | |||||||||||||||||||||||||||||||
| 1294 | - | |||||||||||||||||||||||||||||||
| 1295 | - | |||||||||||||||||||||||||||||||
| 1296 | - | |||||||||||||||||||||||||||||||
| 1297 | - | |||||||||||||||||||||||||||||||
| 1298 | - | |||||||||||||||||||||||||||||||
| 1299 | - | |||||||||||||||||||||||||||||||
| 1300 | void QGraphicsScenePrivate::updatePalette(const QPalette &palette) | - | ||||||||||||||||||||||||||||||
| 1301 | { | - | ||||||||||||||||||||||||||||||
| 1302 | QGraphicsScene * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 1303 | - | |||||||||||||||||||||||||||||||
| 1304 | - | |||||||||||||||||||||||||||||||
| 1305 | this->palette = palette; | - | ||||||||||||||||||||||||||||||
| 1306 | - | |||||||||||||||||||||||||||||||
| 1307 | - | |||||||||||||||||||||||||||||||
| 1308 | - | |||||||||||||||||||||||||||||||
| 1309 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(q->items())>::type> _container_((q->items())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 1310 | if (!item->parentItem()
| 0 | ||||||||||||||||||||||||||||||
| 1311 | - | |||||||||||||||||||||||||||||||
| 1312 | - | |||||||||||||||||||||||||||||||
| 1313 | - | |||||||||||||||||||||||||||||||
| 1314 | item->d_ptr->resolvePalette(palette.resolve()); | - | ||||||||||||||||||||||||||||||
| 1315 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1316 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1317 | - | |||||||||||||||||||||||||||||||
| 1318 | - | |||||||||||||||||||||||||||||||
| 1319 | QEvent event(QEvent::PaletteChange); | - | ||||||||||||||||||||||||||||||
| 1320 | QApplication::sendEvent(q, &event); | - | ||||||||||||||||||||||||||||||
| 1321 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1322 | - | |||||||||||||||||||||||||||||||
| 1323 | - | |||||||||||||||||||||||||||||||
| 1324 | - | |||||||||||||||||||||||||||||||
| 1325 | - | |||||||||||||||||||||||||||||||
| 1326 | - | |||||||||||||||||||||||||||||||
| 1327 | QGraphicsScene::QGraphicsScene(QObject *parent) | - | ||||||||||||||||||||||||||||||
| 1328 | : QObject(*new QGraphicsScenePrivate, parent) | - | ||||||||||||||||||||||||||||||
| 1329 | { | - | ||||||||||||||||||||||||||||||
| 1330 | d_func()->init(); | - | ||||||||||||||||||||||||||||||
| 1331 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1332 | QGraphicsScene::QGraphicsScene(const QRectF &sceneRect, QObject *parent) | - | ||||||||||||||||||||||||||||||
| 1333 | : QObject(*new QGraphicsScenePrivate, parent) | - | ||||||||||||||||||||||||||||||
| 1334 | { | - | ||||||||||||||||||||||||||||||
| 1335 | d_func()->init(); | - | ||||||||||||||||||||||||||||||
| 1336 | setSceneRect(sceneRect); | - | ||||||||||||||||||||||||||||||
| 1337 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1338 | QGraphicsScene::QGraphicsScene(qreal x, qreal y, qreal width, qreal height, QObject *parent) | - | ||||||||||||||||||||||||||||||
| 1339 | : QObject(*new QGraphicsScenePrivate, parent) | - | ||||||||||||||||||||||||||||||
| 1340 | { | - | ||||||||||||||||||||||||||||||
| 1341 | d_func()->init(); | - | ||||||||||||||||||||||||||||||
| 1342 | setSceneRect(x, y, width, height); | - | ||||||||||||||||||||||||||||||
| 1343 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1344 | - | |||||||||||||||||||||||||||||||
| 1345 | - | |||||||||||||||||||||||||||||||
| 1346 | - | |||||||||||||||||||||||||||||||
| 1347 | - | |||||||||||||||||||||||||||||||
| 1348 | - | |||||||||||||||||||||||||||||||
| 1349 | - | |||||||||||||||||||||||||||||||
| 1350 | - | |||||||||||||||||||||||||||||||
| 1351 | QGraphicsScene::~QGraphicsScene() | - | ||||||||||||||||||||||||||||||
| 1352 | { | - | ||||||||||||||||||||||||||||||
| 1353 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1354 | - | |||||||||||||||||||||||||||||||
| 1355 | - | |||||||||||||||||||||||||||||||
| 1356 | if (!QApplicationPrivate::is_app_closing
| 0 | ||||||||||||||||||||||||||||||
| 1357 | (static_cast< never executed: QApplication *>(QCoreApplication::instance()))->d_func()->scene_list.removeAll(this);(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->scene_list.removeAll(this);never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->scene_list.removeAll(this); | 0 | ||||||||||||||||||||||||||||||
| 1358 | - | |||||||||||||||||||||||||||||||
| 1359 | clear(); | - | ||||||||||||||||||||||||||||||
| 1360 | - | |||||||||||||||||||||||||||||||
| 1361 | - | |||||||||||||||||||||||||||||||
| 1362 | for (int j = 0; j < d->views.size()
| 0 | ||||||||||||||||||||||||||||||
| 1363 | d->views.at(j)->setScene(0); never executed: d->views.at(j)->setScene(0); | 0 | ||||||||||||||||||||||||||||||
| 1364 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1365 | QRectF QGraphicsScene::sceneRect() const | - | ||||||||||||||||||||||||||||||
| 1366 | { | - | ||||||||||||||||||||||||||||||
| 1367 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1368 | if (d->hasSceneRect
| 0 | ||||||||||||||||||||||||||||||
| 1369 | return never executed: d->sceneRect;return d->sceneRect;never executed: return d->sceneRect; | 0 | ||||||||||||||||||||||||||||||
| 1370 | - | |||||||||||||||||||||||||||||||
| 1371 | if (d->dirtyGrowingItemsBoundingRect
| 0 | ||||||||||||||||||||||||||||||
| 1372 | - | |||||||||||||||||||||||||||||||
| 1373 | QGraphicsScenePrivate *thatd = const_cast<QGraphicsScenePrivate *>(d); | - | ||||||||||||||||||||||||||||||
| 1374 | QRectF oldGrowingBoundingRect = thatd->growingItemsBoundingRect; | - | ||||||||||||||||||||||||||||||
| 1375 | thatd->growingItemsBoundingRect |= itemsBoundingRect(); | - | ||||||||||||||||||||||||||||||
| 1376 | thatd->dirtyGrowingItemsBoundingRect = false; | - | ||||||||||||||||||||||||||||||
| 1377 | if (oldGrowingBoundingRect != thatd->growingItemsBoundingRect
| 0 | ||||||||||||||||||||||||||||||
| 1378 | const_cast< never executed: QGraphicsScene *>(this)->sceneRectChanged(thatd->growingItemsBoundingRect);const_cast<QGraphicsScene *>(this)->sceneRectChanged(thatd->growingItemsBoundingRect);never executed: const_cast<QGraphicsScene *>(this)->sceneRectChanged(thatd->growingItemsBoundingRect); | 0 | ||||||||||||||||||||||||||||||
| 1379 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1380 | return never executed: d->growingItemsBoundingRect;return d->growingItemsBoundingRect;never executed: return d->growingItemsBoundingRect; | 0 | ||||||||||||||||||||||||||||||
| 1381 | } | - | ||||||||||||||||||||||||||||||
| 1382 | void QGraphicsScene::setSceneRect(const QRectF &rect) | - | ||||||||||||||||||||||||||||||
| 1383 | { | - | ||||||||||||||||||||||||||||||
| 1384 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1385 | if (rect != d->sceneRect
| 0 | ||||||||||||||||||||||||||||||
| 1386 | d->hasSceneRect = !rect.isNull(); | - | ||||||||||||||||||||||||||||||
| 1387 | d->sceneRect = rect; | - | ||||||||||||||||||||||||||||||
| 1388 | sceneRectChanged(d->hasSceneRect ? rect : d->growingItemsBoundingRect); | - | ||||||||||||||||||||||||||||||
| 1389 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1390 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1391 | void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRectF &source, | - | ||||||||||||||||||||||||||||||
| 1392 | Qt::AspectRatioMode aspectRatioMode) | - | ||||||||||||||||||||||||||||||
| 1393 | { | - | ||||||||||||||||||||||||||||||
| 1394 | - | |||||||||||||||||||||||||||||||
| 1395 | - | |||||||||||||||||||||||||||||||
| 1396 | - | |||||||||||||||||||||||||||||||
| 1397 | QRectF sourceRect = source; | - | ||||||||||||||||||||||||||||||
| 1398 | if (sourceRect.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 1399 | sourceRect = sceneRect(); never executed: sourceRect = sceneRect(); | 0 | ||||||||||||||||||||||||||||||
| 1400 | - | |||||||||||||||||||||||||||||||
| 1401 | - | |||||||||||||||||||||||||||||||
| 1402 | QRectF targetRect = target; | - | ||||||||||||||||||||||||||||||
| 1403 | if (targetRect.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 1404 | if (painter->device()->devType() == QInternal::Picture
| 0 | ||||||||||||||||||||||||||||||
| 1405 | targetRect = sourceRect; never executed: targetRect = sourceRect; | 0 | ||||||||||||||||||||||||||||||
| 1406 | else | - | ||||||||||||||||||||||||||||||
| 1407 | targetRect.setRect(0, 0, painter->device()->width(), painter->device()->height()); never executed: targetRect.setRect(0, 0, painter->device()->width(), painter->device()->height()); | 0 | ||||||||||||||||||||||||||||||
| 1408 | } | - | ||||||||||||||||||||||||||||||
| 1409 | - | |||||||||||||||||||||||||||||||
| 1410 | - | |||||||||||||||||||||||||||||||
| 1411 | qreal xratio = targetRect.width() / sourceRect.width(); | - | ||||||||||||||||||||||||||||||
| 1412 | qreal yratio = targetRect.height() / sourceRect.height(); | - | ||||||||||||||||||||||||||||||
| 1413 | - | |||||||||||||||||||||||||||||||
| 1414 | - | |||||||||||||||||||||||||||||||
| 1415 | switch (aspectRatioMode) { | - | ||||||||||||||||||||||||||||||
| 1416 | case never executed: Qt::KeepAspectRatio:case Qt::KeepAspectRatio:never executed: case Qt::KeepAspectRatio: | 0 | ||||||||||||||||||||||||||||||
| 1417 | xratio = yratio = qMin(xratio, yratio); | - | ||||||||||||||||||||||||||||||
| 1418 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1419 | case never executed: Qt::KeepAspectRatioByExpanding:case Qt::KeepAspectRatioByExpanding:never executed: case Qt::KeepAspectRatioByExpanding: | 0 | ||||||||||||||||||||||||||||||
| 1420 | xratio = yratio = qMax(xratio, yratio); | - | ||||||||||||||||||||||||||||||
| 1421 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1422 | case never executed: Qt::IgnoreAspectRatio:case Qt::IgnoreAspectRatio:never executed: case Qt::IgnoreAspectRatio: | 0 | ||||||||||||||||||||||||||||||
| 1423 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1424 | } | - | ||||||||||||||||||||||||||||||
| 1425 | - | |||||||||||||||||||||||||||||||
| 1426 | - | |||||||||||||||||||||||||||||||
| 1427 | - | |||||||||||||||||||||||||||||||
| 1428 | QList<QGraphicsItem *> itemList = items(sourceRect, Qt::IntersectsItemBoundingRect); | - | ||||||||||||||||||||||||||||||
| 1429 | QGraphicsItem **itemArray = new QGraphicsItem *[itemList.size()]; | - | ||||||||||||||||||||||||||||||
| 1430 | int numItems = itemList.size(); | - | ||||||||||||||||||||||||||||||
| 1431 | for (int i = 0; i < numItems
| 0 | ||||||||||||||||||||||||||||||
| 1432 | itemArray[numItems - i - 1] = itemList.at(i); never executed: itemArray[numItems - i - 1] = itemList.at(i); | 0 | ||||||||||||||||||||||||||||||
| 1433 | itemList.clear(); | - | ||||||||||||||||||||||||||||||
| 1434 | - | |||||||||||||||||||||||||||||||
| 1435 | painter->save(); | - | ||||||||||||||||||||||||||||||
| 1436 | - | |||||||||||||||||||||||||||||||
| 1437 | - | |||||||||||||||||||||||||||||||
| 1438 | painter->setClipRect(targetRect, Qt::IntersectClip); | - | ||||||||||||||||||||||||||||||
| 1439 | QTransform painterTransform; | - | ||||||||||||||||||||||||||||||
| 1440 | painterTransform *= QTransform() | - | ||||||||||||||||||||||||||||||
| 1441 | .translate(targetRect.left(), targetRect.top()) | - | ||||||||||||||||||||||||||||||
| 1442 | .scale(xratio, yratio) | - | ||||||||||||||||||||||||||||||
| 1443 | .translate(-sourceRect.left(), -sourceRect.top()); | - | ||||||||||||||||||||||||||||||
| 1444 | painter->setWorldTransform(painterTransform, true); | - | ||||||||||||||||||||||||||||||
| 1445 | - | |||||||||||||||||||||||||||||||
| 1446 | - | |||||||||||||||||||||||||||||||
| 1447 | QStyleOptionGraphicsItem *styleOptionArray = new QStyleOptionGraphicsItem[numItems]; | - | ||||||||||||||||||||||||||||||
| 1448 | for (int i = 0; i < numItems
| 0 | ||||||||||||||||||||||||||||||
| 1449 | itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], painterTransform, targetRect.toRect()); never executed: itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], painterTransform, targetRect.toRect()); | 0 | ||||||||||||||||||||||||||||||
| 1450 | - | |||||||||||||||||||||||||||||||
| 1451 | - | |||||||||||||||||||||||||||||||
| 1452 | drawBackground(painter, sourceRect); | - | ||||||||||||||||||||||||||||||
| 1453 | drawItems(painter, numItems, itemArray, styleOptionArray); | - | ||||||||||||||||||||||||||||||
| 1454 | drawForeground(painter, sourceRect); | - | ||||||||||||||||||||||||||||||
| 1455 | - | |||||||||||||||||||||||||||||||
| 1456 | delete [] itemArray; | - | ||||||||||||||||||||||||||||||
| 1457 | delete [] styleOptionArray; | - | ||||||||||||||||||||||||||||||
| 1458 | - | |||||||||||||||||||||||||||||||
| 1459 | painter->restore(); | - | ||||||||||||||||||||||||||||||
| 1460 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1461 | QGraphicsScene::ItemIndexMethod QGraphicsScene::itemIndexMethod() const | - | ||||||||||||||||||||||||||||||
| 1462 | { | - | ||||||||||||||||||||||||||||||
| 1463 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1464 | return never executed: d->indexMethod;return d->indexMethod;never executed: return d->indexMethod; | 0 | ||||||||||||||||||||||||||||||
| 1465 | } | - | ||||||||||||||||||||||||||||||
| 1466 | void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) | - | ||||||||||||||||||||||||||||||
| 1467 | { | - | ||||||||||||||||||||||||||||||
| 1468 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1469 | if (d->indexMethod == method
| 0 | ||||||||||||||||||||||||||||||
| 1470 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1471 | - | |||||||||||||||||||||||||||||||
| 1472 | d->indexMethod = method; | - | ||||||||||||||||||||||||||||||
| 1473 | - | |||||||||||||||||||||||||||||||
| 1474 | QList<QGraphicsItem *> oldItems = d->index->items(Qt::DescendingOrder); | - | ||||||||||||||||||||||||||||||
| 1475 | delete d->index; | - | ||||||||||||||||||||||||||||||
| 1476 | if (method == BspTreeIndex
| 0 | ||||||||||||||||||||||||||||||
| 1477 | d->index = new QGraphicsSceneBspTreeIndex(this); never executed: d->index = new QGraphicsSceneBspTreeIndex(this); | 0 | ||||||||||||||||||||||||||||||
| 1478 | else | - | ||||||||||||||||||||||||||||||
| 1479 | d->index = new QGraphicsSceneLinearIndex(this); never executed: d->index = new QGraphicsSceneLinearIndex(this); | 0 | ||||||||||||||||||||||||||||||
| 1480 | for (int i = oldItems.size() - 1; i >= 0
| 0 | ||||||||||||||||||||||||||||||
| 1481 | d->index->addItem(oldItems.at(i)); never executed: d->index->addItem(oldItems.at(i)); | 0 | ||||||||||||||||||||||||||||||
| 1482 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1483 | int QGraphicsScene::bspTreeDepth() const | - | ||||||||||||||||||||||||||||||
| 1484 | { | - | ||||||||||||||||||||||||||||||
| 1485 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1486 | QGraphicsSceneBspTreeIndex *bspTree = qobject_cast<QGraphicsSceneBspTreeIndex *>(d->index); | - | ||||||||||||||||||||||||||||||
| 1487 | return never executed: bspTreereturn bspTree ? bspTree->bspTreeDepth() : 0;
never executed: return bspTree ? bspTree->bspTreeDepth() : 0; | 0 | ||||||||||||||||||||||||||||||
| 1488 | } | - | ||||||||||||||||||||||||||||||
| 1489 | void QGraphicsScene::setBspTreeDepth(int depth) | - | ||||||||||||||||||||||||||||||
| 1490 | { | - | ||||||||||||||||||||||||||||||
| 1491 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1492 | if (depth < 0
| 0 | ||||||||||||||||||||||||||||||
| 1493 | QMessageLogger(__FILE__, 1906, __PRETTY_FUNCTION__).warning("QGraphicsScene::setBspTreeDepth: invalid depth %d ignored; must be >= 0", depth); | - | ||||||||||||||||||||||||||||||
| 1494 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1495 | } | - | ||||||||||||||||||||||||||||||
| 1496 | - | |||||||||||||||||||||||||||||||
| 1497 | QGraphicsSceneBspTreeIndex *bspTree = qobject_cast<QGraphicsSceneBspTreeIndex *>(d->index); | - | ||||||||||||||||||||||||||||||
| 1498 | if (!bspTree
| 0 | ||||||||||||||||||||||||||||||
| 1499 | QMessageLogger(__FILE__, 1912, __PRETTY_FUNCTION__).warning("QGraphicsScene::setBspTreeDepth: can not apply if indexing method is not BSP"); | - | ||||||||||||||||||||||||||||||
| 1500 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1501 | } | - | ||||||||||||||||||||||||||||||
| 1502 | bspTree->setBspTreeDepth(depth); | - | ||||||||||||||||||||||||||||||
| 1503 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1504 | bool QGraphicsScene::isSortCacheEnabled() const | - | ||||||||||||||||||||||||||||||
| 1505 | { | - | ||||||||||||||||||||||||||||||
| 1506 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1507 | return never executed: d->sortCacheEnabled;return d->sortCacheEnabled;never executed: return d->sortCacheEnabled; | 0 | ||||||||||||||||||||||||||||||
| 1508 | } | - | ||||||||||||||||||||||||||||||
| 1509 | void QGraphicsScene::setSortCacheEnabled(bool enabled) | - | ||||||||||||||||||||||||||||||
| 1510 | { | - | ||||||||||||||||||||||||||||||
| 1511 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1512 | if (d->sortCacheEnabled == enabled
| 0 | ||||||||||||||||||||||||||||||
| 1513 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1514 | d->sortCacheEnabled = enabled; | - | ||||||||||||||||||||||||||||||
| 1515 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1516 | QRectF QGraphicsScene::itemsBoundingRect() const | - | ||||||||||||||||||||||||||||||
| 1517 | { | - | ||||||||||||||||||||||||||||||
| 1518 | - | |||||||||||||||||||||||||||||||
| 1519 | QRectF boundingRect; | - | ||||||||||||||||||||||||||||||
| 1520 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(items())>::type> _container_((items())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 1521 | boundingRect |= item->sceneBoundingRect(); never executed: boundingRect |= item->sceneBoundingRect(); | 0 | ||||||||||||||||||||||||||||||
| 1522 | return never executed: boundingRect;return boundingRect;never executed: return boundingRect; | 0 | ||||||||||||||||||||||||||||||
| 1523 | } | - | ||||||||||||||||||||||||||||||
| 1524 | - | |||||||||||||||||||||||||||||||
| 1525 | - | |||||||||||||||||||||||||||||||
| 1526 | - | |||||||||||||||||||||||||||||||
| 1527 | - | |||||||||||||||||||||||||||||||
| 1528 | - | |||||||||||||||||||||||||||||||
| 1529 | - | |||||||||||||||||||||||||||||||
| 1530 | - | |||||||||||||||||||||||||||||||
| 1531 | QList<QGraphicsItem *> QGraphicsScene::items(Qt::SortOrder order) const | - | ||||||||||||||||||||||||||||||
| 1532 | { | - | ||||||||||||||||||||||||||||||
| 1533 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1534 | return never executed: d->index->items(order);return d->index->items(order);never executed: return d->index->items(order); | 0 | ||||||||||||||||||||||||||||||
| 1535 | } | - | ||||||||||||||||||||||||||||||
| 1536 | QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos, Qt::ItemSelectionMode mode, | - | ||||||||||||||||||||||||||||||
| 1537 | Qt::SortOrder order, const QTransform &deviceTransform) const | - | ||||||||||||||||||||||||||||||
| 1538 | { | - | ||||||||||||||||||||||||||||||
| 1539 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1540 | return never executed: d->index->items(pos, mode, order, deviceTransform);return d->index->items(pos, mode, order, deviceTransform);never executed: return d->index->items(pos, mode, order, deviceTransform); | 0 | ||||||||||||||||||||||||||||||
| 1541 | } | - | ||||||||||||||||||||||||||||||
| 1542 | QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rect, Qt::ItemSelectionMode mode, | - | ||||||||||||||||||||||||||||||
| 1543 | Qt::SortOrder order, const QTransform &deviceTransform) const | - | ||||||||||||||||||||||||||||||
| 1544 | { | - | ||||||||||||||||||||||||||||||
| 1545 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1546 | return never executed: d->index->items(rect, mode, order, deviceTransform);return d->index->items(rect, mode, order, deviceTransform);never executed: return d->index->items(rect, mode, order, deviceTransform); | 0 | ||||||||||||||||||||||||||||||
| 1547 | } | - | ||||||||||||||||||||||||||||||
| 1548 | QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, | - | ||||||||||||||||||||||||||||||
| 1549 | Qt::SortOrder order, const QTransform &deviceTransform) const | - | ||||||||||||||||||||||||||||||
| 1550 | { | - | ||||||||||||||||||||||||||||||
| 1551 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1552 | return never executed: d->index->items(polygon, mode, order, deviceTransform);return d->index->items(polygon, mode, order, deviceTransform);never executed: return d->index->items(polygon, mode, order, deviceTransform); | 0 | ||||||||||||||||||||||||||||||
| 1553 | } | - | ||||||||||||||||||||||||||||||
| 1554 | QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode, | - | ||||||||||||||||||||||||||||||
| 1555 | Qt::SortOrder order, const QTransform &deviceTransform) const | - | ||||||||||||||||||||||||||||||
| 1556 | { | - | ||||||||||||||||||||||||||||||
| 1557 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1558 | return never executed: d->index->items(path, mode, order, deviceTransform);return d->index->items(path, mode, order, deviceTransform);never executed: return d->index->items(path, mode, order, deviceTransform); | 0 | ||||||||||||||||||||||||||||||
| 1559 | } | - | ||||||||||||||||||||||||||||||
| 1560 | QList<QGraphicsItem *> QGraphicsScene::collidingItems(const QGraphicsItem *item, | - | ||||||||||||||||||||||||||||||
| 1561 | Qt::ItemSelectionMode mode) const | - | ||||||||||||||||||||||||||||||
| 1562 | { | - | ||||||||||||||||||||||||||||||
| 1563 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1564 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 1565 | QMessageLogger(__FILE__, 2113, __PRETTY_FUNCTION__).warning("QGraphicsScene::collidingItems: cannot find collisions for null item"); | - | ||||||||||||||||||||||||||||||
| 1566 | return never executed: QList<QGraphicsItem *>();return QList<QGraphicsItem *>();never executed: return QList<QGraphicsItem *>(); | 0 | ||||||||||||||||||||||||||||||
| 1567 | } | - | ||||||||||||||||||||||||||||||
| 1568 | - | |||||||||||||||||||||||||||||||
| 1569 | - | |||||||||||||||||||||||||||||||
| 1570 | QList<QGraphicsItem *> tmp; | - | ||||||||||||||||||||||||||||||
| 1571 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(d->index->estimateItems(item->sceneBoundingRect(), Qt::DescendingOrder))>::type> _container_((d->index->estimateItems(item->sceneBoundingRect(), Qt::DescendingOrder))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *itemInVicinity = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 1572 | if (item != itemInVicinity
| 0 | ||||||||||||||||||||||||||||||
| 1573 | tmp << itemInVicinity; never executed: tmp << itemInVicinity; | 0 | ||||||||||||||||||||||||||||||
| 1574 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1575 | return never executed: tmp;return tmp;never executed: return tmp; | 0 | ||||||||||||||||||||||||||||||
| 1576 | } | - | ||||||||||||||||||||||||||||||
| 1577 | QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform &deviceTransform) const | - | ||||||||||||||||||||||||||||||
| 1578 | { | - | ||||||||||||||||||||||||||||||
| 1579 | QList<QGraphicsItem *> itemsAtPoint = items(position, Qt::IntersectsItemShape, | - | ||||||||||||||||||||||||||||||
| 1580 | Qt::DescendingOrder, deviceTransform); | - | ||||||||||||||||||||||||||||||
| 1581 | return never executed: itemsAtPoint.isEmpty()return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first();
never executed: return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first(); | 0 | ||||||||||||||||||||||||||||||
| 1582 | } | - | ||||||||||||||||||||||||||||||
| 1583 | QList<QGraphicsItem *> QGraphicsScene::selectedItems() const | - | ||||||||||||||||||||||||||||||
| 1584 | { | - | ||||||||||||||||||||||||||||||
| 1585 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1586 | - | |||||||||||||||||||||||||||||||
| 1587 | - | |||||||||||||||||||||||||||||||
| 1588 | QGraphicsScene *that = const_cast<QGraphicsScene *>(this); | - | ||||||||||||||||||||||||||||||
| 1589 | QSet<QGraphicsItem *> actuallySelectedSet; | - | ||||||||||||||||||||||||||||||
| 1590 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(that->d_func()->selectedItems)>::type> _container_((that->d_func()->selectedItems)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 1591 | if (item->isSelected()
| 0 | ||||||||||||||||||||||||||||||
| 1592 | actuallySelectedSet << item; never executed: actuallySelectedSet << item; | 0 | ||||||||||||||||||||||||||||||
| 1593 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1594 | - | |||||||||||||||||||||||||||||||
| 1595 | that->d_func()->selectedItems = actuallySelectedSet; | - | ||||||||||||||||||||||||||||||
| 1596 | - | |||||||||||||||||||||||||||||||
| 1597 | return never executed: d->selectedItems.values();return d->selectedItems.values();never executed: return d->selectedItems.values(); | 0 | ||||||||||||||||||||||||||||||
| 1598 | } | - | ||||||||||||||||||||||||||||||
| 1599 | QPainterPath QGraphicsScene::selectionArea() const | - | ||||||||||||||||||||||||||||||
| 1600 | { | - | ||||||||||||||||||||||||||||||
| 1601 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1602 | return never executed: d->selectionArea;return d->selectionArea;never executed: return d->selectionArea; | 0 | ||||||||||||||||||||||||||||||
| 1603 | } | - | ||||||||||||||||||||||||||||||
| 1604 | void QGraphicsScene::setSelectionArea(const QPainterPath &path, const QTransform &deviceTransform) | - | ||||||||||||||||||||||||||||||
| 1605 | { | - | ||||||||||||||||||||||||||||||
| 1606 | setSelectionArea(path, Qt::IntersectsItemShape, deviceTransform); | - | ||||||||||||||||||||||||||||||
| 1607 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1608 | void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode, | - | ||||||||||||||||||||||||||||||
| 1609 | const QTransform &deviceTransform) | - | ||||||||||||||||||||||||||||||
| 1610 | { | - | ||||||||||||||||||||||||||||||
| 1611 | setSelectionArea(path, Qt::ReplaceSelection, mode, deviceTransform); | - | ||||||||||||||||||||||||||||||
| 1612 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1613 | void QGraphicsScene::setSelectionArea(const QPainterPath &path, | - | ||||||||||||||||||||||||||||||
| 1614 | Qt::ItemSelectionOperation selectionOperation, | - | ||||||||||||||||||||||||||||||
| 1615 | Qt::ItemSelectionMode mode, | - | ||||||||||||||||||||||||||||||
| 1616 | const QTransform &deviceTransform) | - | ||||||||||||||||||||||||||||||
| 1617 | { | - | ||||||||||||||||||||||||||||||
| 1618 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1619 | - | |||||||||||||||||||||||||||||||
| 1620 | - | |||||||||||||||||||||||||||||||
| 1621 | - | |||||||||||||||||||||||||||||||
| 1622 | - | |||||||||||||||||||||||||||||||
| 1623 | - | |||||||||||||||||||||||||||||||
| 1624 | d->selectionArea = path; | - | ||||||||||||||||||||||||||||||
| 1625 | - | |||||||||||||||||||||||||||||||
| 1626 | QSet<QGraphicsItem *> unselectItems = d->selectedItems; | - | ||||||||||||||||||||||||||||||
| 1627 | - | |||||||||||||||||||||||||||||||
| 1628 | - | |||||||||||||||||||||||||||||||
| 1629 | ++d->selectionChanging; | - | ||||||||||||||||||||||||||||||
| 1630 | bool changed = false; | - | ||||||||||||||||||||||||||||||
| 1631 | - | |||||||||||||||||||||||||||||||
| 1632 | - | |||||||||||||||||||||||||||||||
| 1633 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(items(path, mode, Qt::DescendingOrder, deviceTransform))>::type> _container_((items(path, mode, Qt::DescendingOrder, deviceTransform))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 1634 | if (item->flags() & QGraphicsItem::ItemIsSelectable
| 0 | ||||||||||||||||||||||||||||||
| 1635 | if (!item->isSelected()
| 0 | ||||||||||||||||||||||||||||||
| 1636 | changed = true; never executed: changed = true; | 0 | ||||||||||||||||||||||||||||||
| 1637 | unselectItems.remove(item); | - | ||||||||||||||||||||||||||||||
| 1638 | item->setSelected(true); | - | ||||||||||||||||||||||||||||||
| 1639 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1640 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1641 | - | |||||||||||||||||||||||||||||||
| 1642 | switch (selectionOperation) { | - | ||||||||||||||||||||||||||||||
| 1643 | case never executed: Qt::ReplaceSelection:case Qt::ReplaceSelection:never executed: case Qt::ReplaceSelection: | 0 | ||||||||||||||||||||||||||||||
| 1644 | - | |||||||||||||||||||||||||||||||
| 1645 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(unselectItems)>::type> _container_((unselectItems)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 1646 | item->setSelected(false); | - | ||||||||||||||||||||||||||||||
| 1647 | changed = true; | - | ||||||||||||||||||||||||||||||
| 1648 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1649 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1650 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 1651 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1652 | } | - | ||||||||||||||||||||||||||||||
| 1653 | - | |||||||||||||||||||||||||||||||
| 1654 | - | |||||||||||||||||||||||||||||||
| 1655 | --d->selectionChanging; | - | ||||||||||||||||||||||||||||||
| 1656 | - | |||||||||||||||||||||||||||||||
| 1657 | if (!d->selectionChanging
| 0 | ||||||||||||||||||||||||||||||
| 1658 | selectionChanged(); never executed: selectionChanged(); | 0 | ||||||||||||||||||||||||||||||
| 1659 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1660 | - | |||||||||||||||||||||||||||||||
| 1661 | - | |||||||||||||||||||||||||||||||
| 1662 | - | |||||||||||||||||||||||||||||||
| 1663 | - | |||||||||||||||||||||||||||||||
| 1664 | - | |||||||||||||||||||||||||||||||
| 1665 | - | |||||||||||||||||||||||||||||||
| 1666 | void QGraphicsScene::clearSelection() | - | ||||||||||||||||||||||||||||||
| 1667 | { | - | ||||||||||||||||||||||||||||||
| 1668 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1669 | - | |||||||||||||||||||||||||||||||
| 1670 | - | |||||||||||||||||||||||||||||||
| 1671 | ++d->selectionChanging; | - | ||||||||||||||||||||||||||||||
| 1672 | bool changed = !d->selectedItems.isEmpty(); | - | ||||||||||||||||||||||||||||||
| 1673 | - | |||||||||||||||||||||||||||||||
| 1674 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(d->selectedItems)>::type> _container_((d->selectedItems)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 1675 | item->setSelected(false); never executed: item->setSelected(false); | 0 | ||||||||||||||||||||||||||||||
| 1676 | d->selectedItems.clear(); | - | ||||||||||||||||||||||||||||||
| 1677 | - | |||||||||||||||||||||||||||||||
| 1678 | - | |||||||||||||||||||||||||||||||
| 1679 | --d->selectionChanging; | - | ||||||||||||||||||||||||||||||
| 1680 | - | |||||||||||||||||||||||||||||||
| 1681 | if (!d->selectionChanging
| 0 | ||||||||||||||||||||||||||||||
| 1682 | selectionChanged(); never executed: selectionChanged(); | 0 | ||||||||||||||||||||||||||||||
| 1683 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1684 | void QGraphicsScene::clear() | - | ||||||||||||||||||||||||||||||
| 1685 | { | - | ||||||||||||||||||||||||||||||
| 1686 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1687 | - | |||||||||||||||||||||||||||||||
| 1688 | - | |||||||||||||||||||||||||||||||
| 1689 | d->index->clear(); | - | ||||||||||||||||||||||||||||||
| 1690 | - | |||||||||||||||||||||||||||||||
| 1691 | while (!d->topLevelItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 1692 | delete d->topLevelItems.first(); never executed: delete d->topLevelItems.first(); | 0 | ||||||||||||||||||||||||||||||
| 1693 | ((!(d->topLevelItems.isEmpty())) ? qt_assert("d->topLevelItems.isEmpty()",__FILE__,2375) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1694 | d->lastItemCount = 0; | - | ||||||||||||||||||||||||||||||
| 1695 | d->allItemsIgnoreHoverEvents = true; | - | ||||||||||||||||||||||||||||||
| 1696 | d->allItemsUseDefaultCursor = true; | - | ||||||||||||||||||||||||||||||
| 1697 | d->allItemsIgnoreTouchEvents = true; | - | ||||||||||||||||||||||||||||||
| 1698 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1699 | QGraphicsItemGroup *QGraphicsScene::createItemGroup(const QList<QGraphicsItem *> &items) | - | ||||||||||||||||||||||||||||||
| 1700 | { | - | ||||||||||||||||||||||||||||||
| 1701 | - | |||||||||||||||||||||||||||||||
| 1702 | QList<QGraphicsItem *> ancestors; | - | ||||||||||||||||||||||||||||||
| 1703 | int n = 0; | - | ||||||||||||||||||||||||||||||
| 1704 | if (!items.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 1705 | QGraphicsItem *parent = items.at(n++); | - | ||||||||||||||||||||||||||||||
| 1706 | while ((
| 0 | ||||||||||||||||||||||||||||||
| 1707 | ancestors.append(parent); never executed: ancestors.append(parent); | 0 | ||||||||||||||||||||||||||||||
| 1708 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1709 | - | |||||||||||||||||||||||||||||||
| 1710 | - | |||||||||||||||||||||||||||||||
| 1711 | QGraphicsItem *commonAncestor = 0; | - | ||||||||||||||||||||||||||||||
| 1712 | if (!ancestors.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 1713 | while (n < items.size()
| 0 | ||||||||||||||||||||||||||||||
| 1714 | int commonIndex = -1; | - | ||||||||||||||||||||||||||||||
| 1715 | QGraphicsItem *parent = items.at(n++); | - | ||||||||||||||||||||||||||||||
| 1716 | do { | - | ||||||||||||||||||||||||||||||
| 1717 | int index = ancestors.indexOf(parent, qMax(0, commonIndex)); | - | ||||||||||||||||||||||||||||||
| 1718 | if (index != -1
| 0 | ||||||||||||||||||||||||||||||
| 1719 | commonIndex = index; | - | ||||||||||||||||||||||||||||||
| 1720 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1721 | } | - | ||||||||||||||||||||||||||||||
| 1722 | } never executed: while ((end of block
| 0 | ||||||||||||||||||||||||||||||
| 1723 | - | |||||||||||||||||||||||||||||||
| 1724 | if (commonIndex == -1
| 0 | ||||||||||||||||||||||||||||||
| 1725 | commonAncestor = 0; | - | ||||||||||||||||||||||||||||||
| 1726 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1727 | } | - | ||||||||||||||||||||||||||||||
| 1728 | - | |||||||||||||||||||||||||||||||
| 1729 | commonAncestor = ancestors.at(commonIndex); | - | ||||||||||||||||||||||||||||||
| 1730 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1731 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1732 | - | |||||||||||||||||||||||||||||||
| 1733 | - | |||||||||||||||||||||||||||||||
| 1734 | QGraphicsItemGroup *group = new QGraphicsItemGroup(commonAncestor); | - | ||||||||||||||||||||||||||||||
| 1735 | if (!commonAncestor
| 0 | ||||||||||||||||||||||||||||||
| 1736 | addItem(group); never executed: addItem(group); | 0 | ||||||||||||||||||||||||||||||
| 1737 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(items)>::type> _container_((items)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 1738 | group->addToGroup(item); never executed: group->addToGroup(item); | 0 | ||||||||||||||||||||||||||||||
| 1739 | return never executed: group;return group;never executed: return group; | 0 | ||||||||||||||||||||||||||||||
| 1740 | } | - | ||||||||||||||||||||||||||||||
| 1741 | void QGraphicsScene::destroyItemGroup(QGraphicsItemGroup *group) | - | ||||||||||||||||||||||||||||||
| 1742 | { | - | ||||||||||||||||||||||||||||||
| 1743 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(group->childItems())>::type> _container_((group->childItems())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 1744 | group->removeFromGroup(item); never executed: group->removeFromGroup(item); | 0 | ||||||||||||||||||||||||||||||
| 1745 | removeItem(group); | - | ||||||||||||||||||||||||||||||
| 1746 | delete group; | - | ||||||||||||||||||||||||||||||
| 1747 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1748 | void QGraphicsScene::addItem(QGraphicsItem *item) | - | ||||||||||||||||||||||||||||||
| 1749 | { | - | ||||||||||||||||||||||||||||||
| 1750 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1751 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 1752 | QMessageLogger(__FILE__, 2482, __PRETTY_FUNCTION__).warning("QGraphicsScene::addItem: cannot add null item"); | - | ||||||||||||||||||||||||||||||
| 1753 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1754 | } | - | ||||||||||||||||||||||||||||||
| 1755 | if (item->d_ptr->scene == this
| 0 | ||||||||||||||||||||||||||||||
| 1756 | QMessageLogger(__FILE__, 2486, __PRETTY_FUNCTION__).warning("QGraphicsScene::addItem: item has already been added to this scene"); | - | ||||||||||||||||||||||||||||||
| 1757 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1758 | } | - | ||||||||||||||||||||||||||||||
| 1759 | - | |||||||||||||||||||||||||||||||
| 1760 | if (QGraphicsScene *oldScene = item->d_ptr->scene
| 0 | ||||||||||||||||||||||||||||||
| 1761 | oldScene->removeItem(item); never executed: oldScene->removeItem(item); | 0 | ||||||||||||||||||||||||||||||
| 1762 | - | |||||||||||||||||||||||||||||||
| 1763 | - | |||||||||||||||||||||||||||||||
| 1764 | - | |||||||||||||||||||||||||||||||
| 1765 | const QVariant newSceneVariant(item->itemChange(QGraphicsItem::ItemSceneChange, | - | ||||||||||||||||||||||||||||||
| 1766 | QVariant::fromValue<QGraphicsScene *>(this))); | - | ||||||||||||||||||||||||||||||
| 1767 | QGraphicsScene *targetScene = qvariant_cast<QGraphicsScene *>(newSceneVariant); | - | ||||||||||||||||||||||||||||||
| 1768 | if (targetScene != this
| 0 | ||||||||||||||||||||||||||||||
| 1769 | if (targetScene
| 0 | ||||||||||||||||||||||||||||||
| 1770 | targetScene->addItem(item); never executed: targetScene->addItem(item); | 0 | ||||||||||||||||||||||||||||||
| 1771 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1772 | } | - | ||||||||||||||||||||||||||||||
| 1773 | - | |||||||||||||||||||||||||||||||
| 1774 | - | |||||||||||||||||||||||||||||||
| 1775 | - | |||||||||||||||||||||||||||||||
| 1776 | if (!item->d_ptr->isDeclarativeItem
| 0 | ||||||||||||||||||||||||||||||
| 1777 | if (d->unpolishedItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 1778 | QMetaMethod method = metaObject()->method(d->polishItemsIndex); | - | ||||||||||||||||||||||||||||||
| 1779 | method.invoke(this, Qt::QueuedConnection); | - | ||||||||||||||||||||||||||||||
| 1780 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1781 | d->unpolishedItems.append(item); | - | ||||||||||||||||||||||||||||||
| 1782 | item->d_ptr->pendingPolish = true; | - | ||||||||||||||||||||||||||||||
| 1783 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1784 | - | |||||||||||||||||||||||||||||||
| 1785 | - | |||||||||||||||||||||||||||||||
| 1786 | - | |||||||||||||||||||||||||||||||
| 1787 | if (QGraphicsItem *itemParent = item->d_ptr->parent
| 0 | ||||||||||||||||||||||||||||||
| 1788 | if (itemParent->d_ptr->scene != this
| 0 | ||||||||||||||||||||||||||||||
| 1789 | item->setParentItem(0); never executed: item->setParentItem(0); | 0 | ||||||||||||||||||||||||||||||
| 1790 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1791 | - | |||||||||||||||||||||||||||||||
| 1792 | - | |||||||||||||||||||||||||||||||
| 1793 | item->d_func()->scene = targetScene; | - | ||||||||||||||||||||||||||||||
| 1794 | - | |||||||||||||||||||||||||||||||
| 1795 | - | |||||||||||||||||||||||||||||||
| 1796 | d->index->addItem(item); | - | ||||||||||||||||||||||||||||||
| 1797 | - | |||||||||||||||||||||||||||||||
| 1798 | - | |||||||||||||||||||||||||||||||
| 1799 | if (!item->d_ptr->parent
| 0 | ||||||||||||||||||||||||||||||
| 1800 | d->registerTopLevelItem(item); never executed: d->registerTopLevelItem(item); | 0 | ||||||||||||||||||||||||||||||
| 1801 | - | |||||||||||||||||||||||||||||||
| 1802 | - | |||||||||||||||||||||||||||||||
| 1803 | - | |||||||||||||||||||||||||||||||
| 1804 | - | |||||||||||||||||||||||||||||||
| 1805 | d->markDirty(item); | - | ||||||||||||||||||||||||||||||
| 1806 | d->dirtyGrowingItemsBoundingRect = true; | - | ||||||||||||||||||||||||||||||
| 1807 | - | |||||||||||||||||||||||||||||||
| 1808 | - | |||||||||||||||||||||||||||||||
| 1809 | ++d->selectionChanging; | - | ||||||||||||||||||||||||||||||
| 1810 | int oldSelectedItemSize = d->selectedItems.size(); | - | ||||||||||||||||||||||||||||||
| 1811 | - | |||||||||||||||||||||||||||||||
| 1812 | - | |||||||||||||||||||||||||||||||
| 1813 | if (d->allItemsIgnoreHoverEvents
| 0 | ||||||||||||||||||||||||||||||
| 1814 | d->allItemsIgnoreHoverEvents = false; | - | ||||||||||||||||||||||||||||||
| 1815 | d->enableMouseTrackingOnViews(); | - | ||||||||||||||||||||||||||||||
| 1816 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1817 | - | |||||||||||||||||||||||||||||||
| 1818 | if (d->allItemsUseDefaultCursor
| 0 | ||||||||||||||||||||||||||||||
| 1819 | d->allItemsUseDefaultCursor = false; | - | ||||||||||||||||||||||||||||||
| 1820 | if (d->allItemsIgnoreHoverEvents
| 0 | ||||||||||||||||||||||||||||||
| 1821 | d->enableMouseTrackingOnViews(); never executed: d->enableMouseTrackingOnViews(); | 0 | ||||||||||||||||||||||||||||||
| 1822 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1823 | - | |||||||||||||||||||||||||||||||
| 1824 | - | |||||||||||||||||||||||||||||||
| 1825 | - | |||||||||||||||||||||||||||||||
| 1826 | if (d->allItemsIgnoreTouchEvents
| 0 | ||||||||||||||||||||||||||||||
| 1827 | d->allItemsIgnoreTouchEvents = false; | - | ||||||||||||||||||||||||||||||
| 1828 | d->enableTouchEventsOnViews(); | - | ||||||||||||||||||||||||||||||
| 1829 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1830 | - | |||||||||||||||||||||||||||||||
| 1831 | - | |||||||||||||||||||||||||||||||
| 1832 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(item->d_ptr->gestureContext.keys())>::type> _container_((item->d_ptr->gestureContext.keys())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (Qt::GestureType gesture = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 1833 | d->grabGesture(item, gesture); never executed: d->grabGesture(item, gesture); | 0 | ||||||||||||||||||||||||||||||
| 1834 | - | |||||||||||||||||||||||||||||||
| 1835 | - | |||||||||||||||||||||||||||||||
| 1836 | - | |||||||||||||||||||||||||||||||
| 1837 | if (item->isSelected()
| 0 | ||||||||||||||||||||||||||||||
| 1838 | d->selectedItems << item; never executed: d->selectedItems << item; | 0 | ||||||||||||||||||||||||||||||
| 1839 | if (item->isWidget()
| 0 | ||||||||||||||||||||||||||||||
| 1840 | d->addPopup(static_cast<QGraphicsWidget *>(item)); never executed: d->addPopup(static_cast<QGraphicsWidget *>(item)); | 0 | ||||||||||||||||||||||||||||||
| 1841 | if (item->isPanel()
| 0 | ||||||||||||||||||||||||||||||
| 1842 | d->enterModal(item); never executed: d->enterModal(item); | 0 | ||||||||||||||||||||||||||||||
| 1843 | - | |||||||||||||||||||||||||||||||
| 1844 | - | |||||||||||||||||||||||||||||||
| 1845 | - | |||||||||||||||||||||||||||||||
| 1846 | if (item->isWidget()
| 0 | ||||||||||||||||||||||||||||||
| 1847 | QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); | - | ||||||||||||||||||||||||||||||
| 1848 | if (!d->tabFocusFirst
| 0 | ||||||||||||||||||||||||||||||
| 1849 | - | |||||||||||||||||||||||||||||||
| 1850 | - | |||||||||||||||||||||||||||||||
| 1851 | d->tabFocusFirst = widget; | - | ||||||||||||||||||||||||||||||
| 1852 | } never executed: else if (!widget->parentWidget()end of block
| 0 | ||||||||||||||||||||||||||||||
| 1853 | - | |||||||||||||||||||||||||||||||
| 1854 | QGraphicsWidget *myNewPrev = d->tabFocusFirst->d_func()->focusPrev; | - | ||||||||||||||||||||||||||||||
| 1855 | myNewPrev->d_func()->focusNext = widget; | - | ||||||||||||||||||||||||||||||
| 1856 | widget->d_func()->focusPrev->d_func()->focusNext = d->tabFocusFirst; | - | ||||||||||||||||||||||||||||||
| 1857 | d->tabFocusFirst->d_func()->focusPrev = widget->d_func()->focusPrev; | - | ||||||||||||||||||||||||||||||
| 1858 | widget->d_func()->focusPrev = myNewPrev; | - | ||||||||||||||||||||||||||||||
| 1859 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1860 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1861 | - | |||||||||||||||||||||||||||||||
| 1862 | - | |||||||||||||||||||||||||||||||
| 1863 | item->d_ptr->ensureSortedChildren(); | - | ||||||||||||||||||||||||||||||
| 1864 | for (int i = 0; i < item->d_ptr->children.size()
| 0 | ||||||||||||||||||||||||||||||
| 1865 | addItem(item->d_ptr->children.at(i)); never executed: addItem(item->d_ptr->children.at(i)); | 0 | ||||||||||||||||||||||||||||||
| 1866 | - | |||||||||||||||||||||||||||||||
| 1867 | - | |||||||||||||||||||||||||||||||
| 1868 | item->d_ptr->resolveFont(d->font.resolve()); | - | ||||||||||||||||||||||||||||||
| 1869 | item->d_ptr->resolvePalette(d->palette.resolve()); | - | ||||||||||||||||||||||||||||||
| 1870 | - | |||||||||||||||||||||||||||||||
| 1871 | - | |||||||||||||||||||||||||||||||
| 1872 | - | |||||||||||||||||||||||||||||||
| 1873 | --d->selectionChanging; | - | ||||||||||||||||||||||||||||||
| 1874 | if (!d->selectionChanging
| 0 | ||||||||||||||||||||||||||||||
| 1875 | selectionChanged(); never executed: selectionChanged(); | 0 | ||||||||||||||||||||||||||||||
| 1876 | - | |||||||||||||||||||||||||||||||
| 1877 | - | |||||||||||||||||||||||||||||||
| 1878 | item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant); | - | ||||||||||||||||||||||||||||||
| 1879 | - | |||||||||||||||||||||||||||||||
| 1880 | - | |||||||||||||||||||||||||||||||
| 1881 | bool autoActivate = true; | - | ||||||||||||||||||||||||||||||
| 1882 | if (!d->childExplicitActivation
| 0 | ||||||||||||||||||||||||||||||
| 1883 | d->childExplicitActivation = item->d_ptr->wantsActive
never executed: d->childExplicitActivation = item->d_ptr->wantsActive ? 1 : 2; | 0 | ||||||||||||||||||||||||||||||
| 1884 | if (d->childExplicitActivation
| 0 | ||||||||||||||||||||||||||||||
| 1885 | if (d->childExplicitActivation == 1
| 0 | ||||||||||||||||||||||||||||||
| 1886 | setActivePanel(item); never executed: setActivePanel(item); | 0 | ||||||||||||||||||||||||||||||
| 1887 | else | - | ||||||||||||||||||||||||||||||
| 1888 | autoActivate = false; never executed: autoActivate = false; | 0 | ||||||||||||||||||||||||||||||
| 1889 | d->childExplicitActivation = 0; | - | ||||||||||||||||||||||||||||||
| 1890 | } never executed: else if (!item->d_ptr->parentend of block
| 0 | ||||||||||||||||||||||||||||||
| 1891 | d->childExplicitActivation = 0; | - | ||||||||||||||||||||||||||||||
| 1892 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1893 | - | |||||||||||||||||||||||||||||||
| 1894 | - | |||||||||||||||||||||||||||||||
| 1895 | if (autoActivate
| 0 | ||||||||||||||||||||||||||||||
| 1896 | if (!d->lastActivePanel
| 0 | ||||||||||||||||||||||||||||||
| 1897 | if (isActive()
| 0 | ||||||||||||||||||||||||||||||
| 1898 | setActivePanel(item); never executed: setActivePanel(item); | 0 | ||||||||||||||||||||||||||||||
| 1899 | else | - | ||||||||||||||||||||||||||||||
| 1900 | d->lastActivePanel = item; never executed: d->lastActivePanel = item; | 0 | ||||||||||||||||||||||||||||||
| 1901 | } | - | ||||||||||||||||||||||||||||||
| 1902 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1903 | - | |||||||||||||||||||||||||||||||
| 1904 | if (item->d_ptr->flags & QGraphicsItem::ItemSendsScenePositionChanges
| 0 | ||||||||||||||||||||||||||||||
| 1905 | d->registerScenePosItem(item); never executed: d->registerScenePosItem(item); | 0 | ||||||||||||||||||||||||||||||
| 1906 | - | |||||||||||||||||||||||||||||||
| 1907 | - | |||||||||||||||||||||||||||||||
| 1908 | - | |||||||||||||||||||||||||||||||
| 1909 | if (!d->focusItem
| 0 | ||||||||||||||||||||||||||||||
| 1910 | item->focusItem()->setFocus(); never executed: item->focusItem()->setFocus(); | 0 | ||||||||||||||||||||||||||||||
| 1911 | - | |||||||||||||||||||||||||||||||
| 1912 | d->updateInputMethodSensitivityInViews(); | - | ||||||||||||||||||||||||||||||
| 1913 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1914 | QGraphicsEllipseItem *QGraphicsScene::addEllipse(const QRectF &rect, const QPen &pen, const QBrush &brush) | - | ||||||||||||||||||||||||||||||
| 1915 | { | - | ||||||||||||||||||||||||||||||
| 1916 | QGraphicsEllipseItem *item = new QGraphicsEllipseItem(rect); | - | ||||||||||||||||||||||||||||||
| 1917 | item->setPen(pen); | - | ||||||||||||||||||||||||||||||
| 1918 | item->setBrush(brush); | - | ||||||||||||||||||||||||||||||
| 1919 | addItem(item); | - | ||||||||||||||||||||||||||||||
| 1920 | return never executed: item;return item;never executed: return item; | 0 | ||||||||||||||||||||||||||||||
| 1921 | } | - | ||||||||||||||||||||||||||||||
| 1922 | QGraphicsLineItem *QGraphicsScene::addLine(const QLineF &line, const QPen &pen) | - | ||||||||||||||||||||||||||||||
| 1923 | { | - | ||||||||||||||||||||||||||||||
| 1924 | QGraphicsLineItem *item = new QGraphicsLineItem(line); | - | ||||||||||||||||||||||||||||||
| 1925 | item->setPen(pen); | - | ||||||||||||||||||||||||||||||
| 1926 | addItem(item); | - | ||||||||||||||||||||||||||||||
| 1927 | return never executed: item;return item;never executed: return item; | 0 | ||||||||||||||||||||||||||||||
| 1928 | } | - | ||||||||||||||||||||||||||||||
| 1929 | QGraphicsPathItem *QGraphicsScene::addPath(const QPainterPath &path, const QPen &pen, const QBrush &brush) | - | ||||||||||||||||||||||||||||||
| 1930 | { | - | ||||||||||||||||||||||||||||||
| 1931 | QGraphicsPathItem *item = new QGraphicsPathItem(path); | - | ||||||||||||||||||||||||||||||
| 1932 | item->setPen(pen); | - | ||||||||||||||||||||||||||||||
| 1933 | item->setBrush(brush); | - | ||||||||||||||||||||||||||||||
| 1934 | addItem(item); | - | ||||||||||||||||||||||||||||||
| 1935 | return never executed: item;return item;never executed: return item; | 0 | ||||||||||||||||||||||||||||||
| 1936 | } | - | ||||||||||||||||||||||||||||||
| 1937 | QGraphicsPixmapItem *QGraphicsScene::addPixmap(const QPixmap &pixmap) | - | ||||||||||||||||||||||||||||||
| 1938 | { | - | ||||||||||||||||||||||||||||||
| 1939 | QGraphicsPixmapItem *item = new QGraphicsPixmapItem(pixmap); | - | ||||||||||||||||||||||||||||||
| 1940 | addItem(item); | - | ||||||||||||||||||||||||||||||
| 1941 | return never executed: item;return item;never executed: return item; | 0 | ||||||||||||||||||||||||||||||
| 1942 | } | - | ||||||||||||||||||||||||||||||
| 1943 | QGraphicsPolygonItem *QGraphicsScene::addPolygon(const QPolygonF &polygon, | - | ||||||||||||||||||||||||||||||
| 1944 | const QPen &pen, const QBrush &brush) | - | ||||||||||||||||||||||||||||||
| 1945 | { | - | ||||||||||||||||||||||||||||||
| 1946 | QGraphicsPolygonItem *item = new QGraphicsPolygonItem(polygon); | - | ||||||||||||||||||||||||||||||
| 1947 | item->setPen(pen); | - | ||||||||||||||||||||||||||||||
| 1948 | item->setBrush(brush); | - | ||||||||||||||||||||||||||||||
| 1949 | addItem(item); | - | ||||||||||||||||||||||||||||||
| 1950 | return never executed: item;return item;never executed: return item; | 0 | ||||||||||||||||||||||||||||||
| 1951 | } | - | ||||||||||||||||||||||||||||||
| 1952 | QGraphicsRectItem *QGraphicsScene::addRect(const QRectF &rect, const QPen &pen, const QBrush &brush) | - | ||||||||||||||||||||||||||||||
| 1953 | { | - | ||||||||||||||||||||||||||||||
| 1954 | QGraphicsRectItem *item = new QGraphicsRectItem(rect); | - | ||||||||||||||||||||||||||||||
| 1955 | item->setPen(pen); | - | ||||||||||||||||||||||||||||||
| 1956 | item->setBrush(brush); | - | ||||||||||||||||||||||||||||||
| 1957 | addItem(item); | - | ||||||||||||||||||||||||||||||
| 1958 | return never executed: item;return item;never executed: return item; | 0 | ||||||||||||||||||||||||||||||
| 1959 | } | - | ||||||||||||||||||||||||||||||
| 1960 | QGraphicsTextItem *QGraphicsScene::addText(const QString &text, const QFont &font) | - | ||||||||||||||||||||||||||||||
| 1961 | { | - | ||||||||||||||||||||||||||||||
| 1962 | QGraphicsTextItem *item = new QGraphicsTextItem(text); | - | ||||||||||||||||||||||||||||||
| 1963 | item->setFont(font); | - | ||||||||||||||||||||||||||||||
| 1964 | addItem(item); | - | ||||||||||||||||||||||||||||||
| 1965 | return never executed: item;return item;never executed: return item; | 0 | ||||||||||||||||||||||||||||||
| 1966 | } | - | ||||||||||||||||||||||||||||||
| 1967 | QGraphicsSimpleTextItem *QGraphicsScene::addSimpleText(const QString &text, const QFont &font) | - | ||||||||||||||||||||||||||||||
| 1968 | { | - | ||||||||||||||||||||||||||||||
| 1969 | QGraphicsSimpleTextItem *item = new QGraphicsSimpleTextItem(text); | - | ||||||||||||||||||||||||||||||
| 1970 | item->setFont(font); | - | ||||||||||||||||||||||||||||||
| 1971 | addItem(item); | - | ||||||||||||||||||||||||||||||
| 1972 | return never executed: item;return item;never executed: return item; | 0 | ||||||||||||||||||||||||||||||
| 1973 | } | - | ||||||||||||||||||||||||||||||
| 1974 | QGraphicsProxyWidget *QGraphicsScene::addWidget(QWidget *widget, Qt::WindowFlags wFlags) | - | ||||||||||||||||||||||||||||||
| 1975 | { | - | ||||||||||||||||||||||||||||||
| 1976 | QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(0, wFlags); | - | ||||||||||||||||||||||||||||||
| 1977 | proxy->setWidget(widget); | - | ||||||||||||||||||||||||||||||
| 1978 | addItem(proxy); | - | ||||||||||||||||||||||||||||||
| 1979 | return never executed: proxy;return proxy;never executed: return proxy; | 0 | ||||||||||||||||||||||||||||||
| 1980 | } | - | ||||||||||||||||||||||||||||||
| 1981 | void QGraphicsScene::removeItem(QGraphicsItem *item) | - | ||||||||||||||||||||||||||||||
| 1982 | { | - | ||||||||||||||||||||||||||||||
| 1983 | - | |||||||||||||||||||||||||||||||
| 1984 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1985 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 1986 | QMessageLogger(__FILE__, 2894, __PRETTY_FUNCTION__).warning("QGraphicsScene::removeItem: cannot remove 0-item"); | - | ||||||||||||||||||||||||||||||
| 1987 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1988 | } | - | ||||||||||||||||||||||||||||||
| 1989 | if (item->scene() != this
| 0 | ||||||||||||||||||||||||||||||
| 1990 | QMessageLogger(__FILE__, 2898, __PRETTY_FUNCTION__).warning("QGraphicsScene::removeItem: item %p's scene (%p)" | - | ||||||||||||||||||||||||||||||
| 1991 | " is different from this scene (%p)", | - | ||||||||||||||||||||||||||||||
| 1992 | item, item->scene(), this); | - | ||||||||||||||||||||||||||||||
| 1993 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1994 | } | - | ||||||||||||||||||||||||||||||
| 1995 | - | |||||||||||||||||||||||||||||||
| 1996 | - | |||||||||||||||||||||||||||||||
| 1997 | - | |||||||||||||||||||||||||||||||
| 1998 | const QVariant newSceneVariant(item->itemChange(QGraphicsItem::ItemSceneChange, | - | ||||||||||||||||||||||||||||||
| 1999 | QVariant::fromValue<QGraphicsScene *>(0))); | - | ||||||||||||||||||||||||||||||
| 2000 | QGraphicsScene *targetScene = qvariant_cast<QGraphicsScene *>(newSceneVariant); | - | ||||||||||||||||||||||||||||||
| 2001 | if (targetScene != 0
| 0 | ||||||||||||||||||||||||||||||
| 2002 | targetScene->addItem(item); | - | ||||||||||||||||||||||||||||||
| 2003 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2004 | } | - | ||||||||||||||||||||||||||||||
| 2005 | - | |||||||||||||||||||||||||||||||
| 2006 | d->removeItemHelper(item); | - | ||||||||||||||||||||||||||||||
| 2007 | - | |||||||||||||||||||||||||||||||
| 2008 | - | |||||||||||||||||||||||||||||||
| 2009 | item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant); | - | ||||||||||||||||||||||||||||||
| 2010 | - | |||||||||||||||||||||||||||||||
| 2011 | d->updateInputMethodSensitivityInViews(); | - | ||||||||||||||||||||||||||||||
| 2012 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2013 | QGraphicsItem *QGraphicsScene::focusItem() const | - | ||||||||||||||||||||||||||||||
| 2014 | { | - | ||||||||||||||||||||||||||||||
| 2015 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2016 | return never executed: isActive()return isActive() ? d->focusItem : d->passiveFocusItem;
never executed: return isActive() ? d->focusItem : d->passiveFocusItem; | 0 | ||||||||||||||||||||||||||||||
| 2017 | } | - | ||||||||||||||||||||||||||||||
| 2018 | void QGraphicsScene::setFocusItem(QGraphicsItem *item, Qt::FocusReason focusReason) | - | ||||||||||||||||||||||||||||||
| 2019 | { | - | ||||||||||||||||||||||||||||||
| 2020 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2021 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 2022 | item->setFocus(focusReason); never executed: item->setFocus(focusReason); | 0 | ||||||||||||||||||||||||||||||
| 2023 | else | - | ||||||||||||||||||||||||||||||
| 2024 | d->setFocusItemHelper(item, focusReason); never executed: d->setFocusItemHelper(item, focusReason); | 0 | ||||||||||||||||||||||||||||||
| 2025 | } | - | ||||||||||||||||||||||||||||||
| 2026 | bool QGraphicsScene::hasFocus() const | - | ||||||||||||||||||||||||||||||
| 2027 | { | - | ||||||||||||||||||||||||||||||
| 2028 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2029 | return never executed: d->hasFocus;return d->hasFocus;never executed: return d->hasFocus; | 0 | ||||||||||||||||||||||||||||||
| 2030 | } | - | ||||||||||||||||||||||||||||||
| 2031 | void QGraphicsScene::setFocus(Qt::FocusReason focusReason) | - | ||||||||||||||||||||||||||||||
| 2032 | { | - | ||||||||||||||||||||||||||||||
| 2033 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2034 | if (d->hasFocus
| 0 | ||||||||||||||||||||||||||||||
| 2035 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2036 | QFocusEvent event(QEvent::FocusIn, focusReason); | - | ||||||||||||||||||||||||||||||
| 2037 | QCoreApplication::sendEvent(this, &event); | - | ||||||||||||||||||||||||||||||
| 2038 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2039 | void QGraphicsScene::clearFocus() | - | ||||||||||||||||||||||||||||||
| 2040 | { | - | ||||||||||||||||||||||||||||||
| 2041 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2042 | if (d->hasFocus
| 0 | ||||||||||||||||||||||||||||||
| 2043 | d->hasFocus = false; | - | ||||||||||||||||||||||||||||||
| 2044 | d->passiveFocusItem = d->focusItem; | - | ||||||||||||||||||||||||||||||
| 2045 | setFocusItem(0, Qt::OtherFocusReason); | - | ||||||||||||||||||||||||||||||
| 2046 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2047 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2048 | void QGraphicsScene::setStickyFocus(bool enabled) | - | ||||||||||||||||||||||||||||||
| 2049 | { | - | ||||||||||||||||||||||||||||||
| 2050 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2051 | d->stickyFocus = enabled; | - | ||||||||||||||||||||||||||||||
| 2052 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2053 | bool QGraphicsScene::stickyFocus() const | - | ||||||||||||||||||||||||||||||
| 2054 | { | - | ||||||||||||||||||||||||||||||
| 2055 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2056 | return never executed: d->stickyFocus;return d->stickyFocus;never executed: return d->stickyFocus; | 0 | ||||||||||||||||||||||||||||||
| 2057 | } | - | ||||||||||||||||||||||||||||||
| 2058 | QGraphicsItem *QGraphicsScene::mouseGrabberItem() const | - | ||||||||||||||||||||||||||||||
| 2059 | { | - | ||||||||||||||||||||||||||||||
| 2060 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2061 | return never executed: !d->mouseGrabberItems.isEmpty()return !d->mouseGrabberItems.isEmpty() ? d->mouseGrabberItems.last() : 0;
never executed: return !d->mouseGrabberItems.isEmpty() ? d->mouseGrabberItems.last() : 0; | 0 | ||||||||||||||||||||||||||||||
| 2062 | } | - | ||||||||||||||||||||||||||||||
| 2063 | QBrush QGraphicsScene::backgroundBrush() const | - | ||||||||||||||||||||||||||||||
| 2064 | { | - | ||||||||||||||||||||||||||||||
| 2065 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2066 | return never executed: d->backgroundBrush;return d->backgroundBrush;never executed: return d->backgroundBrush; | 0 | ||||||||||||||||||||||||||||||
| 2067 | } | - | ||||||||||||||||||||||||||||||
| 2068 | void QGraphicsScene::setBackgroundBrush(const QBrush &brush) | - | ||||||||||||||||||||||||||||||
| 2069 | { | - | ||||||||||||||||||||||||||||||
| 2070 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2071 | d->backgroundBrush = brush; | - | ||||||||||||||||||||||||||||||
| 2072 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(d->views)>::type> _container_((d->views)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsView *view = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 2073 | view->resetCachedContent(); | - | ||||||||||||||||||||||||||||||
| 2074 | view->viewport()->update(); | - | ||||||||||||||||||||||||||||||
| 2075 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2076 | update(); | - | ||||||||||||||||||||||||||||||
| 2077 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2078 | QBrush QGraphicsScene::foregroundBrush() const | - | ||||||||||||||||||||||||||||||
| 2079 | { | - | ||||||||||||||||||||||||||||||
| 2080 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2081 | return never executed: d->foregroundBrush;return d->foregroundBrush;never executed: return d->foregroundBrush; | 0 | ||||||||||||||||||||||||||||||
| 2082 | } | - | ||||||||||||||||||||||||||||||
| 2083 | void QGraphicsScene::setForegroundBrush(const QBrush &brush) | - | ||||||||||||||||||||||||||||||
| 2084 | { | - | ||||||||||||||||||||||||||||||
| 2085 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2086 | d->foregroundBrush = brush; | - | ||||||||||||||||||||||||||||||
| 2087 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(views())>::type> _container_((views())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsView *view = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 2088 | view->viewport()->update(); never executed: view->viewport()->update(); | 0 | ||||||||||||||||||||||||||||||
| 2089 | update(); | - | ||||||||||||||||||||||||||||||
| 2090 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2091 | QVariant QGraphicsScene::inputMethodQuery(Qt::InputMethodQuery query) const | - | ||||||||||||||||||||||||||||||
| 2092 | { | - | ||||||||||||||||||||||||||||||
| 2093 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2094 | if (!d->focusItem
| 0 | ||||||||||||||||||||||||||||||
| 2095 | return never executed: QVariant();return QVariant();never executed: return QVariant(); | 0 | ||||||||||||||||||||||||||||||
| 2096 | const QTransform matrix = d->focusItem->sceneTransform(); | - | ||||||||||||||||||||||||||||||
| 2097 | QVariant value = d->focusItem->inputMethodQuery(query); | - | ||||||||||||||||||||||||||||||
| 2098 | if (value.type() == QVariant::RectF
| 0 | ||||||||||||||||||||||||||||||
| 2099 | value = matrix.mapRect(value.toRectF()); never executed: value = matrix.mapRect(value.toRectF()); | 0 | ||||||||||||||||||||||||||||||
| 2100 | else if (value.type() == QVariant::PointF
| 0 | ||||||||||||||||||||||||||||||
| 2101 | value = matrix.map(value.toPointF()); never executed: value = matrix.map(value.toPointF()); | 0 | ||||||||||||||||||||||||||||||
| 2102 | else if (value.type() == QVariant::Rect
| 0 | ||||||||||||||||||||||||||||||
| 2103 | value = matrix.mapRect(value.toRect()); never executed: value = matrix.mapRect(value.toRect()); | 0 | ||||||||||||||||||||||||||||||
| 2104 | else if (value.type() == QVariant::Point
| 0 | ||||||||||||||||||||||||||||||
| 2105 | value = matrix.map(value.toPoint()); never executed: value = matrix.map(value.toPoint()); | 0 | ||||||||||||||||||||||||||||||
| 2106 | return never executed: value;return value;never executed: return value; | 0 | ||||||||||||||||||||||||||||||
| 2107 | } | - | ||||||||||||||||||||||||||||||
| 2108 | - | |||||||||||||||||||||||||||||||
| 2109 | - | |||||||||||||||||||||||||||||||
| 2110 | - | |||||||||||||||||||||||||||||||
| 2111 | - | |||||||||||||||||||||||||||||||
| 2112 | - | |||||||||||||||||||||||||||||||
| 2113 | - | |||||||||||||||||||||||||||||||
| 2114 | - | |||||||||||||||||||||||||||||||
| 2115 | void QGraphicsScene::update(const QRectF &rect) | - | ||||||||||||||||||||||||||||||
| 2116 | { | - | ||||||||||||||||||||||||||||||
| 2117 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2118 | if (d->updateAll
| 0 | ||||||||||||||||||||||||||||||
| 2119 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2120 | - | |||||||||||||||||||||||||||||||
| 2121 | - | |||||||||||||||||||||||||||||||
| 2122 | - | |||||||||||||||||||||||||||||||
| 2123 | bool directUpdates = !(d->isSignalConnected(d->changedSignalIndex))
| 0 | ||||||||||||||||||||||||||||||
| 2124 | if (rect.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 2125 | d->updateAll = true; | - | ||||||||||||||||||||||||||||||
| 2126 | d->updatedRects.clear(); | - | ||||||||||||||||||||||||||||||
| 2127 | if (directUpdates
| 0 | ||||||||||||||||||||||||||||||
| 2128 | - | |||||||||||||||||||||||||||||||
| 2129 | for (int i = 0; i < d->views.size()
| 0 | ||||||||||||||||||||||||||||||
| 2130 | d->views.at(i)->d_func()->fullUpdatePending = true; never executed: d->views.at(i)->d_func()->fullUpdatePending = true; | 0 | ||||||||||||||||||||||||||||||
| 2131 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2132 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2133 | if (directUpdates
| 0 | ||||||||||||||||||||||||||||||
| 2134 | - | |||||||||||||||||||||||||||||||
| 2135 | for (int i = 0; i < d->views.size()
| 0 | ||||||||||||||||||||||||||||||
| 2136 | QGraphicsView *view = d->views.at(i); | - | ||||||||||||||||||||||||||||||
| 2137 | if (view->isTransformed()
| 0 | ||||||||||||||||||||||||||||||
| 2138 | view->d_func()->updateRectF(view->viewportTransform().mapRect(rect)); never executed: view->d_func()->updateRectF(view->viewportTransform().mapRect(rect)); | 0 | ||||||||||||||||||||||||||||||
| 2139 | else | - | ||||||||||||||||||||||||||||||
| 2140 | view->d_func()->updateRectF(rect); never executed: view->d_func()->updateRectF(rect); | 0 | ||||||||||||||||||||||||||||||
| 2141 | } | - | ||||||||||||||||||||||||||||||
| 2142 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2143 | d->updatedRects << rect; | - | ||||||||||||||||||||||||||||||
| 2144 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2145 | } | - | ||||||||||||||||||||||||||||||
| 2146 | - | |||||||||||||||||||||||||||||||
| 2147 | if (!d->calledEmitUpdated
| 0 | ||||||||||||||||||||||||||||||
| 2148 | d->calledEmitUpdated = true; | - | ||||||||||||||||||||||||||||||
| 2149 | QMetaObject::invokeMethod(this, "_q_emitUpdated", Qt::QueuedConnection); | - | ||||||||||||||||||||||||||||||
| 2150 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2151 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2152 | void QGraphicsScene::invalidate(const QRectF &rect, SceneLayers layers) | - | ||||||||||||||||||||||||||||||
| 2153 | { | - | ||||||||||||||||||||||||||||||
| 2154 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(views())>::type> _container_((views())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsView *view = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 2155 | view->invalidateScene(rect, layers); never executed: view->invalidateScene(rect, layers); | 0 | ||||||||||||||||||||||||||||||
| 2156 | update(rect); | - | ||||||||||||||||||||||||||||||
| 2157 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2158 | QList <QGraphicsView *> QGraphicsScene::views() const | - | ||||||||||||||||||||||||||||||
| 2159 | { | - | ||||||||||||||||||||||||||||||
| 2160 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2161 | return never executed: d->views;return d->views;never executed: return d->views; | 0 | ||||||||||||||||||||||||||||||
| 2162 | } | - | ||||||||||||||||||||||||||||||
| 2163 | void QGraphicsScene::advance() | - | ||||||||||||||||||||||||||||||
| 2164 | { | - | ||||||||||||||||||||||||||||||
| 2165 | for (int i = 0; i < 2
| 0 | ||||||||||||||||||||||||||||||
| 2166 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(items())>::type> _container_((items())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 2167 | item->advance(i); never executed: item->advance(i); | 0 | ||||||||||||||||||||||||||||||
| 2168 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2169 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2170 | bool QGraphicsScene::event(QEvent *event) | - | ||||||||||||||||||||||||||||||
| 2171 | { | - | ||||||||||||||||||||||||||||||
| 2172 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2173 | - | |||||||||||||||||||||||||||||||
| 2174 | switch (event->type()) { | - | ||||||||||||||||||||||||||||||
| 2175 | case never executed: QEvent::GraphicsSceneMousePress:case QEvent::GraphicsSceneMousePress:never executed: case QEvent::GraphicsSceneMousePress: | 0 | ||||||||||||||||||||||||||||||
| 2176 | case never executed: QEvent::GraphicsSceneMouseMove:case QEvent::GraphicsSceneMouseMove:never executed: case QEvent::GraphicsSceneMouseMove: | 0 | ||||||||||||||||||||||||||||||
| 2177 | case never executed: QEvent::GraphicsSceneMouseRelease:case QEvent::GraphicsSceneMouseRelease:never executed: case QEvent::GraphicsSceneMouseRelease: | 0 | ||||||||||||||||||||||||||||||
| 2178 | case never executed: QEvent::GraphicsSceneMouseDoubleClick:case QEvent::GraphicsSceneMouseDoubleClick:never executed: case QEvent::GraphicsSceneMouseDoubleClick: | 0 | ||||||||||||||||||||||||||||||
| 2179 | case never executed: QEvent::GraphicsSceneHoverEnter:case QEvent::GraphicsSceneHoverEnter:never executed: case QEvent::GraphicsSceneHoverEnter: | 0 | ||||||||||||||||||||||||||||||
| 2180 | case never executed: QEvent::GraphicsSceneHoverLeave:case QEvent::GraphicsSceneHoverLeave:never executed: case QEvent::GraphicsSceneHoverLeave: | 0 | ||||||||||||||||||||||||||||||
| 2181 | case never executed: QEvent::GraphicsSceneHoverMove:case QEvent::GraphicsSceneHoverMove:never executed: case QEvent::GraphicsSceneHoverMove: | 0 | ||||||||||||||||||||||||||||||
| 2182 | case never executed: QEvent::TouchBegin:case QEvent::TouchBegin:never executed: case QEvent::TouchBegin: | 0 | ||||||||||||||||||||||||||||||
| 2183 | case never executed: QEvent::TouchUpdate:case QEvent::TouchUpdate:never executed: case QEvent::TouchUpdate: | 0 | ||||||||||||||||||||||||||||||
| 2184 | case never executed: QEvent::TouchEnd:case QEvent::TouchEnd:never executed: case QEvent::TouchEnd: | 0 | ||||||||||||||||||||||||||||||
| 2185 | - | |||||||||||||||||||||||||||||||
| 2186 | - | |||||||||||||||||||||||||||||||
| 2187 | - | |||||||||||||||||||||||||||||||
| 2188 | - | |||||||||||||||||||||||||||||||
| 2189 | - | |||||||||||||||||||||||||||||||
| 2190 | - | |||||||||||||||||||||||||||||||
| 2191 | - | |||||||||||||||||||||||||||||||
| 2192 | d->cachedItemsUnderMouse.clear(); | - | ||||||||||||||||||||||||||||||
| 2193 | default never executed: :default:never executed: default:code before this statement never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 2194 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2195 | } | - | ||||||||||||||||||||||||||||||
| 2196 | - | |||||||||||||||||||||||||||||||
| 2197 | switch (event->type()) { | - | ||||||||||||||||||||||||||||||
| 2198 | case never executed: QEvent::GraphicsSceneDragEnter:case QEvent::GraphicsSceneDragEnter:never executed: case QEvent::GraphicsSceneDragEnter: | 0 | ||||||||||||||||||||||||||||||
| 2199 | dragEnterEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2200 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2201 | case never executed: QEvent::GraphicsSceneDragMove:case QEvent::GraphicsSceneDragMove:never executed: case QEvent::GraphicsSceneDragMove: | 0 | ||||||||||||||||||||||||||||||
| 2202 | dragMoveEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2203 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2204 | case never executed: QEvent::GraphicsSceneDragLeave:case QEvent::GraphicsSceneDragLeave:never executed: case QEvent::GraphicsSceneDragLeave: | 0 | ||||||||||||||||||||||||||||||
| 2205 | dragLeaveEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2206 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2207 | case never executed: QEvent::GraphicsSceneDrop:case QEvent::GraphicsSceneDrop:never executed: case QEvent::GraphicsSceneDrop: | 0 | ||||||||||||||||||||||||||||||
| 2208 | dropEvent(static_cast<QGraphicsSceneDragDropEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2209 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2210 | case never executed: QEvent::GraphicsSceneContextMenu:case QEvent::GraphicsSceneContextMenu:never executed: case QEvent::GraphicsSceneContextMenu: | 0 | ||||||||||||||||||||||||||||||
| 2211 | contextMenuEvent(static_cast<QGraphicsSceneContextMenuEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2212 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2213 | case never executed: QEvent::KeyPress:case QEvent::KeyPress:never executed: case QEvent::KeyPress: | 0 | ||||||||||||||||||||||||||||||
| 2214 | if (!d->focusItem
| 0 | ||||||||||||||||||||||||||||||
| 2215 | QKeyEvent *k = static_cast<QKeyEvent *>(event); | - | ||||||||||||||||||||||||||||||
| 2216 | if (k->key() == Qt::Key_Tab
| 0 | ||||||||||||||||||||||||||||||
| 2217 | if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))
| 0 | ||||||||||||||||||||||||||||||
| 2218 | bool res = false; | - | ||||||||||||||||||||||||||||||
| 2219 | if (k->key() == Qt::Key_Backtab
| 0 | ||||||||||||||||||||||||||||||
| 2220 | || (k->key() == Qt::Key_Tab
| 0 | ||||||||||||||||||||||||||||||
| 2221 | res = focusNextPrevChild(false); | - | ||||||||||||||||||||||||||||||
| 2222 | } never executed: else if (k->key() == Qt::Key_Tabend of block
| 0 | ||||||||||||||||||||||||||||||
| 2223 | res = focusNextPrevChild(true); | - | ||||||||||||||||||||||||||||||
| 2224 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2225 | if (!res
| 0 | ||||||||||||||||||||||||||||||
| 2226 | event->ignore(); never executed: event->ignore(); | 0 | ||||||||||||||||||||||||||||||
| 2227 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2228 | } | - | ||||||||||||||||||||||||||||||
| 2229 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2230 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2231 | keyPressEvent(static_cast<QKeyEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2232 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2233 | case never executed: QEvent::KeyRelease:case QEvent::KeyRelease:never executed: case QEvent::KeyRelease: | 0 | ||||||||||||||||||||||||||||||
| 2234 | keyReleaseEvent(static_cast<QKeyEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2235 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2236 | case never executed: QEvent::ShortcutOverride:case QEvent::ShortcutOverride:never executed: {case QEvent::ShortcutOverride: | 0 | ||||||||||||||||||||||||||||||
| 2237 | QGraphicsItem *parent = focusItem(); | - | ||||||||||||||||||||||||||||||
| 2238 | while (parent
| 0 | ||||||||||||||||||||||||||||||
| 2239 | d->sendEvent(parent, event); | - | ||||||||||||||||||||||||||||||
| 2240 | if (event->isAccepted()
| 0 | ||||||||||||||||||||||||||||||
| 2241 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2242 | parent = parent->parentItem(); | - | ||||||||||||||||||||||||||||||
| 2243 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2244 | } | - | ||||||||||||||||||||||||||||||
| 2245 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2246 | case never executed: QEvent::GraphicsSceneMouseMove:case QEvent::GraphicsSceneMouseMove:never executed: case QEvent::GraphicsSceneMouseMove: | 0 | ||||||||||||||||||||||||||||||
| 2247 | { | - | ||||||||||||||||||||||||||||||
| 2248 | QGraphicsSceneMouseEvent *mouseEvent = static_cast<QGraphicsSceneMouseEvent *>(event); | - | ||||||||||||||||||||||||||||||
| 2249 | d->lastSceneMousePos = mouseEvent->scenePos(); | - | ||||||||||||||||||||||||||||||
| 2250 | mouseMoveEvent(mouseEvent); | - | ||||||||||||||||||||||||||||||
| 2251 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2252 | } | - | ||||||||||||||||||||||||||||||
| 2253 | case never executed: QEvent::GraphicsSceneMousePress:case QEvent::GraphicsSceneMousePress:never executed: case QEvent::GraphicsSceneMousePress: | 0 | ||||||||||||||||||||||||||||||
| 2254 | mousePressEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2255 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2256 | case never executed: QEvent::GraphicsSceneMouseRelease:case QEvent::GraphicsSceneMouseRelease:never executed: case QEvent::GraphicsSceneMouseRelease: | 0 | ||||||||||||||||||||||||||||||
| 2257 | mouseReleaseEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2258 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2259 | case never executed: QEvent::GraphicsSceneMouseDoubleClick:case QEvent::GraphicsSceneMouseDoubleClick:never executed: case QEvent::GraphicsSceneMouseDoubleClick: | 0 | ||||||||||||||||||||||||||||||
| 2260 | mouseDoubleClickEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2261 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2262 | case never executed: QEvent::GraphicsSceneWheel:case QEvent::GraphicsSceneWheel:never executed: case QEvent::GraphicsSceneWheel: | 0 | ||||||||||||||||||||||||||||||
| 2263 | wheelEvent(static_cast<QGraphicsSceneWheelEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2264 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2265 | case never executed: QEvent::FocusIn:case QEvent::FocusIn:never executed: case QEvent::FocusIn: | 0 | ||||||||||||||||||||||||||||||
| 2266 | focusInEvent(static_cast<QFocusEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2267 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2268 | case never executed: QEvent::FocusOut:case QEvent::FocusOut:never executed: case QEvent::FocusOut: | 0 | ||||||||||||||||||||||||||||||
| 2269 | focusOutEvent(static_cast<QFocusEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2270 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2271 | case never executed: QEvent::GraphicsSceneHoverEnter:case QEvent::GraphicsSceneHoverEnter:never executed: case QEvent::GraphicsSceneHoverEnter: | 0 | ||||||||||||||||||||||||||||||
| 2272 | case never executed: QEvent::GraphicsSceneHoverLeave:case QEvent::GraphicsSceneHoverLeave:never executed: case QEvent::GraphicsSceneHoverLeave: | 0 | ||||||||||||||||||||||||||||||
| 2273 | case never executed: QEvent::GraphicsSceneHoverMove:case QEvent::GraphicsSceneHoverMove:never executed: case QEvent::GraphicsSceneHoverMove: | 0 | ||||||||||||||||||||||||||||||
| 2274 | { | - | ||||||||||||||||||||||||||||||
| 2275 | QGraphicsSceneHoverEvent *hoverEvent = static_cast<QGraphicsSceneHoverEvent *>(event); | - | ||||||||||||||||||||||||||||||
| 2276 | d->lastSceneMousePos = hoverEvent->scenePos(); | - | ||||||||||||||||||||||||||||||
| 2277 | d->dispatchHoverEvent(hoverEvent); | - | ||||||||||||||||||||||||||||||
| 2278 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2279 | } | - | ||||||||||||||||||||||||||||||
| 2280 | case never executed: QEvent::Leave:case QEvent::Leave:never executed: case QEvent::Leave: | 0 | ||||||||||||||||||||||||||||||
| 2281 | - | |||||||||||||||||||||||||||||||
| 2282 | d->leaveScene(reinterpret_cast<QWidget *>(event->d)); | - | ||||||||||||||||||||||||||||||
| 2283 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2284 | case never executed: QEvent::GraphicsSceneHelp:case QEvent::GraphicsSceneHelp:never executed: case QEvent::GraphicsSceneHelp: | 0 | ||||||||||||||||||||||||||||||
| 2285 | helpEvent(static_cast<QGraphicsSceneHelpEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2286 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2287 | case never executed: QEvent::InputMethod:case QEvent::InputMethod:never executed: case QEvent::InputMethod: | 0 | ||||||||||||||||||||||||||||||
| 2288 | inputMethodEvent(static_cast<QInputMethodEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2289 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2290 | case never executed: QEvent::WindowActivate:case QEvent::WindowActivate:never executed: case QEvent::WindowActivate: | 0 | ||||||||||||||||||||||||||||||
| 2291 | if (!d->activationRefCount++
| 0 | ||||||||||||||||||||||||||||||
| 2292 | if (d->lastActivePanel
| 0 | ||||||||||||||||||||||||||||||
| 2293 | - | |||||||||||||||||||||||||||||||
| 2294 | d->setActivePanelHelper(d->lastActivePanel, true); | - | ||||||||||||||||||||||||||||||
| 2295 | } never executed: else if (d->tabFocusFirstend of block
| 0 | ||||||||||||||||||||||||||||||
| 2296 | - | |||||||||||||||||||||||||||||||
| 2297 | - | |||||||||||||||||||||||||||||||
| 2298 | d->setActivePanelHelper(d->tabFocusFirst, true); | - | ||||||||||||||||||||||||||||||
| 2299 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2300 | - | |||||||||||||||||||||||||||||||
| 2301 | QEvent event(QEvent::WindowActivate); | - | ||||||||||||||||||||||||||||||
| 2302 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(items())>::type> _container_((items())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 2303 | if (item->isVisible()
| 0 | ||||||||||||||||||||||||||||||
| 2304 | sendEvent(item, &event); never executed: sendEvent(item, &event); | 0 | ||||||||||||||||||||||||||||||
| 2305 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2306 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2307 | } | - | ||||||||||||||||||||||||||||||
| 2308 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2309 | case never executed: QEvent::WindowDeactivate:case QEvent::WindowDeactivate:never executed: case QEvent::WindowDeactivate: | 0 | ||||||||||||||||||||||||||||||
| 2310 | if (!--d->activationRefCount
| 0 | ||||||||||||||||||||||||||||||
| 2311 | if (d->activePanel
| 0 | ||||||||||||||||||||||||||||||
| 2312 | - | |||||||||||||||||||||||||||||||
| 2313 | - | |||||||||||||||||||||||||||||||
| 2314 | QGraphicsItem *lastActivePanel = d->activePanel; | - | ||||||||||||||||||||||||||||||
| 2315 | d->setActivePanelHelper(0, true); | - | ||||||||||||||||||||||||||||||
| 2316 | d->lastActivePanel = lastActivePanel; | - | ||||||||||||||||||||||||||||||
| 2317 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2318 | - | |||||||||||||||||||||||||||||||
| 2319 | QEvent event(QEvent::WindowDeactivate); | - | ||||||||||||||||||||||||||||||
| 2320 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(items())>::type> _container_((items())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 2321 | if (item->isVisible()
| 0 | ||||||||||||||||||||||||||||||
| 2322 | sendEvent(item, &event); never executed: sendEvent(item, &event); | 0 | ||||||||||||||||||||||||||||||
| 2323 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2324 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2325 | } | - | ||||||||||||||||||||||||||||||
| 2326 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2327 | case never executed: QEvent::ApplicationFontChange:case QEvent::ApplicationFontChange:never executed: {case QEvent::ApplicationFontChange: | 0 | ||||||||||||||||||||||||||||||
| 2328 | - | |||||||||||||||||||||||||||||||
| 2329 | d->resolveFont(); | - | ||||||||||||||||||||||||||||||
| 2330 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2331 | } | - | ||||||||||||||||||||||||||||||
| 2332 | case never executed: QEvent::FontChange:case QEvent::FontChange:never executed: case QEvent::FontChange: | 0 | ||||||||||||||||||||||||||||||
| 2333 | - | |||||||||||||||||||||||||||||||
| 2334 | update(); | - | ||||||||||||||||||||||||||||||
| 2335 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2336 | case never executed: QEvent::ApplicationPaletteChange:case QEvent::ApplicationPaletteChange:never executed: {case QEvent::ApplicationPaletteChange: | 0 | ||||||||||||||||||||||||||||||
| 2337 | - | |||||||||||||||||||||||||||||||
| 2338 | d->resolvePalette(); | - | ||||||||||||||||||||||||||||||
| 2339 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2340 | } | - | ||||||||||||||||||||||||||||||
| 2341 | case never executed: QEvent::PaletteChange:case QEvent::PaletteChange:never executed: case QEvent::PaletteChange: | 0 | ||||||||||||||||||||||||||||||
| 2342 | - | |||||||||||||||||||||||||||||||
| 2343 | update(); | - | ||||||||||||||||||||||||||||||
| 2344 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2345 | case never executed: QEvent::StyleChange:case QEvent::StyleChange:never executed: case QEvent::StyleChange: | 0 | ||||||||||||||||||||||||||||||
| 2346 | - | |||||||||||||||||||||||||||||||
| 2347 | - | |||||||||||||||||||||||||||||||
| 2348 | update(); | - | ||||||||||||||||||||||||||||||
| 2349 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2350 | case never executed: QEvent::StyleAnimationUpdate:case QEvent::StyleAnimationUpdate:never executed: case QEvent::StyleAnimationUpdate: | 0 | ||||||||||||||||||||||||||||||
| 2351 | - | |||||||||||||||||||||||||||||||
| 2352 | - | |||||||||||||||||||||||||||||||
| 2353 | update(); | - | ||||||||||||||||||||||||||||||
| 2354 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2355 | case never executed: QEvent::TouchBegin:case QEvent::TouchBegin:never executed: case QEvent::TouchBegin: | 0 | ||||||||||||||||||||||||||||||
| 2356 | case never executed: QEvent::TouchUpdate:case QEvent::TouchUpdate:never executed: case QEvent::TouchUpdate: | 0 | ||||||||||||||||||||||||||||||
| 2357 | case never executed: QEvent::TouchEnd:case QEvent::TouchEnd:never executed: case QEvent::TouchEnd: | 0 | ||||||||||||||||||||||||||||||
| 2358 | d->touchEventHandler(static_cast<QTouchEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2359 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2360 | - | |||||||||||||||||||||||||||||||
| 2361 | case never executed: QEvent::Gesture:case QEvent::Gesture:never executed: case QEvent::Gesture: | 0 | ||||||||||||||||||||||||||||||
| 2362 | case never executed: QEvent::GestureOverride:case QEvent::GestureOverride:never executed: case QEvent::GestureOverride: | 0 | ||||||||||||||||||||||||||||||
| 2363 | d->gestureEventHandler(static_cast<QGestureEvent *>(event)); | - | ||||||||||||||||||||||||||||||
| 2364 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2365 | - | |||||||||||||||||||||||||||||||
| 2366 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 2367 | return never executed: QObject::event(event);return QObject::event(event);never executed: return QObject::event(event); | 0 | ||||||||||||||||||||||||||||||
| 2368 | } | - | ||||||||||||||||||||||||||||||
| 2369 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2370 | } | - | ||||||||||||||||||||||||||||||
| 2371 | - | |||||||||||||||||||||||||||||||
| 2372 | - | |||||||||||||||||||||||||||||||
| 2373 | - | |||||||||||||||||||||||||||||||
| 2374 | - | |||||||||||||||||||||||||||||||
| 2375 | - | |||||||||||||||||||||||||||||||
| 2376 | - | |||||||||||||||||||||||||||||||
| 2377 | - | |||||||||||||||||||||||||||||||
| 2378 | bool QGraphicsScene::eventFilter(QObject *watched, QEvent *event) | - | ||||||||||||||||||||||||||||||
| 2379 | { | - | ||||||||||||||||||||||||||||||
| 2380 | if (watched != (static_cast<QApplication *>(QCoreApplication::instance()))
| 0 | ||||||||||||||||||||||||||||||
| 2381 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2382 | - | |||||||||||||||||||||||||||||||
| 2383 | switch (event->type()) { | - | ||||||||||||||||||||||||||||||
| 2384 | case never executed: QEvent::ApplicationPaletteChange:case QEvent::ApplicationPaletteChange:never executed: case QEvent::ApplicationPaletteChange: | 0 | ||||||||||||||||||||||||||||||
| 2385 | QApplication::postEvent(this, new QEvent(QEvent::ApplicationPaletteChange)); | - | ||||||||||||||||||||||||||||||
| 2386 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2387 | case never executed: QEvent::ApplicationFontChange:case QEvent::ApplicationFontChange:never executed: case QEvent::ApplicationFontChange: | 0 | ||||||||||||||||||||||||||||||
| 2388 | QApplication::postEvent(this, new QEvent(QEvent::ApplicationFontChange)); | - | ||||||||||||||||||||||||||||||
| 2389 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2390 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 2391 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2392 | } | - | ||||||||||||||||||||||||||||||
| 2393 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2394 | } | - | ||||||||||||||||||||||||||||||
| 2395 | void QGraphicsScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent) | - | ||||||||||||||||||||||||||||||
| 2396 | { | - | ||||||||||||||||||||||||||||||
| 2397 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2398 | - | |||||||||||||||||||||||||||||||
| 2399 | contextMenuEvent->ignore(); | - | ||||||||||||||||||||||||||||||
| 2400 | - | |||||||||||||||||||||||||||||||
| 2401 | - | |||||||||||||||||||||||||||||||
| 2402 | - | |||||||||||||||||||||||||||||||
| 2403 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(d->itemsAtPosition(contextMenuEvent->screenPos(), contextMenuEvent->scenePos(), contextMenuEvent->widget()))>::type> _container_((d->itemsAtPosition(contextMenuEvent->screenPos(), contextMenuEvent->scenePos(), contextMenuEvent->widget()))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 2404 | - | |||||||||||||||||||||||||||||||
| 2405 | { | - | ||||||||||||||||||||||||||||||
| 2406 | contextMenuEvent->setPos(item->d_ptr->genericMapFromScene(contextMenuEvent->scenePos(), | - | ||||||||||||||||||||||||||||||
| 2407 | contextMenuEvent->widget())); | - | ||||||||||||||||||||||||||||||
| 2408 | contextMenuEvent->accept(); | - | ||||||||||||||||||||||||||||||
| 2409 | if (!d->sendEvent(item, contextMenuEvent)
| 0 | ||||||||||||||||||||||||||||||
| 2410 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2411 | - | |||||||||||||||||||||||||||||||
| 2412 | if (contextMenuEvent->isAccepted()
| 0 | ||||||||||||||||||||||||||||||
| 2413 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2414 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2415 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2416 | void QGraphicsScene::dragEnterEvent(QGraphicsSceneDragDropEvent *event) | - | ||||||||||||||||||||||||||||||
| 2417 | { | - | ||||||||||||||||||||||||||||||
| 2418 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2419 | d->dragDropItem = 0; | - | ||||||||||||||||||||||||||||||
| 2420 | d->lastDropAction = Qt::IgnoreAction; | - | ||||||||||||||||||||||||||||||
| 2421 | event->accept(); | - | ||||||||||||||||||||||||||||||
| 2422 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2423 | void QGraphicsScene::dragMoveEvent(QGraphicsSceneDragDropEvent *event) | - | ||||||||||||||||||||||||||||||
| 2424 | { | - | ||||||||||||||||||||||||||||||
| 2425 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2426 | event->ignore(); | - | ||||||||||||||||||||||||||||||
| 2427 | - | |||||||||||||||||||||||||||||||
| 2428 | if (!d->mouseGrabberItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2429 | - | |||||||||||||||||||||||||||||||
| 2430 | d->clearMouseGrabber(); | - | ||||||||||||||||||||||||||||||
| 2431 | d->mouseGrabberButtonDownPos.clear(); | - | ||||||||||||||||||||||||||||||
| 2432 | d->mouseGrabberButtonDownScenePos.clear(); | - | ||||||||||||||||||||||||||||||
| 2433 | d->mouseGrabberButtonDownScreenPos.clear(); | - | ||||||||||||||||||||||||||||||
| 2434 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2435 | - | |||||||||||||||||||||||||||||||
| 2436 | bool eventDelivered = false; | - | ||||||||||||||||||||||||||||||
| 2437 | - | |||||||||||||||||||||||||||||||
| 2438 | - | |||||||||||||||||||||||||||||||
| 2439 | - | |||||||||||||||||||||||||||||||
| 2440 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(d->itemsAtPosition(event->screenPos(), event->scenePos(), event->widget()))>::type> _container_((d->itemsAtPosition(event->screenPos(), event->scenePos(), event->widget()))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 2441 | - | |||||||||||||||||||||||||||||||
| 2442 | { | - | ||||||||||||||||||||||||||||||
| 2443 | if (!item->isEnabled()
| 0 | ||||||||||||||||||||||||||||||
| 2444 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2445 | - | |||||||||||||||||||||||||||||||
| 2446 | if (item != d->dragDropItem
| 0 | ||||||||||||||||||||||||||||||
| 2447 | - | |||||||||||||||||||||||||||||||
| 2448 | - | |||||||||||||||||||||||||||||||
| 2449 | QGraphicsSceneDragDropEvent dragEnter(QEvent::GraphicsSceneDragEnter); | - | ||||||||||||||||||||||||||||||
| 2450 | d->cloneDragDropEvent(&dragEnter, event); | - | ||||||||||||||||||||||||||||||
| 2451 | dragEnter.setDropAction(event->proposedAction()); | - | ||||||||||||||||||||||||||||||
| 2452 | d->sendDragDropEvent(item, &dragEnter); | - | ||||||||||||||||||||||||||||||
| 2453 | event->setAccepted(dragEnter.isAccepted()); | - | ||||||||||||||||||||||||||||||
| 2454 | event->setDropAction(dragEnter.dropAction()); | - | ||||||||||||||||||||||||||||||
| 2455 | if (!event->isAccepted()
| 0 | ||||||||||||||||||||||||||||||
| 2456 | - | |||||||||||||||||||||||||||||||
| 2457 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2458 | } | - | ||||||||||||||||||||||||||||||
| 2459 | - | |||||||||||||||||||||||||||||||
| 2460 | d->lastDropAction = event->dropAction(); | - | ||||||||||||||||||||||||||||||
| 2461 | - | |||||||||||||||||||||||||||||||
| 2462 | if (d->dragDropItem
| 0 | ||||||||||||||||||||||||||||||
| 2463 | - | |||||||||||||||||||||||||||||||
| 2464 | - | |||||||||||||||||||||||||||||||
| 2465 | - | |||||||||||||||||||||||||||||||
| 2466 | - | |||||||||||||||||||||||||||||||
| 2467 | QGraphicsSceneDragDropEvent dragLeave(QEvent::GraphicsSceneDragLeave); | - | ||||||||||||||||||||||||||||||
| 2468 | d->cloneDragDropEvent(&dragLeave, event); | - | ||||||||||||||||||||||||||||||
| 2469 | d->sendDragDropEvent(d->dragDropItem, &dragLeave); | - | ||||||||||||||||||||||||||||||
| 2470 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2471 | - | |||||||||||||||||||||||||||||||
| 2472 | - | |||||||||||||||||||||||||||||||
| 2473 | d->dragDropItem = item; | - | ||||||||||||||||||||||||||||||
| 2474 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2475 | - | |||||||||||||||||||||||||||||||
| 2476 | - | |||||||||||||||||||||||||||||||
| 2477 | event->setDropAction(d->lastDropAction); | - | ||||||||||||||||||||||||||||||
| 2478 | event->accept(); | - | ||||||||||||||||||||||||||||||
| 2479 | d->sendDragDropEvent(item, event); | - | ||||||||||||||||||||||||||||||
| 2480 | if (event->isAccepted()
| 0 | ||||||||||||||||||||||||||||||
| 2481 | d->lastDropAction = event->dropAction(); never executed: d->lastDropAction = event->dropAction(); | 0 | ||||||||||||||||||||||||||||||
| 2482 | eventDelivered = true; | - | ||||||||||||||||||||||||||||||
| 2483 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2484 | } | - | ||||||||||||||||||||||||||||||
| 2485 | - | |||||||||||||||||||||||||||||||
| 2486 | if (!eventDelivered
| 0 | ||||||||||||||||||||||||||||||
| 2487 | if (d->dragDropItem
| 0 | ||||||||||||||||||||||||||||||
| 2488 | - | |||||||||||||||||||||||||||||||
| 2489 | QGraphicsSceneDragDropEvent dragLeave(QEvent::GraphicsSceneDragLeave); | - | ||||||||||||||||||||||||||||||
| 2490 | d->cloneDragDropEvent(&dragLeave, event); | - | ||||||||||||||||||||||||||||||
| 2491 | d->sendDragDropEvent(d->dragDropItem, &dragLeave); | - | ||||||||||||||||||||||||||||||
| 2492 | d->dragDropItem = 0; | - | ||||||||||||||||||||||||||||||
| 2493 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2494 | - | |||||||||||||||||||||||||||||||
| 2495 | event->setDropAction(Qt::IgnoreAction); | - | ||||||||||||||||||||||||||||||
| 2496 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2497 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2498 | void QGraphicsScene::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) | - | ||||||||||||||||||||||||||||||
| 2499 | { | - | ||||||||||||||||||||||||||||||
| 2500 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2501 | if (d->dragDropItem
| 0 | ||||||||||||||||||||||||||||||
| 2502 | - | |||||||||||||||||||||||||||||||
| 2503 | d->sendDragDropEvent(d->dragDropItem, event); | - | ||||||||||||||||||||||||||||||
| 2504 | d->dragDropItem = 0; | - | ||||||||||||||||||||||||||||||
| 2505 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2506 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2507 | void QGraphicsScene::dropEvent(QGraphicsSceneDragDropEvent *event) | - | ||||||||||||||||||||||||||||||
| 2508 | { | - | ||||||||||||||||||||||||||||||
| 2509 | (void)event;; | - | ||||||||||||||||||||||||||||||
| 2510 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2511 | if (d->dragDropItem
| 0 | ||||||||||||||||||||||||||||||
| 2512 | - | |||||||||||||||||||||||||||||||
| 2513 | d->sendDragDropEvent(d->dragDropItem, event); | - | ||||||||||||||||||||||||||||||
| 2514 | d->dragDropItem = 0; | - | ||||||||||||||||||||||||||||||
| 2515 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2516 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2517 | void QGraphicsScene::focusInEvent(QFocusEvent *focusEvent) | - | ||||||||||||||||||||||||||||||
| 2518 | { | - | ||||||||||||||||||||||||||||||
| 2519 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2520 | - | |||||||||||||||||||||||||||||||
| 2521 | d->hasFocus = true; | - | ||||||||||||||||||||||||||||||
| 2522 | switch (focusEvent->reason()) { | - | ||||||||||||||||||||||||||||||
| 2523 | case never executed: Qt::TabFocusReason:case Qt::TabFocusReason:never executed: case Qt::TabFocusReason: | 0 | ||||||||||||||||||||||||||||||
| 2524 | if (!focusNextPrevChild(true)
| 0 | ||||||||||||||||||||||||||||||
| 2525 | focusEvent->ignore(); never executed: focusEvent->ignore(); | 0 | ||||||||||||||||||||||||||||||
| 2526 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2527 | case never executed: Qt::BacktabFocusReason:case Qt::BacktabFocusReason:never executed: case Qt::BacktabFocusReason: | 0 | ||||||||||||||||||||||||||||||
| 2528 | if (!focusNextPrevChild(false)
| 0 | ||||||||||||||||||||||||||||||
| 2529 | focusEvent->ignore(); never executed: focusEvent->ignore(); | 0 | ||||||||||||||||||||||||||||||
| 2530 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2531 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 2532 | if (d->passiveFocusItem
| 0 | ||||||||||||||||||||||||||||||
| 2533 | - | |||||||||||||||||||||||||||||||
| 2534 | setFocusItem(d->passiveFocusItem, focusEvent->reason()); | - | ||||||||||||||||||||||||||||||
| 2535 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2536 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2537 | } | - | ||||||||||||||||||||||||||||||
| 2538 | } | - | ||||||||||||||||||||||||||||||
| 2539 | void QGraphicsScene::focusOutEvent(QFocusEvent *focusEvent) | - | ||||||||||||||||||||||||||||||
| 2540 | { | - | ||||||||||||||||||||||||||||||
| 2541 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2542 | d->hasFocus = false; | - | ||||||||||||||||||||||||||||||
| 2543 | d->passiveFocusItem = d->focusItem; | - | ||||||||||||||||||||||||||||||
| 2544 | setFocusItem(0, focusEvent->reason()); | - | ||||||||||||||||||||||||||||||
| 2545 | - | |||||||||||||||||||||||||||||||
| 2546 | - | |||||||||||||||||||||||||||||||
| 2547 | if (!d->popupWidgets.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2548 | d->removePopup(d->popupWidgets.first()); never executed: d->removePopup(d->popupWidgets.first()); | 0 | ||||||||||||||||||||||||||||||
| 2549 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2550 | void QGraphicsScene::helpEvent(QGraphicsSceneHelpEvent *helpEvent) | - | ||||||||||||||||||||||||||||||
| 2551 | { | - | ||||||||||||||||||||||||||||||
| 2552 | - | |||||||||||||||||||||||||||||||
| 2553 | - | |||||||||||||||||||||||||||||||
| 2554 | - | |||||||||||||||||||||||||||||||
| 2555 | - | |||||||||||||||||||||||||||||||
| 2556 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2557 | QList<QGraphicsItem *> itemsAtPos = d->itemsAtPosition(helpEvent->screenPos(), | - | ||||||||||||||||||||||||||||||
| 2558 | helpEvent->scenePos(), | - | ||||||||||||||||||||||||||||||
| 2559 | helpEvent->widget()); | - | ||||||||||||||||||||||||||||||
| 2560 | QGraphicsItem *toolTipItem = 0; | - | ||||||||||||||||||||||||||||||
| 2561 | for (int i = 0; i < itemsAtPos.size()
| 0 | ||||||||||||||||||||||||||||||
| 2562 | QGraphicsItem *tmp = itemsAtPos.at(i); | - | ||||||||||||||||||||||||||||||
| 2563 | if (tmp->d_func()->isProxyWidget()
| 0 | ||||||||||||||||||||||||||||||
| 2564 | - | |||||||||||||||||||||||||||||||
| 2565 | sendEvent(tmp, helpEvent); | - | ||||||||||||||||||||||||||||||
| 2566 | if (helpEvent->isAccepted()
| 0 | ||||||||||||||||||||||||||||||
| 2567 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2568 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2569 | if (!tmp->toolTip().isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2570 | toolTipItem = tmp; | - | ||||||||||||||||||||||||||||||
| 2571 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2572 | } | - | ||||||||||||||||||||||||||||||
| 2573 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2574 | - | |||||||||||||||||||||||||||||||
| 2575 | - | |||||||||||||||||||||||||||||||
| 2576 | QString text; | - | ||||||||||||||||||||||||||||||
| 2577 | QPoint point; | - | ||||||||||||||||||||||||||||||
| 2578 | if (toolTipItem
| 0 | ||||||||||||||||||||||||||||||
| 2579 | text = toolTipItem->toolTip(); | - | ||||||||||||||||||||||||||||||
| 2580 | point = helpEvent->screenPos(); | - | ||||||||||||||||||||||||||||||
| 2581 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2582 | QToolTip::showText(point, text, helpEvent->widget()); | - | ||||||||||||||||||||||||||||||
| 2583 | helpEvent->setAccepted(!text.isEmpty()); | - | ||||||||||||||||||||||||||||||
| 2584 | - | |||||||||||||||||||||||||||||||
| 2585 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2586 | - | |||||||||||||||||||||||||||||||
| 2587 | bool QGraphicsScenePrivate::itemAcceptsHoverEvents_helper(const QGraphicsItem *item) const | - | ||||||||||||||||||||||||||||||
| 2588 | { | - | ||||||||||||||||||||||||||||||
| 2589 | return never executed: (item->d_ptr->acceptsHoverreturn (item->d_ptr->acceptsHover || (item->d_ptr->isWidget && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration())) && !item->isBlockedByModalPanel();
never executed: return (item->d_ptr->acceptsHover || (item->d_ptr->isWidget && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration())) && !item->isBlockedByModalPanel(); | 0 | ||||||||||||||||||||||||||||||
| 2590 | || (item->d_ptr->isWidget
never executed: return (item->d_ptr->acceptsHover || (item->d_ptr->isWidget && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration())) && !item->isBlockedByModalPanel(); | 0 | ||||||||||||||||||||||||||||||
| 2591 | && static_cast<const
never executed: return (item->d_ptr->acceptsHover || (item->d_ptr->isWidget && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration())) && !item->isBlockedByModalPanel(); | 0 | ||||||||||||||||||||||||||||||
| 2592 | && !item->isBlockedByModalPanel()
never executed: return (item->d_ptr->acceptsHover || (item->d_ptr->isWidget && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration())) && !item->isBlockedByModalPanel(); | 0 | ||||||||||||||||||||||||||||||
| 2593 | } | - | ||||||||||||||||||||||||||||||
| 2594 | bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEvent) | - | ||||||||||||||||||||||||||||||
| 2595 | { | - | ||||||||||||||||||||||||||||||
| 2596 | if (allItemsIgnoreHoverEvents
| 0 | ||||||||||||||||||||||||||||||
| 2597 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2598 | - | |||||||||||||||||||||||||||||||
| 2599 | - | |||||||||||||||||||||||||||||||
| 2600 | - | |||||||||||||||||||||||||||||||
| 2601 | if (cachedItemsUnderMouse.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2602 | cachedItemsUnderMouse = itemsAtPosition(hoverEvent->screenPos(), | - | ||||||||||||||||||||||||||||||
| 2603 | hoverEvent->scenePos(), | - | ||||||||||||||||||||||||||||||
| 2604 | hoverEvent->widget()); | - | ||||||||||||||||||||||||||||||
| 2605 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2606 | - | |||||||||||||||||||||||||||||||
| 2607 | QGraphicsItem *item = 0; | - | ||||||||||||||||||||||||||||||
| 2608 | for (int i = 0; i < cachedItemsUnderMouse.size()
| 0 | ||||||||||||||||||||||||||||||
| 2609 | QGraphicsItem *tmp = cachedItemsUnderMouse.at(i); | - | ||||||||||||||||||||||||||||||
| 2610 | if (itemAcceptsHoverEvents_helper(tmp)
| 0 | ||||||||||||||||||||||||||||||
| 2611 | item = tmp; | - | ||||||||||||||||||||||||||||||
| 2612 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2613 | } | - | ||||||||||||||||||||||||||||||
| 2614 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2615 | - | |||||||||||||||||||||||||||||||
| 2616 | - | |||||||||||||||||||||||||||||||
| 2617 | - | |||||||||||||||||||||||||||||||
| 2618 | QGraphicsItem *commonAncestorItem = (item
| 0 | ||||||||||||||||||||||||||||||
| 2619 | while (commonAncestorItem
| 0 | ||||||||||||||||||||||||||||||
| 2620 | commonAncestorItem = commonAncestorItem->parentItem(); never executed: commonAncestorItem = commonAncestorItem->parentItem(); | 0 | ||||||||||||||||||||||||||||||
| 2621 | if (commonAncestorItem
| 0 | ||||||||||||||||||||||||||||||
| 2622 | - | |||||||||||||||||||||||||||||||
| 2623 | - | |||||||||||||||||||||||||||||||
| 2624 | commonAncestorItem = 0; | - | ||||||||||||||||||||||||||||||
| 2625 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2626 | - | |||||||||||||||||||||||||||||||
| 2627 | - | |||||||||||||||||||||||||||||||
| 2628 | int index = commonAncestorItem
| 0 | ||||||||||||||||||||||||||||||
| 2629 | - | |||||||||||||||||||||||||||||||
| 2630 | - | |||||||||||||||||||||||||||||||
| 2631 | for (int i = hoverItems.size() - 1; i > index
| 0 | ||||||||||||||||||||||||||||||
| 2632 | QGraphicsItem *lastItem = hoverItems.takeLast(); | - | ||||||||||||||||||||||||||||||
| 2633 | if (itemAcceptsHoverEvents_helper(lastItem)
| 0 | ||||||||||||||||||||||||||||||
| 2634 | sendHoverEvent(QEvent::GraphicsSceneHoverLeave, lastItem, hoverEvent); never executed: sendHoverEvent(QEvent::GraphicsSceneHoverLeave, lastItem, hoverEvent); | 0 | ||||||||||||||||||||||||||||||
| 2635 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2636 | - | |||||||||||||||||||||||||||||||
| 2637 | - | |||||||||||||||||||||||||||||||
| 2638 | - | |||||||||||||||||||||||||||||||
| 2639 | QList<QGraphicsItem *> parents; | - | ||||||||||||||||||||||||||||||
| 2640 | QGraphicsItem *parent = item; | - | ||||||||||||||||||||||||||||||
| 2641 | while (parent
| 0 | ||||||||||||||||||||||||||||||
| 2642 | parents.prepend(parent); | - | ||||||||||||||||||||||||||||||
| 2643 | if (parent->isPanel()
| 0 | ||||||||||||||||||||||||||||||
| 2644 | - | |||||||||||||||||||||||||||||||
| 2645 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2646 | } | - | ||||||||||||||||||||||||||||||
| 2647 | parent = parent->parentItem(); | - | ||||||||||||||||||||||||||||||
| 2648 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2649 | for (int i = 0; i < parents.size()
| 0 | ||||||||||||||||||||||||||||||
| 2650 | parent = parents.at(i); | - | ||||||||||||||||||||||||||||||
| 2651 | hoverItems << parent; | - | ||||||||||||||||||||||||||||||
| 2652 | if (itemAcceptsHoverEvents_helper(parent)
| 0 | ||||||||||||||||||||||||||||||
| 2653 | sendHoverEvent(QEvent::GraphicsSceneHoverEnter, parent, hoverEvent); never executed: sendHoverEvent(QEvent::GraphicsSceneHoverEnter, parent, hoverEvent); | 0 | ||||||||||||||||||||||||||||||
| 2654 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2655 | - | |||||||||||||||||||||||||||||||
| 2656 | - | |||||||||||||||||||||||||||||||
| 2657 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 2658 | && !hoverItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2659 | && item == hoverItems.last()
| 0 | ||||||||||||||||||||||||||||||
| 2660 | sendHoverEvent(QEvent::GraphicsSceneHoverMove, item, hoverEvent); | - | ||||||||||||||||||||||||||||||
| 2661 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2662 | } | - | ||||||||||||||||||||||||||||||
| 2663 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2664 | } | - | ||||||||||||||||||||||||||||||
| 2665 | - | |||||||||||||||||||||||||||||||
| 2666 | - | |||||||||||||||||||||||||||||||
| 2667 | - | |||||||||||||||||||||||||||||||
| 2668 | - | |||||||||||||||||||||||||||||||
| 2669 | - | |||||||||||||||||||||||||||||||
| 2670 | - | |||||||||||||||||||||||||||||||
| 2671 | - | |||||||||||||||||||||||||||||||
| 2672 | void QGraphicsScenePrivate::leaveScene(QWidget *viewport) | - | ||||||||||||||||||||||||||||||
| 2673 | { | - | ||||||||||||||||||||||||||||||
| 2674 | - | |||||||||||||||||||||||||||||||
| 2675 | QToolTip::hideText(); | - | ||||||||||||||||||||||||||||||
| 2676 | - | |||||||||||||||||||||||||||||||
| 2677 | QGraphicsView *view = qobject_cast<QGraphicsView *>(viewport->parent()); | - | ||||||||||||||||||||||||||||||
| 2678 | - | |||||||||||||||||||||||||||||||
| 2679 | QGraphicsSceneHoverEvent hoverEvent; | - | ||||||||||||||||||||||||||||||
| 2680 | hoverEvent.setWidget(viewport); | - | ||||||||||||||||||||||||||||||
| 2681 | - | |||||||||||||||||||||||||||||||
| 2682 | if (view
| 0 | ||||||||||||||||||||||||||||||
| 2683 | QPoint cursorPos = QCursor::pos(); | - | ||||||||||||||||||||||||||||||
| 2684 | hoverEvent.setScenePos(view->mapToScene(viewport->mapFromGlobal(cursorPos))); | - | ||||||||||||||||||||||||||||||
| 2685 | hoverEvent.setLastScenePos(hoverEvent.scenePos()); | - | ||||||||||||||||||||||||||||||
| 2686 | hoverEvent.setScreenPos(cursorPos); | - | ||||||||||||||||||||||||||||||
| 2687 | hoverEvent.setLastScreenPos(hoverEvent.screenPos()); | - | ||||||||||||||||||||||||||||||
| 2688 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2689 | - | |||||||||||||||||||||||||||||||
| 2690 | while (!hoverItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2691 | QGraphicsItem *lastItem = hoverItems.takeLast(); | - | ||||||||||||||||||||||||||||||
| 2692 | if (itemAcceptsHoverEvents_helper(lastItem)
| 0 | ||||||||||||||||||||||||||||||
| 2693 | sendHoverEvent(QEvent::GraphicsSceneHoverLeave, lastItem, &hoverEvent); never executed: sendHoverEvent(QEvent::GraphicsSceneHoverLeave, lastItem, &hoverEvent); | 0 | ||||||||||||||||||||||||||||||
| 2694 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2695 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2696 | void QGraphicsScene::keyPressEvent(QKeyEvent *keyEvent) | - | ||||||||||||||||||||||||||||||
| 2697 | { | - | ||||||||||||||||||||||||||||||
| 2698 | - | |||||||||||||||||||||||||||||||
| 2699 | - | |||||||||||||||||||||||||||||||
| 2700 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2701 | QGraphicsItem *item = !d->keyboardGrabberItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2702 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 2703 | item = focusItem(); never executed: item = focusItem(); | 0 | ||||||||||||||||||||||||||||||
| 2704 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 2705 | QGraphicsItem *p = item; | - | ||||||||||||||||||||||||||||||
| 2706 | do { | - | ||||||||||||||||||||||||||||||
| 2707 | - | |||||||||||||||||||||||||||||||
| 2708 | keyEvent->accept(); | - | ||||||||||||||||||||||||||||||
| 2709 | - | |||||||||||||||||||||||||||||||
| 2710 | - | |||||||||||||||||||||||||||||||
| 2711 | if (p->isBlockedByModalPanel()
| 0 | ||||||||||||||||||||||||||||||
| 2712 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2713 | if (!d->sendEvent(p, keyEvent)
| 0 | ||||||||||||||||||||||||||||||
| 2714 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2715 | } never executed: while (!keyEvent->isAccepted()end of block
| 0 | ||||||||||||||||||||||||||||||
| 2716 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2717 | keyEvent->ignore(); | - | ||||||||||||||||||||||||||||||
| 2718 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2719 | } | - | ||||||||||||||||||||||||||||||
| 2720 | void QGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent) | - | ||||||||||||||||||||||||||||||
| 2721 | { | - | ||||||||||||||||||||||||||||||
| 2722 | - | |||||||||||||||||||||||||||||||
| 2723 | - | |||||||||||||||||||||||||||||||
| 2724 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2725 | QGraphicsItem *item = !d->keyboardGrabberItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2726 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 2727 | item = focusItem(); never executed: item = focusItem(); | 0 | ||||||||||||||||||||||||||||||
| 2728 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 2729 | QGraphicsItem *p = item; | - | ||||||||||||||||||||||||||||||
| 2730 | do { | - | ||||||||||||||||||||||||||||||
| 2731 | - | |||||||||||||||||||||||||||||||
| 2732 | keyEvent->accept(); | - | ||||||||||||||||||||||||||||||
| 2733 | - | |||||||||||||||||||||||||||||||
| 2734 | - | |||||||||||||||||||||||||||||||
| 2735 | if (p->isBlockedByModalPanel()
| 0 | ||||||||||||||||||||||||||||||
| 2736 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2737 | if (!d->sendEvent(p, keyEvent)
| 0 | ||||||||||||||||||||||||||||||
| 2738 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2739 | } never executed: while (!keyEvent->isAccepted()end of block
| 0 | ||||||||||||||||||||||||||||||
| 2740 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2741 | keyEvent->ignore(); | - | ||||||||||||||||||||||||||||||
| 2742 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2743 | } | - | ||||||||||||||||||||||||||||||
| 2744 | void QGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||||||||
| 2745 | { | - | ||||||||||||||||||||||||||||||
| 2746 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2747 | if (d->mouseGrabberItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2748 | - | |||||||||||||||||||||||||||||||
| 2749 | QGraphicsSceneHoverEvent hover; | - | ||||||||||||||||||||||||||||||
| 2750 | _q_hoverFromMouseEvent(&hover, mouseEvent); | - | ||||||||||||||||||||||||||||||
| 2751 | d->dispatchHoverEvent(&hover); | - | ||||||||||||||||||||||||||||||
| 2752 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2753 | - | |||||||||||||||||||||||||||||||
| 2754 | d->mousePressEventHandler(mouseEvent); | - | ||||||||||||||||||||||||||||||
| 2755 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2756 | void QGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||||||||
| 2757 | { | - | ||||||||||||||||||||||||||||||
| 2758 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2759 | if (d->mouseGrabberItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2760 | if (mouseEvent->buttons()
| 0 | ||||||||||||||||||||||||||||||
| 2761 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2762 | QGraphicsSceneHoverEvent hover; | - | ||||||||||||||||||||||||||||||
| 2763 | _q_hoverFromMouseEvent(&hover, mouseEvent); | - | ||||||||||||||||||||||||||||||
| 2764 | mouseEvent->setAccepted(d->dispatchHoverEvent(&hover)); | - | ||||||||||||||||||||||||||||||
| 2765 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2766 | } | - | ||||||||||||||||||||||||||||||
| 2767 | - | |||||||||||||||||||||||||||||||
| 2768 | - | |||||||||||||||||||||||||||||||
| 2769 | d->sendMouseEvent(mouseEvent); | - | ||||||||||||||||||||||||||||||
| 2770 | mouseEvent->accept(); | - | ||||||||||||||||||||||||||||||
| 2771 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2772 | void QGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||||||||
| 2773 | { | - | ||||||||||||||||||||||||||||||
| 2774 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2775 | if (d->mouseGrabberItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2776 | mouseEvent->ignore(); | - | ||||||||||||||||||||||||||||||
| 2777 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2778 | } | - | ||||||||||||||||||||||||||||||
| 2779 | - | |||||||||||||||||||||||||||||||
| 2780 | - | |||||||||||||||||||||||||||||||
| 2781 | d->sendMouseEvent(mouseEvent); | - | ||||||||||||||||||||||||||||||
| 2782 | mouseEvent->accept(); | - | ||||||||||||||||||||||||||||||
| 2783 | - | |||||||||||||||||||||||||||||||
| 2784 | - | |||||||||||||||||||||||||||||||
| 2785 | if (!mouseEvent->buttons()
| 0 | ||||||||||||||||||||||||||||||
| 2786 | if (!d->mouseGrabberItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2787 | d->lastMouseGrabberItem = d->mouseGrabberItems.last(); | - | ||||||||||||||||||||||||||||||
| 2788 | if (d->lastMouseGrabberItemHasImplicitMouseGrab
| 0 | ||||||||||||||||||||||||||||||
| 2789 | d->mouseGrabberItems.last()->ungrabMouse(); never executed: d->mouseGrabberItems.last()->ungrabMouse(); | 0 | ||||||||||||||||||||||||||||||
| 2790 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2791 | d->lastMouseGrabberItem = 0; | - | ||||||||||||||||||||||||||||||
| 2792 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2793 | - | |||||||||||||||||||||||||||||||
| 2794 | - | |||||||||||||||||||||||||||||||
| 2795 | QGraphicsSceneHoverEvent hoverEvent; | - | ||||||||||||||||||||||||||||||
| 2796 | _q_hoverFromMouseEvent(&hoverEvent, mouseEvent); | - | ||||||||||||||||||||||||||||||
| 2797 | d->dispatchHoverEvent(&hoverEvent); | - | ||||||||||||||||||||||||||||||
| 2798 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2799 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2800 | void QGraphicsScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||||||||
| 2801 | { | - | ||||||||||||||||||||||||||||||
| 2802 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2803 | d->mousePressEventHandler(mouseEvent); | - | ||||||||||||||||||||||||||||||
| 2804 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2805 | void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent) | - | ||||||||||||||||||||||||||||||
| 2806 | { | - | ||||||||||||||||||||||||||||||
| 2807 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2808 | QList<QGraphicsItem *> wheelCandidates = d->itemsAtPosition(wheelEvent->screenPos(), | - | ||||||||||||||||||||||||||||||
| 2809 | wheelEvent->scenePos(), | - | ||||||||||||||||||||||||||||||
| 2810 | wheelEvent->widget()); | - | ||||||||||||||||||||||||||||||
| 2811 | QList<QGraphicsWidget *>::const_iterator iter = d->popupWidgets.constEnd(); | - | ||||||||||||||||||||||||||||||
| 2812 | while (--
| 0 | ||||||||||||||||||||||||||||||
| 2813 | if (wheelCandidates.first() == *iter
| 0 | ||||||||||||||||||||||||||||||
| 2814 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2815 | d->removePopup(*iter); | - | ||||||||||||||||||||||||||||||
| 2816 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2817 | - | |||||||||||||||||||||||||||||||
| 2818 | - | |||||||||||||||||||||||||||||||
| 2819 | bool hasSetFocus = false; | - | ||||||||||||||||||||||||||||||
| 2820 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(wheelCandidates)>::type> _container_((wheelCandidates)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 2821 | if (!hasSetFocus
| 0 | ||||||||||||||||||||||||||||||
| 2822 | && ((
| 0 | ||||||||||||||||||||||||||||||
| 2823 | if (item->isWidget()
| 0 | ||||||||||||||||||||||||||||||
| 2824 | hasSetFocus = true; | - | ||||||||||||||||||||||||||||||
| 2825 | if (item != focusItem()
| 0 | ||||||||||||||||||||||||||||||
| 2826 | setFocusItem(item, Qt::MouseFocusReason); never executed: setFocusItem(item, Qt::MouseFocusReason); | 0 | ||||||||||||||||||||||||||||||
| 2827 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2828 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2829 | - | |||||||||||||||||||||||||||||||
| 2830 | wheelEvent->setPos(item->d_ptr->genericMapFromScene(wheelEvent->scenePos(), | - | ||||||||||||||||||||||||||||||
| 2831 | wheelEvent->widget())); | - | ||||||||||||||||||||||||||||||
| 2832 | wheelEvent->accept(); | - | ||||||||||||||||||||||||||||||
| 2833 | bool isPanel = item->isPanel(); | - | ||||||||||||||||||||||||||||||
| 2834 | bool ret = d->sendEvent(item, wheelEvent); | - | ||||||||||||||||||||||||||||||
| 2835 | - | |||||||||||||||||||||||||||||||
| 2836 | if (ret
| 0 | ||||||||||||||||||||||||||||||
| 2837 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2838 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2839 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2840 | void QGraphicsScene::inputMethodEvent(QInputMethodEvent *event) | - | ||||||||||||||||||||||||||||||
| 2841 | { | - | ||||||||||||||||||||||||||||||
| 2842 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2843 | if (d->focusItem
| 0 | ||||||||||||||||||||||||||||||
| 2844 | d->sendEvent(d->focusItem, event); never executed: d->sendEvent(d->focusItem, event); | 0 | ||||||||||||||||||||||||||||||
| 2845 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2846 | void QGraphicsScene::drawBackground(QPainter *painter, const QRectF &rect) | - | ||||||||||||||||||||||||||||||
| 2847 | { | - | ||||||||||||||||||||||||||||||
| 2848 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2849 | - | |||||||||||||||||||||||||||||||
| 2850 | if (d->backgroundBrush.style() != Qt::NoBrush
| 0 | ||||||||||||||||||||||||||||||
| 2851 | if (d->painterStateProtection
| 0 | ||||||||||||||||||||||||||||||
| 2852 | painter->save(); never executed: painter->save(); | 0 | ||||||||||||||||||||||||||||||
| 2853 | painter->setBrushOrigin(0, 0); | - | ||||||||||||||||||||||||||||||
| 2854 | painter->fillRect(rect, backgroundBrush()); | - | ||||||||||||||||||||||||||||||
| 2855 | if (d->painterStateProtection
| 0 | ||||||||||||||||||||||||||||||
| 2856 | painter->restore(); never executed: painter->restore(); | 0 | ||||||||||||||||||||||||||||||
| 2857 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2858 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2859 | void QGraphicsScene::drawForeground(QPainter *painter, const QRectF &rect) | - | ||||||||||||||||||||||||||||||
| 2860 | { | - | ||||||||||||||||||||||||||||||
| 2861 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2862 | - | |||||||||||||||||||||||||||||||
| 2863 | if (d->foregroundBrush.style() != Qt::NoBrush
| 0 | ||||||||||||||||||||||||||||||
| 2864 | if (d->painterStateProtection
| 0 | ||||||||||||||||||||||||||||||
| 2865 | painter->save(); never executed: painter->save(); | 0 | ||||||||||||||||||||||||||||||
| 2866 | painter->setBrushOrigin(0, 0); | - | ||||||||||||||||||||||||||||||
| 2867 | painter->fillRect(rect, foregroundBrush()); | - | ||||||||||||||||||||||||||||||
| 2868 | if (d->painterStateProtection
| 0 | ||||||||||||||||||||||||||||||
| 2869 | painter->restore(); never executed: painter->restore(); | 0 | ||||||||||||||||||||||||||||||
| 2870 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2871 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2872 | - | |||||||||||||||||||||||||||||||
| 2873 | static void _q_paintItem(QGraphicsItem *item, QPainter *painter, | - | ||||||||||||||||||||||||||||||
| 2874 | const QStyleOptionGraphicsItem *option, QWidget *widget, | - | ||||||||||||||||||||||||||||||
| 2875 | bool useWindowOpacity, bool painterStateProtection) | - | ||||||||||||||||||||||||||||||
| 2876 | { | - | ||||||||||||||||||||||||||||||
| 2877 | if (!item->isWidget()
| 0 | ||||||||||||||||||||||||||||||
| 2878 | item->paint(painter, option, widget); | - | ||||||||||||||||||||||||||||||
| 2879 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2880 | } | - | ||||||||||||||||||||||||||||||
| 2881 | QGraphicsWidget *widgetItem = static_cast<QGraphicsWidget *>(item); | - | ||||||||||||||||||||||||||||||
| 2882 | QGraphicsProxyWidget *proxy = qobject_cast<QGraphicsProxyWidget *>(widgetItem); | - | ||||||||||||||||||||||||||||||
| 2883 | const qreal windowOpacity = (proxy
| 0 | ||||||||||||||||||||||||||||||
| 2884 | ? proxy->widget()->windowOpacity() : 1.0; | - | ||||||||||||||||||||||||||||||
| 2885 | const qreal oldPainterOpacity = painter->opacity(); | - | ||||||||||||||||||||||||||||||
| 2886 | - | |||||||||||||||||||||||||||||||
| 2887 | if (qFuzzyIsNull(windowOpacity)
| 0 | ||||||||||||||||||||||||||||||
| 2888 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2889 | - | |||||||||||||||||||||||||||||||
| 2890 | if (windowOpacity < 1.0
| 0 | ||||||||||||||||||||||||||||||
| 2891 | painter->setOpacity(oldPainterOpacity * windowOpacity); never executed: painter->setOpacity(oldPainterOpacity * windowOpacity); | 0 | ||||||||||||||||||||||||||||||
| 2892 | - | |||||||||||||||||||||||||||||||
| 2893 | - | |||||||||||||||||||||||||||||||
| 2894 | Qt::LayoutDirection oldLayoutDirection = painter->layoutDirection(); | - | ||||||||||||||||||||||||||||||
| 2895 | painter->setLayoutDirection(widgetItem->layoutDirection()); | - | ||||||||||||||||||||||||||||||
| 2896 | - | |||||||||||||||||||||||||||||||
| 2897 | if (widgetItem->isWindow()
| 0 | ||||||||||||||||||||||||||||||
| 2898 | && !(widgetItem->windowFlags() & Qt::FramelessWindowHint)
| 0 | ||||||||||||||||||||||||||||||
| 2899 | if (painterStateProtection
| 0 | ||||||||||||||||||||||||||||||
| 2900 | painter->save(); never executed: painter->save(); | 0 | ||||||||||||||||||||||||||||||
| 2901 | widgetItem->paintWindowFrame(painter, option, widget); | - | ||||||||||||||||||||||||||||||
| 2902 | if (painterStateProtection
| 0 | ||||||||||||||||||||||||||||||
| 2903 | painter->restore(); never executed: painter->restore(); | 0 | ||||||||||||||||||||||||||||||
| 2904 | } never executed: else if (widgetItem->autoFillBackground()end of block
| 0 | ||||||||||||||||||||||||||||||
| 2905 | painter->fillRect(option->exposedRect, widgetItem->palette().window()); | - | ||||||||||||||||||||||||||||||
| 2906 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2907 | - | |||||||||||||||||||||||||||||||
| 2908 | widgetItem->paint(painter, option, widget); | - | ||||||||||||||||||||||||||||||
| 2909 | - | |||||||||||||||||||||||||||||||
| 2910 | - | |||||||||||||||||||||||||||||||
| 2911 | painter->setLayoutDirection(oldLayoutDirection); | - | ||||||||||||||||||||||||||||||
| 2912 | - | |||||||||||||||||||||||||||||||
| 2913 | if (windowOpacity < 1.0
| 0 | ||||||||||||||||||||||||||||||
| 2914 | painter->setOpacity(oldPainterOpacity); never executed: painter->setOpacity(oldPainterOpacity); | 0 | ||||||||||||||||||||||||||||||
| 2915 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2916 | - | |||||||||||||||||||||||||||||||
| 2917 | static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion &pixmapExposed, | - | ||||||||||||||||||||||||||||||
| 2918 | const QTransform &itemToPixmap, QPainter::RenderHints renderHints, | - | ||||||||||||||||||||||||||||||
| 2919 | const QStyleOptionGraphicsItem *option, bool painterStateProtection) | - | ||||||||||||||||||||||||||||||
| 2920 | { | - | ||||||||||||||||||||||||||||||
| 2921 | QPixmap subPix; | - | ||||||||||||||||||||||||||||||
| 2922 | QPainter pixmapPainter; | - | ||||||||||||||||||||||||||||||
| 2923 | QRect br = pixmapExposed.boundingRect(); | - | ||||||||||||||||||||||||||||||
| 2924 | - | |||||||||||||||||||||||||||||||
| 2925 | - | |||||||||||||||||||||||||||||||
| 2926 | if (pixmapExposed.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2927 | pix->fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||
| 2928 | pixmapPainter.begin(pix); | - | ||||||||||||||||||||||||||||||
| 2929 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2930 | subPix = QPixmap(br.size()); | - | ||||||||||||||||||||||||||||||
| 2931 | subPix.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||
| 2932 | pixmapPainter.begin(&subPix); | - | ||||||||||||||||||||||||||||||
| 2933 | pixmapPainter.translate(-br.topLeft()); | - | ||||||||||||||||||||||||||||||
| 2934 | if (!pixmapExposed.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2935 | - | |||||||||||||||||||||||||||||||
| 2936 | - | |||||||||||||||||||||||||||||||
| 2937 | pixmapPainter.setClipRegion(pixmapExposed); | - | ||||||||||||||||||||||||||||||
| 2938 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2939 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2940 | - | |||||||||||||||||||||||||||||||
| 2941 | pixmapPainter.setRenderHints(pixmapPainter.renderHints(), false); | - | ||||||||||||||||||||||||||||||
| 2942 | pixmapPainter.setRenderHints(renderHints, true); | - | ||||||||||||||||||||||||||||||
| 2943 | pixmapPainter.setWorldTransform(itemToPixmap, true); | - | ||||||||||||||||||||||||||||||
| 2944 | - | |||||||||||||||||||||||||||||||
| 2945 | - | |||||||||||||||||||||||||||||||
| 2946 | _q_paintItem(item, &pixmapPainter, option, 0, false, painterStateProtection); | - | ||||||||||||||||||||||||||||||
| 2947 | pixmapPainter.end(); | - | ||||||||||||||||||||||||||||||
| 2948 | - | |||||||||||||||||||||||||||||||
| 2949 | if (!subPix.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 2950 | - | |||||||||||||||||||||||||||||||
| 2951 | pixmapPainter.begin(pix); | - | ||||||||||||||||||||||||||||||
| 2952 | pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source); | - | ||||||||||||||||||||||||||||||
| 2953 | pixmapPainter.setClipRegion(pixmapExposed); | - | ||||||||||||||||||||||||||||||
| 2954 | pixmapPainter.drawPixmap(br.topLeft(), subPix); | - | ||||||||||||||||||||||||||||||
| 2955 | pixmapPainter.end(); | - | ||||||||||||||||||||||||||||||
| 2956 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2957 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2958 | - | |||||||||||||||||||||||||||||||
| 2959 | - | |||||||||||||||||||||||||||||||
| 2960 | - | |||||||||||||||||||||||||||||||
| 2961 | static inline bool transformIsSimple(const QTransform& transform) | - | ||||||||||||||||||||||||||||||
| 2962 | { | - | ||||||||||||||||||||||||||||||
| 2963 | QTransform::TransformationType type = transform.type(); | - | ||||||||||||||||||||||||||||||
| 2964 | if (type <= QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 2965 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2966 | } else if (type == QTransform::TxRotate
| 0 | ||||||||||||||||||||||||||||||
| 2967 | - | |||||||||||||||||||||||||||||||
| 2968 | qreal m11 = transform.m11(); | - | ||||||||||||||||||||||||||||||
| 2969 | qreal m12 = transform.m12(); | - | ||||||||||||||||||||||||||||||
| 2970 | qreal m21 = transform.m21(); | - | ||||||||||||||||||||||||||||||
| 2971 | qreal m22 = transform.m22(); | - | ||||||||||||||||||||||||||||||
| 2972 | if (m11 == 0.0f
| 0 | ||||||||||||||||||||||||||||||
| 2973 | if (m12 == 1.0f
| 0 | ||||||||||||||||||||||||||||||
| 2974 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2975 | else if (m12 == -1.0f
| 0 | ||||||||||||||||||||||||||||||
| 2976 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2977 | else if (m12 == -1.0f
| 0 | ||||||||||||||||||||||||||||||
| 2978 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2979 | else if (m12 == 1.0f
| 0 | ||||||||||||||||||||||||||||||
| 2980 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2981 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2982 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2983 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2984 | } | - | ||||||||||||||||||||||||||||||
| 2985 | - | |||||||||||||||||||||||||||||||
| 2986 | - | |||||||||||||||||||||||||||||||
| 2987 | - | |||||||||||||||||||||||||||||||
| 2988 | - | |||||||||||||||||||||||||||||||
| 2989 | - | |||||||||||||||||||||||||||||||
| 2990 | - | |||||||||||||||||||||||||||||||
| 2991 | void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painter, | - | ||||||||||||||||||||||||||||||
| 2992 | const QStyleOptionGraphicsItem *option, QWidget *widget, | - | ||||||||||||||||||||||||||||||
| 2993 | bool painterStateProtection) | - | ||||||||||||||||||||||||||||||
| 2994 | { | - | ||||||||||||||||||||||||||||||
| 2995 | QGraphicsItemPrivate *itemd = item->d_ptr.data(); | - | ||||||||||||||||||||||||||||||
| 2996 | QGraphicsItem::CacheMode cacheMode = QGraphicsItem::CacheMode(itemd->cacheMode); | - | ||||||||||||||||||||||||||||||
| 2997 | - | |||||||||||||||||||||||||||||||
| 2998 | - | |||||||||||||||||||||||||||||||
| 2999 | if (cacheMode == QGraphicsItem::NoCache
| 0 | ||||||||||||||||||||||||||||||
| 3000 | - | |||||||||||||||||||||||||||||||
| 3001 | - | |||||||||||||||||||||||||||||||
| 3002 | - | |||||||||||||||||||||||||||||||
| 3003 | ) { | - | ||||||||||||||||||||||||||||||
| 3004 | _q_paintItem(static_cast<QGraphicsWidget *>(item), painter, option, widget, true, painterStateProtection); | - | ||||||||||||||||||||||||||||||
| 3005 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3006 | } | - | ||||||||||||||||||||||||||||||
| 3007 | - | |||||||||||||||||||||||||||||||
| 3008 | const qreal oldPainterOpacity = painter->opacity(); | - | ||||||||||||||||||||||||||||||
| 3009 | qreal newPainterOpacity = oldPainterOpacity; | - | ||||||||||||||||||||||||||||||
| 3010 | QGraphicsProxyWidget *proxy = item->isWidget()
| 0 | ||||||||||||||||||||||||||||||
| 3011 | if (proxy
| 0 | ||||||||||||||||||||||||||||||
| 3012 | const qreal windowOpacity = proxy->widget()->windowOpacity(); | - | ||||||||||||||||||||||||||||||
| 3013 | if (windowOpacity < 1.0
| 0 | ||||||||||||||||||||||||||||||
| 3014 | newPainterOpacity *= windowOpacity; never executed: newPainterOpacity *= windowOpacity; | 0 | ||||||||||||||||||||||||||||||
| 3015 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3016 | - | |||||||||||||||||||||||||||||||
| 3017 | - | |||||||||||||||||||||||||||||||
| 3018 | QRectF brect = item->boundingRect(); | - | ||||||||||||||||||||||||||||||
| 3019 | QRectF adjustedBrect(brect); | - | ||||||||||||||||||||||||||||||
| 3020 | _q_adjustRect(&adjustedBrect); | - | ||||||||||||||||||||||||||||||
| 3021 | if (adjustedBrect.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 3022 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3023 | - | |||||||||||||||||||||||||||||||
| 3024 | - | |||||||||||||||||||||||||||||||
| 3025 | QPixmapCache::Key pixmapKey; | - | ||||||||||||||||||||||||||||||
| 3026 | QPixmap pix; | - | ||||||||||||||||||||||||||||||
| 3027 | bool pixmapFound; | - | ||||||||||||||||||||||||||||||
| 3028 | QGraphicsItemCache *itemCache = itemd->extraItemCache(); | - | ||||||||||||||||||||||||||||||
| 3029 | if (cacheMode == QGraphicsItem::ItemCoordinateCache
| 0 | ||||||||||||||||||||||||||||||
| 3030 | pixmapKey = itemCache->key; | - | ||||||||||||||||||||||||||||||
| 3031 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3032 | pixmapKey = itemCache->deviceData.value(widget).key; | - | ||||||||||||||||||||||||||||||
| 3033 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3034 | - | |||||||||||||||||||||||||||||||
| 3035 | - | |||||||||||||||||||||||||||||||
| 3036 | pixmapFound = QPixmapCache::find(pixmapKey, &pix); | - | ||||||||||||||||||||||||||||||
| 3037 | - | |||||||||||||||||||||||||||||||
| 3038 | - | |||||||||||||||||||||||||||||||
| 3039 | if (cacheMode == QGraphicsItem::ItemCoordinateCache
| 0 | ||||||||||||||||||||||||||||||
| 3040 | QSize pixmapSize; | - | ||||||||||||||||||||||||||||||
| 3041 | bool fixedCacheSize = false; | - | ||||||||||||||||||||||||||||||
| 3042 | QRect br = brect.toAlignedRect(); | - | ||||||||||||||||||||||||||||||
| 3043 | if ((
| 0 | ||||||||||||||||||||||||||||||
| 3044 | pixmapSize = itemCache->fixedSize; | - | ||||||||||||||||||||||||||||||
| 3045 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3046 | pixmapSize = br.size(); | - | ||||||||||||||||||||||||||||||
| 3047 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3048 | - | |||||||||||||||||||||||||||||||
| 3049 | - | |||||||||||||||||||||||||||||||
| 3050 | int adjust = itemCache->fixedSize.isValid()
| 0 | ||||||||||||||||||||||||||||||
| 3051 | QSize adjustSize(adjust*2, adjust*2); | - | ||||||||||||||||||||||||||||||
| 3052 | br.adjust(-adjust, -adjust, adjust, adjust); | - | ||||||||||||||||||||||||||||||
| 3053 | if (pix.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 3054 | pix = QPixmap(pixmapSize + adjustSize); | - | ||||||||||||||||||||||||||||||
| 3055 | itemCache->boundingRect = br; | - | ||||||||||||||||||||||||||||||
| 3056 | itemCache->exposed.clear(); | - | ||||||||||||||||||||||||||||||
| 3057 | itemCache->allExposed = true; | - | ||||||||||||||||||||||||||||||
| 3058 | } never executed: else if (itemCache->boundingRect != brend of block
| 0 | ||||||||||||||||||||||||||||||
| 3059 | itemCache->boundingRect = br; | - | ||||||||||||||||||||||||||||||
| 3060 | itemCache->exposed.clear(); | - | ||||||||||||||||||||||||||||||
| 3061 | itemCache->allExposed = true; | - | ||||||||||||||||||||||||||||||
| 3062 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3063 | - | |||||||||||||||||||||||||||||||
| 3064 | - | |||||||||||||||||||||||||||||||
| 3065 | if (itemCache->allExposed
| 0 | ||||||||||||||||||||||||||||||
| 3066 | - | |||||||||||||||||||||||||||||||
| 3067 | - | |||||||||||||||||||||||||||||||
| 3068 | - | |||||||||||||||||||||||||||||||
| 3069 | if (pixmapFound
| 0 | ||||||||||||||||||||||||||||||
| 3070 | QPixmapCache::remove(pixmapKey); never executed: QPixmapCache::remove(pixmapKey); | 0 | ||||||||||||||||||||||||||||||
| 3071 | - | |||||||||||||||||||||||||||||||
| 3072 | - | |||||||||||||||||||||||||||||||
| 3073 | QTransform itemToPixmap; | - | ||||||||||||||||||||||||||||||
| 3074 | if (fixedCacheSize
| 0 | ||||||||||||||||||||||||||||||
| 3075 | const QPointF scale(pixmapSize.width() / brect.width(), pixmapSize.height() / brect.height()); | - | ||||||||||||||||||||||||||||||
| 3076 | itemToPixmap.scale(scale.x(), scale.y()); | - | ||||||||||||||||||||||||||||||
| 3077 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3078 | itemToPixmap.translate(-br.x(), -br.y()); | - | ||||||||||||||||||||||||||||||
| 3079 | - | |||||||||||||||||||||||||||||||
| 3080 | - | |||||||||||||||||||||||||||||||
| 3081 | - | |||||||||||||||||||||||||||||||
| 3082 | styleOptionTmp = *option; | - | ||||||||||||||||||||||||||||||
| 3083 | QRegion pixmapExposed; | - | ||||||||||||||||||||||||||||||
| 3084 | QRectF exposedRect; | - | ||||||||||||||||||||||||||||||
| 3085 | if (!itemCache->allExposed
| 0 | ||||||||||||||||||||||||||||||
| 3086 | for (int i = 0; i < itemCache->exposed.size()
| 0 | ||||||||||||||||||||||||||||||
| 3087 | QRectF r = itemCache->exposed.at(i); | - | ||||||||||||||||||||||||||||||
| 3088 | exposedRect |= r; | - | ||||||||||||||||||||||||||||||
| 3089 | pixmapExposed += itemToPixmap.mapRect(r).toAlignedRect(); | - | ||||||||||||||||||||||||||||||
| 3090 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3091 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3092 | exposedRect = brect; | - | ||||||||||||||||||||||||||||||
| 3093 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3094 | styleOptionTmp.exposedRect = exposedRect; | - | ||||||||||||||||||||||||||||||
| 3095 | - | |||||||||||||||||||||||||||||||
| 3096 | - | |||||||||||||||||||||||||||||||
| 3097 | _q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(), | - | ||||||||||||||||||||||||||||||
| 3098 | &styleOptionTmp, painterStateProtection); | - | ||||||||||||||||||||||||||||||
| 3099 | - | |||||||||||||||||||||||||||||||
| 3100 | - | |||||||||||||||||||||||||||||||
| 3101 | itemCache->key = QPixmapCache::insert(pix); | - | ||||||||||||||||||||||||||||||
| 3102 | - | |||||||||||||||||||||||||||||||
| 3103 | - | |||||||||||||||||||||||||||||||
| 3104 | itemCache->allExposed = false; | - | ||||||||||||||||||||||||||||||
| 3105 | itemCache->exposed.clear(); | - | ||||||||||||||||||||||||||||||
| 3106 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3107 | - | |||||||||||||||||||||||||||||||
| 3108 | - | |||||||||||||||||||||||||||||||
| 3109 | - | |||||||||||||||||||||||||||||||
| 3110 | - | |||||||||||||||||||||||||||||||
| 3111 | if (newPainterOpacity != oldPainterOpacity
| 0 | ||||||||||||||||||||||||||||||
| 3112 | painter->setOpacity(newPainterOpacity); | - | ||||||||||||||||||||||||||||||
| 3113 | painter->drawPixmap(br.topLeft(), pix); | - | ||||||||||||||||||||||||||||||
| 3114 | painter->setOpacity(oldPainterOpacity); | - | ||||||||||||||||||||||||||||||
| 3115 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3116 | painter->drawPixmap(br.topLeft(), pix); | - | ||||||||||||||||||||||||||||||
| 3117 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3118 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3119 | } | - | ||||||||||||||||||||||||||||||
| 3120 | - | |||||||||||||||||||||||||||||||
| 3121 | - | |||||||||||||||||||||||||||||||
| 3122 | if (cacheMode == QGraphicsItem::DeviceCoordinateCache
| 0 | ||||||||||||||||||||||||||||||
| 3123 | - | |||||||||||||||||||||||||||||||
| 3124 | QRectF deviceBounds = painter->worldTransform().mapRect(brect); | - | ||||||||||||||||||||||||||||||
| 3125 | QRect deviceRect = deviceBounds.toRect().adjusted(-1, -1, 1, 1); | - | ||||||||||||||||||||||||||||||
| 3126 | if (deviceRect.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 3127 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3128 | QRect viewRect = widget
| 0 | ||||||||||||||||||||||||||||||
| 3129 | if (widget
| 0 | ||||||||||||||||||||||||||||||
| 3130 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3131 | - | |||||||||||||||||||||||||||||||
| 3132 | - | |||||||||||||||||||||||||||||||
| 3133 | - | |||||||||||||||||||||||||||||||
| 3134 | QSize maximumCacheSize = | - | ||||||||||||||||||||||||||||||
| 3135 | itemd->extra(QGraphicsItemPrivate::ExtraMaxDeviceCoordCacheSize).toSize(); | - | ||||||||||||||||||||||||||||||
| 3136 | if (!maximumCacheSize.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 3137 | && (deviceRect.width() > maximumCacheSize.width()
| 0 | ||||||||||||||||||||||||||||||
| 3138 | || deviceRect.height() > maximumCacheSize.height()
| 0 | ||||||||||||||||||||||||||||||
| 3139 | _q_paintItem(static_cast<QGraphicsWidget *>(item), painter, option, widget, | - | ||||||||||||||||||||||||||||||
| 3140 | oldPainterOpacity != newPainterOpacity, painterStateProtection); | - | ||||||||||||||||||||||||||||||
| 3141 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3142 | } | - | ||||||||||||||||||||||||||||||
| 3143 | - | |||||||||||||||||||||||||||||||
| 3144 | - | |||||||||||||||||||||||||||||||
| 3145 | - | |||||||||||||||||||||||||||||||
| 3146 | - | |||||||||||||||||||||||||||||||
| 3147 | bool pixModified = false; | - | ||||||||||||||||||||||||||||||
| 3148 | QGraphicsItemCache::DeviceData *deviceData = &itemCache->deviceData[widget]; | - | ||||||||||||||||||||||||||||||
| 3149 | bool invertable = true; | - | ||||||||||||||||||||||||||||||
| 3150 | QTransform diff = deviceData->lastTransform.inverted(&invertable); | - | ||||||||||||||||||||||||||||||
| 3151 | if (invertable
| 0 | ||||||||||||||||||||||||||||||
| 3152 | diff *= painter->worldTransform(); never executed: diff *= painter->worldTransform(); | 0 | ||||||||||||||||||||||||||||||
| 3153 | deviceData->lastTransform = painter->worldTransform(); | - | ||||||||||||||||||||||||||||||
| 3154 | bool allowPartialCacheExposure = false; | - | ||||||||||||||||||||||||||||||
| 3155 | bool simpleTransform = invertable
| 0 | ||||||||||||||||||||||||||||||
| 3156 | && transformIsSimple(painter->worldTransform())
| 0 | ||||||||||||||||||||||||||||||
| 3157 | if (!simpleTransform
| 0 | ||||||||||||||||||||||||||||||
| 3158 | pixModified = true; | - | ||||||||||||||||||||||||||||||
| 3159 | itemCache->allExposed = true; | - | ||||||||||||||||||||||||||||||
| 3160 | itemCache->exposed.clear(); | - | ||||||||||||||||||||||||||||||
| 3161 | deviceData->cacheIndent = QPoint(); | - | ||||||||||||||||||||||||||||||
| 3162 | pix = QPixmap(); | - | ||||||||||||||||||||||||||||||
| 3163 | } never executed: else if (!viewRect.isNull()end of block
| 0 | ||||||||||||||||||||||||||||||
| 3164 | allowPartialCacheExposure = deviceData->cacheIndent != QPoint(); | - | ||||||||||||||||||||||||||||||
| 3165 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3166 | - | |||||||||||||||||||||||||||||||
| 3167 | - | |||||||||||||||||||||||||||||||
| 3168 | - | |||||||||||||||||||||||||||||||
| 3169 | if (!allowPartialCacheExposure
| 0 | ||||||||||||||||||||||||||||||
| 3170 | allowPartialCacheExposure = (
| 0 | ||||||||||||||||||||||||||||||
| 3171 | || (
| 0 | ||||||||||||||||||||||||||||||
| 3172 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3173 | - | |||||||||||||||||||||||||||||||
| 3174 | QRegion scrollExposure; | - | ||||||||||||||||||||||||||||||
| 3175 | if (allowPartialCacheExposure
| 0 | ||||||||||||||||||||||||||||||
| 3176 | - | |||||||||||||||||||||||||||||||
| 3177 | - | |||||||||||||||||||||||||||||||
| 3178 | - | |||||||||||||||||||||||||||||||
| 3179 | - | |||||||||||||||||||||||||||||||
| 3180 | int dx = deviceRect.left() < viewRect.left()
| 0 | ||||||||||||||||||||||||||||||
| 3181 | int dy = deviceRect.top() < viewRect.top()
| 0 | ||||||||||||||||||||||||||||||
| 3182 | QPoint newCacheIndent(dx, dy); | - | ||||||||||||||||||||||||||||||
| 3183 | deviceRect &= viewRect; | - | ||||||||||||||||||||||||||||||
| 3184 | - | |||||||||||||||||||||||||||||||
| 3185 | if (pix.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 3186 | deviceData->cacheIndent = QPoint(); | - | ||||||||||||||||||||||||||||||
| 3187 | itemCache->allExposed = true; | - | ||||||||||||||||||||||||||||||
| 3188 | itemCache->exposed.clear(); | - | ||||||||||||||||||||||||||||||
| 3189 | pixModified = true; | - | ||||||||||||||||||||||||||||||
| 3190 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3191 | - | |||||||||||||||||||||||||||||||
| 3192 | - | |||||||||||||||||||||||||||||||
| 3193 | - | |||||||||||||||||||||||||||||||
| 3194 | if (newCacheIndent != deviceData->cacheIndent
| 0 | ||||||||||||||||||||||||||||||
| 3195 | QPoint diff = newCacheIndent - deviceData->cacheIndent; | - | ||||||||||||||||||||||||||||||
| 3196 | QPixmap newPix(deviceRect.size()); | - | ||||||||||||||||||||||||||||||
| 3197 | - | |||||||||||||||||||||||||||||||
| 3198 | - | |||||||||||||||||||||||||||||||
| 3199 | newPix.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||
| 3200 | if (!pix.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 3201 | QPainter newPixPainter(&newPix); | - | ||||||||||||||||||||||||||||||
| 3202 | newPixPainter.drawPixmap(-diff, pix); | - | ||||||||||||||||||||||||||||||
| 3203 | newPixPainter.end(); | - | ||||||||||||||||||||||||||||||
| 3204 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3205 | QRegion exposed; | - | ||||||||||||||||||||||||||||||
| 3206 | exposed += newPix.rect(); | - | ||||||||||||||||||||||||||||||
| 3207 | if (!pix.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 3208 | exposed -= QRect(-diff, pix.size()); never executed: exposed -= QRect(-diff, pix.size()); | 0 | ||||||||||||||||||||||||||||||
| 3209 | scrollExposure = exposed; | - | ||||||||||||||||||||||||||||||
| 3210 | - | |||||||||||||||||||||||||||||||
| 3211 | pix = newPix; | - | ||||||||||||||||||||||||||||||
| 3212 | pixModified = true; | - | ||||||||||||||||||||||||||||||
| 3213 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3214 | deviceData->cacheIndent = newCacheIndent; | - | ||||||||||||||||||||||||||||||
| 3215 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3216 | - | |||||||||||||||||||||||||||||||
| 3217 | deviceData->cacheIndent = QPoint(); | - | ||||||||||||||||||||||||||||||
| 3218 | - | |||||||||||||||||||||||||||||||
| 3219 | - | |||||||||||||||||||||||||||||||
| 3220 | if (deviceRect.size() != pix.size()
| 0 | ||||||||||||||||||||||||||||||
| 3221 | - | |||||||||||||||||||||||||||||||
| 3222 | pix = QPixmap(deviceRect.size()); | - | ||||||||||||||||||||||||||||||
| 3223 | pixModified = true; | - | ||||||||||||||||||||||||||||||
| 3224 | itemCache->allExposed = true; | - | ||||||||||||||||||||||||||||||
| 3225 | itemCache->exposed.clear(); | - | ||||||||||||||||||||||||||||||
| 3226 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3227 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3228 | - | |||||||||||||||||||||||||||||||
| 3229 | - | |||||||||||||||||||||||||||||||
| 3230 | if (itemCache->allExposed
| 0 | ||||||||||||||||||||||||||||||
| 3231 | - | |||||||||||||||||||||||||||||||
| 3232 | - | |||||||||||||||||||||||||||||||
| 3233 | if (pixmapFound
| 0 | ||||||||||||||||||||||||||||||
| 3234 | QPixmapCache::remove(pixmapKey); never executed: QPixmapCache::remove(pixmapKey); | 0 | ||||||||||||||||||||||||||||||
| 3235 | - | |||||||||||||||||||||||||||||||
| 3236 | - | |||||||||||||||||||||||||||||||
| 3237 | QPointF p = deviceRect.topLeft(); | - | ||||||||||||||||||||||||||||||
| 3238 | QTransform itemToPixmap = painter->worldTransform(); | - | ||||||||||||||||||||||||||||||
| 3239 | if (!p.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 3240 | itemToPixmap *= QTransform::fromTranslate(-p.x(), -p.y()); never executed: itemToPixmap *= QTransform::fromTranslate(-p.x(), -p.y()); | 0 | ||||||||||||||||||||||||||||||
| 3241 | - | |||||||||||||||||||||||||||||||
| 3242 | - | |||||||||||||||||||||||||||||||
| 3243 | QRegion pixmapExposed = scrollExposure; | - | ||||||||||||||||||||||||||||||
| 3244 | if (!itemCache->allExposed
| 0 | ||||||||||||||||||||||||||||||
| 3245 | const QVector<QRectF> &exposed = itemCache->exposed; | - | ||||||||||||||||||||||||||||||
| 3246 | for (int i = 0; i < exposed.size()
| 0 | ||||||||||||||||||||||||||||||
| 3247 | pixmapExposed += itemToPixmap.mapRect(exposed.at(i)).toRect().adjusted(-1, -1, 1, 1); never executed: pixmapExposed += itemToPixmap.mapRect(exposed.at(i)).toRect().adjusted(-1, -1, 1, 1); | 0 | ||||||||||||||||||||||||||||||
| 3248 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3249 | - | |||||||||||||||||||||||||||||||
| 3250 | - | |||||||||||||||||||||||||||||||
| 3251 | QRectF br; | - | ||||||||||||||||||||||||||||||
| 3252 | if (itemCache->allExposed
| 0 | ||||||||||||||||||||||||||||||
| 3253 | br = item->boundingRect(); | - | ||||||||||||||||||||||||||||||
| 3254 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3255 | const QVector<QRectF> &exposed = itemCache->exposed; | - | ||||||||||||||||||||||||||||||
| 3256 | for (int i = 0; i < exposed.size()
| 0 | ||||||||||||||||||||||||||||||
| 3257 | br |= exposed.at(i); never executed: br |= exposed.at(i); | 0 | ||||||||||||||||||||||||||||||
| 3258 | QTransform pixmapToItem = itemToPixmap.inverted(); | - | ||||||||||||||||||||||||||||||
| 3259 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(scrollExposure.rects())>::type> _container_((scrollExposure.rects())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QRect &r = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 3260 | br |= pixmapToItem.mapRect(r); never executed: br |= pixmapToItem.mapRect(r); | 0 | ||||||||||||||||||||||||||||||
| 3261 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3262 | styleOptionTmp = *option; | - | ||||||||||||||||||||||||||||||
| 3263 | styleOptionTmp.exposedRect = br.adjusted(-1, -1, 1, 1); | - | ||||||||||||||||||||||||||||||
| 3264 | - | |||||||||||||||||||||||||||||||
| 3265 | - | |||||||||||||||||||||||||||||||
| 3266 | _q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(), | - | ||||||||||||||||||||||||||||||
| 3267 | &styleOptionTmp, painterStateProtection); | - | ||||||||||||||||||||||||||||||
| 3268 | - | |||||||||||||||||||||||||||||||
| 3269 | - | |||||||||||||||||||||||||||||||
| 3270 | pixModified = true; | - | ||||||||||||||||||||||||||||||
| 3271 | itemCache->allExposed = false; | - | ||||||||||||||||||||||||||||||
| 3272 | itemCache->exposed.clear(); | - | ||||||||||||||||||||||||||||||
| 3273 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3274 | - | |||||||||||||||||||||||||||||||
| 3275 | if (pixModified
| 0 | ||||||||||||||||||||||||||||||
| 3276 | - | |||||||||||||||||||||||||||||||
| 3277 | deviceData->key = QPixmapCache::insert(pix); | - | ||||||||||||||||||||||||||||||
| 3278 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3279 | - | |||||||||||||||||||||||||||||||
| 3280 | - | |||||||||||||||||||||||||||||||
| 3281 | - | |||||||||||||||||||||||||||||||
| 3282 | QTransform restoreTransform = painter->worldTransform(); | - | ||||||||||||||||||||||||||||||
| 3283 | painter->setWorldTransform(QTransform()); | - | ||||||||||||||||||||||||||||||
| 3284 | if (newPainterOpacity != oldPainterOpacity
| 0 | ||||||||||||||||||||||||||||||
| 3285 | painter->setOpacity(newPainterOpacity); | - | ||||||||||||||||||||||||||||||
| 3286 | painter->drawPixmap(deviceRect.topLeft(), pix); | - | ||||||||||||||||||||||||||||||
| 3287 | painter->setOpacity(oldPainterOpacity); | - | ||||||||||||||||||||||||||||||
| 3288 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3289 | painter->drawPixmap(deviceRect.topLeft(), pix); | - | ||||||||||||||||||||||||||||||
| 3290 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3291 | painter->setWorldTransform(restoreTransform); | - | ||||||||||||||||||||||||||||||
| 3292 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3293 | } | - | ||||||||||||||||||||||||||||||
| 3294 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3295 | - | |||||||||||||||||||||||||||||||
| 3296 | void QGraphicsScenePrivate::drawItems(QPainter *painter, const QTransform *const viewTransform, | - | ||||||||||||||||||||||||||||||
| 3297 | QRegion *exposedRegion, QWidget *widget) | - | ||||||||||||||||||||||||||||||
| 3298 | { | - | ||||||||||||||||||||||||||||||
| 3299 | - | |||||||||||||||||||||||||||||||
| 3300 | if (!unpolishedItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 3301 | _q_polishItems(); never executed: _q_polishItems(); | 0 | ||||||||||||||||||||||||||||||
| 3302 | - | |||||||||||||||||||||||||||||||
| 3303 | updateAll = false; | - | ||||||||||||||||||||||||||||||
| 3304 | QRectF exposedSceneRect; | - | ||||||||||||||||||||||||||||||
| 3305 | if (exposedRegion
| 0 | ||||||||||||||||||||||||||||||
| 3306 | exposedSceneRect = exposedRegion->boundingRect().adjusted(-1, -1, 1, 1); | - | ||||||||||||||||||||||||||||||
| 3307 | if (viewTransform
| 0 | ||||||||||||||||||||||||||||||
| 3308 | exposedSceneRect = viewTransform->inverted().mapRect(exposedSceneRect); never executed: exposedSceneRect = viewTransform->inverted().mapRect(exposedSceneRect); | 0 | ||||||||||||||||||||||||||||||
| 3309 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3310 | const QList<QGraphicsItem *> tli = index->estimateTopLevelItems(exposedSceneRect, Qt::AscendingOrder); | - | ||||||||||||||||||||||||||||||
| 3311 | for (int i = 0; i < tli.size()
| 0 | ||||||||||||||||||||||||||||||
| 3312 | drawSubtreeRecursive(tli.at(i), painter, viewTransform, exposedRegion, widget); never executed: drawSubtreeRecursive(tli.at(i), painter, viewTransform, exposedRegion, widget); | 0 | ||||||||||||||||||||||||||||||
| 3313 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3314 | - | |||||||||||||||||||||||||||||||
| 3315 | void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *painter, | - | ||||||||||||||||||||||||||||||
| 3316 | const QTransform *const viewTransform, | - | ||||||||||||||||||||||||||||||
| 3317 | QRegion *exposedRegion, QWidget *widget, | - | ||||||||||||||||||||||||||||||
| 3318 | qreal parentOpacity, const QTransform *const effectTransform) | - | ||||||||||||||||||||||||||||||
| 3319 | { | - | ||||||||||||||||||||||||||||||
| 3320 | ((!(item)) ? qt_assert("item",__FILE__,4699) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3321 | - | |||||||||||||||||||||||||||||||
| 3322 | if (!item->d_ptr->visible
| 0 | ||||||||||||||||||||||||||||||
| 3323 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3324 | - | |||||||||||||||||||||||||||||||
| 3325 | const bool itemHasContents = !(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents); | - | ||||||||||||||||||||||||||||||
| 3326 | const bool itemHasChildren = !item->d_ptr->children.isEmpty(); | - | ||||||||||||||||||||||||||||||
| 3327 | if (!itemHasContents
| 0 | ||||||||||||||||||||||||||||||
| 3328 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3329 | - | |||||||||||||||||||||||||||||||
| 3330 | const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); | - | ||||||||||||||||||||||||||||||
| 3331 | const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity); | - | ||||||||||||||||||||||||||||||
| 3332 | if (itemIsFullyTransparent
| 0 | ||||||||||||||||||||||||||||||
| 3333 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3334 | - | |||||||||||||||||||||||||||||||
| 3335 | QTransform transform(Qt::Uninitialized); | - | ||||||||||||||||||||||||||||||
| 3336 | QTransform *transformPtr = 0; | - | ||||||||||||||||||||||||||||||
| 3337 | bool translateOnlyTransform = false; | - | ||||||||||||||||||||||||||||||
| 3338 | bool wasDirtyParentSceneTransform = false; | - | ||||||||||||||||||||||||||||||
| 3339 | const bool itemIsUntransformable = item->d_ptr->itemIsUntransformable(); | - | ||||||||||||||||||||||||||||||
| 3340 | if (itemIsUntransformable
| 0 | ||||||||||||||||||||||||||||||
| 3341 | transform = item->deviceTransform(viewTransform ? *viewTransform : QTransform()); | - | ||||||||||||||||||||||||||||||
| 3342 | transformPtr = &transform; | - | ||||||||||||||||||||||||||||||
| 3343 | } never executed: else if (item->d_ptr->dirtySceneTransformend of block
| 0 | ||||||||||||||||||||||||||||||
| 3344 | item->d_ptr->updateSceneTransformFromParent(); | - | ||||||||||||||||||||||||||||||
| 3345 | ((!(!item->d_ptr->dirtySceneTransform)) ? qt_assert("!item->d_ptr->dirtySceneTransform",__FILE__,4739) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3346 | wasDirtyParentSceneTransform = true; | - | ||||||||||||||||||||||||||||||
| 3347 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3348 | - | |||||||||||||||||||||||||||||||
| 3349 | const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape
| 0 | ||||||||||||||||||||||||||||||
| 3350 | || item->d_ptr->flags & QGraphicsItem::ItemContainsChildrenInShape
| 0 | ||||||||||||||||||||||||||||||
| 3351 | bool drawItem = itemHasContents
| 0 | ||||||||||||||||||||||||||||||
| 3352 | if (drawItem
| 0 | ||||||||||||||||||||||||||||||
| 3353 | const QRectF brect = adjustedItemEffectiveBoundingRect(item); | - | ||||||||||||||||||||||||||||||
| 3354 | if (!transformPtr
never executed: else { transformPtr = &item->d_ptr->sceneTransform; translateOnlyTransform = item->d_ptr->sceneTransformTranslateOnly; }end of blocknever executed: }end of block | 0 | ||||||||||||||||||||||||||||||
| 3355 | QRectF preciseViewBoundingRect = translateOnlyTransform
| 0 | ||||||||||||||||||||||||||||||
| 3356 | : transformPtr->mapRect(brect); | - | ||||||||||||||||||||||||||||||
| 3357 | - | |||||||||||||||||||||||||||||||
| 3358 | bool itemIsTooSmallToRender = false; | - | ||||||||||||||||||||||||||||||
| 3359 | if (minimumRenderSize > 0.0
| 0 | ||||||||||||||||||||||||||||||
| 3360 | && (preciseViewBoundingRect.width() < minimumRenderSize
| 0 | ||||||||||||||||||||||||||||||
| 3361 | || preciseViewBoundingRect.height() < minimumRenderSize
| 0 | ||||||||||||||||||||||||||||||
| 3362 | itemIsTooSmallToRender = true; | - | ||||||||||||||||||||||||||||||
| 3363 | drawItem = false; | - | ||||||||||||||||||||||||||||||
| 3364 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3365 | - | |||||||||||||||||||||||||||||||
| 3366 | bool itemIsOutsideVisibleRect = false; | - | ||||||||||||||||||||||||||||||
| 3367 | if (drawItem
| 0 | ||||||||||||||||||||||||||||||
| 3368 | QRect viewBoundingRect = preciseViewBoundingRect.toAlignedRect(); | - | ||||||||||||||||||||||||||||||
| 3369 | viewBoundingRect.adjust(-int(rectAdjust), -int(rectAdjust), rectAdjust, rectAdjust); | - | ||||||||||||||||||||||||||||||
| 3370 | if (widget
| 0 | ||||||||||||||||||||||||||||||
| 3371 | item->d_ptr->paintedViewBoundingRects.insert(widget, viewBoundingRect); never executed: item->d_ptr->paintedViewBoundingRects.insert(widget, viewBoundingRect); | 0 | ||||||||||||||||||||||||||||||
| 3372 | drawItem = exposedRegion
| 0 | ||||||||||||||||||||||||||||||
| 3373 | : !viewBoundingRect.normalized().isEmpty(); | - | ||||||||||||||||||||||||||||||
| 3374 | itemIsOutsideVisibleRect = !drawItem; | - | ||||||||||||||||||||||||||||||
| 3375 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3376 | - | |||||||||||||||||||||||||||||||
| 3377 | if (itemIsTooSmallToRender
| 0 | ||||||||||||||||||||||||||||||
| 3378 | - | |||||||||||||||||||||||||||||||
| 3379 | - | |||||||||||||||||||||||||||||||
| 3380 | - | |||||||||||||||||||||||||||||||
| 3381 | - | |||||||||||||||||||||||||||||||
| 3382 | - | |||||||||||||||||||||||||||||||
| 3383 | if (!itemHasChildren
| 0 | ||||||||||||||||||||||||||||||
| 3384 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3385 | if (itemClipsChildrenToShape
| 0 | ||||||||||||||||||||||||||||||
| 3386 | if (wasDirtyParentSceneTransform
| 0 | ||||||||||||||||||||||||||||||
| 3387 | item->d_ptr->invalidateChildrenSceneTransform(); never executed: item->d_ptr->invalidateChildrenSceneTransform(); | 0 | ||||||||||||||||||||||||||||||
| 3388 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3389 | } | - | ||||||||||||||||||||||||||||||
| 3390 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3391 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3392 | - | |||||||||||||||||||||||||||||||
| 3393 | if (itemHasChildren
| 0 | ||||||||||||||||||||||||||||||
| 3394 | if (!transformPtr
never executed: else { transformPtr = &item->d_ptr->sceneTransform; translateOnlyTransform = item->d_ptr->sceneTransformTranslateOnly; }end of blocknever executed: };end of block | 0 | ||||||||||||||||||||||||||||||
| 3395 | - | |||||||||||||||||||||||||||||||
| 3396 | - | |||||||||||||||||||||||||||||||
| 3397 | if (item->d_ptr->graphicsEffect
| 0 | ||||||||||||||||||||||||||||||
| 3398 | if (!transformPtr
never executed: else { transformPtr = &item->d_ptr->sceneTransform; translateOnlyTransform = item->d_ptr->sceneTransformTranslateOnly; }end of blocknever executed: };end of block | 0 | ||||||||||||||||||||||||||||||
| 3399 | QGraphicsItemPaintInfo info(viewTransform, transformPtr, effectTransform, exposedRegion, widget, &styleOptionTmp, | - | ||||||||||||||||||||||||||||||
| 3400 | painter, opacity, wasDirtyParentSceneTransform, itemHasContents && !itemIsFullyTransparent); | - | ||||||||||||||||||||||||||||||
| 3401 | QGraphicsEffectSource *source = item->d_ptr->graphicsEffect->d_func()->source; | - | ||||||||||||||||||||||||||||||
| 3402 | QGraphicsItemEffectSourcePrivate *sourced = static_cast<QGraphicsItemEffectSourcePrivate *> | - | ||||||||||||||||||||||||||||||
| 3403 | (source->d_func()); | - | ||||||||||||||||||||||||||||||
| 3404 | sourced->info = &info; | - | ||||||||||||||||||||||||||||||
| 3405 | const QTransform restoreTransform = painter->worldTransform(); | - | ||||||||||||||||||||||||||||||
| 3406 | if (effectTransform
| 0 | ||||||||||||||||||||||||||||||
| 3407 | painter->setWorldTransform(*transformPtr * *effectTransform); never executed: painter->setWorldTransform(*transformPtr * *effectTransform); | 0 | ||||||||||||||||||||||||||||||
| 3408 | else | - | ||||||||||||||||||||||||||||||
| 3409 | painter->setWorldTransform(*transformPtr); never executed: painter->setWorldTransform(*transformPtr); | 0 | ||||||||||||||||||||||||||||||
| 3410 | painter->setOpacity(opacity); | - | ||||||||||||||||||||||||||||||
| 3411 | - | |||||||||||||||||||||||||||||||
| 3412 | if (sourced->currentCachedSystem() != Qt::LogicalCoordinates
| 0 | ||||||||||||||||||||||||||||||
| 3413 | && sourced->lastEffectTransform != painter->worldTransform()
| 0 | ||||||||||||||||||||||||||||||
| 3414 | { | - | ||||||||||||||||||||||||||||||
| 3415 | if (sourced->lastEffectTransform.type() <= QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 3416 | && painter->worldTransform().type() <= QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 3417 | { | - | ||||||||||||||||||||||||||||||
| 3418 | QRectF sourceRect = sourced->boundingRect(Qt::DeviceCoordinates); | - | ||||||||||||||||||||||||||||||
| 3419 | QRect effectRect = sourced->paddedEffectRect(Qt::DeviceCoordinates, sourced->currentCachedMode(), sourceRect); | - | ||||||||||||||||||||||||||||||
| 3420 | - | |||||||||||||||||||||||||||||||
| 3421 | sourced->setCachedOffset(effectRect.topLeft()); | - | ||||||||||||||||||||||||||||||
| 3422 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3423 | sourced->invalidateCache(QGraphicsEffectSourcePrivate::TransformChanged); | - | ||||||||||||||||||||||||||||||
| 3424 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3425 | - | |||||||||||||||||||||||||||||||
| 3426 | sourced->lastEffectTransform = painter->worldTransform(); | - | ||||||||||||||||||||||||||||||
| 3427 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3428 | - | |||||||||||||||||||||||||||||||
| 3429 | item->d_ptr->graphicsEffect->draw(painter); | - | ||||||||||||||||||||||||||||||
| 3430 | painter->setWorldTransform(restoreTransform); | - | ||||||||||||||||||||||||||||||
| 3431 | sourced->info = 0; | - | ||||||||||||||||||||||||||||||
| 3432 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||||||||
| 3433 | - | |||||||||||||||||||||||||||||||
| 3434 | { | - | ||||||||||||||||||||||||||||||
| 3435 | draw(item, painter, viewTransform, transformPtr, exposedRegion, widget, opacity, | - | ||||||||||||||||||||||||||||||
| 3436 | effectTransform, wasDirtyParentSceneTransform, drawItem); | - | ||||||||||||||||||||||||||||||
| 3437 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3438 | } | - | ||||||||||||||||||||||||||||||
| 3439 | - | |||||||||||||||||||||||||||||||
| 3440 | static inline void setClip(QPainter *painter, QGraphicsItem *item) | - | ||||||||||||||||||||||||||||||
| 3441 | { | - | ||||||||||||||||||||||||||||||
| 3442 | painter->save(); | - | ||||||||||||||||||||||||||||||
| 3443 | QRectF clipRect; | - | ||||||||||||||||||||||||||||||
| 3444 | const QPainterPath clipPath(item->shape()); | - | ||||||||||||||||||||||||||||||
| 3445 | if (QPathClipper::pathToRect(clipPath, &clipRect)
| 0 | ||||||||||||||||||||||||||||||
| 3446 | painter->setClipRect(clipRect, Qt::IntersectClip); never executed: painter->setClipRect(clipRect, Qt::IntersectClip); | 0 | ||||||||||||||||||||||||||||||
| 3447 | else | - | ||||||||||||||||||||||||||||||
| 3448 | painter->setClipPath(clipPath, Qt::IntersectClip); never executed: painter->setClipPath(clipPath, Qt::IntersectClip); | 0 | ||||||||||||||||||||||||||||||
| 3449 | } | - | ||||||||||||||||||||||||||||||
| 3450 | - | |||||||||||||||||||||||||||||||
| 3451 | static inline void setWorldTransform(QPainter *painter, const QTransform *const transformPtr, | - | ||||||||||||||||||||||||||||||
| 3452 | const QTransform *effectTransform) | - | ||||||||||||||||||||||||||||||
| 3453 | { | - | ||||||||||||||||||||||||||||||
| 3454 | ((!(transformPtr)) ? qt_assert("transformPtr",__FILE__,4848) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3455 | if (effectTransform
| 0 | ||||||||||||||||||||||||||||||
| 3456 | painter->setWorldTransform(*transformPtr * *effectTransform); never executed: painter->setWorldTransform(*transformPtr * *effectTransform); | 0 | ||||||||||||||||||||||||||||||
| 3457 | else | - | ||||||||||||||||||||||||||||||
| 3458 | painter->setWorldTransform(*transformPtr); never executed: painter->setWorldTransform(*transformPtr); | 0 | ||||||||||||||||||||||||||||||
| 3459 | } | - | ||||||||||||||||||||||||||||||
| 3460 | - | |||||||||||||||||||||||||||||||
| 3461 | void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const QTransform *const viewTransform, | - | ||||||||||||||||||||||||||||||
| 3462 | const QTransform *const transformPtr, QRegion *exposedRegion, QWidget *widget, | - | ||||||||||||||||||||||||||||||
| 3463 | qreal opacity, const QTransform *effectTransform, | - | ||||||||||||||||||||||||||||||
| 3464 | bool wasDirtyParentSceneTransform, bool drawItem) | - | ||||||||||||||||||||||||||||||
| 3465 | { | - | ||||||||||||||||||||||||||||||
| 3466 | const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity); | - | ||||||||||||||||||||||||||||||
| 3467 | const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); | - | ||||||||||||||||||||||||||||||
| 3468 | const bool itemHasChildren = !item->d_ptr->children.isEmpty(); | - | ||||||||||||||||||||||||||||||
| 3469 | bool setChildClip = itemClipsChildrenToShape; | - | ||||||||||||||||||||||||||||||
| 3470 | bool itemHasChildrenStackedBehind = false; | - | ||||||||||||||||||||||||||||||
| 3471 | - | |||||||||||||||||||||||||||||||
| 3472 | int i = 0; | - | ||||||||||||||||||||||||||||||
| 3473 | if (itemHasChildren
| 0 | ||||||||||||||||||||||||||||||
| 3474 | if (itemClipsChildrenToShape
| 0 | ||||||||||||||||||||||||||||||
| 3475 | setWorldTransform(painter, transformPtr, effectTransform); never executed: setWorldTransform(painter, transformPtr, effectTransform); | 0 | ||||||||||||||||||||||||||||||
| 3476 | - | |||||||||||||||||||||||||||||||
| 3477 | item->d_ptr->ensureSortedChildren(); | - | ||||||||||||||||||||||||||||||
| 3478 | - | |||||||||||||||||||||||||||||||
| 3479 | - | |||||||||||||||||||||||||||||||
| 3480 | itemHasChildrenStackedBehind = (item->d_ptr->children.at(0)->d_ptr->flags | - | ||||||||||||||||||||||||||||||
| 3481 | & QGraphicsItem::ItemStacksBehindParent); | - | ||||||||||||||||||||||||||||||
| 3482 | - | |||||||||||||||||||||||||||||||
| 3483 | if (itemHasChildrenStackedBehind
| 0 | ||||||||||||||||||||||||||||||
| 3484 | if (itemClipsChildrenToShape
| 0 | ||||||||||||||||||||||||||||||
| 3485 | setClip(painter, item); | - | ||||||||||||||||||||||||||||||
| 3486 | setChildClip = false; | - | ||||||||||||||||||||||||||||||
| 3487 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3488 | - | |||||||||||||||||||||||||||||||
| 3489 | - | |||||||||||||||||||||||||||||||
| 3490 | for (i = 0; i < item->d_ptr->children.size()
| 0 | ||||||||||||||||||||||||||||||
| 3491 | QGraphicsItem *child = item->d_ptr->children.at(i); | - | ||||||||||||||||||||||||||||||
| 3492 | if (wasDirtyParentSceneTransform
| 0 | ||||||||||||||||||||||||||||||
| 3493 | child->d_ptr->dirtySceneTransform = 1; never executed: child->d_ptr->dirtySceneTransform = 1; | 0 | ||||||||||||||||||||||||||||||
| 3494 | if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent)
| 0 | ||||||||||||||||||||||||||||||
| 3495 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3496 | if (itemIsFullyTransparent
| 0 | ||||||||||||||||||||||||||||||
| 3497 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3498 | drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform); | - | ||||||||||||||||||||||||||||||
| 3499 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3500 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3501 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3502 | - | |||||||||||||||||||||||||||||||
| 3503 | - | |||||||||||||||||||||||||||||||
| 3504 | if (drawItem
| 0 | ||||||||||||||||||||||||||||||
| 3505 | ((!(!itemIsFullyTransparent)) ? qt_assert("!itemIsFullyTransparent",__FILE__,4899) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3506 | ((!(!(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents))) ? qt_assert("!(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents)",__FILE__,4900) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3507 | ((!(transformPtr)) ? qt_assert("transformPtr",__FILE__,4901) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3508 | item->d_ptr->initStyleOption(&styleOptionTmp, *transformPtr, exposedRegion | - | ||||||||||||||||||||||||||||||
| 3509 | ? *exposedRegion : QRegion(), exposedRegion == 0); | - | ||||||||||||||||||||||||||||||
| 3510 | - | |||||||||||||||||||||||||||||||
| 3511 | const bool itemClipsToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsToShape; | - | ||||||||||||||||||||||||||||||
| 3512 | bool restorePainterClip = false; | - | ||||||||||||||||||||||||||||||
| 3513 | - | |||||||||||||||||||||||||||||||
| 3514 | if (!itemHasChildren
| 0 | ||||||||||||||||||||||||||||||
| 3515 | - | |||||||||||||||||||||||||||||||
| 3516 | setWorldTransform(painter, transformPtr, effectTransform); | - | ||||||||||||||||||||||||||||||
| 3517 | if ((
| 0 | ||||||||||||||||||||||||||||||
| 3518 | setClip(painter, item); never executed: setClip(painter, item); | 0 | ||||||||||||||||||||||||||||||
| 3519 | } never executed: else if (itemHasChildrenStackedBehindend of block
| 0 | ||||||||||||||||||||||||||||||
| 3520 | - | |||||||||||||||||||||||||||||||
| 3521 | - | |||||||||||||||||||||||||||||||
| 3522 | if (itemClipsToShape
| 0 | ||||||||||||||||||||||||||||||
| 3523 | - | |||||||||||||||||||||||||||||||
| 3524 | setWorldTransform(painter, transformPtr, effectTransform); | - | ||||||||||||||||||||||||||||||
| 3525 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3526 | - | |||||||||||||||||||||||||||||||
| 3527 | painter->restore(); | - | ||||||||||||||||||||||||||||||
| 3528 | setChildClip = true; | - | ||||||||||||||||||||||||||||||
| 3529 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3530 | } else if (itemClipsToShape
| 0 | ||||||||||||||||||||||||||||||
| 3531 | - | |||||||||||||||||||||||||||||||
| 3532 | - | |||||||||||||||||||||||||||||||
| 3533 | - | |||||||||||||||||||||||||||||||
| 3534 | setClip(painter, item); | - | ||||||||||||||||||||||||||||||
| 3535 | setChildClip = false; | - | ||||||||||||||||||||||||||||||
| 3536 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3537 | - | |||||||||||||||||||||||||||||||
| 3538 | if (painterStateProtection
| 0 | ||||||||||||||||||||||||||||||
| 3539 | painter->save(); never executed: painter->save(); | 0 | ||||||||||||||||||||||||||||||
| 3540 | - | |||||||||||||||||||||||||||||||
| 3541 | painter->setOpacity(opacity); | - | ||||||||||||||||||||||||||||||
| 3542 | if (!item->d_ptr->cacheMode
| 0 | ||||||||||||||||||||||||||||||
| 3543 | item->paint(painter, &styleOptionTmp, widget); never executed: item->paint(painter, &styleOptionTmp, widget); | 0 | ||||||||||||||||||||||||||||||
| 3544 | else | - | ||||||||||||||||||||||||||||||
| 3545 | drawItemHelper(item, painter, &styleOptionTmp, widget, painterStateProtection); never executed: drawItemHelper(item, painter, &styleOptionTmp, widget, painterStateProtection); | 0 | ||||||||||||||||||||||||||||||
| 3546 | - | |||||||||||||||||||||||||||||||
| 3547 | if (painterStateProtection
| 0 | ||||||||||||||||||||||||||||||
| 3548 | painter->restore(); never executed: painter->restore(); | 0 | ||||||||||||||||||||||||||||||
| 3549 | - | |||||||||||||||||||||||||||||||
| 3550 | static int drawRect = qEnvironmentVariableIntValue("QT_DRAW_SCENE_ITEM_RECTS"); | - | ||||||||||||||||||||||||||||||
| 3551 | if (drawRect
| 0 | ||||||||||||||||||||||||||||||
| 3552 | QPen oldPen = painter->pen(); | - | ||||||||||||||||||||||||||||||
| 3553 | QBrush oldBrush = painter->brush(); | - | ||||||||||||||||||||||||||||||
| 3554 | quintptr ptr = reinterpret_cast<quintptr>(item); | - | ||||||||||||||||||||||||||||||
| 3555 | const QColor color = QColor::fromHsv(ptr % 255, 255, 255); | - | ||||||||||||||||||||||||||||||
| 3556 | painter->setPen(color); | - | ||||||||||||||||||||||||||||||
| 3557 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||
| 3558 | painter->drawRect(adjustedItemBoundingRect(item)); | - | ||||||||||||||||||||||||||||||
| 3559 | painter->setPen(oldPen); | - | ||||||||||||||||||||||||||||||
| 3560 | painter->setBrush(oldBrush); | - | ||||||||||||||||||||||||||||||
| 3561 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3562 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3563 | - | |||||||||||||||||||||||||||||||
| 3564 | - | |||||||||||||||||||||||||||||||
| 3565 | if (itemHasChildren
| 0 | ||||||||||||||||||||||||||||||
| 3566 | if (setChildClip
| 0 | ||||||||||||||||||||||||||||||
| 3567 | setClip(painter, item); never executed: setClip(painter, item); | 0 | ||||||||||||||||||||||||||||||
| 3568 | - | |||||||||||||||||||||||||||||||
| 3569 | for (; i < item->d_ptr->children.size()
| 0 | ||||||||||||||||||||||||||||||
| 3570 | QGraphicsItem *child = item->d_ptr->children.at(i); | - | ||||||||||||||||||||||||||||||
| 3571 | if (wasDirtyParentSceneTransform
| 0 | ||||||||||||||||||||||||||||||
| 3572 | child->d_ptr->dirtySceneTransform = 1; never executed: child->d_ptr->dirtySceneTransform = 1; | 0 | ||||||||||||||||||||||||||||||
| 3573 | if (itemIsFullyTransparent
| 0 | ||||||||||||||||||||||||||||||
| 3574 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3575 | drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform); | - | ||||||||||||||||||||||||||||||
| 3576 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3577 | - | |||||||||||||||||||||||||||||||
| 3578 | - | |||||||||||||||||||||||||||||||
| 3579 | if (itemClipsChildrenToShape
| 0 | ||||||||||||||||||||||||||||||
| 3580 | painter->restore(); never executed: painter->restore(); | 0 | ||||||||||||||||||||||||||||||
| 3581 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3582 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3583 | - | |||||||||||||||||||||||||||||||
| 3584 | void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, bool invalidateChildren, | - | ||||||||||||||||||||||||||||||
| 3585 | bool force, bool ignoreOpacity, bool removingItemFromScene, | - | ||||||||||||||||||||||||||||||
| 3586 | bool updateBoundingRect) | - | ||||||||||||||||||||||||||||||
| 3587 | { | - | ||||||||||||||||||||||||||||||
| 3588 | ((!(item)) ? qt_assert("item",__FILE__,4982) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3589 | if (updateAll
| 0 | ||||||||||||||||||||||||||||||
| 3590 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3591 | - | |||||||||||||||||||||||||||||||
| 3592 | if (removingItemFromScene
| 0 | ||||||||||||||||||||||||||||||
| 3593 | - | |||||||||||||||||||||||||||||||
| 3594 | - | |||||||||||||||||||||||||||||||
| 3595 | - | |||||||||||||||||||||||||||||||
| 3596 | - | |||||||||||||||||||||||||||||||
| 3597 | - | |||||||||||||||||||||||||||||||
| 3598 | - | |||||||||||||||||||||||||||||||
| 3599 | - | |||||||||||||||||||||||||||||||
| 3600 | QGraphicsItem *p = item->d_ptr->parent; | - | ||||||||||||||||||||||||||||||
| 3601 | while (p
| 0 | ||||||||||||||||||||||||||||||
| 3602 | if (p->d_ptr->ignoreOpacity
| 0 | ||||||||||||||||||||||||||||||
| 3603 | item->d_ptr->ignoreOpacity = true; | - | ||||||||||||||||||||||||||||||
| 3604 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3605 | } | - | ||||||||||||||||||||||||||||||
| 3606 | p = p->d_ptr->parent; | - | ||||||||||||||||||||||||||||||
| 3607 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3608 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3609 | - | |||||||||||||||||||||||||||||||
| 3610 | if (item->d_ptr->discardUpdateRequest( force,
| 0 | ||||||||||||||||||||||||||||||
| 3611 | removingItemFromScene || invalidateChildren,
| 0 | ||||||||||||||||||||||||||||||
| 3612 | ignoreOpacity)
| 0 | ||||||||||||||||||||||||||||||
| 3613 | if (item->d_ptr->dirty
| 0 | ||||||||||||||||||||||||||||||
| 3614 | - | |||||||||||||||||||||||||||||||
| 3615 | - | |||||||||||||||||||||||||||||||
| 3616 | - | |||||||||||||||||||||||||||||||
| 3617 | - | |||||||||||||||||||||||||||||||
| 3618 | if (force
| 0 | ||||||||||||||||||||||||||||||
| 3619 | item->d_ptr->ignoreVisible = 1; never executed: item->d_ptr->ignoreVisible = 1; | 0 | ||||||||||||||||||||||||||||||
| 3620 | if (ignoreOpacity
| 0 | ||||||||||||||||||||||||||||||
| 3621 | item->d_ptr->ignoreOpacity = 1; never executed: item->d_ptr->ignoreOpacity = 1; | 0 | ||||||||||||||||||||||||||||||
| 3622 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3623 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3624 | } | - | ||||||||||||||||||||||||||||||
| 3625 | - | |||||||||||||||||||||||||||||||
| 3626 | const bool fullItemUpdate = rect.isNull(); | - | ||||||||||||||||||||||||||||||
| 3627 | if (!fullItemUpdate
| 0 | ||||||||||||||||||||||||||||||
| 3628 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3629 | - | |||||||||||||||||||||||||||||||
| 3630 | if (!processDirtyItemsEmitted
| 0 | ||||||||||||||||||||||||||||||
| 3631 | QMetaMethod method = q_ptr->metaObject()->method(processDirtyItemsIndex); | - | ||||||||||||||||||||||||||||||
| 3632 | method.invoke(q_ptr, Qt::QueuedConnection); | - | ||||||||||||||||||||||||||||||
| 3633 | - | |||||||||||||||||||||||||||||||
| 3634 | processDirtyItemsEmitted = true; | - | ||||||||||||||||||||||||||||||
| 3635 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3636 | - | |||||||||||||||||||||||||||||||
| 3637 | if (removingItemFromScene
| 0 | ||||||||||||||||||||||||||||||
| 3638 | - | |||||||||||||||||||||||||||||||
| 3639 | - | |||||||||||||||||||||||||||||||
| 3640 | if (isSignalConnected(changedSignalIndex)
| 0 | ||||||||||||||||||||||||||||||
| 3641 | - | |||||||||||||||||||||||||||||||
| 3642 | - | |||||||||||||||||||||||||||||||
| 3643 | - | |||||||||||||||||||||||||||||||
| 3644 | q_func()->update(); | - | ||||||||||||||||||||||||||||||
| 3645 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3646 | } | - | ||||||||||||||||||||||||||||||
| 3647 | - | |||||||||||||||||||||||||||||||
| 3648 | for (int i = 0; i < views.size()
| 0 | ||||||||||||||||||||||||||||||
| 3649 | QGraphicsViewPrivate *viewPrivate = views.at(i)->d_func(); | - | ||||||||||||||||||||||||||||||
| 3650 | QRect rect = item->d_ptr->paintedViewBoundingRects.value(viewPrivate->viewport); | - | ||||||||||||||||||||||||||||||
| 3651 | rect.translate(viewPrivate->dirtyScrollOffset); | - | ||||||||||||||||||||||||||||||
| 3652 | viewPrivate->updateRect(rect); | - | ||||||||||||||||||||||||||||||
| 3653 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3654 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3655 | } | - | ||||||||||||||||||||||||||||||
| 3656 | - | |||||||||||||||||||||||||||||||
| 3657 | bool hasNoContents = item->d_ptr->flags & QGraphicsItem::ItemHasNoContents; | - | ||||||||||||||||||||||||||||||
| 3658 | if (!hasNoContents
| 0 | ||||||||||||||||||||||||||||||
| 3659 | item->d_ptr->dirty = 1; | - | ||||||||||||||||||||||||||||||
| 3660 | if (fullItemUpdate
| 0 | ||||||||||||||||||||||||||||||
| 3661 | item->d_ptr->fullUpdatePending = 1; never executed: item->d_ptr->fullUpdatePending = 1; | 0 | ||||||||||||||||||||||||||||||
| 3662 | else if (!item->d_ptr->fullUpdatePending
| 0 | ||||||||||||||||||||||||||||||
| 3663 | item->d_ptr->needsRepaint |= rect; never executed: item->d_ptr->needsRepaint |= rect; | 0 | ||||||||||||||||||||||||||||||
| 3664 | } never executed: else if (item->d_ptr->graphicsEffectend of block
| 0 | ||||||||||||||||||||||||||||||
| 3665 | invalidateChildren = true; | - | ||||||||||||||||||||||||||||||
| 3666 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3667 | - | |||||||||||||||||||||||||||||||
| 3668 | if (invalidateChildren
| 0 | ||||||||||||||||||||||||||||||
| 3669 | item->d_ptr->allChildrenDirty = 1; | - | ||||||||||||||||||||||||||||||
| 3670 | item->d_ptr->dirtyChildren = 1; | - | ||||||||||||||||||||||||||||||
| 3671 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3672 | - | |||||||||||||||||||||||||||||||
| 3673 | if (force
| 0 | ||||||||||||||||||||||||||||||
| 3674 | item->d_ptr->ignoreVisible = 1; never executed: item->d_ptr->ignoreVisible = 1; | 0 | ||||||||||||||||||||||||||||||
| 3675 | if (ignoreOpacity
| 0 | ||||||||||||||||||||||||||||||
| 3676 | item->d_ptr->ignoreOpacity = 1; never executed: item->d_ptr->ignoreOpacity = 1; | 0 | ||||||||||||||||||||||||||||||
| 3677 | - | |||||||||||||||||||||||||||||||
| 3678 | if (!updateBoundingRect
| 0 | ||||||||||||||||||||||||||||||
| 3679 | item->d_ptr->markParentDirty(); never executed: item->d_ptr->markParentDirty(); | 0 | ||||||||||||||||||||||||||||||
| 3680 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3681 | - | |||||||||||||||||||||||||||||||
| 3682 | static inline bool updateHelper(QGraphicsViewPrivate *view, QGraphicsItemPrivate *item, | - | ||||||||||||||||||||||||||||||
| 3683 | const QRectF &rect, bool itemIsUntransformable) | - | ||||||||||||||||||||||||||||||
| 3684 | { | - | ||||||||||||||||||||||||||||||
| 3685 | ((!(view)) ? qt_assert("view",__FILE__,5079) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3686 | ((!(item)) ? qt_assert("item",__FILE__,5080) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3687 | - | |||||||||||||||||||||||||||||||
| 3688 | QGraphicsItem *itemq = static_cast<QGraphicsItem *>(item->q_ptr); | - | ||||||||||||||||||||||||||||||
| 3689 | QGraphicsView *viewq = static_cast<QGraphicsView *>(view->q_ptr); | - | ||||||||||||||||||||||||||||||
| 3690 | - | |||||||||||||||||||||||||||||||
| 3691 | if (itemIsUntransformable
| 0 | ||||||||||||||||||||||||||||||
| 3692 | const QTransform xform = itemq->deviceTransform(viewq->viewportTransform()); | - | ||||||||||||||||||||||||||||||
| 3693 | if (!item->hasBoundingRegionGranularity
| 0 | ||||||||||||||||||||||||||||||
| 3694 | return never executed: view->updateRectF(xform.mapRect(rect));return view->updateRectF(xform.mapRect(rect));never executed: return view->updateRectF(xform.mapRect(rect)); | 0 | ||||||||||||||||||||||||||||||
| 3695 | return never executed: view->updateRegion(rect, xform);return view->updateRegion(rect, xform);never executed: return view->updateRegion(rect, xform); | 0 | ||||||||||||||||||||||||||||||
| 3696 | } | - | ||||||||||||||||||||||||||||||
| 3697 | - | |||||||||||||||||||||||||||||||
| 3698 | if (item->sceneTransformTranslateOnly
| 0 | ||||||||||||||||||||||||||||||
| 3699 | const qreal dx = item->sceneTransform.dx(); | - | ||||||||||||||||||||||||||||||
| 3700 | const qreal dy = item->sceneTransform.dy(); | - | ||||||||||||||||||||||||||||||
| 3701 | QRectF r(rect); | - | ||||||||||||||||||||||||||||||
| 3702 | r.translate(dx - view->horizontalScroll(), dy - view->verticalScroll()); | - | ||||||||||||||||||||||||||||||
| 3703 | return never executed: view->updateRectF(r);return view->updateRectF(r);never executed: return view->updateRectF(r); | 0 | ||||||||||||||||||||||||||||||
| 3704 | } | - | ||||||||||||||||||||||||||||||
| 3705 | - | |||||||||||||||||||||||||||||||
| 3706 | if (!viewq->isTransformed()
| 0 | ||||||||||||||||||||||||||||||
| 3707 | if (!item->hasBoundingRegionGranularity
| 0 | ||||||||||||||||||||||||||||||
| 3708 | return never executed: view->updateRectF(item->sceneTransform.mapRect(rect));return view->updateRectF(item->sceneTransform.mapRect(rect));never executed: return view->updateRectF(item->sceneTransform.mapRect(rect)); | 0 | ||||||||||||||||||||||||||||||
| 3709 | return never executed: view->updateRegion(rect, item->sceneTransform);return view->updateRegion(rect, item->sceneTransform);never executed: return view->updateRegion(rect, item->sceneTransform); | 0 | ||||||||||||||||||||||||||||||
| 3710 | } | - | ||||||||||||||||||||||||||||||
| 3711 | - | |||||||||||||||||||||||||||||||
| 3712 | QTransform xform = item->sceneTransform; | - | ||||||||||||||||||||||||||||||
| 3713 | xform *= viewq->viewportTransform(); | - | ||||||||||||||||||||||||||||||
| 3714 | if (!item->hasBoundingRegionGranularity
| 0 | ||||||||||||||||||||||||||||||
| 3715 | return never executed: view->updateRectF(xform.mapRect(rect));return view->updateRectF(xform.mapRect(rect));never executed: return view->updateRectF(xform.mapRect(rect)); | 0 | ||||||||||||||||||||||||||||||
| 3716 | return never executed: view->updateRegion(rect, xform);return view->updateRegion(rect, xform);never executed: return view->updateRegion(rect, xform); | 0 | ||||||||||||||||||||||||||||||
| 3717 | } | - | ||||||||||||||||||||||||||||||
| 3718 | - | |||||||||||||||||||||||||||||||
| 3719 | void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool dirtyAncestorContainsChildren, | - | ||||||||||||||||||||||||||||||
| 3720 | qreal parentOpacity) | - | ||||||||||||||||||||||||||||||
| 3721 | { | - | ||||||||||||||||||||||||||||||
| 3722 | QGraphicsScene * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 3723 | ((!(item)) ? qt_assert("item",__FILE__,5117) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3724 | ((!(!updateAll)) ? qt_assert("!updateAll",__FILE__,5118) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3725 | - | |||||||||||||||||||||||||||||||
| 3726 | if (!item->d_ptr->dirty
| 0 | ||||||||||||||||||||||||||||||
| 3727 | resetDirtyItem(item); | - | ||||||||||||||||||||||||||||||
| 3728 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3729 | } | - | ||||||||||||||||||||||||||||||
| 3730 | - | |||||||||||||||||||||||||||||||
| 3731 | const bool itemIsHidden = !item->d_ptr->ignoreVisible
| 0 | ||||||||||||||||||||||||||||||
| 3732 | if (itemIsHidden
| 0 | ||||||||||||||||||||||||||||||
| 3733 | resetDirtyItem(item, true); | - | ||||||||||||||||||||||||||||||
| 3734 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3735 | } | - | ||||||||||||||||||||||||||||||
| 3736 | - | |||||||||||||||||||||||||||||||
| 3737 | bool itemHasContents = !(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents); | - | ||||||||||||||||||||||||||||||
| 3738 | const bool itemHasChildren = !item->d_ptr->children.isEmpty(); | - | ||||||||||||||||||||||||||||||
| 3739 | if (!itemHasContents
| 0 | ||||||||||||||||||||||||||||||
| 3740 | if (!itemHasChildren
| 0 | ||||||||||||||||||||||||||||||
| 3741 | resetDirtyItem(item); | - | ||||||||||||||||||||||||||||||
| 3742 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3743 | } | - | ||||||||||||||||||||||||||||||
| 3744 | if (item->d_ptr->graphicsEffect
| 0 | ||||||||||||||||||||||||||||||
| 3745 | itemHasContents = true; never executed: itemHasContents = true; | 0 | ||||||||||||||||||||||||||||||
| 3746 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3747 | - | |||||||||||||||||||||||||||||||
| 3748 | const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); | - | ||||||||||||||||||||||||||||||
| 3749 | const bool itemIsFullyTransparent = !item->d_ptr->ignoreOpacity
| 0 | ||||||||||||||||||||||||||||||
| 3750 | && QGraphicsItemPrivate::isOpacityNull(opacity)
| 0 | ||||||||||||||||||||||||||||||
| 3751 | if (itemIsFullyTransparent
| 0 | ||||||||||||||||||||||||||||||
| 3752 | resetDirtyItem(item, itemHasChildren); | - | ||||||||||||||||||||||||||||||
| 3753 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3754 | } | - | ||||||||||||||||||||||||||||||
| 3755 | - | |||||||||||||||||||||||||||||||
| 3756 | bool wasDirtyParentSceneTransform = item->d_ptr->dirtySceneTransform; | - | ||||||||||||||||||||||||||||||
| 3757 | const bool itemIsUntransformable = item->d_ptr->itemIsUntransformable(); | - | ||||||||||||||||||||||||||||||
| 3758 | if (wasDirtyParentSceneTransform
| 0 | ||||||||||||||||||||||||||||||
| 3759 | item->d_ptr->updateSceneTransformFromParent(); | - | ||||||||||||||||||||||||||||||
| 3760 | ((!(!item->d_ptr->dirtySceneTransform)) ? qt_assert("!item->d_ptr->dirtySceneTransform",__FILE__,5154) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3761 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3762 | - | |||||||||||||||||||||||||||||||
| 3763 | const bool wasDirtyParentViewBoundingRects = item->d_ptr->paintedViewBoundingRectsNeedRepaint; | - | ||||||||||||||||||||||||||||||
| 3764 | if (itemIsFullyTransparent
| 0 | ||||||||||||||||||||||||||||||
| 3765 | - | |||||||||||||||||||||||||||||||
| 3766 | item->d_ptr->dirty = 0; | - | ||||||||||||||||||||||||||||||
| 3767 | item->d_ptr->fullUpdatePending = 0; | - | ||||||||||||||||||||||||||||||
| 3768 | - | |||||||||||||||||||||||||||||||
| 3769 | if (itemIsFullyTransparent
| 0 | ||||||||||||||||||||||||||||||
| 3770 | item->d_ptr->paintedViewBoundingRectsNeedRepaint = 0; never executed: item->d_ptr->paintedViewBoundingRectsNeedRepaint = 0; | 0 | ||||||||||||||||||||||||||||||
| 3771 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3772 | - | |||||||||||||||||||||||||||||||
| 3773 | if (!hasSceneRect
| 0 | ||||||||||||||||||||||||||||||
| 3774 | - | |||||||||||||||||||||||||||||||
| 3775 | if (item->d_ptr->sceneTransformTranslateOnly
| 0 | ||||||||||||||||||||||||||||||
| 3776 | growingItemsBoundingRect |= item->boundingRect().translated(item->d_ptr->sceneTransform.dx(), | - | ||||||||||||||||||||||||||||||
| 3777 | item->d_ptr->sceneTransform.dy()); | - | ||||||||||||||||||||||||||||||
| 3778 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3779 | growingItemsBoundingRect |= item->d_ptr->sceneTransform.mapRect(item->boundingRect()); | - | ||||||||||||||||||||||||||||||
| 3780 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3781 | } | - | ||||||||||||||||||||||||||||||
| 3782 | - | |||||||||||||||||||||||||||||||
| 3783 | - | |||||||||||||||||||||||||||||||
| 3784 | if (item->d_ptr->dirty
| 0 | ||||||||||||||||||||||||||||||
| 3785 | const bool useCompatUpdate = views.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 3786 | const QRectF itemBoundingRect = adjustedItemEffectiveBoundingRect(item); | - | ||||||||||||||||||||||||||||||
| 3787 | - | |||||||||||||||||||||||||||||||
| 3788 | if (useCompatUpdate
| 0 | ||||||||||||||||||||||||||||||
| 3789 | - | |||||||||||||||||||||||||||||||
| 3790 | - | |||||||||||||||||||||||||||||||
| 3791 | - | |||||||||||||||||||||||||||||||
| 3792 | if (item->d_ptr->sceneTransformTranslateOnly
| 0 | ||||||||||||||||||||||||||||||
| 3793 | q->update(itemBoundingRect.translated(item->d_ptr->sceneTransform.dx(), | - | ||||||||||||||||||||||||||||||
| 3794 | item->d_ptr->sceneTransform.dy())); | - | ||||||||||||||||||||||||||||||
| 3795 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3796 | QRectF rect = item->d_ptr->sceneTransform.mapRect(itemBoundingRect); | - | ||||||||||||||||||||||||||||||
| 3797 | if (!rect.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 3798 | q->update(rect); never executed: q->update(rect); | 0 | ||||||||||||||||||||||||||||||
| 3799 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3800 | } else { | - | ||||||||||||||||||||||||||||||
| 3801 | QRectF dirtyRect; | - | ||||||||||||||||||||||||||||||
| 3802 | bool uninitializedDirtyRect = true; | - | ||||||||||||||||||||||||||||||
| 3803 | - | |||||||||||||||||||||||||||||||
| 3804 | for (int j = 0; j < views.size()
| 0 | ||||||||||||||||||||||||||||||
| 3805 | QGraphicsView *view = views.at(j); | - | ||||||||||||||||||||||||||||||
| 3806 | QGraphicsViewPrivate *viewPrivate = view->d_func(); | - | ||||||||||||||||||||||||||||||
| 3807 | QRect &paintedViewBoundingRect = item->d_ptr->paintedViewBoundingRects[viewPrivate->viewport]; | - | ||||||||||||||||||||||||||||||
| 3808 | if (viewPrivate->fullUpdatePending
| 0 | ||||||||||||||||||||||||||||||
| 3809 | || viewPrivate->viewportUpdateMode == QGraphicsView::NoViewportUpdate
| 0 | ||||||||||||||||||||||||||||||
| 3810 | - | |||||||||||||||||||||||||||||||
| 3811 | - | |||||||||||||||||||||||||||||||
| 3812 | - | |||||||||||||||||||||||||||||||
| 3813 | paintedViewBoundingRect = QRect(-1, -1, -1, -1); | - | ||||||||||||||||||||||||||||||
| 3814 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3815 | } | - | ||||||||||||||||||||||||||||||
| 3816 | - | |||||||||||||||||||||||||||||||
| 3817 | if (item->d_ptr->paintedViewBoundingRectsNeedRepaint
| 0 | ||||||||||||||||||||||||||||||
| 3818 | paintedViewBoundingRect.translate(viewPrivate->dirtyScrollOffset); | - | ||||||||||||||||||||||||||||||
| 3819 | if (!viewPrivate->updateRect(paintedViewBoundingRect)
| 0 | ||||||||||||||||||||||||||||||
| 3820 | paintedViewBoundingRect = QRect(-1, -1, -1, -1); never executed: paintedViewBoundingRect = QRect(-1, -1, -1, -1); | 0 | ||||||||||||||||||||||||||||||
| 3821 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3822 | - | |||||||||||||||||||||||||||||||
| 3823 | if (!item->d_ptr->dirty
| 0 | ||||||||||||||||||||||||||||||
| 3824 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3825 | - | |||||||||||||||||||||||||||||||
| 3826 | if (!item->d_ptr->paintedViewBoundingRectsNeedRepaint
| 0 | ||||||||||||||||||||||||||||||
| 3827 | && paintedViewBoundingRect.x() == -1
| 0 | ||||||||||||||||||||||||||||||
| 3828 | && paintedViewBoundingRect.width() == -1
| 0 | ||||||||||||||||||||||||||||||
| 3829 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3830 | } | - | ||||||||||||||||||||||||||||||
| 3831 | - | |||||||||||||||||||||||||||||||
| 3832 | if (uninitializedDirtyRect
| 0 | ||||||||||||||||||||||||||||||
| 3833 | dirtyRect = itemBoundingRect; | - | ||||||||||||||||||||||||||||||
| 3834 | if (!item->d_ptr->fullUpdatePending
| 0 | ||||||||||||||||||||||||||||||
| 3835 | _q_adjustRect(&item->d_ptr->needsRepaint); | - | ||||||||||||||||||||||||||||||
| 3836 | dirtyRect &= item->d_ptr->needsRepaint; | - | ||||||||||||||||||||||||||||||
| 3837 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3838 | uninitializedDirtyRect = false; | - | ||||||||||||||||||||||||||||||
| 3839 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3840 | - | |||||||||||||||||||||||||||||||
| 3841 | if (dirtyRect.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 3842 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3843 | - | |||||||||||||||||||||||||||||||
| 3844 | if (!updateHelper(viewPrivate, item->d_ptr.data(), dirtyRect, itemIsUntransformable)
| 0 | ||||||||||||||||||||||||||||||
| 3845 | && item->d_ptr->paintedViewBoundingRectsNeedRepaint
| 0 | ||||||||||||||||||||||||||||||
| 3846 | paintedViewBoundingRect = QRect(-1, -1, -1, -1); | - | ||||||||||||||||||||||||||||||
| 3847 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3848 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3849 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3850 | } | - | ||||||||||||||||||||||||||||||
| 3851 | - | |||||||||||||||||||||||||||||||
| 3852 | - | |||||||||||||||||||||||||||||||
| 3853 | if (itemHasChildren
| 0 | ||||||||||||||||||||||||||||||
| 3854 | const bool itemClipsChildrenToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape
| 0 | ||||||||||||||||||||||||||||||
| 3855 | || item->d_ptr->flags & QGraphicsItem::ItemContainsChildrenInShape
| 0 | ||||||||||||||||||||||||||||||
| 3856 | - | |||||||||||||||||||||||||||||||
| 3857 | - | |||||||||||||||||||||||||||||||
| 3858 | - | |||||||||||||||||||||||||||||||
| 3859 | - | |||||||||||||||||||||||||||||||
| 3860 | const bool bypassUpdateClip = !itemHasContents
| 0 | ||||||||||||||||||||||||||||||
| 3861 | if (itemClipsChildrenToShape
| 0 | ||||||||||||||||||||||||||||||
| 3862 | - | |||||||||||||||||||||||||||||||
| 3863 | for (int i = 0; i < views.size()
| 0 | ||||||||||||||||||||||||||||||
| 3864 | views.at(i)->d_func()->setUpdateClip(item); never executed: views.at(i)->d_func()->setUpdateClip(item); | 0 | ||||||||||||||||||||||||||||||
| 3865 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3866 | if (!dirtyAncestorContainsChildren
| 0 | ||||||||||||||||||||||||||||||
| 3867 | dirtyAncestorContainsChildren = item->d_ptr->fullUpdatePending
| 0 | ||||||||||||||||||||||||||||||
| 3868 | && itemClipsChildrenToShape
| 0 | ||||||||||||||||||||||||||||||
| 3869 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3870 | const bool allChildrenDirty = item->d_ptr->allChildrenDirty; | - | ||||||||||||||||||||||||||||||
| 3871 | const bool parentIgnoresVisible = item->d_ptr->ignoreVisible; | - | ||||||||||||||||||||||||||||||
| 3872 | const bool parentIgnoresOpacity = item->d_ptr->ignoreOpacity; | - | ||||||||||||||||||||||||||||||
| 3873 | for (int i = 0; i < item->d_ptr->children.size()
| 0 | ||||||||||||||||||||||||||||||
| 3874 | QGraphicsItem *child = item->d_ptr->children.at(i); | - | ||||||||||||||||||||||||||||||
| 3875 | if (wasDirtyParentSceneTransform
| 0 | ||||||||||||||||||||||||||||||
| 3876 | child->d_ptr->dirtySceneTransform = 1; never executed: child->d_ptr->dirtySceneTransform = 1; | 0 | ||||||||||||||||||||||||||||||
| 3877 | if (wasDirtyParentViewBoundingRects
| 0 | ||||||||||||||||||||||||||||||
| 3878 | child->d_ptr->paintedViewBoundingRectsNeedRepaint = 1; never executed: child->d_ptr->paintedViewBoundingRectsNeedRepaint = 1; | 0 | ||||||||||||||||||||||||||||||
| 3879 | if (parentIgnoresVisible
| 0 | ||||||||||||||||||||||||||||||
| 3880 | child->d_ptr->ignoreVisible = 1; never executed: child->d_ptr->ignoreVisible = 1; | 0 | ||||||||||||||||||||||||||||||
| 3881 | if (parentIgnoresOpacity
| 0 | ||||||||||||||||||||||||||||||
| 3882 | child->d_ptr->ignoreOpacity = 1; never executed: child->d_ptr->ignoreOpacity = 1; | 0 | ||||||||||||||||||||||||||||||
| 3883 | if (allChildrenDirty
| 0 | ||||||||||||||||||||||||||||||
| 3884 | child->d_ptr->dirty = 1; | - | ||||||||||||||||||||||||||||||
| 3885 | child->d_ptr->fullUpdatePending = 1; | - | ||||||||||||||||||||||||||||||
| 3886 | child->d_ptr->dirtyChildren = 1; | - | ||||||||||||||||||||||||||||||
| 3887 | child->d_ptr->allChildrenDirty = 1; | - | ||||||||||||||||||||||||||||||
| 3888 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3889 | processDirtyItemsRecursive(child, dirtyAncestorContainsChildren, opacity); | - | ||||||||||||||||||||||||||||||
| 3890 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3891 | - | |||||||||||||||||||||||||||||||
| 3892 | if (itemClipsChildrenToShape
| 0 | ||||||||||||||||||||||||||||||
| 3893 | - | |||||||||||||||||||||||||||||||
| 3894 | for (int i = 0; i < views.size()
| 0 | ||||||||||||||||||||||||||||||
| 3895 | views.at(i)->d_func()->setUpdateClip(0); never executed: views.at(i)->d_func()->setUpdateClip(0); | 0 | ||||||||||||||||||||||||||||||
| 3896 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3897 | } never executed: else if (wasDirtyParentSceneTransformend of block
| 0 | ||||||||||||||||||||||||||||||
| 3898 | item->d_ptr->invalidateChildrenSceneTransform(); | - | ||||||||||||||||||||||||||||||
| 3899 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3900 | - | |||||||||||||||||||||||||||||||
| 3901 | resetDirtyItem(item); | - | ||||||||||||||||||||||||||||||
| 3902 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3903 | void QGraphicsScene::drawItems(QPainter *painter, | - | ||||||||||||||||||||||||||||||
| 3904 | int numItems, | - | ||||||||||||||||||||||||||||||
| 3905 | QGraphicsItem *items[], | - | ||||||||||||||||||||||||||||||
| 3906 | const QStyleOptionGraphicsItem options[], QWidget *widget) | - | ||||||||||||||||||||||||||||||
| 3907 | { | - | ||||||||||||||||||||||||||||||
| 3908 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 3909 | - | |||||||||||||||||||||||||||||||
| 3910 | if (!d->unpolishedItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 3911 | d->_q_polishItems(); never executed: d->_q_polishItems(); | 0 | ||||||||||||||||||||||||||||||
| 3912 | - | |||||||||||||||||||||||||||||||
| 3913 | const qreal opacity = painter->opacity(); | - | ||||||||||||||||||||||||||||||
| 3914 | QTransform viewTransform = painter->worldTransform(); | - | ||||||||||||||||||||||||||||||
| 3915 | (void)options;; | - | ||||||||||||||||||||||||||||||
| 3916 | - | |||||||||||||||||||||||||||||||
| 3917 | - | |||||||||||||||||||||||||||||||
| 3918 | QGraphicsView *view = widget
| 0 | ||||||||||||||||||||||||||||||
| 3919 | QRegion *expose = 0; | - | ||||||||||||||||||||||||||||||
| 3920 | const quint32 oldRectAdjust = d->rectAdjust; | - | ||||||||||||||||||||||||||||||
| 3921 | if (view
| 0 | ||||||||||||||||||||||||||||||
| 3922 | d->updateAll = false; | - | ||||||||||||||||||||||||||||||
| 3923 | expose = &view->d_func()->exposedRegion; | - | ||||||||||||||||||||||||||||||
| 3924 | if (view->d_func()->optimizationFlags & QGraphicsView::DontAdjustForAntialiasing
| 0 | ||||||||||||||||||||||||||||||
| 3925 | d->rectAdjust = 1; never executed: d->rectAdjust = 1; | 0 | ||||||||||||||||||||||||||||||
| 3926 | else | - | ||||||||||||||||||||||||||||||
| 3927 | d->rectAdjust = 2; never executed: d->rectAdjust = 2; | 0 | ||||||||||||||||||||||||||||||
| 3928 | } | - | ||||||||||||||||||||||||||||||
| 3929 | - | |||||||||||||||||||||||||||||||
| 3930 | - | |||||||||||||||||||||||||||||||
| 3931 | QList<QGraphicsItem *> topLevelItems; | - | ||||||||||||||||||||||||||||||
| 3932 | for (int i = 0; i < numItems
| 0 | ||||||||||||||||||||||||||||||
| 3933 | QGraphicsItem *item = items[i]->topLevelItem(); | - | ||||||||||||||||||||||||||||||
| 3934 | if (!item->d_ptr->itemDiscovered
| 0 | ||||||||||||||||||||||||||||||
| 3935 | topLevelItems << item; | - | ||||||||||||||||||||||||||||||
| 3936 | item->d_ptr->itemDiscovered = 1; | - | ||||||||||||||||||||||||||||||
| 3937 | d->drawSubtreeRecursive(item, painter, &viewTransform, expose, widget); | - | ||||||||||||||||||||||||||||||
| 3938 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3939 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3940 | - | |||||||||||||||||||||||||||||||
| 3941 | d->rectAdjust = oldRectAdjust; | - | ||||||||||||||||||||||||||||||
| 3942 | - | |||||||||||||||||||||||||||||||
| 3943 | for (int i = 0; i < topLevelItems.size()
| 0 | ||||||||||||||||||||||||||||||
| 3944 | topLevelItems.at(i)->d_ptr->itemDiscovered = 0; never executed: topLevelItems.at(i)->d_ptr->itemDiscovered = 0; | 0 | ||||||||||||||||||||||||||||||
| 3945 | - | |||||||||||||||||||||||||||||||
| 3946 | painter->setWorldTransform(viewTransform); | - | ||||||||||||||||||||||||||||||
| 3947 | painter->setOpacity(opacity); | - | ||||||||||||||||||||||||||||||
| 3948 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3949 | bool QGraphicsScene::focusNextPrevChild(bool next) | - | ||||||||||||||||||||||||||||||
| 3950 | { | - | ||||||||||||||||||||||||||||||
| 3951 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 3952 | - | |||||||||||||||||||||||||||||||
| 3953 | QGraphicsItem *item = focusItem(); | - | ||||||||||||||||||||||||||||||
| 3954 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 3955 | - | |||||||||||||||||||||||||||||||
| 3956 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 3957 | } | - | ||||||||||||||||||||||||||||||
| 3958 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 3959 | if (d->lastFocusItem
| 0 | ||||||||||||||||||||||||||||||
| 3960 | - | |||||||||||||||||||||||||||||||
| 3961 | - | |||||||||||||||||||||||||||||||
| 3962 | setFocusItem(d->lastFocusItem, next ? Qt::TabFocusReason : Qt::BacktabFocusReason); | - | ||||||||||||||||||||||||||||||
| 3963 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 3964 | } | - | ||||||||||||||||||||||||||||||
| 3965 | if (d->activePanel
| 0 | ||||||||||||||||||||||||||||||
| 3966 | if (d->activePanel->flags() & QGraphicsItem::ItemIsFocusable
| 0 | ||||||||||||||||||||||||||||||
| 3967 | setFocusItem(d->activePanel, next ? Qt::TabFocusReason : Qt::BacktabFocusReason); | - | ||||||||||||||||||||||||||||||
| 3968 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 3969 | } | - | ||||||||||||||||||||||||||||||
| 3970 | if (d->activePanel->isWidget()
| 0 | ||||||||||||||||||||||||||||||
| 3971 | QGraphicsWidget *fw = static_cast<QGraphicsWidget *>(d->activePanel)->d_func()->focusNext; | - | ||||||||||||||||||||||||||||||
| 3972 | do { | - | ||||||||||||||||||||||||||||||
| 3973 | if (fw->focusPolicy() & Qt::TabFocus
| 0 | ||||||||||||||||||||||||||||||
| 3974 | setFocusItem(fw, next ? Qt::TabFocusReason : Qt::BacktabFocusReason); | - | ||||||||||||||||||||||||||||||
| 3975 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 3976 | } | - | ||||||||||||||||||||||||||||||
| 3977 | } never executed: while (fw != d->activePanelend of block
| 0 | ||||||||||||||||||||||||||||||
| 3978 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3979 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3980 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3981 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 3982 | - | |||||||||||||||||||||||||||||||
| 3983 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 3984 | } | - | ||||||||||||||||||||||||||||||
| 3985 | - | |||||||||||||||||||||||||||||||
| 3986 | - | |||||||||||||||||||||||||||||||
| 3987 | QGraphicsWidget *widget = 0; | - | ||||||||||||||||||||||||||||||
| 3988 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 3989 | widget = next
| 0 | ||||||||||||||||||||||||||||||
| 3990 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3991 | QGraphicsWidget *test = static_cast<QGraphicsWidget *>(item); | - | ||||||||||||||||||||||||||||||
| 3992 | widget = next
| 0 | ||||||||||||||||||||||||||||||
| 3993 | if (!widget->panel()
| 0 | ||||||||||||||||||||||||||||||
| 3994 | - | |||||||||||||||||||||||||||||||
| 3995 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 3996 | } | - | ||||||||||||||||||||||||||||||
| 3997 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3998 | QGraphicsWidget *widgetThatHadFocus = widget; | - | ||||||||||||||||||||||||||||||
| 3999 | - | |||||||||||||||||||||||||||||||
| 4000 | - | |||||||||||||||||||||||||||||||
| 4001 | do { | - | ||||||||||||||||||||||||||||||
| 4002 | if (widget->flags() & QGraphicsItem::ItemIsFocusable
| 0 | ||||||||||||||||||||||||||||||
| 4003 | && widget->isEnabled()
| 0 | ||||||||||||||||||||||||||||||
| 4004 | && (
| 0 | ||||||||||||||||||||||||||||||
| 4005 | && (!item
| 0 | ||||||||||||||||||||||||||||||
| 4006 | ) { | - | ||||||||||||||||||||||||||||||
| 4007 | setFocusItem(widget, next ? Qt::TabFocusReason : Qt::BacktabFocusReason); | - | ||||||||||||||||||||||||||||||
| 4008 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 4009 | } | - | ||||||||||||||||||||||||||||||
| 4010 | widget = next
| 0 | ||||||||||||||||||||||||||||||
| 4011 | if ((next
| 0 | ||||||||||||||||||||||||||||||
| 4012 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 4013 | } never executed: while (widget != widgetThatHadFocusend of block
| 0 | ||||||||||||||||||||||||||||||
| 4014 | - | |||||||||||||||||||||||||||||||
| 4015 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 4016 | } | - | ||||||||||||||||||||||||||||||
| 4017 | QStyle *QGraphicsScene::style() const | - | ||||||||||||||||||||||||||||||
| 4018 | { | - | ||||||||||||||||||||||||||||||
| 4019 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 4020 | - | |||||||||||||||||||||||||||||||
| 4021 | return never executed: d->stylereturn d->style ? d->style : QApplication::style();
never executed: return d->style ? d->style : QApplication::style(); | 0 | ||||||||||||||||||||||||||||||
| 4022 | } | - | ||||||||||||||||||||||||||||||
| 4023 | void QGraphicsScene::setStyle(QStyle *style) | - | ||||||||||||||||||||||||||||||
| 4024 | { | - | ||||||||||||||||||||||||||||||
| 4025 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 4026 | - | |||||||||||||||||||||||||||||||
| 4027 | if (style == d->style
| 0 | ||||||||||||||||||||||||||||||
| 4028 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4029 | - | |||||||||||||||||||||||||||||||
| 4030 | - | |||||||||||||||||||||||||||||||
| 4031 | delete d->style; | - | ||||||||||||||||||||||||||||||
| 4032 | if ((
| 0 | ||||||||||||||||||||||||||||||
| 4033 | d->style->setParent(this); never executed: d->style->setParent(this); | 0 | ||||||||||||||||||||||||||||||
| 4034 | - | |||||||||||||||||||||||||||||||
| 4035 | - | |||||||||||||||||||||||||||||||
| 4036 | QEvent event(QEvent::StyleChange); | - | ||||||||||||||||||||||||||||||
| 4037 | QApplication::sendEvent(this, &event); | - | ||||||||||||||||||||||||||||||
| 4038 | - | |||||||||||||||||||||||||||||||
| 4039 | - | |||||||||||||||||||||||||||||||
| 4040 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(items())>::type> _container_((items())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 4041 | if (item->isWidget()
| 0 | ||||||||||||||||||||||||||||||
| 4042 | QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); | - | ||||||||||||||||||||||||||||||
| 4043 | if (!widget->testAttribute(Qt::WA_SetStyle)
| 0 | ||||||||||||||||||||||||||||||
| 4044 | QApplication::sendEvent(widget, &event); never executed: QApplication::sendEvent(widget, &event); | 0 | ||||||||||||||||||||||||||||||
| 4045 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4046 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4047 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4048 | QFont QGraphicsScene::font() const | - | ||||||||||||||||||||||||||||||
| 4049 | { | - | ||||||||||||||||||||||||||||||
| 4050 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 4051 | return never executed: d->font;return d->font;never executed: return d->font; | 0 | ||||||||||||||||||||||||||||||
| 4052 | } | - | ||||||||||||||||||||||||||||||
| 4053 | void QGraphicsScene::setFont(const QFont &font) | - | ||||||||||||||||||||||||||||||
| 4054 | { | - | ||||||||||||||||||||||||||||||
| 4055 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 4056 | QFont naturalFont = QApplication::font(); | - | ||||||||||||||||||||||||||||||
| 4057 | naturalFont.resolve(0); | - | ||||||||||||||||||||||||||||||
| 4058 | QFont resolvedFont = font.resolve(naturalFont); | - | ||||||||||||||||||||||||||||||
| 4059 | d->setFont_helper(resolvedFont); | - | ||||||||||||||||||||||||||||||
| 4060 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4061 | QPalette QGraphicsScene::palette() const | - | ||||||||||||||||||||||||||||||
| 4062 | { | - | ||||||||||||||||||||||||||||||
| 4063 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 4064 | return never executed: d->palette;return d->palette;never executed: return d->palette; | 0 | ||||||||||||||||||||||||||||||
| 4065 | } | - | ||||||||||||||||||||||||||||||
| 4066 | void QGraphicsScene::setPalette(const QPalette &palette) | - | ||||||||||||||||||||||||||||||
| 4067 | { | - | ||||||||||||||||||||||||||||||
| 4068 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 4069 | QPalette naturalPalette = QApplication::palette(); | - | ||||||||||||||||||||||||||||||
| 4070 | naturalPalette.resolve(0); | - | ||||||||||||||||||||||||||||||
| 4071 | QPalette resolvedPalette = palette.resolve(naturalPalette); | - | ||||||||||||||||||||||||||||||
| 4072 | d->setPalette_helper(resolvedPalette); | - | ||||||||||||||||||||||||||||||
| 4073 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4074 | bool QGraphicsScene::isActive() const | - | ||||||||||||||||||||||||||||||
| 4075 | { | - | ||||||||||||||||||||||||||||||
| 4076 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 4077 | return never executed: d->activationRefCount > 0;return d->activationRefCount > 0;never executed: return d->activationRefCount > 0; | 0 | ||||||||||||||||||||||||||||||
| 4078 | } | - | ||||||||||||||||||||||||||||||
| 4079 | - | |||||||||||||||||||||||||||||||
| 4080 | - | |||||||||||||||||||||||||||||||
| 4081 | - | |||||||||||||||||||||||||||||||
| 4082 | - | |||||||||||||||||||||||||||||||
| 4083 | - | |||||||||||||||||||||||||||||||
| 4084 | - | |||||||||||||||||||||||||||||||
| 4085 | - | |||||||||||||||||||||||||||||||
| 4086 | QGraphicsItem *QGraphicsScene::activePanel() const | - | ||||||||||||||||||||||||||||||
| 4087 | { | - | ||||||||||||||||||||||||||||||
| 4088 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 4089 | return never executed: d->activePanel;return d->activePanel;never executed: return d->activePanel; | 0 | ||||||||||||||||||||||||||||||
| 4090 | } | - | ||||||||||||||||||||||||||||||
| 4091 | void QGraphicsScene::setActivePanel(QGraphicsItem *item) | - | ||||||||||||||||||||||||||||||
| 4092 | { | - | ||||||||||||||||||||||||||||||
| 4093 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 4094 | d->setActivePanelHelper(item, false); | - | ||||||||||||||||||||||||||||||
| 4095 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4096 | QGraphicsWidget *QGraphicsScene::activeWindow() const | - | ||||||||||||||||||||||||||||||
| 4097 | { | - | ||||||||||||||||||||||||||||||
| 4098 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 4099 | if (d->activePanel
| 0 | ||||||||||||||||||||||||||||||
| 4100 | return never executed: static_cast<QGraphicsWidget *>(d->activePanel);return static_cast<QGraphicsWidget *>(d->activePanel);never executed: return static_cast<QGraphicsWidget *>(d->activePanel); | 0 | ||||||||||||||||||||||||||||||
| 4101 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 4102 | } | - | ||||||||||||||||||||||||||||||
| 4103 | void QGraphicsScene::setActiveWindow(QGraphicsWidget *widget) | - | ||||||||||||||||||||||||||||||
| 4104 | { | - | ||||||||||||||||||||||||||||||
| 4105 | if (widget
| 0 | ||||||||||||||||||||||||||||||
| 4106 | QMessageLogger(__FILE__, 5720, __PRETTY_FUNCTION__).warning("QGraphicsScene::setActiveWindow: widget %p must be part of this scene", | - | ||||||||||||||||||||||||||||||
| 4107 | widget); | - | ||||||||||||||||||||||||||||||
| 4108 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4109 | } | - | ||||||||||||||||||||||||||||||
| 4110 | - | |||||||||||||||||||||||||||||||
| 4111 | - | |||||||||||||||||||||||||||||||
| 4112 | QGraphicsItem *panel = widget
| 0 | ||||||||||||||||||||||||||||||
| 4113 | setActivePanel(panel); | - | ||||||||||||||||||||||||||||||
| 4114 | - | |||||||||||||||||||||||||||||||
| 4115 | - | |||||||||||||||||||||||||||||||
| 4116 | if (panel
| 0 | ||||||||||||||||||||||||||||||
| 4117 | QList<QGraphicsItem *> siblingWindows; | - | ||||||||||||||||||||||||||||||
| 4118 | QGraphicsItem *parent = panel->parentItem(); | - | ||||||||||||||||||||||||||||||
| 4119 | - | |||||||||||||||||||||||||||||||
| 4120 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(parent ? parent->childItems() : items())>::type> _container_((parent ? parent->childItems() : items())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *sibling = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 4121 | if (sibling != panel
| 0 | ||||||||||||||||||||||||||||||
| 4122 | siblingWindows << sibling; never executed: siblingWindows << sibling; | 0 | ||||||||||||||||||||||||||||||
| 4123 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4124 | - | |||||||||||||||||||||||||||||||
| 4125 | - | |||||||||||||||||||||||||||||||
| 4126 | qreal z = panel->zValue(); | - | ||||||||||||||||||||||||||||||
| 4127 | for (int i = 0; i < siblingWindows.size()
| 0 | ||||||||||||||||||||||||||||||
| 4128 | z = qMax(z, siblingWindows.at(i)->zValue()); never executed: z = qMax(z, siblingWindows.at(i)->zValue()); | 0 | ||||||||||||||||||||||||||||||
| 4129 | - | |||||||||||||||||||||||||||||||
| 4130 | - | |||||||||||||||||||||||||||||||
| 4131 | const qreal litt = qreal(0.001); | - | ||||||||||||||||||||||||||||||
| 4132 | panel->setZValue(z + litt); | - | ||||||||||||||||||||||||||||||
| 4133 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4134 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4135 | bool QGraphicsScene::sendEvent(QGraphicsItem *item, QEvent *event) | - | ||||||||||||||||||||||||||||||
| 4136 | { | - | ||||||||||||||||||||||||||||||
| 4137 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 4138 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 4139 | QMessageLogger(__FILE__, 5766, __PRETTY_FUNCTION__).warning("QGraphicsScene::sendEvent: cannot send event to a null item"); | - | ||||||||||||||||||||||||||||||
| 4140 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 4141 | } | - | ||||||||||||||||||||||||||||||
| 4142 | if (item->scene() != this
| 0 | ||||||||||||||||||||||||||||||
| 4143 | QMessageLogger(__FILE__, 5770, __PRETTY_FUNCTION__).warning("QGraphicsScene::sendEvent: item %p's scene (%p)" | - | ||||||||||||||||||||||||||||||
| 4144 | " is different from this scene (%p)", | - | ||||||||||||||||||||||||||||||
| 4145 | item, item->scene(), this); | - | ||||||||||||||||||||||||||||||
| 4146 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 4147 | } | - | ||||||||||||||||||||||||||||||
| 4148 | return never executed: d->sendEvent(item, event);return d->sendEvent(item, event);never executed: return d->sendEvent(item, event); | 0 | ||||||||||||||||||||||||||||||
| 4149 | } | - | ||||||||||||||||||||||||||||||
| 4150 | qreal QGraphicsScene::minimumRenderSize() const | - | ||||||||||||||||||||||||||||||
| 4151 | { | - | ||||||||||||||||||||||||||||||
| 4152 | const QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 4153 | return never executed: d->minimumRenderSize;return d->minimumRenderSize;never executed: return d->minimumRenderSize; | 0 | ||||||||||||||||||||||||||||||
| 4154 | } | - | ||||||||||||||||||||||||||||||
| 4155 | void QGraphicsScene::setMinimumRenderSize(qreal minSize) | - | ||||||||||||||||||||||||||||||
| 4156 | { | - | ||||||||||||||||||||||||||||||
| 4157 | QGraphicsScenePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 4158 | d->minimumRenderSize = minSize; | - | ||||||||||||||||||||||||||||||
| 4159 | update(); | - | ||||||||||||||||||||||||||||||
| 4160 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4161 | - | |||||||||||||||||||||||||||||||
| 4162 | void QGraphicsScenePrivate::addView(QGraphicsView *view) | - | ||||||||||||||||||||||||||||||
| 4163 | { | - | ||||||||||||||||||||||||||||||
| 4164 | views << view; | - | ||||||||||||||||||||||||||||||
| 4165 | - | |||||||||||||||||||||||||||||||
| 4166 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(grabbedGestures.keys())>::type> _container_((grabbedGestures.keys())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (Qt::GestureType gesture = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 4167 | view->viewport()->grabGesture(gesture); never executed: view->viewport()->grabGesture(gesture); | 0 | ||||||||||||||||||||||||||||||
| 4168 | - | |||||||||||||||||||||||||||||||
| 4169 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4170 | - | |||||||||||||||||||||||||||||||
| 4171 | void QGraphicsScenePrivate::removeView(QGraphicsView *view) | - | ||||||||||||||||||||||||||||||
| 4172 | { | - | ||||||||||||||||||||||||||||||
| 4173 | views.removeAll(view); | - | ||||||||||||||||||||||||||||||
| 4174 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4175 | - | |||||||||||||||||||||||||||||||
| 4176 | void QGraphicsScenePrivate::updateTouchPointsForItem(QGraphicsItem *item, QTouchEvent *touchEvent) | - | ||||||||||||||||||||||||||||||
| 4177 | { | - | ||||||||||||||||||||||||||||||
| 4178 | QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints(); | - | ||||||||||||||||||||||||||||||
| 4179 | for (int i = 0; i < touchPoints.count()
| 0 | ||||||||||||||||||||||||||||||
| 4180 | QTouchEvent::TouchPoint &touchPoint = touchPoints[i]; | - | ||||||||||||||||||||||||||||||
| 4181 | touchPoint.setRect(item->mapFromScene(touchPoint.sceneRect()).boundingRect()); | - | ||||||||||||||||||||||||||||||
| 4182 | touchPoint.setStartPos(item->d_ptr->genericMapFromScene(touchPoint.startScenePos(), static_cast<QWidget *>(touchEvent->target()))); | - | ||||||||||||||||||||||||||||||
| 4183 | touchPoint.setLastPos(item->d_ptr->genericMapFromScene(touchPoint.lastScenePos(), static_cast<QWidget *>(touchEvent->target()))); | - | ||||||||||||||||||||||||||||||
| 4184 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4185 | touchEvent->setTouchPoints(touchPoints); | - | ||||||||||||||||||||||||||||||
| 4186 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4187 | - | |||||||||||||||||||||||||||||||
| 4188 | int QGraphicsScenePrivate::findClosestTouchPointId(const QPointF &scenePos) | - | ||||||||||||||||||||||||||||||
| 4189 | { | - | ||||||||||||||||||||||||||||||
| 4190 | int closestTouchPointId = -1; | - | ||||||||||||||||||||||||||||||
| 4191 | qreal closestDistance = qreal(0.); | - | ||||||||||||||||||||||||||||||
| 4192 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(sceneCurrentTouchPoints)>::type> _container_((sceneCurrentTouchPoints)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QTouchEvent::TouchPoint &touchPoint = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 4193 | qreal distance = QLineF(scenePos, touchPoint.scenePos()).length(); | - | ||||||||||||||||||||||||||||||
| 4194 | if (closestTouchPointId == -1
| 0 | ||||||||||||||||||||||||||||||
| 4195 | closestTouchPointId = touchPoint.id(); | - | ||||||||||||||||||||||||||||||
| 4196 | closestDistance = distance; | - | ||||||||||||||||||||||||||||||
| 4197 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4198 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4199 | return never executed: closestTouchPointId;return closestTouchPointId;never executed: return closestTouchPointId; | 0 | ||||||||||||||||||||||||||||||
| 4200 | } | - | ||||||||||||||||||||||||||||||
| 4201 | - | |||||||||||||||||||||||||||||||
| 4202 | void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent) | - | ||||||||||||||||||||||||||||||
| 4203 | { | - | ||||||||||||||||||||||||||||||
| 4204 | typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints; | - | ||||||||||||||||||||||||||||||
| 4205 | QHash<QGraphicsItem *, StatesAndTouchPoints> itemsNeedingEvents; | - | ||||||||||||||||||||||||||||||
| 4206 | - | |||||||||||||||||||||||||||||||
| 4207 | for (int i = 0; i < sceneTouchEvent->touchPoints().count()
| 0 | ||||||||||||||||||||||||||||||
| 4208 | const QTouchEvent::TouchPoint &touchPoint = sceneTouchEvent->touchPoints().at(i); | - | ||||||||||||||||||||||||||||||
| 4209 | - | |||||||||||||||||||||||||||||||
| 4210 | - | |||||||||||||||||||||||||||||||
| 4211 | QGraphicsItem *item = 0; | - | ||||||||||||||||||||||||||||||
| 4212 | if (touchPoint.state() == Qt::TouchPointPressed
| 0 | ||||||||||||||||||||||||||||||
| 4213 | if (sceneTouchEvent->device()->type() == QTouchDevice::TouchPad
| 0 | ||||||||||||||||||||||||||||||
| 4214 | - | |||||||||||||||||||||||||||||||
| 4215 | item = itemForTouchPointId.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4216 | ? 0 | - | ||||||||||||||||||||||||||||||
| 4217 | : itemForTouchPointId.constBegin().value(); | - | ||||||||||||||||||||||||||||||
| 4218 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4219 | - | |||||||||||||||||||||||||||||||
| 4220 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 4221 | - | |||||||||||||||||||||||||||||||
| 4222 | cachedItemsUnderMouse = itemsAtPosition(touchPoint.screenPos().toPoint(), | - | ||||||||||||||||||||||||||||||
| 4223 | touchPoint.scenePos(), | - | ||||||||||||||||||||||||||||||
| 4224 | static_cast<QWidget *>(sceneTouchEvent->target())); | - | ||||||||||||||||||||||||||||||
| 4225 | item = cachedItemsUnderMouse.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4226 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4227 | - | |||||||||||||||||||||||||||||||
| 4228 | if (sceneTouchEvent->device()->type() == QTouchDevice::TouchScreen
| 0 | ||||||||||||||||||||||||||||||
| 4229 | - | |||||||||||||||||||||||||||||||
| 4230 | int closestTouchPointId = findClosestTouchPointId(touchPoint.scenePos()); | - | ||||||||||||||||||||||||||||||
| 4231 | QGraphicsItem *closestItem = itemForTouchPointId.value(closestTouchPointId); | - | ||||||||||||||||||||||||||||||
| 4232 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 4233 | item = closestItem; never executed: item = closestItem; | 0 | ||||||||||||||||||||||||||||||
| 4234 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4235 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 4236 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 4237 | - | |||||||||||||||||||||||||||||||
| 4238 | itemForTouchPointId.insert(touchPoint.id(), item); | - | ||||||||||||||||||||||||||||||
| 4239 | sceneCurrentTouchPoints.insert(touchPoint.id(), touchPoint); | - | ||||||||||||||||||||||||||||||
| 4240 | } never executed: else if (touchPoint.state() == Qt::TouchPointReleasedend of block
| 0 | ||||||||||||||||||||||||||||||
| 4241 | item = itemForTouchPointId.take(touchPoint.id()); | - | ||||||||||||||||||||||||||||||
| 4242 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 4243 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 4244 | - | |||||||||||||||||||||||||||||||
| 4245 | sceneCurrentTouchPoints.remove(touchPoint.id()); | - | ||||||||||||||||||||||||||||||
| 4246 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4247 | item = itemForTouchPointId.value(touchPoint.id()); | - | ||||||||||||||||||||||||||||||
| 4248 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 4249 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 4250 | ((!(sceneCurrentTouchPoints.contains(touchPoint.id()))) ? qt_assert("sceneCurrentTouchPoints.contains(touchPoint.id())",__FILE__,5909) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 4251 | sceneCurrentTouchPoints[touchPoint.id()] = touchPoint; | - | ||||||||||||||||||||||||||||||
| 4252 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4253 | - | |||||||||||||||||||||||||||||||
| 4254 | StatesAndTouchPoints &statesAndTouchPoints = itemsNeedingEvents[item]; | - | ||||||||||||||||||||||||||||||
| 4255 | statesAndTouchPoints.first |= touchPoint.state(); | - | ||||||||||||||||||||||||||||||
| 4256 | statesAndTouchPoints.second.append(touchPoint); | - | ||||||||||||||||||||||||||||||
| 4257 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4258 | - | |||||||||||||||||||||||||||||||
| 4259 | if (itemsNeedingEvents.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4260 | sceneTouchEvent->ignore(); | - | ||||||||||||||||||||||||||||||
| 4261 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4262 | } | - | ||||||||||||||||||||||||||||||
| 4263 | - | |||||||||||||||||||||||||||||||
| 4264 | bool ignoreSceneTouchEvent = true; | - | ||||||||||||||||||||||||||||||
| 4265 | QHash<QGraphicsItem *, StatesAndTouchPoints>::ConstIterator it = itemsNeedingEvents.constBegin(); | - | ||||||||||||||||||||||||||||||
| 4266 | const QHash<QGraphicsItem *, StatesAndTouchPoints>::ConstIterator end = itemsNeedingEvents.constEnd(); | - | ||||||||||||||||||||||||||||||
| 4267 | for (; it != end
| 0 | ||||||||||||||||||||||||||||||
| 4268 | QGraphicsItem *item = it.key(); | - | ||||||||||||||||||||||||||||||
| 4269 | - | |||||||||||||||||||||||||||||||
| 4270 | (void) item->isBlockedByModalPanel(&item); | - | ||||||||||||||||||||||||||||||
| 4271 | - | |||||||||||||||||||||||||||||||
| 4272 | - | |||||||||||||||||||||||||||||||
| 4273 | QEvent::Type eventType; | - | ||||||||||||||||||||||||||||||
| 4274 | switch (it.value().first) { | - | ||||||||||||||||||||||||||||||
| 4275 | case never executed: Qt::TouchPointPressed:case Qt::TouchPointPressed:never executed: case Qt::TouchPointPressed: | 0 | ||||||||||||||||||||||||||||||
| 4276 | - | |||||||||||||||||||||||||||||||
| 4277 | eventType = QEvent::TouchBegin; | - | ||||||||||||||||||||||||||||||
| 4278 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4279 | case never executed: Qt::TouchPointReleased:case Qt::TouchPointReleased:never executed: case Qt::TouchPointReleased: | 0 | ||||||||||||||||||||||||||||||
| 4280 | - | |||||||||||||||||||||||||||||||
| 4281 | eventType = QEvent::TouchEnd; | - | ||||||||||||||||||||||||||||||
| 4282 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4283 | case never executed: Qt::TouchPointStationary:case Qt::TouchPointStationary:never executed: case Qt::TouchPointStationary: | 0 | ||||||||||||||||||||||||||||||
| 4284 | - | |||||||||||||||||||||||||||||||
| 4285 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 4286 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 4287 | - | |||||||||||||||||||||||||||||||
| 4288 | eventType = QEvent::TouchUpdate; | - | ||||||||||||||||||||||||||||||
| 4289 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4290 | } | - | ||||||||||||||||||||||||||||||
| 4291 | - | |||||||||||||||||||||||||||||||
| 4292 | QTouchEvent touchEvent(eventType); | - | ||||||||||||||||||||||||||||||
| 4293 | touchEvent.setWindow(sceneTouchEvent->window()); | - | ||||||||||||||||||||||||||||||
| 4294 | touchEvent.setTarget(sceneTouchEvent->target()); | - | ||||||||||||||||||||||||||||||
| 4295 | touchEvent.setDevice(sceneTouchEvent->device()); | - | ||||||||||||||||||||||||||||||
| 4296 | touchEvent.setModifiers(sceneTouchEvent->modifiers()); | - | ||||||||||||||||||||||||||||||
| 4297 | touchEvent.setTouchPointStates(it.value().first); | - | ||||||||||||||||||||||||||||||
| 4298 | touchEvent.setTouchPoints(it.value().second); | - | ||||||||||||||||||||||||||||||
| 4299 | touchEvent.setTimestamp(sceneTouchEvent->timestamp()); | - | ||||||||||||||||||||||||||||||
| 4300 | - | |||||||||||||||||||||||||||||||
| 4301 | switch (touchEvent.type()) { | - | ||||||||||||||||||||||||||||||
| 4302 | case never executed: QEvent::TouchBegin:case QEvent::TouchBegin:never executed: case QEvent::TouchBegin: | 0 | ||||||||||||||||||||||||||||||
| 4303 | { | - | ||||||||||||||||||||||||||||||
| 4304 | - | |||||||||||||||||||||||||||||||
| 4305 | - | |||||||||||||||||||||||||||||||
| 4306 | item->d_ptr->acceptedTouchBeginEvent = true; | - | ||||||||||||||||||||||||||||||
| 4307 | bool res = sendTouchBeginEvent(item, &touchEvent)
| 0 | ||||||||||||||||||||||||||||||
| 4308 | && touchEvent.isAccepted()
| 0 | ||||||||||||||||||||||||||||||
| 4309 | if (!res
| 0 | ||||||||||||||||||||||||||||||
| 4310 | - | |||||||||||||||||||||||||||||||
| 4311 | for (int i = 0; i < touchEvent.touchPoints().count()
| 0 | ||||||||||||||||||||||||||||||
| 4312 | const QTouchEvent::TouchPoint &touchPoint = touchEvent.touchPoints().at(i); | - | ||||||||||||||||||||||||||||||
| 4313 | itemForTouchPointId.remove(touchPoint.id()); | - | ||||||||||||||||||||||||||||||
| 4314 | sceneCurrentTouchPoints.remove(touchPoint.id()); | - | ||||||||||||||||||||||||||||||
| 4315 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4316 | ignoreSceneTouchEvent = false; | - | ||||||||||||||||||||||||||||||
| 4317 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4318 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4319 | } | - | ||||||||||||||||||||||||||||||
| 4320 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 4321 | if (item->d_ptr->acceptedTouchBeginEvent
| 0 | ||||||||||||||||||||||||||||||
| 4322 | updateTouchPointsForItem(item, &touchEvent); | - | ||||||||||||||||||||||||||||||
| 4323 | (void) sendEvent(item, &touchEvent); | - | ||||||||||||||||||||||||||||||
| 4324 | ignoreSceneTouchEvent = false; | - | ||||||||||||||||||||||||||||||
| 4325 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4326 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4327 | } | - | ||||||||||||||||||||||||||||||
| 4328 | } | - | ||||||||||||||||||||||||||||||
| 4329 | sceneTouchEvent->setAccepted(ignoreSceneTouchEvent); | - | ||||||||||||||||||||||||||||||
| 4330 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4331 | - | |||||||||||||||||||||||||||||||
| 4332 | bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEvent *touchEvent) | - | ||||||||||||||||||||||||||||||
| 4333 | { | - | ||||||||||||||||||||||||||||||
| 4334 | QGraphicsScene * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 4335 | - | |||||||||||||||||||||||||||||||
| 4336 | if (cachedItemsUnderMouse.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4337 | const QTouchEvent::TouchPoint &firstTouchPoint = touchEvent->touchPoints().first(); | - | ||||||||||||||||||||||||||||||
| 4338 | cachedItemsUnderMouse = itemsAtPosition(firstTouchPoint.screenPos().toPoint(), | - | ||||||||||||||||||||||||||||||
| 4339 | firstTouchPoint.scenePos(), | - | ||||||||||||||||||||||||||||||
| 4340 | static_cast<QWidget *>(touchEvent->target())); | - | ||||||||||||||||||||||||||||||
| 4341 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4342 | - | |||||||||||||||||||||||||||||||
| 4343 | - | |||||||||||||||||||||||||||||||
| 4344 | bool setFocus = false; | - | ||||||||||||||||||||||||||||||
| 4345 | - | |||||||||||||||||||||||||||||||
| 4346 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(cachedItemsUnderMouse)>::type> _container_((cachedItemsUnderMouse)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 4347 | if (item->isEnabled()
| 0 | ||||||||||||||||||||||||||||||
| 4348 | if (!item->isWidget()
| 0 | ||||||||||||||||||||||||||||||
| 4349 | setFocus = true; | - | ||||||||||||||||||||||||||||||
| 4350 | if (item != q->focusItem()
| 0 | ||||||||||||||||||||||||||||||
| 4351 | q->setFocusItem(item, Qt::MouseFocusReason); never executed: q->setFocusItem(item, Qt::MouseFocusReason); | 0 | ||||||||||||||||||||||||||||||
| 4352 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4353 | } | - | ||||||||||||||||||||||||||||||
| 4354 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4355 | if (item->isPanel()
| 0 | ||||||||||||||||||||||||||||||
| 4356 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4357 | if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation
| 0 | ||||||||||||||||||||||||||||||
| 4358 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4359 | if (item->d_ptr->flags & QGraphicsItem::ItemStopsFocusHandling
| 0 | ||||||||||||||||||||||||||||||
| 4360 | - | |||||||||||||||||||||||||||||||
| 4361 | setFocus = true; | - | ||||||||||||||||||||||||||||||
| 4362 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4363 | } | - | ||||||||||||||||||||||||||||||
| 4364 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4365 | - | |||||||||||||||||||||||||||||||
| 4366 | - | |||||||||||||||||||||||||||||||
| 4367 | if (!stickyFocus
| 0 | ||||||||||||||||||||||||||||||
| 4368 | q->setFocusItem(0, Qt::MouseFocusReason); never executed: q->setFocusItem(0, Qt::MouseFocusReason); | 0 | ||||||||||||||||||||||||||||||
| 4369 | - | |||||||||||||||||||||||||||||||
| 4370 | bool res = false; | - | ||||||||||||||||||||||||||||||
| 4371 | bool eventAccepted = touchEvent->isAccepted(); | - | ||||||||||||||||||||||||||||||
| 4372 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(cachedItemsUnderMouse)>::type> _container_((cachedItemsUnderMouse)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 4373 | - | |||||||||||||||||||||||||||||||
| 4374 | updateTouchPointsForItem(item, touchEvent); | - | ||||||||||||||||||||||||||||||
| 4375 | bool acceptTouchEvents = item->acceptTouchEvents(); | - | ||||||||||||||||||||||||||||||
| 4376 | touchEvent->setAccepted(acceptTouchEvents); | - | ||||||||||||||||||||||||||||||
| 4377 | res = acceptTouchEvents
| 0 | ||||||||||||||||||||||||||||||
| 4378 | eventAccepted = touchEvent->isAccepted(); | - | ||||||||||||||||||||||||||||||
| 4379 | if (itemForTouchPointId.value(touchEvent->touchPoints().first().id()) == 0
| 0 | ||||||||||||||||||||||||||||||
| 4380 | - | |||||||||||||||||||||||||||||||
| 4381 | item = 0; | - | ||||||||||||||||||||||||||||||
| 4382 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4383 | item->d_ptr->acceptedTouchBeginEvent = (res
| 0 | ||||||||||||||||||||||||||||||
| 4384 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4385 | touchEvent->spont = false; | - | ||||||||||||||||||||||||||||||
| 4386 | if (res
| 0 | ||||||||||||||||||||||||||||||
| 4387 | - | |||||||||||||||||||||||||||||||
| 4388 | for (int i = 0; i < touchEvent->touchPoints().count()
| 0 | ||||||||||||||||||||||||||||||
| 4389 | const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().at(i); | - | ||||||||||||||||||||||||||||||
| 4390 | itemForTouchPointId[touchPoint.id()] = item; | - | ||||||||||||||||||||||||||||||
| 4391 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4392 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4393 | } | - | ||||||||||||||||||||||||||||||
| 4394 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 4395 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4396 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4397 | - | |||||||||||||||||||||||||||||||
| 4398 | touchEvent->setAccepted(eventAccepted); | - | ||||||||||||||||||||||||||||||
| 4399 | return never executed: res;return res;never executed: return res; | 0 | ||||||||||||||||||||||||||||||
| 4400 | } | - | ||||||||||||||||||||||||||||||
| 4401 | - | |||||||||||||||||||||||||||||||
| 4402 | void QGraphicsScenePrivate::enableTouchEventsOnViews() | - | ||||||||||||||||||||||||||||||
| 4403 | { | - | ||||||||||||||||||||||||||||||
| 4404 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(views)>::type> _container_((views)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsView *view = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 4405 | view->viewport()->setAttribute(Qt::WA_AcceptTouchEvents, true); never executed: view->viewport()->setAttribute(Qt::WA_AcceptTouchEvents, true); | 0 | ||||||||||||||||||||||||||||||
| 4406 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4407 | - | |||||||||||||||||||||||||||||||
| 4408 | void QGraphicsScenePrivate::updateInputMethodSensitivityInViews() | - | ||||||||||||||||||||||||||||||
| 4409 | { | - | ||||||||||||||||||||||||||||||
| 4410 | for (int i = 0; i < views.size()
| 0 | ||||||||||||||||||||||||||||||
| 4411 | views.at(i)->d_func()->updateInputMethodSensitivity(); never executed: views.at(i)->d_func()->updateInputMethodSensitivity(); | 0 | ||||||||||||||||||||||||||||||
| 4412 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4413 | - | |||||||||||||||||||||||||||||||
| 4414 | void QGraphicsScenePrivate::enterModal(QGraphicsItem *panel, QGraphicsItem::PanelModality previousModality) | - | ||||||||||||||||||||||||||||||
| 4415 | { | - | ||||||||||||||||||||||||||||||
| 4416 | QGraphicsScene * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 4417 | ((!(panel && panel->isPanel())) ? qt_assert("panel && panel->isPanel()",__FILE__,6076) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 4418 | - | |||||||||||||||||||||||||||||||
| 4419 | QGraphicsItem::PanelModality panelModality = panel->d_ptr->panelModality; | - | ||||||||||||||||||||||||||||||
| 4420 | if (previousModality != QGraphicsItem::NonModal
| 0 | ||||||||||||||||||||||||||||||
| 4421 | - | |||||||||||||||||||||||||||||||
| 4422 | - | |||||||||||||||||||||||||||||||
| 4423 | panel->d_ptr->panelModality = previousModality; | - | ||||||||||||||||||||||||||||||
| 4424 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4425 | - | |||||||||||||||||||||||||||||||
| 4426 | QSet<QGraphicsItem *> blockedPanels; | - | ||||||||||||||||||||||||||||||
| 4427 | QList<QGraphicsItem *> items = q->items(); | - | ||||||||||||||||||||||||||||||
| 4428 | for (int i = 0; i < items.count()
| 0 | ||||||||||||||||||||||||||||||
| 4429 | QGraphicsItem *item = items.at(i); | - | ||||||||||||||||||||||||||||||
| 4430 | if (item->isPanel()
| 0 | ||||||||||||||||||||||||||||||
| 4431 | blockedPanels.insert(item); never executed: blockedPanels.insert(item); | 0 | ||||||||||||||||||||||||||||||
| 4432 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4433 | - | |||||||||||||||||||||||||||||||
| 4434 | - | |||||||||||||||||||||||||||||||
| 4435 | if (previousModality != QGraphicsItem::NonModal
| 0 | ||||||||||||||||||||||||||||||
| 4436 | - | |||||||||||||||||||||||||||||||
| 4437 | panel->d_ptr->panelModality = panelModality; | - | ||||||||||||||||||||||||||||||
| 4438 | - | |||||||||||||||||||||||||||||||
| 4439 | modalPanels.removeAll(panel); | - | ||||||||||||||||||||||||||||||
| 4440 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4441 | - | |||||||||||||||||||||||||||||||
| 4442 | modalPanels.prepend(panel); | - | ||||||||||||||||||||||||||||||
| 4443 | - | |||||||||||||||||||||||||||||||
| 4444 | if (!hoverItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4445 | - | |||||||||||||||||||||||||||||||
| 4446 | QGraphicsSceneHoverEvent hoverEvent; | - | ||||||||||||||||||||||||||||||
| 4447 | hoverEvent.setScenePos(lastSceneMousePos); | - | ||||||||||||||||||||||||||||||
| 4448 | dispatchHoverEvent(&hoverEvent); | - | ||||||||||||||||||||||||||||||
| 4449 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4450 | - | |||||||||||||||||||||||||||||||
| 4451 | if (!mouseGrabberItems.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4452 | QGraphicsItem *item = mouseGrabberItems.last(); | - | ||||||||||||||||||||||||||||||
| 4453 | if (item->isBlockedByModalPanel()
| 0 | ||||||||||||||||||||||||||||||
| 4454 | ungrabMouse(item, false); never executed: ungrabMouse(item, false); | 0 | ||||||||||||||||||||||||||||||
| 4455 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4456 | - | |||||||||||||||||||||||||||||||
| 4457 | QEvent windowBlockedEvent(QEvent::WindowBlocked); | - | ||||||||||||||||||||||||||||||
| 4458 | QEvent windowUnblockedEvent(QEvent::WindowUnblocked); | - | ||||||||||||||||||||||||||||||
| 4459 | for (int i = 0; i < items.count()
| 0 | ||||||||||||||||||||||||||||||
| 4460 | QGraphicsItem *item = items.at(i); | - | ||||||||||||||||||||||||||||||
| 4461 | if (item->isPanel()
| 0 | ||||||||||||||||||||||||||||||
| 4462 | if (!blockedPanels.contains(item)
| 0 | ||||||||||||||||||||||||||||||
| 4463 | - | |||||||||||||||||||||||||||||||
| 4464 | sendEvent(item, &windowBlockedEvent); | - | ||||||||||||||||||||||||||||||
| 4465 | } never executed: else if (blockedPanels.contains(item)end of block
| 0 | ||||||||||||||||||||||||||||||
| 4466 | - | |||||||||||||||||||||||||||||||
| 4467 | - | |||||||||||||||||||||||||||||||
| 4468 | sendEvent(item, &windowUnblockedEvent); | - | ||||||||||||||||||||||||||||||
| 4469 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4470 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4471 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4472 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4473 | - | |||||||||||||||||||||||||||||||
| 4474 | void QGraphicsScenePrivate::leaveModal(QGraphicsItem *panel) | - | ||||||||||||||||||||||||||||||
| 4475 | { | - | ||||||||||||||||||||||||||||||
| 4476 | QGraphicsScene * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 4477 | ((!(panel && panel->isPanel())) ? qt_assert("panel && panel->isPanel()",__FILE__,6136) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 4478 | - | |||||||||||||||||||||||||||||||
| 4479 | QSet<QGraphicsItem *> blockedPanels; | - | ||||||||||||||||||||||||||||||
| 4480 | QList<QGraphicsItem *> items = q->items(); | - | ||||||||||||||||||||||||||||||
| 4481 | for (int i = 0; i < items.count()
| 0 | ||||||||||||||||||||||||||||||
| 4482 | QGraphicsItem *item = items.at(i); | - | ||||||||||||||||||||||||||||||
| 4483 | if (item->isPanel()
| 0 | ||||||||||||||||||||||||||||||
| 4484 | blockedPanels.insert(item); never executed: blockedPanels.insert(item); | 0 | ||||||||||||||||||||||||||||||
| 4485 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4486 | - | |||||||||||||||||||||||||||||||
| 4487 | modalPanels.removeAll(panel); | - | ||||||||||||||||||||||||||||||
| 4488 | - | |||||||||||||||||||||||||||||||
| 4489 | QEvent e(QEvent::WindowUnblocked); | - | ||||||||||||||||||||||||||||||
| 4490 | for (int i = 0; i < items.count()
| 0 | ||||||||||||||||||||||||||||||
| 4491 | QGraphicsItem *item = items.at(i); | - | ||||||||||||||||||||||||||||||
| 4492 | if (item->isPanel()
| 0 | ||||||||||||||||||||||||||||||
| 4493 | sendEvent(item, &e); never executed: sendEvent(item, &e); | 0 | ||||||||||||||||||||||||||||||
| 4494 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4495 | - | |||||||||||||||||||||||||||||||
| 4496 | - | |||||||||||||||||||||||||||||||
| 4497 | QGraphicsSceneHoverEvent hoverEvent; | - | ||||||||||||||||||||||||||||||
| 4498 | hoverEvent.setScenePos(lastSceneMousePos); | - | ||||||||||||||||||||||||||||||
| 4499 | dispatchHoverEvent(&hoverEvent); | - | ||||||||||||||||||||||||||||||
| 4500 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4501 | - | |||||||||||||||||||||||||||||||
| 4502 | - | |||||||||||||||||||||||||||||||
| 4503 | void QGraphicsScenePrivate::gestureTargetsAtHotSpots(const QSet<QGesture *> &gestures, | - | ||||||||||||||||||||||||||||||
| 4504 | Qt::GestureFlag flag, | - | ||||||||||||||||||||||||||||||
| 4505 | QHash<QGraphicsObject *, QSet<QGesture *> > *targets, | - | ||||||||||||||||||||||||||||||
| 4506 | QSet<QGraphicsObject *> *itemsSet, | - | ||||||||||||||||||||||||||||||
| 4507 | QSet<QGesture *> *normal, | - | ||||||||||||||||||||||||||||||
| 4508 | QSet<QGesture *> *conflicts) | - | ||||||||||||||||||||||||||||||
| 4509 | { | - | ||||||||||||||||||||||||||||||
| 4510 | QSet<QGesture *> normalGestures; | - | ||||||||||||||||||||||||||||||
| 4511 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(gestures)>::type> _container_((gestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *gesture = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 4512 | if (!gesture->hasHotSpot()
| 0 | ||||||||||||||||||||||||||||||
| 4513 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 4514 | const Qt::GestureType gestureType = gesture->gestureType(); | - | ||||||||||||||||||||||||||||||
| 4515 | QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), gesture->d_func()->sceneHotSpot, 0); | - | ||||||||||||||||||||||||||||||
| 4516 | for (int j = 0; j < items.size()
| 0 | ||||||||||||||||||||||||||||||
| 4517 | QGraphicsItem *item = items.at(j); | - | ||||||||||||||||||||||||||||||
| 4518 | - | |||||||||||||||||||||||||||||||
| 4519 | - | |||||||||||||||||||||||||||||||
| 4520 | - | |||||||||||||||||||||||||||||||
| 4521 | (void) item->isBlockedByModalPanel(&item); | - | ||||||||||||||||||||||||||||||
| 4522 | - | |||||||||||||||||||||||||||||||
| 4523 | if (QGraphicsObject *itemobj = item->toGraphicsObject()
| 0 | ||||||||||||||||||||||||||||||
| 4524 | QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); | - | ||||||||||||||||||||||||||||||
| 4525 | QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it = | - | ||||||||||||||||||||||||||||||
| 4526 | d->gestureContext.constFind(gestureType); | - | ||||||||||||||||||||||||||||||
| 4527 | if (it != d->gestureContext.constEnd()
| 0 | ||||||||||||||||||||||||||||||
| 4528 | if (normalGestures.contains(gesture)
| 0 | ||||||||||||||||||||||||||||||
| 4529 | normalGestures.remove(gesture); | - | ||||||||||||||||||||||||||||||
| 4530 | if (conflicts
| 0 | ||||||||||||||||||||||||||||||
| 4531 | conflicts->insert(gesture); never executed: conflicts->insert(gesture); | 0 | ||||||||||||||||||||||||||||||
| 4532 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4533 | normalGestures.insert(gesture); | - | ||||||||||||||||||||||||||||||
| 4534 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4535 | if (targets
| 0 | ||||||||||||||||||||||||||||||
| 4536 | (* never executed: targets)[itemobj].insert(gesture);(*targets)[itemobj].insert(gesture);never executed: (*targets)[itemobj].insert(gesture); | 0 | ||||||||||||||||||||||||||||||
| 4537 | if (itemsSet
| 0 | ||||||||||||||||||||||||||||||
| 4538 | (* never executed: itemsSet).insert(itemobj);(*itemsSet).insert(itemobj);never executed: (*itemsSet).insert(itemobj); | 0 | ||||||||||||||||||||||||||||||
| 4539 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4540 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4541 | - | |||||||||||||||||||||||||||||||
| 4542 | if (item->isPanel()
| 0 | ||||||||||||||||||||||||||||||
| 4543 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4544 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4545 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4546 | if (normal
| 0 | ||||||||||||||||||||||||||||||
| 4547 | * never executed: normal = normalGestures;*normal = normalGestures;never executed: *normal = normalGestures; | 0 | ||||||||||||||||||||||||||||||
| 4548 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4549 | - | |||||||||||||||||||||||||||||||
| 4550 | void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) | - | ||||||||||||||||||||||||||||||
| 4551 | { | - | ||||||||||||||||||||||||||||||
| 4552 | QWidget *viewport = event->widget(); | - | ||||||||||||||||||||||||||||||
| 4553 | if (!viewport
| 0 | ||||||||||||||||||||||||||||||
| 4554 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4555 | QGraphicsView *graphicsView = qobject_cast<QGraphicsView *>(viewport->parent()); | - | ||||||||||||||||||||||||||||||
| 4556 | if (!graphicsView
| 0 | ||||||||||||||||||||||||||||||
| 4557 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4558 | - | |||||||||||||||||||||||||||||||
| 4559 | QList<QGesture *> allGestures = event->gestures(); | - | ||||||||||||||||||||||||||||||
| 4560 | if (0) QMessageLogger(__FILE__, 6219, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" dead code: QMessageLogger(__FILE__, 6219, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "Gestures:" << allGestures; | - | ||||||||||||||||||||||||||||||
| 4561 | << "Gestures:" << allGestures; dead code: QMessageLogger(__FILE__, 6219, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "Gestures:" << allGestures; | - | ||||||||||||||||||||||||||||||
| 4562 | - | |||||||||||||||||||||||||||||||
| 4563 | QSet<QGesture *> startedGestures; | - | ||||||||||||||||||||||||||||||
| 4564 | QPoint delta = viewport->mapFromGlobal(QPoint()); | - | ||||||||||||||||||||||||||||||
| 4565 | QTransform toScene = QTransform::fromTranslate(delta.x(), delta.y()) | - | ||||||||||||||||||||||||||||||
| 4566 | * graphicsView->viewportTransform().inverted(); | - | ||||||||||||||||||||||||||||||
| 4567 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(allGestures)>::type> _container_((allGestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *gesture = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 4568 | - | |||||||||||||||||||||||||||||||
| 4569 | if (gesture->hasHotSpot()
| 0 | ||||||||||||||||||||||||||||||
| 4570 | gesture->d_func()->sceneHotSpot = toScene.map(gesture->hotSpot()); | - | ||||||||||||||||||||||||||||||
| 4571 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4572 | gesture->d_func()->sceneHotSpot = QPointF(); | - | ||||||||||||||||||||||||||||||
| 4573 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4574 | - | |||||||||||||||||||||||||||||||
| 4575 | QGraphicsObject *target = gestureTargets.value(gesture, 0); | - | ||||||||||||||||||||||||||||||
| 4576 | if (!target
| 0 | ||||||||||||||||||||||||||||||
| 4577 | - | |||||||||||||||||||||||||||||||
| 4578 | - | |||||||||||||||||||||||||||||||
| 4579 | if (gesture->state() == Qt::GestureStarted
| 0 | ||||||||||||||||||||||||||||||
| 4580 | startedGestures.insert(gesture); never executed: startedGestures.insert(gesture); | 0 | ||||||||||||||||||||||||||||||
| 4581 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4582 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4583 | - | |||||||||||||||||||||||||||||||
| 4584 | if (!startedGestures.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4585 | QSet<QGesture *> normalGestures; | - | ||||||||||||||||||||||||||||||
| 4586 | QSet<QGesture *> conflictedGestures; | - | ||||||||||||||||||||||||||||||
| 4587 | gestureTargetsAtHotSpots(startedGestures, Qt::GestureFlag(0), &cachedItemGestures, 0, | - | ||||||||||||||||||||||||||||||
| 4588 | &normalGestures, &conflictedGestures); | - | ||||||||||||||||||||||||||||||
| 4589 | cachedTargetItems = cachedItemGestures.keys(); | - | ||||||||||||||||||||||||||||||
| 4590 | std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); | - | ||||||||||||||||||||||||||||||
| 4591 | if (0) QMessageLogger(__FILE__, 6250, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" dead code: QMessageLogger(__FILE__, 6250, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "Normal gestures:" << normalGestures << "Conflicting gestures:" << conflictedGestures; | - | ||||||||||||||||||||||||||||||
| 4592 | << "Normal gestures:" << normalGestures dead code: QMessageLogger(__FILE__, 6250, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "Normal gestures:" << normalGestures << "Conflicting gestures:" << conflictedGestures; | - | ||||||||||||||||||||||||||||||
| 4593 | << "Conflicting gestures:" << conflictedGestures; dead code: QMessageLogger(__FILE__, 6250, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "Normal gestures:" << normalGestures << "Conflicting gestures:" << conflictedGestures; | - | ||||||||||||||||||||||||||||||
| 4594 | - | |||||||||||||||||||||||||||||||
| 4595 | - | |||||||||||||||||||||||||||||||
| 4596 | - | |||||||||||||||||||||||||||||||
| 4597 | if (!conflictedGestures.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4598 | for (int i = 0; i < cachedTargetItems.size()
| 0 | ||||||||||||||||||||||||||||||
| 4599 | QPointer<QGraphicsObject> item = cachedTargetItems.at(i); | - | ||||||||||||||||||||||||||||||
| 4600 | - | |||||||||||||||||||||||||||||||
| 4601 | - | |||||||||||||||||||||||||||||||
| 4602 | QSet<QGesture *> gestures = conflictedGestures & cachedItemGestures.value(item.data()); | - | ||||||||||||||||||||||||||||||
| 4603 | if (gestures.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4604 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 4605 | - | |||||||||||||||||||||||||||||||
| 4606 | if (0) QMessageLogger(__FILE__, 6265, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" dead code: QMessageLogger(__FILE__, 6265, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering override to" << item.data() << gestures; | - | ||||||||||||||||||||||||||||||
| 4607 | << "delivering override to" dead code: QMessageLogger(__FILE__, 6265, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering override to" << item.data() << gestures; | - | ||||||||||||||||||||||||||||||
| 4608 | << item.data() << gestures; dead code: QMessageLogger(__FILE__, 6265, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering override to" << item.data() << gestures; | - | ||||||||||||||||||||||||||||||
| 4609 | - | |||||||||||||||||||||||||||||||
| 4610 | QGestureEvent ev(gestures.toList()); | - | ||||||||||||||||||||||||||||||
| 4611 | ev.t = QEvent::GestureOverride; | - | ||||||||||||||||||||||||||||||
| 4612 | ev.setWidget(event->widget()); | - | ||||||||||||||||||||||||||||||
| 4613 | - | |||||||||||||||||||||||||||||||
| 4614 | ev.ignore(); | - | ||||||||||||||||||||||||||||||
| 4615 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(gestures)>::type> _container_((gestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *g = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 4616 | ev.setAccepted(g, false); never executed: ev.setAccepted(g, false); | 0 | ||||||||||||||||||||||||||||||
| 4617 | sendEvent(item.data(), &ev); | - | ||||||||||||||||||||||||||||||
| 4618 | - | |||||||||||||||||||||||||||||||
| 4619 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(gestures)>::type> _container_((gestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *g = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 4620 | if (ev.isAccepted()
| 0 | ||||||||||||||||||||||||||||||
| 4621 | conflictedGestures.remove(g); | - | ||||||||||||||||||||||||||||||
| 4622 | - | |||||||||||||||||||||||||||||||
| 4623 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 4624 | gestureTargets.insert(g, item.data()); | - | ||||||||||||||||||||||||||||||
| 4625 | QHash<QGraphicsObject *, QSet<QGesture *> >::iterator it, e; | - | ||||||||||||||||||||||||||||||
| 4626 | it = cachedItemGestures.begin(); | - | ||||||||||||||||||||||||||||||
| 4627 | e = cachedItemGestures.end(); | - | ||||||||||||||||||||||||||||||
| 4628 | for(; it != e
| 0 | ||||||||||||||||||||||||||||||
| 4629 | it.value().remove(g); never executed: it.value().remove(g); | 0 | ||||||||||||||||||||||||||||||
| 4630 | cachedItemGestures[item.data()].insert(g); | - | ||||||||||||||||||||||||||||||
| 4631 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4632 | if (0) QMessageLogger(__FILE__, 6291, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" dead code: QMessageLogger(__FILE__, 6291, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "override was accepted:" << g << item.data(); | - | ||||||||||||||||||||||||||||||
| 4633 | << "override was accepted:" dead code: QMessageLogger(__FILE__, 6291, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "override was accepted:" << g << item.data(); | - | ||||||||||||||||||||||||||||||
| 4634 | << g << item.data(); dead code: QMessageLogger(__FILE__, 6291, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "override was accepted:" << g << item.data(); | - | ||||||||||||||||||||||||||||||
| 4635 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4636 | - | |||||||||||||||||||||||||||||||
| 4637 | - | |||||||||||||||||||||||||||||||
| 4638 | - | |||||||||||||||||||||||||||||||
| 4639 | if (!gestureTargets.contains(g)
| 0 | ||||||||||||||||||||||||||||||
| 4640 | gestureTargets.insert(g, item.data()); never executed: gestureTargets.insert(g, item.data()); | 0 | ||||||||||||||||||||||||||||||
| 4641 | - | |||||||||||||||||||||||||||||||
| 4642 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4643 | if (conflictedGestures.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4644 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4645 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4646 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4647 | - | |||||||||||||||||||||||||||||||
| 4648 | - | |||||||||||||||||||||||||||||||
| 4649 | if (!normalGestures.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4650 | for (int i = 0; i < cachedTargetItems.size()
| 0 | ||||||||||||||||||||||||||||||
| 4651 | QGraphicsObject *item = cachedTargetItems.at(i); | - | ||||||||||||||||||||||||||||||
| 4652 | - | |||||||||||||||||||||||||||||||
| 4653 | - | |||||||||||||||||||||||||||||||
| 4654 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(cachedItemGestures.value(item))>::type> _container_((cachedItemGestures.value(item))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *g = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 4655 | if (!gestureTargets.contains(g)
| 0 | ||||||||||||||||||||||||||||||
| 4656 | gestureTargets.insert(g, item); | - | ||||||||||||||||||||||||||||||
| 4657 | normalGestures.remove(g); | - | ||||||||||||||||||||||||||||||
| 4658 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4659 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4660 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4661 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4662 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4663 | - | |||||||||||||||||||||||||||||||
| 4664 | - | |||||||||||||||||||||||||||||||
| 4665 | - | |||||||||||||||||||||||||||||||
| 4666 | QSet<QGesture *> undeliveredGestures; | - | ||||||||||||||||||||||||||||||
| 4667 | QSet<QGesture *> parentPropagatedGestures; | - | ||||||||||||||||||||||||||||||
| 4668 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(allGestures)>::type> _container_((allGestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *gesture = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 4669 | if (QGraphicsObject *target = gestureTargets.value(gesture, 0)
| 0 | ||||||||||||||||||||||||||||||
| 4670 | cachedItemGestures[target].insert(gesture); | - | ||||||||||||||||||||||||||||||
| 4671 | cachedTargetItems.append(target); | - | ||||||||||||||||||||||||||||||
| 4672 | undeliveredGestures.insert(gesture); | - | ||||||||||||||||||||||||||||||
| 4673 | QGraphicsItemPrivate *d = target->QGraphicsItem::d_func(); | - | ||||||||||||||||||||||||||||||
| 4674 | const Qt::GestureFlags flags = d->gestureContext.value(gesture->gestureType()); | - | ||||||||||||||||||||||||||||||
| 4675 | if (flags & Qt::IgnoredGesturesPropagateToParent
| 0 | ||||||||||||||||||||||||||||||
| 4676 | parentPropagatedGestures.insert(gesture); never executed: parentPropagatedGestures.insert(gesture); | 0 | ||||||||||||||||||||||||||||||
| 4677 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4678 | if (0) QMessageLogger(__FILE__, 6337, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" dead code: QMessageLogger(__FILE__, 6337, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "no target for" << gesture << "at" << gesture->hotSpot() << gesture->d_func()->sceneHotSpot; | - | ||||||||||||||||||||||||||||||
| 4679 | << "no target for" << gesture << "at" dead code: QMessageLogger(__FILE__, 6337, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "no target for" << gesture << "at" << gesture->hotSpot() << gesture->d_func()->sceneHotSpot; | - | ||||||||||||||||||||||||||||||
| 4680 | << gesture->hotSpot() << gesture->d_func()->sceneHotSpot; dead code: QMessageLogger(__FILE__, 6337, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "no target for" << gesture << "at" << gesture->hotSpot() << gesture->d_func()->sceneHotSpot; | - | ||||||||||||||||||||||||||||||
| 4681 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4682 | } | - | ||||||||||||||||||||||||||||||
| 4683 | std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); | - | ||||||||||||||||||||||||||||||
| 4684 | for (int i = 0; i < cachedTargetItems.size()
| 0 | ||||||||||||||||||||||||||||||
| 4685 | QPointer<QGraphicsObject> receiver = cachedTargetItems.at(i); | - | ||||||||||||||||||||||||||||||
| 4686 | QSet<QGesture *> gestures = | - | ||||||||||||||||||||||||||||||
| 4687 | undeliveredGestures & cachedItemGestures.value(receiver.data()); | - | ||||||||||||||||||||||||||||||
| 4688 | gestures -= cachedAlreadyDeliveredGestures.value(receiver.data()); | - | ||||||||||||||||||||||||||||||
| 4689 | - | |||||||||||||||||||||||||||||||
| 4690 | if (gestures.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4691 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 4692 | - | |||||||||||||||||||||||||||||||
| 4693 | cachedAlreadyDeliveredGestures[receiver.data()] += gestures; | - | ||||||||||||||||||||||||||||||
| 4694 | const bool isPanel = receiver.data()->isPanel(); | - | ||||||||||||||||||||||||||||||
| 4695 | - | |||||||||||||||||||||||||||||||
| 4696 | if (0) QMessageLogger(__FILE__, 6355, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" dead code: QMessageLogger(__FILE__, 6355, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering to" << receiver.data() << gestures; | - | ||||||||||||||||||||||||||||||
| 4697 | << "delivering to" dead code: QMessageLogger(__FILE__, 6355, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering to" << receiver.data() << gestures; | - | ||||||||||||||||||||||||||||||
| 4698 | << receiver.data() << gestures; dead code: QMessageLogger(__FILE__, 6355, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering to" << receiver.data() << gestures; | - | ||||||||||||||||||||||||||||||
| 4699 | QGestureEvent ev(gestures.toList()); | - | ||||||||||||||||||||||||||||||
| 4700 | ev.setWidget(event->widget()); | - | ||||||||||||||||||||||||||||||
| 4701 | sendEvent(receiver.data(), &ev); | - | ||||||||||||||||||||||||||||||
| 4702 | QSet<QGesture *> ignoredGestures; | - | ||||||||||||||||||||||||||||||
| 4703 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(gestures)>::type> _container_((gestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *g = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 4704 | if (!ev.isAccepted()
| 0 | ||||||||||||||||||||||||||||||
| 4705 | - | |||||||||||||||||||||||||||||||
| 4706 | - | |||||||||||||||||||||||||||||||
| 4707 | - | |||||||||||||||||||||||||||||||
| 4708 | - | |||||||||||||||||||||||||||||||
| 4709 | - | |||||||||||||||||||||||||||||||
| 4710 | if (receiver
| 0 | ||||||||||||||||||||||||||||||
| 4711 | ignoredGestures.insert(g); never executed: ignoredGestures.insert(g); | 0 | ||||||||||||||||||||||||||||||
| 4712 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4713 | if (receiver
| 0 | ||||||||||||||||||||||||||||||
| 4714 | - | |||||||||||||||||||||||||||||||
| 4715 | - | |||||||||||||||||||||||||||||||
| 4716 | gestureTargets[g] = receiver.data(); | - | ||||||||||||||||||||||||||||||
| 4717 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4718 | undeliveredGestures.remove(g); | - | ||||||||||||||||||||||||||||||
| 4719 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4720 | } | - | ||||||||||||||||||||||||||||||
| 4721 | if (undeliveredGestures.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4722 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4723 | - | |||||||||||||||||||||||||||||||
| 4724 | - | |||||||||||||||||||||||||||||||
| 4725 | - | |||||||||||||||||||||||||||||||
| 4726 | if (!ignoredGestures.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4727 | - | |||||||||||||||||||||||||||||||
| 4728 | - | |||||||||||||||||||||||||||||||
| 4729 | - | |||||||||||||||||||||||||||||||
| 4730 | QSet<QGraphicsObject *> targetsSet = cachedTargetItems.toSet(); | - | ||||||||||||||||||||||||||||||
| 4731 | - | |||||||||||||||||||||||||||||||
| 4732 | if (receiver
| 0 | ||||||||||||||||||||||||||||||
| 4733 | - | |||||||||||||||||||||||||||||||
| 4734 | for (QSet<QGesture *>::iterator it = ignoredGestures.begin(); | - | ||||||||||||||||||||||||||||||
| 4735 | it != ignoredGestures.end()
| 0 | ||||||||||||||||||||||||||||||
| 4736 | if (parentPropagatedGestures.contains(*it)
| 0 | ||||||||||||||||||||||||||||||
| 4737 | QGesture *gesture = *it; | - | ||||||||||||||||||||||||||||||
| 4738 | const Qt::GestureType gestureType = gesture->gestureType(); | - | ||||||||||||||||||||||||||||||
| 4739 | QGraphicsItem *item = receiver.data(); | - | ||||||||||||||||||||||||||||||
| 4740 | while (item
| 0 | ||||||||||||||||||||||||||||||
| 4741 | if (QGraphicsObject *obj = item->toGraphicsObject()
| 0 | ||||||||||||||||||||||||||||||
| 4742 | if (item->d_func()->gestureContext.contains(gestureType)
| 0 | ||||||||||||||||||||||||||||||
| 4743 | targetsSet.insert(obj); | - | ||||||||||||||||||||||||||||||
| 4744 | cachedItemGestures[obj].insert(gesture); | - | ||||||||||||||||||||||||||||||
| 4745 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4746 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4747 | if (item->isPanel()
| 0 | ||||||||||||||||||||||||||||||
| 4748 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4749 | item = item->parentItem(); | - | ||||||||||||||||||||||||||||||
| 4750 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4751 | - | |||||||||||||||||||||||||||||||
| 4752 | it = ignoredGestures.erase(it); | - | ||||||||||||||||||||||||||||||
| 4753 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 4754 | } | - | ||||||||||||||||||||||||||||||
| 4755 | ++it; | - | ||||||||||||||||||||||||||||||
| 4756 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4757 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4758 | - | |||||||||||||||||||||||||||||||
| 4759 | gestureTargetsAtHotSpots(ignoredGestures, Qt::ReceivePartialGestures, | - | ||||||||||||||||||||||||||||||
| 4760 | &cachedItemGestures, &targetsSet, 0, 0); | - | ||||||||||||||||||||||||||||||
| 4761 | - | |||||||||||||||||||||||||||||||
| 4762 | cachedTargetItems = targetsSet.toList(); | - | ||||||||||||||||||||||||||||||
| 4763 | std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); | - | ||||||||||||||||||||||||||||||
| 4764 | if (0) QMessageLogger(__FILE__, 6423, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" dead code: QMessageLogger(__FILE__, 6423, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "new targets:" << cachedTargetItems; | - | ||||||||||||||||||||||||||||||
| 4765 | << "new targets:" << cachedTargetItems; dead code: QMessageLogger(__FILE__, 6423, __PRETTY_FUNCTION__).debug() << "QGraphicsScenePrivate::gestureEventHandler:" << "new targets:" << cachedTargetItems; | - | ||||||||||||||||||||||||||||||
| 4766 | i = -1; | - | ||||||||||||||||||||||||||||||
| 4767 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 4768 | } | - | ||||||||||||||||||||||||||||||
| 4769 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4770 | - | |||||||||||||||||||||||||||||||
| 4771 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(startedGestures)>::type> _container_((startedGestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *g = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 4772 | if (g->gestureCancelPolicy() == QGesture::CancelAllInContext
| 0 | ||||||||||||||||||||||||||||||
| 4773 | if (0) QMessageLogger(__FILE__, 6432, __PRETTY_FUNCTION__).debug() << "lets try to cancel some"; dead code: QMessageLogger(__FILE__, 6432, __PRETTY_FUNCTION__).debug() << "lets try to cancel some"; | - | ||||||||||||||||||||||||||||||
| 4774 | - | |||||||||||||||||||||||||||||||
| 4775 | cancelGesturesForChildren(g); | - | ||||||||||||||||||||||||||||||
| 4776 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4777 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4778 | - | |||||||||||||||||||||||||||||||
| 4779 | - | |||||||||||||||||||||||||||||||
| 4780 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(allGestures)>::type> _container_((allGestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *g = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 4781 | switch (g->state()) { | - | ||||||||||||||||||||||||||||||
| 4782 | case never executed: Qt::GestureFinished:case Qt::GestureFinished:never executed: case Qt::GestureFinished: | 0 | ||||||||||||||||||||||||||||||
| 4783 | case never executed: Qt::GestureCanceled:case Qt::GestureCanceled:never executed: case Qt::GestureCanceled: | 0 | ||||||||||||||||||||||||||||||
| 4784 | gestureTargets.remove(g); | - | ||||||||||||||||||||||||||||||
| 4785 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4786 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 4787 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4788 | } | - | ||||||||||||||||||||||||||||||
| 4789 | } | - | ||||||||||||||||||||||||||||||
| 4790 | - | |||||||||||||||||||||||||||||||
| 4791 | cachedTargetItems.clear(); | - | ||||||||||||||||||||||||||||||
| 4792 | cachedItemGestures.clear(); | - | ||||||||||||||||||||||||||||||
| 4793 | cachedAlreadyDeliveredGestures.clear(); | - | ||||||||||||||||||||||||||||||
| 4794 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4795 | - | |||||||||||||||||||||||||||||||
| 4796 | void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original) | - | ||||||||||||||||||||||||||||||
| 4797 | { | - | ||||||||||||||||||||||||||||||
| 4798 | ((!(original)) ? qt_assert("original",__FILE__,6457) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 4799 | QGraphicsItem *originalItem = gestureTargets.value(original); | - | ||||||||||||||||||||||||||||||
| 4800 | if (originalItem == 0
| 0 | ||||||||||||||||||||||||||||||
| 4801 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4802 | - | |||||||||||||||||||||||||||||||
| 4803 | - | |||||||||||||||||||||||||||||||
| 4804 | - | |||||||||||||||||||||||||||||||
| 4805 | - | |||||||||||||||||||||||||||||||
| 4806 | QSet<QGesture *> canceledGestures; | - | ||||||||||||||||||||||||||||||
| 4807 | QHash<QGesture *, QGraphicsObject *>::Iterator iter = gestureTargets.begin(); | - | ||||||||||||||||||||||||||||||
| 4808 | while (iter != gestureTargets.end()
| 0 | ||||||||||||||||||||||||||||||
| 4809 | QGraphicsObject *item = iter.value(); | - | ||||||||||||||||||||||||||||||
| 4810 | - | |||||||||||||||||||||||||||||||
| 4811 | if (item != originalItem
| 0 | ||||||||||||||||||||||||||||||
| 4812 | if (0) QMessageLogger(__FILE__, 6471, __PRETTY_FUNCTION__).debug() << " found a gesture to cancel" << iter.key(); dead code: QMessageLogger(__FILE__, 6471, __PRETTY_FUNCTION__).debug() << " found a gesture to cancel" << iter.key(); | - | ||||||||||||||||||||||||||||||
| 4813 | iter.key()->d_func()->state = Qt::GestureCanceled; | - | ||||||||||||||||||||||||||||||
| 4814 | canceledGestures << iter.key(); | - | ||||||||||||||||||||||||||||||
| 4815 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4816 | ++iter; | - | ||||||||||||||||||||||||||||||
| 4817 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4818 | - | |||||||||||||||||||||||||||||||
| 4819 | - | |||||||||||||||||||||||||||||||
| 4820 | QSet<QGesture *> almostCanceledGestures = canceledGestures; | - | ||||||||||||||||||||||||||||||
| 4821 | QSet<QGesture *>::Iterator setIter; | - | ||||||||||||||||||||||||||||||
| 4822 | while (!almostCanceledGestures.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4823 | QGraphicsObject *target = 0; | - | ||||||||||||||||||||||||||||||
| 4824 | QSet<QGesture*> gestures; | - | ||||||||||||||||||||||||||||||
| 4825 | setIter = almostCanceledGestures.begin(); | - | ||||||||||||||||||||||||||||||
| 4826 | - | |||||||||||||||||||||||||||||||
| 4827 | while (setIter != almostCanceledGestures.end()
| 0 | ||||||||||||||||||||||||||||||
| 4828 | QGraphicsObject *item = gestureTargets.value(*setIter); | - | ||||||||||||||||||||||||||||||
| 4829 | if (target == 0
| 0 | ||||||||||||||||||||||||||||||
| 4830 | target = item; never executed: target = item; | 0 | ||||||||||||||||||||||||||||||
| 4831 | if (target == item
| 0 | ||||||||||||||||||||||||||||||
| 4832 | gestures << *setIter; | - | ||||||||||||||||||||||||||||||
| 4833 | setIter = almostCanceledGestures.erase(setIter); | - | ||||||||||||||||||||||||||||||
| 4834 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4835 | ++setIter; | - | ||||||||||||||||||||||||||||||
| 4836 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4837 | } | - | ||||||||||||||||||||||||||||||
| 4838 | ((!(target)) ? qt_assert("target",__FILE__,6497) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 4839 | - | |||||||||||||||||||||||||||||||
| 4840 | QList<QGesture *> list = gestures.toList(); | - | ||||||||||||||||||||||||||||||
| 4841 | QGestureEvent ev(list); | - | ||||||||||||||||||||||||||||||
| 4842 | sendEvent(target, &ev); | - | ||||||||||||||||||||||||||||||
| 4843 | - | |||||||||||||||||||||||||||||||
| 4844 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(list)>::type> _container_((list)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *g = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 4845 | if (ev.isAccepted()
| 0 | ||||||||||||||||||||||||||||||
| 4846 | gestures.remove(g); never executed: gestures.remove(g); | 0 | ||||||||||||||||||||||||||||||
| 4847 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4848 | - | |||||||||||||||||||||||||||||||
| 4849 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(gestures)>::type> _container_((gestures)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGesture *g = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||
| 4850 | if (!g->hasHotSpot()
| 0 | ||||||||||||||||||||||||||||||
| 4851 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 4852 | - | |||||||||||||||||||||||||||||||
| 4853 | QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), g->d_func()->sceneHotSpot, 0); | - | ||||||||||||||||||||||||||||||
| 4854 | for (int j = 0; j < items.size()
| 0 | ||||||||||||||||||||||||||||||
| 4855 | QGraphicsObject *item = items.at(j)->toGraphicsObject(); | - | ||||||||||||||||||||||||||||||
| 4856 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 4857 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 4858 | QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); | - | ||||||||||||||||||||||||||||||
| 4859 | if (d->gestureContext.contains(g->gestureType())
| 0 | ||||||||||||||||||||||||||||||
| 4860 | QList<QGesture *> list; | - | ||||||||||||||||||||||||||||||
| 4861 | list << g; | - | ||||||||||||||||||||||||||||||
| 4862 | QGestureEvent ev(list); | - | ||||||||||||||||||||||||||||||
| 4863 | sendEvent(item, &ev); | - | ||||||||||||||||||||||||||||||
| 4864 | if (ev.isAccepted()
| 0 | ||||||||||||||||||||||||||||||
| 4865 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4866 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4867 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4868 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4869 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4870 | - | |||||||||||||||||||||||||||||||
| 4871 | QGestureManager *gestureManager = QApplicationPrivate::instance()->gestureManager; | - | ||||||||||||||||||||||||||||||
| 4872 | ((!(gestureManager)) ? qt_assert("gestureManager",__FILE__,6531) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 4873 | for (setIter = canceledGestures.begin(); setIter != canceledGestures.end()
| 0 | ||||||||||||||||||||||||||||||
| 4874 | gestureManager->recycle(*setIter); | - | ||||||||||||||||||||||||||||||
| 4875 | gestureTargets.remove(*setIter); | - | ||||||||||||||||||||||||||||||
| 4876 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4877 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4878 | - | |||||||||||||||||||||||||||||||
| 4879 | void QGraphicsScenePrivate::grabGesture(QGraphicsItem *, Qt::GestureType gesture) | - | ||||||||||||||||||||||||||||||
| 4880 | { | - | ||||||||||||||||||||||||||||||
| 4881 | (void)QGestureManager::instance(); | - | ||||||||||||||||||||||||||||||
| 4882 | if (!grabbedGestures[gesture]++
| 0 | ||||||||||||||||||||||||||||||
| 4883 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(views)>::type> _container_((views)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsView *view = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 4884 | view->viewport()->grabGesture(gesture); never executed: view->viewport()->grabGesture(gesture); | 0 | ||||||||||||||||||||||||||||||
| 4885 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4886 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4887 | - | |||||||||||||||||||||||||||||||
| 4888 | void QGraphicsScenePrivate::ungrabGesture(QGraphicsItem *item, Qt::GestureType gesture) | - | ||||||||||||||||||||||||||||||
| 4889 | { | - | ||||||||||||||||||||||||||||||
| 4890 | - | |||||||||||||||||||||||||||||||
| 4891 | ((!(item->d_ptr->isObject)) ? qt_assert("item->d_ptr->isObject",__FILE__,6550) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 4892 | QGraphicsObject *obj = static_cast<QGraphicsObject *>(item); | - | ||||||||||||||||||||||||||||||
| 4893 | QGestureManager::instance()->cleanupCachedGestures(obj, gesture); | - | ||||||||||||||||||||||||||||||
| 4894 | if (!--grabbedGestures[gesture]
| 0 | ||||||||||||||||||||||||||||||
| 4895 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(views)>::type> _container_((views)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsView *view = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 4896 | view->viewport()->ungrabGesture(gesture); never executed: view->viewport()->ungrabGesture(gesture); | 0 | ||||||||||||||||||||||||||||||
| 4897 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4898 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4899 | - | |||||||||||||||||||||||||||||||
| 4900 | - | |||||||||||||||||||||||||||||||
| 4901 | - | |||||||||||||||||||||||||||||||
| 4902 | - | |||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |