qlayoutitem.cpp

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

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9