Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | class QGraphicsGridLayoutPrivate : public QGraphicsLayoutPrivate | - |
8 | { | - |
9 | public: | - |
10 | QGraphicsGridLayoutPrivate() { } | - |
11 | QLayoutStyleInfo styleInfo() const; | - |
12 | | - |
13 | QGridLayoutEngine engine; | - |
14 | | - |
15 | | - |
16 | | - |
17 | }; | - |
18 | | - |
19 | static QWidget *globalStyleInfoWidget() { static QGlobalStatic<QWidget > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QWidget *x = new QWidget; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QWidget > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }; never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:770 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:1 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:1 | yes Evaluation Count:769 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-770 |
20 | | - |
21 | QLayoutStyleInfo QGraphicsGridLayoutPrivate::styleInfo() const | - |
22 | { | - |
23 | QGraphicsItem *item = parentItem(); | - |
24 | QStyle *style = (item && item->isWidget()) ? static_cast<QGraphicsWidget*>(item)->style() : QApplication::style(); evaluated: item yes Evaluation Count:645 | yes Evaluation Count:125 |
partially evaluated: item->isWidget() yes Evaluation Count:645 | no Evaluation Count:0 |
| 0-645 |
25 | return QLayoutStyleInfo(style, globalStyleInfoWidget()); executed: return QLayoutStyleInfo(style, globalStyleInfoWidget()); Execution Count:770 | 770 |
26 | } | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | QGraphicsGridLayout::QGraphicsGridLayout(QGraphicsLayoutItem *parent) | - |
33 | : QGraphicsLayout(*new QGraphicsGridLayoutPrivate(), parent) | - |
34 | { | - |
35 | } executed: } Execution Count:265 | 265 |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
40 | QGraphicsGridLayout::~QGraphicsGridLayout() | - |
41 | { | - |
42 | for (int i = count() - 1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:476 | yes Evaluation Count:213 |
| 213-476 |
43 | QGraphicsLayoutItem *item = itemAt(i); | - |
44 | | - |
45 | | - |
46 | | - |
47 | removeAt(i); | - |
48 | if (item) { partially evaluated: item yes Evaluation Count:476 | no Evaluation Count:0 |
| 0-476 |
49 | item->setParentLayoutItem(0); | - |
50 | if (item->ownedByLayout()) evaluated: item->ownedByLayout() yes Evaluation Count:1 | yes Evaluation Count:475 |
| 1-475 |
51 | delete item; executed: delete item; Execution Count:1 | 1 |
52 | } executed: } Execution Count:476 | 476 |
53 | } executed: } Execution Count:476 | 476 |
54 | } executed: } Execution Count:213 | 213 |
55 | | - |
56 | | - |
57 | | - |
58 | | - |
59 | | - |
60 | void QGraphicsGridLayout::addItem(QGraphicsLayoutItem *item, int row, int column, | - |
61 | int rowSpan, int columnSpan, Qt::Alignment alignment) | - |
62 | { | - |
63 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
64 | if (row < 0 || column < 0) { evaluated: row < 0 yes Evaluation Count:27 | yes Evaluation Count:783 |
evaluated: column < 0 yes Evaluation Count:27 | yes Evaluation Count:756 |
| 27-783 |
65 | QMessageLogger("graphicsview/qgraphicsgridlayout.cpp", 155, __PRETTY_FUNCTION__).warning("QGraphicsGridLayout::addItem: invalid row/column: %d", | - |
66 | row < 0 ? row : column); | - |
67 | return; executed: return; Execution Count:54 | 54 |
68 | } | - |
69 | if (columnSpan < 1 || rowSpan < 1) { evaluated: columnSpan < 1 yes Evaluation Count:37 | yes Evaluation Count:719 |
evaluated: rowSpan < 1 yes Evaluation Count:12 | yes Evaluation Count:707 |
| 12-719 |
70 | QMessageLogger("graphicsview/qgraphicsgridlayout.cpp", 160, __PRETTY_FUNCTION__).warning("QGraphicsGridLayout::addItem: invalid row span/column span: %d", | - |
71 | rowSpan < 1 ? rowSpan : columnSpan); | - |
72 | return; executed: return; Execution Count:49 | 49 |
73 | } | - |
74 | if (!item) { evaluated: !item yes Evaluation Count:1 | yes Evaluation Count:706 |
| 1-706 |
75 | QMessageLogger("graphicsview/qgraphicsgridlayout.cpp", 165, __PRETTY_FUNCTION__).warning("QGraphicsGridLayout::addItem: cannot add null item"); | - |
76 | return; executed: return; Execution Count:1 | 1 |
77 | } | - |
78 | if (item == this) { evaluated: item == this yes Evaluation Count:1 | yes Evaluation Count:705 |
| 1-705 |
79 | QMessageLogger("graphicsview/qgraphicsgridlayout.cpp", 169, __PRETTY_FUNCTION__).warning("QGraphicsGridLayout::addItem: cannot insert itself"); | - |
80 | return; executed: return; Execution Count:1 | 1 |
81 | } | - |
82 | | - |
83 | d->addChildLayoutItem(item); | - |
84 | | - |
85 | new QGridLayoutItem(&d->engine, item, row, column, rowSpan, columnSpan, alignment); | - |
86 | invalidate(); | - |
87 | } executed: } Execution Count:705 | 705 |
88 | void QGraphicsGridLayout::setHorizontalSpacing(qreal spacing) | - |
89 | { | - |
90 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
91 | d->engine.setSpacing(spacing, Qt::Horizontal); | - |
92 | invalidate(); | - |
93 | } executed: } Execution Count:3 | 3 |
94 | | - |
95 | | - |
96 | | - |
97 | | - |
98 | qreal QGraphicsGridLayout::horizontalSpacing() const | - |
99 | { | - |
100 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
101 | return d->engine.spacing(d->styleInfo(), Qt::Horizontal); executed: return d->engine.spacing(d->styleInfo(), Qt::Horizontal); Execution Count:8 | 8 |
102 | } | - |
103 | | - |
104 | | - |
105 | | - |
106 | | - |
107 | void QGraphicsGridLayout::setVerticalSpacing(qreal spacing) | - |
108 | { | - |
109 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
110 | d->engine.setSpacing(spacing, Qt::Vertical); | - |
111 | invalidate(); | - |
112 | } executed: } Execution Count:3 | 3 |
113 | | - |
114 | | - |
115 | | - |
116 | | - |
117 | qreal QGraphicsGridLayout::verticalSpacing() const | - |
118 | { | - |
119 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
120 | return d->engine.spacing(d->styleInfo(), Qt::Vertical); executed: return d->engine.spacing(d->styleInfo(), Qt::Vertical); Execution Count:7 | 7 |
121 | } | - |
122 | | - |
123 | | - |
124 | | - |
125 | | - |
126 | | - |
127 | | - |
128 | | - |
129 | void QGraphicsGridLayout::setSpacing(qreal spacing) | - |
130 | { | - |
131 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
132 | d->engine.setSpacing(spacing, Qt::Horizontal | Qt::Vertical); | - |
133 | invalidate(); | - |
134 | } executed: } Execution Count:135 | 135 |
135 | | - |
136 | | - |
137 | | - |
138 | | - |
139 | void QGraphicsGridLayout::setRowSpacing(int row, qreal spacing) | - |
140 | { | - |
141 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
142 | d->engine.setRowSpacing(row, spacing, Qt::Vertical); | - |
143 | invalidate(); | - |
144 | } executed: } Execution Count:7 | 7 |
145 | | - |
146 | | - |
147 | | - |
148 | | - |
149 | qreal QGraphicsGridLayout::rowSpacing(int row) const | - |
150 | { | - |
151 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
152 | return d->engine.rowSpacing(row, Qt::Vertical); executed: return d->engine.rowSpacing(row, Qt::Vertical); Execution Count:5 | 5 |
153 | } | - |
154 | | - |
155 | | - |
156 | | - |
157 | | - |
158 | void QGraphicsGridLayout::setColumnSpacing(int column, qreal spacing) | - |
159 | { | - |
160 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
161 | d->engine.setRowSpacing(column, spacing, Qt::Horizontal); | - |
162 | invalidate(); | - |
163 | } executed: } Execution Count:13 | 13 |
164 | | - |
165 | | - |
166 | | - |
167 | | - |
168 | qreal QGraphicsGridLayout::columnSpacing(int column) const | - |
169 | { | - |
170 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
171 | return d->engine.rowSpacing(column, Qt::Horizontal); executed: return d->engine.rowSpacing(column, Qt::Horizontal); Execution Count:7 | 7 |
172 | } | - |
173 | | - |
174 | | - |
175 | | - |
176 | | - |
177 | void QGraphicsGridLayout::setRowStretchFactor(int row, int stretch) | - |
178 | { | - |
179 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
180 | d->engine.setRowStretchFactor(row, stretch, Qt::Vertical); | - |
181 | invalidate(); | - |
182 | } executed: } Execution Count:7 | 7 |
183 | | - |
184 | | - |
185 | | - |
186 | | - |
187 | int QGraphicsGridLayout::rowStretchFactor(int row) const | - |
188 | { | - |
189 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
190 | return d->engine.rowStretchFactor(row, Qt::Vertical); executed: return d->engine.rowStretchFactor(row, Qt::Vertical); Execution Count:1 | 1 |
191 | } | - |
192 | | - |
193 | | - |
194 | | - |
195 | | - |
196 | void QGraphicsGridLayout::setColumnStretchFactor(int column, int stretch) | - |
197 | { | - |
198 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
199 | d->engine.setRowStretchFactor(column, stretch, Qt::Horizontal); | - |
200 | invalidate(); | - |
201 | } executed: } Execution Count:5 | 5 |
202 | | - |
203 | | - |
204 | | - |
205 | | - |
206 | int QGraphicsGridLayout::columnStretchFactor(int column) const | - |
207 | { | - |
208 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
209 | return d->engine.rowStretchFactor(column, Qt::Horizontal); executed: return d->engine.rowStretchFactor(column, Qt::Horizontal); Execution Count:1 | 1 |
210 | } | - |
211 | | - |
212 | | - |
213 | | - |
214 | | - |
215 | void QGraphicsGridLayout::setRowMinimumHeight(int row, qreal height) | - |
216 | { | - |
217 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
218 | d->engine.setRowSizeHint(Qt::MinimumSize, row, height, Qt::Vertical); | - |
219 | invalidate(); | - |
220 | } executed: } Execution Count:13 | 13 |
221 | | - |
222 | | - |
223 | | - |
224 | | - |
225 | qreal QGraphicsGridLayout::rowMinimumHeight(int row) const | - |
226 | { | - |
227 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
228 | return d->engine.rowSizeHint(Qt::MinimumSize, row, Qt::Vertical); executed: return d->engine.rowSizeHint(Qt::MinimumSize, row, Qt::Vertical); Execution Count:11 | 11 |
229 | } | - |
230 | | - |
231 | | - |
232 | | - |
233 | | - |
234 | void QGraphicsGridLayout::setRowPreferredHeight(int row, qreal height) | - |
235 | { | - |
236 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
237 | d->engine.setRowSizeHint(Qt::PreferredSize, row, height, Qt::Vertical); | - |
238 | invalidate(); | - |
239 | } executed: } Execution Count:5 | 5 |
240 | | - |
241 | | - |
242 | | - |
243 | | - |
244 | qreal QGraphicsGridLayout::rowPreferredHeight(int row) const | - |
245 | { | - |
246 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
247 | return d->engine.rowSizeHint(Qt::PreferredSize, row, Qt::Vertical); executed: return d->engine.rowSizeHint(Qt::PreferredSize, row, Qt::Vertical); Execution Count:11 | 11 |
248 | } | - |
249 | | - |
250 | | - |
251 | | - |
252 | | - |
253 | void QGraphicsGridLayout::setRowMaximumHeight(int row, qreal height) | - |
254 | { | - |
255 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
256 | d->engine.setRowSizeHint(Qt::MaximumSize, row, height, Qt::Vertical); | - |
257 | invalidate(); | - |
258 | } executed: } Execution Count:5 | 5 |
259 | | - |
260 | | - |
261 | | - |
262 | | - |
263 | qreal QGraphicsGridLayout::rowMaximumHeight(int row) const | - |
264 | { | - |
265 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
266 | return d->engine.rowSizeHint(Qt::MaximumSize, row, Qt::Vertical); executed: return d->engine.rowSizeHint(Qt::MaximumSize, row, Qt::Vertical); Execution Count:11 | 11 |
267 | } | - |
268 | | - |
269 | | - |
270 | | - |
271 | | - |
272 | void QGraphicsGridLayout::setRowFixedHeight(int row, qreal height) | - |
273 | { | - |
274 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
275 | d->engine.setRowSizeHint(Qt::MinimumSize, row, height, Qt::Vertical); | - |
276 | d->engine.setRowSizeHint(Qt::MaximumSize, row, height, Qt::Vertical); | - |
277 | invalidate(); | - |
278 | } executed: } Execution Count:3 | 3 |
279 | | - |
280 | | - |
281 | | - |
282 | | - |
283 | void QGraphicsGridLayout::setColumnMinimumWidth(int column, qreal width) | - |
284 | { | - |
285 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
286 | d->engine.setRowSizeHint(Qt::MinimumSize, column, width, Qt::Horizontal); | - |
287 | invalidate(); | - |
288 | } executed: } Execution Count:23 | 23 |
289 | | - |
290 | | - |
291 | | - |
292 | | - |
293 | qreal QGraphicsGridLayout::columnMinimumWidth(int column) const | - |
294 | { | - |
295 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
296 | return d->engine.rowSizeHint(Qt::MinimumSize, column, Qt::Horizontal); executed: return d->engine.rowSizeHint(Qt::MinimumSize, column, Qt::Horizontal); Execution Count:11 | 11 |
297 | } | - |
298 | | - |
299 | | - |
300 | | - |
301 | | - |
302 | void QGraphicsGridLayout::setColumnPreferredWidth(int column, qreal width) | - |
303 | { | - |
304 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
305 | d->engine.setRowSizeHint(Qt::PreferredSize, column, width, Qt::Horizontal); | - |
306 | invalidate(); | - |
307 | } executed: } Execution Count:5 | 5 |
308 | | - |
309 | | - |
310 | | - |
311 | | - |
312 | qreal QGraphicsGridLayout::columnPreferredWidth(int column) const | - |
313 | { | - |
314 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
315 | return d->engine.rowSizeHint(Qt::PreferredSize, column, Qt::Horizontal); executed: return d->engine.rowSizeHint(Qt::PreferredSize, column, Qt::Horizontal); Execution Count:11 | 11 |
316 | } | - |
317 | | - |
318 | | - |
319 | | - |
320 | | - |
321 | void QGraphicsGridLayout::setColumnMaximumWidth(int column, qreal width) | - |
322 | { | - |
323 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
324 | d->engine.setRowSizeHint(Qt::MaximumSize, column, width, Qt::Horizontal); | - |
325 | invalidate(); | - |
326 | } executed: } Execution Count:5 | 5 |
327 | | - |
328 | | - |
329 | | - |
330 | | - |
331 | qreal QGraphicsGridLayout::columnMaximumWidth(int column) const | - |
332 | { | - |
333 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
334 | return d->engine.rowSizeHint(Qt::MaximumSize, column, Qt::Horizontal); executed: return d->engine.rowSizeHint(Qt::MaximumSize, column, Qt::Horizontal); Execution Count:11 | 11 |
335 | } | - |
336 | | - |
337 | | - |
338 | | - |
339 | | - |
340 | void QGraphicsGridLayout::setColumnFixedWidth(int column, qreal width) | - |
341 | { | - |
342 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
343 | d->engine.setRowSizeHint(Qt::MinimumSize, column, width, Qt::Horizontal); | - |
344 | d->engine.setRowSizeHint(Qt::MaximumSize, column, width, Qt::Horizontal); | - |
345 | invalidate(); | - |
346 | } executed: } Execution Count:3 | 3 |
347 | | - |
348 | | - |
349 | | - |
350 | | - |
351 | void QGraphicsGridLayout::setRowAlignment(int row, Qt::Alignment alignment) | - |
352 | { | - |
353 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
354 | d->engine.setRowAlignment(row, alignment, Qt::Vertical); | - |
355 | invalidate(); | - |
356 | } executed: } Execution Count:7 | 7 |
357 | | - |
358 | | - |
359 | | - |
360 | | - |
361 | Qt::Alignment QGraphicsGridLayout::rowAlignment(int row) const | - |
362 | { | - |
363 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
364 | return d->engine.rowAlignment(row, Qt::Vertical); executed: return d->engine.rowAlignment(row, Qt::Vertical); Execution Count:13 | 13 |
365 | } | - |
366 | | - |
367 | | - |
368 | | - |
369 | | - |
370 | void QGraphicsGridLayout::setColumnAlignment(int column, Qt::Alignment alignment) | - |
371 | { | - |
372 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
373 | d->engine.setRowAlignment(column, alignment, Qt::Horizontal); | - |
374 | invalidate(); | - |
375 | } executed: } Execution Count:9 | 9 |
376 | | - |
377 | | - |
378 | | - |
379 | | - |
380 | Qt::Alignment QGraphicsGridLayout::columnAlignment(int column) const | - |
381 | { | - |
382 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
383 | return d->engine.rowAlignment(column, Qt::Horizontal); executed: return d->engine.rowAlignment(column, Qt::Horizontal); Execution Count:7 | 7 |
384 | } | - |
385 | | - |
386 | | - |
387 | | - |
388 | | - |
389 | void QGraphicsGridLayout::setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment) | - |
390 | { | - |
391 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
392 | d->engine.setAlignment(item, alignment); | - |
393 | invalidate(); | - |
394 | } executed: } Execution Count:232 | 232 |
395 | | - |
396 | | - |
397 | | - |
398 | | - |
399 | Qt::Alignment QGraphicsGridLayout::alignment(QGraphicsLayoutItem *item) const | - |
400 | { | - |
401 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
402 | return d->engine.alignment(item); executed: return d->engine.alignment(item); Execution Count:7 | 7 |
403 | } | - |
404 | | - |
405 | | - |
406 | | - |
407 | | - |
408 | | - |
409 | | - |
410 | int QGraphicsGridLayout::rowCount() const | - |
411 | { | - |
412 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
413 | return d->engine.effectiveLastRow(Qt::Vertical) + 1; executed: return d->engine.effectiveLastRow(Qt::Vertical) + 1; Execution Count:288 | 288 |
414 | } | - |
415 | | - |
416 | | - |
417 | | - |
418 | | - |
419 | | - |
420 | | - |
421 | int QGraphicsGridLayout::columnCount() const | - |
422 | { | - |
423 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
424 | return d->engine.effectiveLastRow(Qt::Horizontal) + 1; executed: return d->engine.effectiveLastRow(Qt::Horizontal) + 1; Execution Count:311 | 311 |
425 | } | - |
426 | | - |
427 | | - |
428 | | - |
429 | | - |
430 | QGraphicsLayoutItem *QGraphicsGridLayout::itemAt(int row, int column) const | - |
431 | { | - |
432 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
433 | if (row < 0 || row >= rowCount() || column < 0 || column >= columnCount()) { partially evaluated: row < 0 no Evaluation Count:0 | yes Evaluation Count:283 |
evaluated: row >= rowCount() yes Evaluation Count:1 | yes Evaluation Count:282 |
partially evaluated: column < 0 no Evaluation Count:0 | yes Evaluation Count:282 |
partially evaluated: column >= columnCount() no Evaluation Count:0 | yes Evaluation Count:282 |
| 0-283 |
434 | QMessageLogger("graphicsview/qgraphicsgridlayout.cpp", 535, __PRETTY_FUNCTION__).warning("QGraphicsGridLayout::itemAt: invalid row, column %d, %d", row, column); | - |
435 | return 0; executed: return 0; Execution Count:1 | 1 |
436 | } | - |
437 | if (QGridLayoutItem *item = d->engine.itemAt(row, column)) evaluated: QGridLayoutItem *item = d->engine.itemAt(row, column) yes Evaluation Count:280 | yes Evaluation Count:2 |
| 2-280 |
438 | return item->layoutItem(); executed: return item->layoutItem(); Execution Count:280 | 280 |
439 | return 0; executed: return 0; Execution Count:2 | 2 |
440 | } | - |
441 | | - |
442 | | - |
443 | | - |
444 | | - |
445 | int QGraphicsGridLayout::count() const | - |
446 | { | - |
447 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
448 | return d->engine.itemCount(); executed: return d->engine.itemCount(); Execution Count:524 | 524 |
449 | } | - |
450 | | - |
451 | | - |
452 | | - |
453 | | - |
454 | | - |
455 | QGraphicsLayoutItem *QGraphicsGridLayout::itemAt(int index) const | - |
456 | { | - |
457 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
458 | if (index < 0 || index >= d->engine.itemCount()) { evaluated: index < 0 yes Evaluation Count:2 | yes Evaluation Count:1260 |
evaluated: index >= d->engine.itemCount() yes Evaluation Count:3 | yes Evaluation Count:1257 |
| 2-1260 |
459 | QMessageLogger("graphicsview/qgraphicsgridlayout.cpp", 560, __PRETTY_FUNCTION__).warning("QGraphicsGridLayout::itemAt: invalid index %d", index); | - |
460 | return 0; executed: return 0; Execution Count:5 | 5 |
461 | } | - |
462 | QGraphicsLayoutItem *item = 0; | - |
463 | if (QGridLayoutItem *gridItem = d->engine.itemAt(index)) partially evaluated: QGridLayoutItem *gridItem = d->engine.itemAt(index) yes Evaluation Count:1257 | no Evaluation Count:0 |
| 0-1257 |
464 | item = gridItem->layoutItem(); executed: item = gridItem->layoutItem(); Execution Count:1257 | 1257 |
465 | return item; executed: return item; Execution Count:1257 | 1257 |
466 | } | - |
467 | | - |
468 | | - |
469 | | - |
470 | | - |
471 | | - |
472 | | - |
473 | | - |
474 | void QGraphicsGridLayout::removeAt(int index) | - |
475 | { | - |
476 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
477 | if (index < 0 || index >= d->engine.itemCount()) { evaluated: index < 0 yes Evaluation Count:2 | yes Evaluation Count:507 |
evaluated: index >= d->engine.itemCount() yes Evaluation Count:2 | yes Evaluation Count:505 |
| 2-507 |
478 | QMessageLogger("graphicsview/qgraphicsgridlayout.cpp", 579, __PRETTY_FUNCTION__).warning("QGraphicsGridLayout::removeAt: invalid index %d", index); | - |
479 | return; executed: return; Execution Count:4 | 4 |
480 | } | - |
481 | if (QGridLayoutItem *gridItem = d->engine.itemAt(index)) { partially evaluated: QGridLayoutItem *gridItem = d->engine.itemAt(index) yes Evaluation Count:505 | no Evaluation Count:0 |
| 0-505 |
482 | if (QGraphicsLayoutItem *layoutItem = gridItem->layoutItem()) partially evaluated: QGraphicsLayoutItem *layoutItem = gridItem->layoutItem() yes Evaluation Count:505 | no Evaluation Count:0 |
| 0-505 |
483 | layoutItem->setParentLayoutItem(0); executed: layoutItem->setParentLayoutItem(0); Execution Count:505 | 505 |
484 | d->engine.removeItem(gridItem); | - |
485 | | - |
486 | | - |
487 | for (int j = 0; j < NOrientations; ++j) { evaluated: j < NOrientations yes Evaluation Count:1010 | yes Evaluation Count:505 |
| 505-1010 |
488 | | - |
489 | const Qt::Orientation orient = (j == 0 ? Qt::Horizontal : Qt::Vertical); evaluated: j == 0 yes Evaluation Count:505 | yes Evaluation Count:505 |
| 505 |
490 | const int oldCount = d->engine.rowCount(orient); | - |
491 | if (gridItem->lastRow(orient) == oldCount - 1) { evaluated: gridItem->lastRow(orient) == oldCount - 1 yes Evaluation Count:839 | yes Evaluation Count:171 |
| 171-839 |
492 | const int newCount = d->engine.effectiveLastRow(orient) + 1; | - |
493 | d->engine.removeRows(newCount, oldCount - newCount, orient); | - |
494 | } executed: } Execution Count:839 | 839 |
495 | } executed: } Execution Count:1010 | 1010 |
496 | | - |
497 | delete gridItem; | - |
498 | invalidate(); | - |
499 | } executed: } Execution Count:505 | 505 |
500 | } executed: } Execution Count:505 | 505 |
501 | | - |
502 | | - |
503 | | - |
504 | | - |
505 | | - |
506 | | - |
507 | | - |
508 | void QGraphicsGridLayout::removeItem(QGraphicsLayoutItem *item) | - |
509 | { | - |
510 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
511 | int index = d->engine.indexOf(item); | - |
512 | removeAt(index); | - |
513 | } executed: } Execution Count:4 | 4 |
514 | | - |
515 | | - |
516 | | - |
517 | void QGraphicsGridLayout::invalidate() | - |
518 | { | - |
519 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
520 | d->engine.invalidate(); | - |
521 | QGraphicsLayout::invalidate(); | - |
522 | } executed: } Execution Count:2052 | 2052 |
523 | void QGraphicsGridLayout::setGeometry(const QRectF &rect) | - |
524 | { | - |
525 | QGraphicsGridLayoutPrivate * const d = d_func(); | - |
526 | QGraphicsLayout::setGeometry(rect); | - |
527 | QRectF effectiveRect = geometry(); | - |
528 | qreal left, top, right, bottom; | - |
529 | getContentsMargins(&left, &top, &right, &bottom); | - |
530 | Qt::LayoutDirection visualDir = d->visualDirection(); | - |
531 | d->engine.setVisualDirection(visualDir); | - |
532 | if (visualDir == Qt::RightToLeft) evaluated: visualDir == Qt::RightToLeft yes Evaluation Count:2 | yes Evaluation Count:171 |
| 2-171 |
533 | qSwap(left, right); executed: qSwap(left, right); Execution Count:2 | 2 |
534 | effectiveRect.adjust(+left, +top, -right, -bottom); | - |
535 | d->engine.setGeometries(d->styleInfo(), effectiveRect); | - |
536 | } executed: } Execution Count:173 | 173 |
537 | | - |
538 | | - |
539 | | - |
540 | | - |
541 | QSizeF QGraphicsGridLayout::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const | - |
542 | { | - |
543 | const QGraphicsGridLayoutPrivate * const d = d_func(); | - |
544 | qreal left, top, right, bottom; | - |
545 | getContentsMargins(&left, &top, &right, &bottom); | - |
546 | const QSizeF extraMargins(left + right, top + bottom); | - |
547 | return d->engine.sizeHint(d->styleInfo(), which , constraint - extraMargins) + extraMargins; executed: return d->engine.sizeHint(d->styleInfo(), which , constraint - extraMargins) + extraMargins; Execution Count:582 | 582 |
548 | } | - |
549 | | - |
550 | | - |
| | |