Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/graphicsview/qgraphicsview.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | static const int QGRAPHICSVIEW_REGION_RECT_THRESHOLD = 50; | - | ||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; | - | ||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||
13 | bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); | - | ||||||||||||||||||||||||
14 | - | |||||||||||||||||||||||||
15 | inline int q_round_bound(qreal d) | - | ||||||||||||||||||||||||
16 | { | - | ||||||||||||||||||||||||
17 | if (d <= (qreal) (-2147483647 - 1)
| 0 | ||||||||||||||||||||||||
18 | return never executed: (-2147483647 - 1);return (-2147483647 - 1); never executed: return (-2147483647 - 1); | 0 | ||||||||||||||||||||||||
19 | else if (d >= (qreal) 2147483647
| 0 | ||||||||||||||||||||||||
20 | return never executed: 2147483647;return 2147483647; never executed: return 2147483647; | 0 | ||||||||||||||||||||||||
21 | return never executed: d >= 0.0return d >= 0.0 ? int(d + 0.5) : int(d - int(d-1) + 0.5) + int(d-1);
never executed: return d >= 0.0 ? int(d + 0.5) : int(d - int(d-1) + 0.5) + int(d-1); | 0 | ||||||||||||||||||||||||
22 | } | - | ||||||||||||||||||||||||
23 | - | |||||||||||||||||||||||||
24 | void QGraphicsViewPrivate::translateTouchEvent(QGraphicsViewPrivate *d, QTouchEvent *touchEvent) | - | ||||||||||||||||||||||||
25 | { | - | ||||||||||||||||||||||||
26 | QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints(); | - | ||||||||||||||||||||||||
27 | for (int i = 0; i < touchPoints.count()
| 0 | ||||||||||||||||||||||||
28 | QTouchEvent::TouchPoint &touchPoint = touchPoints[i]; | - | ||||||||||||||||||||||||
29 | - | |||||||||||||||||||||||||
30 | - | |||||||||||||||||||||||||
31 | touchPoint.setSceneRect(d->mapToScene(touchPoint.rect())); | - | ||||||||||||||||||||||||
32 | touchPoint.setStartScenePos(d->mapToScene(touchPoint.startPos())); | - | ||||||||||||||||||||||||
33 | touchPoint.setLastScenePos(d->mapToScene(touchPoint.lastPos())); | - | ||||||||||||||||||||||||
34 | - | |||||||||||||||||||||||||
35 | - | |||||||||||||||||||||||||
36 | } never executed: end of block | 0 | ||||||||||||||||||||||||
37 | - | |||||||||||||||||||||||||
38 | touchEvent->setTouchPoints(touchPoints); | - | ||||||||||||||||||||||||
39 | } never executed: end of block | 0 | ||||||||||||||||||||||||
40 | - | |||||||||||||||||||||||||
41 | - | |||||||||||||||||||||||||
42 | - | |||||||||||||||||||||||||
43 | - | |||||||||||||||||||||||||
44 | QGraphicsViewPrivate::QGraphicsViewPrivate() | - | ||||||||||||||||||||||||
45 | : renderHints(QPainter::TextAntialiasing), | - | ||||||||||||||||||||||||
46 | dragMode(QGraphicsView::NoDrag), | - | ||||||||||||||||||||||||
47 | sceneInteractionAllowed(true), hasSceneRect(false), | - | ||||||||||||||||||||||||
48 | connectedToScene(false), | - | ||||||||||||||||||||||||
49 | useLastMouseEvent(false), | - | ||||||||||||||||||||||||
50 | identityMatrix(true), | - | ||||||||||||||||||||||||
51 | dirtyScroll(true), | - | ||||||||||||||||||||||||
52 | accelerateScrolling(true), | - | ||||||||||||||||||||||||
53 | keepLastCenterPoint(true), | - | ||||||||||||||||||||||||
54 | transforming(false), | - | ||||||||||||||||||||||||
55 | handScrolling(false), | - | ||||||||||||||||||||||||
56 | mustAllocateStyleOptions(false), | - | ||||||||||||||||||||||||
57 | mustResizeBackgroundPixmap(true), | - | ||||||||||||||||||||||||
58 | fullUpdatePending(true), | - | ||||||||||||||||||||||||
59 | hasUpdateClip(false), | - | ||||||||||||||||||||||||
60 | mousePressButton(Qt::NoButton), | - | ||||||||||||||||||||||||
61 | leftIndent(0), topIndent(0), | - | ||||||||||||||||||||||||
62 | lastMouseEvent(QEvent::None, QPointF(), QPointF(), QPointF(), Qt::NoButton, 0, 0), | - | ||||||||||||||||||||||||
63 | alignment(Qt::AlignCenter), | - | ||||||||||||||||||||||||
64 | transformationAnchor(QGraphicsView::AnchorViewCenter), resizeAnchor(QGraphicsView::NoAnchor), | - | ||||||||||||||||||||||||
65 | viewportUpdateMode(QGraphicsView::MinimalViewportUpdate), | - | ||||||||||||||||||||||||
66 | optimizationFlags(0), | - | ||||||||||||||||||||||||
67 | scene(0), | - | ||||||||||||||||||||||||
68 | - | |||||||||||||||||||||||||
69 | rubberBanding(false), | - | ||||||||||||||||||||||||
70 | rubberBandSelectionMode(Qt::IntersectsItemShape), | - | ||||||||||||||||||||||||
71 | rubberBandSelectionOperation(Qt::ReplaceSelection), | - | ||||||||||||||||||||||||
72 | - | |||||||||||||||||||||||||
73 | handScrollMotions(0), cacheMode(0), | - | ||||||||||||||||||||||||
74 | - | |||||||||||||||||||||||||
75 | hasStoredOriginalCursor(false), | - | ||||||||||||||||||||||||
76 | - | |||||||||||||||||||||||||
77 | lastDragDropEvent(0), | - | ||||||||||||||||||||||||
78 | updateSceneSlotReimplementedChecked(false) | - | ||||||||||||||||||||||||
79 | { | - | ||||||||||||||||||||||||
80 | styleOptions.reserve(QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS); | - | ||||||||||||||||||||||||
81 | } never executed: end of block | 0 | ||||||||||||||||||||||||
82 | - | |||||||||||||||||||||||||
83 | QGraphicsViewPrivate::~QGraphicsViewPrivate() | - | ||||||||||||||||||||||||
84 | { | - | ||||||||||||||||||||||||
85 | } | - | ||||||||||||||||||||||||
86 | - | |||||||||||||||||||||||||
87 | - | |||||||||||||||||||||||||
88 | - | |||||||||||||||||||||||||
89 | - | |||||||||||||||||||||||||
90 | void QGraphicsViewPrivate::recalculateContentSize() | - | ||||||||||||||||||||||||
91 | { | - | ||||||||||||||||||||||||
92 | QGraphicsView * const q = q_func(); | - | ||||||||||||||||||||||||
93 | - | |||||||||||||||||||||||||
94 | QSize maxSize = q->maximumViewportSize(); | - | ||||||||||||||||||||||||
95 | int width = maxSize.width(); | - | ||||||||||||||||||||||||
96 | int height = maxSize.height(); | - | ||||||||||||||||||||||||
97 | QRectF viewRect = matrix.mapRect(q->sceneRect()); | - | ||||||||||||||||||||||||
98 | - | |||||||||||||||||||||||||
99 | bool frameOnlyAround = (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)); | - | ||||||||||||||||||||||||
100 | if (frameOnlyAround
| 0 | ||||||||||||||||||||||||
101 | if (hbarpolicy == Qt::ScrollBarAlwaysOn
| 0 | ||||||||||||||||||||||||
102 | height -= frameWidth * 2; never executed: height -= frameWidth * 2; | 0 | ||||||||||||||||||||||||
103 | if (vbarpolicy == Qt::ScrollBarAlwaysOn
| 0 | ||||||||||||||||||||||||
104 | width -= frameWidth * 2; never executed: width -= frameWidth * 2; | 0 | ||||||||||||||||||||||||
105 | } never executed: end of block | 0 | ||||||||||||||||||||||||
106 | - | |||||||||||||||||||||||||
107 | - | |||||||||||||||||||||||||
108 | - | |||||||||||||||||||||||||
109 | int scrollBarExtent = q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, q); | - | ||||||||||||||||||||||||
110 | if (frameOnlyAround
| 0 | ||||||||||||||||||||||||
111 | scrollBarExtent += frameWidth * 2; never executed: scrollBarExtent += frameWidth * 2; | 0 | ||||||||||||||||||||||||
112 | - | |||||||||||||||||||||||||
113 | - | |||||||||||||||||||||||||
114 | - | |||||||||||||||||||||||||
115 | bool useHorizontalScrollBar = (
| 0 | ||||||||||||||||||||||||
116 | bool useVerticalScrollBar = (
| 0 | ||||||||||||||||||||||||
117 | if (useHorizontalScrollBar
| 0 | ||||||||||||||||||||||||
118 | if (viewRect.height() > height - scrollBarExtent
| 0 | ||||||||||||||||||||||||
119 | useVerticalScrollBar = true; never executed: useVerticalScrollBar = true; | 0 | ||||||||||||||||||||||||
120 | } never executed: end of block | 0 | ||||||||||||||||||||||||
121 | if (useVerticalScrollBar
| 0 | ||||||||||||||||||||||||
122 | if (viewRect.width() > width - scrollBarExtent
| 0 | ||||||||||||||||||||||||
123 | useHorizontalScrollBar = true; never executed: useHorizontalScrollBar = true; | 0 | ||||||||||||||||||||||||
124 | } never executed: end of block | 0 | ||||||||||||||||||||||||
125 | if (useHorizontalScrollBar
| 0 | ||||||||||||||||||||||||
126 | height -= scrollBarExtent; never executed: height -= scrollBarExtent; | 0 | ||||||||||||||||||||||||
127 | if (useVerticalScrollBar
| 0 | ||||||||||||||||||||||||
128 | width -= scrollBarExtent; never executed: width -= scrollBarExtent; | 0 | ||||||||||||||||||||||||
129 | - | |||||||||||||||||||||||||
130 | - | |||||||||||||||||||||||||
131 | - | |||||||||||||||||||||||||
132 | - | |||||||||||||||||||||||||
133 | QPointF savedLastCenterPoint = lastCenterPoint; | - | ||||||||||||||||||||||||
134 | - | |||||||||||||||||||||||||
135 | - | |||||||||||||||||||||||||
136 | qreal oldLeftIndent = leftIndent; | - | ||||||||||||||||||||||||
137 | qreal oldTopIndent = topIndent; | - | ||||||||||||||||||||||||
138 | - | |||||||||||||||||||||||||
139 | - | |||||||||||||||||||||||||
140 | - | |||||||||||||||||||||||||
141 | int left = q_round_bound(viewRect.left()); | - | ||||||||||||||||||||||||
142 | int right = q_round_bound(viewRect.right() - width); | - | ||||||||||||||||||||||||
143 | if (left >= right
| 0 | ||||||||||||||||||||||||
144 | hbar->setRange(0, 0); | - | ||||||||||||||||||||||||
145 | - | |||||||||||||||||||||||||
146 | switch (alignment & Qt::AlignHorizontal_Mask) { | - | ||||||||||||||||||||||||
147 | case never executed: Qt::AlignLeft:case Qt::AlignLeft: never executed: case Qt::AlignLeft: | 0 | ||||||||||||||||||||||||
148 | leftIndent = -viewRect.left(); | - | ||||||||||||||||||||||||
149 | break; never executed: break; | 0 | ||||||||||||||||||||||||
150 | case never executed: Qt::AlignRight:case Qt::AlignRight: never executed: case Qt::AlignRight: | 0 | ||||||||||||||||||||||||
151 | leftIndent = width - viewRect.width() - viewRect.left() - 1; | - | ||||||||||||||||||||||||
152 | break; never executed: break; | 0 | ||||||||||||||||||||||||
153 | case never executed: Qt::AlignHCenter:case Qt::AlignHCenter: never executed: case Qt::AlignHCenter: | 0 | ||||||||||||||||||||||||
154 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
155 | leftIndent = width / 2 - (viewRect.left() + viewRect.right()) / 2; | - | ||||||||||||||||||||||||
156 | break; never executed: break; | 0 | ||||||||||||||||||||||||
157 | } | - | ||||||||||||||||||||||||
158 | } else { | - | ||||||||||||||||||||||||
159 | hbar->setRange(left, right); | - | ||||||||||||||||||||||||
160 | hbar->setPageStep(width); | - | ||||||||||||||||||||||||
161 | hbar->setSingleStep(width / 20); | - | ||||||||||||||||||||||||
162 | leftIndent = 0; | - | ||||||||||||||||||||||||
163 | } never executed: end of block | 0 | ||||||||||||||||||||||||
164 | - | |||||||||||||||||||||||||
165 | - | |||||||||||||||||||||||||
166 | - | |||||||||||||||||||||||||
167 | int top = q_round_bound(viewRect.top()); | - | ||||||||||||||||||||||||
168 | int bottom = q_round_bound(viewRect.bottom() - height); | - | ||||||||||||||||||||||||
169 | if (top >= bottom
| 0 | ||||||||||||||||||||||||
170 | vbar->setRange(0, 0); | - | ||||||||||||||||||||||||
171 | - | |||||||||||||||||||||||||
172 | switch (alignment & Qt::AlignVertical_Mask) { | - | ||||||||||||||||||||||||
173 | case never executed: Qt::AlignTop:case Qt::AlignTop: never executed: case Qt::AlignTop: | 0 | ||||||||||||||||||||||||
174 | topIndent = -viewRect.top(); | - | ||||||||||||||||||||||||
175 | break; never executed: break; | 0 | ||||||||||||||||||||||||
176 | case never executed: Qt::AlignBottom:case Qt::AlignBottom: never executed: case Qt::AlignBottom: | 0 | ||||||||||||||||||||||||
177 | topIndent = height - viewRect.height() - viewRect.top() - 1; | - | ||||||||||||||||||||||||
178 | break; never executed: break; | 0 | ||||||||||||||||||||||||
179 | case never executed: Qt::AlignVCenter:case Qt::AlignVCenter: never executed: case Qt::AlignVCenter: | 0 | ||||||||||||||||||||||||
180 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
181 | topIndent = height / 2 - (viewRect.top() + viewRect.bottom()) / 2; | - | ||||||||||||||||||||||||
182 | break; never executed: break; | 0 | ||||||||||||||||||||||||
183 | } | - | ||||||||||||||||||||||||
184 | } else { | - | ||||||||||||||||||||||||
185 | vbar->setRange(top, bottom); | - | ||||||||||||||||||||||||
186 | vbar->setPageStep(height); | - | ||||||||||||||||||||||||
187 | vbar->setSingleStep(height / 20); | - | ||||||||||||||||||||||||
188 | topIndent = 0; | - | ||||||||||||||||||||||||
189 | } never executed: end of block | 0 | ||||||||||||||||||||||||
190 | - | |||||||||||||||||||||||||
191 | - | |||||||||||||||||||||||||
192 | lastCenterPoint = savedLastCenterPoint; | - | ||||||||||||||||||||||||
193 | - | |||||||||||||||||||||||||
194 | - | |||||||||||||||||||||||||
195 | - | |||||||||||||||||||||||||
196 | - | |||||||||||||||||||||||||
197 | if (oldLeftIndent != leftIndent
| 0 | ||||||||||||||||||||||||
198 | dirtyScroll = true; | - | ||||||||||||||||||||||||
199 | updateAll(); | - | ||||||||||||||||||||||||
200 | } never executed: else if (q->isRightToLeft()end of block
| 0 | ||||||||||||||||||||||||
201 | - | |||||||||||||||||||||||||
202 | - | |||||||||||||||||||||||||
203 | - | |||||||||||||||||||||||||
204 | - | |||||||||||||||||||||||||
205 | dirtyScroll = true; | - | ||||||||||||||||||||||||
206 | } never executed: end of block | 0 | ||||||||||||||||||||||||
207 | - | |||||||||||||||||||||||||
208 | if (cacheMode & QGraphicsView::CacheBackground
| 0 | ||||||||||||||||||||||||
209 | - | |||||||||||||||||||||||||
210 | mustResizeBackgroundPixmap = true; | - | ||||||||||||||||||||||||
211 | } never executed: end of block | 0 | ||||||||||||||||||||||||
212 | } never executed: end of block | 0 | ||||||||||||||||||||||||
213 | - | |||||||||||||||||||||||||
214 | - | |||||||||||||||||||||||||
215 | - | |||||||||||||||||||||||||
216 | - | |||||||||||||||||||||||||
217 | void QGraphicsViewPrivate::centerView(QGraphicsView::ViewportAnchor anchor) | - | ||||||||||||||||||||||||
218 | { | - | ||||||||||||||||||||||||
219 | QGraphicsView * const q = q_func(); | - | ||||||||||||||||||||||||
220 | switch (anchor) { | - | ||||||||||||||||||||||||
221 | case never executed: QGraphicsView::AnchorUnderMouse:case QGraphicsView::AnchorUnderMouse: never executed: {case QGraphicsView::AnchorUnderMouse: | 0 | ||||||||||||||||||||||||
222 | if (q->underMouse()
| 0 | ||||||||||||||||||||||||
223 | - | |||||||||||||||||||||||||
224 | - | |||||||||||||||||||||||||
225 | QPointF transformationDiff = q->mapToScene(viewport->rect().center()) | - | ||||||||||||||||||||||||
226 | - q->mapToScene(viewport->mapFromGlobal(QCursor::pos())); | - | ||||||||||||||||||||||||
227 | q->centerOn(lastMouseMoveScenePoint + transformationDiff); | - | ||||||||||||||||||||||||
228 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
229 | q->centerOn(lastCenterPoint); | - | ||||||||||||||||||||||||
230 | } never executed: end of block | 0 | ||||||||||||||||||||||||
231 | break; never executed: break; | 0 | ||||||||||||||||||||||||
232 | } | - | ||||||||||||||||||||||||
233 | case never executed: QGraphicsView::AnchorViewCenter:case QGraphicsView::AnchorViewCenter: never executed: case QGraphicsView::AnchorViewCenter: | 0 | ||||||||||||||||||||||||
234 | q->centerOn(lastCenterPoint); | - | ||||||||||||||||||||||||
235 | break; never executed: break; | 0 | ||||||||||||||||||||||||
236 | case never executed: QGraphicsView::NoAnchor:case QGraphicsView::NoAnchor: never executed: case QGraphicsView::NoAnchor: | 0 | ||||||||||||||||||||||||
237 | break; never executed: break; | 0 | ||||||||||||||||||||||||
238 | } | - | ||||||||||||||||||||||||
239 | } never executed: end of block | 0 | ||||||||||||||||||||||||
240 | - | |||||||||||||||||||||||||
241 | - | |||||||||||||||||||||||||
242 | - | |||||||||||||||||||||||||
243 | - | |||||||||||||||||||||||||
244 | void QGraphicsViewPrivate::updateLastCenterPoint() | - | ||||||||||||||||||||||||
245 | { | - | ||||||||||||||||||||||||
246 | QGraphicsView * const q = q_func(); | - | ||||||||||||||||||||||||
247 | lastCenterPoint = q->mapToScene(viewport->rect().center()); | - | ||||||||||||||||||||||||
248 | } never executed: end of block | 0 | ||||||||||||||||||||||||
249 | - | |||||||||||||||||||||||||
250 | - | |||||||||||||||||||||||||
251 | - | |||||||||||||||||||||||||
252 | - | |||||||||||||||||||||||||
253 | - | |||||||||||||||||||||||||
254 | - | |||||||||||||||||||||||||
255 | - | |||||||||||||||||||||||||
256 | qint64 QGraphicsViewPrivate::horizontalScroll() const | - | ||||||||||||||||||||||||
257 | { | - | ||||||||||||||||||||||||
258 | if (dirtyScroll
| 0 | ||||||||||||||||||||||||
259 | const_cast< never executed: QGraphicsViewPrivate *>(this)->updateScroll();const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); never executed: const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); | 0 | ||||||||||||||||||||||||
260 | return never executed: scrollX;return scrollX; never executed: return scrollX; | 0 | ||||||||||||||||||||||||
261 | } | - | ||||||||||||||||||||||||
262 | - | |||||||||||||||||||||||||
263 | - | |||||||||||||||||||||||||
264 | - | |||||||||||||||||||||||||
265 | - | |||||||||||||||||||||||||
266 | - | |||||||||||||||||||||||||
267 | - | |||||||||||||||||||||||||
268 | - | |||||||||||||||||||||||||
269 | qint64 QGraphicsViewPrivate::verticalScroll() const | - | ||||||||||||||||||||||||
270 | { | - | ||||||||||||||||||||||||
271 | if (dirtyScroll
| 0 | ||||||||||||||||||||||||
272 | const_cast< never executed: QGraphicsViewPrivate *>(this)->updateScroll();const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); never executed: const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); | 0 | ||||||||||||||||||||||||
273 | return never executed: scrollY;return scrollY; never executed: return scrollY; | 0 | ||||||||||||||||||||||||
274 | } | - | ||||||||||||||||||||||||
275 | - | |||||||||||||||||||||||||
276 | - | |||||||||||||||||||||||||
277 | - | |||||||||||||||||||||||||
278 | - | |||||||||||||||||||||||||
279 | - | |||||||||||||||||||||||||
280 | - | |||||||||||||||||||||||||
281 | QRectF QGraphicsViewPrivate::mapRectToScene(const QRect &rect) const | - | ||||||||||||||||||||||||
282 | { | - | ||||||||||||||||||||||||
283 | if (dirtyScroll
| 0 | ||||||||||||||||||||||||
284 | const_cast< never executed: QGraphicsViewPrivate *>(this)->updateScroll();const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); never executed: const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); | 0 | ||||||||||||||||||||||||
285 | QRectF scrolled = QRectF(rect.translated(scrollX, scrollY)); | - | ||||||||||||||||||||||||
286 | return never executed: identityMatrixreturn identityMatrix ? scrolled : matrix.inverted().mapRect(scrolled);
never executed: return identityMatrix ? scrolled : matrix.inverted().mapRect(scrolled); | 0 | ||||||||||||||||||||||||
287 | } | - | ||||||||||||||||||||||||
288 | - | |||||||||||||||||||||||||
289 | - | |||||||||||||||||||||||||
290 | - | |||||||||||||||||||||||||
291 | - | |||||||||||||||||||||||||
292 | - | |||||||||||||||||||||||||
293 | - | |||||||||||||||||||||||||
294 | - | |||||||||||||||||||||||||
295 | QRectF QGraphicsViewPrivate::mapRectFromScene(const QRectF &rect) const | - | ||||||||||||||||||||||||
296 | { | - | ||||||||||||||||||||||||
297 | if (dirtyScroll
| 0 | ||||||||||||||||||||||||
298 | const_cast< never executed: QGraphicsViewPrivate *>(this)->updateScroll();const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); never executed: const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); | 0 | ||||||||||||||||||||||||
299 | return never executed: (identityMatrixreturn (identityMatrix ? rect : matrix.mapRect(rect)).translated(-scrollX, -scrollY);
never executed: return (identityMatrix ? rect : matrix.mapRect(rect)).translated(-scrollX, -scrollY); | 0 | ||||||||||||||||||||||||
300 | } | - | ||||||||||||||||||||||||
301 | - | |||||||||||||||||||||||||
302 | - | |||||||||||||||||||||||||
303 | - | |||||||||||||||||||||||||
304 | - | |||||||||||||||||||||||||
305 | void QGraphicsViewPrivate::updateScroll() | - | ||||||||||||||||||||||||
306 | { | - | ||||||||||||||||||||||||
307 | QGraphicsView * const q = q_func(); | - | ||||||||||||||||||||||||
308 | scrollX = qint64(-leftIndent); | - | ||||||||||||||||||||||||
309 | if (q->isRightToLeft()
| 0 | ||||||||||||||||||||||||
310 | if (!leftIndent
| 0 | ||||||||||||||||||||||||
311 | scrollX += hbar->minimum(); | - | ||||||||||||||||||||||||
312 | scrollX += hbar->maximum(); | - | ||||||||||||||||||||||||
313 | scrollX -= hbar->value(); | - | ||||||||||||||||||||||||
314 | } never executed: end of block | 0 | ||||||||||||||||||||||||
315 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
316 | scrollX += hbar->value(); | - | ||||||||||||||||||||||||
317 | } never executed: end of block | 0 | ||||||||||||||||||||||||
318 | - | |||||||||||||||||||||||||
319 | scrollY = qint64(vbar->value() - topIndent); | - | ||||||||||||||||||||||||
320 | - | |||||||||||||||||||||||||
321 | dirtyScroll = false; | - | ||||||||||||||||||||||||
322 | } never executed: end of block | 0 | ||||||||||||||||||||||||
323 | - | |||||||||||||||||||||||||
324 | - | |||||||||||||||||||||||||
325 | - | |||||||||||||||||||||||||
326 | - | |||||||||||||||||||||||||
327 | void QGraphicsViewPrivate::replayLastMouseEvent() | - | ||||||||||||||||||||||||
328 | { | - | ||||||||||||||||||||||||
329 | if (!useLastMouseEvent
| 0 | ||||||||||||||||||||||||
330 | return; never executed: return; | 0 | ||||||||||||||||||||||||
331 | mouseMoveEventHandler(&lastMouseEvent); | - | ||||||||||||||||||||||||
332 | } never executed: end of block | 0 | ||||||||||||||||||||||||
333 | - | |||||||||||||||||||||||||
334 | - | |||||||||||||||||||||||||
335 | - | |||||||||||||||||||||||||
336 | - | |||||||||||||||||||||||||
337 | void QGraphicsViewPrivate::storeMouseEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
338 | { | - | ||||||||||||||||||||||||
339 | useLastMouseEvent = true; | - | ||||||||||||||||||||||||
340 | lastMouseEvent = QMouseEvent(QEvent::MouseMove, event->localPos(), event->windowPos(), event->screenPos(), | - | ||||||||||||||||||||||||
341 | event->button(), event->buttons(), event->modifiers()); | - | ||||||||||||||||||||||||
342 | } never executed: end of block | 0 | ||||||||||||||||||||||||
343 | - | |||||||||||||||||||||||||
344 | void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event) | - | ||||||||||||||||||||||||
345 | { | - | ||||||||||||||||||||||||
346 | QGraphicsView * const q = q_func(); | - | ||||||||||||||||||||||||
347 | - | |||||||||||||||||||||||||
348 | - | |||||||||||||||||||||||||
349 | updateRubberBand(event); | - | ||||||||||||||||||||||||
350 | - | |||||||||||||||||||||||||
351 | - | |||||||||||||||||||||||||
352 | storeMouseEvent(event); | - | ||||||||||||||||||||||||
353 | lastMouseEvent.setAccepted(false); | - | ||||||||||||||||||||||||
354 | - | |||||||||||||||||||||||||
355 | if (!sceneInteractionAllowed
| 0 | ||||||||||||||||||||||||
356 | return; never executed: return; | 0 | ||||||||||||||||||||||||
357 | if (handScrolling
| 0 | ||||||||||||||||||||||||
358 | return; never executed: return; | 0 | ||||||||||||||||||||||||
359 | if (!scene
| 0 | ||||||||||||||||||||||||
360 | return; never executed: return; | 0 | ||||||||||||||||||||||||
361 | - | |||||||||||||||||||||||||
362 | QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove); | - | ||||||||||||||||||||||||
363 | mouseEvent.setWidget(viewport); | - | ||||||||||||||||||||||||
364 | mouseEvent.setButtonDownScenePos(mousePressButton, mousePressScenePoint); | - | ||||||||||||||||||||||||
365 | mouseEvent.setButtonDownScreenPos(mousePressButton, mousePressScreenPoint); | - | ||||||||||||||||||||||||
366 | mouseEvent.setScenePos(q->mapToScene(event->pos())); | - | ||||||||||||||||||||||||
367 | mouseEvent.setScreenPos(event->globalPos()); | - | ||||||||||||||||||||||||
368 | mouseEvent.setLastScenePos(lastMouseMoveScenePoint); | - | ||||||||||||||||||||||||
369 | mouseEvent.setLastScreenPos(lastMouseMoveScreenPoint); | - | ||||||||||||||||||||||||
370 | mouseEvent.setButtons(event->buttons()); | - | ||||||||||||||||||||||||
371 | mouseEvent.setButton(event->button()); | - | ||||||||||||||||||||||||
372 | mouseEvent.setModifiers(event->modifiers()); | - | ||||||||||||||||||||||||
373 | mouseEvent.setSource(event->source()); | - | ||||||||||||||||||||||||
374 | mouseEvent.setFlags(event->flags()); | - | ||||||||||||||||||||||||
375 | lastMouseMoveScenePoint = mouseEvent.scenePos(); | - | ||||||||||||||||||||||||
376 | lastMouseMoveScreenPoint = mouseEvent.screenPos(); | - | ||||||||||||||||||||||||
377 | mouseEvent.setAccepted(false); | - | ||||||||||||||||||||||||
378 | if (event->spontaneous()
| 0 | ||||||||||||||||||||||||
379 | qt_sendSpontaneousEvent(scene, &mouseEvent); never executed: qt_sendSpontaneousEvent(scene, &mouseEvent); | 0 | ||||||||||||||||||||||||
380 | else | - | ||||||||||||||||||||||||
381 | QApplication::sendEvent(scene, &mouseEvent); never executed: QApplication::sendEvent(scene, &mouseEvent); | 0 | ||||||||||||||||||||||||
382 | - | |||||||||||||||||||||||||
383 | - | |||||||||||||||||||||||||
384 | lastMouseEvent.setAccepted(mouseEvent.isAccepted()); | - | ||||||||||||||||||||||||
385 | - | |||||||||||||||||||||||||
386 | if (mouseEvent.isAccepted()
| 0 | ||||||||||||||||||||||||
387 | - | |||||||||||||||||||||||||
388 | - | |||||||||||||||||||||||||
389 | return; never executed: return; | 0 | ||||||||||||||||||||||||
390 | } | - | ||||||||||||||||||||||||
391 | - | |||||||||||||||||||||||||
392 | - | |||||||||||||||||||||||||
393 | - | |||||||||||||||||||||||||
394 | - | |||||||||||||||||||||||||
395 | - | |||||||||||||||||||||||||
396 | - | |||||||||||||||||||||||||
397 | if (scene->d_func()->allItemsIgnoreHoverEvents
| 0 | ||||||||||||||||||||||||
398 | && scene->d_func()->cachedItemsUnderMouse.isEmpty()
| 0 | ||||||||||||||||||||||||
399 | scene->d_func()->cachedItemsUnderMouse = scene->d_func()->itemsAtPosition(mouseEvent.screenPos(), | - | ||||||||||||||||||||||||
400 | mouseEvent.scenePos(), | - | ||||||||||||||||||||||||
401 | mouseEvent.widget()); | - | ||||||||||||||||||||||||
402 | } never executed: end of block | 0 | ||||||||||||||||||||||||
403 | - | |||||||||||||||||||||||||
404 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(scene->d_func()->cachedItemsUnderMouse)>::type> _container_((scene->d_func()->cachedItemsUnderMouse)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||
405 | if (item->hasCursor()
| 0 | ||||||||||||||||||||||||
406 | _q_setViewportCursor(item->cursor()); | - | ||||||||||||||||||||||||
407 | return; never executed: return; | 0 | ||||||||||||||||||||||||
408 | } | - | ||||||||||||||||||||||||
409 | } never executed: end of block | 0 | ||||||||||||||||||||||||
410 | - | |||||||||||||||||||||||||
411 | - | |||||||||||||||||||||||||
412 | if (hasStoredOriginalCursor
| 0 | ||||||||||||||||||||||||
413 | - | |||||||||||||||||||||||||
414 | hasStoredOriginalCursor = false; | - | ||||||||||||||||||||||||
415 | viewport->setCursor(originalCursor); | - | ||||||||||||||||||||||||
416 | } never executed: end of block | 0 | ||||||||||||||||||||||||
417 | - | |||||||||||||||||||||||||
418 | } never executed: end of block | 0 | ||||||||||||||||||||||||
419 | - | |||||||||||||||||||||||||
420 | - | |||||||||||||||||||||||||
421 | - | |||||||||||||||||||||||||
422 | - | |||||||||||||||||||||||||
423 | - | |||||||||||||||||||||||||
424 | QRegion QGraphicsViewPrivate::rubberBandRegion(const QWidget *widget, const QRect &rect) const | - | ||||||||||||||||||||||||
425 | { | - | ||||||||||||||||||||||||
426 | QStyleHintReturnMask mask; | - | ||||||||||||||||||||||||
427 | QStyleOptionRubberBand option; | - | ||||||||||||||||||||||||
428 | option.initFrom(widget); | - | ||||||||||||||||||||||||
429 | option.rect = rect; | - | ||||||||||||||||||||||||
430 | option.opaque = false; | - | ||||||||||||||||||||||||
431 | option.shape = QRubberBand::Rectangle; | - | ||||||||||||||||||||||||
432 | - | |||||||||||||||||||||||||
433 | QRegion tmp; | - | ||||||||||||||||||||||||
434 | tmp += rect; | - | ||||||||||||||||||||||||
435 | if (widget->style()->styleHint(QStyle::SH_RubberBand_Mask, &option, widget, &mask)
| 0 | ||||||||||||||||||||||||
436 | tmp &= mask.region; never executed: tmp &= mask.region; | 0 | ||||||||||||||||||||||||
437 | return never executed: tmp;return tmp; never executed: return tmp; | 0 | ||||||||||||||||||||||||
438 | } | - | ||||||||||||||||||||||||
439 | - | |||||||||||||||||||||||||
440 | void QGraphicsViewPrivate::updateRubberBand(const QMouseEvent *event) | - | ||||||||||||||||||||||||
441 | { | - | ||||||||||||||||||||||||
442 | QGraphicsView * const q = q_func(); | - | ||||||||||||||||||||||||
443 | if (dragMode != QGraphicsView::RubberBandDrag
| 0 | ||||||||||||||||||||||||
444 | return; never executed: return; | 0 | ||||||||||||||||||||||||
445 | - | |||||||||||||||||||||||||
446 | if ((
| 0 | ||||||||||||||||||||||||
447 | return; never executed: return; | 0 | ||||||||||||||||||||||||
448 | - | |||||||||||||||||||||||||
449 | - | |||||||||||||||||||||||||
450 | if (viewportUpdateMode != QGraphicsView::NoViewportUpdate
| 0 | ||||||||||||||||||||||||
451 | if (viewportUpdateMode != QGraphicsView::FullViewportUpdate
| 0 | ||||||||||||||||||||||||
452 | q->viewport()->update(rubberBandRegion(q->viewport(), rubberBandRect)); never executed: q->viewport()->update(rubberBandRegion(q->viewport(), rubberBandRect)); | 0 | ||||||||||||||||||||||||
453 | else | - | ||||||||||||||||||||||||
454 | updateAll(); never executed: updateAll(); | 0 | ||||||||||||||||||||||||
455 | } | - | ||||||||||||||||||||||||
456 | - | |||||||||||||||||||||||||
457 | - | |||||||||||||||||||||||||
458 | - | |||||||||||||||||||||||||
459 | if (!event->buttons()
| 0 | ||||||||||||||||||||||||
460 | rubberBanding = false; | - | ||||||||||||||||||||||||
461 | rubberBandSelectionOperation = Qt::ReplaceSelection; | - | ||||||||||||||||||||||||
462 | if (!rubberBandRect.isNull()
| 0 | ||||||||||||||||||||||||
463 | rubberBandRect = QRect(); | - | ||||||||||||||||||||||||
464 | q->rubberBandChanged(rubberBandRect, QPointF(), QPointF()); | - | ||||||||||||||||||||||||
465 | } never executed: end of block | 0 | ||||||||||||||||||||||||
466 | return; never executed: return; | 0 | ||||||||||||||||||||||||
467 | } | - | ||||||||||||||||||||||||
468 | - | |||||||||||||||||||||||||
469 | QRect oldRubberband = rubberBandRect; | - | ||||||||||||||||||||||||
470 | - | |||||||||||||||||||||||||
471 | - | |||||||||||||||||||||||||
472 | const QPoint mp = q->mapFromScene(mousePressScenePoint); | - | ||||||||||||||||||||||||
473 | const QPoint ep = event->pos(); | - | ||||||||||||||||||||||||
474 | rubberBandRect = QRect(qMin(mp.x(), ep.x()), qMin(mp.y(), ep.y()), | - | ||||||||||||||||||||||||
475 | qAbs(mp.x() - ep.x()) + 1, qAbs(mp.y() - ep.y()) + 1); | - | ||||||||||||||||||||||||
476 | - | |||||||||||||||||||||||||
477 | if (rubberBandRect != oldRubberband
| 0 | ||||||||||||||||||||||||
478 | lastRubberbandScenePoint = lastMouseMoveScenePoint; | - | ||||||||||||||||||||||||
479 | oldRubberband = rubberBandRect; | - | ||||||||||||||||||||||||
480 | q->rubberBandChanged(rubberBandRect, mousePressScenePoint, lastRubberbandScenePoint); | - | ||||||||||||||||||||||||
481 | } never executed: end of block | 0 | ||||||||||||||||||||||||
482 | - | |||||||||||||||||||||||||
483 | - | |||||||||||||||||||||||||
484 | if (viewportUpdateMode != QGraphicsView::NoViewportUpdate
| 0 | ||||||||||||||||||||||||
485 | if (viewportUpdateMode != QGraphicsView::FullViewportUpdate
| 0 | ||||||||||||||||||||||||
486 | q->viewport()->update(rubberBandRegion(q->viewport(), rubberBandRect)); never executed: q->viewport()->update(rubberBandRegion(q->viewport(), rubberBandRect)); | 0 | ||||||||||||||||||||||||
487 | else | - | ||||||||||||||||||||||||
488 | updateAll(); never executed: updateAll(); | 0 | ||||||||||||||||||||||||
489 | } | - | ||||||||||||||||||||||||
490 | - | |||||||||||||||||||||||||
491 | QPainterPath selectionArea; | - | ||||||||||||||||||||||||
492 | selectionArea.addPolygon(q->mapToScene(rubberBandRect)); | - | ||||||||||||||||||||||||
493 | selectionArea.closeSubpath(); | - | ||||||||||||||||||||||||
494 | if (scene
| 0 | ||||||||||||||||||||||||
495 | scene->setSelectionArea(selectionArea, rubberBandSelectionOperation, rubberBandSelectionMode, q->viewportTransform()); never executed: scene->setSelectionArea(selectionArea, rubberBandSelectionOperation, rubberBandSelectionMode, q->viewportTransform()); | 0 | ||||||||||||||||||||||||
496 | } never executed: end of block | 0 | ||||||||||||||||||||||||
497 | - | |||||||||||||||||||||||||
498 | - | |||||||||||||||||||||||||
499 | - | |||||||||||||||||||||||||
500 | - | |||||||||||||||||||||||||
501 | - | |||||||||||||||||||||||||
502 | - | |||||||||||||||||||||||||
503 | void QGraphicsViewPrivate::_q_setViewportCursor(const QCursor &cursor) | - | ||||||||||||||||||||||||
504 | { | - | ||||||||||||||||||||||||
505 | if (!hasStoredOriginalCursor
| 0 | ||||||||||||||||||||||||
506 | hasStoredOriginalCursor = true; | - | ||||||||||||||||||||||||
507 | originalCursor = viewport->cursor(); | - | ||||||||||||||||||||||||
508 | } never executed: end of block | 0 | ||||||||||||||||||||||||
509 | viewport->setCursor(cursor); | - | ||||||||||||||||||||||||
510 | } never executed: end of block | 0 | ||||||||||||||||||||||||
511 | - | |||||||||||||||||||||||||
512 | - | |||||||||||||||||||||||||
513 | - | |||||||||||||||||||||||||
514 | - | |||||||||||||||||||||||||
515 | - | |||||||||||||||||||||||||
516 | - | |||||||||||||||||||||||||
517 | void QGraphicsViewPrivate::_q_unsetViewportCursor() | - | ||||||||||||||||||||||||
518 | { | - | ||||||||||||||||||||||||
519 | QGraphicsView * const q = q_func(); | - | ||||||||||||||||||||||||
520 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(q->items(lastMouseEvent.pos()))>::type> _container_((q->items(lastMouseEvent.pos()))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QGraphicsItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||
521 | if (item->hasCursor()
| 0 | ||||||||||||||||||||||||
522 | _q_setViewportCursor(item->cursor()); | - | ||||||||||||||||||||||||
523 | return; never executed: return; | 0 | ||||||||||||||||||||||||
524 | } | - | ||||||||||||||||||||||||
525 | } never executed: end of block | 0 | ||||||||||||||||||||||||
526 | - | |||||||||||||||||||||||||
527 | - | |||||||||||||||||||||||||
528 | if (hasStoredOriginalCursor
| 0 | ||||||||||||||||||||||||
529 | hasStoredOriginalCursor = false; | - | ||||||||||||||||||||||||
530 | if (dragMode == QGraphicsView::ScrollHandDrag
| 0 | ||||||||||||||||||||||||
531 | viewport->setCursor(Qt::OpenHandCursor); never executed: viewport->setCursor(Qt::OpenHandCursor); | 0 | ||||||||||||||||||||||||
532 | else | - | ||||||||||||||||||||||||
533 | viewport->setCursor(originalCursor); never executed: viewport->setCursor(originalCursor); | 0 | ||||||||||||||||||||||||
534 | } | - | ||||||||||||||||||||||||
535 | } never executed: end of block | 0 | ||||||||||||||||||||||||
536 | - | |||||||||||||||||||||||||
537 | - | |||||||||||||||||||||||||
538 | - | |||||||||||||||||||||||||
539 | - | |||||||||||||||||||||||||
540 | - | |||||||||||||||||||||||||
541 | void QGraphicsViewPrivate::storeDragDropEvent(const QGraphicsSceneDragDropEvent *event) | - | ||||||||||||||||||||||||
542 | { | - | ||||||||||||||||||||||||
543 | delete lastDragDropEvent; | - | ||||||||||||||||||||||||
544 | lastDragDropEvent = new QGraphicsSceneDragDropEvent(event->type()); | - | ||||||||||||||||||||||||
545 | lastDragDropEvent->setScenePos(event->scenePos()); | - | ||||||||||||||||||||||||
546 | lastDragDropEvent->setScreenPos(event->screenPos()); | - | ||||||||||||||||||||||||
547 | lastDragDropEvent->setButtons(event->buttons()); | - | ||||||||||||||||||||||||
548 | lastDragDropEvent->setModifiers(event->modifiers()); | - | ||||||||||||||||||||||||
549 | lastDragDropEvent->setPossibleActions(event->possibleActions()); | - | ||||||||||||||||||||||||
550 | lastDragDropEvent->setProposedAction(event->proposedAction()); | - | ||||||||||||||||||||||||
551 | lastDragDropEvent->setDropAction(event->dropAction()); | - | ||||||||||||||||||||||||
552 | lastDragDropEvent->setMimeData(event->mimeData()); | - | ||||||||||||||||||||||||
553 | lastDragDropEvent->setWidget(event->widget()); | - | ||||||||||||||||||||||||
554 | lastDragDropEvent->setSource(event->source()); | - | ||||||||||||||||||||||||
555 | } never executed: end of block | 0 | ||||||||||||||||||||||||
556 | - | |||||||||||||||||||||||||
557 | - | |||||||||||||||||||||||||
558 | - | |||||||||||||||||||||||||
559 | - | |||||||||||||||||||||||||
560 | void QGraphicsViewPrivate::populateSceneDragDropEvent(QGraphicsSceneDragDropEvent *dest, | - | ||||||||||||||||||||||||
561 | QDropEvent *source) | - | ||||||||||||||||||||||||
562 | { | - | ||||||||||||||||||||||||
563 | - | |||||||||||||||||||||||||
564 | QGraphicsView * const q = q_func(); | - | ||||||||||||||||||||||||
565 | dest->setScenePos(q->mapToScene(source->pos())); | - | ||||||||||||||||||||||||
566 | dest->setScreenPos(q->mapToGlobal(source->pos())); | - | ||||||||||||||||||||||||
567 | dest->setButtons(source->mouseButtons()); | - | ||||||||||||||||||||||||
568 | dest->setModifiers(source->keyboardModifiers()); | - | ||||||||||||||||||||||||
569 | dest->setPossibleActions(source->possibleActions()); | - | ||||||||||||||||||||||||
570 | dest->setProposedAction(source->proposedAction()); | - | ||||||||||||||||||||||||
571 | dest->setDropAction(source->dropAction()); | - | ||||||||||||||||||||||||
572 | dest->setMimeData(source->mimeData()); | - | ||||||||||||||||||||||||
573 | dest->setWidget(viewport); | - | ||||||||||||||||||||||||
574 | dest->setSource(qobject_cast<QWidget *>(source->source())); | - | ||||||||||||||||||||||||
575 | - | |||||||||||||||||||||||||
576 | - | |||||||||||||||||||||||||
577 | - | |||||||||||||||||||||||||
578 | - | |||||||||||||||||||||||||
579 | } never executed: end of block | 0 | ||||||||||||||||||||||||
580 | - | |||||||||||||||||||||||||
581 | - | |||||||||||||||||||||||||
582 | - | |||||||||||||||||||||||||
583 | - | |||||||||||||||||||||||||
584 | QRect QGraphicsViewPrivate::mapToViewRect(const QGraphicsItem *item, const QRectF &rect) const | - | ||||||||||||||||||||||||
585 | { | - | ||||||||||||||||||||||||
586 | const QGraphicsView * const q = q_func(); | - | ||||||||||||||||||||||||
587 | if (dirtyScroll
| 0 | ||||||||||||||||||||||||
588 | const_cast< never executed: QGraphicsViewPrivate *>(this)->updateScroll();const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); never executed: const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); | 0 | ||||||||||||||||||||||||
589 | - | |||||||||||||||||||||||||
590 | if (item->d_ptr->itemIsUntransformable()
| 0 | ||||||||||||||||||||||||
591 | QTransform itv = item->deviceTransform(q->viewportTransform()); | - | ||||||||||||||||||||||||
592 | return never executed: itv.mapRect(rect).toAlignedRect();return itv.mapRect(rect).toAlignedRect(); never executed: return itv.mapRect(rect).toAlignedRect(); | 0 | ||||||||||||||||||||||||
593 | } | - | ||||||||||||||||||||||||
594 | - | |||||||||||||||||||||||||
595 | - | |||||||||||||||||||||||||
596 | - | |||||||||||||||||||||||||
597 | QPointF offset; | - | ||||||||||||||||||||||||
598 | const QGraphicsItem *parentItem = item; | - | ||||||||||||||||||||||||
599 | const QGraphicsItemPrivate *itemd; | - | ||||||||||||||||||||||||
600 | do { | - | ||||||||||||||||||||||||
601 | itemd = parentItem->d_ptr.data(); | - | ||||||||||||||||||||||||
602 | if (itemd->transformData
| 0 | ||||||||||||||||||||||||
603 | break; never executed: break; | 0 | ||||||||||||||||||||||||
604 | offset += itemd->pos; | - | ||||||||||||||||||||||||
605 | } never executed: while ((end of block
| 0 | ||||||||||||||||||||||||
606 | - | |||||||||||||||||||||||||
607 | QRectF baseRect = rect.translated(offset.x(), offset.y()); | - | ||||||||||||||||||||||||
608 | if (!parentItem
| 0 | ||||||||||||||||||||||||
609 | if (identityMatrix
| 0 | ||||||||||||||||||||||||
610 | baseRect.translate(-scrollX, -scrollY); | - | ||||||||||||||||||||||||
611 | return never executed: baseRect.toAlignedRect();return baseRect.toAlignedRect(); never executed: return baseRect.toAlignedRect(); | 0 | ||||||||||||||||||||||||
612 | } | - | ||||||||||||||||||||||||
613 | return never executed: matrix.mapRect(baseRect).translated(-scrollX, -scrollY).toAlignedRect();return matrix.mapRect(baseRect).translated(-scrollX, -scrollY).toAlignedRect(); never executed: return matrix.mapRect(baseRect).translated(-scrollX, -scrollY).toAlignedRect(); | 0 | ||||||||||||||||||||||||
614 | } | - | ||||||||||||||||||||||||
615 | - | |||||||||||||||||||||||||
616 | QTransform tr = parentItem->sceneTransform(); | - | ||||||||||||||||||||||||
617 | if (!identityMatrix
| 0 | ||||||||||||||||||||||||
618 | tr *= matrix; never executed: tr *= matrix; | 0 | ||||||||||||||||||||||||
619 | QRectF r = tr.mapRect(baseRect); | - | ||||||||||||||||||||||||
620 | r.translate(-scrollX, -scrollY); | - | ||||||||||||||||||||||||
621 | return never executed: r.toAlignedRect();return r.toAlignedRect(); never executed: return r.toAlignedRect(); | 0 | ||||||||||||||||||||||||
622 | } | - | ||||||||||||||||||||||||
623 | - | |||||||||||||||||||||||||
624 | - | |||||||||||||||||||||||||
625 | - | |||||||||||||||||||||||||
626 | - | |||||||||||||||||||||||||
627 | QRegion QGraphicsViewPrivate::mapToViewRegion(const QGraphicsItem *item, const QRectF &rect) const | - | ||||||||||||||||||||||||
628 | { | - | ||||||||||||||||||||||||
629 | const QGraphicsView * const q = q_func(); | - | ||||||||||||||||||||||||
630 | if (dirtyScroll
| 0 | ||||||||||||||||||||||||
631 | const_cast< never executed: QGraphicsViewPrivate *>(this)->updateScroll();const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); never executed: const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); | 0 | ||||||||||||||||||||||||
632 | - | |||||||||||||||||||||||||
633 | - | |||||||||||||||||||||||||
634 | QTransform itv = item->deviceTransform(q->viewportTransform()); | - | ||||||||||||||||||||||||
635 | return never executed: item->boundingRegion(itv) & itv.mapRect(rect).toAlignedRect();return item->boundingRegion(itv) & itv.mapRect(rect).toAlignedRect(); never executed: return item->boundingRegion(itv) & itv.mapRect(rect).toAlignedRect(); | 0 | ||||||||||||||||||||||||
636 | } | - | ||||||||||||||||||||||||
637 | - | |||||||||||||||||||||||||
638 | - | |||||||||||||||||||||||||
639 | - | |||||||||||||||||||||||||
640 | - | |||||||||||||||||||||||||
641 | void QGraphicsViewPrivate::processPendingUpdates() | - | ||||||||||||||||||||||||
642 | { | - | ||||||||||||||||||||||||
643 | if (!scene
| 0 | ||||||||||||||||||||||||
644 | return; never executed: return; | 0 | ||||||||||||||||||||||||
645 | - | |||||||||||||||||||||||||
646 | if (fullUpdatePending
| 0 | ||||||||||||||||||||||||
647 | viewport->update(); | - | ||||||||||||||||||||||||
648 | } never executed: else if (viewportUpdateMode == QGraphicsView::BoundingRectViewportUpdateend of block
| 0 | ||||||||||||||||||||||||
649 | viewport->update(dirtyBoundingRect); | - | ||||||||||||||||||||||||
650 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
651 | viewport->update(dirtyRegion); | - | ||||||||||||||||||||||||
652 | } never executed: end of block | 0 | ||||||||||||||||||||||||
653 | - | |||||||||||||||||||||||||
654 | dirtyBoundingRect = QRect(); | - | ||||||||||||||||||||||||
655 | dirtyRegion = QRegion(); | - | ||||||||||||||||||||||||
656 | } never executed: end of block | 0 | ||||||||||||||||||||||||
657 | - | |||||||||||||||||||||||||
658 | static inline bool intersectsViewport(const QRect &r, int width, int height) | - | ||||||||||||||||||||||||
659 | { return never executed: !(r.left() > width)return !(r.left() > width) && !(r.right() < 0) && !(r.top() >= height) && !(r.bottom() < 0);
never executed: }return !(r.left() > width) && !(r.right() < 0) && !(r.top() >= height) && !(r.bottom() < 0); | 0 | ||||||||||||||||||||||||
660 | - | |||||||||||||||||||||||||
661 | static inline bool containsViewport(const QRect &r, int width, int height) | - | ||||||||||||||||||||||||
662 | { return never executed: r.left() <= 0return r.left() <= 0 && r.top() <= 0 && r.right() >= width - 1 && r.bottom() >= height - 1;
never executed: }return r.left() <= 0 && r.top() <= 0 && r.right() >= width - 1 && r.bottom() >= height - 1; | 0 | ||||||||||||||||||||||||
663 | - | |||||||||||||||||||||||||
664 | static inline void QRect_unite(QRect *rect, const QRect &other) | - | ||||||||||||||||||||||||
665 | { | - | ||||||||||||||||||||||||
666 | if (rect->isEmpty()
| 0 | ||||||||||||||||||||||||
667 | *rect = other; | - | ||||||||||||||||||||||||
668 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
669 | rect->setCoords(qMin(rect->left(), other.left()), qMin(rect->top(), other.top()), | - | ||||||||||||||||||||||||
670 | qMax(rect->right(), other.right()), qMax(rect->bottom(), other.bottom())); | - | ||||||||||||||||||||||||
671 | } never executed: end of block | 0 | ||||||||||||||||||||||||
672 | } | - | ||||||||||||||||||||||||
673 | - | |||||||||||||||||||||||||
674 | - | |||||||||||||||||||||||||
675 | - | |||||||||||||||||||||||||
676 | - | |||||||||||||||||||||||||
677 | - | |||||||||||||||||||||||||
678 | - | |||||||||||||||||||||||||
679 | void QGraphicsViewPrivate::setUpdateClip(QGraphicsItem *item) | - | ||||||||||||||||||||||||
680 | { | - | ||||||||||||||||||||||||
681 | QGraphicsView * const q = q_func(); | - | ||||||||||||||||||||||||
682 | - | |||||||||||||||||||||||||
683 | - | |||||||||||||||||||||||||
684 | if (!item
| 0 | ||||||||||||||||||||||||
685 | || viewportUpdateMode == QGraphicsView::FullViewportUpdate
| 0 | ||||||||||||||||||||||||
686 | hasUpdateClip = false; | - | ||||||||||||||||||||||||
687 | return; never executed: return; | 0 | ||||||||||||||||||||||||
688 | } | - | ||||||||||||||||||||||||
689 | - | |||||||||||||||||||||||||
690 | - | |||||||||||||||||||||||||
691 | - | |||||||||||||||||||||||||
692 | - | |||||||||||||||||||||||||
693 | - | |||||||||||||||||||||||||
694 | QRect clip; | - | ||||||||||||||||||||||||
695 | if (item->d_ptr->itemIsUntransformable()
| 0 | ||||||||||||||||||||||||
696 | QTransform xform = item->deviceTransform(q->viewportTransform()); | - | ||||||||||||||||||||||||
697 | clip = xform.mapRect(item->boundingRect()).toAlignedRect(); | - | ||||||||||||||||||||||||
698 | } never executed: else if (item->d_ptr->sceneTransformTranslateOnlyend of block
| 0 | ||||||||||||||||||||||||
699 | QRectF r(item->boundingRect()); | - | ||||||||||||||||||||||||
700 | r.translate(item->d_ptr->sceneTransform.dx() - horizontalScroll(), | - | ||||||||||||||||||||||||
701 | item->d_ptr->sceneTransform.dy() - verticalScroll()); | - | ||||||||||||||||||||||||
702 | clip = r.toAlignedRect(); | - | ||||||||||||||||||||||||
703 | } never executed: else if (!q->isTransformed()end of block
| 0 | ||||||||||||||||||||||||
704 | clip = item->d_ptr->sceneTransform.mapRect(item->boundingRect()).toAlignedRect(); | - | ||||||||||||||||||||||||
705 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
706 | QTransform xform = item->d_ptr->sceneTransform; | - | ||||||||||||||||||||||||
707 | xform *= q->viewportTransform(); | - | ||||||||||||||||||||||||
708 | clip = xform.mapRect(item->boundingRect()).toAlignedRect(); | - | ||||||||||||||||||||||||
709 | } never executed: end of block | 0 | ||||||||||||||||||||||||
710 | - | |||||||||||||||||||||||||
711 | if (hasUpdateClip
| 0 | ||||||||||||||||||||||||
712 | - | |||||||||||||||||||||||||
713 | updateClip &= clip; | - | ||||||||||||||||||||||||
714 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
715 | updateClip = clip; | - | ||||||||||||||||||||||||
716 | hasUpdateClip = true; | - | ||||||||||||||||||||||||
717 | } never executed: end of block | 0 | ||||||||||||||||||||||||
718 | } | - | ||||||||||||||||||||||||
719 | - | |||||||||||||||||||||||||
720 | bool QGraphicsViewPrivate::updateRegion(const QRectF &rect, const QTransform &xform) | - | ||||||||||||||||||||||||
721 | { | - | ||||||||||||||||||||||||
722 | if (rect.isEmpty()
| 0 | ||||||||||||||||||||||||
723 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
724 | - | |||||||||||||||||||||||||
725 | if (viewportUpdateMode != QGraphicsView::MinimalViewportUpdate
| 0 | ||||||||||||||||||||||||
726 | && viewportUpdateMode != QGraphicsView::SmartViewportUpdate
| 0 | ||||||||||||||||||||||||
727 | - | |||||||||||||||||||||||||
728 | return never executed: updateRectF(xform.mapRect(rect));return updateRectF(xform.mapRect(rect)); never executed: return updateRectF(xform.mapRect(rect)); | 0 | ||||||||||||||||||||||||
729 | } | - | ||||||||||||||||||||||||
730 | - | |||||||||||||||||||||||||
731 | - | |||||||||||||||||||||||||
732 | - | |||||||||||||||||||||||||
733 | const QRegion region = xform.map(QRegion(rect.toAlignedRect())); | - | ||||||||||||||||||||||||
734 | QRect viewRect = region.boundingRect(); | - | ||||||||||||||||||||||||
735 | const bool dontAdjustForAntialiasing = optimizationFlags & QGraphicsView::DontAdjustForAntialiasing; | - | ||||||||||||||||||||||||
736 | if (dontAdjustForAntialiasing
| 0 | ||||||||||||||||||||||||
737 | viewRect.adjust(-1, -1, 1, 1); never executed: viewRect.adjust(-1, -1, 1, 1); | 0 | ||||||||||||||||||||||||
738 | else | - | ||||||||||||||||||||||||
739 | viewRect.adjust(-2, -2, 2, 2); never executed: viewRect.adjust(-2, -2, 2, 2); | 0 | ||||||||||||||||||||||||
740 | if (!intersectsViewport(viewRect, viewport->width(), viewport->height())
| 0 | ||||||||||||||||||||||||
741 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
742 | - | |||||||||||||||||||||||||
743 | const QVector<QRect> &rects = region.rects(); | - | ||||||||||||||||||||||||
744 | for (int i = 0; i < rects.size()
| 0 | ||||||||||||||||||||||||
745 | viewRect = rects.at(i); | - | ||||||||||||||||||||||||
746 | if (dontAdjustForAntialiasing
| 0 | ||||||||||||||||||||||||
747 | viewRect.adjust(-1, -1, 1, 1); never executed: viewRect.adjust(-1, -1, 1, 1); | 0 | ||||||||||||||||||||||||
748 | else | - | ||||||||||||||||||||||||
749 | viewRect.adjust(-2, -2, 2, 2); never executed: viewRect.adjust(-2, -2, 2, 2); | 0 | ||||||||||||||||||||||||
750 | if (hasUpdateClip
| 0 | ||||||||||||||||||||||||
751 | viewRect &= updateClip; never executed: viewRect &= updateClip; | 0 | ||||||||||||||||||||||||
752 | dirtyRegion += viewRect; | - | ||||||||||||||||||||||||
753 | } never executed: end of block | 0 | ||||||||||||||||||||||||
754 | - | |||||||||||||||||||||||||
755 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
756 | } | - | ||||||||||||||||||||||||
757 | - | |||||||||||||||||||||||||
758 | - | |||||||||||||||||||||||||
759 | - | |||||||||||||||||||||||||
760 | bool QGraphicsViewPrivate::updateRect(const QRect &r) | - | ||||||||||||||||||||||||
761 | { | - | ||||||||||||||||||||||||
762 | if (fullUpdatePending
| 0 | ||||||||||||||||||||||||
763 | || !intersectsViewport(r, viewport->width(), viewport->height())
| 0 | ||||||||||||||||||||||||
764 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
765 | } | - | ||||||||||||||||||||||||
766 | - | |||||||||||||||||||||||||
767 | switch (viewportUpdateMode) { | - | ||||||||||||||||||||||||
768 | case never executed: QGraphicsView::FullViewportUpdate:case QGraphicsView::FullViewportUpdate: never executed: case QGraphicsView::FullViewportUpdate: | 0 | ||||||||||||||||||||||||
769 | fullUpdatePending = true; | - | ||||||||||||||||||||||||
770 | viewport->update(); | - | ||||||||||||||||||||||||
771 | break; never executed: break; | 0 | ||||||||||||||||||||||||
772 | case never executed: QGraphicsView::BoundingRectViewportUpdate:case QGraphicsView::BoundingRectViewportUpdate: never executed: case QGraphicsView::BoundingRectViewportUpdate: | 0 | ||||||||||||||||||||||||
773 | if (hasUpdateClip
| 0 | ||||||||||||||||||||||||
774 | QRect_unite(&dirtyBoundingRect, r & updateClip); never executed: QRect_unite(&dirtyBoundingRect, r & updateClip); | 0 | ||||||||||||||||||||||||
775 | else | - | ||||||||||||||||||||||||
776 | QRect_unite(&dirtyBoundingRect, r); never executed: QRect_unite(&dirtyBoundingRect, r); | 0 | ||||||||||||||||||||||||
777 | if (containsViewport(dirtyBoundingRect, viewport->width(), viewport->height())
| 0 | ||||||||||||||||||||||||
778 | fullUpdatePending = true; | - | ||||||||||||||||||||||||
779 | viewport->update(); | - | ||||||||||||||||||||||||
780 | } never executed: end of block | 0 | ||||||||||||||||||||||||
781 | break; never executed: break; | 0 | ||||||||||||||||||||||||
782 | case never executed: QGraphicsView::SmartViewportUpdate:case QGraphicsView::SmartViewportUpdate: never executed: case QGraphicsView::SmartViewportUpdate: | 0 | ||||||||||||||||||||||||
783 | case never executed: QGraphicsView::MinimalViewportUpdate:case QGraphicsView::MinimalViewportUpdate: never executed: case QGraphicsView::MinimalViewportUpdate: | 0 | ||||||||||||||||||||||||
784 | if (hasUpdateClip
| 0 | ||||||||||||||||||||||||
785 | dirtyRegion += r & updateClip; never executed: dirtyRegion += r & updateClip; | 0 | ||||||||||||||||||||||||
786 | else | - | ||||||||||||||||||||||||
787 | dirtyRegion += r; never executed: dirtyRegion += r; | 0 | ||||||||||||||||||||||||
788 | break; never executed: break; | 0 | ||||||||||||||||||||||||
789 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
790 | break; never executed: break; | 0 | ||||||||||||||||||||||||
791 | } | - | ||||||||||||||||||||||||
792 | - | |||||||||||||||||||||||||
793 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
794 | } | - | ||||||||||||||||||||||||
795 | - | |||||||||||||||||||||||||
796 | QStyleOptionGraphicsItem *QGraphicsViewPrivate::allocStyleOptionsArray(int numItems) | - | ||||||||||||||||||||||||
797 | { | - | ||||||||||||||||||||||||
798 | if (mustAllocateStyleOptions
| 0 | ||||||||||||||||||||||||
799 | - | |||||||||||||||||||||||||
800 | return never executed: new QStyleOptionGraphicsItem[numItems];return new QStyleOptionGraphicsItem[numItems]; never executed: return new QStyleOptionGraphicsItem[numItems]; | 0 | ||||||||||||||||||||||||
801 | - | |||||||||||||||||||||||||
802 | - | |||||||||||||||||||||||||
803 | if (numItems > styleOptions.size()
| 0 | ||||||||||||||||||||||||
804 | styleOptions.resize(numItems); never executed: styleOptions.resize(numItems); | 0 | ||||||||||||||||||||||||
805 | - | |||||||||||||||||||||||||
806 | mustAllocateStyleOptions = true; | - | ||||||||||||||||||||||||
807 | return never executed: styleOptions.data();return styleOptions.data(); never executed: return styleOptions.data(); | 0 | ||||||||||||||||||||||||
808 | } | - | ||||||||||||||||||||||||
809 | - | |||||||||||||||||||||||||
810 | void QGraphicsViewPrivate::freeStyleOptionsArray(QStyleOptionGraphicsItem *array) | - | ||||||||||||||||||||||||
811 | { | - | ||||||||||||||||||||||||
812 | mustAllocateStyleOptions = false; | - | ||||||||||||||||||||||||
813 | if (array != styleOptions.data()
| 0 | ||||||||||||||||||||||||
814 | delete [] array; never executed: delete [] array; | 0 | ||||||||||||||||||||||||
815 | } never executed: end of block | 0 | ||||||||||||||||||||||||
816 | - | |||||||||||||||||||||||||
817 | extern QPainterPath qt_regionToPath(const QRegion ®ion); | - | ||||||||||||||||||||||||
818 | QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedRegion, bool *allItems, | - | ||||||||||||||||||||||||
819 | const QTransform &viewTransform) const | - | ||||||||||||||||||||||||
820 | { | - | ||||||||||||||||||||||||
821 | const QGraphicsView * const q = q_func(); | - | ||||||||||||||||||||||||
822 | - | |||||||||||||||||||||||||
823 | - | |||||||||||||||||||||||||
824 | - | |||||||||||||||||||||||||
825 | - | |||||||||||||||||||||||||
826 | const QRectF exposedRegionSceneBounds = q->mapToScene(exposedRegion.boundingRect().adjusted(-1, -1, 1, 1)) | - | ||||||||||||||||||||||||
827 | .boundingRect(); | - | ||||||||||||||||||||||||
828 | if (exposedRegionSceneBounds.contains(scene->sceneRect())
| 0 | ||||||||||||||||||||||||
829 | ((!(allItems)) ? qt_assert("allItems",__FILE__,1121) : qt_noop()); | - | ||||||||||||||||||||||||
830 | *allItems = true; | - | ||||||||||||||||||||||||
831 | - | |||||||||||||||||||||||||
832 | - | |||||||||||||||||||||||||
833 | return never executed: scene->items(Qt::AscendingOrder);return scene->items(Qt::AscendingOrder); never executed: return scene->items(Qt::AscendingOrder); | 0 | ||||||||||||||||||||||||
834 | } | - | ||||||||||||||||||||||||
835 | - | |||||||||||||||||||||||||
836 | - | |||||||||||||||||||||||||
837 | - | |||||||||||||||||||||||||
838 | - | |||||||||||||||||||||||||
839 | bool simpleRectLookup = exposedRegion.rectCount() == 1
| 0 | ||||||||||||||||||||||||
840 | if (simpleRectLookup
| 0 | ||||||||||||||||||||||||
841 | return never executed: scene->items(exposedRegionSceneBounds,return scene->items(exposedRegionSceneBounds, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, viewTransform); never executed: return scene->items(exposedRegionSceneBounds, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, viewTransform); | 0 | ||||||||||||||||||||||||
842 | Qt::IntersectsItemBoundingRect, never executed: return scene->items(exposedRegionSceneBounds, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, viewTransform); | 0 | ||||||||||||||||||||||||
843 | Qt::AscendingOrder, viewTransform); never executed: return scene->items(exposedRegionSceneBounds, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, viewTransform); | 0 | ||||||||||||||||||||||||
844 | } | - | ||||||||||||||||||||||||
845 | - | |||||||||||||||||||||||||
846 | - | |||||||||||||||||||||||||
847 | - | |||||||||||||||||||||||||
848 | - | |||||||||||||||||||||||||
849 | QRegion adjustedRegion; | - | ||||||||||||||||||||||||
850 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(exposedRegion.rects())>::type> _container_((exposedRegion.rects())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QRect &r = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||
851 | adjustedRegion += r.adjusted(-1, -1, 1, 1); never executed: adjustedRegion += r.adjusted(-1, -1, 1, 1); | 0 | ||||||||||||||||||||||||
852 | - | |||||||||||||||||||||||||
853 | const QPainterPath exposedScenePath(q->mapToScene(qt_regionToPath(adjustedRegion))); | - | ||||||||||||||||||||||||
854 | return never executed: scene->items(exposedScenePath, Qt::IntersectsItemBoundingRect,return scene->items(exposedScenePath, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, viewTransform); never executed: return scene->items(exposedScenePath, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, viewTransform); | 0 | ||||||||||||||||||||||||
855 | Qt::AscendingOrder, viewTransform); never executed: return scene->items(exposedScenePath, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, viewTransform); | 0 | ||||||||||||||||||||||||
856 | } | - | ||||||||||||||||||||||||
857 | void QGraphicsViewPrivate::updateInputMethodSensitivity() | - | ||||||||||||||||||||||||
858 | { | - | ||||||||||||||||||||||||
859 | QGraphicsView * const q = q_func(); | - | ||||||||||||||||||||||||
860 | QGraphicsItem *focusItem = 0; | - | ||||||||||||||||||||||||
861 | bool enabled = scene
| 0 | ||||||||||||||||||||||||
862 | && (
| 0 | ||||||||||||||||||||||||
863 | q->setAttribute(Qt::WA_InputMethodEnabled, enabled); | - | ||||||||||||||||||||||||
864 | q->viewport()->setAttribute(Qt::WA_InputMethodEnabled, enabled); | - | ||||||||||||||||||||||||
865 | - | |||||||||||||||||||||||||
866 | if (!enabled
| 0 | ||||||||||||||||||||||||
867 | q->setInputMethodHints(0); | - | ||||||||||||||||||||||||
868 | return; never executed: return; | 0 | ||||||||||||||||||||||||
869 | } | - | ||||||||||||||||||||||||
870 | - | |||||||||||||||||||||||||
871 | QGraphicsProxyWidget *proxy = focusItem->d_ptr->isWidget
| 0 | ||||||||||||||||||||||||
872 | ? static_cast<QGraphicsProxyWidget *>(focusItem) : 0; | - | ||||||||||||||||||||||||
873 | if (!proxy
| 0 | ||||||||||||||||||||||||
874 | q->setInputMethodHints(focusItem->inputMethodHints()); | - | ||||||||||||||||||||||||
875 | } never executed: else if (QWidget *widget = proxy->widget()end of block
| 0 | ||||||||||||||||||||||||
876 | if (QWidget *fw = widget->focusWidget()
| 0 | ||||||||||||||||||||||||
877 | widget = fw; never executed: widget = fw; | 0 | ||||||||||||||||||||||||
878 | q->setInputMethodHints(widget->inputMethodHints()); | - | ||||||||||||||||||||||||
879 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
880 | q->setInputMethodHints(0); | - | ||||||||||||||||||||||||
881 | } never executed: end of block | 0 | ||||||||||||||||||||||||
882 | } | - | ||||||||||||||||||||||||
883 | - | |||||||||||||||||||||||||
884 | - | |||||||||||||||||||||||||
885 | - | |||||||||||||||||||||||||
886 | - | |||||||||||||||||||||||||
887 | QGraphicsView::QGraphicsView(QWidget *parent) | - | ||||||||||||||||||||||||
888 | : QAbstractScrollArea(*new QGraphicsViewPrivate, parent) | - | ||||||||||||||||||||||||
889 | { | - | ||||||||||||||||||||||||
890 | setViewport(0); | - | ||||||||||||||||||||||||
891 | setAcceptDrops(true); | - | ||||||||||||||||||||||||
892 | setBackgroundRole(QPalette::Base); | - | ||||||||||||||||||||||||
893 | - | |||||||||||||||||||||||||
894 | setAttribute(Qt::WA_InputMethodEnabled); | - | ||||||||||||||||||||||||
895 | viewport()->setAttribute(Qt::WA_InputMethodEnabled); | - | ||||||||||||||||||||||||
896 | } never executed: end of block | 0 | ||||||||||||||||||||||||
897 | - | |||||||||||||||||||||||||
898 | - | |||||||||||||||||||||||||
899 | - | |||||||||||||||||||||||||
900 | - | |||||||||||||||||||||||||
901 | - | |||||||||||||||||||||||||
902 | QGraphicsView::QGraphicsView(QGraphicsScene *scene, QWidget *parent) | - | ||||||||||||||||||||||||
903 | : QAbstractScrollArea(*new QGraphicsViewPrivate, parent) | - | ||||||||||||||||||||||||
904 | { | - | ||||||||||||||||||||||||
905 | setScene(scene); | - | ||||||||||||||||||||||||
906 | setViewport(0); | - | ||||||||||||||||||||||||
907 | setAcceptDrops(true); | - | ||||||||||||||||||||||||
908 | setBackgroundRole(QPalette::Base); | - | ||||||||||||||||||||||||
909 | - | |||||||||||||||||||||||||
910 | setAttribute(Qt::WA_InputMethodEnabled); | - | ||||||||||||||||||||||||
911 | viewport()->setAttribute(Qt::WA_InputMethodEnabled); | - | ||||||||||||||||||||||||
912 | } never executed: end of block | 0 | ||||||||||||||||||||||||
913 | - | |||||||||||||||||||||||||
914 | - | |||||||||||||||||||||||||
915 | - | |||||||||||||||||||||||||
916 | - | |||||||||||||||||||||||||
917 | QGraphicsView::QGraphicsView(QGraphicsViewPrivate &dd, QWidget *parent) | - | ||||||||||||||||||||||||
918 | : QAbstractScrollArea(dd, parent) | - | ||||||||||||||||||||||||
919 | { | - | ||||||||||||||||||||||||
920 | setViewport(0); | - | ||||||||||||||||||||||||
921 | setAcceptDrops(true); | - | ||||||||||||||||||||||||
922 | setBackgroundRole(QPalette::Base); | - | ||||||||||||||||||||||||
923 | - | |||||||||||||||||||||||||
924 | setAttribute(Qt::WA_InputMethodEnabled); | - | ||||||||||||||||||||||||
925 | viewport()->setAttribute(Qt::WA_InputMethodEnabled); | - | ||||||||||||||||||||||||
926 | } never executed: end of block | 0 | ||||||||||||||||||||||||
927 | - | |||||||||||||||||||||||||
928 | - | |||||||||||||||||||||||||
929 | - | |||||||||||||||||||||||||
930 | - | |||||||||||||||||||||||||
931 | QGraphicsView::~QGraphicsView() | - | ||||||||||||||||||||||||
932 | { | - | ||||||||||||||||||||||||
933 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
934 | if (d->scene
| 0 | ||||||||||||||||||||||||
935 | d->scene->d_func()->views.removeAll(this); never executed: d->scene->d_func()->views.removeAll(this); | 0 | ||||||||||||||||||||||||
936 | delete d->lastDragDropEvent; | - | ||||||||||||||||||||||||
937 | } never executed: end of block | 0 | ||||||||||||||||||||||||
938 | - | |||||||||||||||||||||||||
939 | - | |||||||||||||||||||||||||
940 | - | |||||||||||||||||||||||||
941 | - | |||||||||||||||||||||||||
942 | QSize QGraphicsView::sizeHint() const | - | ||||||||||||||||||||||||
943 | { | - | ||||||||||||||||||||||||
944 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
945 | if (d->scene
| 0 | ||||||||||||||||||||||||
946 | QSizeF baseSize = d->matrix.mapRect(sceneRect()).size(); | - | ||||||||||||||||||||||||
947 | baseSize += QSizeF(d->frameWidth * 2, d->frameWidth * 2); | - | ||||||||||||||||||||||||
948 | return never executed: baseSize.boundedTo((3 * QApplication::desktop()->size()) / 4).toSize();return baseSize.boundedTo((3 * QApplication::desktop()->size()) / 4).toSize(); never executed: return baseSize.boundedTo((3 * QApplication::desktop()->size()) / 4).toSize(); | 0 | ||||||||||||||||||||||||
949 | } | - | ||||||||||||||||||||||||
950 | return never executed: QAbstractScrollArea::sizeHint();return QAbstractScrollArea::sizeHint(); never executed: return QAbstractScrollArea::sizeHint(); | 0 | ||||||||||||||||||||||||
951 | } | - | ||||||||||||||||||||||||
952 | QPainter::RenderHints QGraphicsView::renderHints() const | - | ||||||||||||||||||||||||
953 | { | - | ||||||||||||||||||||||||
954 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
955 | return never executed: d->renderHints;return d->renderHints; never executed: return d->renderHints; | 0 | ||||||||||||||||||||||||
956 | } | - | ||||||||||||||||||||||||
957 | void QGraphicsView::setRenderHints(QPainter::RenderHints hints) | - | ||||||||||||||||||||||||
958 | { | - | ||||||||||||||||||||||||
959 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
960 | if (hints == d->renderHints
| 0 | ||||||||||||||||||||||||
961 | return; never executed: return; | 0 | ||||||||||||||||||||||||
962 | d->renderHints = hints; | - | ||||||||||||||||||||||||
963 | d->updateAll(); | - | ||||||||||||||||||||||||
964 | } never executed: end of block | 0 | ||||||||||||||||||||||||
965 | - | |||||||||||||||||||||||||
966 | - | |||||||||||||||||||||||||
967 | - | |||||||||||||||||||||||||
968 | - | |||||||||||||||||||||||||
969 | - | |||||||||||||||||||||||||
970 | - | |||||||||||||||||||||||||
971 | - | |||||||||||||||||||||||||
972 | void QGraphicsView::setRenderHint(QPainter::RenderHint hint, bool enabled) | - | ||||||||||||||||||||||||
973 | { | - | ||||||||||||||||||||||||
974 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
975 | QPainter::RenderHints oldHints = d->renderHints; | - | ||||||||||||||||||||||||
976 | if (enabled
| 0 | ||||||||||||||||||||||||
977 | d->renderHints |= hint; never executed: d->renderHints |= hint; | 0 | ||||||||||||||||||||||||
978 | else | - | ||||||||||||||||||||||||
979 | d->renderHints &= ~hint; never executed: d->renderHints &= ~hint; | 0 | ||||||||||||||||||||||||
980 | if (oldHints != d->renderHints
| 0 | ||||||||||||||||||||||||
981 | d->updateAll(); never executed: d->updateAll(); | 0 | ||||||||||||||||||||||||
982 | } never executed: end of block | 0 | ||||||||||||||||||||||||
983 | Qt::Alignment QGraphicsView::alignment() const | - | ||||||||||||||||||||||||
984 | { | - | ||||||||||||||||||||||||
985 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
986 | return never executed: d->alignment;return d->alignment; never executed: return d->alignment; | 0 | ||||||||||||||||||||||||
987 | } | - | ||||||||||||||||||||||||
988 | void QGraphicsView::setAlignment(Qt::Alignment alignment) | - | ||||||||||||||||||||||||
989 | { | - | ||||||||||||||||||||||||
990 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
991 | if (d->alignment != alignment
| 0 | ||||||||||||||||||||||||
992 | d->alignment = alignment; | - | ||||||||||||||||||||||||
993 | d->recalculateContentSize(); | - | ||||||||||||||||||||||||
994 | } never executed: end of block | 0 | ||||||||||||||||||||||||
995 | } never executed: end of block | 0 | ||||||||||||||||||||||||
996 | QGraphicsView::ViewportAnchor QGraphicsView::transformationAnchor() const | - | ||||||||||||||||||||||||
997 | { | - | ||||||||||||||||||||||||
998 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
999 | return never executed: d->transformationAnchor;return d->transformationAnchor; never executed: return d->transformationAnchor; | 0 | ||||||||||||||||||||||||
1000 | } | - | ||||||||||||||||||||||||
1001 | void QGraphicsView::setTransformationAnchor(ViewportAnchor anchor) | - | ||||||||||||||||||||||||
1002 | { | - | ||||||||||||||||||||||||
1003 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1004 | d->transformationAnchor = anchor; | - | ||||||||||||||||||||||||
1005 | - | |||||||||||||||||||||||||
1006 | - | |||||||||||||||||||||||||
1007 | - | |||||||||||||||||||||||||
1008 | if (d->transformationAnchor == AnchorUnderMouse
| 0 | ||||||||||||||||||||||||
1009 | d->viewport->setMouseTracking(true); never executed: d->viewport->setMouseTracking(true); | 0 | ||||||||||||||||||||||||
1010 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1011 | QGraphicsView::ViewportAnchor QGraphicsView::resizeAnchor() const | - | ||||||||||||||||||||||||
1012 | { | - | ||||||||||||||||||||||||
1013 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1014 | return never executed: d->resizeAnchor;return d->resizeAnchor; never executed: return d->resizeAnchor; | 0 | ||||||||||||||||||||||||
1015 | } | - | ||||||||||||||||||||||||
1016 | void QGraphicsView::setResizeAnchor(ViewportAnchor anchor) | - | ||||||||||||||||||||||||
1017 | { | - | ||||||||||||||||||||||||
1018 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1019 | d->resizeAnchor = anchor; | - | ||||||||||||||||||||||||
1020 | - | |||||||||||||||||||||||||
1021 | - | |||||||||||||||||||||||||
1022 | - | |||||||||||||||||||||||||
1023 | if (d->resizeAnchor == AnchorUnderMouse
| 0 | ||||||||||||||||||||||||
1024 | d->viewport->setMouseTracking(true); never executed: d->viewport->setMouseTracking(true); | 0 | ||||||||||||||||||||||||
1025 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1026 | QGraphicsView::ViewportUpdateMode QGraphicsView::viewportUpdateMode() const | - | ||||||||||||||||||||||||
1027 | { | - | ||||||||||||||||||||||||
1028 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1029 | return never executed: d->viewportUpdateMode;return d->viewportUpdateMode; never executed: return d->viewportUpdateMode; | 0 | ||||||||||||||||||||||||
1030 | } | - | ||||||||||||||||||||||||
1031 | void QGraphicsView::setViewportUpdateMode(ViewportUpdateMode mode) | - | ||||||||||||||||||||||||
1032 | { | - | ||||||||||||||||||||||||
1033 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1034 | d->viewportUpdateMode = mode; | - | ||||||||||||||||||||||||
1035 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1036 | QGraphicsView::OptimizationFlags QGraphicsView::optimizationFlags() const | - | ||||||||||||||||||||||||
1037 | { | - | ||||||||||||||||||||||||
1038 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1039 | return never executed: d->optimizationFlags;return d->optimizationFlags; never executed: return d->optimizationFlags; | 0 | ||||||||||||||||||||||||
1040 | } | - | ||||||||||||||||||||||||
1041 | void QGraphicsView::setOptimizationFlags(OptimizationFlags flags) | - | ||||||||||||||||||||||||
1042 | { | - | ||||||||||||||||||||||||
1043 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1044 | d->optimizationFlags = flags; | - | ||||||||||||||||||||||||
1045 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1046 | - | |||||||||||||||||||||||||
1047 | - | |||||||||||||||||||||||||
1048 | - | |||||||||||||||||||||||||
1049 | - | |||||||||||||||||||||||||
1050 | - | |||||||||||||||||||||||||
1051 | - | |||||||||||||||||||||||||
1052 | void QGraphicsView::setOptimizationFlag(OptimizationFlag flag, bool enabled) | - | ||||||||||||||||||||||||
1053 | { | - | ||||||||||||||||||||||||
1054 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1055 | if (enabled
| 0 | ||||||||||||||||||||||||
1056 | d->optimizationFlags |= flag; never executed: d->optimizationFlags |= flag; | 0 | ||||||||||||||||||||||||
1057 | else | - | ||||||||||||||||||||||||
1058 | d->optimizationFlags &= ~flag; never executed: d->optimizationFlags &= ~flag; | 0 | ||||||||||||||||||||||||
1059 | } | - | ||||||||||||||||||||||||
1060 | QGraphicsView::DragMode QGraphicsView::dragMode() const | - | ||||||||||||||||||||||||
1061 | { | - | ||||||||||||||||||||||||
1062 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1063 | return never executed: d->dragMode;return d->dragMode; never executed: return d->dragMode; | 0 | ||||||||||||||||||||||||
1064 | } | - | ||||||||||||||||||||||||
1065 | void QGraphicsView::setDragMode(DragMode mode) | - | ||||||||||||||||||||||||
1066 | { | - | ||||||||||||||||||||||||
1067 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1068 | if (d->dragMode == mode
| 0 | ||||||||||||||||||||||||
1069 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1070 | - | |||||||||||||||||||||||||
1071 | - | |||||||||||||||||||||||||
1072 | if (d->dragMode == ScrollHandDrag
| 0 | ||||||||||||||||||||||||
1073 | viewport()->unsetCursor(); never executed: viewport()->unsetCursor(); | 0 | ||||||||||||||||||||||||
1074 | - | |||||||||||||||||||||||||
1075 | - | |||||||||||||||||||||||||
1076 | - | |||||||||||||||||||||||||
1077 | - | |||||||||||||||||||||||||
1078 | - | |||||||||||||||||||||||||
1079 | - | |||||||||||||||||||||||||
1080 | if (d->dragMode == ScrollHandDrag
| 0 | ||||||||||||||||||||||||
1081 | d->handScrolling = false; never executed: d->handScrolling = false; | 0 | ||||||||||||||||||||||||
1082 | - | |||||||||||||||||||||||||
1083 | d->dragMode = mode; | - | ||||||||||||||||||||||||
1084 | - | |||||||||||||||||||||||||
1085 | - | |||||||||||||||||||||||||
1086 | if (d->dragMode == ScrollHandDrag
| 0 | ||||||||||||||||||||||||
1087 | - | |||||||||||||||||||||||||
1088 | d->hasStoredOriginalCursor = false; | - | ||||||||||||||||||||||||
1089 | viewport()->setCursor(Qt::OpenHandCursor); | - | ||||||||||||||||||||||||
1090 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1091 | - | |||||||||||||||||||||||||
1092 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1093 | Qt::ItemSelectionMode QGraphicsView::rubberBandSelectionMode() const | - | ||||||||||||||||||||||||
1094 | { | - | ||||||||||||||||||||||||
1095 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1096 | return never executed: d->rubberBandSelectionMode;return d->rubberBandSelectionMode; never executed: return d->rubberBandSelectionMode; | 0 | ||||||||||||||||||||||||
1097 | } | - | ||||||||||||||||||||||||
1098 | void QGraphicsView::setRubberBandSelectionMode(Qt::ItemSelectionMode mode) | - | ||||||||||||||||||||||||
1099 | { | - | ||||||||||||||||||||||||
1100 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1101 | d->rubberBandSelectionMode = mode; | - | ||||||||||||||||||||||||
1102 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1103 | QRect QGraphicsView::rubberBandRect() const | - | ||||||||||||||||||||||||
1104 | { | - | ||||||||||||||||||||||||
1105 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1106 | if (d->dragMode != QGraphicsView::RubberBandDrag
| 0 | ||||||||||||||||||||||||
1107 | return never executed: QRect();return QRect(); never executed: return QRect(); | 0 | ||||||||||||||||||||||||
1108 | - | |||||||||||||||||||||||||
1109 | return never executed: d->rubberBandRect;return d->rubberBandRect; never executed: return d->rubberBandRect; | 0 | ||||||||||||||||||||||||
1110 | } | - | ||||||||||||||||||||||||
1111 | QGraphicsView::CacheMode QGraphicsView::cacheMode() const | - | ||||||||||||||||||||||||
1112 | { | - | ||||||||||||||||||||||||
1113 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1114 | return never executed: d->cacheMode;return d->cacheMode; never executed: return d->cacheMode; | 0 | ||||||||||||||||||||||||
1115 | } | - | ||||||||||||||||||||||||
1116 | void QGraphicsView::setCacheMode(CacheMode mode) | - | ||||||||||||||||||||||||
1117 | { | - | ||||||||||||||||||||||||
1118 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1119 | if (mode == d->cacheMode
| 0 | ||||||||||||||||||||||||
1120 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1121 | d->cacheMode = mode; | - | ||||||||||||||||||||||||
1122 | resetCachedContent(); | - | ||||||||||||||||||||||||
1123 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1124 | void QGraphicsView::resetCachedContent() | - | ||||||||||||||||||||||||
1125 | { | - | ||||||||||||||||||||||||
1126 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1127 | if (d->cacheMode == CacheNone
| 0 | ||||||||||||||||||||||||
1128 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1129 | - | |||||||||||||||||||||||||
1130 | if (d->cacheMode & CacheBackground
| 0 | ||||||||||||||||||||||||
1131 | - | |||||||||||||||||||||||||
1132 | d->mustResizeBackgroundPixmap = true; | - | ||||||||||||||||||||||||
1133 | d->updateAll(); | - | ||||||||||||||||||||||||
1134 | } never executed: else if (d->mustResizeBackgroundPixmapend of block
| 0 | ||||||||||||||||||||||||
1135 | - | |||||||||||||||||||||||||
1136 | - | |||||||||||||||||||||||||
1137 | d->mustResizeBackgroundPixmap = false; | - | ||||||||||||||||||||||||
1138 | d->backgroundPixmap = QPixmap(); | - | ||||||||||||||||||||||||
1139 | d->backgroundPixmapExposed = QRegion(); | - | ||||||||||||||||||||||||
1140 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1141 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1142 | void QGraphicsView::invalidateScene(const QRectF &rect, QGraphicsScene::SceneLayers layers) | - | ||||||||||||||||||||||||
1143 | { | - | ||||||||||||||||||||||||
1144 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1145 | if ((
| 0 | ||||||||||||||||||||||||
1146 | QRect viewRect = mapFromScene(rect).boundingRect(); | - | ||||||||||||||||||||||||
1147 | if (viewport()->rect().intersects(viewRect)
| 0 | ||||||||||||||||||||||||
1148 | - | |||||||||||||||||||||||||
1149 | - | |||||||||||||||||||||||||
1150 | d->backgroundPixmapExposed += viewRect; | - | ||||||||||||||||||||||||
1151 | if (d->scene
| 0 | ||||||||||||||||||||||||
1152 | d->scene->update(rect); never executed: d->scene->update(rect); | 0 | ||||||||||||||||||||||||
1153 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1154 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1155 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1156 | bool QGraphicsView::isInteractive() const | - | ||||||||||||||||||||||||
1157 | { | - | ||||||||||||||||||||||||
1158 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1159 | return never executed: d->sceneInteractionAllowed;return d->sceneInteractionAllowed; never executed: return d->sceneInteractionAllowed; | 0 | ||||||||||||||||||||||||
1160 | } | - | ||||||||||||||||||||||||
1161 | void QGraphicsView::setInteractive(bool allowed) | - | ||||||||||||||||||||||||
1162 | { | - | ||||||||||||||||||||||||
1163 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1164 | d->sceneInteractionAllowed = allowed; | - | ||||||||||||||||||||||||
1165 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1166 | - | |||||||||||||||||||||||||
1167 | - | |||||||||||||||||||||||||
1168 | - | |||||||||||||||||||||||||
1169 | - | |||||||||||||||||||||||||
1170 | - | |||||||||||||||||||||||||
1171 | - | |||||||||||||||||||||||||
1172 | - | |||||||||||||||||||||||||
1173 | QGraphicsScene *QGraphicsView::scene() const | - | ||||||||||||||||||||||||
1174 | { | - | ||||||||||||||||||||||||
1175 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1176 | return never executed: d->scene;return d->scene; never executed: return d->scene; | 0 | ||||||||||||||||||||||||
1177 | } | - | ||||||||||||||||||||||||
1178 | void QGraphicsView::setScene(QGraphicsScene *scene) | - | ||||||||||||||||||||||||
1179 | { | - | ||||||||||||||||||||||||
1180 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1181 | if (d->scene == scene
| 0 | ||||||||||||||||||||||||
1182 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1183 | - | |||||||||||||||||||||||||
1184 | - | |||||||||||||||||||||||||
1185 | d->updateAll(); | - | ||||||||||||||||||||||||
1186 | - | |||||||||||||||||||||||||
1187 | - | |||||||||||||||||||||||||
1188 | if (d->scene
| 0 | ||||||||||||||||||||||||
1189 | disconnect(d->scene, qFlagLocation("2""changed(QList<QRectF>)" "\0" __FILE__ ":" "1710"), | - | ||||||||||||||||||||||||
1190 | this, qFlagLocation("1""updateScene(QList<QRectF>)" "\0" __FILE__ ":" "1711")); | - | ||||||||||||||||||||||||
1191 | disconnect(d->scene, qFlagLocation("2""sceneRectChanged(QRectF)" "\0" __FILE__ ":" "1712"), | - | ||||||||||||||||||||||||
1192 | this, qFlagLocation("1""updateSceneRect(QRectF)" "\0" __FILE__ ":" "1713")); | - | ||||||||||||||||||||||||
1193 | d->scene->d_func()->removeView(this); | - | ||||||||||||||||||||||||
1194 | d->connectedToScene = false; | - | ||||||||||||||||||||||||
1195 | - | |||||||||||||||||||||||||
1196 | if (isActiveWindow()
| 0 | ||||||||||||||||||||||||
1197 | QEvent windowDeactivate(QEvent::WindowDeactivate); | - | ||||||||||||||||||||||||
1198 | QApplication::sendEvent(d->scene, &windowDeactivate); | - | ||||||||||||||||||||||||
1199 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1200 | if(hasFocus()
| 0 | ||||||||||||||||||||||||
1201 | d->scene->clearFocus(); never executed: d->scene->clearFocus(); | 0 | ||||||||||||||||||||||||
1202 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1203 | - | |||||||||||||||||||||||||
1204 | - | |||||||||||||||||||||||||
1205 | if ((
| 0 | ||||||||||||||||||||||||
1206 | connect(d->scene, qFlagLocation("2""sceneRectChanged(QRectF)" "\0" __FILE__ ":" "1727"), | - | ||||||||||||||||||||||||
1207 | this, qFlagLocation("1""updateSceneRect(QRectF)" "\0" __FILE__ ":" "1728")); | - | ||||||||||||||||||||||||
1208 | d->updateSceneSlotReimplementedChecked = false; | - | ||||||||||||||||||||||||
1209 | d->scene->d_func()->addView(this); | - | ||||||||||||||||||||||||
1210 | d->recalculateContentSize(); | - | ||||||||||||||||||||||||
1211 | d->lastCenterPoint = sceneRect().center(); | - | ||||||||||||||||||||||||
1212 | d->keepLastCenterPoint = true; | - | ||||||||||||||||||||||||
1213 | - | |||||||||||||||||||||||||
1214 | - | |||||||||||||||||||||||||
1215 | if (!d->scene->d_func()->allItemsIgnoreHoverEvents
| 0 | ||||||||||||||||||||||||
1216 | || !d->scene->d_func()->allItemsUseDefaultCursor
| 0 | ||||||||||||||||||||||||
1217 | d->viewport->setMouseTracking(true); | - | ||||||||||||||||||||||||
1218 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1219 | - | |||||||||||||||||||||||||
1220 | - | |||||||||||||||||||||||||
1221 | if (!d->scene->d_func()->allItemsIgnoreTouchEvents
| 0 | ||||||||||||||||||||||||
1222 | d->viewport->setAttribute(Qt::WA_AcceptTouchEvents); never executed: d->viewport->setAttribute(Qt::WA_AcceptTouchEvents); | 0 | ||||||||||||||||||||||||
1223 | - | |||||||||||||||||||||||||
1224 | if (isActiveWindow()
| 0 | ||||||||||||||||||||||||
1225 | QEvent windowActivate(QEvent::WindowActivate); | - | ||||||||||||||||||||||||
1226 | QApplication::sendEvent(d->scene, &windowActivate); | - | ||||||||||||||||||||||||
1227 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1228 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1229 | d->recalculateContentSize(); | - | ||||||||||||||||||||||||
1230 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1231 | - | |||||||||||||||||||||||||
1232 | d->updateInputMethodSensitivity(); | - | ||||||||||||||||||||||||
1233 | - | |||||||||||||||||||||||||
1234 | if (d->scene
| 0 | ||||||||||||||||||||||||
1235 | d->scene->setFocus(); never executed: d->scene->setFocus(); | 0 | ||||||||||||||||||||||||
1236 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1237 | QRectF QGraphicsView::sceneRect() const | - | ||||||||||||||||||||||||
1238 | { | - | ||||||||||||||||||||||||
1239 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1240 | if (d->hasSceneRect
| 0 | ||||||||||||||||||||||||
1241 | return never executed: d->sceneRect;return d->sceneRect; never executed: return d->sceneRect; | 0 | ||||||||||||||||||||||||
1242 | if (d->scene
| 0 | ||||||||||||||||||||||||
1243 | return never executed: d->scene->sceneRect();return d->scene->sceneRect(); never executed: return d->scene->sceneRect(); | 0 | ||||||||||||||||||||||||
1244 | return never executed: QRectF();return QRectF(); never executed: return QRectF(); | 0 | ||||||||||||||||||||||||
1245 | } | - | ||||||||||||||||||||||||
1246 | void QGraphicsView::setSceneRect(const QRectF &rect) | - | ||||||||||||||||||||||||
1247 | { | - | ||||||||||||||||||||||||
1248 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1249 | d->hasSceneRect = !rect.isNull(); | - | ||||||||||||||||||||||||
1250 | d->sceneRect = rect; | - | ||||||||||||||||||||||||
1251 | d->recalculateContentSize(); | - | ||||||||||||||||||||||||
1252 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1253 | - | |||||||||||||||||||||||||
1254 | - | |||||||||||||||||||||||||
1255 | - | |||||||||||||||||||||||||
1256 | - | |||||||||||||||||||||||||
1257 | - | |||||||||||||||||||||||||
1258 | - | |||||||||||||||||||||||||
1259 | - | |||||||||||||||||||||||||
1260 | QMatrix QGraphicsView::matrix() const | - | ||||||||||||||||||||||||
1261 | { | - | ||||||||||||||||||||||||
1262 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1263 | return never executed: d->matrix.toAffine();return d->matrix.toAffine(); never executed: return d->matrix.toAffine(); | 0 | ||||||||||||||||||||||||
1264 | } | - | ||||||||||||||||||||||||
1265 | void QGraphicsView::setMatrix(const QMatrix &matrix, bool combine) | - | ||||||||||||||||||||||||
1266 | { | - | ||||||||||||||||||||||||
1267 | setTransform(QTransform(matrix), combine); | - | ||||||||||||||||||||||||
1268 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1269 | - | |||||||||||||||||||||||||
1270 | - | |||||||||||||||||||||||||
1271 | - | |||||||||||||||||||||||||
1272 | - | |||||||||||||||||||||||||
1273 | - | |||||||||||||||||||||||||
1274 | - | |||||||||||||||||||||||||
1275 | void QGraphicsView::resetMatrix() | - | ||||||||||||||||||||||||
1276 | { | - | ||||||||||||||||||||||||
1277 | resetTransform(); | - | ||||||||||||||||||||||||
1278 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1279 | - | |||||||||||||||||||||||||
1280 | - | |||||||||||||||||||||||||
1281 | - | |||||||||||||||||||||||||
1282 | - | |||||||||||||||||||||||||
1283 | - | |||||||||||||||||||||||||
1284 | - | |||||||||||||||||||||||||
1285 | void QGraphicsView::rotate(qreal angle) | - | ||||||||||||||||||||||||
1286 | { | - | ||||||||||||||||||||||||
1287 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1288 | QTransform matrix = d->matrix; | - | ||||||||||||||||||||||||
1289 | matrix.rotate(angle); | - | ||||||||||||||||||||||||
1290 | setTransform(matrix); | - | ||||||||||||||||||||||||
1291 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1292 | - | |||||||||||||||||||||||||
1293 | - | |||||||||||||||||||||||||
1294 | - | |||||||||||||||||||||||||
1295 | - | |||||||||||||||||||||||||
1296 | - | |||||||||||||||||||||||||
1297 | - | |||||||||||||||||||||||||
1298 | void QGraphicsView::scale(qreal sx, qreal sy) | - | ||||||||||||||||||||||||
1299 | { | - | ||||||||||||||||||||||||
1300 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1301 | QTransform matrix = d->matrix; | - | ||||||||||||||||||||||||
1302 | matrix.scale(sx, sy); | - | ||||||||||||||||||||||||
1303 | setTransform(matrix); | - | ||||||||||||||||||||||||
1304 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1305 | - | |||||||||||||||||||||||||
1306 | - | |||||||||||||||||||||||||
1307 | - | |||||||||||||||||||||||||
1308 | - | |||||||||||||||||||||||||
1309 | - | |||||||||||||||||||||||||
1310 | - | |||||||||||||||||||||||||
1311 | void QGraphicsView::shear(qreal sh, qreal sv) | - | ||||||||||||||||||||||||
1312 | { | - | ||||||||||||||||||||||||
1313 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1314 | QTransform matrix = d->matrix; | - | ||||||||||||||||||||||||
1315 | matrix.shear(sh, sv); | - | ||||||||||||||||||||||||
1316 | setTransform(matrix); | - | ||||||||||||||||||||||||
1317 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1318 | - | |||||||||||||||||||||||||
1319 | - | |||||||||||||||||||||||||
1320 | - | |||||||||||||||||||||||||
1321 | - | |||||||||||||||||||||||||
1322 | - | |||||||||||||||||||||||||
1323 | - | |||||||||||||||||||||||||
1324 | void QGraphicsView::translate(qreal dx, qreal dy) | - | ||||||||||||||||||||||||
1325 | { | - | ||||||||||||||||||||||||
1326 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1327 | QTransform matrix = d->matrix; | - | ||||||||||||||||||||||||
1328 | matrix.translate(dx, dy); | - | ||||||||||||||||||||||||
1329 | setTransform(matrix); | - | ||||||||||||||||||||||||
1330 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1331 | void QGraphicsView::centerOn(const QPointF &pos) | - | ||||||||||||||||||||||||
1332 | { | - | ||||||||||||||||||||||||
1333 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1334 | qreal width = viewport()->width(); | - | ||||||||||||||||||||||||
1335 | qreal height = viewport()->height(); | - | ||||||||||||||||||||||||
1336 | QPointF viewPoint = d->matrix.map(pos); | - | ||||||||||||||||||||||||
1337 | QPointF oldCenterPoint = pos; | - | ||||||||||||||||||||||||
1338 | - | |||||||||||||||||||||||||
1339 | if (!d->leftIndent
| 0 | ||||||||||||||||||||||||
1340 | if (isRightToLeft()
| 0 | ||||||||||||||||||||||||
1341 | qint64 horizontal = 0; | - | ||||||||||||||||||||||||
1342 | horizontal += horizontalScrollBar()->minimum(); | - | ||||||||||||||||||||||||
1343 | horizontal += horizontalScrollBar()->maximum(); | - | ||||||||||||||||||||||||
1344 | horizontal -= int(viewPoint.x() - width / 2.0); | - | ||||||||||||||||||||||||
1345 | horizontalScrollBar()->setValue(horizontal); | - | ||||||||||||||||||||||||
1346 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1347 | horizontalScrollBar()->setValue(int(viewPoint.x() - width / 2.0)); | - | ||||||||||||||||||||||||
1348 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1349 | } | - | ||||||||||||||||||||||||
1350 | if (!d->topIndent
| 0 | ||||||||||||||||||||||||
1351 | verticalScrollBar()->setValue(int(viewPoint.y() - height / 2.0)); never executed: verticalScrollBar()->setValue(int(viewPoint.y() - height / 2.0)); | 0 | ||||||||||||||||||||||||
1352 | d->lastCenterPoint = oldCenterPoint; | - | ||||||||||||||||||||||||
1353 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1354 | void QGraphicsView::centerOn(const QGraphicsItem *item) | - | ||||||||||||||||||||||||
1355 | { | - | ||||||||||||||||||||||||
1356 | centerOn(item->sceneBoundingRect().center()); | - | ||||||||||||||||||||||||
1357 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1358 | void QGraphicsView::ensureVisible(const QRectF &rect, int xmargin, int ymargin) | - | ||||||||||||||||||||||||
1359 | { | - | ||||||||||||||||||||||||
1360 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1361 | qreal width = viewport()->width(); | - | ||||||||||||||||||||||||
1362 | qreal height = viewport()->height(); | - | ||||||||||||||||||||||||
1363 | QRectF viewRect = d->matrix.mapRect(rect); | - | ||||||||||||||||||||||||
1364 | - | |||||||||||||||||||||||||
1365 | qreal left = d->horizontalScroll(); | - | ||||||||||||||||||||||||
1366 | qreal right = left + width; | - | ||||||||||||||||||||||||
1367 | qreal top = d->verticalScroll(); | - | ||||||||||||||||||||||||
1368 | qreal bottom = top + height; | - | ||||||||||||||||||||||||
1369 | - | |||||||||||||||||||||||||
1370 | if (viewRect.left() <= left + xmargin
| 0 | ||||||||||||||||||||||||
1371 | - | |||||||||||||||||||||||||
1372 | if (!d->leftIndent
| 0 | ||||||||||||||||||||||||
1373 | horizontalScrollBar()->setValue(int(viewRect.left() - xmargin - 0.5)); never executed: horizontalScrollBar()->setValue(int(viewRect.left() - xmargin - 0.5)); | 0 | ||||||||||||||||||||||||
1374 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1375 | if (viewRect.right() >= right - xmargin
| 0 | ||||||||||||||||||||||||
1376 | - | |||||||||||||||||||||||||
1377 | if (!d->leftIndent
| 0 | ||||||||||||||||||||||||
1378 | horizontalScrollBar()->setValue(int(viewRect.right() - width + xmargin + 0.5)); never executed: horizontalScrollBar()->setValue(int(viewRect.right() - width + xmargin + 0.5)); | 0 | ||||||||||||||||||||||||
1379 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1380 | if (viewRect.top() <= top + ymargin
| 0 | ||||||||||||||||||||||||
1381 | - | |||||||||||||||||||||||||
1382 | if (!d->topIndent
| 0 | ||||||||||||||||||||||||
1383 | verticalScrollBar()->setValue(int(viewRect.top() - ymargin - 0.5)); never executed: verticalScrollBar()->setValue(int(viewRect.top() - ymargin - 0.5)); | 0 | ||||||||||||||||||||||||
1384 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1385 | if (viewRect.bottom() >= bottom - ymargin
| 0 | ||||||||||||||||||||||||
1386 | - | |||||||||||||||||||||||||
1387 | if (!d->topIndent
| 0 | ||||||||||||||||||||||||
1388 | verticalScrollBar()->setValue(int(viewRect.bottom() - height + ymargin + 0.5)); never executed: verticalScrollBar()->setValue(int(viewRect.bottom() - height + ymargin + 0.5)); | 0 | ||||||||||||||||||||||||
1389 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1390 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1391 | void QGraphicsView::ensureVisible(const QGraphicsItem *item, int xmargin, int ymargin) | - | ||||||||||||||||||||||||
1392 | { | - | ||||||||||||||||||||||||
1393 | ensureVisible(item->sceneBoundingRect(), xmargin, ymargin); | - | ||||||||||||||||||||||||
1394 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1395 | void QGraphicsView::fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRatioMode) | - | ||||||||||||||||||||||||
1396 | { | - | ||||||||||||||||||||||||
1397 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1398 | if (!d->scene
| 0 | ||||||||||||||||||||||||
1399 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1400 | - | |||||||||||||||||||||||||
1401 | - | |||||||||||||||||||||||||
1402 | QRectF unity = d->matrix.mapRect(QRectF(0, 0, 1, 1)); | - | ||||||||||||||||||||||||
1403 | if (unity.isEmpty()
| 0 | ||||||||||||||||||||||||
1404 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1405 | scale(1 / unity.width(), 1 / unity.height()); | - | ||||||||||||||||||||||||
1406 | - | |||||||||||||||||||||||||
1407 | - | |||||||||||||||||||||||||
1408 | int margin = 2; | - | ||||||||||||||||||||||||
1409 | QRectF viewRect = viewport()->rect().adjusted(margin, margin, -margin, -margin); | - | ||||||||||||||||||||||||
1410 | if (viewRect.isEmpty()
| 0 | ||||||||||||||||||||||||
1411 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1412 | QRectF sceneRect = d->matrix.mapRect(rect); | - | ||||||||||||||||||||||||
1413 | if (sceneRect.isEmpty()
| 0 | ||||||||||||||||||||||||
1414 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1415 | qreal xratio = viewRect.width() / sceneRect.width(); | - | ||||||||||||||||||||||||
1416 | qreal yratio = viewRect.height() / sceneRect.height(); | - | ||||||||||||||||||||||||
1417 | - | |||||||||||||||||||||||||
1418 | - | |||||||||||||||||||||||||
1419 | switch (aspectRatioMode) { | - | ||||||||||||||||||||||||
1420 | case never executed: Qt::KeepAspectRatio:case Qt::KeepAspectRatio: never executed: case Qt::KeepAspectRatio: | 0 | ||||||||||||||||||||||||
1421 | xratio = yratio = qMin(xratio, yratio); | - | ||||||||||||||||||||||||
1422 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1423 | case never executed: Qt::KeepAspectRatioByExpanding:case Qt::KeepAspectRatioByExpanding: never executed: case Qt::KeepAspectRatioByExpanding: | 0 | ||||||||||||||||||||||||
1424 | xratio = yratio = qMax(xratio, yratio); | - | ||||||||||||||||||||||||
1425 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1426 | case never executed: Qt::IgnoreAspectRatio:case Qt::IgnoreAspectRatio: never executed: case Qt::IgnoreAspectRatio: | 0 | ||||||||||||||||||||||||
1427 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1428 | } | - | ||||||||||||||||||||||||
1429 | - | |||||||||||||||||||||||||
1430 | - | |||||||||||||||||||||||||
1431 | scale(xratio, yratio); | - | ||||||||||||||||||||||||
1432 | centerOn(rect.center()); | - | ||||||||||||||||||||||||
1433 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1434 | void QGraphicsView::fitInView(const QGraphicsItem *item, Qt::AspectRatioMode aspectRatioMode) | - | ||||||||||||||||||||||||
1435 | { | - | ||||||||||||||||||||||||
1436 | QPainterPath path = item->isClipped()
| 0 | ||||||||||||||||||||||||
1437 | if (item->d_ptr->hasTranslateOnlySceneTransform()
| 0 | ||||||||||||||||||||||||
1438 | path.translate(item->d_ptr->sceneTransform.dx(), item->d_ptr->sceneTransform.dy()); | - | ||||||||||||||||||||||||
1439 | fitInView(path.boundingRect(), aspectRatioMode); | - | ||||||||||||||||||||||||
1440 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1441 | fitInView(item->d_ptr->sceneTransform.map(path).boundingRect(), aspectRatioMode); | - | ||||||||||||||||||||||||
1442 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1443 | } | - | ||||||||||||||||||||||||
1444 | void QGraphicsView::render(QPainter *painter, const QRectF &target, const QRect &source, | - | ||||||||||||||||||||||||
1445 | Qt::AspectRatioMode aspectRatioMode) | - | ||||||||||||||||||||||||
1446 | { | - | ||||||||||||||||||||||||
1447 | - | |||||||||||||||||||||||||
1448 | - | |||||||||||||||||||||||||
1449 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1450 | if (!d->scene
| 0 | ||||||||||||||||||||||||
1451 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1452 | - | |||||||||||||||||||||||||
1453 | - | |||||||||||||||||||||||||
1454 | QRect sourceRect = source; | - | ||||||||||||||||||||||||
1455 | if (source.isNull()
| 0 | ||||||||||||||||||||||||
1456 | sourceRect = viewport()->rect(); never executed: sourceRect = viewport()->rect(); | 0 | ||||||||||||||||||||||||
1457 | - | |||||||||||||||||||||||||
1458 | - | |||||||||||||||||||||||||
1459 | QRectF targetRect = target; | - | ||||||||||||||||||||||||
1460 | if (target.isNull()
| 0 | ||||||||||||||||||||||||
1461 | if (painter->device()->devType() == QInternal::Picture
| 0 | ||||||||||||||||||||||||
1462 | targetRect = sourceRect; never executed: targetRect = sourceRect; | 0 | ||||||||||||||||||||||||
1463 | else | - | ||||||||||||||||||||||||
1464 | targetRect.setRect(0, 0, painter->device()->width(), painter->device()->height()); never executed: targetRect.setRect(0, 0, painter->device()->width(), painter->device()->height()); | 0 | ||||||||||||||||||||||||
1465 | } | - | ||||||||||||||||||||||||
1466 | - | |||||||||||||||||||||||||
1467 | - | |||||||||||||||||||||||||
1468 | qreal xratio = targetRect.width() / sourceRect.width(); | - | ||||||||||||||||||||||||
1469 | qreal yratio = targetRect.height() / sourceRect.height(); | - | ||||||||||||||||||||||||
1470 | - | |||||||||||||||||||||||||
1471 | - | |||||||||||||||||||||||||
1472 | switch (aspectRatioMode) { | - | ||||||||||||||||||||||||
1473 | case never executed: Qt::KeepAspectRatio:case Qt::KeepAspectRatio: never executed: case Qt::KeepAspectRatio: | 0 | ||||||||||||||||||||||||
1474 | xratio = yratio = qMin(xratio, yratio); | - | ||||||||||||||||||||||||
1475 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1476 | case never executed: Qt::KeepAspectRatioByExpanding:case Qt::KeepAspectRatioByExpanding: never executed: case Qt::KeepAspectRatioByExpanding: | 0 | ||||||||||||||||||||||||
1477 | xratio = yratio = qMax(xratio, yratio); | - | ||||||||||||||||||||||||
1478 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1479 | case never executed: Qt::IgnoreAspectRatio:case Qt::IgnoreAspectRatio: never executed: case Qt::IgnoreAspectRatio: | 0 | ||||||||||||||||||||||||
1480 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1481 | } | - | ||||||||||||||||||||||||
1482 | - | |||||||||||||||||||||||||
1483 | - | |||||||||||||||||||||||||
1484 | - | |||||||||||||||||||||||||
1485 | QPolygonF sourceScenePoly = mapToScene(sourceRect.adjusted(-1, -1, 1, 1)); | - | ||||||||||||||||||||||||
1486 | QList<QGraphicsItem *> itemList = d->scene->items(sourceScenePoly, | - | ||||||||||||||||||||||||
1487 | Qt::IntersectsItemBoundingRect); | - | ||||||||||||||||||||||||
1488 | QGraphicsItem **itemArray = new QGraphicsItem *[itemList.size()]; | - | ||||||||||||||||||||||||
1489 | int numItems = itemList.size(); | - | ||||||||||||||||||||||||
1490 | for (int i = 0; i < numItems
| 0 | ||||||||||||||||||||||||
1491 | itemArray[numItems - i - 1] = itemList.at(i); never executed: itemArray[numItems - i - 1] = itemList.at(i); | 0 | ||||||||||||||||||||||||
1492 | itemList.clear(); | - | ||||||||||||||||||||||||
1493 | - | |||||||||||||||||||||||||
1494 | - | |||||||||||||||||||||||||
1495 | QTransform moveMatrix = QTransform::fromTranslate(-d->horizontalScroll(), -d->verticalScroll()); | - | ||||||||||||||||||||||||
1496 | QTransform painterMatrix = d->matrix * moveMatrix; | - | ||||||||||||||||||||||||
1497 | painterMatrix *= QTransform() | - | ||||||||||||||||||||||||
1498 | .translate(targetRect.left(), targetRect.top()) | - | ||||||||||||||||||||||||
1499 | .scale(xratio, yratio) | - | ||||||||||||||||||||||||
1500 | .translate(-sourceRect.left(), -sourceRect.top()); | - | ||||||||||||||||||||||||
1501 | - | |||||||||||||||||||||||||
1502 | - | |||||||||||||||||||||||||
1503 | QStyleOptionGraphicsItem *styleOptionArray = d->allocStyleOptionsArray(numItems); | - | ||||||||||||||||||||||||
1504 | for (int i = 0; i < numItems
| 0 | ||||||||||||||||||||||||
1505 | itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], painterMatrix, targetRect.toRect()); never executed: itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], painterMatrix, targetRect.toRect()); | 0 | ||||||||||||||||||||||||
1506 | - | |||||||||||||||||||||||||
1507 | painter->save(); | - | ||||||||||||||||||||||||
1508 | - | |||||||||||||||||||||||||
1509 | - | |||||||||||||||||||||||||
1510 | painter->setClipRect(targetRect); | - | ||||||||||||||||||||||||
1511 | QPainterPath path; | - | ||||||||||||||||||||||||
1512 | path.addPolygon(sourceScenePoly); | - | ||||||||||||||||||||||||
1513 | path.closeSubpath(); | - | ||||||||||||||||||||||||
1514 | painter->setClipPath(painterMatrix.map(path), Qt::IntersectClip); | - | ||||||||||||||||||||||||
1515 | - | |||||||||||||||||||||||||
1516 | - | |||||||||||||||||||||||||
1517 | painter->setTransform(painterMatrix, true); | - | ||||||||||||||||||||||||
1518 | - | |||||||||||||||||||||||||
1519 | - | |||||||||||||||||||||||||
1520 | QRectF sourceSceneRect = sourceScenePoly.boundingRect(); | - | ||||||||||||||||||||||||
1521 | drawBackground(painter, sourceSceneRect); | - | ||||||||||||||||||||||||
1522 | drawItems(painter, numItems, itemArray, styleOptionArray); | - | ||||||||||||||||||||||||
1523 | drawForeground(painter, sourceSceneRect); | - | ||||||||||||||||||||||||
1524 | - | |||||||||||||||||||||||||
1525 | delete [] itemArray; | - | ||||||||||||||||||||||||
1526 | d->freeStyleOptionsArray(styleOptionArray); | - | ||||||||||||||||||||||||
1527 | - | |||||||||||||||||||||||||
1528 | painter->restore(); | - | ||||||||||||||||||||||||
1529 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1530 | QList<QGraphicsItem *> QGraphicsView::items() const | - | ||||||||||||||||||||||||
1531 | { | - | ||||||||||||||||||||||||
1532 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1533 | if (!d->scene
| 0 | ||||||||||||||||||||||||
1534 | return never executed: QList<QGraphicsItem *>();return QList<QGraphicsItem *>(); never executed: return QList<QGraphicsItem *>(); | 0 | ||||||||||||||||||||||||
1535 | return never executed: d->scene->items();return d->scene->items(); never executed: return d->scene->items(); | 0 | ||||||||||||||||||||||||
1536 | } | - | ||||||||||||||||||||||||
1537 | QList<QGraphicsItem *> QGraphicsView::items(const QPoint &pos) const | - | ||||||||||||||||||||||||
1538 | { | - | ||||||||||||||||||||||||
1539 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1540 | if (!d->scene
| 0 | ||||||||||||||||||||||||
1541 | return never executed: QList<QGraphicsItem *>();return QList<QGraphicsItem *>(); never executed: return QList<QGraphicsItem *>(); | 0 | ||||||||||||||||||||||||
1542 | - | |||||||||||||||||||||||||
1543 | - | |||||||||||||||||||||||||
1544 | - | |||||||||||||||||||||||||
1545 | if ((d->identityMatrix
| 0 | ||||||||||||||||||||||||
1546 | - | |||||||||||||||||||||||||
1547 | QTransform xinv = viewportTransform().inverted(); | - | ||||||||||||||||||||||||
1548 | return never executed: d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)),return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform()); never executed: return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform()); | 0 | ||||||||||||||||||||||||
1549 | Qt::IntersectsItemShape, never executed: return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform()); | 0 | ||||||||||||||||||||||||
1550 | Qt::DescendingOrder, never executed: return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform()); | 0 | ||||||||||||||||||||||||
1551 | viewportTransform()); never executed: return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform()); | 0 | ||||||||||||||||||||||||
1552 | } | - | ||||||||||||||||||||||||
1553 | - | |||||||||||||||||||||||||
1554 | return never executed: d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1),return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform()); never executed: return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform()); | 0 | ||||||||||||||||||||||||
1555 | Qt::IntersectsItemShape, never executed: return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform()); | 0 | ||||||||||||||||||||||||
1556 | Qt::DescendingOrder, never executed: return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform()); | 0 | ||||||||||||||||||||||||
1557 | viewportTransform()); never executed: return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1), Qt::IntersectsItemShape, Qt::DescendingOrder, viewportTransform()); | 0 | ||||||||||||||||||||||||
1558 | } | - | ||||||||||||||||||||||||
1559 | QList<QGraphicsItem *> QGraphicsView::items(const QRect &rect, Qt::ItemSelectionMode mode) const | - | ||||||||||||||||||||||||
1560 | { | - | ||||||||||||||||||||||||
1561 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1562 | if (!d->scene
| 0 | ||||||||||||||||||||||||
1563 | return never executed: QList<QGraphicsItem *>();return QList<QGraphicsItem *>(); never executed: return QList<QGraphicsItem *>(); | 0 | ||||||||||||||||||||||||
1564 | return never executed: d->scene->items(mapToScene(rect), mode, Qt::DescendingOrder, viewportTransform());return d->scene->items(mapToScene(rect), mode, Qt::DescendingOrder, viewportTransform()); never executed: return d->scene->items(mapToScene(rect), mode, Qt::DescendingOrder, viewportTransform()); | 0 | ||||||||||||||||||||||||
1565 | } | - | ||||||||||||||||||||||||
1566 | QList<QGraphicsItem *> QGraphicsView::items(const QPolygon &polygon, Qt::ItemSelectionMode mode) const | - | ||||||||||||||||||||||||
1567 | { | - | ||||||||||||||||||||||||
1568 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1569 | if (!d->scene
| 0 | ||||||||||||||||||||||||
1570 | return never executed: QList<QGraphicsItem *>();return QList<QGraphicsItem *>(); never executed: return QList<QGraphicsItem *>(); | 0 | ||||||||||||||||||||||||
1571 | return never executed: d->scene->items(mapToScene(polygon), mode, Qt::DescendingOrder, viewportTransform());return d->scene->items(mapToScene(polygon), mode, Qt::DescendingOrder, viewportTransform()); never executed: return d->scene->items(mapToScene(polygon), mode, Qt::DescendingOrder, viewportTransform()); | 0 | ||||||||||||||||||||||||
1572 | } | - | ||||||||||||||||||||||||
1573 | QList<QGraphicsItem *> QGraphicsView::items(const QPainterPath &path, Qt::ItemSelectionMode mode) const | - | ||||||||||||||||||||||||
1574 | { | - | ||||||||||||||||||||||||
1575 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1576 | if (!d->scene
| 0 | ||||||||||||||||||||||||
1577 | return never executed: QList<QGraphicsItem *>();return QList<QGraphicsItem *>(); never executed: return QList<QGraphicsItem *>(); | 0 | ||||||||||||||||||||||||
1578 | return never executed: d->scene->items(mapToScene(path), mode, Qt::DescendingOrder, viewportTransform());return d->scene->items(mapToScene(path), mode, Qt::DescendingOrder, viewportTransform()); never executed: return d->scene->items(mapToScene(path), mode, Qt::DescendingOrder, viewportTransform()); | 0 | ||||||||||||||||||||||||
1579 | } | - | ||||||||||||||||||||||||
1580 | QGraphicsItem *QGraphicsView::itemAt(const QPoint &pos) const | - | ||||||||||||||||||||||||
1581 | { | - | ||||||||||||||||||||||||
1582 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1583 | if (!d->scene
| 0 | ||||||||||||||||||||||||
1584 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1585 | QList<QGraphicsItem *> itemsAtPos = items(pos); | - | ||||||||||||||||||||||||
1586 | return never executed: itemsAtPos.isEmpty()return itemsAtPos.isEmpty() ? 0 : itemsAtPos.first();
never executed: return itemsAtPos.isEmpty() ? 0 : itemsAtPos.first(); | 0 | ||||||||||||||||||||||||
1587 | } | - | ||||||||||||||||||||||||
1588 | QPointF QGraphicsView::mapToScene(const QPoint &point) const | - | ||||||||||||||||||||||||
1589 | { | - | ||||||||||||||||||||||||
1590 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1591 | QPointF p = point; | - | ||||||||||||||||||||||||
1592 | p.rx() += d->horizontalScroll(); | - | ||||||||||||||||||||||||
1593 | p.ry() += d->verticalScroll(); | - | ||||||||||||||||||||||||
1594 | return never executed: d->identityMatrixreturn d->identityMatrix ? p : d->matrix.inverted().map(p);
never executed: return d->identityMatrix ? p : d->matrix.inverted().map(p); | 0 | ||||||||||||||||||||||||
1595 | } | - | ||||||||||||||||||||||||
1596 | QPolygonF QGraphicsView::mapToScene(const QRect &rect) const | - | ||||||||||||||||||||||||
1597 | { | - | ||||||||||||||||||||||||
1598 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1599 | if (!rect.isValid()
| 0 | ||||||||||||||||||||||||
1600 | return never executed: QPolygonF();return QPolygonF(); never executed: return QPolygonF(); | 0 | ||||||||||||||||||||||||
1601 | - | |||||||||||||||||||||||||
1602 | QPointF scrollOffset(d->horizontalScroll(), d->verticalScroll()); | - | ||||||||||||||||||||||||
1603 | QRect r = rect.adjusted(0, 0, 1, 1); | - | ||||||||||||||||||||||||
1604 | QPointF tl = scrollOffset + r.topLeft(); | - | ||||||||||||||||||||||||
1605 | QPointF tr = scrollOffset + r.topRight(); | - | ||||||||||||||||||||||||
1606 | QPointF br = scrollOffset + r.bottomRight(); | - | ||||||||||||||||||||||||
1607 | QPointF bl = scrollOffset + r.bottomLeft(); | - | ||||||||||||||||||||||||
1608 | - | |||||||||||||||||||||||||
1609 | QPolygonF poly(4); | - | ||||||||||||||||||||||||
1610 | if (!d->identityMatrix
| 0 | ||||||||||||||||||||||||
1611 | QTransform x = d->matrix.inverted(); | - | ||||||||||||||||||||||||
1612 | poly[0] = x.map(tl); | - | ||||||||||||||||||||||||
1613 | poly[1] = x.map(tr); | - | ||||||||||||||||||||||||
1614 | poly[2] = x.map(br); | - | ||||||||||||||||||||||||
1615 | poly[3] = x.map(bl); | - | ||||||||||||||||||||||||
1616 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1617 | poly[0] = tl; | - | ||||||||||||||||||||||||
1618 | poly[1] = tr; | - | ||||||||||||||||||||||||
1619 | poly[2] = br; | - | ||||||||||||||||||||||||
1620 | poly[3] = bl; | - | ||||||||||||||||||||||||
1621 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1622 | return never executed: poly;return poly; never executed: return poly; | 0 | ||||||||||||||||||||||||
1623 | } | - | ||||||||||||||||||||||||
1624 | QPolygonF QGraphicsView::mapToScene(const QPolygon &polygon) const | - | ||||||||||||||||||||||||
1625 | { | - | ||||||||||||||||||||||||
1626 | QPolygonF poly; | - | ||||||||||||||||||||||||
1627 | poly.reserve(polygon.count()); | - | ||||||||||||||||||||||||
1628 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(polygon)>::type> _container_((polygon)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QPoint &point = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||
1629 | poly << mapToScene(point); never executed: poly << mapToScene(point); | 0 | ||||||||||||||||||||||||
1630 | return never executed: poly;return poly; never executed: return poly; | 0 | ||||||||||||||||||||||||
1631 | } | - | ||||||||||||||||||||||||
1632 | - | |||||||||||||||||||||||||
1633 | - | |||||||||||||||||||||||||
1634 | - | |||||||||||||||||||||||||
1635 | - | |||||||||||||||||||||||||
1636 | - | |||||||||||||||||||||||||
1637 | - | |||||||||||||||||||||||||
1638 | - | |||||||||||||||||||||||||
1639 | QPainterPath QGraphicsView::mapToScene(const QPainterPath &path) const | - | ||||||||||||||||||||||||
1640 | { | - | ||||||||||||||||||||||||
1641 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1642 | QTransform matrix = QTransform::fromTranslate(d->horizontalScroll(), d->verticalScroll()); | - | ||||||||||||||||||||||||
1643 | matrix *= d->matrix.inverted(); | - | ||||||||||||||||||||||||
1644 | return never executed: matrix.map(path);return matrix.map(path); never executed: return matrix.map(path); | 0 | ||||||||||||||||||||||||
1645 | } | - | ||||||||||||||||||||||||
1646 | - | |||||||||||||||||||||||||
1647 | - | |||||||||||||||||||||||||
1648 | - | |||||||||||||||||||||||||
1649 | - | |||||||||||||||||||||||||
1650 | - | |||||||||||||||||||||||||
1651 | - | |||||||||||||||||||||||||
1652 | QPoint QGraphicsView::mapFromScene(const QPointF &point) const | - | ||||||||||||||||||||||||
1653 | { | - | ||||||||||||||||||||||||
1654 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1655 | QPointF p = d->identityMatrix
| 0 | ||||||||||||||||||||||||
1656 | p.rx() -= d->horizontalScroll(); | - | ||||||||||||||||||||||||
1657 | p.ry() -= d->verticalScroll(); | - | ||||||||||||||||||||||||
1658 | return never executed: p.toPoint();return p.toPoint(); never executed: return p.toPoint(); | 0 | ||||||||||||||||||||||||
1659 | } | - | ||||||||||||||||||||||||
1660 | QPolygon QGraphicsView::mapFromScene(const QRectF &rect) const | - | ||||||||||||||||||||||||
1661 | { | - | ||||||||||||||||||||||||
1662 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1663 | QPointF tl; | - | ||||||||||||||||||||||||
1664 | QPointF tr; | - | ||||||||||||||||||||||||
1665 | QPointF br; | - | ||||||||||||||||||||||||
1666 | QPointF bl; | - | ||||||||||||||||||||||||
1667 | if (!d->identityMatrix
| 0 | ||||||||||||||||||||||||
1668 | const QTransform &x = d->matrix; | - | ||||||||||||||||||||||||
1669 | tl = x.map(rect.topLeft()); | - | ||||||||||||||||||||||||
1670 | tr = x.map(rect.topRight()); | - | ||||||||||||||||||||||||
1671 | br = x.map(rect.bottomRight()); | - | ||||||||||||||||||||||||
1672 | bl = x.map(rect.bottomLeft()); | - | ||||||||||||||||||||||||
1673 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1674 | tl = rect.topLeft(); | - | ||||||||||||||||||||||||
1675 | tr = rect.topRight(); | - | ||||||||||||||||||||||||
1676 | br = rect.bottomRight(); | - | ||||||||||||||||||||||||
1677 | bl = rect.bottomLeft(); | - | ||||||||||||||||||||||||
1678 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1679 | QPointF scrollOffset(d->horizontalScroll(), d->verticalScroll()); | - | ||||||||||||||||||||||||
1680 | tl -= scrollOffset; | - | ||||||||||||||||||||||||
1681 | tr -= scrollOffset; | - | ||||||||||||||||||||||||
1682 | br -= scrollOffset; | - | ||||||||||||||||||||||||
1683 | bl -= scrollOffset; | - | ||||||||||||||||||||||||
1684 | - | |||||||||||||||||||||||||
1685 | QPolygon poly(4); | - | ||||||||||||||||||||||||
1686 | poly[0] = tl.toPoint(); | - | ||||||||||||||||||||||||
1687 | poly[1] = tr.toPoint(); | - | ||||||||||||||||||||||||
1688 | poly[2] = br.toPoint(); | - | ||||||||||||||||||||||||
1689 | poly[3] = bl.toPoint(); | - | ||||||||||||||||||||||||
1690 | return never executed: poly;return poly; never executed: return poly; | 0 | ||||||||||||||||||||||||
1691 | } | - | ||||||||||||||||||||||||
1692 | QPolygon QGraphicsView::mapFromScene(const QPolygonF &polygon) const | - | ||||||||||||||||||||||||
1693 | { | - | ||||||||||||||||||||||||
1694 | QPolygon poly; | - | ||||||||||||||||||||||||
1695 | poly.reserve(polygon.count()); | - | ||||||||||||||||||||||||
1696 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(polygon)>::type> _container_((polygon)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QPointF &point = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||
1697 | poly << mapFromScene(point); never executed: poly << mapFromScene(point); | 0 | ||||||||||||||||||||||||
1698 | return never executed: poly;return poly; never executed: return poly; | 0 | ||||||||||||||||||||||||
1699 | } | - | ||||||||||||||||||||||||
1700 | - | |||||||||||||||||||||||||
1701 | - | |||||||||||||||||||||||||
1702 | - | |||||||||||||||||||||||||
1703 | - | |||||||||||||||||||||||||
1704 | - | |||||||||||||||||||||||||
1705 | - | |||||||||||||||||||||||||
1706 | - | |||||||||||||||||||||||||
1707 | QPainterPath QGraphicsView::mapFromScene(const QPainterPath &path) const | - | ||||||||||||||||||||||||
1708 | { | - | ||||||||||||||||||||||||
1709 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1710 | QTransform matrix = d->matrix; | - | ||||||||||||||||||||||||
1711 | matrix *= QTransform::fromTranslate(-d->horizontalScroll(), -d->verticalScroll()); | - | ||||||||||||||||||||||||
1712 | return never executed: matrix.map(path);return matrix.map(path); never executed: return matrix.map(path); | 0 | ||||||||||||||||||||||||
1713 | } | - | ||||||||||||||||||||||||
1714 | - | |||||||||||||||||||||||||
1715 | - | |||||||||||||||||||||||||
1716 | - | |||||||||||||||||||||||||
1717 | - | |||||||||||||||||||||||||
1718 | QVariant QGraphicsView::inputMethodQuery(Qt::InputMethodQuery query) const | - | ||||||||||||||||||||||||
1719 | { | - | ||||||||||||||||||||||||
1720 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1721 | if (!d->scene
| 0 | ||||||||||||||||||||||||
1722 | return never executed: QVariant();return QVariant(); never executed: return QVariant(); | 0 | ||||||||||||||||||||||||
1723 | - | |||||||||||||||||||||||||
1724 | QVariant value = d->scene->inputMethodQuery(query); | - | ||||||||||||||||||||||||
1725 | if (value.type() == QVariant::RectF
| 0 | ||||||||||||||||||||||||
1726 | value = d->mapRectFromScene(value.toRectF()); never executed: value = d->mapRectFromScene(value.toRectF()); | 0 | ||||||||||||||||||||||||
1727 | else if (value.type() == QVariant::PointF
| 0 | ||||||||||||||||||||||||
1728 | value = mapFromScene(value.toPointF()); never executed: value = mapFromScene(value.toPointF()); | 0 | ||||||||||||||||||||||||
1729 | else if (value.type() == QVariant::Rect
| 0 | ||||||||||||||||||||||||
1730 | value = d->mapRectFromScene(value.toRect()).toRect(); never executed: value = d->mapRectFromScene(value.toRect()).toRect(); | 0 | ||||||||||||||||||||||||
1731 | else if (value.type() == QVariant::Point
| 0 | ||||||||||||||||||||||||
1732 | value = mapFromScene(value.toPoint()); never executed: value = mapFromScene(value.toPoint()); | 0 | ||||||||||||||||||||||||
1733 | return never executed: value;return value; never executed: return value; | 0 | ||||||||||||||||||||||||
1734 | } | - | ||||||||||||||||||||||||
1735 | QBrush QGraphicsView::backgroundBrush() const | - | ||||||||||||||||||||||||
1736 | { | - | ||||||||||||||||||||||||
1737 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1738 | return never executed: d->backgroundBrush;return d->backgroundBrush; never executed: return d->backgroundBrush; | 0 | ||||||||||||||||||||||||
1739 | } | - | ||||||||||||||||||||||||
1740 | void QGraphicsView::setBackgroundBrush(const QBrush &brush) | - | ||||||||||||||||||||||||
1741 | { | - | ||||||||||||||||||||||||
1742 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1743 | d->backgroundBrush = brush; | - | ||||||||||||||||||||||||
1744 | d->updateAll(); | - | ||||||||||||||||||||||||
1745 | - | |||||||||||||||||||||||||
1746 | if (d->cacheMode & CacheBackground
| 0 | ||||||||||||||||||||||||
1747 | - | |||||||||||||||||||||||||
1748 | d->mustResizeBackgroundPixmap = true; | - | ||||||||||||||||||||||||
1749 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1750 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1751 | QBrush QGraphicsView::foregroundBrush() const | - | ||||||||||||||||||||||||
1752 | { | - | ||||||||||||||||||||||||
1753 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1754 | return never executed: d->foregroundBrush;return d->foregroundBrush; never executed: return d->foregroundBrush; | 0 | ||||||||||||||||||||||||
1755 | } | - | ||||||||||||||||||||||||
1756 | void QGraphicsView::setForegroundBrush(const QBrush &brush) | - | ||||||||||||||||||||||||
1757 | { | - | ||||||||||||||||||||||||
1758 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1759 | d->foregroundBrush = brush; | - | ||||||||||||||||||||||||
1760 | d->updateAll(); | - | ||||||||||||||||||||||||
1761 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1762 | - | |||||||||||||||||||||||||
1763 | - | |||||||||||||||||||||||||
1764 | - | |||||||||||||||||||||||||
1765 | - | |||||||||||||||||||||||||
1766 | - | |||||||||||||||||||||||||
1767 | - | |||||||||||||||||||||||||
1768 | void QGraphicsView::updateScene(const QList<QRectF> &rects) | - | ||||||||||||||||||||||||
1769 | { | - | ||||||||||||||||||||||||
1770 | - | |||||||||||||||||||||||||
1771 | - | |||||||||||||||||||||||||
1772 | - | |||||||||||||||||||||||||
1773 | - | |||||||||||||||||||||||||
1774 | - | |||||||||||||||||||||||||
1775 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1776 | if (d->fullUpdatePending
| 0 | ||||||||||||||||||||||||
1777 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1778 | - | |||||||||||||||||||||||||
1779 | - | |||||||||||||||||||||||||
1780 | QVector<QRect> dirtyViewportRects; | - | ||||||||||||||||||||||||
1781 | const QVector<QRect> &dirtyRects = d->dirtyRegion.rects(); | - | ||||||||||||||||||||||||
1782 | const int dirtyRectsCount = dirtyRects.size(); | - | ||||||||||||||||||||||||
1783 | dirtyViewportRects.reserve(dirtyRectsCount + rects.count()); | - | ||||||||||||||||||||||||
1784 | for (int i = 0; i < dirtyRectsCount
| 0 | ||||||||||||||||||||||||
1785 | dirtyViewportRects += dirtyRects.at(i); never executed: dirtyViewportRects += dirtyRects.at(i); | 0 | ||||||||||||||||||||||||
1786 | d->dirtyRegion = QRegion(); | - | ||||||||||||||||||||||||
1787 | d->dirtyBoundingRect = QRect(); | - | ||||||||||||||||||||||||
1788 | - | |||||||||||||||||||||||||
1789 | bool fullUpdate = !d->accelerateScrolling
| 0 | ||||||||||||||||||||||||
1790 | bool boundingRectUpdate = (
| 0 | ||||||||||||||||||||||||
1791 | || (d->viewportUpdateMode == QGraphicsView::SmartViewportUpdate
| 0 | ||||||||||||||||||||||||
1792 | && ((
| 0 | ||||||||||||||||||||||||
1793 | - | |||||||||||||||||||||||||
1794 | QRegion updateRegion; | - | ||||||||||||||||||||||||
1795 | QRect boundingRect; | - | ||||||||||||||||||||||||
1796 | QRect viewportRect = viewport()->rect(); | - | ||||||||||||||||||||||||
1797 | bool redraw = false; | - | ||||||||||||||||||||||||
1798 | QTransform transform = viewportTransform(); | - | ||||||||||||||||||||||||
1799 | - | |||||||||||||||||||||||||
1800 | - | |||||||||||||||||||||||||
1801 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(rects)>::type> _container_((rects)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QRectF &rect = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||
1802 | QRect xrect = transform.mapRect(rect).toAlignedRect(); | - | ||||||||||||||||||||||||
1803 | if (!(d->optimizationFlags & DontAdjustForAntialiasing)
| 0 | ||||||||||||||||||||||||
1804 | xrect.adjust(-2, -2, 2, 2); never executed: xrect.adjust(-2, -2, 2, 2); | 0 | ||||||||||||||||||||||||
1805 | else | - | ||||||||||||||||||||||||
1806 | xrect.adjust(-1, -1, 1, 1); never executed: xrect.adjust(-1, -1, 1, 1); | 0 | ||||||||||||||||||||||||
1807 | if (!viewportRect.intersects(xrect)
| 0 | ||||||||||||||||||||||||
1808 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
1809 | dirtyViewportRects << xrect; | - | ||||||||||||||||||||||||
1810 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1811 | - | |||||||||||||||||||||||||
1812 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(dirtyViewportRects)>::type> _container_((dirtyViewportRects)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QRect &rect = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||
1813 | - | |||||||||||||||||||||||||
1814 | - | |||||||||||||||||||||||||
1815 | if (!boundingRectUpdate
| 0 | ||||||||||||||||||||||||
1816 | updateRegion += rect; | - | ||||||||||||||||||||||||
1817 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1818 | boundingRect |= rect; | - | ||||||||||||||||||||||||
1819 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1820 | redraw = true; | - | ||||||||||||||||||||||||
1821 | if (fullUpdate
| 0 | ||||||||||||||||||||||||
1822 | - | |||||||||||||||||||||||||
1823 | - | |||||||||||||||||||||||||
1824 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1825 | } | - | ||||||||||||||||||||||||
1826 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1827 | - | |||||||||||||||||||||||||
1828 | if (!redraw
| 0 | ||||||||||||||||||||||||
1829 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1830 | - | |||||||||||||||||||||||||
1831 | if (fullUpdate
| 0 | ||||||||||||||||||||||||
1832 | viewport()->update(); never executed: viewport()->update(); | 0 | ||||||||||||||||||||||||
1833 | else if (boundingRectUpdate
| 0 | ||||||||||||||||||||||||
1834 | viewport()->update(boundingRect); never executed: viewport()->update(boundingRect); | 0 | ||||||||||||||||||||||||
1835 | else | - | ||||||||||||||||||||||||
1836 | viewport()->update(updateRegion); never executed: viewport()->update(updateRegion); | 0 | ||||||||||||||||||||||||
1837 | } | - | ||||||||||||||||||||||||
1838 | void QGraphicsView::updateSceneRect(const QRectF &rect) | - | ||||||||||||||||||||||||
1839 | { | - | ||||||||||||||||||||||||
1840 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1841 | if (!d->hasSceneRect
| 0 | ||||||||||||||||||||||||
1842 | d->sceneRect = rect; | - | ||||||||||||||||||||||||
1843 | d->recalculateContentSize(); | - | ||||||||||||||||||||||||
1844 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1845 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1846 | void QGraphicsView::setupViewport(QWidget *widget) | - | ||||||||||||||||||||||||
1847 | { | - | ||||||||||||||||||||||||
1848 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1849 | - | |||||||||||||||||||||||||
1850 | if (!widget
| 0 | ||||||||||||||||||||||||
1851 | QMessageLogger(__FILE__, 2763, __PRETTY_FUNCTION__).warning("QGraphicsView::setupViewport: cannot initialize null widget"); | - | ||||||||||||||||||||||||
1852 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1853 | } | - | ||||||||||||||||||||||||
1854 | - | |||||||||||||||||||||||||
1855 | const bool isGLWidget = widget->inherits("QGLWidget")
| 0 | ||||||||||||||||||||||||
1856 | - | |||||||||||||||||||||||||
1857 | d->accelerateScrolling = !(isGLWidget); | - | ||||||||||||||||||||||||
1858 | - | |||||||||||||||||||||||||
1859 | widget->setFocusPolicy(Qt::StrongFocus); | - | ||||||||||||||||||||||||
1860 | - | |||||||||||||||||||||||||
1861 | if (!isGLWidget
| 0 | ||||||||||||||||||||||||
1862 | - | |||||||||||||||||||||||||
1863 | widget->setAutoFillBackground(true); | - | ||||||||||||||||||||||||
1864 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1865 | - | |||||||||||||||||||||||||
1866 | - | |||||||||||||||||||||||||
1867 | - | |||||||||||||||||||||||||
1868 | - | |||||||||||||||||||||||||
1869 | if ((d->scene
| 0 | ||||||||||||||||||||||||
1870 | || !d->scene->d_func()->allItemsUseDefaultCursor
| 0 | ||||||||||||||||||||||||
1871 | || d->transformationAnchor == AnchorUnderMouse
| 0 | ||||||||||||||||||||||||
1872 | || d->resizeAnchor == AnchorUnderMouse
| 0 | ||||||||||||||||||||||||
1873 | widget->setMouseTracking(true); | - | ||||||||||||||||||||||||
1874 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1875 | - | |||||||||||||||||||||||||
1876 | - | |||||||||||||||||||||||||
1877 | if (d->scene
| 0 | ||||||||||||||||||||||||
1878 | widget->setAttribute(Qt::WA_AcceptTouchEvents); never executed: widget->setAttribute(Qt::WA_AcceptTouchEvents); | 0 | ||||||||||||||||||||||||
1879 | - | |||||||||||||||||||||||||
1880 | - | |||||||||||||||||||||||||
1881 | if (d->scene
| 0 | ||||||||||||||||||||||||
1882 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(d->scene->d_func()->grabbedGestures.keys())>::type> _container_((d->scene->d_func()->grabbedGestures.keys())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (Qt::GestureType gesture = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||
1883 | widget->grabGesture(gesture); never executed: widget->grabGesture(gesture); | 0 | ||||||||||||||||||||||||
1884 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1885 | - | |||||||||||||||||||||||||
1886 | - | |||||||||||||||||||||||||
1887 | widget->setAcceptDrops(acceptDrops()); | - | ||||||||||||||||||||||||
1888 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1889 | - | |||||||||||||||||||||||||
1890 | - | |||||||||||||||||||||||||
1891 | - | |||||||||||||||||||||||||
1892 | - | |||||||||||||||||||||||||
1893 | bool QGraphicsView::event(QEvent *event) | - | ||||||||||||||||||||||||
1894 | { | - | ||||||||||||||||||||||||
1895 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1896 | - | |||||||||||||||||||||||||
1897 | if (d->sceneInteractionAllowed
| 0 | ||||||||||||||||||||||||
1898 | switch (event->type()) { | - | ||||||||||||||||||||||||
1899 | case never executed: QEvent::ShortcutOverride:case QEvent::ShortcutOverride: never executed: case QEvent::ShortcutOverride: | 0 | ||||||||||||||||||||||||
1900 | if (d->scene
| 0 | ||||||||||||||||||||||||
1901 | return never executed: QApplication::sendEvent(d->scene, event);return QApplication::sendEvent(d->scene, event); never executed: return QApplication::sendEvent(d->scene, event); | 0 | ||||||||||||||||||||||||
1902 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1903 | case never executed: QEvent::KeyPress:case QEvent::KeyPress: never executed: case QEvent::KeyPress: | 0 | ||||||||||||||||||||||||
1904 | if (d->scene
| 0 | ||||||||||||||||||||||||
1905 | QKeyEvent *k = static_cast<QKeyEvent *>(event); | - | ||||||||||||||||||||||||
1906 | if (k->key() == Qt::Key_Tab
| 0 | ||||||||||||||||||||||||
1907 | - | |||||||||||||||||||||||||
1908 | - | |||||||||||||||||||||||||
1909 | - | |||||||||||||||||||||||||
1910 | - | |||||||||||||||||||||||||
1911 | - | |||||||||||||||||||||||||
1912 | - | |||||||||||||||||||||||||
1913 | QApplication::sendEvent(d->scene, event); | - | ||||||||||||||||||||||||
1914 | if (event->isAccepted()
| 0 | ||||||||||||||||||||||||
1915 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1916 | - | |||||||||||||||||||||||||
1917 | - | |||||||||||||||||||||||||
1918 | - | |||||||||||||||||||||||||
1919 | event->accept(); | - | ||||||||||||||||||||||||
1920 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1921 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1922 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1923 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
1924 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1925 | } | - | ||||||||||||||||||||||||
1926 | } | - | ||||||||||||||||||||||||
1927 | - | |||||||||||||||||||||||||
1928 | return never executed: QAbstractScrollArea::event(event);return QAbstractScrollArea::event(event); never executed: return QAbstractScrollArea::event(event); | 0 | ||||||||||||||||||||||||
1929 | } | - | ||||||||||||||||||||||||
1930 | - | |||||||||||||||||||||||||
1931 | - | |||||||||||||||||||||||||
1932 | - | |||||||||||||||||||||||||
1933 | - | |||||||||||||||||||||||||
1934 | bool QGraphicsView::viewportEvent(QEvent *event) | - | ||||||||||||||||||||||||
1935 | { | - | ||||||||||||||||||||||||
1936 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
1937 | if (!d->scene
| 0 | ||||||||||||||||||||||||
1938 | return never executed: QAbstractScrollArea::viewportEvent(event);return QAbstractScrollArea::viewportEvent(event); never executed: return QAbstractScrollArea::viewportEvent(event); | 0 | ||||||||||||||||||||||||
1939 | - | |||||||||||||||||||||||||
1940 | switch (event->type()) { | - | ||||||||||||||||||||||||
1941 | case never executed: QEvent::Enter:case QEvent::Enter: never executed: case QEvent::Enter: | 0 | ||||||||||||||||||||||||
1942 | QApplication::sendEvent(d->scene, event); | - | ||||||||||||||||||||||||
1943 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1944 | case never executed: QEvent::WindowActivate:case QEvent::WindowActivate: never executed: case QEvent::WindowActivate: | 0 | ||||||||||||||||||||||||
1945 | QApplication::sendEvent(d->scene, event); | - | ||||||||||||||||||||||||
1946 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1947 | case never executed: QEvent::WindowDeactivate:case QEvent::WindowDeactivate: never executed: case QEvent::WindowDeactivate: | 0 | ||||||||||||||||||||||||
1948 | - | |||||||||||||||||||||||||
1949 | - | |||||||||||||||||||||||||
1950 | - | |||||||||||||||||||||||||
1951 | - | |||||||||||||||||||||||||
1952 | if (!d->scene->d_func()->popupWidgets.isEmpty()
| 0 | ||||||||||||||||||||||||
1953 | d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.first()); never executed: d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.first()); | 0 | ||||||||||||||||||||||||
1954 | QApplication::sendEvent(d->scene, event); | - | ||||||||||||||||||||||||
1955 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1956 | case never executed: QEvent::Show:case QEvent::Show: never executed: case QEvent::Show: | 0 | ||||||||||||||||||||||||
1957 | if (d->scene
| 0 | ||||||||||||||||||||||||
1958 | QEvent windowActivate(QEvent::WindowActivate); | - | ||||||||||||||||||||||||
1959 | QApplication::sendEvent(d->scene, &windowActivate); | - | ||||||||||||||||||||||||
1960 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1961 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1962 | case never executed: QEvent::Hide:case QEvent::Hide: never executed: case QEvent::Hide: | 0 | ||||||||||||||||||||||||
1963 | - | |||||||||||||||||||||||||
1964 | if (!event->spontaneous()
| 0 | ||||||||||||||||||||||||
1965 | QEvent windowDeactivate(QEvent::WindowDeactivate); | - | ||||||||||||||||||||||||
1966 | QApplication::sendEvent(d->scene, &windowDeactivate); | - | ||||||||||||||||||||||||
1967 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1968 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1969 | case never executed: QEvent::Leave:case QEvent::Leave: never executed: {case QEvent::Leave: | 0 | ||||||||||||||||||||||||
1970 | - | |||||||||||||||||||||||||
1971 | - | |||||||||||||||||||||||||
1972 | - | |||||||||||||||||||||||||
1973 | if ((QApplication::activePopupWidget()
| 0 | ||||||||||||||||||||||||
1974 | || (QApplication::activeModalWidget()
| 0 | ||||||||||||||||||||||||
1975 | || (
| 0 | ||||||||||||||||||||||||
1976 | if (!d->scene->d_func()->popupWidgets.isEmpty()
| 0 | ||||||||||||||||||||||||
1977 | d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.first()); never executed: d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.first()); | 0 | ||||||||||||||||||||||||
1978 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1979 | d->useLastMouseEvent = false; | - | ||||||||||||||||||||||||
1980 | - | |||||||||||||||||||||||||
1981 | ((!(event->d == 0)) ? qt_assert("event->d == 0",__FILE__,2893) : qt_noop()); | - | ||||||||||||||||||||||||
1982 | QScopedValueRollback<QEventPrivate *> rb(event->d); | - | ||||||||||||||||||||||||
1983 | event->d = reinterpret_cast<QEventPrivate *>(viewport()); | - | ||||||||||||||||||||||||
1984 | QApplication::sendEvent(d->scene, event); | - | ||||||||||||||||||||||||
1985 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1986 | } | - | ||||||||||||||||||||||||
1987 | - | |||||||||||||||||||||||||
1988 | case never executed: QEvent::ToolTip:case QEvent::ToolTip: never executed: {case QEvent::ToolTip: | 0 | ||||||||||||||||||||||||
1989 | QHelpEvent *toolTip = static_cast<QHelpEvent *>(event); | - | ||||||||||||||||||||||||
1990 | QGraphicsSceneHelpEvent helpEvent(QEvent::GraphicsSceneHelp); | - | ||||||||||||||||||||||||
1991 | helpEvent.setWidget(viewport()); | - | ||||||||||||||||||||||||
1992 | helpEvent.setScreenPos(toolTip->globalPos()); | - | ||||||||||||||||||||||||
1993 | helpEvent.setScenePos(mapToScene(toolTip->pos())); | - | ||||||||||||||||||||||||
1994 | QApplication::sendEvent(d->scene, &helpEvent); | - | ||||||||||||||||||||||||
1995 | toolTip->setAccepted(helpEvent.isAccepted()); | - | ||||||||||||||||||||||||
1996 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1997 | } | - | ||||||||||||||||||||||||
1998 | - | |||||||||||||||||||||||||
1999 | case never executed: QEvent::Paint:case QEvent::Paint: never executed: case QEvent::Paint: | 0 | ||||||||||||||||||||||||
2000 | - | |||||||||||||||||||||||||
2001 | d->fullUpdatePending = false; | - | ||||||||||||||||||||||||
2002 | d->dirtyScrollOffset = QPoint(); | - | ||||||||||||||||||||||||
2003 | if (d->scene
| 0 | ||||||||||||||||||||||||
2004 | - | |||||||||||||||||||||||||
2005 | - | |||||||||||||||||||||||||
2006 | - | |||||||||||||||||||||||||
2007 | if (!d->updateSceneSlotReimplementedChecked
| 0 | ||||||||||||||||||||||||
2008 | d->updateSceneSlotReimplementedChecked = true; | - | ||||||||||||||||||||||||
2009 | const QMetaObject *mo = metaObject(); | - | ||||||||||||||||||||||||
2010 | if (mo != &QGraphicsView::staticMetaObject
| 0 | ||||||||||||||||||||||||
2011 | if (mo->indexOfSlot("updateScene(QList<QRectF>)")
| 0 | ||||||||||||||||||||||||
2012 | != QGraphicsView::staticMetaObject.indexOfSlot("updateScene(QList<QRectF>)")
| 0 | ||||||||||||||||||||||||
2013 | connect(d->scene, qFlagLocation("2""changed(QList<QRectF>)" "\0" __FILE__ ":" "2925"), | - | ||||||||||||||||||||||||
2014 | this, qFlagLocation("1""updateScene(QList<QRectF>)" "\0" __FILE__ ":" "2926")); | - | ||||||||||||||||||||||||
2015 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2016 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2017 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2018 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2019 | break; never executed: break; | 0 | ||||||||||||||||||||||||
2020 | case never executed: QEvent::TouchBegin:case QEvent::TouchBegin: never executed: case QEvent::TouchBegin: | 0 | ||||||||||||||||||||||||
2021 | case never executed: QEvent::TouchUpdate:case QEvent::TouchUpdate: never executed: case QEvent::TouchUpdate: | 0 | ||||||||||||||||||||||||
2022 | case never executed: QEvent::TouchEnd:case QEvent::TouchEnd: never executed: case QEvent::TouchEnd: | 0 | ||||||||||||||||||||||||
2023 | { | - | ||||||||||||||||||||||||
2024 | if (!isEnabled()
| 0 | ||||||||||||||||||||||||
2025 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
2026 | - | |||||||||||||||||||||||||
2027 | if (d->scene
| 0 | ||||||||||||||||||||||||
2028 | - | |||||||||||||||||||||||||
2029 | QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event); | - | ||||||||||||||||||||||||
2030 | touchEvent->setTarget(viewport()); | - | ||||||||||||||||||||||||
2031 | QGraphicsViewPrivate::translateTouchEvent(d, touchEvent); | - | ||||||||||||||||||||||||
2032 | (void) QApplication::sendEvent(d->scene, touchEvent); | - | ||||||||||||||||||||||||
2033 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
2034 | event->ignore(); | - | ||||||||||||||||||||||||
2035 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2036 | - | |||||||||||||||||||||||||
2037 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
2038 | } | - | ||||||||||||||||||||||||
2039 | - | |||||||||||||||||||||||||
2040 | case never executed: QEvent::Gesture:case QEvent::Gesture: never executed: case QEvent::Gesture: | 0 | ||||||||||||||||||||||||
2041 | case never executed: QEvent::GestureOverride:case QEvent::GestureOverride: never executed: case QEvent::GestureOverride: | 0 | ||||||||||||||||||||||||
2042 | { | - | ||||||||||||||||||||||||
2043 | if (!isEnabled()
| 0 | ||||||||||||||||||||||||
2044 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
2045 | - | |||||||||||||||||||||||||
2046 | if (d->scene
| 0 | ||||||||||||||||||||||||
2047 | QGestureEvent *gestureEvent = static_cast<QGestureEvent *>(event); | - | ||||||||||||||||||||||||
2048 | gestureEvent->setWidget(viewport()); | - | ||||||||||||||||||||||||
2049 | (void) QApplication::sendEvent(d->scene, gestureEvent); | - | ||||||||||||||||||||||||
2050 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2051 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
2052 | } | - | ||||||||||||||||||||||||
2053 | - | |||||||||||||||||||||||||
2054 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
2055 | break; never executed: break; | 0 | ||||||||||||||||||||||||
2056 | } | - | ||||||||||||||||||||||||
2057 | - | |||||||||||||||||||||||||
2058 | return never executed: QAbstractScrollArea::viewportEvent(event);return QAbstractScrollArea::viewportEvent(event); never executed: return QAbstractScrollArea::viewportEvent(event); | 0 | ||||||||||||||||||||||||
2059 | } | - | ||||||||||||||||||||||||
2060 | - | |||||||||||||||||||||||||
2061 | - | |||||||||||||||||||||||||
2062 | - | |||||||||||||||||||||||||
2063 | - | |||||||||||||||||||||||||
2064 | - | |||||||||||||||||||||||||
2065 | void QGraphicsView::contextMenuEvent(QContextMenuEvent *event) | - | ||||||||||||||||||||||||
2066 | { | - | ||||||||||||||||||||||||
2067 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2068 | if (!d->scene
| 0 | ||||||||||||||||||||||||
2069 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2070 | - | |||||||||||||||||||||||||
2071 | d->mousePressViewPoint = event->pos(); | - | ||||||||||||||||||||||||
2072 | d->mousePressScenePoint = mapToScene(d->mousePressViewPoint); | - | ||||||||||||||||||||||||
2073 | d->mousePressScreenPoint = event->globalPos(); | - | ||||||||||||||||||||||||
2074 | d->lastMouseMoveScenePoint = d->mousePressScenePoint; | - | ||||||||||||||||||||||||
2075 | d->lastMouseMoveScreenPoint = d->mousePressScreenPoint; | - | ||||||||||||||||||||||||
2076 | - | |||||||||||||||||||||||||
2077 | QGraphicsSceneContextMenuEvent contextEvent(QEvent::GraphicsSceneContextMenu); | - | ||||||||||||||||||||||||
2078 | contextEvent.setWidget(viewport()); | - | ||||||||||||||||||||||||
2079 | contextEvent.setScenePos(d->mousePressScenePoint); | - | ||||||||||||||||||||||||
2080 | contextEvent.setScreenPos(d->mousePressScreenPoint); | - | ||||||||||||||||||||||||
2081 | contextEvent.setModifiers(event->modifiers()); | - | ||||||||||||||||||||||||
2082 | contextEvent.setReason((QGraphicsSceneContextMenuEvent::Reason)(event->reason())); | - | ||||||||||||||||||||||||
2083 | contextEvent.setAccepted(event->isAccepted()); | - | ||||||||||||||||||||||||
2084 | QApplication::sendEvent(d->scene, &contextEvent); | - | ||||||||||||||||||||||||
2085 | event->setAccepted(contextEvent.isAccepted()); | - | ||||||||||||||||||||||||
2086 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2087 | - | |||||||||||||||||||||||||
2088 | - | |||||||||||||||||||||||||
2089 | - | |||||||||||||||||||||||||
2090 | - | |||||||||||||||||||||||||
2091 | - | |||||||||||||||||||||||||
2092 | void QGraphicsView::dropEvent(QDropEvent *event) | - | ||||||||||||||||||||||||
2093 | { | - | ||||||||||||||||||||||||
2094 | - | |||||||||||||||||||||||||
2095 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2096 | if (!d->scene
| 0 | ||||||||||||||||||||||||
2097 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2098 | - | |||||||||||||||||||||||||
2099 | - | |||||||||||||||||||||||||
2100 | QGraphicsSceneDragDropEvent sceneEvent(QEvent::GraphicsSceneDrop); | - | ||||||||||||||||||||||||
2101 | d->populateSceneDragDropEvent(&sceneEvent, event); | - | ||||||||||||||||||||||||
2102 | - | |||||||||||||||||||||||||
2103 | - | |||||||||||||||||||||||||
2104 | QApplication::sendEvent(d->scene, &sceneEvent); | - | ||||||||||||||||||||||||
2105 | - | |||||||||||||||||||||||||
2106 | - | |||||||||||||||||||||||||
2107 | event->setAccepted(sceneEvent.isAccepted()); | - | ||||||||||||||||||||||||
2108 | if (sceneEvent.isAccepted()
| 0 | ||||||||||||||||||||||||
2109 | event->setDropAction(sceneEvent.dropAction()); never executed: event->setDropAction(sceneEvent.dropAction()); | 0 | ||||||||||||||||||||||||
2110 | - | |||||||||||||||||||||||||
2111 | delete d->lastDragDropEvent; | - | ||||||||||||||||||||||||
2112 | d->lastDragDropEvent = 0; | - | ||||||||||||||||||||||||
2113 | - | |||||||||||||||||||||||||
2114 | - | |||||||||||||||||||||||||
2115 | - | |||||||||||||||||||||||||
2116 | - | |||||||||||||||||||||||||
2117 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2118 | - | |||||||||||||||||||||||||
2119 | - | |||||||||||||||||||||||||
2120 | - | |||||||||||||||||||||||||
2121 | - | |||||||||||||||||||||||||
2122 | void QGraphicsView::dragEnterEvent(QDragEnterEvent *event) | - | ||||||||||||||||||||||||
2123 | { | - | ||||||||||||||||||||||||
2124 | - | |||||||||||||||||||||||||
2125 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2126 | if (!d->scene
| 0 | ||||||||||||||||||||||||
2127 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2128 | - | |||||||||||||||||||||||||
2129 | - | |||||||||||||||||||||||||
2130 | d->useLastMouseEvent = false; | - | ||||||||||||||||||||||||
2131 | - | |||||||||||||||||||||||||
2132 | - | |||||||||||||||||||||||||
2133 | QGraphicsSceneDragDropEvent sceneEvent(QEvent::GraphicsSceneDragEnter); | - | ||||||||||||||||||||||||
2134 | d->populateSceneDragDropEvent(&sceneEvent, event); | - | ||||||||||||||||||||||||
2135 | - | |||||||||||||||||||||||||
2136 | - | |||||||||||||||||||||||||
2137 | d->storeDragDropEvent(&sceneEvent); | - | ||||||||||||||||||||||||
2138 | - | |||||||||||||||||||||||||
2139 | - | |||||||||||||||||||||||||
2140 | QApplication::sendEvent(d->scene, &sceneEvent); | - | ||||||||||||||||||||||||
2141 | - | |||||||||||||||||||||||||
2142 | - | |||||||||||||||||||||||||
2143 | if (sceneEvent.isAccepted()
| 0 | ||||||||||||||||||||||||
2144 | event->setAccepted(true); | - | ||||||||||||||||||||||||
2145 | event->setDropAction(sceneEvent.dropAction()); | - | ||||||||||||||||||||||||
2146 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2147 | - | |||||||||||||||||||||||||
2148 | - | |||||||||||||||||||||||||
2149 | - | |||||||||||||||||||||||||
2150 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2151 | - | |||||||||||||||||||||||||
2152 | - | |||||||||||||||||||||||||
2153 | - | |||||||||||||||||||||||||
2154 | - | |||||||||||||||||||||||||
2155 | void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *event) | - | ||||||||||||||||||||||||
2156 | { | - | ||||||||||||||||||||||||
2157 | - | |||||||||||||||||||||||||
2158 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2159 | if (!d->scene
| 0 | ||||||||||||||||||||||||
2160 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2161 | if (!d->lastDragDropEvent
| 0 | ||||||||||||||||||||||||
2162 | QMessageLogger(__FILE__, 3074, __PRETTY_FUNCTION__).warning("QGraphicsView::dragLeaveEvent: drag leave received before drag enter"); | - | ||||||||||||||||||||||||
2163 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2164 | } | - | ||||||||||||||||||||||||
2165 | - | |||||||||||||||||||||||||
2166 | - | |||||||||||||||||||||||||
2167 | QGraphicsSceneDragDropEvent sceneEvent(QEvent::GraphicsSceneDragLeave); | - | ||||||||||||||||||||||||
2168 | sceneEvent.setScenePos(d->lastDragDropEvent->scenePos()); | - | ||||||||||||||||||||||||
2169 | sceneEvent.setScreenPos(d->lastDragDropEvent->screenPos()); | - | ||||||||||||||||||||||||
2170 | sceneEvent.setButtons(d->lastDragDropEvent->buttons()); | - | ||||||||||||||||||||||||
2171 | sceneEvent.setModifiers(d->lastDragDropEvent->modifiers()); | - | ||||||||||||||||||||||||
2172 | sceneEvent.setPossibleActions(d->lastDragDropEvent->possibleActions()); | - | ||||||||||||||||||||||||
2173 | sceneEvent.setProposedAction(d->lastDragDropEvent->proposedAction()); | - | ||||||||||||||||||||||||
2174 | sceneEvent.setDropAction(d->lastDragDropEvent->dropAction()); | - | ||||||||||||||||||||||||
2175 | sceneEvent.setMimeData(d->lastDragDropEvent->mimeData()); | - | ||||||||||||||||||||||||
2176 | sceneEvent.setWidget(d->lastDragDropEvent->widget()); | - | ||||||||||||||||||||||||
2177 | sceneEvent.setSource(d->lastDragDropEvent->source()); | - | ||||||||||||||||||||||||
2178 | delete d->lastDragDropEvent; | - | ||||||||||||||||||||||||
2179 | d->lastDragDropEvent = 0; | - | ||||||||||||||||||||||||
2180 | - | |||||||||||||||||||||||||
2181 | - | |||||||||||||||||||||||||
2182 | QApplication::sendEvent(d->scene, &sceneEvent); | - | ||||||||||||||||||||||||
2183 | - | |||||||||||||||||||||||||
2184 | - | |||||||||||||||||||||||||
2185 | if (sceneEvent.isAccepted()
| 0 | ||||||||||||||||||||||||
2186 | event->setAccepted(true); never executed: event->setAccepted(true); | 0 | ||||||||||||||||||||||||
2187 | - | |||||||||||||||||||||||||
2188 | - | |||||||||||||||||||||||||
2189 | - | |||||||||||||||||||||||||
2190 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2191 | - | |||||||||||||||||||||||||
2192 | - | |||||||||||||||||||||||||
2193 | - | |||||||||||||||||||||||||
2194 | - | |||||||||||||||||||||||||
2195 | void QGraphicsView::dragMoveEvent(QDragMoveEvent *event) | - | ||||||||||||||||||||||||
2196 | { | - | ||||||||||||||||||||||||
2197 | - | |||||||||||||||||||||||||
2198 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2199 | if (!d->scene
| 0 | ||||||||||||||||||||||||
2200 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2201 | - | |||||||||||||||||||||||||
2202 | - | |||||||||||||||||||||||||
2203 | QGraphicsSceneDragDropEvent sceneEvent(QEvent::GraphicsSceneDragMove); | - | ||||||||||||||||||||||||
2204 | d->populateSceneDragDropEvent(&sceneEvent, event); | - | ||||||||||||||||||||||||
2205 | - | |||||||||||||||||||||||||
2206 | - | |||||||||||||||||||||||||
2207 | d->storeDragDropEvent(&sceneEvent); | - | ||||||||||||||||||||||||
2208 | - | |||||||||||||||||||||||||
2209 | - | |||||||||||||||||||||||||
2210 | QApplication::sendEvent(d->scene, &sceneEvent); | - | ||||||||||||||||||||||||
2211 | - | |||||||||||||||||||||||||
2212 | - | |||||||||||||||||||||||||
2213 | event->setAccepted(sceneEvent.isAccepted()); | - | ||||||||||||||||||||||||
2214 | if (sceneEvent.isAccepted()
| 0 | ||||||||||||||||||||||||
2215 | event->setDropAction(sceneEvent.dropAction()); never executed: event->setDropAction(sceneEvent.dropAction()); | 0 | ||||||||||||||||||||||||
2216 | - | |||||||||||||||||||||||||
2217 | - | |||||||||||||||||||||||||
2218 | - | |||||||||||||||||||||||||
2219 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2220 | - | |||||||||||||||||||||||||
2221 | - | |||||||||||||||||||||||||
2222 | - | |||||||||||||||||||||||||
2223 | - | |||||||||||||||||||||||||
2224 | void QGraphicsView::focusInEvent(QFocusEvent *event) | - | ||||||||||||||||||||||||
2225 | { | - | ||||||||||||||||||||||||
2226 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2227 | d->updateInputMethodSensitivity(); | - | ||||||||||||||||||||||||
2228 | QAbstractScrollArea::focusInEvent(event); | - | ||||||||||||||||||||||||
2229 | if (d->scene
| 0 | ||||||||||||||||||||||||
2230 | QApplication::sendEvent(d->scene, event); never executed: QApplication::sendEvent(d->scene, event); | 0 | ||||||||||||||||||||||||
2231 | - | |||||||||||||||||||||||||
2232 | if (!d->scene
| 0 | ||||||||||||||||||||||||
2233 | QAbstractScrollArea::focusInEvent(event); never executed: QAbstractScrollArea::focusInEvent(event); | 0 | ||||||||||||||||||||||||
2234 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2235 | - | |||||||||||||||||||||||||
2236 | - | |||||||||||||||||||||||||
2237 | - | |||||||||||||||||||||||||
2238 | - | |||||||||||||||||||||||||
2239 | bool QGraphicsView::focusNextPrevChild(bool next) | - | ||||||||||||||||||||||||
2240 | { | - | ||||||||||||||||||||||||
2241 | return never executed: QAbstractScrollArea::focusNextPrevChild(next);return QAbstractScrollArea::focusNextPrevChild(next); never executed: return QAbstractScrollArea::focusNextPrevChild(next); | 0 | ||||||||||||||||||||||||
2242 | } | - | ||||||||||||||||||||||||
2243 | - | |||||||||||||||||||||||||
2244 | - | |||||||||||||||||||||||||
2245 | - | |||||||||||||||||||||||||
2246 | - | |||||||||||||||||||||||||
2247 | void QGraphicsView::focusOutEvent(QFocusEvent *event) | - | ||||||||||||||||||||||||
2248 | { | - | ||||||||||||||||||||||||
2249 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2250 | QAbstractScrollArea::focusOutEvent(event); | - | ||||||||||||||||||||||||
2251 | if (d->scene
| 0 | ||||||||||||||||||||||||
2252 | QApplication::sendEvent(d->scene, event); never executed: QApplication::sendEvent(d->scene, event); | 0 | ||||||||||||||||||||||||
2253 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2254 | - | |||||||||||||||||||||||||
2255 | - | |||||||||||||||||||||||||
2256 | - | |||||||||||||||||||||||||
2257 | - | |||||||||||||||||||||||||
2258 | void QGraphicsView::keyPressEvent(QKeyEvent *event) | - | ||||||||||||||||||||||||
2259 | { | - | ||||||||||||||||||||||||
2260 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2261 | if (!d->scene
| 0 | ||||||||||||||||||||||||
2262 | QAbstractScrollArea::keyPressEvent(event); | - | ||||||||||||||||||||||||
2263 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2264 | } | - | ||||||||||||||||||||||||
2265 | QApplication::sendEvent(d->scene, event); | - | ||||||||||||||||||||||||
2266 | if (!event->isAccepted()
| 0 | ||||||||||||||||||||||||
2267 | QAbstractScrollArea::keyPressEvent(event); never executed: QAbstractScrollArea::keyPressEvent(event); | 0 | ||||||||||||||||||||||||
2268 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2269 | - | |||||||||||||||||||||||||
2270 | - | |||||||||||||||||||||||||
2271 | - | |||||||||||||||||||||||||
2272 | - | |||||||||||||||||||||||||
2273 | void QGraphicsView::keyReleaseEvent(QKeyEvent *event) | - | ||||||||||||||||||||||||
2274 | { | - | ||||||||||||||||||||||||
2275 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2276 | if (!d->scene
| 0 | ||||||||||||||||||||||||
2277 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2278 | QApplication::sendEvent(d->scene, event); | - | ||||||||||||||||||||||||
2279 | if (!event->isAccepted()
| 0 | ||||||||||||||||||||||||
2280 | QAbstractScrollArea::keyReleaseEvent(event); never executed: QAbstractScrollArea::keyReleaseEvent(event); | 0 | ||||||||||||||||||||||||
2281 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2282 | - | |||||||||||||||||||||||||
2283 | - | |||||||||||||||||||||||||
2284 | - | |||||||||||||||||||||||||
2285 | - | |||||||||||||||||||||||||
2286 | void QGraphicsView::mouseDoubleClickEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
2287 | { | - | ||||||||||||||||||||||||
2288 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2289 | if (!d->scene
| 0 | ||||||||||||||||||||||||
2290 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2291 | - | |||||||||||||||||||||||||
2292 | d->storeMouseEvent(event); | - | ||||||||||||||||||||||||
2293 | d->mousePressViewPoint = event->pos(); | - | ||||||||||||||||||||||||
2294 | d->mousePressScenePoint = mapToScene(d->mousePressViewPoint); | - | ||||||||||||||||||||||||
2295 | d->mousePressScreenPoint = event->globalPos(); | - | ||||||||||||||||||||||||
2296 | d->lastMouseMoveScenePoint = d->mousePressScenePoint; | - | ||||||||||||||||||||||||
2297 | d->lastMouseMoveScreenPoint = d->mousePressScreenPoint; | - | ||||||||||||||||||||||||
2298 | d->mousePressButton = event->button(); | - | ||||||||||||||||||||||||
2299 | - | |||||||||||||||||||||||||
2300 | QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseDoubleClick); | - | ||||||||||||||||||||||||
2301 | mouseEvent.setWidget(viewport()); | - | ||||||||||||||||||||||||
2302 | mouseEvent.setButtonDownScenePos(d->mousePressButton, d->mousePressScenePoint); | - | ||||||||||||||||||||||||
2303 | mouseEvent.setButtonDownScreenPos(d->mousePressButton, d->mousePressScreenPoint); | - | ||||||||||||||||||||||||
2304 | mouseEvent.setScenePos(mapToScene(d->mousePressViewPoint)); | - | ||||||||||||||||||||||||
2305 | mouseEvent.setScreenPos(d->mousePressScreenPoint); | - | ||||||||||||||||||||||||
2306 | mouseEvent.setLastScenePos(d->lastMouseMoveScenePoint); | - | ||||||||||||||||||||||||
2307 | mouseEvent.setLastScreenPos(d->lastMouseMoveScreenPoint); | - | ||||||||||||||||||||||||
2308 | mouseEvent.setButtons(event->buttons()); | - | ||||||||||||||||||||||||
2309 | mouseEvent.setAccepted(false); | - | ||||||||||||||||||||||||
2310 | mouseEvent.setButton(event->button()); | - | ||||||||||||||||||||||||
2311 | mouseEvent.setModifiers(event->modifiers()); | - | ||||||||||||||||||||||||
2312 | mouseEvent.setSource(event->source()); | - | ||||||||||||||||||||||||
2313 | mouseEvent.setFlags(event->flags()); | - | ||||||||||||||||||||||||
2314 | if (event->spontaneous()
| 0 | ||||||||||||||||||||||||
2315 | qt_sendSpontaneousEvent(d->scene, &mouseEvent); never executed: qt_sendSpontaneousEvent(d->scene, &mouseEvent); | 0 | ||||||||||||||||||||||||
2316 | else | - | ||||||||||||||||||||||||
2317 | QApplication::sendEvent(d->scene, &mouseEvent); never executed: QApplication::sendEvent(d->scene, &mouseEvent); | 0 | ||||||||||||||||||||||||
2318 | - | |||||||||||||||||||||||||
2319 | - | |||||||||||||||||||||||||
2320 | const bool isAccepted = mouseEvent.isAccepted(); | - | ||||||||||||||||||||||||
2321 | event->setAccepted(isAccepted); | - | ||||||||||||||||||||||||
2322 | - | |||||||||||||||||||||||||
2323 | - | |||||||||||||||||||||||||
2324 | d->lastMouseEvent.setAccepted(isAccepted); | - | ||||||||||||||||||||||||
2325 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2326 | - | |||||||||||||||||||||||||
2327 | - | |||||||||||||||||||||||||
2328 | - | |||||||||||||||||||||||||
2329 | - | |||||||||||||||||||||||||
2330 | void QGraphicsView::mousePressEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
2331 | { | - | ||||||||||||||||||||||||
2332 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2333 | - | |||||||||||||||||||||||||
2334 | - | |||||||||||||||||||||||||
2335 | - | |||||||||||||||||||||||||
2336 | - | |||||||||||||||||||||||||
2337 | d->storeMouseEvent(event); | - | ||||||||||||||||||||||||
2338 | d->lastMouseEvent.setAccepted(false); | - | ||||||||||||||||||||||||
2339 | - | |||||||||||||||||||||||||
2340 | if (d->sceneInteractionAllowed
| 0 | ||||||||||||||||||||||||
2341 | - | |||||||||||||||||||||||||
2342 | d->mousePressViewPoint = event->pos(); | - | ||||||||||||||||||||||||
2343 | d->mousePressScenePoint = mapToScene(d->mousePressViewPoint); | - | ||||||||||||||||||||||||
2344 | d->mousePressScreenPoint = event->globalPos(); | - | ||||||||||||||||||||||||
2345 | d->lastMouseMoveScenePoint = d->mousePressScenePoint; | - | ||||||||||||||||||||||||
2346 | d->lastMouseMoveScreenPoint = d->mousePressScreenPoint; | - | ||||||||||||||||||||||||
2347 | d->mousePressButton = event->button(); | - | ||||||||||||||||||||||||
2348 | - | |||||||||||||||||||||||||
2349 | if (d->scene
| 0 | ||||||||||||||||||||||||
2350 | - | |||||||||||||||||||||||||
2351 | QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMousePress); | - | ||||||||||||||||||||||||
2352 | mouseEvent.setWidget(viewport()); | - | ||||||||||||||||||||||||
2353 | mouseEvent.setButtonDownScenePos(d->mousePressButton, d->mousePressScenePoint); | - | ||||||||||||||||||||||||
2354 | mouseEvent.setButtonDownScreenPos(d->mousePressButton, d->mousePressScreenPoint); | - | ||||||||||||||||||||||||
2355 | mouseEvent.setScenePos(d->mousePressScenePoint); | - | ||||||||||||||||||||||||
2356 | mouseEvent.setScreenPos(d->mousePressScreenPoint); | - | ||||||||||||||||||||||||
2357 | mouseEvent.setLastScenePos(d->lastMouseMoveScenePoint); | - | ||||||||||||||||||||||||
2358 | mouseEvent.setLastScreenPos(d->lastMouseMoveScreenPoint); | - | ||||||||||||||||||||||||
2359 | mouseEvent.setButtons(event->buttons()); | - | ||||||||||||||||||||||||
2360 | mouseEvent.setButton(event->button()); | - | ||||||||||||||||||||||||
2361 | mouseEvent.setModifiers(event->modifiers()); | - | ||||||||||||||||||||||||
2362 | mouseEvent.setSource(event->source()); | - | ||||||||||||||||||||||||
2363 | mouseEvent.setFlags(event->flags()); | - | ||||||||||||||||||||||||
2364 | mouseEvent.setAccepted(false); | - | ||||||||||||||||||||||||
2365 | if (event->spontaneous()
| 0 | ||||||||||||||||||||||||
2366 | qt_sendSpontaneousEvent(d->scene, &mouseEvent); never executed: qt_sendSpontaneousEvent(d->scene, &mouseEvent); | 0 | ||||||||||||||||||||||||
2367 | else | - | ||||||||||||||||||||||||
2368 | QApplication::sendEvent(d->scene, &mouseEvent); never executed: QApplication::sendEvent(d->scene, &mouseEvent); | 0 | ||||||||||||||||||||||||
2369 | - | |||||||||||||||||||||||||
2370 | - | |||||||||||||||||||||||||
2371 | bool isAccepted = mouseEvent.isAccepted(); | - | ||||||||||||||||||||||||
2372 | event->setAccepted(isAccepted); | - | ||||||||||||||||||||||||
2373 | - | |||||||||||||||||||||||||
2374 | - | |||||||||||||||||||||||||
2375 | d->lastMouseEvent.setAccepted(isAccepted); | - | ||||||||||||||||||||||||
2376 | - | |||||||||||||||||||||||||
2377 | if (isAccepted
| 0 | ||||||||||||||||||||||||
2378 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2379 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2380 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2381 | - | |||||||||||||||||||||||||
2382 | - | |||||||||||||||||||||||||
2383 | if (d->dragMode == QGraphicsView::RubberBandDrag
| 0 | ||||||||||||||||||||||||
2384 | if (d->sceneInteractionAllowed
| 0 | ||||||||||||||||||||||||
2385 | - | |||||||||||||||||||||||||
2386 | event->accept(); | - | ||||||||||||||||||||||||
2387 | d->rubberBanding = true; | - | ||||||||||||||||||||||||
2388 | d->rubberBandRect = QRect(); | - | ||||||||||||||||||||||||
2389 | if (d->scene
| 0 | ||||||||||||||||||||||||
2390 | bool extendSelection = (event->modifiers() & Qt::ControlModifier) != 0; | - | ||||||||||||||||||||||||
2391 | - | |||||||||||||||||||||||||
2392 | if (extendSelection
| 0 | ||||||||||||||||||||||||
2393 | d->rubberBandSelectionOperation = Qt::AddToSelection; | - | ||||||||||||||||||||||||
2394 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
2395 | d->rubberBandSelectionOperation = Qt::ReplaceSelection; | - | ||||||||||||||||||||||||
2396 | d->scene->clearSelection(); | - | ||||||||||||||||||||||||
2397 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2398 | } | - | ||||||||||||||||||||||||
2399 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2400 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
2401 | - | |||||||||||||||||||||||||
2402 | if (d->dragMode == QGraphicsView::ScrollHandDrag
| 0 | ||||||||||||||||||||||||
2403 | - | |||||||||||||||||||||||||
2404 | event->accept(); | - | ||||||||||||||||||||||||
2405 | d->handScrolling = true; | - | ||||||||||||||||||||||||
2406 | d->handScrollMotions = 0; | - | ||||||||||||||||||||||||
2407 | - | |||||||||||||||||||||||||
2408 | viewport()->setCursor(Qt::ClosedHandCursor); | - | ||||||||||||||||||||||||
2409 | - | |||||||||||||||||||||||||
2410 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2411 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2412 | - | |||||||||||||||||||||||||
2413 | - | |||||||||||||||||||||||||
2414 | - | |||||||||||||||||||||||||
2415 | - | |||||||||||||||||||||||||
2416 | void QGraphicsView::mouseMoveEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
2417 | { | - | ||||||||||||||||||||||||
2418 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2419 | - | |||||||||||||||||||||||||
2420 | if (d->dragMode == QGraphicsView::ScrollHandDrag
| 0 | ||||||||||||||||||||||||
2421 | if (d->handScrolling
| 0 | ||||||||||||||||||||||||
2422 | QScrollBar *hBar = horizontalScrollBar(); | - | ||||||||||||||||||||||||
2423 | QScrollBar *vBar = verticalScrollBar(); | - | ||||||||||||||||||||||||
2424 | QPoint delta = event->pos() - d->lastMouseEvent.pos(); | - | ||||||||||||||||||||||||
2425 | hBar->setValue(hBar->value() + (isRightToLeft() ? delta.x() : -delta.x())); | - | ||||||||||||||||||||||||
2426 | vBar->setValue(vBar->value() - delta.y()); | - | ||||||||||||||||||||||||
2427 | - | |||||||||||||||||||||||||
2428 | - | |||||||||||||||||||||||||
2429 | - | |||||||||||||||||||||||||
2430 | ++d->handScrollMotions; | - | ||||||||||||||||||||||||
2431 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2432 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2433 | - | |||||||||||||||||||||||||
2434 | d->mouseMoveEventHandler(event); | - | ||||||||||||||||||||||||
2435 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2436 | - | |||||||||||||||||||||||||
2437 | - | |||||||||||||||||||||||||
2438 | - | |||||||||||||||||||||||||
2439 | - | |||||||||||||||||||||||||
2440 | void QGraphicsView::mouseReleaseEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
2441 | { | - | ||||||||||||||||||||||||
2442 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2443 | - | |||||||||||||||||||||||||
2444 | - | |||||||||||||||||||||||||
2445 | if (d->dragMode == QGraphicsView::RubberBandDrag
| 0 | ||||||||||||||||||||||||
2446 | if (d->rubberBanding
| 0 | ||||||||||||||||||||||||
2447 | if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate
| 0 | ||||||||||||||||||||||||
2448 | if (d->viewportUpdateMode != FullViewportUpdate
| 0 | ||||||||||||||||||||||||
2449 | viewport()->update(d->rubberBandRegion(viewport(), d->rubberBandRect)); never executed: viewport()->update(d->rubberBandRegion(viewport(), d->rubberBandRect)); | 0 | ||||||||||||||||||||||||
2450 | else | - | ||||||||||||||||||||||||
2451 | d->updateAll(); never executed: d->updateAll(); | 0 | ||||||||||||||||||||||||
2452 | } | - | ||||||||||||||||||||||||
2453 | d->rubberBanding = false; | - | ||||||||||||||||||||||||
2454 | d->rubberBandSelectionOperation = Qt::ReplaceSelection; | - | ||||||||||||||||||||||||
2455 | if (!d->rubberBandRect.isNull()
| 0 | ||||||||||||||||||||||||
2456 | d->rubberBandRect = QRect(); | - | ||||||||||||||||||||||||
2457 | rubberBandChanged(d->rubberBandRect, QPointF(), QPointF()); | - | ||||||||||||||||||||||||
2458 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2459 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2460 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
2461 | - | |||||||||||||||||||||||||
2462 | if (d->dragMode == QGraphicsView::ScrollHandDrag
| 0 | ||||||||||||||||||||||||
2463 | - | |||||||||||||||||||||||||
2464 | - | |||||||||||||||||||||||||
2465 | - | |||||||||||||||||||||||||
2466 | - | |||||||||||||||||||||||||
2467 | viewport()->setCursor(Qt::OpenHandCursor); | - | ||||||||||||||||||||||||
2468 | - | |||||||||||||||||||||||||
2469 | d->handScrolling = false; | - | ||||||||||||||||||||||||
2470 | - | |||||||||||||||||||||||||
2471 | if (d->scene
| 0 | ||||||||||||||||||||||||
2472 | - | |||||||||||||||||||||||||
2473 | - | |||||||||||||||||||||||||
2474 | - | |||||||||||||||||||||||||
2475 | d->scene->clearSelection(); | - | ||||||||||||||||||||||||
2476 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2477 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2478 | - | |||||||||||||||||||||||||
2479 | d->storeMouseEvent(event); | - | ||||||||||||||||||||||||
2480 | - | |||||||||||||||||||||||||
2481 | if (!d->sceneInteractionAllowed
| 0 | ||||||||||||||||||||||||
2482 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2483 | - | |||||||||||||||||||||||||
2484 | if (!d->scene
| 0 | ||||||||||||||||||||||||
2485 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2486 | - | |||||||||||||||||||||||||
2487 | QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseRelease); | - | ||||||||||||||||||||||||
2488 | mouseEvent.setWidget(viewport()); | - | ||||||||||||||||||||||||
2489 | mouseEvent.setButtonDownScenePos(d->mousePressButton, d->mousePressScenePoint); | - | ||||||||||||||||||||||||
2490 | mouseEvent.setButtonDownScreenPos(d->mousePressButton, d->mousePressScreenPoint); | - | ||||||||||||||||||||||||
2491 | mouseEvent.setScenePos(mapToScene(event->pos())); | - | ||||||||||||||||||||||||
2492 | mouseEvent.setScreenPos(event->globalPos()); | - | ||||||||||||||||||||||||
2493 | mouseEvent.setLastScenePos(d->lastMouseMoveScenePoint); | - | ||||||||||||||||||||||||
2494 | mouseEvent.setLastScreenPos(d->lastMouseMoveScreenPoint); | - | ||||||||||||||||||||||||
2495 | mouseEvent.setButtons(event->buttons()); | - | ||||||||||||||||||||||||
2496 | mouseEvent.setButton(event->button()); | - | ||||||||||||||||||||||||
2497 | mouseEvent.setModifiers(event->modifiers()); | - | ||||||||||||||||||||||||
2498 | mouseEvent.setSource(event->source()); | - | ||||||||||||||||||||||||
2499 | mouseEvent.setFlags(event->flags()); | - | ||||||||||||||||||||||||
2500 | mouseEvent.setAccepted(false); | - | ||||||||||||||||||||||||
2501 | if (event->spontaneous()
| 0 | ||||||||||||||||||||||||
2502 | qt_sendSpontaneousEvent(d->scene, &mouseEvent); never executed: qt_sendSpontaneousEvent(d->scene, &mouseEvent); | 0 | ||||||||||||||||||||||||
2503 | else | - | ||||||||||||||||||||||||
2504 | QApplication::sendEvent(d->scene, &mouseEvent); never executed: QApplication::sendEvent(d->scene, &mouseEvent); | 0 | ||||||||||||||||||||||||
2505 | - | |||||||||||||||||||||||||
2506 | - | |||||||||||||||||||||||||
2507 | d->lastMouseEvent.setAccepted(mouseEvent.isAccepted()); | - | ||||||||||||||||||||||||
2508 | - | |||||||||||||||||||||||||
2509 | - | |||||||||||||||||||||||||
2510 | if (mouseEvent.isAccepted()
| 0 | ||||||||||||||||||||||||
2511 | - | |||||||||||||||||||||||||
2512 | d->_q_unsetViewportCursor(); | - | ||||||||||||||||||||||||
2513 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2514 | - | |||||||||||||||||||||||||
2515 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2516 | - | |||||||||||||||||||||||||
2517 | - | |||||||||||||||||||||||||
2518 | - | |||||||||||||||||||||||||
2519 | - | |||||||||||||||||||||||||
2520 | - | |||||||||||||||||||||||||
2521 | void QGraphicsView::wheelEvent(QWheelEvent *event) | - | ||||||||||||||||||||||||
2522 | { | - | ||||||||||||||||||||||||
2523 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2524 | if (!d->scene
| 0 | ||||||||||||||||||||||||
2525 | QAbstractScrollArea::wheelEvent(event); | - | ||||||||||||||||||||||||
2526 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2527 | } | - | ||||||||||||||||||||||||
2528 | - | |||||||||||||||||||||||||
2529 | event->ignore(); | - | ||||||||||||||||||||||||
2530 | - | |||||||||||||||||||||||||
2531 | QGraphicsSceneWheelEvent wheelEvent(QEvent::GraphicsSceneWheel); | - | ||||||||||||||||||||||||
2532 | wheelEvent.setWidget(viewport()); | - | ||||||||||||||||||||||||
2533 | wheelEvent.setScenePos(mapToScene(event->pos())); | - | ||||||||||||||||||||||||
2534 | wheelEvent.setScreenPos(event->globalPos()); | - | ||||||||||||||||||||||||
2535 | wheelEvent.setButtons(event->buttons()); | - | ||||||||||||||||||||||||
2536 | wheelEvent.setModifiers(event->modifiers()); | - | ||||||||||||||||||||||||
2537 | wheelEvent.setDelta(event->delta()); | - | ||||||||||||||||||||||||
2538 | wheelEvent.setOrientation(event->orientation()); | - | ||||||||||||||||||||||||
2539 | wheelEvent.setAccepted(false); | - | ||||||||||||||||||||||||
2540 | QApplication::sendEvent(d->scene, &wheelEvent); | - | ||||||||||||||||||||||||
2541 | event->setAccepted(wheelEvent.isAccepted()); | - | ||||||||||||||||||||||||
2542 | if (!event->isAccepted()
| 0 | ||||||||||||||||||||||||
2543 | QAbstractScrollArea::wheelEvent(event); never executed: QAbstractScrollArea::wheelEvent(event); | 0 | ||||||||||||||||||||||||
2544 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2545 | - | |||||||||||||||||||||||||
2546 | - | |||||||||||||||||||||||||
2547 | - | |||||||||||||||||||||||||
2548 | - | |||||||||||||||||||||||||
2549 | - | |||||||||||||||||||||||||
2550 | void QGraphicsView::paintEvent(QPaintEvent *event) | - | ||||||||||||||||||||||||
2551 | { | - | ||||||||||||||||||||||||
2552 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2553 | if (!d->scene
| 0 | ||||||||||||||||||||||||
2554 | QAbstractScrollArea::paintEvent(event); | - | ||||||||||||||||||||||||
2555 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2556 | } | - | ||||||||||||||||||||||||
2557 | - | |||||||||||||||||||||||||
2558 | - | |||||||||||||||||||||||||
2559 | d->scene->d_func()->painterStateProtection = !(d->optimizationFlags & DontSavePainterState); | - | ||||||||||||||||||||||||
2560 | - | |||||||||||||||||||||||||
2561 | - | |||||||||||||||||||||||||
2562 | d->exposedRegion = event->region(); | - | ||||||||||||||||||||||||
2563 | QRectF exposedSceneRect = mapToScene(d->exposedRegion.boundingRect()).boundingRect(); | - | ||||||||||||||||||||||||
2564 | - | |||||||||||||||||||||||||
2565 | - | |||||||||||||||||||||||||
2566 | QPainter painter(viewport()); | - | ||||||||||||||||||||||||
2567 | - | |||||||||||||||||||||||||
2568 | if (d->rubberBanding
| 0 | ||||||||||||||||||||||||
2569 | painter.save(); never executed: painter.save(); | 0 | ||||||||||||||||||||||||
2570 | - | |||||||||||||||||||||||||
2571 | - | |||||||||||||||||||||||||
2572 | painter.setRenderHints(painter.renderHints(), false); | - | ||||||||||||||||||||||||
2573 | painter.setRenderHints(d->renderHints, true); | - | ||||||||||||||||||||||||
2574 | - | |||||||||||||||||||||||||
2575 | - | |||||||||||||||||||||||||
2576 | const bool viewTransformed = isTransformed(); | - | ||||||||||||||||||||||||
2577 | if (viewTransformed
| 0 | ||||||||||||||||||||||||
2578 | painter.setWorldTransform(viewportTransform()); never executed: painter.setWorldTransform(viewportTransform()); | 0 | ||||||||||||||||||||||||
2579 | const QTransform viewTransform = painter.worldTransform(); | - | ||||||||||||||||||||||||
2580 | - | |||||||||||||||||||||||||
2581 | - | |||||||||||||||||||||||||
2582 | if ((
| 0 | ||||||||||||||||||||||||
2583 | - | |||||||||||||||||||||||||
2584 | - | |||||||||||||||||||||||||
2585 | - | |||||||||||||||||||||||||
2586 | ) { | - | ||||||||||||||||||||||||
2587 | - | |||||||||||||||||||||||||
2588 | - | |||||||||||||||||||||||||
2589 | if (d->mustResizeBackgroundPixmap
| 0 | ||||||||||||||||||||||||
2590 | d->backgroundPixmap = QPixmap(viewport()->size()); | - | ||||||||||||||||||||||||
2591 | QBrush bgBrush = viewport()->palette().brush(viewport()->backgroundRole()); | - | ||||||||||||||||||||||||
2592 | if (!bgBrush.isOpaque()
| 0 | ||||||||||||||||||||||||
2593 | d->backgroundPixmap.fill(Qt::transparent); never executed: d->backgroundPixmap.fill(Qt::transparent); | 0 | ||||||||||||||||||||||||
2594 | QPainter p(&d->backgroundPixmap); | - | ||||||||||||||||||||||||
2595 | p.fillRect(0, 0, d->backgroundPixmap.width(), d->backgroundPixmap.height(), bgBrush); | - | ||||||||||||||||||||||||
2596 | d->backgroundPixmapExposed = QRegion(viewport()->rect()); | - | ||||||||||||||||||||||||
2597 | d->mustResizeBackgroundPixmap = false; | - | ||||||||||||||||||||||||
2598 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2599 | - | |||||||||||||||||||||||||
2600 | - | |||||||||||||||||||||||||
2601 | if (!d->backgroundPixmapExposed.isEmpty()
| 0 | ||||||||||||||||||||||||
2602 | QPainter backgroundPainter(&d->backgroundPixmap); | - | ||||||||||||||||||||||||
2603 | backgroundPainter.setClipRegion(d->backgroundPixmapExposed, Qt::ReplaceClip); | - | ||||||||||||||||||||||||
2604 | if (viewTransformed
| 0 | ||||||||||||||||||||||||
2605 | backgroundPainter.setTransform(viewTransform); never executed: backgroundPainter.setTransform(viewTransform); | 0 | ||||||||||||||||||||||||
2606 | QRectF backgroundExposedSceneRect = mapToScene(d->backgroundPixmapExposed.boundingRect()).boundingRect(); | - | ||||||||||||||||||||||||
2607 | drawBackground(&backgroundPainter, backgroundExposedSceneRect); | - | ||||||||||||||||||||||||
2608 | d->backgroundPixmapExposed = QRegion(); | - | ||||||||||||||||||||||||
2609 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2610 | - | |||||||||||||||||||||||||
2611 | - | |||||||||||||||||||||||||
2612 | if (viewTransformed
| 0 | ||||||||||||||||||||||||
2613 | painter.setWorldTransform(QTransform()); | - | ||||||||||||||||||||||||
2614 | painter.drawPixmap(QPoint(), d->backgroundPixmap); | - | ||||||||||||||||||||||||
2615 | painter.setWorldTransform(viewTransform); | - | ||||||||||||||||||||||||
2616 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
2617 | painter.drawPixmap(QPoint(), d->backgroundPixmap); | - | ||||||||||||||||||||||||
2618 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2619 | } else { | - | ||||||||||||||||||||||||
2620 | if (!(d->optimizationFlags & DontSavePainterState)
| 0 | ||||||||||||||||||||||||
2621 | painter.save(); never executed: painter.save(); | 0 | ||||||||||||||||||||||||
2622 | drawBackground(&painter, exposedSceneRect); | - | ||||||||||||||||||||||||
2623 | if (!(d->optimizationFlags & DontSavePainterState)
| 0 | ||||||||||||||||||||||||
2624 | painter.restore(); never executed: painter.restore(); | 0 | ||||||||||||||||||||||||
2625 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2626 | - | |||||||||||||||||||||||||
2627 | - | |||||||||||||||||||||||||
2628 | if (!(d->optimizationFlags & IndirectPainting)
| 0 | ||||||||||||||||||||||||
2629 | const quint32 oldRectAdjust = d->scene->d_func()->rectAdjust; | - | ||||||||||||||||||||||||
2630 | if (d->optimizationFlags & QGraphicsView::DontAdjustForAntialiasing
| 0 | ||||||||||||||||||||||||
2631 | d->scene->d_func()->rectAdjust = 1; never executed: d->scene->d_func()->rectAdjust = 1; | 0 | ||||||||||||||||||||||||
2632 | else | - | ||||||||||||||||||||||||
2633 | d->scene->d_func()->rectAdjust = 2; never executed: d->scene->d_func()->rectAdjust = 2; | 0 | ||||||||||||||||||||||||
2634 | d->scene->d_func()->drawItems(&painter, viewTransformed ? &viewTransform : 0, | - | ||||||||||||||||||||||||
2635 | &d->exposedRegion, viewport()); | - | ||||||||||||||||||||||||
2636 | d->scene->d_func()->rectAdjust = oldRectAdjust; | - | ||||||||||||||||||||||||
2637 | - | |||||||||||||||||||||||||
2638 | - | |||||||||||||||||||||||||
2639 | - | |||||||||||||||||||||||||
2640 | - | |||||||||||||||||||||||||
2641 | - | |||||||||||||||||||||||||
2642 | - | |||||||||||||||||||||||||
2643 | if (!d->scene->d_func()->painterStateProtection
| 0 | ||||||||||||||||||||||||
2644 | painter.setOpacity(1.0); never executed: painter.setOpacity(1.0); | 0 | ||||||||||||||||||||||||
2645 | painter.setWorldTransform(viewTransform); | - | ||||||||||||||||||||||||
2646 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
2647 | - | |||||||||||||||||||||||||
2648 | if (!d->scene->d_func()->unpolishedItems.isEmpty()
| 0 | ||||||||||||||||||||||||
2649 | d->scene->d_func()->_q_polishItems(); never executed: d->scene->d_func()->_q_polishItems(); | 0 | ||||||||||||||||||||||||
2650 | - | |||||||||||||||||||||||||
2651 | - | |||||||||||||||||||||||||
2652 | d->scene->d_func()->updateAll = false; | - | ||||||||||||||||||||||||
2653 | - | |||||||||||||||||||||||||
2654 | - | |||||||||||||||||||||||||
2655 | bool allItems = false; | - | ||||||||||||||||||||||||
2656 | QList<QGraphicsItem *> itemList = d->findItems(d->exposedRegion, &allItems, viewTransform); | - | ||||||||||||||||||||||||
2657 | if (!itemList.isEmpty()
| 0 | ||||||||||||||||||||||||
2658 | - | |||||||||||||||||||||||||
2659 | const int numItems = itemList.size(); | - | ||||||||||||||||||||||||
2660 | QGraphicsItem **itemArray = &itemList[0]; | - | ||||||||||||||||||||||||
2661 | QStyleOptionGraphicsItem *styleOptionArray = d->allocStyleOptionsArray(numItems); | - | ||||||||||||||||||||||||
2662 | QTransform transform(Qt::Uninitialized); | - | ||||||||||||||||||||||||
2663 | for (int i = 0; i < numItems
| 0 | ||||||||||||||||||||||||
2664 | QGraphicsItem *item = itemArray[i]; | - | ||||||||||||||||||||||||
2665 | QGraphicsItemPrivate *itemd = item->d_ptr.data(); | - | ||||||||||||||||||||||||
2666 | itemd->initStyleOption(&styleOptionArray[i], viewTransform, d->exposedRegion, allItems); | - | ||||||||||||||||||||||||
2667 | - | |||||||||||||||||||||||||
2668 | - | |||||||||||||||||||||||||
2669 | - | |||||||||||||||||||||||||
2670 | - | |||||||||||||||||||||||||
2671 | - | |||||||||||||||||||||||||
2672 | const QRectF brect = adjustedItemEffectiveBoundingRect(item); | - | ||||||||||||||||||||||||
2673 | if (!itemd->itemIsUntransformable()
| 0 | ||||||||||||||||||||||||
2674 | transform = item->sceneTransform(); | - | ||||||||||||||||||||||||
2675 | if (viewTransformed
| 0 | ||||||||||||||||||||||||
2676 | transform *= viewTransform; never executed: transform *= viewTransform; | 0 | ||||||||||||||||||||||||
2677 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
2678 | transform = item->deviceTransform(viewTransform); | - | ||||||||||||||||||||||||
2679 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2680 | itemd->paintedViewBoundingRects.insert(d->viewport, transform.mapRect(brect).toRect()); | - | ||||||||||||||||||||||||
2681 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2682 | - | |||||||||||||||||||||||||
2683 | drawItems(&painter, numItems, itemArray, styleOptionArray); | - | ||||||||||||||||||||||||
2684 | d->freeStyleOptionsArray(styleOptionArray); | - | ||||||||||||||||||||||||
2685 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2686 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2687 | - | |||||||||||||||||||||||||
2688 | - | |||||||||||||||||||||||||
2689 | drawForeground(&painter, exposedSceneRect); | - | ||||||||||||||||||||||||
2690 | - | |||||||||||||||||||||||||
2691 | - | |||||||||||||||||||||||||
2692 | - | |||||||||||||||||||||||||
2693 | if (d->rubberBanding
| 0 | ||||||||||||||||||||||||
2694 | painter.restore(); | - | ||||||||||||||||||||||||
2695 | QStyleOptionRubberBand option; | - | ||||||||||||||||||||||||
2696 | option.initFrom(viewport()); | - | ||||||||||||||||||||||||
2697 | option.rect = d->rubberBandRect; | - | ||||||||||||||||||||||||
2698 | option.shape = QRubberBand::Rectangle; | - | ||||||||||||||||||||||||
2699 | - | |||||||||||||||||||||||||
2700 | QStyleHintReturnMask mask; | - | ||||||||||||||||||||||||
2701 | if (viewport()->style()->styleHint(QStyle::SH_RubberBand_Mask, &option, viewport(), &mask)
| 0 | ||||||||||||||||||||||||
2702 | - | |||||||||||||||||||||||||
2703 | painter.setClipRegion(mask.region, Qt::IntersectClip); | - | ||||||||||||||||||||||||
2704 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2705 | - | |||||||||||||||||||||||||
2706 | viewport()->style()->drawControl(QStyle::CE_RubberBand, &option, &painter, viewport()); | - | ||||||||||||||||||||||||
2707 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2708 | - | |||||||||||||||||||||||||
2709 | - | |||||||||||||||||||||||||
2710 | painter.end(); | - | ||||||||||||||||||||||||
2711 | - | |||||||||||||||||||||||||
2712 | - | |||||||||||||||||||||||||
2713 | d->scene->d_func()->painterStateProtection = true; | - | ||||||||||||||||||||||||
2714 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2715 | - | |||||||||||||||||||||||||
2716 | - | |||||||||||||||||||||||||
2717 | - | |||||||||||||||||||||||||
2718 | - | |||||||||||||||||||||||||
2719 | void QGraphicsView::resizeEvent(QResizeEvent *event) | - | ||||||||||||||||||||||||
2720 | { | - | ||||||||||||||||||||||||
2721 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2722 | - | |||||||||||||||||||||||||
2723 | - | |||||||||||||||||||||||||
2724 | QPointF oldLastCenterPoint = d->lastCenterPoint; | - | ||||||||||||||||||||||||
2725 | - | |||||||||||||||||||||||||
2726 | QAbstractScrollArea::resizeEvent(event); | - | ||||||||||||||||||||||||
2727 | d->recalculateContentSize(); | - | ||||||||||||||||||||||||
2728 | - | |||||||||||||||||||||||||
2729 | - | |||||||||||||||||||||||||
2730 | if (d->resizeAnchor == NoAnchor
| 0 | ||||||||||||||||||||||||
2731 | d->updateLastCenterPoint(); | - | ||||||||||||||||||||||||
2732 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
2733 | d->lastCenterPoint = oldLastCenterPoint; | - | ||||||||||||||||||||||||
2734 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2735 | d->centerView(d->resizeAnchor); | - | ||||||||||||||||||||||||
2736 | d->keepLastCenterPoint = false; | - | ||||||||||||||||||||||||
2737 | - | |||||||||||||||||||||||||
2738 | if (d->cacheMode & CacheBackground
| 0 | ||||||||||||||||||||||||
2739 | - | |||||||||||||||||||||||||
2740 | d->mustResizeBackgroundPixmap = true; | - | ||||||||||||||||||||||||
2741 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2742 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2743 | - | |||||||||||||||||||||||||
2744 | - | |||||||||||||||||||||||||
2745 | - | |||||||||||||||||||||||||
2746 | - | |||||||||||||||||||||||||
2747 | void QGraphicsView::scrollContentsBy(int dx, int dy) | - | ||||||||||||||||||||||||
2748 | { | - | ||||||||||||||||||||||||
2749 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2750 | d->dirtyScroll = true; | - | ||||||||||||||||||||||||
2751 | if (d->transforming
| 0 | ||||||||||||||||||||||||
2752 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2753 | if (isRightToLeft()
| 0 | ||||||||||||||||||||||||
2754 | dx = -dx; never executed: dx = -dx; | 0 | ||||||||||||||||||||||||
2755 | - | |||||||||||||||||||||||||
2756 | if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate
| 0 | ||||||||||||||||||||||||
2757 | if (d->viewportUpdateMode != QGraphicsView::FullViewportUpdate
| 0 | ||||||||||||||||||||||||
2758 | if (d->accelerateScrolling
| 0 | ||||||||||||||||||||||||
2759 | - | |||||||||||||||||||||||||
2760 | - | |||||||||||||||||||||||||
2761 | if (!d->rubberBandRect.isEmpty()
| 0 | ||||||||||||||||||||||||
2762 | QRegion rubberBandRegion(d->rubberBandRegion(viewport(), d->rubberBandRect)); | - | ||||||||||||||||||||||||
2763 | rubberBandRegion += rubberBandRegion.translated(-dx, -dy); | - | ||||||||||||||||||||||||
2764 | viewport()->update(rubberBandRegion); | - | ||||||||||||||||||||||||
2765 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2766 | - | |||||||||||||||||||||||||
2767 | d->dirtyScrollOffset.rx() += dx; | - | ||||||||||||||||||||||||
2768 | d->dirtyScrollOffset.ry() += dy; | - | ||||||||||||||||||||||||
2769 | d->dirtyRegion.translate(dx, dy); | - | ||||||||||||||||||||||||
2770 | viewport()->scroll(dx, dy); | - | ||||||||||||||||||||||||
2771 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
2772 | d->updateAll(); | - | ||||||||||||||||||||||||
2773 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2774 | } else { | - | ||||||||||||||||||||||||
2775 | d->updateAll(); | - | ||||||||||||||||||||||||
2776 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2777 | } | - | ||||||||||||||||||||||||
2778 | - | |||||||||||||||||||||||||
2779 | d->updateLastCenterPoint(); | - | ||||||||||||||||||||||||
2780 | - | |||||||||||||||||||||||||
2781 | if ((
| 0 | ||||||||||||||||||||||||
2782 | - | |||||||||||||||||||||||||
2783 | - | |||||||||||||||||||||||||
2784 | - | |||||||||||||||||||||||||
2785 | ) { | - | ||||||||||||||||||||||||
2786 | - | |||||||||||||||||||||||||
2787 | QRegion exposed; | - | ||||||||||||||||||||||||
2788 | if (!d->backgroundPixmap.isNull()
| 0 | ||||||||||||||||||||||||
2789 | d->backgroundPixmap.scroll(dx, dy, d->backgroundPixmap.rect(), &exposed); never executed: d->backgroundPixmap.scroll(dx, dy, d->backgroundPixmap.rect(), &exposed); | 0 | ||||||||||||||||||||||||
2790 | - | |||||||||||||||||||||||||
2791 | - | |||||||||||||||||||||||||
2792 | d->backgroundPixmapExposed.translate(dx, dy); | - | ||||||||||||||||||||||||
2793 | d->backgroundPixmapExposed += exposed; | - | ||||||||||||||||||||||||
2794 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2795 | - | |||||||||||||||||||||||||
2796 | - | |||||||||||||||||||||||||
2797 | if (d->sceneInteractionAllowed
| 0 | ||||||||||||||||||||||||
2798 | d->replayLastMouseEvent(); never executed: d->replayLastMouseEvent(); | 0 | ||||||||||||||||||||||||
2799 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2800 | - | |||||||||||||||||||||||||
2801 | - | |||||||||||||||||||||||||
2802 | - | |||||||||||||||||||||||||
2803 | - | |||||||||||||||||||||||||
2804 | void QGraphicsView::showEvent(QShowEvent *event) | - | ||||||||||||||||||||||||
2805 | { | - | ||||||||||||||||||||||||
2806 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2807 | d->recalculateContentSize(); | - | ||||||||||||||||||||||||
2808 | d->centerView(d->transformationAnchor); | - | ||||||||||||||||||||||||
2809 | QAbstractScrollArea::showEvent(event); | - | ||||||||||||||||||||||||
2810 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2811 | - | |||||||||||||||||||||||||
2812 | - | |||||||||||||||||||||||||
2813 | - | |||||||||||||||||||||||||
2814 | - | |||||||||||||||||||||||||
2815 | void QGraphicsView::inputMethodEvent(QInputMethodEvent *event) | - | ||||||||||||||||||||||||
2816 | { | - | ||||||||||||||||||||||||
2817 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2818 | if (d->scene
| 0 | ||||||||||||||||||||||||
2819 | QApplication::sendEvent(d->scene, event); never executed: QApplication::sendEvent(d->scene, event); | 0 | ||||||||||||||||||||||||
2820 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2821 | void QGraphicsView::drawBackground(QPainter *painter, const QRectF &rect) | - | ||||||||||||||||||||||||
2822 | { | - | ||||||||||||||||||||||||
2823 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2824 | if (d->scene
| 0 | ||||||||||||||||||||||||
2825 | d->scene->drawBackground(painter, rect); | - | ||||||||||||||||||||||||
2826 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2827 | } | - | ||||||||||||||||||||||||
2828 | - | |||||||||||||||||||||||||
2829 | painter->fillRect(rect, d->backgroundBrush); | - | ||||||||||||||||||||||||
2830 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2831 | void QGraphicsView::drawForeground(QPainter *painter, const QRectF &rect) | - | ||||||||||||||||||||||||
2832 | { | - | ||||||||||||||||||||||||
2833 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2834 | if (d->scene
| 0 | ||||||||||||||||||||||||
2835 | d->scene->drawForeground(painter, rect); | - | ||||||||||||||||||||||||
2836 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2837 | } | - | ||||||||||||||||||||||||
2838 | - | |||||||||||||||||||||||||
2839 | painter->fillRect(rect, d->foregroundBrush); | - | ||||||||||||||||||||||||
2840 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2841 | void QGraphicsView::drawItems(QPainter *painter, int numItems, | - | ||||||||||||||||||||||||
2842 | QGraphicsItem *items[], | - | ||||||||||||||||||||||||
2843 | const QStyleOptionGraphicsItem options[]) | - | ||||||||||||||||||||||||
2844 | { | - | ||||||||||||||||||||||||
2845 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2846 | if (d->scene
| 0 | ||||||||||||||||||||||||
2847 | QWidget *widget = painter->device() == viewport()
| 0 | ||||||||||||||||||||||||
2848 | d->scene->drawItems(painter, numItems, items, options, widget); | - | ||||||||||||||||||||||||
2849 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2850 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2851 | - | |||||||||||||||||||||||||
2852 | - | |||||||||||||||||||||||||
2853 | - | |||||||||||||||||||||||||
2854 | - | |||||||||||||||||||||||||
2855 | - | |||||||||||||||||||||||||
2856 | - | |||||||||||||||||||||||||
2857 | - | |||||||||||||||||||||||||
2858 | QTransform QGraphicsView::transform() const | - | ||||||||||||||||||||||||
2859 | { | - | ||||||||||||||||||||||||
2860 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2861 | return never executed: d->matrix;return d->matrix; never executed: return d->matrix; | 0 | ||||||||||||||||||||||||
2862 | } | - | ||||||||||||||||||||||||
2863 | - | |||||||||||||||||||||||||
2864 | - | |||||||||||||||||||||||||
2865 | - | |||||||||||||||||||||||||
2866 | - | |||||||||||||||||||||||||
2867 | - | |||||||||||||||||||||||||
2868 | - | |||||||||||||||||||||||||
2869 | QTransform QGraphicsView::viewportTransform() const | - | ||||||||||||||||||||||||
2870 | { | - | ||||||||||||||||||||||||
2871 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2872 | QTransform moveMatrix = QTransform::fromTranslate(-d->horizontalScroll(), -d->verticalScroll()); | - | ||||||||||||||||||||||||
2873 | return never executed: d->identityMatrixreturn d->identityMatrix ? moveMatrix : d->matrix * moveMatrix;
never executed: return d->identityMatrix ? moveMatrix : d->matrix * moveMatrix; | 0 | ||||||||||||||||||||||||
2874 | } | - | ||||||||||||||||||||||||
2875 | bool QGraphicsView::isTransformed() const | - | ||||||||||||||||||||||||
2876 | { | - | ||||||||||||||||||||||||
2877 | const QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2878 | return never executed: !d->identityMatrixreturn !d->identityMatrix || d->horizontalScroll() || d->verticalScroll();
never executed: return !d->identityMatrix || d->horizontalScroll() || d->verticalScroll(); | 0 | ||||||||||||||||||||||||
2879 | } | - | ||||||||||||||||||||||||
2880 | void QGraphicsView::setTransform(const QTransform &matrix, bool combine ) | - | ||||||||||||||||||||||||
2881 | { | - | ||||||||||||||||||||||||
2882 | QGraphicsViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
2883 | QTransform oldMatrix = d->matrix; | - | ||||||||||||||||||||||||
2884 | if (!combine
| 0 | ||||||||||||||||||||||||
2885 | d->matrix = matrix; never executed: d->matrix = matrix; | 0 | ||||||||||||||||||||||||
2886 | else | - | ||||||||||||||||||||||||
2887 | d->matrix = matrix * d->matrix; never executed: d->matrix = matrix * d->matrix; | 0 | ||||||||||||||||||||||||
2888 | if (oldMatrix == d->matrix
| 0 | ||||||||||||||||||||||||
2889 | return; never executed: return; | 0 | ||||||||||||||||||||||||
2890 | - | |||||||||||||||||||||||||
2891 | d->identityMatrix = d->matrix.isIdentity(); | - | ||||||||||||||||||||||||
2892 | d->transforming = true; | - | ||||||||||||||||||||||||
2893 | if (d->scene
| 0 | ||||||||||||||||||||||||
2894 | d->recalculateContentSize(); | - | ||||||||||||||||||||||||
2895 | d->centerView(d->transformationAnchor); | - | ||||||||||||||||||||||||
2896 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
2897 | d->updateLastCenterPoint(); | - | ||||||||||||||||||||||||
2898 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2899 | - | |||||||||||||||||||||||||
2900 | if (d->sceneInteractionAllowed
| 0 | ||||||||||||||||||||||||
2901 | d->replayLastMouseEvent(); never executed: d->replayLastMouseEvent(); | 0 | ||||||||||||||||||||||||
2902 | d->transforming = false; | - | ||||||||||||||||||||||||
2903 | - | |||||||||||||||||||||||||
2904 | - | |||||||||||||||||||||||||
2905 | d->updateAll(); | - | ||||||||||||||||||||||||
2906 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2907 | - | |||||||||||||||||||||||||
2908 | - | |||||||||||||||||||||||||
2909 | - | |||||||||||||||||||||||||
2910 | - | |||||||||||||||||||||||||
2911 | - | |||||||||||||||||||||||||
2912 | - | |||||||||||||||||||||||||
2913 | void QGraphicsView::resetTransform() | - | ||||||||||||||||||||||||
2914 | { | - | ||||||||||||||||||||||||
2915 | setTransform(QTransform()); | - | ||||||||||||||||||||||||
2916 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2917 | - | |||||||||||||||||||||||||
2918 | QPointF QGraphicsViewPrivate::mapToScene(const QPointF &point) const | - | ||||||||||||||||||||||||
2919 | { | - | ||||||||||||||||||||||||
2920 | QPointF p = point; | - | ||||||||||||||||||||||||
2921 | p.rx() += horizontalScroll(); | - | ||||||||||||||||||||||||
2922 | p.ry() += verticalScroll(); | - | ||||||||||||||||||||||||
2923 | return never executed: identityMatrixreturn identityMatrix ? p : matrix.inverted().map(p);
never executed: return identityMatrix ? p : matrix.inverted().map(p); | 0 | ||||||||||||||||||||||||
2924 | } | - | ||||||||||||||||||||||||
2925 | - | |||||||||||||||||||||||||
2926 | QRectF QGraphicsViewPrivate::mapToScene(const QRectF &rect) const | - | ||||||||||||||||||||||||
2927 | { | - | ||||||||||||||||||||||||
2928 | QPointF scrollOffset(horizontalScroll(), verticalScroll()); | - | ||||||||||||||||||||||||
2929 | QPointF tl = scrollOffset + rect.topLeft(); | - | ||||||||||||||||||||||||
2930 | QPointF tr = scrollOffset + rect.topRight(); | - | ||||||||||||||||||||||||
2931 | QPointF br = scrollOffset + rect.bottomRight(); | - | ||||||||||||||||||||||||
2932 | QPointF bl = scrollOffset + rect.bottomLeft(); | - | ||||||||||||||||||||||||
2933 | - | |||||||||||||||||||||||||
2934 | QPolygonF poly(4); | - | ||||||||||||||||||||||||
2935 | if (!identityMatrix
| 0 | ||||||||||||||||||||||||
2936 | QTransform x = matrix.inverted(); | - | ||||||||||||||||||||||||
2937 | poly[0] = x.map(tl); | - | ||||||||||||||||||||||||
2938 | poly[1] = x.map(tr); | - | ||||||||||||||||||||||||
2939 | poly[2] = x.map(br); | - | ||||||||||||||||||||||||
2940 | poly[3] = x.map(bl); | - | ||||||||||||||||||||||||
2941 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
2942 | poly[0] = tl; | - | ||||||||||||||||||||||||
2943 | poly[1] = tr; | - | ||||||||||||||||||||||||
2944 | poly[2] = br; | - | ||||||||||||||||||||||||
2945 | poly[3] = bl; | - | ||||||||||||||||||||||||
2946 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2947 | return never executed: poly.boundingRect();return poly.boundingRect(); never executed: return poly.boundingRect(); | 0 | ||||||||||||||||||||||||
2948 | } | - | ||||||||||||||||||||||||
2949 | - | |||||||||||||||||||||||||
2950 | - | |||||||||||||||||||||||||
2951 | - | |||||||||||||||||||||||||
Switch to Source code | Preprocessed file |