Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | class QGraphicsSceneIndexRectIntersector : public QGraphicsSceneIndexIntersector | - |
7 | { | - |
8 | public: | - |
9 | bool intersect(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode, | - |
10 | const QTransform &deviceTransform) const | - |
11 | { | - |
12 | QRectF brect = item->boundingRect(); | - |
13 | _q_adjustRect(&brect); | - |
14 | | - |
15 | | - |
16 | (void)exposeRect;; | - |
17 | | - |
18 | bool keep = true; | - |
19 | const QGraphicsItemPrivate *itemd = QGraphicsItemPrivate::get(item); | - |
20 | if (itemd->itemIsUntransformable()) { evaluated: itemd->itemIsUntransformable() yes Evaluation Count:2 | yes Evaluation Count:387 |
| 2-387 |
21 | | - |
22 | const QTransform transform = item->deviceTransform(deviceTransform); | - |
23 | QRectF itemRect = (deviceTransform * transform.inverted()).mapRect(sceneRect); | - |
24 | if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) partially evaluated: mode == Qt::ContainsItemShape no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: mode == Qt::ContainsItemBoundingRect no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
25 | keep = itemRect.contains(brect) && itemRect != brect; never executed: keep = itemRect.contains(brect) && itemRect != brect; never evaluated: itemRect.contains(brect) never evaluated: itemRect != brect | 0 |
26 | else | - |
27 | keep = itemRect.intersects(brect); executed: keep = itemRect.intersects(brect); Execution Count:2 | 2 |
28 | if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { partially evaluated: keep yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: mode == Qt::ContainsItemShape no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: mode == Qt::IntersectsItemShape yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
29 | QPainterPath itemPath; | - |
30 | itemPath.addRect(itemRect); | - |
31 | keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, itemPath, mode); | - |
32 | } executed: } Execution Count:2 | 2 |
33 | } else { executed: } Execution Count:2 | 2 |
34 | qt_noop(); | - |
35 | const QRectF itemSceneBoundingRect = itemd->sceneTransformTranslateOnly evaluated: itemd->sceneTransformTranslateOnly yes Evaluation Count:351 | yes Evaluation Count:36 |
| 36-351 |
36 | ? brect.translated(itemd->sceneTransform.dx(), | - |
37 | itemd->sceneTransform.dy()) | - |
38 | : itemd->sceneTransform.mapRect(brect); | - |
39 | if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) partially evaluated: mode == Qt::ContainsItemShape no Evaluation Count:0 | yes Evaluation Count:387 |
partially evaluated: mode == Qt::ContainsItemBoundingRect no Evaluation Count:0 | yes Evaluation Count:387 |
| 0-387 |
40 | keep = sceneRect != brect && sceneRect.contains(itemSceneBoundingRect); never evaluated: sceneRect != brect never evaluated: sceneRect.contains(itemSceneBoundingRect) never executed: keep = sceneRect != brect && sceneRect.contains(itemSceneBoundingRect); | 0 |
41 | else | - |
42 | keep = sceneRect.intersects(itemSceneBoundingRect); executed: keep = sceneRect.intersects(itemSceneBoundingRect); Execution Count:387 | 387 |
43 | if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { evaluated: keep yes Evaluation Count:344 | yes Evaluation Count:43 |
partially evaluated: mode == Qt::ContainsItemShape no Evaluation Count:0 | yes Evaluation Count:344 |
evaluated: mode == Qt::IntersectsItemShape yes Evaluation Count:321 | yes Evaluation Count:23 |
| 0-344 |
44 | QPainterPath rectPath; | - |
45 | rectPath.addRect(sceneRect); | - |
46 | if (itemd->sceneTransformTranslateOnly) evaluated: itemd->sceneTransformTranslateOnly yes Evaluation Count:293 | yes Evaluation Count:28 |
| 28-293 |
47 | rectPath.translate(-itemd->sceneTransform.dx(), -itemd->sceneTransform.dy()); executed: rectPath.translate(-itemd->sceneTransform.dx(), -itemd->sceneTransform.dy()); Execution Count:293 | 293 |
48 | else | - |
49 | rectPath = itemd->sceneTransform.inverted().map(rectPath); executed: rectPath = itemd->sceneTransform.inverted().map(rectPath); Execution Count:28 | 28 |
50 | keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, rectPath, mode); | - |
51 | } executed: } Execution Count:321 | 321 |
52 | } executed: } Execution Count:387 | 387 |
53 | return keep; executed: return keep; Execution Count:389 | 389 |
54 | } | - |
55 | | - |
56 | QRectF sceneRect; | - |
57 | }; | - |
58 | | - |
59 | class QGraphicsSceneIndexPointIntersector : public QGraphicsSceneIndexIntersector | - |
60 | { | - |
61 | public: | - |
62 | bool intersect(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode, | - |
63 | const QTransform &deviceTransform) const | - |
64 | { | - |
65 | QRectF brect = item->boundingRect(); | - |
66 | _q_adjustRect(&brect); | - |
67 | | - |
68 | | - |
69 | (void)exposeRect;; | - |
70 | | - |
71 | bool keep = false; | - |
72 | const QGraphicsItemPrivate *itemd = QGraphicsItemPrivate::get(item); | - |
73 | if (itemd->itemIsUntransformable()) { partially evaluated: itemd->itemIsUntransformable() no Evaluation Count:0 | yes Evaluation Count:179 |
| 0-179 |
74 | | - |
75 | const QTransform transform = item->deviceTransform(deviceTransform); | - |
76 | QPointF itemPoint = (deviceTransform * transform.inverted()).map(scenePoint); | - |
77 | keep = brect.contains(itemPoint); | - |
78 | if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { never evaluated: mode == Qt::ContainsItemShape never evaluated: mode == Qt::IntersectsItemShape | 0 |
79 | QPainterPath pointPath; | - |
80 | pointPath.addRect(QRectF(itemPoint, QSizeF(1, 1))); | - |
81 | keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, pointPath, mode); | - |
82 | } | 0 |
83 | } else { | 0 |
84 | qt_noop(); | - |
85 | QRectF sceneBoundingRect = itemd->sceneTransformTranslateOnly partially evaluated: itemd->sceneTransformTranslateOnly yes Evaluation Count:179 | no Evaluation Count:0 |
| 0-179 |
86 | ? brect.translated(itemd->sceneTransform.dx(), | - |
87 | itemd->sceneTransform.dy()) | - |
88 | : itemd->sceneTransform.mapRect(brect); | - |
89 | keep = sceneBoundingRect.intersects(QRectF(scenePoint, QSizeF(1, 1))); | - |
90 | if (keep) { evaluated: keep yes Evaluation Count:146 | yes Evaluation Count:33 |
| 33-146 |
91 | QPointF p = itemd->sceneTransformTranslateOnly partially evaluated: itemd->sceneTransformTranslateOnly yes Evaluation Count:146 | no Evaluation Count:0 |
| 0-146 |
92 | ? QPointF(scenePoint.x() - itemd->sceneTransform.dx(), | - |
93 | scenePoint.y() - itemd->sceneTransform.dy()) | - |
94 | : itemd->sceneTransform.inverted().map(scenePoint); | - |
95 | keep = item->contains(p); | - |
96 | } executed: } Execution Count:146 | 146 |
97 | } executed: } Execution Count:179 | 179 |
98 | | - |
99 | return keep; executed: return keep; Execution Count:179 | 179 |
100 | } | - |
101 | | - |
102 | QPointF scenePoint; | - |
103 | }; | - |
104 | | - |
105 | class QGraphicsSceneIndexPathIntersector : public QGraphicsSceneIndexIntersector | - |
106 | { | - |
107 | public: | - |
108 | bool intersect(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode, | - |
109 | const QTransform &deviceTransform) const | - |
110 | { | - |
111 | QRectF brect = item->boundingRect(); | - |
112 | _q_adjustRect(&brect); | - |
113 | | - |
114 | | - |
115 | (void)exposeRect;; | - |
116 | | - |
117 | bool keep = true; | - |
118 | const QGraphicsItemPrivate *itemd = QGraphicsItemPrivate::get(item); | - |
119 | if (itemd->itemIsUntransformable()) { evaluated: itemd->itemIsUntransformable() yes Evaluation Count:2 | yes Evaluation Count:52 |
| 2-52 |
120 | | - |
121 | const QTransform transform = item->deviceTransform(deviceTransform); | - |
122 | QPainterPath itemPath = (deviceTransform * transform.inverted()).map(scenePath); | - |
123 | if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) partially evaluated: mode == Qt::ContainsItemShape no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: mode == Qt::ContainsItemBoundingRect no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
124 | keep = itemPath.contains(brect); never executed: keep = itemPath.contains(brect); | 0 |
125 | else | - |
126 | keep = itemPath.intersects(brect); executed: keep = itemPath.intersects(brect); Execution Count:2 | 2 |
127 | if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) partially evaluated: keep yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: mode == Qt::ContainsItemShape no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: mode == Qt::IntersectsItemShape yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
128 | keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, itemPath, mode); executed: keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, itemPath, mode); Execution Count:2 | 2 |
129 | } else { executed: } Execution Count:2 | 2 |
130 | qt_noop(); | - |
131 | const QRectF itemSceneBoundingRect = itemd->sceneTransformTranslateOnly partially evaluated: itemd->sceneTransformTranslateOnly yes Evaluation Count:52 | no Evaluation Count:0 |
| 0-52 |
132 | ? brect.translated(itemd->sceneTransform.dx(), | - |
133 | itemd->sceneTransform.dy()) | - |
134 | : itemd->sceneTransform.mapRect(brect); | - |
135 | if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) evaluated: mode == Qt::ContainsItemShape yes Evaluation Count:2 | yes Evaluation Count:50 |
partially evaluated: mode == Qt::ContainsItemBoundingRect no Evaluation Count:0 | yes Evaluation Count:50 |
| 0-50 |
136 | keep = scenePath.contains(itemSceneBoundingRect); executed: keep = scenePath.contains(itemSceneBoundingRect); Execution Count:2 | 2 |
137 | else | - |
138 | keep = scenePath.intersects(itemSceneBoundingRect); executed: keep = scenePath.intersects(itemSceneBoundingRect); Execution Count:50 | 50 |
139 | if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { evaluated: keep yes Evaluation Count:51 | yes Evaluation Count:1 |
evaluated: mode == Qt::ContainsItemShape yes Evaluation Count:1 | yes Evaluation Count:50 |
evaluated: mode == Qt::IntersectsItemShape yes Evaluation Count:46 | yes Evaluation Count:4 |
| 1-51 |
140 | QPainterPath itemPath = itemd->sceneTransformTranslateOnly partially evaluated: itemd->sceneTransformTranslateOnly yes Evaluation Count:47 | no Evaluation Count:0 |
| 0-47 |
141 | ? scenePath.translated(-itemd->sceneTransform.dx(), | - |
142 | -itemd->sceneTransform.dy()) | - |
143 | : itemd->sceneTransform.inverted().map(scenePath); | - |
144 | keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, itemPath, mode); | - |
145 | } executed: } Execution Count:47 | 47 |
146 | } executed: } Execution Count:52 | 52 |
147 | return keep; executed: return keep; Execution Count:54 | 54 |
148 | } | - |
149 | | - |
150 | QPainterPath scenePath; | - |
151 | }; | - |
152 | | - |
153 | | - |
154 | | - |
155 | | - |
156 | QGraphicsSceneIndexPrivate::QGraphicsSceneIndexPrivate(QGraphicsScene *scene) : scene(scene) | - |
157 | { | - |
158 | pointIntersector = new QGraphicsSceneIndexPointIntersector; | - |
159 | rectIntersector = new QGraphicsSceneIndexRectIntersector; | - |
160 | pathIntersector = new QGraphicsSceneIndexPathIntersector; | - |
161 | } executed: } Execution Count:798 | 798 |
162 | | - |
163 | | - |
164 | | - |
165 | | - |
166 | QGraphicsSceneIndexPrivate::~QGraphicsSceneIndexPrivate() | - |
167 | { | - |
168 | delete pointIntersector; | - |
169 | delete rectIntersector; | - |
170 | delete pathIntersector; | - |
171 | } executed: } Execution Count:779 | 779 |
172 | | - |
173 | | - |
174 | | - |
175 | | - |
176 | | - |
177 | | - |
178 | | - |
179 | bool QGraphicsSceneIndexPrivate::itemCollidesWithPath(const QGraphicsItem *item, | - |
180 | const QPainterPath &path, | - |
181 | Qt::ItemSelectionMode mode) | - |
182 | { | - |
183 | if (item->collidesWithPath(path, mode)) evaluated: item->collidesWithPath(path, mode) yes Evaluation Count:357 | yes Evaluation Count:15 |
| 15-357 |
184 | return true; executed: return true; Execution Count:357 | 357 |
185 | if (item->isWidget()) { partially evaluated: item->isWidget() no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
186 | | - |
187 | const QGraphicsWidget *widget = static_cast<const QGraphicsWidget *>(item); | - |
188 | if (widget->isWindow()) { never evaluated: widget->isWindow() | 0 |
189 | QRectF frameRect = widget->windowFrameRect(); | - |
190 | QPainterPath framePath; | - |
191 | framePath.addRect(frameRect); | - |
192 | bool intersects = path.intersects(frameRect); | - |
193 | if (mode == Qt::IntersectsItemShape || mode == Qt::IntersectsItemBoundingRect) never evaluated: mode == Qt::IntersectsItemShape never evaluated: mode == Qt::IntersectsItemBoundingRect | 0 |
194 | return intersects || path.contains(frameRect.topLeft()) | 0 |
195 | || framePath.contains(path.elementAt(0)); never executed: return intersects || path.contains(frameRect.topLeft()) || framePath.contains(path.elementAt(0)); | 0 |
196 | return !intersects && path.contains(frameRect.topLeft()); never executed: return !intersects && path.contains(frameRect.topLeft()); | 0 |
197 | } | - |
198 | } | 0 |
199 | return false; executed: return false; Execution Count:15 | 15 |
200 | } | - |
201 | | - |
202 | | - |
203 | | - |
204 | | - |
205 | | - |
206 | void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRectF exposeRect, | - |
207 | QGraphicsSceneIndexIntersector *intersector, | - |
208 | QList<QGraphicsItem *> *items, | - |
209 | const QTransform &viewTransform, | - |
210 | Qt::ItemSelectionMode mode, | - |
211 | qreal parentOpacity) const | - |
212 | { | - |
213 | qt_noop(); | - |
214 | if (!item->d_ptr->visible) partially evaluated: !item->d_ptr->visible no Evaluation Count:0 | yes Evaluation Count:622 |
| 0-622 |
215 | return; | 0 |
216 | | - |
217 | const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); | - |
218 | const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity); | - |
219 | const bool itemHasChildren = !item->d_ptr->children.isEmpty(); | - |
220 | if (itemIsFullyTransparent && (!itemHasChildren || item->d_ptr->childrenCombineOpacity())) partially evaluated: itemIsFullyTransparent no Evaluation Count:0 | yes Evaluation Count:622 |
never evaluated: !itemHasChildren never evaluated: item->d_ptr->childrenCombineOpacity() | 0-622 |
221 | return; | 0 |
222 | | - |
223 | | - |
224 | const bool itemIsUntransformable = item->d_ptr->itemIsUntransformable(); | - |
225 | const bool wasDirtyParentSceneTransform = item->d_ptr->dirtySceneTransform && !itemIsUntransformable; evaluated: item->d_ptr->dirtySceneTransform yes Evaluation Count:49 | yes Evaluation Count:573 |
partially evaluated: !itemIsUntransformable yes Evaluation Count:49 | no Evaluation Count:0 |
| 0-573 |
226 | if (wasDirtyParentSceneTransform) { evaluated: wasDirtyParentSceneTransform yes Evaluation Count:49 | yes Evaluation Count:573 |
| 49-573 |
227 | item->d_ptr->updateSceneTransformFromParent(); | - |
228 | qt_noop(); | - |
229 | } executed: } Execution Count:49 | 49 |
230 | | - |
231 | const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); | - |
232 | bool processItem = !itemIsFullyTransparent; | - |
233 | if (processItem) { partially evaluated: processItem yes Evaluation Count:622 | no Evaluation Count:0 |
| 0-622 |
234 | processItem = intersector->intersect(item, exposeRect, mode, viewTransform); | - |
235 | if (!processItem && (!itemHasChildren || itemClipsChildrenToShape)) { evaluated: !processItem yes Evaluation Count:92 | yes Evaluation Count:530 |
evaluated: !itemHasChildren yes Evaluation Count:86 | yes Evaluation Count:6 |
partially evaluated: itemClipsChildrenToShape no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-530 |
236 | if (wasDirtyParentSceneTransform) evaluated: wasDirtyParentSceneTransform yes Evaluation Count:8 | yes Evaluation Count:78 |
| 8-78 |
237 | item->d_ptr->invalidateChildrenSceneTransform(); executed: item->d_ptr->invalidateChildrenSceneTransform(); Execution Count:8 | 8 |
238 | return; executed: return; Execution Count:86 | 86 |
239 | } | - |
240 | } executed: } Execution Count:536 | 536 |
241 | | - |
242 | int i = 0; | - |
243 | if (itemHasChildren) { evaluated: itemHasChildren yes Evaluation Count:55 | yes Evaluation Count:481 |
| 55-481 |
244 | | - |
245 | item->d_ptr->ensureSortedChildren(); | - |
246 | | - |
247 | | - |
248 | if (itemClipsChildrenToShape && !itemIsUntransformable) { evaluated: itemClipsChildrenToShape yes Evaluation Count:4 | yes Evaluation Count:51 |
partially evaluated: !itemIsUntransformable yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-51 |
249 | QPainterPath mappedShape = item->d_ptr->sceneTransformTranslateOnly partially evaluated: item->d_ptr->sceneTransformTranslateOnly yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
250 | ? item->shape().translated(item->d_ptr->sceneTransform.dx(), | - |
251 | item->d_ptr->sceneTransform.dy()) | - |
252 | : item->d_ptr->sceneTransform.map(item->shape()); | - |
253 | exposeRect &= mappedShape.controlPointRect(); | - |
254 | } executed: } Execution Count:4 | 4 |
255 | | - |
256 | | - |
257 | for (i = 0; i < item->d_ptr->children.size(); ++i) { evaluated: i < item->d_ptr->children.size() yes Evaluation Count:55 | yes Evaluation Count:1 |
| 1-55 |
258 | QGraphicsItem *child = item->d_ptr->children.at(i); | - |
259 | if (wasDirtyParentSceneTransform) partially evaluated: wasDirtyParentSceneTransform no Evaluation Count:0 | yes Evaluation Count:55 |
| 0-55 |
260 | child->d_ptr->dirtySceneTransform = 1; never executed: child->d_ptr->dirtySceneTransform = 1; | 0 |
261 | if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent)) evaluated: !(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent) yes Evaluation Count:54 | yes Evaluation Count:1 |
| 1-54 |
262 | break; executed: break; Execution Count:54 | 54 |
263 | if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity)) partially evaluated: itemIsFullyTransparent no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity) | 0-1 |
264 | continue; never executed: continue; | 0 |
265 | recursive_items_helper(child, exposeRect, intersector, items, viewTransform, | - |
266 | mode, opacity); | - |
267 | } executed: } Execution Count:1 | 1 |
268 | } executed: } Execution Count:55 | 55 |
269 | | - |
270 | | - |
271 | if (processItem) evaluated: processItem yes Evaluation Count:530 | yes Evaluation Count:6 |
| 6-530 |
272 | items->append(item); executed: items->append(item); Execution Count:530 | 530 |
273 | | - |
274 | | - |
275 | if (itemHasChildren) { evaluated: itemHasChildren yes Evaluation Count:55 | yes Evaluation Count:481 |
| 55-481 |
276 | for (; i < item->d_ptr->children.size(); ++i) { evaluated: i < item->d_ptr->children.size() yes Evaluation Count:64 | yes Evaluation Count:55 |
| 55-64 |
277 | QGraphicsItem *child = item->d_ptr->children.at(i); | - |
278 | if (wasDirtyParentSceneTransform) partially evaluated: wasDirtyParentSceneTransform no Evaluation Count:0 | yes Evaluation Count:64 |
| 0-64 |
279 | child->d_ptr->dirtySceneTransform = 1; never executed: child->d_ptr->dirtySceneTransform = 1; | 0 |
280 | if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity)) partially evaluated: itemIsFullyTransparent no Evaluation Count:0 | yes Evaluation Count:64 |
never evaluated: !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity) | 0-64 |
281 | continue; never executed: continue; | 0 |
282 | recursive_items_helper(child, exposeRect, intersector, items, viewTransform, | - |
283 | mode, opacity); | - |
284 | } executed: } Execution Count:64 | 64 |
285 | } executed: } Execution Count:55 | 55 |
286 | } executed: } Execution Count:536 | 536 |
287 | | - |
288 | void QGraphicsSceneIndexPrivate::init() | - |
289 | { | - |
290 | if (!scene) partially evaluated: !scene no Evaluation Count:0 | yes Evaluation Count:798 |
| 0-798 |
291 | return; | 0 |
292 | | - |
293 | QObject::connect(scene, "2""sceneRectChanged(QRectF)", | - |
294 | q_func(), "1""updateSceneRect(QRectF)"); | - |
295 | } executed: } Execution Count:798 | 798 |
296 | | - |
297 | | - |
298 | | - |
299 | | - |
300 | QGraphicsSceneIndex::QGraphicsSceneIndex(QGraphicsScene *scene) | - |
301 | : QObject(*new QGraphicsSceneIndexPrivate(scene), scene) | - |
302 | { | - |
303 | d_func()->init(); | - |
304 | } | 0 |
305 | | - |
306 | | - |
307 | | - |
308 | | - |
309 | QGraphicsSceneIndex::QGraphicsSceneIndex(QGraphicsSceneIndexPrivate &dd, QGraphicsScene *scene) | - |
310 | : QObject(dd, scene) | - |
311 | { | - |
312 | d_func()->init(); | - |
313 | } executed: } Execution Count:798 | 798 |
314 | | - |
315 | | - |
316 | | - |
317 | | - |
318 | QGraphicsSceneIndex::~QGraphicsSceneIndex() | - |
319 | { | - |
320 | | - |
321 | } | - |
322 | | - |
323 | | - |
324 | | - |
325 | | - |
326 | QGraphicsScene* QGraphicsSceneIndex::scene() const | - |
327 | { | - |
328 | const QGraphicsSceneIndexPrivate * const d = d_func(); | - |
329 | return d->scene; never executed: return d->scene; | 0 |
330 | } | - |
331 | QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSelectionMode mode, | - |
332 | Qt::SortOrder order, const QTransform &deviceTransform) const | - |
333 | { | - |
334 | | - |
335 | const QGraphicsSceneIndexPrivate * const d = d_func(); | - |
336 | QList<QGraphicsItem *> itemList; | - |
337 | d->pointIntersector->scenePoint = pos; | - |
338 | d->items_helper(QRectF(pos, QSizeF(1, 1)), d->pointIntersector, &itemList, deviceTransform, mode, order); | - |
339 | return itemList; executed: return itemList; Execution Count:67 | 67 |
340 | } | - |
341 | QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSelectionMode mode, | - |
342 | Qt::SortOrder order, const QTransform &deviceTransform) const | - |
343 | { | - |
344 | const QGraphicsSceneIndexPrivate * const d = d_func(); | - |
345 | QRectF exposeRect = rect; | - |
346 | _q_adjustRect(&exposeRect); | - |
347 | QList<QGraphicsItem *> itemList; | - |
348 | d->rectIntersector->sceneRect = rect; | - |
349 | d->items_helper(exposeRect, d->rectIntersector, &itemList, deviceTransform, mode, order); | - |
350 | return itemList; executed: return itemList; Execution Count:340 | 340 |
351 | } | - |
352 | QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, | - |
353 | Qt::SortOrder order, const QTransform &deviceTransform) const | - |
354 | { | - |
355 | const QGraphicsSceneIndexPrivate * const d = d_func(); | - |
356 | QList<QGraphicsItem *> itemList; | - |
357 | QRectF exposeRect = polygon.boundingRect(); | - |
358 | _q_adjustRect(&exposeRect); | - |
359 | QPainterPath path; | - |
360 | path.addPolygon(polygon); | - |
361 | d->pathIntersector->scenePath = path; | - |
362 | d->items_helper(exposeRect, d->pathIntersector, &itemList, deviceTransform, mode, order); | - |
363 | return itemList; executed: return itemList; Execution Count:11 | 11 |
364 | } | - |
365 | QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QPainterPath &path, Qt::ItemSelectionMode mode, | - |
366 | Qt::SortOrder order, const QTransform &deviceTransform) const | - |
367 | { | - |
368 | const QGraphicsSceneIndexPrivate * const d = d_func(); | - |
369 | QList<QGraphicsItem *> itemList; | - |
370 | QRectF exposeRect = path.controlPointRect(); | - |
371 | _q_adjustRect(&exposeRect); | - |
372 | d->pathIntersector->scenePath = path; | - |
373 | d->items_helper(exposeRect, d->pathIntersector, &itemList, deviceTransform, mode, order); | - |
374 | return itemList; executed: return itemList; Execution Count:7 | 7 |
375 | } | - |
376 | | - |
377 | | - |
378 | | - |
379 | | - |
380 | | - |
381 | QList<QGraphicsItem *> QGraphicsSceneIndex::estimateItems(const QPointF &point, Qt::SortOrder order) const | - |
382 | { | - |
383 | return estimateItems(QRectF(point, QSize(1, 1)), order); never executed: return estimateItems(QRectF(point, QSize(1, 1)), order); | 0 |
384 | } | - |
385 | | - |
386 | QList<QGraphicsItem *> QGraphicsSceneIndex::estimateTopLevelItems(const QRectF &rect, Qt::SortOrder order) const | - |
387 | { | - |
388 | const QGraphicsSceneIndexPrivate * const d = d_func(); | - |
389 | (void)rect;; | - |
390 | QGraphicsScenePrivate *scened = d->scene->d_func(); | - |
391 | scened->ensureSortedTopLevelItems(); | - |
392 | if (order == Qt::DescendingOrder) { never evaluated: order == Qt::DescendingOrder | 0 |
393 | QList<QGraphicsItem *> sorted; | - |
394 | for (int i = scened->topLevelItems.size() - 1; i >= 0; --i) | 0 |
395 | sorted << scened->topLevelItems.at(i); never executed: sorted << scened->topLevelItems.at(i); | 0 |
396 | return sorted; never executed: return sorted; | 0 |
397 | } | - |
398 | return scened->topLevelItems; never executed: return scened->topLevelItems; | 0 |
399 | } | - |
400 | void QGraphicsSceneIndex::updateSceneRect(const QRectF &rect) | - |
401 | { | - |
402 | (void)rect;; | - |
403 | } | 0 |
404 | | - |
405 | | - |
406 | | - |
407 | | - |
408 | void QGraphicsSceneIndex::clear() | - |
409 | { | - |
410 | const QList<QGraphicsItem *> allItems = items(); | - |
411 | for (int i = 0 ; i < allItems.size(); ++i) never evaluated: i < allItems.size() | 0 |
412 | removeItem(allItems.at(i)); never executed: removeItem(allItems.at(i)); | 0 |
413 | } | 0 |
414 | void QGraphicsSceneIndex::deleteItem(QGraphicsItem *item) | - |
415 | { | - |
416 | removeItem(item); | - |
417 | } executed: } Execution Count:1686 | 1686 |
418 | void QGraphicsSceneIndex::itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const void *const value) | - |
419 | { | - |
420 | (void)item;; | - |
421 | (void)change;; | - |
422 | (void)value;; | - |
423 | } | 0 |
424 | | - |
425 | | - |
426 | | - |
427 | | - |
428 | | - |
429 | | - |
430 | void QGraphicsSceneIndex::prepareBoundingRectChange(const QGraphicsItem *item) | - |
431 | { | - |
432 | (void)item;; | - |
433 | } | 0 |
434 | | - |
435 | | - |
436 | | - |
437 | | - |
| | |