kernel/qlayout.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5static int menuBarHeightForWidth(QWidget *menubar, int w) -
6{ -
7 if (menubar && !menubar->isHidden() && !menubar->isWindow()) {
evaluated: menubar
TRUEFALSE
yes
Evaluation Count:183
yes
Evaluation Count:24920
evaluated: !menubar->isHidden()
TRUEFALSE
yes
Evaluation Count:158
yes
Evaluation Count:25
partially evaluated: !menubar->isWindow()
TRUEFALSE
yes
Evaluation Count:158
no
Evaluation Count:0
0-24920
8 int result = menubar->heightForWidth(qMax(w, menubar->minimumWidth())); -
9 if (result != -1)
evaluated: result != -1
TRUEFALSE
yes
Evaluation Count:153
yes
Evaluation Count:5
5-153
10 return result;
executed: return result;
Execution Count:153
153
11 result = menubar->sizeHint() -
12 .expandedTo(menubar->minimumSize()) -
13 .expandedTo(menubar->minimumSizeHint()) -
14 .boundedTo(menubar->maximumSize()).height(); -
15 if (result != -1)
partially evaluated: result != -1
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
16 return result;
executed: return result;
Execution Count:5
5
17 }
never executed: }
0
18 return 0;
executed: return 0;
Execution Count:24945
24945
19} -
20QLayout::QLayout(QWidget *parent) -
21 : QObject(*new QLayoutPrivate, parent) -
22{ -
23 if (!parent)
partially evaluated: !parent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:87
0-87
24 return;
never executed: return;
0
25 parent->setLayout(this); -
26}
executed: }
Execution Count:87
87
27 -
28 -
29 -
30 -
31 -
32 -
33 -
34QLayout::QLayout() -
35 : QObject(*new QLayoutPrivate, 0) -
36{ -
37}
executed: }
Execution Count:1
1
38 -
39 -
40 -
41 -
42QLayout::QLayout(QLayoutPrivate &dd, QLayout *lay, QWidget *w) -
43 : QObject(dd, lay ? static_cast<QObject*>(lay) : static_cast<QObject*>(w)) -
44{ -
45 QLayoutPrivate * const d = d_func(); -
46 if (lay) {
partially evaluated: lay
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13175
0-13175
47 lay->addItem(this); -
48 } else if (w) {
evaluated: w
TRUEFALSE
yes
Evaluation Count:2279
yes
Evaluation Count:10896
never executed: }
0-10896
49 if (w->layout()) {
partially evaluated: w->layout()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2279
0-2279
50 QMessageLogger("kernel/qlayout.cpp", 143, __PRETTY_FUNCTION__).warning("QLayout: Attempting to add QLayout \"%s\" to %s \"%s\", which" -
51 " already has a layout", -
52 QString(QObject::objectName()).toLocal8Bit().constData(), w->metaObject()->className(), -
53 w->objectName().toLocal8Bit().data()); -
54 setParent(0); -
55 } else {
never executed: }
0
56 d->topLevel = true; -
57 w->d_func()->layout = this; -
58 if (true) {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:2279
no
Evaluation Count:0
0-2279
59 invalidate(); -
60 } else {
executed: }
Execution Count:2279
2279
61 w->d_func()->layout = 0; -
62 qt_noop(); -
63 }
never executed: }
0
64 } -
65 } -
66} -
67 -
68QLayoutPrivate::QLayoutPrivate() -
69 : QObjectPrivate(), insideSpacing(-1), userLeftMargin(-1), userTopMargin(-1), userRightMargin(-1), -
70 userBottomMargin(-1), topLevel(false), enabled(true), activated(true), autoNewChild(false), -
71 constraint(QLayout::SetDefaultConstraint), menubar(0) -
72{ -
73}
executed: }
Execution Count:13263
13263
74 -
75void QLayoutPrivate::getMargin(int *result, int userMargin, QStyle::PixelMetric pm) const -
76{ -
77 if (!result)
evaluated: !result
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:32991
9-32991
78 return;
executed: return;
Execution Count:9
9
79 -
80 const QLayout * const q = q_func(); -
81 if (userMargin >= 0) {
evaluated: userMargin >= 0
TRUEFALSE
yes
Evaluation Count:26476
yes
Evaluation Count:6515
6515-26476
82 *result = userMargin; -
83 } else if (!topLevel) {
executed: }
Execution Count:26476
evaluated: !topLevel
TRUEFALSE
yes
Evaluation Count:1856
yes
Evaluation Count:4659
1856-26476
84 *result = 0; -
85 } else if (QWidget *pw = q->parentWidget()) {
executed: }
Execution Count:1856
partially evaluated: QWidget *pw = q->parentWidget()
TRUEFALSE
yes
Evaluation Count:4659
no
Evaluation Count:0
0-4659
86 *result = pw->style()->pixelMetric(pm, 0, pw); -
87 } else {
executed: }
Execution Count:4659
4659
88 *result = 0; -
89 }
never executed: }
0
90} -
91 -
92 -
93 -
94QLayoutPrivate::QWidgetItemFactoryMethod QLayoutPrivate::widgetItemFactoryMethod = 0; -
95QLayoutPrivate::QSpacerItemFactoryMethod QLayoutPrivate::spacerItemFactoryMethod = 0; -
96 -
97QWidgetItem *QLayoutPrivate::createWidgetItem(const QLayout *layout, QWidget *widget) -
98{ -
99 if (widgetItemFactoryMethod)
partially evaluated: widgetItemFactoryMethod
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18458
0-18458
100 if (QWidgetItem *wi = (*widgetItemFactoryMethod)(layout, widget))
never evaluated: QWidgetItem *wi = (*widgetItemFactoryMethod)(layout, widget)
0
101 return wi;
never executed: return wi;
0
102 return new QWidgetItemV2(widget);
executed: return new QWidgetItemV2(widget);
Execution Count:18458
18458
103} -
104 -
105QSpacerItem *QLayoutPrivate::createSpacerItem(const QLayout *layout, int w, int h, QSizePolicy::Policy hPolicy, QSizePolicy::Policy vPolicy) -
106{ -
107 if (spacerItemFactoryMethod)
partially evaluated: spacerItemFactoryMethod
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2214
0-2214
108 if (QSpacerItem *si = (*spacerItemFactoryMethod)(layout, w, h, hPolicy, vPolicy))
never evaluated: QSpacerItem *si = (*spacerItemFactoryMethod)(layout, w, h, hPolicy, vPolicy)
0
109 return si;
never executed: return si;
0
110 return new QSpacerItem(w, h, hPolicy, vPolicy);
executed: return new QSpacerItem(w, h, hPolicy, vPolicy);
Execution Count:2214
2214
111} -
112void QLayout::addWidget(QWidget *w) -
113{ -
114 addChildWidget(w); -
115 addItem(QLayoutPrivate::createWidgetItem(this, w)); -
116}
executed: }
Execution Count:127
127
117bool QLayout::setAlignment(QWidget *w, Qt::Alignment alignment) -
118{ -
119 int i = 0; -
120 QLayoutItem *item = itemAt(i); -
121 while (item) {
partially evaluated: item
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
122 if (item->widget() == w) {
partially evaluated: item->widget() == w
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
123 item->setAlignment(alignment); -
124 invalidate(); -
125 return true;
executed: return true;
Execution Count:2
2
126 } -
127 ++i; -
128 item = itemAt(i); -
129 }
never executed: }
0
130 return false;
never executed: return false;
0
131} -
132bool QLayout::setAlignment(QLayout *l, Qt::Alignment alignment) -
133{ -
134 int i = 0; -
135 QLayoutItem *item = itemAt(i); -
136 while (item) {
never evaluated: item
0
137 if (item->layout() == l) {
never evaluated: item->layout() == l
0
138 item->setAlignment(alignment); -
139 invalidate(); -
140 return true;
never executed: return true;
0
141 } -
142 ++i; -
143 item = itemAt(i); -
144 }
never executed: }
0
145 return false;
never executed: return false;
0
146} -
147int QLayout::margin() const -
148{ -
149 int left, top, right, bottom; -
150 getContentsMargins(&left, &top, &right, &bottom); -
151 if (left == top && top == right && right == bottom) {
partially evaluated: left == top
TRUEFALSE
yes
Evaluation Count:141
no
Evaluation Count:0
partially evaluated: top == right
TRUEFALSE
yes
Evaluation Count:141
no
Evaluation Count:0
partially evaluated: right == bottom
TRUEFALSE
yes
Evaluation Count:141
no
Evaluation Count:0
0-141
152 return left;
executed: return left;
Execution Count:141
141
153 } else { -
154 return -1;
never executed: return -1;
0
155 } -
156} -
157int QLayout::spacing() const -
158{ -
159 if (const QBoxLayout* boxlayout = qobject_cast<const QBoxLayout*>(this)) {
evaluated: const QBoxLayout* boxlayout = qobject_cast<const QBoxLayout*>(this)
TRUEFALSE
yes
Evaluation Count:365
yes
Evaluation Count:406
365-406
160 return boxlayout->spacing();
executed: return boxlayout->spacing();
Execution Count:365
365
161 } else if (const QGridLayout* gridlayout = qobject_cast<const QGridLayout*>(this)) {
evaluated: const QGridLayout* gridlayout = qobject_cast<const QGridLayout*>(this)
TRUEFALSE
yes
Evaluation Count:313
yes
Evaluation Count:93
93-313
162 return gridlayout->spacing();
executed: return gridlayout->spacing();
Execution Count:313
313
163 } else if (const QFormLayout* formlayout = qobject_cast<const QFormLayout*>(this)) {
evaluated: const QFormLayout* formlayout = qobject_cast<const QFormLayout*>(this)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:92
1-92
164 return formlayout->spacing();
executed: return formlayout->spacing();
Execution Count:1
1
165 } else { -
166 const QLayoutPrivate * const d = d_func(); -
167 if (d->insideSpacing >=0) {
partially evaluated: d->insideSpacing >=0
TRUEFALSE
yes
Evaluation Count:92
no
Evaluation Count:0
0-92
168 return d->insideSpacing;
executed: return d->insideSpacing;
Execution Count:92
92
169 } else { -
170 -
171 return qSmartSpacing(this, QStyle::PM_LayoutHorizontalSpacing);
never executed: return qSmartSpacing(this, QStyle::PM_LayoutHorizontalSpacing);
0
172 } -
173 } -
174} -
175 -
176 -
177 -
178 -
179void QLayout::setMargin(int margin) -
180{ -
181 setContentsMargins(margin, margin, margin, margin); -
182}
executed: }
Execution Count:10960
10960
183 -
184void QLayout::setSpacing(int spacing) -
185{ -
186 if (QBoxLayout* boxlayout = qobject_cast<QBoxLayout*>(this)) {
partially evaluated: QBoxLayout* boxlayout = qobject_cast<QBoxLayout*>(this)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
187 boxlayout->setSpacing(spacing); -
188 } else if (QGridLayout* gridlayout = qobject_cast<QGridLayout*>(this)) {
partially evaluated: QGridLayout* gridlayout = qobject_cast<QGridLayout*>(this)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
never executed: }
0-16
189 gridlayout->setSpacing(spacing); -
190 } else if (QFormLayout* formlayout = qobject_cast<QFormLayout*>(this)) {
partially evaluated: QFormLayout* formlayout = qobject_cast<QFormLayout*>(this)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
never executed: }
0-16
191 formlayout->setSpacing(spacing); -
192 } else {
never executed: }
0
193 QLayoutPrivate * const d = d_func(); -
194 d->insideSpacing = spacing; -
195 invalidate(); -
196 }
executed: }
Execution Count:16
16
197} -
198void QLayout::setContentsMargins(int left, int top, int right, int bottom) -
199{ -
200 QLayoutPrivate * const d = d_func(); -
201 -
202 if (d->userLeftMargin == left && d->userTopMargin == top &&
evaluated: d->userLeftMargin == left
TRUEFALSE
yes
Evaluation Count:158
yes
Evaluation Count:12162
partially evaluated: d->userTopMargin == top
TRUEFALSE
yes
Evaluation Count:158
no
Evaluation Count:0
0-12162
203 d->userRightMargin == right && d->userBottomMargin == bottom)
partially evaluated: d->userRightMargin == right
TRUEFALSE
yes
Evaluation Count:158
no
Evaluation Count:0
partially evaluated: d->userBottomMargin == bottom
TRUEFALSE
yes
Evaluation Count:158
no
Evaluation Count:0
0-158
204 return;
executed: return;
Execution Count:158
158
205 -
206 d->userLeftMargin = left; -
207 d->userTopMargin = top; -
208 d->userRightMargin = right; -
209 d->userBottomMargin = bottom; -
210 invalidate(); -
211}
executed: }
Execution Count:12162
12162
212void QLayout::setContentsMargins(const QMargins &margins) -
213{ -
214 setContentsMargins(margins.left(), margins.top(), margins.right(), margins.bottom()); -
215}
never executed: }
0
216void QLayout::getContentsMargins(int *left, int *top, int *right, int *bottom) const -
217{ -
218 const QLayoutPrivate * const d = d_func(); -
219 d->getMargin(left, d->userLeftMargin, QStyle::PM_LayoutLeftMargin); -
220 d->getMargin(top, d->userTopMargin, QStyle::PM_LayoutTopMargin); -
221 d->getMargin(right, d->userRightMargin, QStyle::PM_LayoutRightMargin); -
222 d->getMargin(bottom, d->userBottomMargin, QStyle::PM_LayoutBottomMargin); -
223}
executed: }
Execution Count:8250
8250
224QMargins QLayout::contentsMargins() const -
225{ -
226 int left, top, right, bottom; -
227 getContentsMargins(&left, &top, &right, &bottom); -
228 return QMargins(left, top, right, bottom);
never executed: return QMargins(left, top, right, bottom);
0
229} -
230QRect QLayout::contentsRect() const -
231{ -
232 const QLayoutPrivate * const d = d_func(); -
233 int left, top, right, bottom; -
234 getContentsMargins(&left, &top, &right, &bottom); -
235 return d->rect.adjusted(+left, +top, -right, -bottom);
executed: return d->rect.adjusted(+left, +top, -right, -bottom);
Execution Count:2
2
236} -
237QWidget *QLayout::parentWidget() const -
238{ -
239 const QLayoutPrivate * const d = d_func(); -
240 if (!d->topLevel) {
evaluated: !d->topLevel
TRUEFALSE
yes
Evaluation Count:3662
yes
Evaluation Count:59289
3662-59289
241 if (parent()) {
evaluated: parent()
TRUEFALSE
yes
Evaluation Count:1433
yes
Evaluation Count:2229
1433-2229
242 QLayout *parentLayout = qobject_cast<QLayout*>(parent()); -
243 if (!parentLayout) {
evaluated: !parentLayout
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1432
1-1432
244 QMessageLogger("kernel/qlayout.cpp", 491, __PRETTY_FUNCTION__).warning("QLayout::parentWidget: A layout can only have another layout as a parent."); -
245 return 0;
executed: return 0;
Execution Count:1
1
246 } -
247 return parentLayout->parentWidget();
executed: return parentLayout->parentWidget();
Execution Count:1432
1432
248 } else { -
249 return 0;
executed: return 0;
Execution Count:2229
2229
250 } -
251 } else { -
252 qt_noop(); -
253 return static_cast<QWidget *>(parent());
executed: return static_cast<QWidget *>(parent());
Execution Count:59289
59289
254 } -
255} -
256 -
257 -
258 -
259 -
260bool QLayout::isEmpty() const -
261{ -
262 int i = 0; -
263 QLayoutItem *item = itemAt(i); -
264 while (item) {
evaluated: item
TRUEFALSE
yes
Evaluation Count:6798
yes
Evaluation Count:164
164-6798
265 if (!item->isEmpty())
evaluated: !item->isEmpty()
TRUEFALSE
yes
Evaluation Count:3606
yes
Evaluation Count:3192
3192-3606
266 return false;
executed: return false;
Execution Count:3606
3606
267 ++i; -
268 item = itemAt(i); -
269 }
executed: }
Execution Count:3192
3192
270 return true;
executed: return true;
Execution Count:164
164
271} -
272 -
273 -
274 -
275 -
276QSizePolicy::ControlTypes QLayout::controlTypes() const -
277{ -
278 if (count() == 0)
evaluated: count() == 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
279 return QSizePolicy::DefaultType;
executed: return QSizePolicy::DefaultType;
Execution Count:1
1
280 QSizePolicy::ControlTypes types; -
281 for (int i = count() - 1; i >= 0; --i)
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
282 types |= itemAt(i)->controlTypes();
executed: types |= itemAt(i)->controlTypes();
Execution Count:1
1
283 return types;
executed: return types;
Execution Count:1
1
284} -
285 -
286 -
287 -
288 -
289void QLayout::setGeometry(const QRect &r) -
290{ -
291 QLayoutPrivate * const d = d_func(); -
292 d->rect = r; -
293}
executed: }
Execution Count:6157
6157
294 -
295 -
296 -
297 -
298QRect QLayout::geometry() const -
299{ -
300 const QLayoutPrivate * const d = d_func(); -
301 return d->rect;
executed: return d->rect;
Execution Count:10150
10150
302} -
303 -
304 -
305 -
306 -
307void QLayout::invalidate() -
308{ -
309 QLayoutPrivate * const d = d_func(); -
310 d->rect = QRect(); -
311 update(); -
312}
executed: }
Execution Count:105410
105410
313 -
314static bool removeWidgetRecursively(QLayoutItem *li, QWidget *w) -
315{ -
316 QLayout *lay = li->layout(); -
317 if (!lay)
evaluated: !lay
TRUEFALSE
yes
Evaluation Count:3689
yes
Evaluation Count:1960
1960-3689
318 return false;
executed: return false;
Execution Count:3689
3689
319 int i = 0; -
320 QLayoutItem *child; -
321 while ((child = lay->itemAt(i))) {
evaluated: (child = lay->itemAt(i))
TRUEFALSE
yes
Evaluation Count:4599
yes
Evaluation Count:1403
1403-4599
322 if (child->widget() == w) {
evaluated: child->widget() == w
TRUEFALSE
yes
Evaluation Count:557
yes
Evaluation Count:4042
557-4042
323 delete lay->takeAt(i); -
324 lay->invalidate(); -
325 return true;
executed: return true;
Execution Count:557
557
326 } else if (removeWidgetRecursively(child, w)) {
partially evaluated: removeWidgetRecursively(child, w)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4042
0-4042
327 return true;
never executed: return true;
0
328 } else { -
329 ++i; -
330 }
executed: }
Execution Count:4042
4042
331 } -
332 return false;
executed: return false;
Execution Count:1403
1403
333} -
334 -
335 -
336void QLayoutPrivate::doResize(const QSize &r) -
337{ -
338 QLayout * const q = q_func(); -
339 int mbh = menuBarHeightForWidth(menubar, r.width()); -
340 QWidget *mw = q->parentWidget(); -
341 QRect rect = mw->testAttribute(Qt::WA_LayoutOnEntireRect) ? mw->rect() : mw->contentsRect();
partially evaluated: mw->testAttribute(Qt::WA_LayoutOnEntireRect)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7232
0-7232
342 rect.setTop(rect.top() + mbh); -
343 q->setGeometry(rect); -
344 -
345 if (menubar)
evaluated: menubar
TRUEFALSE
yes
Evaluation Count:97
yes
Evaluation Count:7135
97-7135
346 menubar->setGeometry(0,0,r.width(), mbh);
executed: menubar->setGeometry(0,0,r.width(), mbh);
Execution Count:97
97
347 -
348}
executed: }
Execution Count:7232
7232
349void QLayout::widgetEvent(QEvent *e) -
350{ -
351 QLayoutPrivate * const d = d_func(); -
352 if (!d->enabled)
partially evaluated: !d->enabled
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:105401
0-105401
353 return;
never executed: return;
0
354 -
355 switch (e->type()) { -
356 case QEvent::Resize: -
357 if (d->activated) {
evaluated: d->activated
TRUEFALSE
yes
Evaluation Count:3092
yes
Evaluation Count:65
65-3092
358 QResizeEvent *r = (QResizeEvent *)e; -
359 d->doResize(r->size()); -
360 } else {
executed: }
Execution Count:3092
3092
361 activate(); -
362 }
executed: }
Execution Count:65
65
363 break;
executed: break;
Execution Count:3157
3157
364 case QEvent::ChildRemoved: -
365 { -
366 QChildEvent *c = (QChildEvent *)e; -
367 if (c->child()->isWidgetType()) {
evaluated: c->child()->isWidgetType()
TRUEFALSE
yes
Evaluation Count:697
yes
Evaluation Count:131
131-697
368 QWidget *w = (QWidget *)c->child(); -
369 -
370 if (w == d->menubar)
evaluated: w == d->menubar
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:696
1-696
371 d->menubar = 0;
executed: d->menubar = 0;
Execution Count:1
1
372 -
373 removeWidgetRecursively(this, w); -
374 }
executed: }
Execution Count:697
697
375 } -
376 break;
executed: break;
Execution Count:828
828
377 case QEvent::LayoutRequest: -
378 if (static_cast<QWidget *>(parent())->isVisible())
evaluated: static_cast<QWidget *>(parent())->isVisible()
TRUEFALSE
yes
Evaluation Count:1625
yes
Evaluation Count:2858
1625-2858
379 activate();
executed: activate();
Execution Count:1625
1625
380 break;
executed: break;
Execution Count:4483
4483
381 default: -
382 break;
executed: break;
Execution Count:96933
96933
383 } -
384}
executed: }
Execution Count:105401
105401
385 -
386 -
387 -
388 -
389void QLayout::childEvent(QChildEvent *e) -
390{ -
391 QLayoutPrivate * const d = d_func(); -
392 if (!d->enabled)
partially evaluated: !d->enabled
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:807
0-807
393 return;
never executed: return;
0
394 -
395 if (e->type() == QEvent::ChildRemoved) {
evaluated: e->type() == QEvent::ChildRemoved
TRUEFALSE
yes
Evaluation Count:403
yes
Evaluation Count:404
403-404
396 QChildEvent *c = (QChildEvent*)e; -
397 int i = 0; -
398 -
399 QLayoutItem *item; -
400 while ((item = itemAt(i))) {
evaluated: (item = itemAt(i))
TRUEFALSE
yes
Evaluation Count:1624
yes
Evaluation Count:331
331-1624
401 if (item == static_cast<QLayout*>(c->child())) {
evaluated: item == static_cast<QLayout*>(c->child())
TRUEFALSE
yes
Evaluation Count:72
yes
Evaluation Count:1552
72-1552
402 takeAt(i); -
403 invalidate(); -
404 break;
executed: break;
Execution Count:72
72
405 } else { -
406 ++i; -
407 }
executed: }
Execution Count:1552
1552
408 } -
409 }
executed: }
Execution Count:403
403
410}
executed: }
Execution Count:807
807
411 -
412 -
413 -
414 -
415 -
416int QLayout::totalHeightForWidth(int w) const -
417{ -
418 const QLayoutPrivate * const d = d_func(); -
419 int side=0, top=0; -
420 if (d->topLevel) {
partially evaluated: d->topLevel
TRUEFALSE
yes
Evaluation Count:159
no
Evaluation Count:0
0-159
421 QWidget *parent = parentWidget(); -
422 parent->ensurePolished(); -
423 QWidgetPrivate *wd = parent->d_func(); -
424 side += wd->leftmargin + wd->rightmargin; -
425 top += wd->topmargin + wd->bottommargin; -
426 }
executed: }
Execution Count:159
159
427 int h = heightForWidth(w - side) + top; -
428 -
429 h += menuBarHeightForWidth(d->menubar, w); -
430 -
431 return h;
executed: return h;
Execution Count:159
159
432} -
433 -
434 -
435 -
436 -
437 -
438QSize QLayout::totalMinimumSize() const -
439{ -
440 const QLayoutPrivate * const d = d_func(); -
441 int side=0, top=0; -
442 if (d->topLevel) {
partially evaluated: d->topLevel
TRUEFALSE
yes
Evaluation Count:5129
no
Evaluation Count:0
0-5129
443 QWidget *pw = parentWidget(); -
444 pw->ensurePolished(); -
445 QWidgetPrivate *wd = pw->d_func(); -
446 side += wd->leftmargin + wd->rightmargin; -
447 top += wd->topmargin + wd->bottommargin; -
448 }
executed: }
Execution Count:5129
5129
449 -
450 QSize s = minimumSize(); -
451 -
452 top += menuBarHeightForWidth(d->menubar, s.width() + side); -
453 -
454 return s + QSize(side, top);
executed: return s + QSize(side, top);
Execution Count:5129
5129
455} -
456 -
457 -
458 -
459 -
460 -
461QSize QLayout::totalSizeHint() const -
462{ -
463 const QLayoutPrivate * const d = d_func(); -
464 int side=0, top=0; -
465 if (d->topLevel) {
partially evaluated: d->topLevel
TRUEFALSE
yes
Evaluation Count:10821
no
Evaluation Count:0
0-10821
466 QWidget *pw = parentWidget(); -
467 pw->ensurePolished(); -
468 QWidgetPrivate *wd = pw->d_func(); -
469 side += wd->leftmargin + wd->rightmargin; -
470 top += wd->topmargin + wd->bottommargin; -
471 }
executed: }
Execution Count:10821
10821
472 -
473 QSize s = sizeHint(); -
474 if (hasHeightForWidth())
evaluated: hasHeightForWidth()
TRUEFALSE
yes
Evaluation Count:260
yes
Evaluation Count:10561
260-10561
475 s.setHeight(heightForWidth(s.width() + side));
executed: s.setHeight(heightForWidth(s.width() + side));
Execution Count:260
260
476 -
477 top += menuBarHeightForWidth(d->menubar, s.width()); -
478 -
479 return s + QSize(side, top);
executed: return s + QSize(side, top);
Execution Count:10821
10821
480} -
481 -
482 -
483 -
484 -
485 -
486QSize QLayout::totalMaximumSize() const -
487{ -
488 const QLayoutPrivate * const d = d_func(); -
489 int side=0, top=0; -
490 if (d->topLevel) {
partially evaluated: d->topLevel
TRUEFALSE
yes
Evaluation Count:1762
no
Evaluation Count:0
0-1762
491 QWidget *pw = parentWidget(); -
492 pw->ensurePolished(); -
493 QWidgetPrivate *wd = pw->d_func(); -
494 side += wd->leftmargin + wd->rightmargin; -
495 top += wd->topmargin + wd->bottommargin; -
496 }
executed: }
Execution Count:1762
1762
497 -
498 QSize s = maximumSize(); -
499 -
500 top += menuBarHeightForWidth(d->menubar, s.width()); -
501 -
502 -
503 if (d->topLevel)
partially evaluated: d->topLevel
TRUEFALSE
yes
Evaluation Count:1762
no
Evaluation Count:0
0-1762
504 s = QSize(qMin(s.width() + side, QLAYOUTSIZE_MAX), 1762
505 qMin(s.height() + top, QLAYOUTSIZE_MAX));
executed: s = QSize(qMin(s.width() + side, QLAYOUTSIZE_MAX), qMin(s.height() + top, QLAYOUTSIZE_MAX));
Execution Count:1762
1762
506 return s;
executed: return s;
Execution Count:1762
1762
507} -
508QLayout::~QLayout() -
509{ -
510 QLayoutPrivate * const d = d_func(); -
511 -
512 -
513 -
514 -
515 if (d->topLevel && parent() && parent()->isWidgetType() &&
evaluated: d->topLevel
TRUEFALSE
yes
Evaluation Count:11573
yes
Evaluation Count:385
partially evaluated: parent()
TRUEFALSE
yes
Evaluation Count:11573
no
Evaluation Count:0
partially evaluated: parent()->isWidgetType()
TRUEFALSE
yes
Evaluation Count:11573
no
Evaluation Count:0
0-11573
516 ((QWidget*)parent())->layout() == this)
partially evaluated: ((QWidget*)parent())->layout() == this
TRUEFALSE
yes
Evaluation Count:11573
no
Evaluation Count:0
0-11573
517 ((QWidget*)parent())->d_func()->layout = 0;
executed: ((QWidget*)parent())->d_func()->layout = 0;
Execution Count:11573
11573
518}
executed: }
Execution Count:11958
11958
519void QLayout::addChildLayout(QLayout *l) -
520{ -
521 if (l->parent()) {
evaluated: l->parent()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:404
1-404
522 QMessageLogger("kernel/qlayout.cpp", 797, __PRETTY_FUNCTION__).warning("QLayout::addChildLayout: layout \"%s\" already has a parent", -
523 l->objectName().toLocal8Bit().data()); -
524 return;
executed: return;
Execution Count:1
1
525 } -
526 l->setParent(this); -
527 -
528 if (QWidget *mw = parentWidget()) {
evaluated: QWidget *mw = parentWidget()
TRUEFALSE
yes
Evaluation Count:384
yes
Evaluation Count:20
20-384
529 l->d_func()->reparentChildWidgets(mw); -
530 }
executed: }
Execution Count:384
384
531 -
532}
executed: }
Execution Count:404
404
533void QLayoutPrivate::reparentChildWidgets(QWidget *mw) -
534{ -
535 QLayout * const q = q_func(); -
536 int n = q->count(); -
537 -
538 -
539 if (menubar && menubar->parentWidget() != mw) {
partially evaluated: menubar
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10898
never evaluated: menubar->parentWidget() != mw
0-10898
540 menubar->setParent(mw); -
541 }
never executed: }
0
542 -
543 bool mwVisible = mw && mw->isVisible();
partially evaluated: mw
TRUEFALSE
yes
Evaluation Count:10898
no
Evaluation Count:0
evaluated: mw->isVisible()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:10896
0-10898
544 for (int i = 0; i < n; ++i) {
evaluated: i < n
TRUEFALSE
yes
Evaluation Count:2344
yes
Evaluation Count:10898
2344-10898
545 QLayoutItem *item = q->itemAt(i); -
546 if (QWidget *w = item->widget()) {
evaluated: QWidget *w = item->widget()
TRUEFALSE
yes
Evaluation Count:2189
yes
Evaluation Count:155
155-2189
547 QWidget *pw = w->parentWidget(); -
548 -
549 -
550 -
551 -
552 -
553 -
554 bool needShow = mwVisible && !(w->isHidden() && w->testAttribute(Qt::WA_WState_ExplicitShowHide));
evaluated: mwVisible
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2187
evaluated: w->isHidden()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
partially evaluated: w->testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-2187
555 if (pw != mw)
evaluated: pw != mw
TRUEFALSE
yes
Evaluation Count:235
yes
Evaluation Count:1954
235-1954
556 w->setParent(mw);
executed: w->setParent(mw);
Execution Count:235
235
557 if (needShow)
evaluated: needShow
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2188
1-2188
558 QMetaObject::invokeMethod(w, "_q_showIfNotHidden", Qt::QueuedConnection);
executed: QMetaObject::invokeMethod(w, "_q_showIfNotHidden", Qt::QueuedConnection);
Execution Count:1
1
559 } else if (QLayout *l = item->layout()) {
executed: }
Execution Count:2189
evaluated: QLayout *l = item->layout()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:153
2-2189
560 l->d_func()->reparentChildWidgets(mw); -
561 }
executed: }
Execution Count:2
2
562 } -
563}
executed: }
Execution Count:10898
10898
564void QLayout::addChildWidget(QWidget *w) -
565{ -
566 QWidget *mw = parentWidget(); -
567 QWidget *pw = w->parentWidget(); -
568 -
569 -
570 -
571 if (pw && w->testAttribute(Qt::WA_LaidOut)) {
evaluated: pw
TRUEFALSE
yes
Evaluation Count:17584
yes
Evaluation Count:1012
evaluated: w->testAttribute(Qt::WA_LaidOut)
TRUEFALSE
yes
Evaluation Count:910
yes
Evaluation Count:16674
910-17584
572 QLayout *l = pw->layout(); -
573 if (l && removeWidgetRecursively(l, w)) {
partially evaluated: l
TRUEFALSE
yes
Evaluation Count:910
no
Evaluation Count:0
evaluated: removeWidgetRecursively(l, w)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:907
0-910
574 -
575 -
576 -
577 -
578 -
579 }
executed: }
Execution Count:3
3
580 }
executed: }
Execution Count:910
910
581 if (pw && mw && pw != mw) {
evaluated: pw
TRUEFALSE
yes
Evaluation Count:17584
yes
Evaluation Count:1012
evaluated: mw
TRUEFALSE
yes
Evaluation Count:15652
yes
Evaluation Count:1932
evaluated: pw != mw
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:15650
2-17584
582 -
583 -
584 -
585 -
586 -
587 pw = 0; -
588 }
executed: }
Execution Count:2
2
589 bool needShow = mw && mw->isVisible() && !(w->isHidden() && w->testAttribute(Qt::WA_WState_ExplicitShowHide));
evaluated: mw
TRUEFALSE
yes
Evaluation Count:16389
yes
Evaluation Count:2207
evaluated: mw->isVisible()
TRUEFALSE
yes
Evaluation Count:136
yes
Evaluation Count:16253
evaluated: w->isHidden()
TRUEFALSE
yes
Evaluation Count:134
yes
Evaluation Count:2
evaluated: w->testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:78
2-16389
590 if (!pw && mw)
evaluated: !pw
TRUEFALSE
yes
Evaluation Count:1014
yes
Evaluation Count:17582
evaluated: mw
TRUEFALSE
yes
Evaluation Count:739
yes
Evaluation Count:275
275-17582
591 w->setParent(mw);
executed: w->setParent(mw);
Execution Count:739
739
592 w->setAttribute(Qt::WA_LaidOut); -
593 if (needShow)
evaluated: needShow
TRUEFALSE
yes
Evaluation Count:80
yes
Evaluation Count:18516
80-18516
594 QMetaObject::invokeMethod(w, "_q_showIfNotHidden", Qt::QueuedConnection);
executed: QMetaObject::invokeMethod(w, "_q_showIfNotHidden", Qt::QueuedConnection);
Execution Count:80
80
595}
executed: }
Execution Count:18596
18596
596void QLayout::setMenuBar(QWidget *widget) -
597{ -
598 QLayoutPrivate * const d = d_func(); -
599 -
600 -
601 -
602 -
603 if (widget)
evaluated: widget
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:2
2-19
604 -
605 addChildWidget(widget);
executed: addChildWidget(widget);
Execution Count:19
19
606 d->menubar = widget; -
607}
executed: }
Execution Count:21
21
608 -
609 -
610 -
611 -
612 -
613 -
614QWidget *QLayout::menuBar() const -
615{ -
616 const QLayoutPrivate * const d = d_func(); -
617 return d->menubar;
executed: return d->menubar;
Execution Count:7547
7547
618} -
619QSize QLayout::minimumSize() const -
620{ -
621 return QSize(0, 0);
never executed: return QSize(0, 0);
0
622} -
623QSize QLayout::maximumSize() const -
624{ -
625 return QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX);
executed: return QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX);
Execution Count:4
4
626} -
627Qt::Orientations QLayout::expandingDirections() const -
628{ -
629 return Qt::Horizontal | Qt::Vertical;
executed: return Qt::Horizontal | Qt::Vertical;
Execution Count:768
768
630} -
631 -
632void QLayout::activateRecursiveHelper(QLayoutItem *item) -
633{ -
634 item->invalidate(); -
635 QLayout *layout = item->layout(); -
636 if (layout) {
evaluated: layout
TRUEFALSE
yes
Evaluation Count:4902
yes
Evaluation Count:12885
4902-12885
637 QLayoutItem *child; -
638 int i=0; -
639 while ((child = layout->itemAt(i++)))
evaluated: (child = layout->itemAt(i++))
TRUEFALSE
yes
Evaluation Count:13647
yes
Evaluation Count:4902
4902-13647
640 activateRecursiveHelper(child);
executed: activateRecursiveHelper(child);
Execution Count:13647
13647
641 layout->d_func()->activated = true; -
642 }
executed: }
Execution Count:4902
4902
643}
executed: }
Execution Count:17787
17787
644void QLayout::update() -
645{ -
646 QLayout *layout = this; -
647 while (layout && layout->d_func()->activated) {
evaluated: layout
TRUEFALSE
yes
Evaluation Count:106630
yes
Evaluation Count:483
evaluated: layout->d_func()->activated
TRUEFALSE
yes
Evaluation Count:15896
yes
Evaluation Count:90734
483-106630
648 layout->d_func()->activated = false; -
649 if (layout->d_func()->topLevel) {
evaluated: layout->d_func()->topLevel
TRUEFALSE
yes
Evaluation Count:14783
yes
Evaluation Count:1113
1113-14783
650 qt_noop(); -
651 QWidget *mw = static_cast<QWidget*>(layout->parent()); -
652 QApplication::postEvent(mw, new QEvent(QEvent::LayoutRequest)); -
653 break;
executed: break;
Execution Count:14783
14783
654 } -
655 layout = static_cast<QLayout*>(layout->parent()); -
656 }
executed: }
Execution Count:1113
1113
657}
executed: }
Execution Count:106000
106000
658bool QLayout::activate() -
659{ -
660 QLayoutPrivate * const d = d_func(); -
661 if (!d->enabled || !parent())
partially evaluated: !d->enabled
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7332
partially evaluated: !parent()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7332
0-7332
662 return false;
never executed: return false;
0
663 if (!d->topLevel)
partially evaluated: !d->topLevel
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7332
0-7332
664 return static_cast<QLayout*>(parent())->activate();
never executed: return static_cast<QLayout*>(parent())->activate();
0
665 if (d->activated)
evaluated: d->activated
TRUEFALSE
yes
Evaluation Count:3192
yes
Evaluation Count:4140
3192-4140
666 return false;
executed: return false;
Execution Count:3192
3192
667 QWidget *mw = static_cast<QWidget*>(parent()); -
668 if (mw == 0) {
partially evaluated: mw == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4140
0-4140
669 QMessageLogger("kernel/qlayout.cpp", 1034, __PRETTY_FUNCTION__).warning("QLayout::activate: %s \"%s\" does not have a main widget", -
670 QObject::metaObject()->className(), QObject::objectName().toLocal8Bit().data()); -
671 return false;
never executed: return false;
0
672 } -
673 activateRecursiveHelper(this); -
674 -
675 QWidgetPrivate *md = mw->d_func(); -
676 uint explMin = md->extra ? md->extra->explicitMinSize : 0;
evaluated: md->extra
TRUEFALSE
yes
Evaluation Count:2343
yes
Evaluation Count:1797
1797-2343
677 uint explMax = md->extra ? md->extra->explicitMaxSize : 0;
evaluated: md->extra
TRUEFALSE
yes
Evaluation Count:2343
yes
Evaluation Count:1797
1797-2343
678 -
679 switch (d->constraint) { -
680 case SetFixedSize: -
681 -
682 mw->setFixedSize(totalSizeHint()); -
683 break;
executed: break;
Execution Count:14
14
684 case SetMinimumSize: -
685 mw->setMinimumSize(totalMinimumSize()); -
686 break;
never executed: break;
0
687 case SetMaximumSize: -
688 mw->setMaximumSize(totalMaximumSize()); -
689 break;
executed: break;
Execution Count:1147
1147
690 case SetMinAndMaxSize: -
691 mw->setMinimumSize(totalMinimumSize()); -
692 mw->setMaximumSize(totalMaximumSize()); -
693 break;
executed: break;
Execution Count:151
151
694 case SetDefaultConstraint: { -
695 bool widthSet = explMin & Qt::Horizontal; -
696 bool heightSet = explMin & Qt::Vertical; -
697 if (mw->isWindow()) {
evaluated: mw->isWindow()
TRUEFALSE
yes
Evaluation Count:718
yes
Evaluation Count:1367
718-1367
698 QSize ms = totalMinimumSize(); -
699 if (widthSet)
evaluated: widthSet
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:699
19-699
700 ms.setWidth(mw->minimumSize().width());
executed: ms.setWidth(mw->minimumSize().width());
Execution Count:19
19
701 if (heightSet)
evaluated: heightSet
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:700
18-700
702 ms.setHeight(mw->minimumSize().height());
executed: ms.setHeight(mw->minimumSize().height());
Execution Count:18
18
703 if ((!heightSet || !widthSet) && hasHeightForWidth()) {
evaluated: !heightSet
TRUEFALSE
yes
Evaluation Count:700
yes
Evaluation Count:18
partially evaluated: !widthSet
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
evaluated: hasHeightForWidth()
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:671
0-700
704 int h = minimumHeightForWidth(ms.width()); -
705 if (h > ms.height()) {
evaluated: h > ms.height()
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:6
6-23
706 if (!heightSet)
partially evaluated: !heightSet
TRUEFALSE
yes
Evaluation Count:23
no
Evaluation Count:0
0-23
707 ms.setHeight(0);
executed: ms.setHeight(0);
Execution Count:23
23
708 if (!widthSet)
evaluated: !widthSet
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:1
1-22
709 ms.setWidth(0);
executed: ms.setWidth(0);
Execution Count:22
22
710 }
executed: }
Execution Count:23
23
711 }
executed: }
Execution Count:29
29
712 mw->setMinimumSize(ms); -
713 } else if (!widthSet || !heightSet) {
executed: }
Execution Count:718
evaluated: !widthSet
TRUEFALSE
yes
Evaluation Count:1344
yes
Evaluation Count:23
partially evaluated: !heightSet
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:23
0-1344
714 QSize ms = mw->minimumSize(); -
715 if (!widthSet)
partially evaluated: !widthSet
TRUEFALSE
yes
Evaluation Count:1344
no
Evaluation Count:0
0-1344
716 ms.setWidth(0);
executed: ms.setWidth(0);
Execution Count:1344
1344
717 if (!heightSet)
evaluated: !heightSet
TRUEFALSE
yes
Evaluation Count:1336
yes
Evaluation Count:8
8-1336
718 ms.setHeight(0);
executed: ms.setHeight(0);
Execution Count:1336
1336
719 mw->setMinimumSize(ms); -
720 }
executed: }
Execution Count:1344
1344
721 break;
executed: break;
Execution Count:2085
2085
722 } -
723 case SetNoConstraint: -
724 break;
executed: break;
Execution Count:743
743
725 } -
726 -
727 d->doResize(mw->size()); -
728 -
729 if (md->extra) {
evaluated: md->extra
TRUEFALSE
yes
Evaluation Count:3610
yes
Evaluation Count:530
530-3610
730 md->extra->explicitMinSize = explMin; -
731 md->extra->explicitMaxSize = explMax; -
732 }
executed: }
Execution Count:3610
3610
733 -
734 mw->updateGeometry(); -
735 return true;
executed: return true;
Execution Count:4140
4140
736} -
737int QLayout::indexOf(QWidget *widget) const -
738{ -
739 int i = 0; -
740 QLayoutItem *item = itemAt(i); -
741 while (item) {
evaluated: item
TRUEFALSE
yes
Evaluation Count:434
yes
Evaluation Count:7
7-434
742 if (item->widget() == widget)
evaluated: item->widget() == widget
TRUEFALSE
yes
Evaluation Count:324
yes
Evaluation Count:110
110-324
743 return i;
executed: return i;
Execution Count:324
324
744 ++i; -
745 item = itemAt(i); -
746 }
executed: }
Execution Count:110
110
747 return -1;
executed: return -1;
Execution Count:7
7
748} -
749void QLayout::setSizeConstraint(SizeConstraint constraint) -
750{ -
751 QLayoutPrivate * const d = d_func(); -
752 if (constraint == d->constraint)
partially evaluated: constraint == d->constraint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10364
0-10364
753 return;
never executed: return;
0
754 -
755 d->constraint = constraint; -
756 invalidate(); -
757}
executed: }
Execution Count:10364
10364
758 -
759QLayout::SizeConstraint QLayout::sizeConstraint() const -
760{ -
761 const QLayoutPrivate * const d = d_func(); -
762 return d->constraint;
never executed: return d->constraint;
0
763} -
764QRect QLayout::alignmentRect(const QRect &r) const -
765{ -
766 QSize s = sizeHint(); -
767 Qt::Alignment a = alignment(); -
768 -
769 -
770 -
771 -
772 -
773 -
774 QLayout *that = const_cast<QLayout *>(this); -
775 that->setAlignment(0); -
776 QSize ms = that->maximumSize(); -
777 that->setAlignment(a); -
778 -
779 if ((expandingDirections() & Qt::Horizontal) ||
partially evaluated: (expandingDirections() & Qt::Horizontal)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
780 !(a & Qt::AlignHorizontal_Mask)) {
partially evaluated: !(a & Qt::AlignHorizontal_Mask)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
781 s.setWidth(qMin(r.width(), ms.width())); -
782 }
never executed: }
0
783 if ((expandingDirections() & Qt::Vertical) ||
partially evaluated: (expandingDirections() & Qt::Vertical)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
784 !(a & Qt::AlignVertical_Mask)) {
partially evaluated: !(a & Qt::AlignVertical_Mask)
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
785 s.setHeight(qMin(r.height(), ms.height())); -
786 } else if (hasHeightForWidth()) {
executed: }
Execution Count:3
never evaluated: hasHeightForWidth()
0-3
787 int hfw = heightForWidth(s.width()); -
788 if (hfw < s.height())
never evaluated: hfw < s.height()
0
789 s.setHeight(qMin(hfw, ms.height()));
never executed: s.setHeight(qMin(hfw, ms.height()));
0
790 }
never executed: }
0
791 -
792 s = s.boundedTo(r.size()); -
793 int x = r.x(); -
794 int y = r.y(); -
795 -
796 if (a & Qt::AlignBottom)
partially evaluated: a & Qt::AlignBottom
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
797 y += (r.height() - s.height());
never executed: y += (r.height() - s.height());
0
798 else if (!(a & Qt::AlignTop))
partially evaluated: !(a & Qt::AlignTop)
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
799 y += (r.height() - s.height()) / 2;
executed: y += (r.height() - s.height()) / 2;
Execution Count:3
3
800 -
801 QWidget *parent = parentWidget(); -
802 a = QStyle::visualAlignment(parent ? parent->layoutDirection() : QApplication::layoutDirection(), a); -
803 if (a & Qt::AlignRight)
partially evaluated: a & Qt::AlignRight
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
804 x += (r.width() - s.width());
executed: x += (r.width() - s.width());
Execution Count:3
3
805 else if (!(a & Qt::AlignLeft))
never evaluated: !(a & Qt::AlignLeft)
0
806 x += (r.width() - s.width()) / 2;
never executed: x += (r.width() - s.width()) / 2;
0
807 -
808 return QRect(x, y, s.width(), s.height());
executed: return QRect(x, y, s.width(), s.height());
Execution Count:3
3
809} -
810void QLayout::removeWidget(QWidget *widget) -
811{ -
812 int i = 0; -
813 QLayoutItem *child; -
814 while ((child = itemAt(i))) {
evaluated: (child = itemAt(i))
TRUEFALSE
yes
Evaluation Count:283
yes
Evaluation Count:110
110-283
815 if (child->widget() == widget) {
evaluated: child->widget() == widget
TRUEFALSE
yes
Evaluation Count:94
yes
Evaluation Count:189
94-189
816 delete takeAt(i); -
817 invalidate(); -
818 } else {
executed: }
Execution Count:94
94
819 ++i; -
820 }
executed: }
Execution Count:189
189
821 } -
822}
executed: }
Execution Count:110
110
823void QLayout::removeItem(QLayoutItem *item) -
824{ -
825 int i = 0; -
826 QLayoutItem *child; -
827 while ((child = itemAt(i))) {
evaluated: (child = itemAt(i))
TRUEFALSE
yes
Evaluation Count:53
yes
Evaluation Count:32
32-53
828 if (child == item) {
evaluated: child == item
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:21
21-32
829 takeAt(i); -
830 invalidate(); -
831 } else {
executed: }
Execution Count:32
32
832 ++i; -
833 }
executed: }
Execution Count:21
21
834 } -
835}
executed: }
Execution Count:32
32
836void QLayout::setEnabled(bool enable) -
837{ -
838 QLayoutPrivate * const d = d_func(); -
839 d->enabled = enable; -
840}
executed: }
Execution Count:468
468
841 -
842 -
843 -
844 -
845 -
846 -
847bool QLayout::isEnabled() const -
848{ -
849 const QLayoutPrivate * const d = d_func(); -
850 return d->enabled;
executed: return d->enabled;
Execution Count:234
234
851} -
852 -
853 -
854 -
855 -
856 -
857 -
858 -
859QSize QLayout::closestAcceptableSize(const QWidget *widget, const QSize &size) -
860{ -
861 QSize result = size.boundedTo(qSmartMaxSize(widget)); -
862 result = result.expandedTo(qSmartMinSize(widget)); -
863 QLayout *l = widget->layout(); -
864 if (l && l->hasHeightForWidth() && result.height() < l->minimumHeightForWidth(result.width()) ) {
never evaluated: l
never evaluated: l->hasHeightForWidth()
never evaluated: result.height() < l->minimumHeightForWidth(result.width())
0
865 QSize current = widget->size(); -
866 int currentHfw = l->minimumHeightForWidth(current.width()); -
867 int newHfw = l->minimumHeightForWidth(result.width()); -
868 if (current.height() < currentHfw || currentHfw == newHfw) {
never evaluated: current.height() < currentHfw
never evaluated: currentHfw == newHfw
0
869 -
870 -
871 result.setHeight(newHfw); -
872 } else {
never executed: }
0
873 -
874 -
875 int maxw = qMax(widget->width(),result.width()); -
876 int maxh = qMax(widget->height(), result.height()); -
877 int minw = qMin(widget->width(),result.width()); -
878 int minh = qMin(widget->height(), result.height()); -
879 -
880 int minhfw = l->minimumHeightForWidth(minw); -
881 int maxhfw = l->minimumHeightForWidth(maxw); -
882 while (minw < maxw) {
never evaluated: minw < maxw
0
883 if (minhfw > maxh) {
never evaluated: minhfw > maxh
0
884 minw = maxw - (maxw-minw)/2; -
885 minhfw = l->minimumHeightForWidth(minw); -
886 } else if (maxhfw < minh ) {
never executed: }
never evaluated: maxhfw < minh
0
887 maxw = minw + (maxw-minw)/2; -
888 maxhfw = l->minimumHeightForWidth(maxw); -
889 } else {
never executed: }
0
890 break;
never executed: break;
0
891 } -
892 } -
893 result = result.expandedTo(QSize(minw, minhfw)); -
894 }
never executed: }
0
895 } -
896 return result;
never executed: return result;
0
897} -
898 -
899void QSizePolicy::setControlType(ControlType type) -
900{ -
901 int i = 0; -
902 while (true) {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:293123
no
Evaluation Count:0
0-293123
903 if (type & (0x1 << i)) {
evaluated: type & (0x1 << i)
TRUEFALSE
yes
Evaluation Count:88373
yes
Evaluation Count:204750
88373-204750
904 bits.ctype = i; -
905 return;
executed: return;
Execution Count:88373
88373
906 } -
907 ++i; -
908 }
executed: }
Execution Count:204750
204750
909}
never executed: }
0
910 -
911QSizePolicy::ControlType QSizePolicy::controlType() const -
912{ -
913 return QSizePolicy::ControlType(1 << bits.ctype);
executed: return QSizePolicy::ControlType(1 << bits.ctype);
Execution Count:26848
26848
914} -
915QDataStream &operator<<(QDataStream &stream, const QSizePolicy &policy) -
916{ -
917 -
918 quint32 data = (policy.bits.horPolicy | -
919 policy.bits.verPolicy << 4 | -
920 policy.bits.hfw << 8 | -
921 policy.bits.ctype << 9 | -
922 policy.bits.wfh << 14 | -
923 -
924 policy.bits.verStretch << 16 | -
925 policy.bits.horStretch << 24); -
926 return stream << data;
executed: return stream << data;
Execution Count:2
2
927} -
928QDataStream &operator>>(QDataStream &stream, QSizePolicy &policy) -
929{ -
930 quint32 data; -
931 stream >> data; -
932 policy.bits.horPolicy = ((data >> 0) & ((1 << 4) -1)); -
933 policy.bits.verPolicy = ((data >> 4) & ((1 << 4) -1)); -
934 policy.bits.hfw = ((data >> 8) & ((1 << 1) -1)); -
935 policy.bits.ctype = ((data >> 9) & ((1 << 5) -1)); -
936 policy.bits.wfh = ((data >> 14) & ((1 << 1) -1)); -
937 policy.bits.padding = 0; -
938 policy.bits.verStretch = ((data >> 16) & ((1 << 8) -1)); -
939 policy.bits.horStretch = ((data >> 24) & ((1 << 8) -1)); -
940 return stream;
executed: return stream;
Execution Count:2
2
941} -
942 -
943 -
944 -
945 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial