Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | static int menuBarHeightForWidth(QWidget *menubar, int w) | - |
6 | { | - |
7 | if (menubar && !menubar->isHidden() && !menubar->isWindow()) { evaluated: menubar yes Evaluation Count:220 | yes Evaluation Count:18007 |
evaluated: !menubar->isHidden() yes Evaluation Count:207 | yes Evaluation Count:13 |
partially evaluated: !menubar->isWindow() yes Evaluation Count:207 | no Evaluation Count:0 |
| 0-18007 |
8 | int result = menubar->heightForWidth(qMax(w, menubar->minimumWidth())); | - |
9 | if (result != -1) partially evaluated: result != -1 yes Evaluation Count:207 | no Evaluation Count:0 |
| 0-207 |
10 | return result; executed: return result; Execution Count:207 | 207 |
11 | result = menubar->sizeHint() | - |
12 | .expandedTo(menubar->minimumSize()) | - |
13 | .expandedTo(menubar->minimumSizeHint()) | - |
14 | .boundedTo(menubar->maximumSize()).height(); | - |
15 | if (result != -1) never evaluated: result != -1 | 0 |
16 | return result; never executed: return result; | 0 |
17 | } | 0 |
18 | return 0; executed: return 0; Execution Count:18020 | 18020 |
19 | } | - |
20 | QLayout::QLayout(QWidget *parent) | - |
21 | : QObject(*new QLayoutPrivate, parent) | - |
22 | { | - |
23 | if (!parent) partially evaluated: !parent no Evaluation Count:0 | yes Evaluation Count:82 |
| 0-82 |
24 | return; | 0 |
25 | parent->setLayout(this); | - |
26 | } executed: } Execution Count:82 | 82 |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | QLayout::QLayout() | - |
35 | : QObject(*new QLayoutPrivate, 0) | - |
36 | { | - |
37 | } executed: } Execution Count:1 | 1 |
38 | | - |
39 | | - |
40 | | - |
41 | | - |
42 | QLayout::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 no Evaluation Count:0 | yes Evaluation Count:9745 |
| 0-9745 |
47 | lay->addItem(this); | - |
48 | } else if (w) { evaluated: w yes Evaluation Count:1693 | yes Evaluation Count:8052 |
| 0-8052 |
49 | if (w->layout()) { partially evaluated: w->layout() no Evaluation Count:0 | yes Evaluation Count:1693 |
| 0-1693 |
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 { | 0 |
56 | d->topLevel = true; | - |
57 | w->d_func()->layout = this; | - |
58 | if (true) { partially evaluated: true yes Evaluation Count:1693 | no Evaluation Count:0 |
| 0-1693 |
59 | invalidate(); | - |
60 | } else { executed: } Execution Count:1693 | 1693 |
61 | w->d_func()->layout = 0; | - |
62 | qt_noop(); | - |
63 | } | 0 |
64 | } | - |
65 | } | - |
66 | } | - |
67 | | - |
68 | QLayoutPrivate::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:9828 | 9828 |
74 | | - |
75 | void QLayoutPrivate::getMargin(int *result, int userMargin, QStyle::PixelMetric pm) const | - |
76 | { | - |
77 | if (!result) evaluated: !result yes Evaluation Count:9 | yes Evaluation Count:26119 |
| 9-26119 |
78 | return; executed: return; Execution Count:9 | 9 |
79 | | - |
80 | const QLayout * const q = q_func(); | - |
81 | if (userMargin >= 0) { evaluated: userMargin >= 0 yes Evaluation Count:20840 | yes Evaluation Count:5279 |
| 5279-20840 |
82 | *result = userMargin; | - |
83 | } else if (!topLevel) { executed: } Execution Count:20840 evaluated: !topLevel yes Evaluation Count:1364 | yes Evaluation Count:3915 |
| 1364-20840 |
84 | *result = 0; | - |
85 | } else if (QWidget *pw = q->parentWidget()) { executed: } Execution Count:1364 partially evaluated: QWidget *pw = q->parentWidget() yes Evaluation Count:3915 | no Evaluation Count:0 |
| 0-3915 |
86 | *result = pw->style()->pixelMetric(pm, 0, pw); | - |
87 | } else { executed: } Execution Count:3915 | 3915 |
88 | *result = 0; | - |
89 | } | 0 |
90 | } | - |
91 | | - |
92 | | - |
93 | | - |
94 | QLayoutPrivate::QWidgetItemFactoryMethod QLayoutPrivate::widgetItemFactoryMethod = 0; | - |
95 | QLayoutPrivate::QSpacerItemFactoryMethod QLayoutPrivate::spacerItemFactoryMethod = 0; | - |
96 | | - |
97 | QWidgetItem *QLayoutPrivate::createWidgetItem(const QLayout *layout, QWidget *widget) | - |
98 | { | - |
99 | if (widgetItemFactoryMethod) partially evaluated: widgetItemFactoryMethod no Evaluation Count:0 | yes Evaluation Count:13879 |
| 0-13879 |
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:13879 | 13879 |
103 | } | - |
104 | | - |
105 | QSpacerItem *QLayoutPrivate::createSpacerItem(const QLayout *layout, int w, int h, QSizePolicy::Policy hPolicy, QSizePolicy::Policy vPolicy) | - |
106 | { | - |
107 | if (spacerItemFactoryMethod) partially evaluated: spacerItemFactoryMethod no Evaluation Count:0 | yes Evaluation Count:1833 |
| 0-1833 |
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:1833 | 1833 |
111 | } | - |
112 | void QLayout::addWidget(QWidget *w) | - |
113 | { | - |
114 | addChildWidget(w); | - |
115 | addItem(QLayoutPrivate::createWidgetItem(this, w)); | - |
116 | } executed: } Execution Count:143 | 143 |
117 | bool QLayout::setAlignment(QWidget *w, Qt::Alignment alignment) | - |
118 | { | - |
119 | int i = 0; | - |
120 | QLayoutItem *item = itemAt(i); | - |
121 | while (item) { | 0 |
122 | if (item->widget() == w) { never evaluated: item->widget() == w | 0 |
123 | item->setAlignment(alignment); | - |
124 | invalidate(); | - |
125 | return true; never executed: return true; | 0 |
126 | } | - |
127 | ++i; | - |
128 | item = itemAt(i); | - |
129 | } | 0 |
130 | return false; never executed: return false; | 0 |
131 | } | - |
132 | bool QLayout::setAlignment(QLayout *l, Qt::Alignment alignment) | - |
133 | { | - |
134 | int i = 0; | - |
135 | QLayoutItem *item = itemAt(i); | - |
136 | while (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 | } | 0 |
145 | return false; never executed: return false; | 0 |
146 | } | - |
147 | int 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 yes Evaluation Count:132 | no Evaluation Count:0 |
partially evaluated: top == right yes Evaluation Count:132 | no Evaluation Count:0 |
partially evaluated: right == bottom yes Evaluation Count:132 | no Evaluation Count:0 |
| 0-132 |
152 | return left; executed: return left; Execution Count:132 | 132 |
153 | } else { | - |
154 | return -1; never executed: return -1; | 0 |
155 | } | - |
156 | } | - |
157 | int QLayout::spacing() const | - |
158 | { | - |
159 | if (const QBoxLayout* boxlayout = qobject_cast<const QBoxLayout*>(this)) { evaluated: const QBoxLayout* boxlayout = qobject_cast<const QBoxLayout*>(this) yes Evaluation Count:367 | yes Evaluation Count:272 |
| 272-367 |
160 | return boxlayout->spacing(); executed: return boxlayout->spacing(); Execution Count:367 | 367 |
161 | } else if (const QGridLayout* gridlayout = qobject_cast<const QGridLayout*>(this)) { evaluated: const QGridLayout* gridlayout = qobject_cast<const QGridLayout*>(this) yes Evaluation Count:186 | yes Evaluation Count:86 |
| 86-186 |
162 | return gridlayout->spacing(); executed: return gridlayout->spacing(); Execution Count:186 | 186 |
163 | } else if (const QFormLayout* formlayout = qobject_cast<const QFormLayout*>(this)) { evaluated: const QFormLayout* formlayout = qobject_cast<const QFormLayout*>(this) yes Evaluation Count:1 | yes Evaluation Count:85 |
| 1-85 |
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 yes Evaluation Count:85 | no Evaluation Count:0 |
| 0-85 |
168 | return d->insideSpacing; executed: return d->insideSpacing; Execution Count:85 | 85 |
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 | | - |
179 | void QLayout::setMargin(int margin) | - |
180 | { | - |
181 | setContentsMargins(margin, margin, margin, margin); | - |
182 | } executed: } Execution Count:8120 | 8120 |
183 | | - |
184 | void QLayout::setSpacing(int spacing) | - |
185 | { | - |
186 | if (QBoxLayout* boxlayout = qobject_cast<QBoxLayout*>(this)) { partially evaluated: QBoxLayout* boxlayout = qobject_cast<QBoxLayout*>(this) no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
187 | boxlayout->setSpacing(spacing); | - |
188 | } else if (QGridLayout* gridlayout = qobject_cast<QGridLayout*>(this)) { partially evaluated: QGridLayout* gridlayout = qobject_cast<QGridLayout*>(this) no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
189 | gridlayout->setSpacing(spacing); | - |
190 | } else if (QFormLayout* formlayout = qobject_cast<QFormLayout*>(this)) { partially evaluated: QFormLayout* formlayout = qobject_cast<QFormLayout*>(this) no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
191 | formlayout->setSpacing(spacing); | - |
192 | } else { | 0 |
193 | QLayoutPrivate * const d = d_func(); | - |
194 | d->insideSpacing = spacing; | - |
195 | invalidate(); | - |
196 | } executed: } Execution Count:15 | 15 |
197 | } | - |
198 | void 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 yes Evaluation Count:155 | yes Evaluation Count:8969 |
partially evaluated: d->userTopMargin == top yes Evaluation Count:155 | no Evaluation Count:0 |
| 0-8969 |
203 | d->userRightMargin == right && d->userBottomMargin == bottom) partially evaluated: d->userRightMargin == right yes Evaluation Count:155 | no Evaluation Count:0 |
partially evaluated: d->userBottomMargin == bottom yes Evaluation Count:155 | no Evaluation Count:0 |
| 0-155 |
204 | return; executed: return; Execution Count:155 | 155 |
205 | | - |
206 | d->userLeftMargin = left; | - |
207 | d->userTopMargin = top; | - |
208 | d->userRightMargin = right; | - |
209 | d->userBottomMargin = bottom; | - |
210 | invalidate(); | - |
211 | } executed: } Execution Count:8969 | 8969 |
212 | void QLayout::setContentsMargins(const QMargins &margins) | - |
213 | { | - |
214 | setContentsMargins(margins.left(), margins.top(), margins.right(), margins.bottom()); | - |
215 | } | 0 |
216 | void 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:6532 | 6532 |
224 | QMargins 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 | } | - |
230 | QRect 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 | } | - |
237 | QWidget *QLayout::parentWidget() const | - |
238 | { | - |
239 | const QLayoutPrivate * const d = d_func(); | - |
240 | if (!d->topLevel) { evaluated: !d->topLevel yes Evaluation Count:3095 | yes Evaluation Count:45818 |
| 3095-45818 |
241 | if (parent()) { evaluated: parent() yes Evaluation Count:1382 | yes Evaluation Count:1713 |
| 1382-1713 |
242 | QLayout *parentLayout = qobject_cast<QLayout*>(parent()); | - |
243 | if (!parentLayout) { evaluated: !parentLayout yes Evaluation Count:1 | yes Evaluation Count:1381 |
| 1-1381 |
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:1381 | 1381 |
248 | } else { | - |
249 | return 0; executed: return 0; Execution Count:1713 | 1713 |
250 | } | - |
251 | } else { | - |
252 | qt_noop(); | - |
253 | return static_cast<QWidget *>(parent()); executed: return static_cast<QWidget *>(parent()); Execution Count:45818 | 45818 |
254 | } | - |
255 | } | - |
256 | | - |
257 | | - |
258 | | - |
259 | | - |
260 | bool QLayout::isEmpty() const | - |
261 | { | - |
262 | int i = 0; | - |
263 | QLayoutItem *item = itemAt(i); | - |
264 | while (item) { evaluated: item yes Evaluation Count:6598 | yes Evaluation Count:180 |
| 180-6598 |
265 | if (!item->isEmpty()) evaluated: !item->isEmpty() yes Evaluation Count:3354 | yes Evaluation Count:3244 |
| 3244-3354 |
266 | return false; executed: return false; Execution Count:3354 | 3354 |
267 | ++i; | - |
268 | item = itemAt(i); | - |
269 | } executed: } Execution Count:3244 | 3244 |
270 | return true; executed: return true; Execution Count:180 | 180 |
271 | } | - |
272 | | - |
273 | | - |
274 | | - |
275 | | - |
276 | QSizePolicy::ControlTypes QLayout::controlTypes() const | - |
277 | { | - |
278 | if (count() == 0) evaluated: count() == 0 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 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 | | - |
289 | void QLayout::setGeometry(const QRect &r) | - |
290 | { | - |
291 | QLayoutPrivate * const d = d_func(); | - |
292 | d->rect = r; | - |
293 | } executed: } Execution Count:5089 | 5089 |
294 | | - |
295 | | - |
296 | | - |
297 | | - |
298 | QRect QLayout::geometry() const | - |
299 | { | - |
300 | const QLayoutPrivate * const d = d_func(); | - |
301 | return d->rect; executed: return d->rect; Execution Count:7680 | 7680 |
302 | } | - |
303 | | - |
304 | | - |
305 | | - |
306 | | - |
307 | void QLayout::invalidate() | - |
308 | { | - |
309 | QLayoutPrivate * const d = d_func(); | - |
310 | d->rect = QRect(); | - |
311 | update(); | - |
312 | } executed: } Execution Count:80094 | 80094 |
313 | | - |
314 | static bool removeWidgetRecursively(QLayoutItem *li, QWidget *w) | - |
315 | { | - |
316 | QLayout *lay = li->layout(); | - |
317 | if (!lay) evaluated: !lay yes Evaluation Count:3640 | yes Evaluation Count:1782 |
| 1782-3640 |
318 | return false; executed: return false; Execution Count:3640 | 3640 |
319 | int i = 0; | - |
320 | QLayoutItem *child; | - |
321 | while ((child = lay->itemAt(i))) { evaluated: (child = lay->itemAt(i)) yes Evaluation Count:4378 | yes Evaluation Count:1397 |
| 1397-4378 |
322 | if (child->widget() == w) { evaluated: child->widget() == w yes Evaluation Count:385 | yes Evaluation Count:3993 |
| 385-3993 |
323 | delete lay->takeAt(i); | - |
324 | lay->invalidate(); | - |
325 | return true; executed: return true; Execution Count:385 | 385 |
326 | } else if (removeWidgetRecursively(child, w)) { partially evaluated: removeWidgetRecursively(child, w) no Evaluation Count:0 | yes Evaluation Count:3993 |
| 0-3993 |
327 | return true; never executed: return true; | 0 |
328 | } else { | - |
329 | ++i; | - |
330 | } executed: } Execution Count:3993 | 3993 |
331 | } | - |
332 | return false; executed: return false; Execution Count:1397 | 1397 |
333 | } | - |
334 | | - |
335 | | - |
336 | void 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) no Evaluation Count:0 | yes Evaluation Count:5605 |
| 0-5605 |
342 | rect.setTop(rect.top() + mbh); | - |
343 | q->setGeometry(rect); | - |
344 | | - |
345 | if (menubar) evaluated: menubar yes Evaluation Count:116 | yes Evaluation Count:5489 |
| 116-5489 |
346 | menubar->setGeometry(0,0,r.width(), mbh); executed: menubar->setGeometry(0,0,r.width(), mbh); Execution Count:116 | 116 |
347 | | - |
348 | } executed: } Execution Count:5605 | 5605 |
349 | void QLayout::widgetEvent(QEvent *e) | - |
350 | { | - |
351 | QLayoutPrivate * const d = d_func(); | - |
352 | if (!d->enabled) partially evaluated: !d->enabled no Evaluation Count:0 | yes Evaluation Count:75845 |
| 0-75845 |
353 | return; | 0 |
354 | | - |
355 | switch (e->type()) { | - |
356 | case QEvent::Resize: | - |
357 | if (d->activated) { evaluated: d->activated yes Evaluation Count:2321 | yes Evaluation Count:46 |
| 46-2321 |
358 | QResizeEvent *r = (QResizeEvent *)e; | - |
359 | d->doResize(r->size()); | - |
360 | } else { executed: } Execution Count:2321 | 2321 |
361 | activate(); | - |
362 | } executed: } Execution Count:46 | 46 |
363 | break; executed: break; Execution Count:2367 | 2367 |
364 | case QEvent::ChildRemoved: | - |
365 | { | - |
366 | QChildEvent *c = (QChildEvent *)e; | - |
367 | if (c->child()->isWidgetType()) { evaluated: c->child()->isWidgetType() yes Evaluation Count:522 | yes Evaluation Count:114 |
| 114-522 |
368 | QWidget *w = (QWidget *)c->child(); | - |
369 | | - |
370 | if (w == d->menubar) partially evaluated: w == d->menubar no Evaluation Count:0 | yes Evaluation Count:522 |
| 0-522 |
371 | d->menubar = 0; never executed: d->menubar = 0; | 0 |
372 | | - |
373 | removeWidgetRecursively(this, w); | - |
374 | } executed: } Execution Count:522 | 522 |
375 | } | - |
376 | break; executed: break; Execution Count:636 | 636 |
377 | case QEvent::LayoutRequest: | - |
378 | if (static_cast<QWidget *>(parent())->isVisible()) evaluated: static_cast<QWidget *>(parent())->isVisible() yes Evaluation Count:1091 | yes Evaluation Count:1615 |
| 1091-1615 |
379 | activate(); executed: activate(); Execution Count:1091 | 1091 |
380 | break; executed: break; Execution Count:2706 | 2706 |
381 | default: | - |
382 | break; executed: break; Execution Count:70136 | 70136 |
383 | } | - |
384 | } executed: } Execution Count:75845 | 75845 |
385 | | - |
386 | | - |
387 | | - |
388 | | - |
389 | void QLayout::childEvent(QChildEvent *e) | - |
390 | { | - |
391 | QLayoutPrivate * const d = d_func(); | - |
392 | if (!d->enabled) partially evaluated: !d->enabled no Evaluation Count:0 | yes Evaluation Count:667 |
| 0-667 |
393 | return; | 0 |
394 | | - |
395 | if (e->type() == QEvent::ChildRemoved) { evaluated: e->type() == QEvent::ChildRemoved yes Evaluation Count:333 | yes Evaluation Count:334 |
| 333-334 |
396 | QChildEvent *c = (QChildEvent*)e; | - |
397 | int i = 0; | - |
398 | | - |
399 | QLayoutItem *item; | - |
400 | while ((item = itemAt(i))) { evaluated: (item = itemAt(i)) yes Evaluation Count:1204 | yes Evaluation Count:261 |
| 261-1204 |
401 | if (item == static_cast<QLayout*>(c->child())) { evaluated: item == static_cast<QLayout*>(c->child()) yes Evaluation Count:72 | yes Evaluation Count:1132 |
| 72-1132 |
402 | takeAt(i); | - |
403 | invalidate(); | - |
404 | break; executed: break; Execution Count:72 | 72 |
405 | } else { | - |
406 | ++i; | - |
407 | } executed: } Execution Count:1132 | 1132 |
408 | } | - |
409 | } executed: } Execution Count:333 | 333 |
410 | } executed: } Execution Count:667 | 667 |
411 | | - |
412 | | - |
413 | | - |
414 | | - |
415 | | - |
416 | int 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 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 | | - |
438 | QSize 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 yes Evaluation Count:3914 | no Evaluation Count:0 |
| 0-3914 |
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:3914 | 3914 |
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:3914 | 3914 |
455 | } | - |
456 | | - |
457 | | - |
458 | | - |
459 | | - |
460 | | - |
461 | QSize 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 yes Evaluation Count:7368 | no Evaluation Count:0 |
| 0-7368 |
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:7368 | 7368 |
472 | | - |
473 | QSize s = sizeHint(); | - |
474 | if (hasHeightForWidth()) evaluated: hasHeightForWidth() yes Evaluation Count:256 | yes Evaluation Count:7112 |
| 256-7112 |
475 | s.setHeight(heightForWidth(s.width() + side)); executed: s.setHeight(heightForWidth(s.width() + side)); Execution Count:256 | 256 |
476 | | - |
477 | top += menuBarHeightForWidth(d->menubar, s.width()); | - |
478 | | - |
479 | return s + QSize(side, top); executed: return s + QSize(side, top); Execution Count:7368 | 7368 |
480 | } | - |
481 | | - |
482 | | - |
483 | | - |
484 | | - |
485 | | - |
486 | QSize 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 yes Evaluation Count:1181 | no Evaluation Count:0 |
| 0-1181 |
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:1181 | 1181 |
497 | | - |
498 | QSize s = maximumSize(); | - |
499 | | - |
500 | top += menuBarHeightForWidth(d->menubar, s.width()); | - |
501 | | - |
502 | | - |
503 | if (d->topLevel) partially evaluated: d->topLevel yes Evaluation Count:1181 | no Evaluation Count:0 |
| 0-1181 |
504 | s = QSize(qMin(s.width() + side, QLAYOUTSIZE_MAX), | 1181 |
505 | qMin(s.height() + top, QLAYOUTSIZE_MAX)); executed: s = QSize(qMin(s.width() + side, QLAYOUTSIZE_MAX), qMin(s.height() + top, QLAYOUTSIZE_MAX)); Execution Count:1181 | 1181 |
506 | return s; executed: return s; Execution Count:1181 | 1181 |
507 | } | - |
508 | QLayout::~QLayout() | - |
509 | { | - |
510 | QLayoutPrivate * const d = d_func(); | - |
511 | | - |
512 | | - |
513 | | - |
514 | | - |
515 | if (d->topLevel && parent() && parent()->isWidgetType() && evaluated: d->topLevel yes Evaluation Count:8158 | yes Evaluation Count:315 |
partially evaluated: parent() yes Evaluation Count:8158 | no Evaluation Count:0 |
partially evaluated: parent()->isWidgetType() yes Evaluation Count:8158 | no Evaluation Count:0 |
| 0-8158 |
516 | ((QWidget*)parent())->layout() == this) partially evaluated: ((QWidget*)parent())->layout() == this yes Evaluation Count:8158 | no Evaluation Count:0 |
| 0-8158 |
517 | ((QWidget*)parent())->d_func()->layout = 0; executed: ((QWidget*)parent())->d_func()->layout = 0; Execution Count:8158 | 8158 |
518 | } executed: } Execution Count:8473 | 8473 |
519 | void QLayout::addChildLayout(QLayout *l) | - |
520 | { | - |
521 | if (l->parent()) { evaluated: l->parent() yes Evaluation Count:1 | yes Evaluation Count:334 |
| 1-334 |
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() yes Evaluation Count:314 | yes Evaluation Count:20 |
| 20-314 |
529 | l->d_func()->reparentChildWidgets(mw); | - |
530 | } executed: } Execution Count:314 | 314 |
531 | | - |
532 | } executed: } Execution Count:334 | 334 |
533 | void 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 no Evaluation Count:0 | yes Evaluation Count:8054 |
never evaluated: menubar->parentWidget() != mw | 0-8054 |
540 | menubar->setParent(mw); | - |
541 | } | 0 |
542 | | - |
543 | bool mwVisible = mw && mw->isVisible(); partially evaluated: mw yes Evaluation Count:8054 | no Evaluation Count:0 |
evaluated: mw->isVisible() yes Evaluation Count:2 | yes Evaluation Count:8052 |
| 0-8054 |
544 | for (int i = 0; i < n; ++i) { evaluated: i < n yes Evaluation Count:1822 | yes Evaluation Count:8054 |
| 1822-8054 |
545 | QLayoutItem *item = q->itemAt(i); | - |
546 | if (QWidget *w = item->widget()) { evaluated: QWidget *w = item->widget() yes Evaluation Count:1673 | yes Evaluation Count:149 |
| 149-1673 |
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 yes Evaluation Count:2 | yes Evaluation Count:1671 |
evaluated: w->isHidden() yes Evaluation Count:1 | yes Evaluation Count:1 |
partially evaluated: w->testAttribute(Qt::WA_WState_ExplicitShowHide) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1671 |
555 | if (pw != mw) evaluated: pw != mw yes Evaluation Count:217 | yes Evaluation Count:1456 |
| 217-1456 |
556 | w->setParent(mw); executed: w->setParent(mw); Execution Count:217 | 217 |
557 | if (needShow) evaluated: needShow yes Evaluation Count:1 | yes Evaluation Count:1672 |
| 1-1672 |
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:1673 evaluated: QLayout *l = item->layout() yes Evaluation Count:2 | yes Evaluation Count:147 |
| 2-1673 |
560 | l->d_func()->reparentChildWidgets(mw); | - |
561 | } executed: } Execution Count:2 | 2 |
562 | } | - |
563 | } executed: } Execution Count:8054 | 8054 |
564 | void 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 yes Evaluation Count:13157 | yes Evaluation Count:850 |
evaluated: w->testAttribute(Qt::WA_LaidOut) yes Evaluation Count:907 | yes Evaluation Count:12250 |
| 850-13157 |
572 | QLayout *l = pw->layout(); | - |
573 | if (l && removeWidgetRecursively(l, w)) { partially evaluated: l yes Evaluation Count:907 | no Evaluation Count:0 |
evaluated: removeWidgetRecursively(l, w) yes Evaluation Count:3 | yes Evaluation Count:904 |
| 0-907 |
574 | | - |
575 | | - |
576 | | - |
577 | | - |
578 | | - |
579 | } executed: } Execution Count:3 | 3 |
580 | } executed: } Execution Count:907 | 907 |
581 | if (pw && mw && pw != mw) { evaluated: pw yes Evaluation Count:13157 | yes Evaluation Count:850 |
evaluated: mw yes Evaluation Count:11723 | yes Evaluation Count:1434 |
evaluated: pw != mw yes Evaluation Count:18 | yes Evaluation Count:11705 |
| 18-13157 |
582 | | - |
583 | | - |
584 | | - |
585 | | - |
586 | | - |
587 | pw = 0; | - |
588 | } executed: } Execution Count:18 | 18 |
589 | bool needShow = mw && mw->isVisible() && !(w->isHidden() && w->testAttribute(Qt::WA_WState_ExplicitShowHide)); evaluated: mw yes Evaluation Count:12316 | yes Evaluation Count:1691 |
evaluated: mw->isVisible() yes Evaluation Count:124 | yes Evaluation Count:12192 |
evaluated: w->isHidden() yes Evaluation Count:121 | yes Evaluation Count:3 |
evaluated: w->testAttribute(Qt::WA_WState_ExplicitShowHide) yes Evaluation Count:55 | yes Evaluation Count:66 |
| 3-12316 |
590 | if (!pw && mw) evaluated: !pw yes Evaluation Count:868 | yes Evaluation Count:13139 |
evaluated: mw yes Evaluation Count:611 | yes Evaluation Count:257 |
| 257-13139 |
591 | w->setParent(mw); executed: w->setParent(mw); Execution Count:611 | 611 |
592 | w->setAttribute(Qt::WA_LaidOut); | - |
593 | if (needShow) evaluated: needShow yes Evaluation Count:69 | yes Evaluation Count:13938 |
| 69-13938 |
594 | QMetaObject::invokeMethod(w, "_q_showIfNotHidden", Qt::QueuedConnection); executed: QMetaObject::invokeMethod(w, "_q_showIfNotHidden", Qt::QueuedConnection); Execution Count:69 | 69 |
595 | } executed: } Execution Count:14007 | 14007 |
596 | void QLayout::setMenuBar(QWidget *widget) | - |
597 | { | - |
598 | QLayoutPrivate * const d = d_func(); | - |
599 | | - |
600 | | - |
601 | | - |
602 | | - |
603 | if (widget) evaluated: widget yes Evaluation Count:18 | yes Evaluation Count:1 |
| 1-18 |
604 | | - |
605 | addChildWidget(widget); executed: addChildWidget(widget); Execution Count:18 | 18 |
606 | d->menubar = widget; | - |
607 | } executed: } Execution Count:19 | 19 |
608 | | - |
609 | | - |
610 | | - |
611 | | - |
612 | | - |
613 | | - |
614 | QWidget *QLayout::menuBar() const | - |
615 | { | - |
616 | const QLayoutPrivate * const d = d_func(); | - |
617 | return d->menubar; executed: return d->menubar; Execution Count:7116 | 7116 |
618 | } | - |
619 | QSize QLayout::minimumSize() const | - |
620 | { | - |
621 | return QSize(0, 0); never executed: return QSize(0, 0); | 0 |
622 | } | - |
623 | QSize QLayout::maximumSize() const | - |
624 | { | - |
625 | return QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX); executed: return QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX); Execution Count:4 | 4 |
626 | } | - |
627 | Qt::Orientations QLayout::expandingDirections() const | - |
628 | { | - |
629 | return Qt::Horizontal | Qt::Vertical; executed: return Qt::Horizontal | Qt::Vertical; Execution Count:485 | 485 |
630 | } | - |
631 | | - |
632 | void QLayout::activateRecursiveHelper(QLayoutItem *item) | - |
633 | { | - |
634 | item->invalidate(); | - |
635 | QLayout *layout = item->layout(); | - |
636 | if (layout) { evaluated: layout yes Evaluation Count:3994 | yes Evaluation Count:10989 |
| 3994-10989 |
637 | QLayoutItem *child; | - |
638 | int i=0; | - |
639 | while ((child = layout->itemAt(i++))) evaluated: (child = layout->itemAt(i++)) yes Evaluation Count:11699 | yes Evaluation Count:3994 |
| 3994-11699 |
640 | activateRecursiveHelper(child); executed: activateRecursiveHelper(child); Execution Count:11699 | 11699 |
641 | layout->d_func()->activated = true; | - |
642 | } executed: } Execution Count:3994 | 3994 |
643 | } executed: } Execution Count:14983 | 14983 |
644 | void QLayout::update() | - |
645 | { | - |
646 | QLayout *layout = this; | - |
647 | while (layout && layout->d_func()->activated) { evaluated: layout yes Evaluation Count:81177 | yes Evaluation Count:399 |
evaluated: layout->d_func()->activated yes Evaluation Count:12320 | yes Evaluation Count:68857 |
| 399-81177 |
648 | layout->d_func()->activated = false; | - |
649 | if (layout->d_func()->topLevel) { evaluated: layout->d_func()->topLevel yes Evaluation Count:11323 | yes Evaluation Count:997 |
| 997-11323 |
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:11323 | 11323 |
654 | } | - |
655 | layout = static_cast<QLayout*>(layout->parent()); | - |
656 | } executed: } Execution Count:997 | 997 |
657 | } executed: } Execution Count:80579 | 80579 |
658 | bool QLayout::activate() | - |
659 | { | - |
660 | QLayoutPrivate * const d = d_func(); | - |
661 | if (!d->enabled || !parent()) partially evaluated: !d->enabled no Evaluation Count:0 | yes Evaluation Count:5545 |
partially evaluated: !parent() no Evaluation Count:0 | yes Evaluation Count:5545 |
| 0-5545 |
662 | return false; never executed: return false; | 0 |
663 | if (!d->topLevel) partially evaluated: !d->topLevel no Evaluation Count:0 | yes Evaluation Count:5545 |
| 0-5545 |
664 | return static_cast<QLayout*>(parent())->activate(); never executed: return static_cast<QLayout*>(parent())->activate(); | 0 |
665 | if (d->activated) evaluated: d->activated yes Evaluation Count:2261 | yes Evaluation Count:3284 |
| 2261-3284 |
666 | return false; executed: return false; Execution Count:2261 | 2261 |
667 | QWidget *mw = static_cast<QWidget*>(parent()); | - |
668 | if (mw == 0) { partially evaluated: mw == 0 no Evaluation Count:0 | yes Evaluation Count:3284 |
| 0-3284 |
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 yes Evaluation Count:1889 | yes Evaluation Count:1395 |
| 1395-1889 |
677 | uint explMax = md->extra ? md->extra->explicitMaxSize : 0; evaluated: md->extra yes Evaluation Count:1889 | yes Evaluation Count:1395 |
| 1395-1889 |
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; | 0 |
687 | case SetMaximumSize: | - |
688 | mw->setMaximumSize(totalMaximumSize()); | - |
689 | break; executed: break; Execution Count:571 | 571 |
690 | case SetMinAndMaxSize: | - |
691 | mw->setMinimumSize(totalMinimumSize()); | - |
692 | mw->setMaximumSize(totalMaximumSize()); | - |
693 | break; executed: break; Execution Count:146 | 146 |
694 | case SetDefaultConstraint: { | - |
695 | bool widthSet = explMin & Qt::Horizontal; | - |
696 | bool heightSet = explMin & Qt::Vertical; | - |
697 | if (mw->isWindow()) { evaluated: mw->isWindow() yes Evaluation Count:626 | yes Evaluation Count:1189 |
| 626-1189 |
698 | QSize ms = totalMinimumSize(); | - |
699 | if (widthSet) evaluated: widthSet yes Evaluation Count:19 | yes Evaluation Count:607 |
| 19-607 |
700 | ms.setWidth(mw->minimumSize().width()); executed: ms.setWidth(mw->minimumSize().width()); Execution Count:19 | 19 |
701 | if (heightSet) evaluated: heightSet yes Evaluation Count:18 | yes Evaluation Count:608 |
| 18-608 |
702 | ms.setHeight(mw->minimumSize().height()); executed: ms.setHeight(mw->minimumSize().height()); Execution Count:18 | 18 |
703 | if ((!heightSet || !widthSet) && hasHeightForWidth()) { evaluated: !heightSet yes Evaluation Count:608 | yes Evaluation Count:18 |
partially evaluated: !widthSet no Evaluation Count:0 | yes Evaluation Count:18 |
evaluated: hasHeightForWidth() yes Evaluation Count:27 | yes Evaluation Count:581 |
| 0-608 |
704 | int h = minimumHeightForWidth(ms.width()); | - |
705 | if (h > ms.height()) { evaluated: h > ms.height() yes Evaluation Count:23 | yes Evaluation Count:4 |
| 4-23 |
706 | if (!heightSet) partially evaluated: !heightSet 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 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:27 | 27 |
712 | mw->setMinimumSize(ms); | - |
713 | } else if (!widthSet || !heightSet) { executed: } Execution Count:626 evaluated: !widthSet yes Evaluation Count:1169 | yes Evaluation Count:20 |
partially evaluated: !heightSet no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-1169 |
714 | QSize ms = mw->minimumSize(); | - |
715 | if (!widthSet) partially evaluated: !widthSet yes Evaluation Count:1169 | no Evaluation Count:0 |
| 0-1169 |
716 | ms.setWidth(0); executed: ms.setWidth(0); Execution Count:1169 | 1169 |
717 | if (!heightSet) evaluated: !heightSet yes Evaluation Count:1161 | yes Evaluation Count:8 |
| 8-1161 |
718 | ms.setHeight(0); executed: ms.setHeight(0); Execution Count:1161 | 1161 |
719 | mw->setMinimumSize(ms); | - |
720 | } executed: } Execution Count:1169 | 1169 |
721 | break; executed: break; Execution Count:1815 | 1815 |
722 | } | - |
723 | case SetNoConstraint: | - |
724 | break; executed: break; Execution Count:738 | 738 |
725 | } | - |
726 | | - |
727 | d->doResize(mw->size()); | - |
728 | | - |
729 | if (md->extra) { evaluated: md->extra yes Evaluation Count:2753 | yes Evaluation Count:531 |
| 531-2753 |
730 | md->extra->explicitMinSize = explMin; | - |
731 | md->extra->explicitMaxSize = explMax; | - |
732 | } executed: } Execution Count:2753 | 2753 |
733 | | - |
734 | mw->updateGeometry(); | - |
735 | return true; executed: return true; Execution Count:3284 | 3284 |
736 | } | - |
737 | int QLayout::indexOf(QWidget *widget) const | - |
738 | { | - |
739 | int i = 0; | - |
740 | QLayoutItem *item = itemAt(i); | - |
741 | while (item) { evaluated: item yes Evaluation Count:318 | yes Evaluation Count:7 |
| 7-318 |
742 | if (item->widget() == widget) evaluated: item->widget() == widget yes Evaluation Count:214 | yes Evaluation Count:104 |
| 104-214 |
743 | return i; executed: return i; Execution Count:214 | 214 |
744 | ++i; | - |
745 | item = itemAt(i); | - |
746 | } executed: } Execution Count:104 | 104 |
747 | return -1; executed: return -1; Execution Count:7 | 7 |
748 | } | - |
749 | void QLayout::setSizeConstraint(SizeConstraint constraint) | - |
750 | { | - |
751 | QLayoutPrivate * const d = d_func(); | - |
752 | if (constraint == d->constraint) partially evaluated: constraint == d->constraint no Evaluation Count:0 | yes Evaluation Count:7589 |
| 0-7589 |
753 | return; | 0 |
754 | | - |
755 | d->constraint = constraint; | - |
756 | invalidate(); | - |
757 | } executed: } Execution Count:7589 | 7589 |
758 | | - |
759 | QLayout::SizeConstraint QLayout::sizeConstraint() const | - |
760 | { | - |
761 | const QLayoutPrivate * const d = d_func(); | - |
762 | return d->constraint; never executed: return d->constraint; | 0 |
763 | } | - |
764 | QRect 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) no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
780 | !(a & Qt::AlignHorizontal_Mask)) { partially evaluated: !(a & Qt::AlignHorizontal_Mask) no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
781 | s.setWidth(qMin(r.width(), ms.width())); | - |
782 | } | 0 |
783 | if ((expandingDirections() & Qt::Vertical) || partially evaluated: (expandingDirections() & Qt::Vertical) no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
784 | !(a & Qt::AlignVertical_Mask)) { partially evaluated: !(a & Qt::AlignVertical_Mask) 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 | } | 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 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) 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 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 | } | - |
810 | void QLayout::removeWidget(QWidget *widget) | - |
811 | { | - |
812 | int i = 0; | - |
813 | QLayoutItem *child; | - |
814 | while ((child = itemAt(i))) { evaluated: (child = itemAt(i)) yes Evaluation Count:279 | yes Evaluation Count:107 |
| 107-279 |
815 | if (child->widget() == widget) { evaluated: child->widget() == widget yes Evaluation Count:93 | yes Evaluation Count:186 |
| 93-186 |
816 | delete takeAt(i); | - |
817 | invalidate(); | - |
818 | } else { executed: } Execution Count:93 | 93 |
819 | ++i; | - |
820 | } executed: } Execution Count:186 | 186 |
821 | } | - |
822 | } executed: } Execution Count:107 | 107 |
823 | void QLayout::removeItem(QLayoutItem *item) | - |
824 | { | - |
825 | int i = 0; | - |
826 | QLayoutItem *child; | - |
827 | while ((child = itemAt(i))) { evaluated: (child = itemAt(i)) yes Evaluation Count:53 | yes Evaluation Count:32 |
| 32-53 |
828 | if (child == item) { evaluated: child == item 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 |
836 | void 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 | | - |
847 | bool 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 | | - |
859 | QSize 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->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 { | 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 evaluated: maxhfw < minh | 0 |
887 | maxw = minw + (maxw-minw)/2; | - |
888 | maxhfw = l->minimumHeightForWidth(maxw); | - |
889 | } else { | 0 |
890 | break; | 0 |
891 | } | - |
892 | } | - |
893 | result = result.expandedTo(QSize(minw, minhfw)); | - |
894 | } | 0 |
895 | } | - |
896 | return result; never executed: return result; | 0 |
897 | } | - |
898 | | - |
899 | void QSizePolicy::setControlType(ControlType type) | - |
900 | { | - |
901 | int i = 0; | - |
902 | while (true) { partially evaluated: true yes Evaluation Count:221290 | no Evaluation Count:0 |
| 0-221290 |
903 | if (type & (0x1 << i)) { evaluated: type & (0x1 << i) yes Evaluation Count:67276 | yes Evaluation Count:154014 |
| 67276-154014 |
904 | bits.ctype = i; | - |
905 | return; executed: return; Execution Count:67276 | 67276 |
906 | } | - |
907 | ++i; | - |
908 | } executed: } Execution Count:154014 | 154014 |
909 | } | 0 |
910 | | - |
911 | QSizePolicy::ControlType QSizePolicy::controlType() const | - |
912 | { | - |
913 | return QSizePolicy::ControlType(1 << bits.ctype); executed: return QSizePolicy::ControlType(1 << bits.ctype); Execution Count:26848 | 26848 |
914 | } | - |
915 | QDataStream &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:1 | 1 |
927 | } | - |
928 | QDataStream &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:1 | 1 |
941 | } | - |
942 | | - |
943 | | - |
944 | | - |
945 | | - |
| | |