graphicsview/qgraphicslayoutitem.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7static void combineSize(QSizeF &result, const QSizeF &size) -
8{ -
9 if (result.width() < 0)
evaluated: result.width() < 0
TRUEFALSE
yes
Evaluation Count:16679
yes
Evaluation Count:4814
4814-16679
10 result.setWidth(size.width());
executed: result.setWidth(size.width());
Execution Count:16679
16679
11 if (result.height() < 0)
evaluated: result.height() < 0
TRUEFALSE
yes
Evaluation Count:17270
yes
Evaluation Count:4223
4223-17270
12 result.setHeight(size.height());
executed: result.setHeight(size.height());
Execution Count:17270
17270
13}
executed: }
Execution Count:21493
21493
14 -
15static void boundSize(QSizeF &result, const QSizeF &size) -
16{ -
17 if (size.width() >= 0 && size.width() < result.width())
evaluated: size.width() >= 0
TRUEFALSE
yes
Evaluation Count:13829
yes
Evaluation Count:2891
evaluated: size.width() < result.width()
TRUEFALSE
yes
Evaluation Count:317
yes
Evaluation Count:13512
317-13829
18 result.setWidth(size.width());
executed: result.setWidth(size.width());
Execution Count:317
317
19 if (size.height() >= 0 && size.height() < result.height())
evaluated: size.height() >= 0
TRUEFALSE
yes
Evaluation Count:13805
yes
Evaluation Count:2915
evaluated: size.height() < result.height()
TRUEFALSE
yes
Evaluation Count:341
yes
Evaluation Count:13464
341-13805
20 result.setHeight(size.height());
executed: result.setHeight(size.height());
Execution Count:341
341
21}
executed: }
Execution Count:16720
16720
22 -
23static void expandSize(QSizeF &result, const QSizeF &size) -
24{ -
25 if (size.width() >= 0 && size.width() > result.width())
evaluated: size.width() >= 0
TRUEFALSE
yes
Evaluation Count:11966
yes
Evaluation Count:4754
evaluated: size.width() > result.width()
TRUEFALSE
yes
Evaluation Count:367
yes
Evaluation Count:11599
367-11966
26 result.setWidth(size.width());
executed: result.setWidth(size.width());
Execution Count:367
367
27 if (size.height() >= 0 && size.height() > result.height())
evaluated: size.height() >= 0
TRUEFALSE
yes
Evaluation Count:11926
yes
Evaluation Count:4794
evaluated: size.height() > result.height()
TRUEFALSE
yes
Evaluation Count:207
yes
Evaluation Count:11719
207-11926
28 result.setHeight(size.height());
executed: result.setHeight(size.height());
Execution Count:207
207
29}
executed: }
Execution Count:16720
16720
30 -
31static void normalizeHints(qreal &minimum, qreal &preferred, qreal &maximum, qreal &descent) -
32{ -
33 if (minimum >= 0 && maximum >= 0 && minimum > maximum)
evaluated: minimum >= 0
TRUEFALSE
yes
Evaluation Count:4618
yes
Evaluation Count:3742
evaluated: maximum >= 0
TRUEFALSE
yes
Evaluation Count:2052
yes
Evaluation Count:2566
evaluated: minimum > maximum
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2048
4-4618
34 minimum = maximum;
executed: minimum = maximum;
Execution Count:4
4
35 -
36 if (preferred >= 0) {
evaluated: preferred >= 0
TRUEFALSE
yes
Evaluation Count:2554
yes
Evaluation Count:5806
2554-5806
37 if (minimum >= 0 && preferred < minimum) {
evaluated: minimum >= 0
TRUEFALSE
yes
Evaluation Count:2517
yes
Evaluation Count:37
partially evaluated: preferred < minimum
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2517
0-2517
38 preferred = minimum; -
39 } else if (maximum >= 0 && preferred > maximum) {
never executed: }
evaluated: maximum >= 0
TRUEFALSE
yes
Evaluation Count:1388
yes
Evaluation Count:1166
partially evaluated: preferred > maximum
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1388
0-1388
40 preferred = maximum; -
41 }
never executed: }
0
42 } -
43 -
44 if (minimum >= 0 && descent > minimum)
evaluated: minimum >= 0
TRUEFALSE
yes
Evaluation Count:4618
yes
Evaluation Count:3742
partially evaluated: descent > minimum
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4618
0-4618
45 descent = minimum;
never executed: descent = minimum;
0
46}
executed: }
Execution Count:8360
8360
47 -
48 -
49 -
50 -
51QGraphicsLayoutItemPrivate::QGraphicsLayoutItemPrivate(QGraphicsLayoutItem *par, bool layout) -
52 : parent(par), userSizeHints(0), isLayout(layout), ownedByLayout(false), graphicsItem(0) -
53{ -
54}
executed: }
Execution Count:2159
2159
55 -
56 -
57 -
58 -
59QGraphicsLayoutItemPrivate::~QGraphicsLayoutItemPrivate() -
60{ -
61 -
62 delete[] userSizeHints; -
63}
executed: }
Execution Count:1589
1589
64 -
65 -
66 -
67 -
68void QGraphicsLayoutItemPrivate::init() -
69{ -
70 sizeHintCacheDirty = true; -
71 sizeHintWithConstraintCacheDirty = true; -
72}
executed: }
Execution Count:2159
2159
73 -
74 -
75 -
76 -
77QSizeF *QGraphicsLayoutItemPrivate::effectiveSizeHints(const QSizeF &constraint) const -
78{ -
79 const QGraphicsLayoutItem * const q = q_func(); -
80 QSizeF *sizeHintCache; -
81 const bool hasConstraint = constraint.width() >= 0 || constraint.height() >= 0;
evaluated: constraint.width() >= 0
TRUEFALSE
yes
Evaluation Count:933
yes
Evaluation Count:55594
evaluated: constraint.height() >= 0
TRUEFALSE
yes
Evaluation Count:93
yes
Evaluation Count:55501
93-55594
82 if (hasConstraint) {
evaluated: hasConstraint
TRUEFALSE
yes
Evaluation Count:1026
yes
Evaluation Count:55501
1026-55501
83 if (!sizeHintWithConstraintCacheDirty && constraint == cachedConstraint)
evaluated: !sizeHintWithConstraintCacheDirty
TRUEFALSE
yes
Evaluation Count:877
yes
Evaluation Count:149
evaluated: constraint == cachedConstraint
TRUEFALSE
yes
Evaluation Count:830
yes
Evaluation Count:47
47-877
84 return cachedSizeHintsWithConstraints;
executed: return cachedSizeHintsWithConstraints;
Execution Count:830
830
85 sizeHintCache = cachedSizeHintsWithConstraints; -
86 } else {
executed: }
Execution Count:196
196
87 if (!sizeHintCacheDirty)
evaluated: !sizeHintCacheDirty
TRUEFALSE
yes
Evaluation Count:51517
yes
Evaluation Count:3984
3984-51517
88 return cachedSizeHints;
executed: return cachedSizeHints;
Execution Count:51517
51517
89 sizeHintCache = cachedSizeHints; -
90 }
executed: }
Execution Count:3984
3984
91 -
92 for (int i = 0; i < Qt::NSizeHints; ++i) {
evaluated: i < Qt::NSizeHints
TRUEFALSE
yes
Evaluation Count:16720
yes
Evaluation Count:4180
4180-16720
93 sizeHintCache[i] = constraint; -
94 if (userSizeHints)
evaluated: userSizeHints
TRUEFALSE
yes
Evaluation Count:9308
yes
Evaluation Count:7412
7412-9308
95 combineSize(sizeHintCache[i], userSizeHints[i]);
executed: combineSize(sizeHintCache[i], userSizeHints[i]);
Execution Count:9308
9308
96 }
executed: }
Execution Count:16720
16720
97 -
98 QSizeF &minS = sizeHintCache[Qt::MinimumSize]; -
99 QSizeF &prefS = sizeHintCache[Qt::PreferredSize]; -
100 QSizeF &maxS = sizeHintCache[Qt::MaximumSize]; -
101 QSizeF &descentS = sizeHintCache[Qt::MinimumDescent]; -
102 -
103 normalizeHints(minS.rwidth(), prefS.rwidth(), maxS.rwidth(), descentS.rwidth()); -
104 normalizeHints(minS.rheight(), prefS.rheight(), maxS.rheight(), descentS.rheight()); -
105 -
106 -
107 -
108 -
109 do { if ((maxS).width() < 0 || (maxS).height() < 0) combineSize((maxS), (q->sizeHint(Qt::MaximumSize, maxS))); } while (false);
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4180
evaluated: (maxS).width() < 0
TRUEFALSE
yes
Evaluation Count:3115
yes
Evaluation Count:1065
evaluated: (maxS).height() < 0
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:1017
executed: combineSize((maxS), (q->sizeHint(Qt::MaximumSize, maxS)));
Execution Count:3163
executed: }
Execution Count:4180
0-4180
110 combineSize(maxS, QSizeF(((1<<24)-1), ((1<<24)-1))); -
111 expandSize(maxS, prefS); -
112 expandSize(maxS, minS); -
113 boundSize(maxS, QSizeF(((1<<24)-1), ((1<<24)-1))); -
114 -
115 do { if ((minS).width() < 0 || (minS).height() < 0) combineSize((minS), (q->sizeHint(Qt::MinimumSize, minS))); } while (false);
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4180
evaluated: (minS).width() < 0
TRUEFALSE
yes
Evaluation Count:1863
yes
Evaluation Count:2317
evaluated: (minS).height() < 0
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:2277
executed: combineSize((minS), (q->sizeHint(Qt::MinimumSize, minS)));
Execution Count:1903
executed: }
Execution Count:4180
0-4180
116 expandSize(minS, QSizeF(0, 0)); -
117 boundSize(minS, prefS); -
118 boundSize(minS, maxS); -
119 -
120 do { if ((prefS).width() < 0 || (prefS).height() < 0) combineSize((prefS), (q->sizeHint(Qt::PreferredSize, prefS))); } while (false);
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4180
evaluated: (prefS).width() < 0
TRUEFALSE
yes
Evaluation Count:2891
yes
Evaluation Count:1289
evaluated: (prefS).height() < 0
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:1241
executed: combineSize((prefS), (q->sizeHint(Qt::PreferredSize, prefS)));
Execution Count:2939
executed: }
Execution Count:4180
0-4180
121 expandSize(prefS, minS); -
122 boundSize(prefS, maxS); -
123 -
124 -
125 -
126 -
127 if (hasConstraint) {
evaluated: hasConstraint
TRUEFALSE
yes
Evaluation Count:196
yes
Evaluation Count:3984
196-3984
128 cachedConstraint = constraint; -
129 sizeHintWithConstraintCacheDirty = false; -
130 } else {
executed: }
Execution Count:196
196
131 sizeHintCacheDirty = false; -
132 }
executed: }
Execution Count:3984
3984
133 return sizeHintCache;
executed: return sizeHintCache;
Execution Count:4180
4180
134} -
135QGraphicsItem *QGraphicsLayoutItemPrivate::parentItem() const -
136{ -
137 const QGraphicsLayoutItem * const q = q_func(); -
138 -
139 const QGraphicsLayoutItem *parent = q; -
140 while (parent && parent->isLayout()) {
evaluated: parent
TRUEFALSE
yes
Evaluation Count:8878
yes
Evaluation Count:1120
evaluated: parent->isLayout()
TRUEFALSE
yes
Evaluation Count:5330
yes
Evaluation Count:3548
1120-8878
141 parent = parent->parentLayoutItem(); -
142 }
executed: }
Execution Count:5330
5330
143 return parent ? parent->graphicsItem() : 0;
executed: return parent ? parent->graphicsItem() : 0;
Execution Count:4668
4668
144} -
145 -
146 -
147 -
148 -
149 -
150 -
151 -
152void QGraphicsLayoutItemPrivate::ensureUserSizeHints() -
153{ -
154 if (!userSizeHints)
evaluated: !userSizeHints
TRUEFALSE
yes
Evaluation Count:799
yes
Evaluation Count:1203
799-1203
155 userSizeHints = new QSizeF[Qt::NSizeHints];
executed: userSizeHints = new QSizeF[Qt::NSizeHints];
Execution Count:799
799
156}
executed: }
Execution Count:2002
2002
157 -
158 -
159 -
160 -
161 -
162 -
163void QGraphicsLayoutItemPrivate::setSize(Qt::SizeHint which, const QSizeF &size) -
164{ -
165 QGraphicsLayoutItem * const q = q_func(); -
166 -
167 if (userSizeHints) {
evaluated: userSizeHints
TRUEFALSE
yes
Evaluation Count:1204
yes
Evaluation Count:810
810-1204
168 if (size == userSizeHints[which])
evaluated: size == userSizeHints[which]
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1202
2-1202
169 return;
executed: return;
Execution Count:2
2
170 } else if (size.width() < 0 && size.height() < 0) {
evaluated: size.width() < 0
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:799
partially evaluated: size.height() < 0
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
executed: }
Execution Count:1202
0-1202
171 return;
executed: return;
Execution Count:11
11
172 } -
173 -
174 ensureUserSizeHints(); -
175 userSizeHints[which] = size; -
176 q->updateGeometry(); -
177}
executed: }
Execution Count:2001
2001
178 -
179 -
180 -
181 -
182 -
183 -
184void QGraphicsLayoutItemPrivate::setSizeComponent( -
185 Qt::SizeHint which, SizeComponent component, qreal value) -
186{ -
187 QGraphicsLayoutItem * const q = q_func(); -
188 ensureUserSizeHints(); -
189 qreal &userValue = (component == Width)
partially evaluated: (component == Width)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
190 ? userSizeHints[which].rwidth() -
191 : userSizeHints[which].rheight(); -
192 if (value == userValue)
partially evaluated: value == userValue
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
193 return;
never executed: return;
0
194 userValue = value; -
195 q->updateGeometry(); -
196}
executed: }
Execution Count:1
1
197 -
198 -
199bool QGraphicsLayoutItemPrivate::hasHeightForWidth() const -
200{ -
201 const QGraphicsLayoutItem * const q = q_func(); -
202 if (isLayout) {
evaluated: isLayout
TRUEFALSE
yes
Evaluation Count:480
yes
Evaluation Count:4518
480-4518
203 const QGraphicsLayout *l = static_cast<const QGraphicsLayout *>(q); -
204 for (int i = l->count() - 1; i >= 0; --i) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:332
yes
Evaluation Count:480
332-480
205 if (QGraphicsLayoutItemPrivate::get(l->itemAt(i))->hasHeightForWidth())
partially evaluated: QGraphicsLayoutItemPrivate::get(l->itemAt(i))->hasHeightForWidth()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:332
0-332
206 return true;
never executed: return true;
0
207 }
executed: }
Execution Count:332
332
208 } else if (QGraphicsItem *item = q->graphicsItem()) {
partially evaluated: QGraphicsItem *item = q->graphicsItem()
TRUEFALSE
yes
Evaluation Count:4518
no
Evaluation Count:0
executed: }
Execution Count:480
0-4518
209 if (item->isWidget()) {
evaluated: item->isWidget()
TRUEFALSE
yes
Evaluation Count:4500
yes
Evaluation Count:18
18-4500
210 QGraphicsWidget *w = static_cast<QGraphicsWidget *>(item); -
211 if (w->layout()) {
evaluated: w->layout()
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:4434
66-4434
212 return QGraphicsLayoutItemPrivate::get(w->layout())->hasHeightForWidth();
executed: return QGraphicsLayoutItemPrivate::get(w->layout())->hasHeightForWidth();
Execution Count:66
66
213 } -
214 }
executed: }
Execution Count:4434
4434
215 }
executed: }
Execution Count:4452
4452
216 return q->sizePolicy().hasHeightForWidth();
executed: return q->sizePolicy().hasHeightForWidth();
Execution Count:4932
4932
217} -
218 -
219bool QGraphicsLayoutItemPrivate::hasWidthForHeight() const -
220{ -
221 const QGraphicsLayoutItem * const q = q_func(); -
222 if (isLayout) {
evaluated: isLayout
TRUEFALSE
yes
Evaluation Count:480
yes
Evaluation Count:3306
480-3306
223 const QGraphicsLayout *l = static_cast<const QGraphicsLayout *>(q); -
224 for (int i = l->count() - 1; i >= 0; --i) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:332
yes
Evaluation Count:480
332-480
225 if (QGraphicsLayoutItemPrivate::get(l->itemAt(i))->hasWidthForHeight())
partially evaluated: QGraphicsLayoutItemPrivate::get(l->itemAt(i))->hasWidthForHeight()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:332
0-332
226 return true;
never executed: return true;
0
227 }
executed: }
Execution Count:332
332
228 } else if (QGraphicsItem *item = q->graphicsItem()) {
partially evaluated: QGraphicsItem *item = q->graphicsItem()
TRUEFALSE
yes
Evaluation Count:3306
no
Evaluation Count:0
executed: }
Execution Count:480
0-3306
229 if (item->isWidget()) {
evaluated: item->isWidget()
TRUEFALSE
yes
Evaluation Count:3288
yes
Evaluation Count:18
18-3288
230 QGraphicsWidget *w = static_cast<QGraphicsWidget *>(item); -
231 if (w->layout()) {
evaluated: w->layout()
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:3222
66-3222
232 return QGraphicsLayoutItemPrivate::get(w->layout())->hasWidthForHeight();
executed: return QGraphicsLayoutItemPrivate::get(w->layout())->hasWidthForHeight();
Execution Count:66
66
233 } -
234 }
executed: }
Execution Count:3222
3222
235 }
executed: }
Execution Count:3240
3240
236 return q->sizePolicy().hasWidthForHeight();
executed: return q->sizePolicy().hasWidthForHeight();
Execution Count:3720
3720
237} -
238QGraphicsLayoutItem::QGraphicsLayoutItem(QGraphicsLayoutItem *parent, bool isLayout) -
239 : d_ptr(new QGraphicsLayoutItemPrivate(parent, isLayout)) -
240{ -
241 QGraphicsLayoutItemPrivate * const d = d_func(); -
242 d->init(); -
243 d->sizePolicy = QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); -
244 d->q_ptr = this; -
245}
executed: }
Execution Count:1489
1489
246 -
247 -
248 -
249 -
250QGraphicsLayoutItem::QGraphicsLayoutItem(QGraphicsLayoutItemPrivate &dd) -
251 : d_ptr(&dd) -
252{ -
253 QGraphicsLayoutItemPrivate * const d = d_func(); -
254 d->init(); -
255 d->q_ptr = this; -
256}
executed: }
Execution Count:670
670
257 -
258 -
259 -
260 -
261QGraphicsLayoutItem::~QGraphicsLayoutItem() -
262{ -
263 QGraphicsLayoutItem *parentLI = parentLayoutItem(); -
264 if (parentLI && parentLI->isLayout()) {
evaluated: parentLI
TRUEFALSE
yes
Evaluation Count:201
yes
Evaluation Count:1388
evaluated: parentLI->isLayout()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:195
6-1388
265 QGraphicsLayout *lay = static_cast<QGraphicsLayout*>(parentLI); -
266 -
267 for (int i = lay->count() - 1; i >= 0; --i) {
partially evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-12
268 if (lay->itemAt(i) == this) {
evaluated: lay->itemAt(i) == this
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:6
6
269 lay->removeAt(i); -
270 break;
executed: break;
Execution Count:6
6
271 } -
272 }
executed: }
Execution Count:6
6
273 }
executed: }
Execution Count:6
6
274}
executed: }
Execution Count:1589
1589
275void QGraphicsLayoutItem::setSizePolicy(const QSizePolicy &policy) -
276{ -
277 QGraphicsLayoutItemPrivate * const d = d_func(); -
278 if (d->sizePolicy == policy)
evaluated: d->sizePolicy == policy
TRUEFALSE
yes
Evaluation Count:1764
yes
Evaluation Count:321
321-1764
279 return;
executed: return;
Execution Count:1764
1764
280 d->sizePolicy = policy; -
281 updateGeometry(); -
282}
executed: }
Execution Count:321
321
283void QGraphicsLayoutItem::setSizePolicy(QSizePolicy::Policy hPolicy, -
284 QSizePolicy::Policy vPolicy, -
285 QSizePolicy::ControlType controlType) -
286{ -
287 setSizePolicy(QSizePolicy(hPolicy, vPolicy, controlType)); -
288}
executed: }
Execution Count:133
133
289 -
290 -
291 -
292 -
293 -
294 -
295QSizePolicy QGraphicsLayoutItem::sizePolicy() const -
296{ -
297 const QGraphicsLayoutItemPrivate * const d = d_func(); -
298 return d->sizePolicy;
executed: return d->sizePolicy;
Execution Count:53795
53795
299} -
300void QGraphicsLayoutItem::setMinimumSize(const QSizeF &size) -
301{ -
302 d_ptr->setSize(Qt::MinimumSize, size); -
303}
executed: }
Execution Count:782
782
304QSizeF QGraphicsLayoutItem::minimumSize() const -
305{ -
306 return effectiveSizeHint(Qt::MinimumSize);
executed: return effectiveSizeHint(Qt::MinimumSize);
Execution Count:58
58
307} -
308 -
309 -
310 -
311 -
312 -
313 -
314void QGraphicsLayoutItem::setMinimumWidth(qreal width) -
315{ -
316 d_ptr->setSizeComponent(Qt::MinimumSize, d_ptr->Width, width); -
317}
never executed: }
0
318 -
319 -
320 -
321 -
322 -
323 -
324void QGraphicsLayoutItem::setMinimumHeight(qreal height) -
325{ -
326 d_ptr->setSizeComponent(Qt::MinimumSize, d_ptr->Height, height); -
327}
never executed: }
0
328void QGraphicsLayoutItem::setPreferredSize(const QSizeF &size) -
329{ -
330 d_ptr->setSize(Qt::PreferredSize, size); -
331}
executed: }
Execution Count:532
532
332QSizeF QGraphicsLayoutItem::preferredSize() const -
333{ -
334 return effectiveSizeHint(Qt::PreferredSize);
executed: return effectiveSizeHint(Qt::PreferredSize);
Execution Count:30
30
335} -
336 -
337 -
338 -
339 -
340 -
341 -
342void QGraphicsLayoutItem::setPreferredHeight(qreal height) -
343{ -
344 d_ptr->setSizeComponent(Qt::PreferredSize, d_ptr->Height, height); -
345}
never executed: }
0
346 -
347 -
348 -
349 -
350 -
351 -
352void QGraphicsLayoutItem::setPreferredWidth(qreal width) -
353{ -
354 d_ptr->setSizeComponent(Qt::PreferredSize, d_ptr->Width, width); -
355}
never executed: }
0
356void QGraphicsLayoutItem::setMaximumSize(const QSizeF &size) -
357{ -
358 d_ptr->setSize(Qt::MaximumSize, size); -
359}
executed: }
Execution Count:700
700
360QSizeF QGraphicsLayoutItem::maximumSize() const -
361{ -
362 return effectiveSizeHint(Qt::MaximumSize);
executed: return effectiveSizeHint(Qt::MaximumSize);
Execution Count:67
67
363} -
364 -
365 -
366 -
367 -
368 -
369 -
370void QGraphicsLayoutItem::setMaximumWidth(qreal width) -
371{ -
372 d_ptr->setSizeComponent(Qt::MaximumSize, d_ptr->Width, width); -
373}
never executed: }
0
374 -
375 -
376 -
377 -
378 -
379 -
380void QGraphicsLayoutItem::setMaximumHeight(qreal height) -
381{ -
382 d_ptr->setSizeComponent(Qt::MaximumSize, d_ptr->Height, height); -
383}
executed: }
Execution Count:1
1
384void QGraphicsLayoutItem::setGeometry(const QRectF &rect) -
385{ -
386 QGraphicsLayoutItemPrivate * const d = d_func(); -
387 QSizeF effectiveSize = rect.size().expandedTo(effectiveSizeHint(Qt::MinimumSize)) -
388 .boundedTo(effectiveSizeHint(Qt::MaximumSize)); -
389 d->geom = QRectF(rect.topLeft(), effectiveSize); -
390}
executed: }
Execution Count:2473
2473
391QRectF QGraphicsLayoutItem::geometry() const -
392{ -
393 const QGraphicsLayoutItemPrivate * const d = d_func(); -
394 return d->geom;
executed: return d->geom;
Execution Count:10101
10101
395} -
396void QGraphicsLayoutItem::getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const -
397{ -
398 if (left)
partially evaluated: left
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
399 *left = 0;
executed: *left = 0;
Execution Count:3
3
400 if (top)
partially evaluated: top
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
401 *top = 0;
executed: *top = 0;
Execution Count:3
3
402 if (right)
partially evaluated: right
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
403 *right = 0;
executed: *right = 0;
Execution Count:3
3
404 if (bottom)
partially evaluated: bottom
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
405 *bottom = 0;
executed: *bottom = 0;
Execution Count:3
3
406}
executed: }
Execution Count:3
3
407QRectF QGraphicsLayoutItem::contentsRect() const -
408{ -
409 qreal left, top, right, bottom; -
410 getContentsMargins(&left, &top, &right, &bottom); -
411 return QRectF(QPointF(), geometry().size()).adjusted(+left, +top, -right, -bottom);
executed: return QRectF(QPointF(), geometry().size()).adjusted(+left, +top, -right, -bottom);
Execution Count:370
370
412} -
413QSizeF QGraphicsLayoutItem::effectiveSizeHint(Qt::SizeHint which, const QSizeF &constraint) const -
414{ -
415 const QGraphicsLayoutItemPrivate * const d = d_func(); -
416 -
417 if (!d->userSizeHints && constraint.isValid())
evaluated: !d->userSizeHints
TRUEFALSE
yes
Evaluation Count:18556
yes
Evaluation Count:37981
evaluated: constraint.isValid()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:18546
10-37981
418 return constraint;
executed: return constraint;
Execution Count:10
10
419 -
420 -
421 return d_ptr->effectiveSizeHints(constraint)[which];
executed: return d_ptr->effectiveSizeHints(constraint)[which];
Execution Count:56527
56527
422} -
423void QGraphicsLayoutItem::updateGeometry() -
424{ -
425 QGraphicsLayoutItemPrivate * const d = d_func(); -
426 d->sizeHintCacheDirty = true; -
427 d->sizeHintWithConstraintCacheDirty = true; -
428}
executed: }
Execution Count:3571
3571
429QGraphicsLayoutItem *QGraphicsLayoutItem::parentLayoutItem() const -
430{ -
431 return d_func()->parent;
executed: return d_func()->parent;
Execution Count:25841
25841
432} -
433 -
434 -
435 -
436 -
437 -
438 -
439void QGraphicsLayoutItem::setParentLayoutItem(QGraphicsLayoutItem *parent) -
440{ -
441 d_func()->parent = parent; -
442}
executed: }
Execution Count:5012
5012
443bool QGraphicsLayoutItem::isLayout() const -
444{ -
445 return d_func()->isLayout;
executed: return d_func()->isLayout;
Execution Count:30024
30024
446} -
447bool QGraphicsLayoutItem::ownedByLayout() const -
448{ -
449 return d_func()->ownedByLayout;
executed: return d_func()->ownedByLayout;
Execution Count:1071
1071
450} -
451 -
452 -
453 -
454 -
455 -
456 -
457 -
458void QGraphicsLayoutItem::setOwnedByLayout(bool ownership) -
459{ -
460 d_func()->ownedByLayout = ownership; -
461}
executed: }
Execution Count:673
673
462QGraphicsItem *QGraphicsLayoutItem::graphicsItem() const -
463{ -
464 return d_func()->graphicsItem;
executed: return d_func()->graphicsItem;
Execution Count:12761
12761
465} -
466void QGraphicsLayoutItem::setGraphicsItem(QGraphicsItem *item) -
467{ -
468 d_func()->graphicsItem = item; -
469}
executed: }
Execution Count:1447
1447
470 -
471 -
472 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial