Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | inline static QRect fromLayoutItemRect(QWidgetPrivate *priv, const QRect &rect) | - |
6 | { | - |
7 | return rect.adjusted(priv->leftLayoutItemMargin, priv->topLayoutItemMargin, | 11409 |
8 | -priv->rightLayoutItemMargin, -priv->bottomLayoutItemMargin); executed: return rect.adjusted(priv->leftLayoutItemMargin, priv->topLayoutItemMargin, -priv->rightLayoutItemMargin, -priv->bottomLayoutItemMargin); Execution Count:11409 | 11409 |
9 | } | - |
10 | | - |
11 | inline static QSize fromLayoutItemSize(QWidgetPrivate *priv, const QSize &size) | - |
12 | { | - |
13 | return fromLayoutItemRect(priv, QRect(QPoint(0, 0), size)).size(); executed: return fromLayoutItemRect(priv, QRect(QPoint(0, 0), size)).size(); Execution Count:274 | 274 |
14 | } | - |
15 | | - |
16 | inline static QRect toLayoutItemRect(QWidgetPrivate *priv, const QRect &rect) | - |
17 | { | - |
18 | return rect.adjusted(-priv->leftLayoutItemMargin, -priv->topLayoutItemMargin, | 35043 |
19 | priv->rightLayoutItemMargin, priv->bottomLayoutItemMargin); executed: return rect.adjusted(-priv->leftLayoutItemMargin, -priv->topLayoutItemMargin, priv->rightLayoutItemMargin, priv->bottomLayoutItemMargin); Execution Count:35043 | 35043 |
20 | } | - |
21 | | - |
22 | inline static QSize toLayoutItemSize(QWidgetPrivate *priv, const QSize &size) | - |
23 | { | - |
24 | return toLayoutItemRect(priv, QRect(QPoint(0, 0), size)).size(); executed: return toLayoutItemRect(priv, QRect(QPoint(0, 0), size)).size(); Execution Count:30542 | 30542 |
25 | } | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | QSizePolicy::operator QVariant() const | - |
31 | { | - |
32 | return QVariant(QVariant::SizePolicy, this); executed: return QVariant(QVariant::SizePolicy, this); Execution Count:2 | 2 |
33 | } | - |
34 | void QLayoutItem::setAlignment(Qt::Alignment alignment) | - |
35 | { | - |
36 | align = alignment; | - |
37 | } executed: } Execution Count:18140 | 18140 |
38 | QSpacerItem::~QSpacerItem() {} | - |
39 | void QSpacerItem::changeSize(int w, int h, QSizePolicy::Policy hPolicy, | - |
40 | QSizePolicy::Policy vPolicy) | - |
41 | { | - |
42 | width = w; | - |
43 | height = h; | - |
44 | sizeP = QSizePolicy(hPolicy, vPolicy); | - |
45 | } executed: } Execution Count:1483 | 1483 |
46 | QWidgetItem::~QWidgetItem() {} | - |
47 | | - |
48 | | - |
49 | | - |
50 | | - |
51 | QLayoutItem::~QLayoutItem() | - |
52 | { | - |
53 | } | - |
54 | | - |
55 | | - |
56 | | - |
57 | | - |
58 | void QLayoutItem::invalidate() | - |
59 | { | - |
60 | } | - |
61 | | - |
62 | | - |
63 | | - |
64 | | - |
65 | | - |
66 | QLayout * QLayoutItem::layout() | - |
67 | { | - |
68 | return 0; executed: return 0; Execution Count:19142 | 19142 |
69 | } | - |
70 | | - |
71 | | - |
72 | | - |
73 | | - |
74 | | - |
75 | QSpacerItem * QLayoutItem::spacerItem() | - |
76 | { | - |
77 | return 0; never executed: return 0; | 0 |
78 | } | - |
79 | | - |
80 | | - |
81 | | - |
82 | | - |
83 | QLayout * QLayout::layout() | - |
84 | { | - |
85 | return this; executed: return this; Execution Count:7000 | 7000 |
86 | } | - |
87 | | - |
88 | | - |
89 | | - |
90 | | - |
91 | QSpacerItem * QSpacerItem::spacerItem() | - |
92 | { | - |
93 | return this; executed: return this; Execution Count:1479 | 1479 |
94 | } | - |
95 | | - |
96 | | - |
97 | | - |
98 | | - |
99 | | - |
100 | QWidget * QLayoutItem::widget() | - |
101 | { | - |
102 | return 0; executed: return 0; Execution Count:13640 | 13640 |
103 | } | - |
104 | | - |
105 | | - |
106 | | - |
107 | | - |
108 | QWidget *QWidgetItem::widget() | - |
109 | { | - |
110 | return wid; executed: return wid; Execution Count:82691 | 82691 |
111 | } | - |
112 | bool QLayoutItem::hasHeightForWidth() const | - |
113 | { | - |
114 | return false; executed: return false; Execution Count:3448 | 3448 |
115 | } | - |
116 | | - |
117 | | - |
118 | | - |
119 | | - |
120 | | - |
121 | | - |
122 | int QLayoutItem::minimumHeightForWidth(int w) const | - |
123 | { | - |
124 | return heightForWidth(w); executed: return heightForWidth(w); Execution Count:3 | 3 |
125 | } | - |
126 | int QLayoutItem::heightForWidth(int ) const | - |
127 | { | - |
128 | return -1; never executed: return -1; | 0 |
129 | } | - |
130 | QSizePolicy::ControlTypes QLayoutItem::controlTypes() const | - |
131 | { | - |
132 | return QSizePolicy::DefaultType; executed: return QSizePolicy::DefaultType; Execution Count:28 | 28 |
133 | } | - |
134 | | - |
135 | | - |
136 | | - |
137 | | - |
138 | void QSpacerItem::setGeometry(const QRect &r) | - |
139 | { | - |
140 | rect = r; | - |
141 | } executed: } Execution Count:1999 | 1999 |
142 | | - |
143 | | - |
144 | | - |
145 | | - |
146 | void QWidgetItem::setGeometry(const QRect &rect) | - |
147 | { | - |
148 | if (isEmpty()) evaluated: isEmpty() yes Evaluation Count:1430 | yes Evaluation Count:11174 |
| 1430-11174 |
149 | return; executed: return; Execution Count:1430 | 1430 |
150 | | - |
151 | QRect r = !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) evaluated: !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) yes Evaluation Count:11135 | yes Evaluation Count:39 |
| 39-11135 |
152 | ? fromLayoutItemRect(wid->d_func(), rect) | - |
153 | : rect; | - |
154 | const QSize widgetRectSurplus = r.size() - rect.size(); | - |
155 | QSize s = r.size().boundedTo(maximumSize() + widgetRectSurplus); | - |
156 | int x = r.x(); | - |
157 | int y = r.y(); | - |
158 | if (align & (Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask)) { evaluated: align & (Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask) yes Evaluation Count:295 | yes Evaluation Count:10879 |
| 295-10879 |
159 | QSize pref(sizeHint()); | - |
160 | QSizePolicy sp = wid->sizePolicy(); | - |
161 | if (sp.horizontalPolicy() == QSizePolicy::Ignored) partially evaluated: sp.horizontalPolicy() == QSizePolicy::Ignored no Evaluation Count:0 | yes Evaluation Count:295 |
| 0-295 |
162 | pref.setWidth(wid->sizeHint().expandedTo(wid->minimumSize()).width()); never executed: pref.setWidth(wid->sizeHint().expandedTo(wid->minimumSize()).width()); | 0 |
163 | if (sp.verticalPolicy() == QSizePolicy::Ignored) partially evaluated: sp.verticalPolicy() == QSizePolicy::Ignored no Evaluation Count:0 | yes Evaluation Count:295 |
| 0-295 |
164 | pref.setHeight(wid->sizeHint().expandedTo(wid->minimumSize()).height()); never executed: pref.setHeight(wid->sizeHint().expandedTo(wid->minimumSize()).height()); | 0 |
165 | pref += widgetRectSurplus; | - |
166 | if (align & Qt::AlignHorizontal_Mask) evaluated: align & Qt::AlignHorizontal_Mask yes Evaluation Count:31 | yes Evaluation Count:264 |
| 31-264 |
167 | s.setWidth(qMin(s.width(), pref.width())); executed: s.setWidth(qMin(s.width(), pref.width())); Execution Count:31 | 31 |
168 | if (align & Qt::AlignVertical_Mask) { evaluated: align & Qt::AlignVertical_Mask yes Evaluation Count:293 | yes Evaluation Count:2 |
| 2-293 |
169 | if (hasHeightForWidth()) partially evaluated: hasHeightForWidth() no Evaluation Count:0 | yes Evaluation Count:293 |
| 0-293 |
170 | s.setHeight(qMin(s.height(), | 0 |
171 | heightForWidth(s.width() - widgetRectSurplus.width()) | 0 |
172 | + widgetRectSurplus.height())); never executed: s.setHeight(qMin(s.height(), heightForWidth(s.width() - widgetRectSurplus.width()) + widgetRectSurplus.height())); | 0 |
173 | else | - |
174 | s.setHeight(qMin(s.height(), pref.height())); executed: s.setHeight(qMin(s.height(), pref.height())); Execution Count:293 | 293 |
175 | } | - |
176 | } executed: } Execution Count:295 | 295 |
177 | Qt::Alignment alignHoriz = QStyle::visualAlignment(wid->layoutDirection(), align); | - |
178 | if (alignHoriz & Qt::AlignRight) evaluated: alignHoriz & Qt::AlignRight yes Evaluation Count:181 | yes Evaluation Count:10993 |
| 181-10993 |
179 | x = x + (r.width() - s.width()); executed: x = x + (r.width() - s.width()); Execution Count:181 | 181 |
180 | else if (!(alignHoriz & Qt::AlignLeft)) evaluated: !(alignHoriz & Qt::AlignLeft) yes Evaluation Count:6 | yes Evaluation Count:10987 |
| 6-10987 |
181 | x = x + (r.width() - s.width()) / 2; executed: x = x + (r.width() - s.width()) / 2; Execution Count:6 | 6 |
182 | | - |
183 | if (align & Qt::AlignBottom) evaluated: align & Qt::AlignBottom yes Evaluation Count:16 | yes Evaluation Count:11158 |
| 16-11158 |
184 | y = y + (r.height() - s.height()); executed: y = y + (r.height() - s.height()); Execution Count:16 | 16 |
185 | else if (!(align & Qt::AlignTop)) evaluated: !(align & Qt::AlignTop) yes Evaluation Count:10885 | yes Evaluation Count:273 |
| 273-10885 |
186 | y = y + (r.height() - s.height()) / 2; executed: y = y + (r.height() - s.height()) / 2; Execution Count:10885 | 10885 |
187 | | - |
188 | wid->setGeometry(x, y, s.width(), s.height()); | - |
189 | } executed: } Execution Count:11174 | 11174 |
190 | | - |
191 | | - |
192 | | - |
193 | | - |
194 | QRect QSpacerItem::geometry() const | - |
195 | { | - |
196 | return rect; never executed: return rect; | 0 |
197 | } | - |
198 | | - |
199 | | - |
200 | | - |
201 | | - |
202 | QRect QWidgetItem::geometry() const | - |
203 | { | - |
204 | return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) | 4501 |
205 | ? toLayoutItemRect(wid->d_func(), wid->geometry()) | 4501 |
206 | : wid->geometry(); executed: return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) ? toLayoutItemRect(wid->d_func(), wid->geometry()) : wid->geometry(); Execution Count:4501 | 4501 |
207 | } | - |
208 | | - |
209 | | - |
210 | | - |
211 | | - |
212 | | - |
213 | bool QWidgetItem::hasHeightForWidth() const | - |
214 | { | - |
215 | if (isEmpty()) evaluated: isEmpty() yes Evaluation Count:2541 | yes Evaluation Count:18198 |
| 2541-18198 |
216 | return false; executed: return false; Execution Count:2541 | 2541 |
217 | return wid->hasHeightForWidth(); executed: return wid->hasHeightForWidth(); Execution Count:18198 | 18198 |
218 | } | - |
219 | | - |
220 | | - |
221 | | - |
222 | | - |
223 | int QWidgetItem::heightForWidth(int w) const | - |
224 | { | - |
225 | if (isEmpty()) partially evaluated: isEmpty() no Evaluation Count:0 | yes Evaluation Count:274 |
| 0-274 |
226 | return -1; never executed: return -1; | 0 |
227 | | - |
228 | w = !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) partially evaluated: !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) yes Evaluation Count:274 | no Evaluation Count:0 |
| 0-274 |
229 | ? fromLayoutItemSize(wid->d_func(), QSize(w, 0)).width() | - |
230 | : w; | - |
231 | | - |
232 | int hfw; | - |
233 | if (wid->layout()) evaluated: wid->layout() yes Evaluation Count:69 | yes Evaluation Count:205 |
| 69-205 |
234 | hfw = wid->layout()->totalHeightForWidth(w); executed: hfw = wid->layout()->totalHeightForWidth(w); Execution Count:69 | 69 |
235 | else | - |
236 | hfw = wid->heightForWidth(w); executed: hfw = wid->heightForWidth(w); Execution Count:205 | 205 |
237 | | - |
238 | if (hfw > wid->maximumHeight()) evaluated: hfw > wid->maximumHeight() yes Evaluation Count:4 | yes Evaluation Count:270 |
| 4-270 |
239 | hfw = wid->maximumHeight(); executed: hfw = wid->maximumHeight(); Execution Count:4 | 4 |
240 | if (hfw < wid->minimumHeight()) evaluated: hfw < wid->minimumHeight() yes Evaluation Count:57 | yes Evaluation Count:217 |
| 57-217 |
241 | hfw = wid->minimumHeight(); executed: hfw = wid->minimumHeight(); Execution Count:57 | 57 |
242 | | - |
243 | hfw = !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) partially evaluated: !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) yes Evaluation Count:274 | no Evaluation Count:0 |
| 0-274 |
244 | ? toLayoutItemSize(wid->d_func(), QSize(0, hfw)).height() | - |
245 | : hfw; | - |
246 | | - |
247 | if (hfw < 0) partially evaluated: hfw < 0 no Evaluation Count:0 | yes Evaluation Count:274 |
| 0-274 |
248 | hfw = 0; | 0 |
249 | return hfw; executed: return hfw; Execution Count:274 | 274 |
250 | } | - |
251 | | - |
252 | | - |
253 | | - |
254 | | - |
255 | Qt::Orientations QSpacerItem::expandingDirections() const | - |
256 | { | - |
257 | return sizeP.expandingDirections(); executed: return sizeP.expandingDirections(); Execution Count:3047 | 3047 |
258 | } | - |
259 | | - |
260 | | - |
261 | | - |
262 | | - |
263 | Qt::Orientations QWidgetItem::expandingDirections() const | - |
264 | { | - |
265 | if (isEmpty()) evaluated: isEmpty() yes Evaluation Count:1917 | yes Evaluation Count:20188 |
| 1917-20188 |
266 | return Qt::Orientations(0); executed: return Qt::Orientations(0); Execution Count:1917 | 1917 |
267 | | - |
268 | Qt::Orientations e = wid->sizePolicy().expandingDirections(); | - |
269 | | - |
270 | | - |
271 | | - |
272 | | - |
273 | if (wid->layout()) { evaluated: wid->layout() yes Evaluation Count:2893 | yes Evaluation Count:17295 |
| 2893-17295 |
274 | if (wid->sizePolicy().horizontalPolicy() & QSizePolicy::GrowFlag evaluated: wid->sizePolicy().horizontalPolicy() & QSizePolicy::GrowFlag yes Evaluation Count:2464 | yes Evaluation Count:429 |
| 429-2464 |
275 | && (wid->layout()->expandingDirections() & Qt::Horizontal)) evaluated: (wid->layout()->expandingDirections() & Qt::Horizontal) yes Evaluation Count:915 | yes Evaluation Count:1549 |
| 915-1549 |
276 | e |= Qt::Horizontal; executed: e |= Qt::Horizontal; Execution Count:915 | 915 |
277 | if (wid->sizePolicy().verticalPolicy() & QSizePolicy::GrowFlag evaluated: wid->sizePolicy().verticalPolicy() & QSizePolicy::GrowFlag yes Evaluation Count:2511 | yes Evaluation Count:382 |
| 382-2511 |
278 | && (wid->layout()->expandingDirections() & Qt::Vertical)) evaluated: (wid->layout()->expandingDirections() & Qt::Vertical) yes Evaluation Count:1003 | yes Evaluation Count:1508 |
| 1003-1508 |
279 | e |= Qt::Vertical; executed: e |= Qt::Vertical; Execution Count:1003 | 1003 |
280 | } executed: } Execution Count:2893 | 2893 |
281 | | - |
282 | if (align & Qt::AlignHorizontal_Mask) evaluated: align & Qt::AlignHorizontal_Mask yes Evaluation Count:42 | yes Evaluation Count:20146 |
| 42-20146 |
283 | e &= ~Qt::Horizontal; executed: e &= ~Qt::Horizontal; Execution Count:42 | 42 |
284 | if (align & Qt::AlignVertical_Mask) evaluated: align & Qt::AlignVertical_Mask yes Evaluation Count:275 | yes Evaluation Count:19913 |
| 275-19913 |
285 | e &= ~Qt::Vertical; executed: e &= ~Qt::Vertical; Execution Count:275 | 275 |
286 | return e; executed: return e; Execution Count:20188 | 20188 |
287 | } | - |
288 | | - |
289 | | - |
290 | | - |
291 | | - |
292 | QSize QSpacerItem::minimumSize() const | - |
293 | { | - |
294 | return QSize(sizeP.horizontalPolicy() & QSizePolicy::ShrinkFlag ? 0 : width, | 3038 |
295 | sizeP.verticalPolicy() & QSizePolicy::ShrinkFlag ? 0 : height); executed: return QSize(sizeP.horizontalPolicy() & QSizePolicy::ShrinkFlag ? 0 : width, sizeP.verticalPolicy() & QSizePolicy::ShrinkFlag ? 0 : height); Execution Count:3038 | 3038 |
296 | } | - |
297 | | - |
298 | | - |
299 | | - |
300 | | - |
301 | QSize QWidgetItem::minimumSize() const | - |
302 | { | - |
303 | if (isEmpty()) evaluated: isEmpty() yes Evaluation Count:2 | yes Evaluation Count:29 |
| 2-29 |
304 | return QSize(0, 0); executed: return QSize(0, 0); Execution Count:2 | 2 |
305 | return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) | 29 |
306 | ? toLayoutItemSize(wid->d_func(), qSmartMinSize(this)) | 29 |
307 | : qSmartMinSize(this); executed: return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) ? toLayoutItemSize(wid->d_func(), qSmartMinSize(this)) : qSmartMinSize(this); Execution Count:29 | 29 |
308 | } | - |
309 | | - |
310 | | - |
311 | | - |
312 | | - |
313 | QSize QSpacerItem::maximumSize() const | - |
314 | { | - |
315 | return QSize(sizeP.horizontalPolicy() & QSizePolicy::GrowFlag ? QLAYOUTSIZE_MAX : width, | 3014 |
316 | sizeP.verticalPolicy() & QSizePolicy::GrowFlag ? QLAYOUTSIZE_MAX : height); executed: return QSize(sizeP.horizontalPolicy() & QSizePolicy::GrowFlag ? QLAYOUTSIZE_MAX : width, sizeP.verticalPolicy() & QSizePolicy::GrowFlag ? QLAYOUTSIZE_MAX : height); Execution Count:3014 | 3014 |
317 | } | - |
318 | | - |
319 | | - |
320 | | - |
321 | | - |
322 | QSize QWidgetItem::maximumSize() const | - |
323 | { | - |
324 | if (isEmpty()) { evaluated: isEmpty() yes Evaluation Count:2 | yes Evaluation Count:56 |
| 2-56 |
325 | return QSize(0, 0); executed: return QSize(0, 0); Execution Count:2 | 2 |
326 | } else { | - |
327 | return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) | 56 |
328 | ? toLayoutItemSize(wid->d_func(), qSmartMaxSize(this, align)) | 56 |
329 | : qSmartMaxSize(this, align); executed: return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) ? toLayoutItemSize(wid->d_func(), qSmartMaxSize(this, align)) : qSmartMaxSize(this, align); Execution Count:56 | 56 |
330 | } | - |
331 | } | - |
332 | | - |
333 | | - |
334 | | - |
335 | | - |
336 | QSize QSpacerItem::sizeHint() const | - |
337 | { | - |
338 | return QSize(width, height); executed: return QSize(width, height); Execution Count:3038 | 3038 |
339 | } | - |
340 | | - |
341 | | - |
342 | | - |
343 | | - |
344 | QSize QWidgetItem::sizeHint() const | - |
345 | { | - |
346 | QSize s(0, 0); | - |
347 | if (!isEmpty()) { evaluated: !isEmpty() yes Evaluation Count:90 | yes Evaluation Count:2 |
| 2-90 |
348 | s = wid->sizeHint().expandedTo(wid->minimumSizeHint()); | - |
349 | s = s.boundedTo(wid->maximumSize()) | - |
350 | .expandedTo(wid->minimumSize()); | - |
351 | s = !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) evaluated: !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) yes Evaluation Count:60 | yes Evaluation Count:30 |
| 30-60 |
352 | ? toLayoutItemSize(wid->d_func(), s) | - |
353 | : s; | - |
354 | | - |
355 | if (wid->sizePolicy().horizontalPolicy() == QSizePolicy::Ignored) partially evaluated: wid->sizePolicy().horizontalPolicy() == QSizePolicy::Ignored no Evaluation Count:0 | yes Evaluation Count:90 |
| 0-90 |
356 | s.setWidth(0); never executed: s.setWidth(0); | 0 |
357 | if (wid->sizePolicy().verticalPolicy() == QSizePolicy::Ignored) partially evaluated: wid->sizePolicy().verticalPolicy() == QSizePolicy::Ignored no Evaluation Count:0 | yes Evaluation Count:90 |
| 0-90 |
358 | s.setHeight(0); never executed: s.setHeight(0); | 0 |
359 | } executed: } Execution Count:90 | 90 |
360 | return s; executed: return s; Execution Count:92 | 92 |
361 | } | - |
362 | | - |
363 | | - |
364 | | - |
365 | | - |
366 | bool QSpacerItem::isEmpty() const | - |
367 | { | - |
368 | return true; executed: return true; Execution Count:8744 | 8744 |
369 | } | - |
370 | | - |
371 | | - |
372 | | - |
373 | | - |
374 | | - |
375 | | - |
376 | bool QWidgetItem::isEmpty() const | - |
377 | { | - |
378 | return wid->isHidden() || wid->isWindow(); executed: return wid->isHidden() || wid->isWindow(); Execution Count:172371 | 172371 |
379 | } | - |
380 | | - |
381 | | - |
382 | | - |
383 | | - |
384 | | - |
385 | | - |
386 | | - |
387 | QSizePolicy::ControlTypes QWidgetItem::controlTypes() const | - |
388 | { | - |
389 | return wid->sizePolicy().controlType(); executed: return wid->sizePolicy().controlType(); Execution Count:1227 | 1227 |
390 | } | - |
391 | | - |
392 | | - |
393 | | - |
394 | | - |
395 | | - |
396 | | - |
397 | inline bool QWidgetItemV2::useSizeCache() const | - |
398 | { | - |
399 | return wid->d_func()->widgetItem == this; executed: return wid->d_func()->widgetItem == this; Execution Count:61258 | 61258 |
400 | } | - |
401 | | - |
402 | void QWidgetItemV2::updateCacheIfNecessary() const | - |
403 | { | - |
404 | if (q_cachedMinimumSize.width() != Dirty) evaluated: q_cachedMinimumSize.width() != Dirty yes Evaluation Count:51183 | yes Evaluation Count:10075 |
| 10075-51183 |
405 | return; executed: return; Execution Count:51183 | 51183 |
406 | | - |
407 | const QSize sizeHint(wid->sizeHint()); | - |
408 | const QSize minimumSizeHint(wid->minimumSizeHint()); | - |
409 | const QSize minimumSize(wid->minimumSize()); | - |
410 | const QSize maximumSize(wid->maximumSize()); | - |
411 | const QSizePolicy sizePolicy(wid->sizePolicy()); | - |
412 | const QSize expandedSizeHint(sizeHint.expandedTo(minimumSizeHint)); | - |
413 | | - |
414 | const QSize smartMinSize(qSmartMinSize(sizeHint, minimumSizeHint, minimumSize, maximumSize, sizePolicy)); | - |
415 | const QSize smartMaxSize(qSmartMaxSize(expandedSizeHint, minimumSize, maximumSize, sizePolicy, align)); | - |
416 | | - |
417 | const bool useLayoutItemRect = !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect); | - |
418 | | - |
419 | q_cachedMinimumSize = useLayoutItemRect evaluated: useLayoutItemRect yes Evaluation Count:10066 | yes Evaluation Count:9 |
| 9-10066 |
420 | ? toLayoutItemSize(wid->d_func(), smartMinSize) | - |
421 | : smartMinSize; | - |
422 | | - |
423 | q_cachedSizeHint = expandedSizeHint; | - |
424 | q_cachedSizeHint = q_cachedSizeHint.boundedTo(maximumSize) | - |
425 | .expandedTo(minimumSize); | - |
426 | q_cachedSizeHint = useLayoutItemRect evaluated: useLayoutItemRect yes Evaluation Count:10066 | yes Evaluation Count:9 |
| 9-10066 |
427 | ? toLayoutItemSize(wid->d_func(), q_cachedSizeHint) | - |
428 | : q_cachedSizeHint; | - |
429 | | - |
430 | if (wid->sizePolicy().horizontalPolicy() == QSizePolicy::Ignored) evaluated: wid->sizePolicy().horizontalPolicy() == QSizePolicy::Ignored yes Evaluation Count:250 | yes Evaluation Count:9825 |
| 250-9825 |
431 | q_cachedSizeHint.setWidth(0); executed: q_cachedSizeHint.setWidth(0); Execution Count:250 | 250 |
432 | if (wid->sizePolicy().verticalPolicy() == QSizePolicy::Ignored) evaluated: wid->sizePolicy().verticalPolicy() == QSizePolicy::Ignored yes Evaluation Count:16 | yes Evaluation Count:10059 |
| 16-10059 |
433 | q_cachedSizeHint.setHeight(0); executed: q_cachedSizeHint.setHeight(0); Execution Count:16 | 16 |
434 | | - |
435 | q_cachedMaximumSize = useLayoutItemRect evaluated: useLayoutItemRect yes Evaluation Count:10066 | yes Evaluation Count:9 |
| 9-10066 |
436 | ? toLayoutItemSize(wid->d_func(), smartMaxSize) | - |
437 | : smartMaxSize; | - |
438 | } executed: } Execution Count:10075 | 10075 |
439 | | - |
440 | QWidgetItemV2::QWidgetItemV2(QWidget *widget) | - |
441 | : QWidgetItem(widget), | - |
442 | q_cachedMinimumSize(Dirty, Dirty), | - |
443 | q_cachedSizeHint(Dirty, Dirty), | - |
444 | q_cachedMaximumSize(Dirty, Dirty), | - |
445 | q_firstCachedHfw(0), | - |
446 | q_hfwCacheSize(0), | - |
447 | d(0) | - |
448 | { | - |
449 | QWidgetPrivate *wd = wid->d_func(); | - |
450 | if (!wd->widgetItem) evaluated: !wd->widgetItem yes Evaluation Count:18553 | yes Evaluation Count:1 |
| 1-18553 |
451 | wd->widgetItem = this; executed: wd->widgetItem = this; Execution Count:18553 | 18553 |
452 | } executed: } Execution Count:18554 | 18554 |
453 | | - |
454 | QWidgetItemV2::~QWidgetItemV2() | - |
455 | { | - |
456 | if (wid) { evaluated: wid yes Evaluation Count:17174 | yes Evaluation Count:59 |
| 59-17174 |
457 | QWidgetPrivate *wd = wid->d_func(); | - |
458 | if (wd->widgetItem == this) partially evaluated: wd->widgetItem == this yes Evaluation Count:17174 | no Evaluation Count:0 |
| 0-17174 |
459 | wd->widgetItem = 0; executed: wd->widgetItem = 0; Execution Count:17174 | 17174 |
460 | } executed: } Execution Count:17174 | 17174 |
461 | } executed: } Execution Count:17233 | 17233 |
462 | | - |
463 | QSize QWidgetItemV2::sizeHint() const | - |
464 | { | - |
465 | if (isEmpty()) evaluated: isEmpty() yes Evaluation Count:1945 | yes Evaluation Count:16972 |
| 1945-16972 |
466 | return QSize(0, 0); executed: return QSize(0, 0); Execution Count:1945 | 1945 |
467 | | - |
468 | if (useSizeCache()) { partially evaluated: useSizeCache() yes Evaluation Count:16972 | no Evaluation Count:0 |
| 0-16972 |
469 | updateCacheIfNecessary(); | - |
470 | return q_cachedSizeHint; executed: return q_cachedSizeHint; Execution Count:16972 | 16972 |
471 | } else { | - |
472 | return QWidgetItem::sizeHint(); never executed: return QWidgetItem::sizeHint(); | 0 |
473 | } | - |
474 | } | - |
475 | | - |
476 | QSize QWidgetItemV2::minimumSize() const | - |
477 | { | - |
478 | if (isEmpty()) evaluated: isEmpty() yes Evaluation Count:1950 | yes Evaluation Count:17074 |
| 1950-17074 |
479 | return QSize(0, 0); executed: return QSize(0, 0); Execution Count:1950 | 1950 |
480 | | - |
481 | if (useSizeCache()) { partially evaluated: useSizeCache() yes Evaluation Count:17074 | no Evaluation Count:0 |
| 0-17074 |
482 | updateCacheIfNecessary(); | - |
483 | return q_cachedMinimumSize; executed: return q_cachedMinimumSize; Execution Count:17074 | 17074 |
484 | } else { | - |
485 | return QWidgetItem::minimumSize(); never executed: return QWidgetItem::minimumSize(); | 0 |
486 | } | - |
487 | } | - |
488 | | - |
489 | QSize QWidgetItemV2::maximumSize() const | - |
490 | { | - |
491 | if (isEmpty()) evaluated: isEmpty() yes Evaluation Count:1941 | yes Evaluation Count:27212 |
| 1941-27212 |
492 | return QSize(0, 0); executed: return QSize(0, 0); Execution Count:1941 | 1941 |
493 | | - |
494 | if (useSizeCache()) { partially evaluated: useSizeCache() yes Evaluation Count:27212 | no Evaluation Count:0 |
| 0-27212 |
495 | updateCacheIfNecessary(); | - |
496 | return q_cachedMaximumSize; executed: return q_cachedMaximumSize; Execution Count:27212 | 27212 |
497 | } else { | - |
498 | return QWidgetItem::maximumSize(); never executed: return QWidgetItem::maximumSize(); | 0 |
499 | } | - |
500 | } | - |
501 | int QWidgetItemV2::heightForWidth(int width) const | - |
502 | { | - |
503 | if (isEmpty()) evaluated: isEmpty() yes Evaluation Count:1 | yes Evaluation Count:580 |
| 1-580 |
504 | return -1; executed: return -1; Execution Count:1 | 1 |
505 | | - |
506 | for (int i = 0; i < q_hfwCacheSize; ++i) { evaluated: i < q_hfwCacheSize yes Evaluation Count:570 | yes Evaluation Count:274 |
| 274-570 |
507 | int offset = q_firstCachedHfw + i; | - |
508 | const QSize &size = q_cachedHfws[offset % HfwCacheMaxSize]; | - |
509 | if (size.width() == width) { evaluated: size.width() == width yes Evaluation Count:306 | yes Evaluation Count:264 |
| 264-306 |
510 | if (q_hfwCacheSize == HfwCacheMaxSize) evaluated: q_hfwCacheSize == HfwCacheMaxSize yes Evaluation Count:102 | yes Evaluation Count:204 |
| 102-204 |
511 | q_firstCachedHfw = offset; executed: q_firstCachedHfw = offset; Execution Count:102 | 102 |
512 | return size.height(); executed: return size.height(); Execution Count:306 | 306 |
513 | } | - |
514 | } executed: } Execution Count:264 | 264 |
515 | | - |
516 | if (q_hfwCacheSize < HfwCacheMaxSize) evaluated: q_hfwCacheSize < HfwCacheMaxSize yes Evaluation Count:268 | yes Evaluation Count:6 |
| 6-268 |
517 | ++q_hfwCacheSize; executed: ++q_hfwCacheSize; Execution Count:268 | 268 |
518 | q_firstCachedHfw = (q_firstCachedHfw + HfwCacheMaxSize - 1) % HfwCacheMaxSize; | - |
519 | | - |
520 | int height = QWidgetItem::heightForWidth(width); | - |
521 | q_cachedHfws[q_firstCachedHfw] = QSize(width, height); | - |
522 | return height; executed: return height; Execution Count:274 | 274 |
523 | } | - |
524 | | - |
525 | | - |
526 | QDebug operator<<(QDebug dbg, const QSizePolicy &p) | - |
527 | { | - |
528 | dbg.nospace() << "QSizePolicy(horizontalPolicy = " << p.horizontalPolicy() | - |
529 | << ", verticalPolicy = " << p.verticalPolicy() << ')'; | - |
530 | return dbg.space(); executed: return dbg.space(); Execution Count:1 | 1 |
531 | } | - |
532 | | - |
533 | | - |
534 | | - |
535 | | - |
| | |