Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | struct QGridLayoutSizeTriple | - |
5 | { | - |
6 | QSize minS; | - |
7 | QSize hint; | - |
8 | QSize maxS; | - |
9 | }; | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | class QGridBox | - |
18 | { | - |
19 | public: | - |
20 | QGridBox(QLayoutItem *lit) { item_ = lit; } executed: } Execution Count:778 | 778 |
21 | | - |
22 | QGridBox(const QLayout *l, QWidget *wid) { item_ = QLayoutPrivate::createWidgetItem(l, wid); } executed: } Execution Count:1682 | 1682 |
23 | ~QGridBox() { delete item_; } executed: } Execution Count:2460 | 2460 |
24 | | - |
25 | QSize sizeHint() const { return item_->sizeHint(); } executed: return item_->sizeHint(); Execution Count:7580 | 7580 |
26 | QSize minimumSize() const { return item_->minimumSize(); } executed: return item_->minimumSize(); Execution Count:7580 | 7580 |
27 | QSize maximumSize() const { return item_->maximumSize(); } executed: return item_->maximumSize(); Execution Count:6729 | 6729 |
28 | Qt::Orientations expandingDirections() const { return item_->expandingDirections(); } executed: return item_->expandingDirections(); Execution Count:11434 | 11434 |
29 | bool isEmpty() const { return item_->isEmpty(); } executed: return item_->isEmpty(); Execution Count:22912 | 22912 |
30 | | - |
31 | bool hasHeightForWidth() const { return item_->hasHeightForWidth(); } executed: return item_->hasHeightForWidth(); Execution Count:7914 | 7914 |
32 | int heightForWidth(int w) const { return item_->heightForWidth(w); } executed: return item_->heightForWidth(w); Execution Count:334 | 334 |
33 | | - |
34 | void setAlignment(Qt::Alignment a) { item_->setAlignment(a); } executed: } Execution Count:2460 | 2460 |
35 | void setGeometry(const QRect &r) { item_->setGeometry(r); } executed: } Execution Count:4378 | 4378 |
36 | Qt::Alignment alignment() const { return item_->alignment(); } never executed: return item_->alignment(); | 0 |
37 | QLayoutItem *item() { return item_; } executed: return item_; Execution Count:29441 | 29441 |
38 | QLayoutItem *takeItem() { QLayoutItem *i = item_; item_ = 0; return i; } executed: return i; Execution Count:264 | 264 |
39 | | - |
40 | int hStretch() { return item_->widget() ? | 6556 |
41 | item_->widget()->sizePolicy().horizontalStretch() : 0; } executed: return item_->widget() ? item_->widget()->sizePolicy().horizontalStretch() : 0; Execution Count:6556 | 6556 |
42 | int vStretch() { return item_->widget() ? | 6772 |
43 | item_->widget()->sizePolicy().verticalStretch() : 0; } executed: return item_->widget() ? item_->widget()->sizePolicy().verticalStretch() : 0; Execution Count:6772 | 6772 |
44 | | - |
45 | private: | - |
46 | friend class QGridLayoutPrivate; | - |
47 | friend class QGridLayout; | - |
48 | | - |
49 | inline int toRow(int rr) const { return torow >= 0 ? torow : rr - 1; } executed: return torow >= 0 ? torow : rr - 1; Execution Count:33954 | 33954 |
50 | inline int toCol(int cc) const { return tocol >= 0 ? tocol : cc - 1; } executed: return tocol >= 0 ? tocol : cc - 1; Execution Count:37619 | 37619 |
51 | | - |
52 | QLayoutItem *item_; | - |
53 | int row, col; | - |
54 | int torow, tocol; | - |
55 | }; | - |
56 | | - |
57 | class QGridLayoutPrivate : public QLayoutPrivate | - |
58 | { | - |
59 | inline QGridLayout* q_func() { return static_cast<QGridLayout *>(q_ptr); } inline const QGridLayout* q_func() const { return static_cast<const QGridLayout *>(q_ptr); } friend class QGridLayout; | - |
60 | public: | - |
61 | QGridLayoutPrivate(); | - |
62 | | - |
63 | void add(QGridBox*, int row, int col); | - |
64 | void add(QGridBox*, int row1, int row2, int col1, int col2); | - |
65 | QSize sizeHint(int hSpacing, int vSpacing) const; | - |
66 | QSize minimumSize(int hSpacing, int vSpacing) const; | - |
67 | QSize maximumSize(int hSpacing, int vSpacing) const; | - |
68 | | - |
69 | Qt::Orientations expandingDirections(int hSpacing, int vSpacing) const; | - |
70 | | - |
71 | void distribute(QRect rect, int hSpacing, int vSpacing); | - |
72 | inline int numRows() const { return rr; } executed: return rr; Execution Count:94 | 94 |
73 | inline int numCols() const { return cc; } executed: return cc; Execution Count:94 | 94 |
74 | inline void expand(int rows, int cols) | - |
75 | { setSize(qMax(rows, rr), qMax(cols, cc)); } executed: } Execution Count:3600 | 3600 |
76 | inline void setRowStretch(int r, int s) | - |
77 | { expand(r + 1, 0); rStretch[r] = s; setDirty(); } executed: } Execution Count:23 | 23 |
78 | inline void setColStretch(int c, int s) | - |
79 | { expand(0, c + 1); cStretch[c] = s; setDirty(); } executed: } Execution Count:34 | 34 |
80 | inline int rowStretch(int r) const { return rStretch.at(r); } never executed: return rStretch.at(r); | 0 |
81 | inline int colStretch(int c) const { return cStretch.at(c); } never executed: return cStretch.at(c); | 0 |
82 | inline void setRowMinimumHeight(int r, int s) | - |
83 | { expand(r + 1, 0); rMinHeights[r] = s; setDirty(); } executed: } Execution Count:388 | 388 |
84 | inline void setColumnMinimumWidth(int c, int s) | - |
85 | { expand(0, c + 1); cMinWidths[c] = s; setDirty(); } executed: } Execution Count:291 | 291 |
86 | inline int rowSpacing(int r) const { return rMinHeights.at(r); } never executed: return rMinHeights.at(r); | 0 |
87 | inline int colSpacing(int c) const { return cMinWidths.at(c); } executed: return cMinWidths.at(c); Execution Count:1 | 1 |
88 | | - |
89 | inline void setReversed(bool r, bool c) { hReversed = c; vReversed = r; } | 0 |
90 | inline bool horReversed() const { return hReversed; } never executed: return hReversed; | 0 |
91 | inline bool verReversed() const { return vReversed; } never executed: return vReversed; | 0 |
92 | inline void setDirty() { needRecalc = true; hfw_width = -1; } executed: } Execution Count:24477 | 24477 |
93 | inline bool isDirty() const { return needRecalc; } executed: return needRecalc; Execution Count:1411 | 1411 |
94 | bool hasHeightForWidth(int hSpacing, int vSpacing); | - |
95 | int heightForWidth(int width, int hSpacing, int vSpacing); | - |
96 | int minimumHeightForWidth(int width, int hSpacing, int vSpacing); | - |
97 | | - |
98 | inline void getNextPos(int &row, int &col) { row = nextR; col = nextC; } executed: } Execution Count:1 | 1 |
99 | inline int count() const { return things.count(); } executed: return things.count(); Execution Count:231 | 231 |
100 | QRect cellRect(int row, int col) const; | - |
101 | | - |
102 | inline QLayoutItem *itemAt(int index) const { | - |
103 | if (index < things.count()) evaluated: index < things.count() yes Evaluation Count:6932 | yes Evaluation Count:1802 |
| 1802-6932 |
104 | return things.at(index)->item(); executed: return things.at(index)->item(); Execution Count:6932 | 6932 |
105 | else | - |
106 | return 0; executed: return 0; Execution Count:1802 | 1802 |
107 | } | - |
108 | inline QLayoutItem *takeAt(int index) { | - |
109 | QGridLayout * const q = q_func(); | - |
110 | if (index < things.count()) { partially evaluated: index < things.count() yes Evaluation Count:264 | no Evaluation Count:0 |
| 0-264 |
111 | if (QGridBox *b = things.takeAt(index)) { partially evaluated: QGridBox *b = things.takeAt(index) yes Evaluation Count:264 | no Evaluation Count:0 |
| 0-264 |
112 | QLayoutItem *item = b->takeItem(); | - |
113 | if (QLayout *l = item->layout()) { evaluated: QLayout *l = item->layout() yes Evaluation Count:41 | yes Evaluation Count:223 |
| 41-223 |
114 | | - |
115 | if (l->parent() == q) partially evaluated: l->parent() == q yes Evaluation Count:41 | no Evaluation Count:0 |
| 0-41 |
116 | l->setParent(0); executed: l->setParent(0); Execution Count:41 | 41 |
117 | } executed: } Execution Count:41 | 41 |
118 | delete b; | - |
119 | return item; executed: return item; Execution Count:264 | 264 |
120 | } | - |
121 | } | 0 |
122 | return 0; never executed: return 0; | 0 |
123 | } | - |
124 | | - |
125 | void getItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan) const { | - |
126 | if (index < things.count()) { partially evaluated: index < things.count() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
127 | const QGridBox *b = things.at(index); | - |
128 | int toRow = b->toRow(rr); | - |
129 | int toCol = b->toCol(cc); | - |
130 | *row = b->row; | - |
131 | *column = b->col; | - |
132 | *rowSpan = toRow - *row + 1; | - |
133 | *columnSpan = toCol - *column +1; | - |
134 | } executed: } Execution Count:4 | 4 |
135 | } executed: } Execution Count:4 | 4 |
136 | void deleteAll(); | - |
137 | | - |
138 | private: | - |
139 | void setNextPosAfter(int r, int c); | - |
140 | void recalcHFW(int w); | - |
141 | void addHfwData(QGridBox *box, int width); | - |
142 | void init(); | - |
143 | QSize findSize(int QLayoutStruct::*, int hSpacing, int vSpacing) const; | - |
144 | void addData(QGridBox *b, const QGridLayoutSizeTriple &sizes, bool r, bool c); | - |
145 | void setSize(int rows, int cols); | - |
146 | void setupSpacings(QVector<QLayoutStruct> &chain, QGridBox *grid[], int fixedSpacing, | - |
147 | Qt::Orientation orientation); | - |
148 | void setupLayoutData(int hSpacing, int vSpacing); | - |
149 | void setupHfwLayoutData(); | - |
150 | void effectiveMargins(int *left, int *top, int *right, int *bottom) const; | - |
151 | | - |
152 | int rr; | - |
153 | int cc; | - |
154 | QVector<QLayoutStruct> rowData; | - |
155 | QVector<QLayoutStruct> colData; | - |
156 | QVector<QLayoutStruct> *hfwData; | - |
157 | QVector<int> rStretch; | - |
158 | QVector<int> cStretch; | - |
159 | QVector<int> rMinHeights; | - |
160 | QVector<int> cMinWidths; | - |
161 | QList<QGridBox *> things; | - |
162 | | - |
163 | int hfw_width; | - |
164 | int hfw_height; | - |
165 | int hfw_minheight; | - |
166 | int nextR; | - |
167 | int nextC; | - |
168 | | - |
169 | int horizontalSpacing; | - |
170 | int verticalSpacing; | - |
171 | int leftMargin; | - |
172 | int topMargin; | - |
173 | int rightMargin; | - |
174 | int bottomMargin; | - |
175 | | - |
176 | uint hReversed : 1; | - |
177 | uint vReversed : 1; | - |
178 | uint needRecalc : 1; | - |
179 | uint has_hfw : 1; | - |
180 | uint addVertical : 1; | - |
181 | }; | - |
182 | | - |
183 | void QGridLayoutPrivate::effectiveMargins(int *left, int *top, int *right, int *bottom) const | - |
184 | { | - |
185 | int l = leftMargin; | - |
186 | int t = topMargin; | - |
187 | int r = rightMargin; | - |
188 | int b = bottomMargin; | - |
189 | if (left) evaluated: left yes Evaluation Count:3999 | yes Evaluation Count:9 |
| 9-3999 |
190 | *left = l; executed: *left = l; Execution Count:3999 | 3999 |
191 | if (top) partially evaluated: top yes Evaluation Count:4008 | no Evaluation Count:0 |
| 0-4008 |
192 | *top = t; executed: *top = t; Execution Count:4008 | 4008 |
193 | if (right) evaluated: right yes Evaluation Count:3999 | yes Evaluation Count:9 |
| 9-3999 |
194 | *right = r; executed: *right = r; Execution Count:3999 | 3999 |
195 | if (bottom) partially evaluated: bottom yes Evaluation Count:4008 | no Evaluation Count:0 |
| 0-4008 |
196 | *bottom = b; executed: *bottom = b; Execution Count:4008 | 4008 |
197 | } executed: } Execution Count:4008 | 4008 |
198 | | - |
199 | QGridLayoutPrivate::QGridLayoutPrivate() | - |
200 | { | - |
201 | addVertical = false; | - |
202 | setDirty(); | - |
203 | rr = cc = 0; | - |
204 | nextR = nextC = 0; | - |
205 | hfwData = 0; | - |
206 | hReversed = false; | - |
207 | vReversed = false; | - |
208 | horizontalSpacing = -1; | - |
209 | verticalSpacing = -1; | - |
210 | } executed: } Execution Count:404 | 404 |
211 | void QGridLayoutPrivate::deleteAll() | - |
212 | { | - |
213 | while (!things.isEmpty()) evaluated: !things.isEmpty() yes Evaluation Count:2196 | yes Evaluation Count:404 |
| 404-2196 |
214 | delete things.takeFirst(); executed: delete things.takeFirst(); Execution Count:2196 | 2196 |
215 | delete hfwData; | - |
216 | } executed: } Execution Count:404 | 404 |
217 | | - |
218 | bool QGridLayoutPrivate::hasHeightForWidth(int hSpacing, int vSpacing) | - |
219 | { | - |
220 | setupLayoutData(hSpacing, vSpacing); | - |
221 | return has_hfw; executed: return has_hfw; Execution Count:1660 | 1660 |
222 | } | - |
223 | | - |
224 | | - |
225 | | - |
226 | | - |
227 | | - |
228 | void QGridLayoutPrivate::recalcHFW(int w) | - |
229 | { | - |
230 | | - |
231 | | - |
232 | | - |
233 | | - |
234 | if (!hfwData) evaluated: !hfwData yes Evaluation Count:27 | yes Evaluation Count:271 |
| 27-271 |
235 | hfwData = new QVector<QLayoutStruct>(rr); executed: hfwData = new QVector<QLayoutStruct>(rr); Execution Count:27 | 27 |
236 | setupHfwLayoutData(); | - |
237 | QVector<QLayoutStruct> &rData = *hfwData; | - |
238 | | - |
239 | int h = 0; | - |
240 | int mh = 0; | - |
241 | for (int r = 0; r < rr; r++) { evaluated: r < rr yes Evaluation Count:1583 | yes Evaluation Count:298 |
| 298-1583 |
242 | int spacing = rData.at(r).spacing; | - |
243 | h += rData.at(r).sizeHint + spacing; | - |
244 | mh += rData.at(r).minimumSize + spacing; | - |
245 | } executed: } Execution Count:1583 | 1583 |
246 | | - |
247 | hfw_width = w; | - |
248 | hfw_height = qMin(QLAYOUTSIZE_MAX, h); | - |
249 | hfw_minheight = qMin(QLAYOUTSIZE_MAX, mh); | - |
250 | } executed: } Execution Count:298 | 298 |
251 | | - |
252 | int QGridLayoutPrivate::heightForWidth(int w, int hSpacing, int vSpacing) | - |
253 | { | - |
254 | setupLayoutData(hSpacing, vSpacing); | - |
255 | if (!has_hfw) partially evaluated: !has_hfw no Evaluation Count:0 | yes Evaluation Count:235 |
| 0-235 |
256 | return -1; never executed: return -1; | 0 |
257 | int left, top, right, bottom; | - |
258 | effectiveMargins(&left, &top, &right, &bottom); | - |
259 | | - |
260 | int hMargins = left + right; | - |
261 | if (w - hMargins != hfw_width) { evaluated: w - hMargins != hfw_width yes Evaluation Count:129 | yes Evaluation Count:106 |
| 106-129 |
262 | qGeomCalc(colData, 0, cc, 0, w - hMargins); | - |
263 | recalcHFW(w - hMargins); | - |
264 | } executed: } Execution Count:129 | 129 |
265 | return hfw_height + top + bottom; executed: return hfw_height + top + bottom; Execution Count:235 | 235 |
266 | } | - |
267 | | - |
268 | int QGridLayoutPrivate::minimumHeightForWidth(int w, int hSpacing, int vSpacing) | - |
269 | { | - |
270 | (void)heightForWidth(w, hSpacing, vSpacing); | - |
271 | if (!has_hfw) partially evaluated: !has_hfw no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
272 | return -1; never executed: return -1; | 0 |
273 | int top, bottom; | - |
274 | effectiveMargins(0, &top, 0, &bottom); | - |
275 | return hfw_minheight + top + bottom; executed: return hfw_minheight + top + bottom; Execution Count:9 | 9 |
276 | } | - |
277 | | - |
278 | QSize QGridLayoutPrivate::findSize(int QLayoutStruct::*size, int hSpacing, int vSpacing) const | - |
279 | { | - |
280 | QGridLayoutPrivate *that = const_cast<QGridLayoutPrivate*>(this); | - |
281 | that->setupLayoutData(hSpacing, vSpacing); | - |
282 | | - |
283 | int w = 0; | - |
284 | int h = 0; | - |
285 | | - |
286 | for (int r = 0; r < rr; r++) evaluated: r < rr yes Evaluation Count:8548 | yes Evaluation Count:2555 |
| 2555-8548 |
287 | h += rowData.at(r).*size + rowData.at(r).spacing; executed: h += rowData.at(r).*size + rowData.at(r).spacing; Execution Count:8548 | 8548 |
288 | for (int c = 0; c < cc; c++) evaluated: c < cc yes Evaluation Count:4953 | yes Evaluation Count:2555 |
| 2555-4953 |
289 | w += colData.at(c).*size + colData.at(c).spacing; executed: w += colData.at(c).*size + colData.at(c).spacing; Execution Count:4953 | 4953 |
290 | | - |
291 | w = qMin(QLAYOUTSIZE_MAX, w); | - |
292 | h = qMin(QLAYOUTSIZE_MAX, h); | - |
293 | | - |
294 | return QSize(w, h); executed: return QSize(w, h); Execution Count:2555 | 2555 |
295 | } | - |
296 | | - |
297 | Qt::Orientations QGridLayoutPrivate::expandingDirections(int hSpacing, int vSpacing) const | - |
298 | { | - |
299 | QGridLayoutPrivate *that = const_cast<QGridLayoutPrivate*>(this); | - |
300 | that->setupLayoutData(hSpacing, vSpacing); | - |
301 | Qt::Orientations ret; | - |
302 | | - |
303 | for (int r = 0; r < rr; r++) { evaluated: r < rr yes Evaluation Count:814 | yes Evaluation Count:132 |
| 132-814 |
304 | if (rowData.at(r).expansive) { evaluated: rowData.at(r).expansive yes Evaluation Count:135 | yes Evaluation Count:679 |
| 135-679 |
305 | ret |= Qt::Vertical; | - |
306 | break; executed: break; Execution Count:135 | 135 |
307 | } | - |
308 | } executed: } Execution Count:679 | 679 |
309 | for (int c = 0; c < cc; c++) { evaluated: c < cc yes Evaluation Count:668 | yes Evaluation Count:116 |
| 116-668 |
310 | if (colData.at(c).expansive) { evaluated: colData.at(c).expansive yes Evaluation Count:151 | yes Evaluation Count:517 |
| 151-517 |
311 | ret |= Qt::Horizontal; | - |
312 | break; executed: break; Execution Count:151 | 151 |
313 | } | - |
314 | } executed: } Execution Count:517 | 517 |
315 | return ret; executed: return ret; Execution Count:267 | 267 |
316 | } | - |
317 | | - |
318 | QSize QGridLayoutPrivate::sizeHint(int hSpacing, int vSpacing) const | - |
319 | { | - |
320 | return findSize(&QLayoutStruct::sizeHint, hSpacing, vSpacing); executed: return findSize(&QLayoutStruct::sizeHint, hSpacing, vSpacing); Execution Count:1048 | 1048 |
321 | } | - |
322 | | - |
323 | QSize QGridLayoutPrivate::maximumSize(int hSpacing, int vSpacing) const | - |
324 | { | - |
325 | return findSize(&QLayoutStruct::maximumSize, hSpacing, vSpacing); executed: return findSize(&QLayoutStruct::maximumSize, hSpacing, vSpacing); Execution Count:499 | 499 |
326 | } | - |
327 | | - |
328 | QSize QGridLayoutPrivate::minimumSize(int hSpacing, int vSpacing) const | - |
329 | { | - |
330 | return findSize(&QLayoutStruct::minimumSize, hSpacing, vSpacing); executed: return findSize(&QLayoutStruct::minimumSize, hSpacing, vSpacing); Execution Count:1008 | 1008 |
331 | } | - |
332 | | - |
333 | void QGridLayoutPrivate::setSize(int r, int c) | - |
334 | { | - |
335 | if ((int)rowData.size() < r) { evaluated: (int)rowData.size() < r yes Evaluation Count:1156 | yes Evaluation Count:2444 |
| 1156-2444 |
336 | int newR = qMax(r, rr * 2); | - |
337 | rowData.resize(newR); | - |
338 | rStretch.resize(newR); | - |
339 | rMinHeights.resize(newR); | - |
340 | for (int i = rr; i < newR; i++) { evaluated: i < newR yes Evaluation Count:1698 | yes Evaluation Count:1156 |
| 1156-1698 |
341 | rowData[i].init(); | - |
342 | rowData[i].maximumSize = 0; | - |
343 | rowData[i].pos = 0; | - |
344 | rowData[i].size = 0; | - |
345 | rStretch[i] = 0; | - |
346 | rMinHeights[i] = 0; | - |
347 | } executed: } Execution Count:1698 | 1698 |
348 | } executed: } Execution Count:1156 | 1156 |
349 | if ((int)colData.size() < c) { evaluated: (int)colData.size() < c yes Evaluation Count:804 | yes Evaluation Count:2796 |
| 804-2796 |
350 | int newC = qMax(c, cc * 2); | - |
351 | colData.resize(newC); | - |
352 | cStretch.resize(newC); | - |
353 | cMinWidths.resize(newC); | - |
354 | for (int i = cc; i < newC; i++) { evaluated: i < newC yes Evaluation Count:1236 | yes Evaluation Count:804 |
| 804-1236 |
355 | colData[i].init(); | - |
356 | colData[i].maximumSize = 0; | - |
357 | colData[i].pos = 0; | - |
358 | colData[i].size = 0; | - |
359 | cStretch[i] = 0; | - |
360 | cMinWidths[i] = 0; | - |
361 | } executed: } Execution Count:1236 | 1236 |
362 | } executed: } Execution Count:804 | 804 |
363 | | - |
364 | if (hfwData && (int)hfwData->size() < r) { evaluated: hfwData yes Evaluation Count:462 | yes Evaluation Count:3138 |
evaluated: (int)hfwData->size() < r yes Evaluation Count:3 | yes Evaluation Count:459 |
| 3-3138 |
365 | delete hfwData; | - |
366 | hfwData = 0; | - |
367 | hfw_width = -1; | - |
368 | } executed: } Execution Count:3 | 3 |
369 | rr = r; | - |
370 | cc = c; | - |
371 | } executed: } Execution Count:3600 | 3600 |
372 | | - |
373 | void QGridLayoutPrivate::setNextPosAfter(int row, int col) | - |
374 | { | - |
375 | if (addVertical) { partially evaluated: addVertical no Evaluation Count:0 | yes Evaluation Count:2460 |
| 0-2460 |
376 | if (col > nextC || (col == nextC && row >= nextR)) { never evaluated: col > nextC never evaluated: col == nextC never evaluated: row >= nextR | 0 |
377 | nextR = row + 1; | - |
378 | nextC = col; | - |
379 | if (nextR >= rr) { never evaluated: nextR >= rr | 0 |
380 | nextR = 0; | - |
381 | nextC++; | - |
382 | } | 0 |
383 | } | 0 |
384 | } else { | 0 |
385 | if (row > nextR || (row == nextR && col >= nextC)) { evaluated: row > nextR yes Evaluation Count:350 | yes Evaluation Count:2110 |
evaluated: row == nextR yes Evaluation Count:1202 | yes Evaluation Count:908 |
evaluated: col >= nextC yes Evaluation Count:1197 | yes Evaluation Count:5 |
| 5-2110 |
386 | nextR = row; | - |
387 | nextC = col + 1; | - |
388 | if (nextC >= cc) { evaluated: nextC >= cc yes Evaluation Count:1039 | yes Evaluation Count:508 |
| 508-1039 |
389 | nextC = 0; | - |
390 | nextR++; | - |
391 | } executed: } Execution Count:1039 | 1039 |
392 | } executed: } Execution Count:1547 | 1547 |
393 | } executed: } Execution Count:2460 | 2460 |
394 | } | - |
395 | | - |
396 | void QGridLayoutPrivate::add(QGridBox *box, int row, int col) | - |
397 | { | - |
398 | expand(row + 1, col + 1); | - |
399 | box->row = box->torow = row; | - |
400 | box->col = box->tocol = col; | - |
401 | things.append(box); | - |
402 | setDirty(); | - |
403 | setNextPosAfter(row, col); | - |
404 | } executed: } Execution Count:1683 | 1683 |
405 | | - |
406 | void QGridLayoutPrivate::add(QGridBox *box, int row1, int row2, int col1, int col2) | - |
407 | { | - |
408 | if (row2 >= 0 && row2 < row1) evaluated: row2 >= 0 yes Evaluation Count:2456 | yes Evaluation Count:3 |
partially evaluated: row2 < row1 no Evaluation Count:0 | yes Evaluation Count:2456 |
| 0-2456 |
409 | QMessageLogger("kernel/qgridlayout.cpp", 556, __PRETTY_FUNCTION__).warning("QGridLayout: Multi-cell fromRow greater than toRow"); never executed: QMessageLogger("kernel/qgridlayout.cpp", 556, __PRETTY_FUNCTION__).warning("QGridLayout: Multi-cell fromRow greater than toRow"); | 0 |
410 | if (col2 >= 0 && col2 < col1) partially evaluated: col2 >= 0 yes Evaluation Count:2459 | no Evaluation Count:0 |
partially evaluated: col2 < col1 no Evaluation Count:0 | yes Evaluation Count:2459 |
| 0-2459 |
411 | QMessageLogger("kernel/qgridlayout.cpp", 558, __PRETTY_FUNCTION__).warning("QGridLayout: Multi-cell fromCol greater than toCol"); never executed: QMessageLogger("kernel/qgridlayout.cpp", 558, __PRETTY_FUNCTION__).warning("QGridLayout: Multi-cell fromCol greater than toCol"); | 0 |
412 | if (row1 == row2 && col1 == col2) { evaluated: row1 == row2 yes Evaluation Count:2172 | yes Evaluation Count:287 |
evaluated: col1 == col2 yes Evaluation Count:1682 | yes Evaluation Count:490 |
| 287-2172 |
413 | add(box, row1, col1); | - |
414 | return; executed: return; Execution Count:1682 | 1682 |
415 | } | - |
416 | expand(row2 + 1, col2 + 1); | - |
417 | box->row = row1; | - |
418 | box->col = col1; | - |
419 | | - |
420 | box->torow = row2; | - |
421 | box->tocol = col2; | - |
422 | | - |
423 | things.append(box); | - |
424 | setDirty(); | - |
425 | if (col2 < 0) partially evaluated: col2 < 0 no Evaluation Count:0 | yes Evaluation Count:777 |
| 0-777 |
426 | col2 = cc - 1; never executed: col2 = cc - 1; | 0 |
427 | | - |
428 | setNextPosAfter(row2, col2); | - |
429 | } executed: } Execution Count:777 | 777 |
430 | | - |
431 | void QGridLayoutPrivate::addData(QGridBox *box, const QGridLayoutSizeTriple &sizes, bool r, bool c) | - |
432 | { | - |
433 | const QWidget *widget = box->item()->widget(); | - |
434 | | - |
435 | if (box->isEmpty() && widget) evaluated: box->isEmpty() yes Evaluation Count:172 | yes Evaluation Count:11306 |
evaluated: widget yes Evaluation Count:44 | yes Evaluation Count:128 |
| 44-11306 |
436 | return; executed: return; Execution Count:44 | 44 |
437 | | - |
438 | if (c) { evaluated: c yes Evaluation Count:5484 | yes Evaluation Count:5950 |
| 5484-5950 |
439 | QLayoutStruct *data = &colData[box->col]; | - |
440 | if (!cStretch.at(box->col)) evaluated: !cStretch.at(box->col) yes Evaluation Count:5329 | yes Evaluation Count:155 |
| 155-5329 |
441 | data->stretch = qMax(data->stretch, box->hStretch()); executed: data->stretch = qMax(data->stretch, box->hStretch()); Execution Count:5329 | 5329 |
442 | data->sizeHint = qMax(sizes.hint.width(), data->sizeHint); | - |
443 | data->minimumSize = qMax(sizes.minS.width(), data->minimumSize); | - |
444 | | - |
445 | qMaxExpCalc(data->maximumSize, data->expansive, data->empty, sizes.maxS.width(), | - |
446 | box->expandingDirections() & Qt::Horizontal, box->isEmpty()); | - |
447 | } executed: } Execution Count:5484 | 5484 |
448 | if (r) { evaluated: r yes Evaluation Count:5950 | yes Evaluation Count:5484 |
| 5484-5950 |
449 | QLayoutStruct *data = &rowData[box->row]; | - |
450 | if (!rStretch.at(box->row)) evaluated: !rStretch.at(box->row) yes Evaluation Count:5867 | yes Evaluation Count:83 |
| 83-5867 |
451 | data->stretch = qMax(data->stretch, box->vStretch()); executed: data->stretch = qMax(data->stretch, box->vStretch()); Execution Count:5867 | 5867 |
452 | data->sizeHint = qMax(sizes.hint.height(), data->sizeHint); | - |
453 | data->minimumSize = qMax(sizes.minS.height(), data->minimumSize); | - |
454 | | - |
455 | qMaxExpCalc(data->maximumSize, data->expansive, data->empty, sizes.maxS.height(), | - |
456 | box->expandingDirections() & Qt::Vertical, box->isEmpty()); | - |
457 | } executed: } Execution Count:5950 | 5950 |
458 | } executed: } Execution Count:11434 | 11434 |
459 | | - |
460 | static void initEmptyMultiBox(QVector<QLayoutStruct> &chain, int start, int end) | - |
461 | { | - |
462 | for (int i = start; i <= end; i++) { evaluated: i <= end yes Evaluation Count:5325 | yes Evaluation Count:2132 |
| 2132-5325 |
463 | QLayoutStruct *data = &chain[i]; | - |
464 | if (data->empty && data->maximumSize == 0) evaluated: data->empty yes Evaluation Count:2211 | yes Evaluation Count:3114 |
evaluated: data->maximumSize == 0 yes Evaluation Count:1912 | yes Evaluation Count:299 |
| 299-3114 |
465 | data->maximumSize = ((1<<24)-1); executed: data->maximumSize = ((1<<24)-1); Execution Count:1912 | 1912 |
466 | data->empty = false; | - |
467 | } executed: } Execution Count:5325 | 5325 |
468 | } executed: } Execution Count:2132 | 2132 |
469 | | - |
470 | static void distributeMultiBox(QVector<QLayoutStruct> &chain, int start, int end, int minSize, | - |
471 | int sizeHint, QVector<int> &stretchArray, int stretch) | - |
472 | { | - |
473 | int i; | - |
474 | int w = 0; | - |
475 | int wh = 0; | - |
476 | int max = 0; | - |
477 | | - |
478 | for (i = start; i <= end; i++) { evaluated: i <= end yes Evaluation Count:5325 | yes Evaluation Count:2132 |
| 2132-5325 |
479 | QLayoutStruct *data = &chain[i]; | - |
480 | w += data->minimumSize; | - |
481 | wh += data->sizeHint; | - |
482 | max += data->maximumSize; | - |
483 | if (stretchArray.at(i) == 0) evaluated: stretchArray.at(i) == 0 yes Evaluation Count:5087 | yes Evaluation Count:238 |
| 238-5087 |
484 | data->stretch = qMax(data->stretch, stretch); executed: data->stretch = qMax(data->stretch, stretch); Execution Count:5087 | 5087 |
485 | | - |
486 | if (i != end) { evaluated: i != end yes Evaluation Count:3193 | yes Evaluation Count:2132 |
| 2132-3193 |
487 | int spacing = data->spacing; | - |
488 | w += spacing; | - |
489 | wh += spacing; | - |
490 | max += spacing; | - |
491 | } executed: } Execution Count:3193 | 3193 |
492 | } executed: } Execution Count:5325 | 5325 |
493 | | - |
494 | if (max < minSize) { evaluated: max < minSize yes Evaluation Count:309 | yes Evaluation Count:1823 |
| 309-1823 |
495 | | - |
496 | | - |
497 | | - |
498 | | - |
499 | | - |
500 | | - |
501 | | - |
502 | qGeomCalc(chain, start, end - start + 1, 0, minSize); | - |
503 | int pos = 0; | - |
504 | for (i = start; i <= end; i++) { evaluated: i <= end yes Evaluation Count:618 | yes Evaluation Count:309 |
| 309-618 |
505 | QLayoutStruct *data = &chain[i]; | - |
506 | int nextPos = (i == end) ? minSize : chain.at(i + 1).pos; evaluated: (i == end) yes Evaluation Count:309 | yes Evaluation Count:309 |
| 309 |
507 | int realSize = nextPos - pos; | - |
508 | if (i != end) evaluated: i != end yes Evaluation Count:309 | yes Evaluation Count:309 |
| 309 |
509 | realSize -= data->spacing; executed: realSize -= data->spacing; Execution Count:309 | 309 |
510 | if (data->minimumSize < realSize) partially evaluated: data->minimumSize < realSize yes Evaluation Count:618 | no Evaluation Count:0 |
| 0-618 |
511 | data->minimumSize = realSize; executed: data->minimumSize = realSize; Execution Count:618 | 618 |
512 | if (data->maximumSize < data->minimumSize) partially evaluated: data->maximumSize < data->minimumSize yes Evaluation Count:618 | no Evaluation Count:0 |
| 0-618 |
513 | data->maximumSize = data->minimumSize; executed: data->maximumSize = data->minimumSize; Execution Count:618 | 618 |
514 | pos = nextPos; | - |
515 | } executed: } Execution Count:618 | 618 |
516 | } else if (w < minSize) { executed: } Execution Count:309 evaluated: w < minSize yes Evaluation Count:808 | yes Evaluation Count:1015 |
| 309-1015 |
517 | qGeomCalc(chain, start, end - start + 1, 0, minSize); | - |
518 | for (i = start; i <= end; i++) { evaluated: i <= end yes Evaluation Count:2005 | yes Evaluation Count:808 |
| 808-2005 |
519 | QLayoutStruct *data = &chain[i]; | - |
520 | if (data->minimumSize < data->size) evaluated: data->minimumSize < data->size yes Evaluation Count:926 | yes Evaluation Count:1079 |
| 926-1079 |
521 | data->minimumSize = data->size; executed: data->minimumSize = data->size; Execution Count:926 | 926 |
522 | } executed: } Execution Count:2005 | 2005 |
523 | } executed: } Execution Count:808 | 808 |
524 | | - |
525 | if (wh < sizeHint) { evaluated: wh < sizeHint yes Evaluation Count:1470 | yes Evaluation Count:662 |
| 662-1470 |
526 | qGeomCalc(chain, start, end - start + 1, 0, sizeHint); | - |
527 | for (i = start; i <= end; i++) { evaluated: i <= end yes Evaluation Count:3780 | yes Evaluation Count:1470 |
| 1470-3780 |
528 | QLayoutStruct *data = &chain[i]; | - |
529 | if (data->sizeHint < data->size) evaluated: data->sizeHint < data->size yes Evaluation Count:1945 | yes Evaluation Count:1835 |
| 1835-1945 |
530 | data->sizeHint = data->size; executed: data->sizeHint = data->size; Execution Count:1945 | 1945 |
531 | } executed: } Execution Count:3780 | 3780 |
532 | } executed: } Execution Count:1470 | 1470 |
533 | } executed: } Execution Count:2132 | 2132 |
534 | | - |
535 | static QGridBox *&gridAt(QGridBox *grid[], int r, int c, int cc, | - |
536 | Qt::Orientation orientation = Qt::Vertical) | - |
537 | { | - |
538 | if (orientation == Qt::Horizontal) evaluated: orientation == Qt::Horizontal yes Evaluation Count:11882 | yes Evaluation Count:22302 |
| 11882-22302 |
539 | qSwap(r, c); executed: qSwap(r, c); Execution Count:11882 | 11882 |
540 | return grid[(r * cc) + c]; executed: return grid[(r * cc) + c]; Execution Count:34184 | 34184 |
541 | } | - |
542 | | - |
543 | void QGridLayoutPrivate::setupSpacings(QVector<QLayoutStruct> &chain, | - |
544 | QGridBox *grid[], int fixedSpacing, | - |
545 | Qt::Orientation orientation) | - |
546 | { | - |
547 | QGridLayout * const q = q_func(); | - |
548 | int numRows = rr; | - |
549 | int numColumns = cc; | - |
550 | | - |
551 | if (orientation == Qt::Horizontal) { evaluated: orientation == Qt::Horizontal yes Evaluation Count:1623 | yes Evaluation Count:1623 |
| 1623 |
552 | qSwap(numRows, numColumns); | - |
553 | } executed: } Execution Count:1623 | 1623 |
554 | | - |
555 | QStyle *style = 0; | - |
556 | if (fixedSpacing < 0) { evaluated: fixedSpacing < 0 yes Evaluation Count:220 | yes Evaluation Count:3026 |
| 220-3026 |
557 | if (QWidget *parentWidget = q->parentWidget()) partially evaluated: QWidget *parentWidget = q->parentWidget() yes Evaluation Count:220 | no Evaluation Count:0 |
| 0-220 |
558 | style = parentWidget->style(); executed: style = parentWidget->style(); Execution Count:220 | 220 |
559 | } executed: } Execution Count:220 | 220 |
560 | | - |
561 | for (int c = 0; c < numColumns; ++c) { evaluated: c < numColumns yes Evaluation Count:9466 | yes Evaluation Count:3246 |
| 3246-9466 |
562 | QGridBox *previousBox = 0; | - |
563 | int previousRow = -1; | - |
564 | | - |
565 | for (int r = 0; r < numRows; ++r) { evaluated: r < numRows yes Evaluation Count:29542 | yes Evaluation Count:9466 |
| 9466-29542 |
566 | if (chain.at(r).empty) evaluated: chain.at(r).empty yes Evaluation Count:4844 | yes Evaluation Count:24698 |
| 4844-24698 |
567 | continue; executed: continue; Execution Count:4844 | 4844 |
568 | | - |
569 | QGridBox *box = gridAt(grid, r, c, cc, orientation); | - |
570 | if (previousRow != -1 && (!box || previousBox != box)) { evaluated: previousRow != -1 yes Evaluation Count:15408 | yes Evaluation Count:9290 |
evaluated: !box yes Evaluation Count:3970 | yes Evaluation Count:11438 |
evaluated: previousBox != box yes Evaluation Count:8589 | yes Evaluation Count:2849 |
| 2849-15408 |
571 | int spacing = fixedSpacing; | - |
572 | if (spacing < 0) { evaluated: spacing < 0 yes Evaluation Count:2032 | yes Evaluation Count:10527 |
| 2032-10527 |
573 | QSizePolicy::ControlTypes controlTypes1 = QSizePolicy::DefaultType; | - |
574 | QSizePolicy::ControlTypes controlTypes2 = QSizePolicy::DefaultType; | - |
575 | if (previousBox) evaluated: previousBox yes Evaluation Count:584 | yes Evaluation Count:1448 |
| 584-1448 |
576 | controlTypes1 = previousBox->item()->controlTypes(); executed: controlTypes1 = previousBox->item()->controlTypes(); Execution Count:584 | 584 |
577 | if (box) evaluated: box yes Evaluation Count:640 | yes Evaluation Count:1392 |
| 640-1392 |
578 | controlTypes2 = box->item()->controlTypes(); executed: controlTypes2 = box->item()->controlTypes(); Execution Count:640 | 640 |
579 | | - |
580 | if ((orientation == Qt::Horizontal && hReversed) evaluated: orientation == Qt::Horizontal yes Evaluation Count:804 | yes Evaluation Count:1228 |
partially evaluated: hReversed no Evaluation Count:0 | yes Evaluation Count:804 |
| 0-1228 |
581 | || (orientation == Qt::Vertical && vReversed)) evaluated: orientation == Qt::Vertical yes Evaluation Count:1228 | yes Evaluation Count:804 |
partially evaluated: vReversed no Evaluation Count:0 | yes Evaluation Count:1228 |
| 0-1228 |
582 | qSwap(controlTypes1, controlTypes2); never executed: qSwap(controlTypes1, controlTypes2); | 0 |
583 | | - |
584 | if (style) partially evaluated: style yes Evaluation Count:2032 | no Evaluation Count:0 |
| 0-2032 |
585 | spacing = style->combinedLayoutSpacing(controlTypes1, controlTypes2, | 2032 |
586 | orientation, 0, q->parentWidget()); executed: spacing = style->combinedLayoutSpacing(controlTypes1, controlTypes2, orientation, 0, q->parentWidget()); Execution Count:2032 | 2032 |
587 | } else { executed: } Execution Count:2032 | 2032 |
588 | if (orientation == Qt::Vertical) { evaluated: orientation == Qt::Vertical yes Evaluation Count:6969 | yes Evaluation Count:3558 |
| 3558-6969 |
589 | QGridBox *sibling = vReversed ? previousBox : box; partially evaluated: vReversed no Evaluation Count:0 | yes Evaluation Count:6969 |
| 0-6969 |
590 | if (sibling) { evaluated: sibling yes Evaluation Count:5335 | yes Evaluation Count:1634 |
| 1634-5335 |
591 | QWidget *wid = sibling->item()->widget(); | - |
592 | if (wid) evaluated: wid yes Evaluation Count:4463 | yes Evaluation Count:872 |
| 872-4463 |
593 | spacing = qMax(spacing, sibling->item()->geometry().top() - wid->geometry().top() ); executed: spacing = qMax(spacing, sibling->item()->geometry().top() - wid->geometry().top() ); Execution Count:4463 | 4463 |
594 | } executed: } Execution Count:5335 | 5335 |
595 | } executed: } Execution Count:6969 | 6969 |
596 | } executed: } Execution Count:10527 | 10527 |
597 | | - |
598 | if (spacing > chain.at(previousRow).spacing) evaluated: spacing > chain.at(previousRow).spacing yes Evaluation Count:3079 | yes Evaluation Count:9480 |
| 3079-9480 |
599 | chain[previousRow].spacing = spacing; executed: chain[previousRow].spacing = spacing; Execution Count:3079 | 3079 |
600 | } executed: } Execution Count:12559 | 12559 |
601 | | - |
602 | previousBox = box; | - |
603 | previousRow = r; | - |
604 | } executed: } Execution Count:24698 | 24698 |
605 | } executed: } Execution Count:9466 | 9466 |
606 | } executed: } Execution Count:3246 | 3246 |
607 | | - |
608 | | - |
609 | | - |
610 | void QGridLayoutPrivate::setupLayoutData(int hSpacing, int vSpacing) | - |
611 | { | - |
612 | QGridLayout * const q = q_func(); | - |
613 | | - |
614 | | - |
615 | if (!needRecalc) evaluated: !needRecalc yes Evaluation Count:4303 | yes Evaluation Count:1623 |
| 1623-4303 |
616 | return; executed: return; Execution Count:4303 | 4303 |
617 | | - |
618 | has_hfw = false; | - |
619 | int i; | - |
620 | | - |
621 | for (i = 0; i < rr; i++) { evaluated: i < rr yes Evaluation Count:5904 | yes Evaluation Count:1623 |
| 1623-5904 |
622 | rowData[i].init(rStretch.at(i), rMinHeights.at(i)); | - |
623 | rowData[i].maximumSize = rStretch.at(i) ? QLAYOUTSIZE_MAX : rMinHeights.at(i); evaluated: rStretch.at(i) yes Evaluation Count:75 | yes Evaluation Count:5829 |
| 75-5829 |
624 | } executed: } Execution Count:5904 | 5904 |
625 | for (i = 0; i < cc; i++) { evaluated: i < cc yes Evaluation Count:3562 | yes Evaluation Count:1623 |
| 1623-3562 |
626 | colData[i].init(cStretch.at(i), cMinWidths.at(i)); | - |
627 | colData[i].maximumSize = cStretch.at(i) ? QLAYOUTSIZE_MAX : cMinWidths.at(i); evaluated: cStretch.at(i) yes Evaluation Count:94 | yes Evaluation Count:3468 |
| 94-3468 |
628 | } executed: } Execution Count:3562 | 3562 |
629 | | - |
630 | int n = things.size(); | - |
631 | QVarLengthArray<QGridLayoutSizeTriple> sizes(n); | - |
632 | | - |
633 | bool has_multi = false; | - |
634 | | - |
635 | | - |
636 | | - |
637 | | - |
638 | | - |
639 | QVarLengthArray<QGridBox *> grid(rr * cc); | - |
640 | memset(grid.data(), 0, rr * cc * sizeof(QGridBox *)); | - |
641 | | - |
642 | | - |
643 | | - |
644 | | - |
645 | | - |
646 | for (i = 0; i < n; ++i) { evaluated: i < n yes Evaluation Count:6729 | yes Evaluation Count:1623 |
| 1623-6729 |
647 | QGridBox * const box = things.at(i); | - |
648 | sizes[i].minS = box->minimumSize(); | - |
649 | sizes[i].hint = box->sizeHint(); | - |
650 | sizes[i].maxS = box->maximumSize(); | - |
651 | | - |
652 | if (box->hasHeightForWidth()) evaluated: box->hasHeightForWidth() yes Evaluation Count:266 | yes Evaluation Count:6463 |
| 266-6463 |
653 | has_hfw = true; executed: has_hfw = true; Execution Count:266 | 266 |
654 | | - |
655 | if (box->row == box->toRow(rr)) { evaluated: box->row == box->toRow(rr) yes Evaluation Count:5976 | yes Evaluation Count:753 |
| 753-5976 |
656 | addData(box, sizes[i], true, false); | - |
657 | } else { executed: } Execution Count:5976 | 5976 |
658 | initEmptyMultiBox(rowData, box->row, box->toRow(rr)); | - |
659 | has_multi = true; | - |
660 | } executed: } Execution Count:753 | 753 |
661 | | - |
662 | if (box->col == box->toCol(cc)) { evaluated: box->col == box->toCol(cc) yes Evaluation Count:5502 | yes Evaluation Count:1227 |
| 1227-5502 |
663 | addData(box, sizes[i], false, true); | - |
664 | } else { executed: } Execution Count:5502 | 5502 |
665 | initEmptyMultiBox(colData, box->col, box->toCol(cc)); | - |
666 | has_multi = true; | - |
667 | } executed: } Execution Count:1227 | 1227 |
668 | | - |
669 | for (int r = box->row; r <= box->toRow(rr); ++r) { evaluated: r <= box->toRow(rr) yes Evaluation Count:7777 | yes Evaluation Count:6729 |
| 6729-7777 |
670 | for (int c = box->col; c <= box->toCol(cc); ++c) { evaluated: c <= box->toCol(cc) yes Evaluation Count:9486 | yes Evaluation Count:7777 |
| 7777-9486 |
671 | gridAt(grid.data(), r, c, cc) = box; | - |
672 | } executed: } Execution Count:9486 | 9486 |
673 | } executed: } Execution Count:7777 | 7777 |
674 | } executed: } Execution Count:6729 | 6729 |
675 | | - |
676 | setupSpacings(colData, grid.data(), hSpacing, Qt::Horizontal); | - |
677 | setupSpacings(rowData, grid.data(), vSpacing, Qt::Vertical); | - |
678 | | - |
679 | | - |
680 | | - |
681 | | - |
682 | | - |
683 | | - |
684 | if (has_multi) { evaluated: has_multi yes Evaluation Count:799 | yes Evaluation Count:824 |
| 799-824 |
685 | for (i = 0; i < n; ++i) { evaluated: i < n yes Evaluation Count:4400 | yes Evaluation Count:799 |
| 799-4400 |
686 | QGridBox * const box = things.at(i); | - |
687 | | - |
688 | if (box->row != box->toRow(rr)) evaluated: box->row != box->toRow(rr) yes Evaluation Count:753 | yes Evaluation Count:3647 |
| 753-3647 |
689 | distributeMultiBox(rowData, box->row, box->toRow(rr), sizes[i].minS.height(), | 753 |
690 | sizes[i].hint.height(), rStretch, box->vStretch()); executed: distributeMultiBox(rowData, box->row, box->toRow(rr), sizes[i].minS.height(), sizes[i].hint.height(), rStretch, box->vStretch()); Execution Count:753 | 753 |
691 | if (box->col != box->toCol(cc)) evaluated: box->col != box->toCol(cc) yes Evaluation Count:1227 | yes Evaluation Count:3173 |
| 1227-3173 |
692 | distributeMultiBox(colData, box->col, box->toCol(cc), sizes[i].minS.width(), | 1227 |
693 | sizes[i].hint.width(), cStretch, box->hStretch()); executed: distributeMultiBox(colData, box->col, box->toCol(cc), sizes[i].minS.width(), sizes[i].hint.width(), cStretch, box->hStretch()); Execution Count:1227 | 1227 |
694 | } executed: } Execution Count:4400 | 4400 |
695 | } executed: } Execution Count:799 | 799 |
696 | | - |
697 | for (i = 0; i < rr; i++) evaluated: i < rr yes Evaluation Count:5904 | yes Evaluation Count:1623 |
| 1623-5904 |
698 | rowData[i].expansive = rowData.at(i).expansive || rowData.at(i).stretch > 0; executed: rowData[i].expansive = rowData.at(i).expansive || rowData.at(i).stretch > 0; Execution Count:5904 evaluated: rowData.at(i).expansive yes Evaluation Count:465 | yes Evaluation Count:5439 |
evaluated: rowData.at(i).stretch > 0 yes Evaluation Count:73 | yes Evaluation Count:5366 |
| 73-5904 |
699 | for (i = 0; i < cc; i++) evaluated: i < cc yes Evaluation Count:3562 | yes Evaluation Count:1623 |
| 1623-3562 |
700 | colData[i].expansive = colData.at(i).expansive || colData.at(i).stretch > 0; executed: colData[i].expansive = colData.at(i).expansive || colData.at(i).stretch > 0; Execution Count:3562 evaluated: colData.at(i).expansive yes Evaluation Count:1056 | yes Evaluation Count:2506 |
evaluated: colData.at(i).stretch > 0 yes Evaluation Count:78 | yes Evaluation Count:2428 |
| 78-3562 |
701 | | - |
702 | q->getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin); | - |
703 | | - |
704 | needRecalc = false; | - |
705 | } executed: } Execution Count:1623 | 1623 |
706 | | - |
707 | void QGridLayoutPrivate::addHfwData(QGridBox *box, int width) | - |
708 | { | - |
709 | QVector<QLayoutStruct> &rData = *hfwData; | - |
710 | if (box->hasHeightForWidth()) { evaluated: box->hasHeightForWidth() yes Evaluation Count:334 | yes Evaluation Count:699 |
| 334-699 |
711 | int hint = box->heightForWidth(width); | - |
712 | rData[box->row].sizeHint = qMax(hint, rData.at(box->row).sizeHint); | - |
713 | rData[box->row].minimumSize = qMax(hint, rData.at(box->row).minimumSize); | - |
714 | } else { executed: } Execution Count:334 | 334 |
715 | QSize hint = box->sizeHint(); | - |
716 | QSize minS = box->minimumSize(); | - |
717 | rData[box->row].sizeHint = qMax(hint.height(), rData.at(box->row).sizeHint); | - |
718 | rData[box->row].minimumSize = qMax(minS.height(), rData.at(box->row).minimumSize); | - |
719 | } executed: } Execution Count:699 | 699 |
720 | } | - |
721 | | - |
722 | | - |
723 | | - |
724 | | - |
725 | | - |
726 | | - |
727 | void QGridLayoutPrivate::setupHfwLayoutData() | - |
728 | { | - |
729 | QVector<QLayoutStruct> &rData = *hfwData; | - |
730 | for (int i = 0; i < rr; i++) { evaluated: i < rr yes Evaluation Count:1583 | yes Evaluation Count:298 |
| 298-1583 |
731 | rData[i] = rowData.at(i); | - |
732 | rData[i].minimumSize = rData[i].sizeHint = rMinHeights.at(i); | - |
733 | } executed: } Execution Count:1583 | 1583 |
734 | | - |
735 | for (int pass = 0; pass < 2; ++pass) { evaluated: pass < 2 yes Evaluation Count:596 | yes Evaluation Count:298 |
| 298-596 |
736 | for (int i = 0; i < things.size(); ++i) { evaluated: i < things.size() yes Evaluation Count:2370 | yes Evaluation Count:596 |
| 596-2370 |
737 | QGridBox *box = things.at(i); | - |
738 | int r1 = box->row; | - |
739 | int c1 = box->col; | - |
740 | int r2 = box->toRow(rr); | - |
741 | int c2 = box->toCol(cc); | - |
742 | int w = colData.at(c2).pos + colData.at(c2).size - colData.at(c1).pos; | - |
743 | | - |
744 | if (r1 == r2) { evaluated: r1 == r2 yes Evaluation Count:2066 | yes Evaluation Count:304 |
| 304-2066 |
745 | if (pass == 0) evaluated: pass == 0 yes Evaluation Count:1033 | yes Evaluation Count:1033 |
| 1033 |
746 | addHfwData(box, w); executed: addHfwData(box, w); Execution Count:1033 | 1033 |
747 | } else { executed: } Execution Count:2066 | 2066 |
748 | if (pass == 0) { evaluated: pass == 0 yes Evaluation Count:152 | yes Evaluation Count:152 |
| 152 |
749 | initEmptyMultiBox(rData, r1, r2); | - |
750 | } else { executed: } Execution Count:152 | 152 |
751 | QSize hint = box->sizeHint(); | - |
752 | QSize min = box->minimumSize(); | - |
753 | if (box->hasHeightForWidth()) { partially evaluated: box->hasHeightForWidth() no Evaluation Count:0 | yes Evaluation Count:152 |
| 0-152 |
754 | int hfwh = box->heightForWidth(w); | - |
755 | if (hfwh > hint.height()) never evaluated: hfwh > hint.height() | 0 |
756 | hint.setHeight(hfwh); never executed: hint.setHeight(hfwh); | 0 |
757 | if (hfwh > min.height()) never evaluated: hfwh > min.height() | 0 |
758 | min.setHeight(hfwh); never executed: min.setHeight(hfwh); | 0 |
759 | } | 0 |
760 | distributeMultiBox(rData, r1, r2, min.height(), hint.height(), | - |
761 | rStretch, box->vStretch()); | - |
762 | } executed: } Execution Count:152 | 152 |
763 | } | - |
764 | } | - |
765 | } executed: } Execution Count:596 | 596 |
766 | for (int i = 0; i < rr; i++) evaluated: i < rr yes Evaluation Count:1583 | yes Evaluation Count:298 |
| 298-1583 |
767 | rData[i].expansive = rData.at(i).expansive || rData.at(i).stretch > 0; executed: rData[i].expansive = rData.at(i).expansive || rData.at(i).stretch > 0; Execution Count:1583 evaluated: rData.at(i).expansive yes Evaluation Count:161 | yes Evaluation Count:1422 |
partially evaluated: rData.at(i).stretch > 0 no Evaluation Count:0 | yes Evaluation Count:1422 |
| 0-1583 |
768 | } executed: } Execution Count:298 | 298 |
769 | | - |
770 | void QGridLayoutPrivate::distribute(QRect r, int hSpacing, int vSpacing) | - |
771 | { | - |
772 | QGridLayout * const q = q_func(); | - |
773 | bool visualHReversed = hReversed; | - |
774 | QWidget *parent = q->parentWidget(); | - |
775 | if (parent && parent->isRightToLeft()) partially evaluated: parent yes Evaluation Count:1209 | no Evaluation Count:0 |
evaluated: parent->isRightToLeft() yes Evaluation Count:30 | yes Evaluation Count:1179 |
| 0-1209 |
776 | visualHReversed = !visualHReversed; executed: visualHReversed = !visualHReversed; Execution Count:30 | 30 |
777 | | - |
778 | setupLayoutData(hSpacing, vSpacing); | - |
779 | | - |
780 | int left, top, right, bottom; | - |
781 | effectiveMargins(&left, &top, &right, &bottom); | - |
782 | r.adjust(+left, +top, -right, -bottom); | - |
783 | | - |
784 | qGeomCalc(colData, 0, cc, r.x(), r.width()); | - |
785 | QVector<QLayoutStruct> *rDataPtr; | - |
786 | if (has_hfw) { evaluated: has_hfw yes Evaluation Count:169 | yes Evaluation Count:1040 |
| 169-1040 |
787 | recalcHFW(r.width()); | - |
788 | qGeomCalc(*hfwData, 0, rr, r.y(), r.height()); | - |
789 | rDataPtr = hfwData; | - |
790 | } else { executed: } Execution Count:169 | 169 |
791 | qGeomCalc(rowData, 0, rr, r.y(), r.height()); | - |
792 | rDataPtr = &rowData; | - |
793 | } executed: } Execution Count:1040 | 1040 |
794 | QVector<QLayoutStruct> &rData = *rDataPtr; | - |
795 | int i; | - |
796 | | - |
797 | bool reverse = ((r.bottom() > rect.bottom()) || (r.bottom() == rect.bottom() evaluated: (r.bottom() > rect.bottom()) yes Evaluation Count:1144 | yes Evaluation Count:65 |
evaluated: r.bottom() == rect.bottom() yes Evaluation Count:2 | yes Evaluation Count:63 |
| 2-1144 |
798 | && ((r.right() > rect.right()) != visualHReversed))); evaluated: ((r.right() > rect.right()) != visualHReversed) yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
799 | int n = things.size(); | - |
800 | for (i = 0; i < n; ++i) { evaluated: i < n yes Evaluation Count:4378 | yes Evaluation Count:1209 |
| 1209-4378 |
801 | QGridBox *box = things.at(reverse ? n-i-1 : i); | - |
802 | int r2 = box->toRow(rr); | - |
803 | int c2 = box->toCol(cc); | - |
804 | | - |
805 | int x = colData.at(box->col).pos; | - |
806 | int y = rData.at(box->row).pos; | - |
807 | int x2p = colData.at(c2).pos + colData.at(c2).size; | - |
808 | int y2p = rData.at(r2).pos + rData.at(r2).size; | - |
809 | int w = x2p - x; | - |
810 | int h = y2p - y; | - |
811 | | - |
812 | if (visualHReversed) evaluated: visualHReversed yes Evaluation Count:84 | yes Evaluation Count:4294 |
| 84-4294 |
813 | x = r.left() + r.right() - x - w + 1; executed: x = r.left() + r.right() - x - w + 1; Execution Count:84 | 84 |
814 | if (vReversed) partially evaluated: vReversed no Evaluation Count:0 | yes Evaluation Count:4378 |
| 0-4378 |
815 | y = r.top() + r.bottom() - y - h + 1; never executed: y = r.top() + r.bottom() - y - h + 1; | 0 |
816 | | - |
817 | box->setGeometry(QRect(x, y, w, h)); | - |
818 | } executed: } Execution Count:4378 | 4378 |
819 | } executed: } Execution Count:1209 | 1209 |
820 | | - |
821 | QRect QGridLayoutPrivate::cellRect(int row, int col) const | - |
822 | { | - |
823 | if (row < 0 || row >= rr || col < 0 || col >= cc) never evaluated: row >= rr never evaluated: col >= cc | 0 |
824 | return QRect(); never executed: return QRect(); | 0 |
825 | | - |
826 | const QVector<QLayoutStruct> *rDataPtr; | - |
827 | if (has_hfw && hfwData) | 0 |
828 | rDataPtr = hfwData; never executed: rDataPtr = hfwData; | 0 |
829 | else | - |
830 | rDataPtr = &rowData; never executed: rDataPtr = &rowData; | 0 |
831 | return QRect(colData.at(col).pos, rDataPtr->at(row).pos, | 0 |
832 | colData.at(col).size, rDataPtr->at(row).size); never executed: return QRect(colData.at(col).pos, rDataPtr->at(row).pos, colData.at(col).size, rDataPtr->at(row).size); | 0 |
833 | } | - |
834 | QGridLayout::QGridLayout(QWidget *parent) | - |
835 | : QLayout(*new QGridLayoutPrivate, 0, parent) | - |
836 | { | - |
837 | QGridLayoutPrivate * const d = d_func(); | - |
838 | d->expand(1, 1); | - |
839 | } executed: } Execution Count:311 | 311 |
840 | QGridLayout::QGridLayout() | - |
841 | : QLayout(*new QGridLayoutPrivate, 0, 0) | - |
842 | { | - |
843 | QGridLayoutPrivate * const d = d_func(); | - |
844 | d->expand(1, 1); | - |
845 | } executed: } Execution Count:93 | 93 |
846 | void QGridLayout::setDefaultPositioning(int n, Qt::Orientation orient) | - |
847 | { | - |
848 | QGridLayoutPrivate * const d = d_func(); | - |
849 | if (orient == Qt::Horizontal) { never evaluated: orient == Qt::Horizontal | 0 |
850 | d->expand(1, n); | - |
851 | d->addVertical = false; | - |
852 | } else { | 0 |
853 | d->expand(n,1); | - |
854 | d->addVertical = true; | - |
855 | } | 0 |
856 | } | - |
857 | QGridLayout::~QGridLayout() | - |
858 | { | - |
859 | QGridLayoutPrivate * const d = d_func(); | - |
860 | d->deleteAll(); | - |
861 | } executed: } Execution Count:404 | 404 |
862 | void QGridLayout::setHorizontalSpacing(int spacing) | - |
863 | { | - |
864 | QGridLayoutPrivate * const d = d_func(); | - |
865 | d->horizontalSpacing = spacing; | - |
866 | invalidate(); | - |
867 | } executed: } Execution Count:15 | 15 |
868 | | - |
869 | int QGridLayout::horizontalSpacing() const | - |
870 | { | - |
871 | const QGridLayoutPrivate * const d = d_func(); | - |
872 | if (d->horizontalSpacing >= 0) { evaluated: d->horizontalSpacing >= 0 yes Evaluation Count:3119 | yes Evaluation Count:3137 |
| 3119-3137 |
873 | return d->horizontalSpacing; executed: return d->horizontalSpacing; Execution Count:3119 | 3119 |
874 | } else { | - |
875 | return qSmartSpacing(this, QStyle::PM_LayoutHorizontalSpacing); executed: return qSmartSpacing(this, QStyle::PM_LayoutHorizontalSpacing); Execution Count:3137 | 3137 |
876 | } | - |
877 | } | - |
878 | void QGridLayout::setVerticalSpacing(int spacing) | - |
879 | { | - |
880 | QGridLayoutPrivate * const d = d_func(); | - |
881 | d->verticalSpacing = spacing; | - |
882 | invalidate(); | - |
883 | } executed: } Execution Count:15 | 15 |
884 | | - |
885 | int QGridLayout::verticalSpacing() const | - |
886 | { | - |
887 | const QGridLayoutPrivate * const d = d_func(); | - |
888 | if (d->verticalSpacing >= 0) { evaluated: d->verticalSpacing >= 0 yes Evaluation Count:3118 | yes Evaluation Count:3138 |
| 3118-3138 |
889 | return d->verticalSpacing; executed: return d->verticalSpacing; Execution Count:3118 | 3118 |
890 | } else { | - |
891 | return qSmartSpacing(this, QStyle::PM_LayoutVerticalSpacing); executed: return qSmartSpacing(this, QStyle::PM_LayoutVerticalSpacing); Execution Count:3138 | 3138 |
892 | } | - |
893 | } | - |
894 | | - |
895 | | - |
896 | | - |
897 | | - |
898 | | - |
899 | | - |
900 | | - |
901 | void QGridLayout::setSpacing(int spacing) | - |
902 | { | - |
903 | QGridLayoutPrivate * const d = d_func(); | - |
904 | d->horizontalSpacing = d->verticalSpacing = spacing; | - |
905 | invalidate(); | - |
906 | } executed: } Execution Count:121 | 121 |
907 | | - |
908 | | - |
909 | | - |
910 | | - |
911 | | - |
912 | | - |
913 | | - |
914 | int QGridLayout::spacing() const | - |
915 | { | - |
916 | int hSpacing = horizontalSpacing(); | - |
917 | if (hSpacing == verticalSpacing()) { evaluated: hSpacing == verticalSpacing() yes Evaluation Count:323 | yes Evaluation Count:3 |
| 3-323 |
918 | return hSpacing; executed: return hSpacing; Execution Count:323 | 323 |
919 | } else { | - |
920 | return -1; executed: return -1; Execution Count:3 | 3 |
921 | } | - |
922 | } | - |
923 | | - |
924 | | - |
925 | | - |
926 | | - |
927 | int QGridLayout::rowCount() const | - |
928 | { | - |
929 | const QGridLayoutPrivate * const d = d_func(); | - |
930 | return d->numRows(); executed: return d->numRows(); Execution Count:94 | 94 |
931 | } | - |
932 | | - |
933 | | - |
934 | | - |
935 | | - |
936 | int QGridLayout::columnCount() const | - |
937 | { | - |
938 | const QGridLayoutPrivate * const d = d_func(); | - |
939 | return d->numCols(); executed: return d->numCols(); Execution Count:94 | 94 |
940 | } | - |
941 | | - |
942 | | - |
943 | | - |
944 | | - |
945 | QSize QGridLayout::sizeHint() const | - |
946 | { | - |
947 | const QGridLayoutPrivate * const d = d_func(); | - |
948 | QSize result(d->sizeHint(horizontalSpacing(), verticalSpacing())); | - |
949 | int left, top, right, bottom; | - |
950 | d->effectiveMargins(&left, &top, &right, &bottom); | - |
951 | result += QSize(left + right, top + bottom); | - |
952 | return result; executed: return result; Execution Count:1048 | 1048 |
953 | } | - |
954 | | - |
955 | | - |
956 | | - |
957 | | - |
958 | QSize QGridLayout::minimumSize() const | - |
959 | { | - |
960 | const QGridLayoutPrivate * const d = d_func(); | - |
961 | QSize result(d->minimumSize(horizontalSpacing(), verticalSpacing())); | - |
962 | int left, top, right, bottom; | - |
963 | d->effectiveMargins(&left, &top, &right, &bottom); | - |
964 | result += QSize(left + right, top + bottom); | - |
965 | return result; executed: return result; Execution Count:1008 | 1008 |
966 | } | - |
967 | | - |
968 | | - |
969 | | - |
970 | | - |
971 | QSize QGridLayout::maximumSize() const | - |
972 | { | - |
973 | const QGridLayoutPrivate * const d = d_func(); | - |
974 | | - |
975 | QSize s = d->maximumSize(horizontalSpacing(), verticalSpacing()); | - |
976 | int left, top, right, bottom; | - |
977 | d->effectiveMargins(&left, &top, &right, &bottom); | - |
978 | s += QSize(left + right, top + bottom); | - |
979 | s = s.boundedTo(QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX)); | - |
980 | if (alignment() & Qt::AlignHorizontal_Mask) partially evaluated: alignment() & Qt::AlignHorizontal_Mask no Evaluation Count:0 | yes Evaluation Count:499 |
| 0-499 |
981 | s.setWidth(QLAYOUTSIZE_MAX); never executed: s.setWidth(QLAYOUTSIZE_MAX); | 0 |
982 | if (alignment() & Qt::AlignVertical_Mask) partially evaluated: alignment() & Qt::AlignVertical_Mask no Evaluation Count:0 | yes Evaluation Count:499 |
| 0-499 |
983 | s.setHeight(QLAYOUTSIZE_MAX); never executed: s.setHeight(QLAYOUTSIZE_MAX); | 0 |
984 | return s; executed: return s; Execution Count:499 | 499 |
985 | } | - |
986 | | - |
987 | | - |
988 | | - |
989 | | - |
990 | bool QGridLayout::hasHeightForWidth() const | - |
991 | { | - |
992 | return ((QGridLayout*)this)->d_func()->hasHeightForWidth(horizontalSpacing(), verticalSpacing()); executed: return ((QGridLayout*)this)->d_func()->hasHeightForWidth(horizontalSpacing(), verticalSpacing()); Execution Count:1660 | 1660 |
993 | } | - |
994 | | - |
995 | | - |
996 | | - |
997 | | - |
998 | int QGridLayout::heightForWidth(int w) const | - |
999 | { | - |
1000 | const QGridLayoutPrivate * const d = d_func(); | - |
1001 | QGridLayoutPrivate *dat = const_cast<QGridLayoutPrivate *>(d); | - |
1002 | return dat->heightForWidth(w, horizontalSpacing(), verticalSpacing()); executed: return dat->heightForWidth(w, horizontalSpacing(), verticalSpacing()); Execution Count:226 | 226 |
1003 | } | - |
1004 | | - |
1005 | | - |
1006 | | - |
1007 | | - |
1008 | int QGridLayout::minimumHeightForWidth(int w) const | - |
1009 | { | - |
1010 | const QGridLayoutPrivate * const d = d_func(); | - |
1011 | QGridLayoutPrivate *dat = const_cast<QGridLayoutPrivate *>(d); | - |
1012 | return dat->minimumHeightForWidth(w, horizontalSpacing(), verticalSpacing()); executed: return dat->minimumHeightForWidth(w, horizontalSpacing(), verticalSpacing()); Execution Count:9 | 9 |
1013 | } | - |
1014 | | - |
1015 | | - |
1016 | | - |
1017 | | - |
1018 | int QGridLayout::count() const | - |
1019 | { | - |
1020 | const QGridLayoutPrivate * const d = d_func(); | - |
1021 | return d->count(); executed: return d->count(); Execution Count:231 | 231 |
1022 | } | - |
1023 | | - |
1024 | | - |
1025 | | - |
1026 | | - |
1027 | | - |
1028 | QLayoutItem *QGridLayout::itemAt(int index) const | - |
1029 | { | - |
1030 | const QGridLayoutPrivate * const d = d_func(); | - |
1031 | return d->itemAt(index); executed: return d->itemAt(index); Execution Count:8734 | 8734 |
1032 | } | - |
1033 | QLayoutItem *QGridLayout::itemAtPosition(int row, int column) const | - |
1034 | { | - |
1035 | const QGridLayoutPrivate * const d = d_func(); | - |
1036 | int n = d->things.count(); | - |
1037 | for (int i = 0; i < n; ++i) { evaluated: i < n yes Evaluation Count:67 | yes Evaluation Count:11 |
| 11-67 |
1038 | QGridBox *box = d->things.at(i); | - |
1039 | if (row >= box->row && row <= box->toRow(d->rr) evaluated: row >= box->row yes Evaluation Count:61 | yes Evaluation Count:6 |
evaluated: row <= box->toRow(d->rr) yes Evaluation Count:25 | yes Evaluation Count:36 |
| 6-61 |
1040 | && column >= box->col && column <= box->toCol(d->cc)) { evaluated: column >= box->col yes Evaluation Count:21 | yes Evaluation Count:4 |
evaluated: column <= box->toCol(d->cc) yes Evaluation Count:9 | yes Evaluation Count:12 |
| 4-21 |
1041 | return box->item(); executed: return box->item(); Execution Count:9 | 9 |
1042 | } | - |
1043 | } executed: } Execution Count:58 | 58 |
1044 | return 0; executed: return 0; Execution Count:11 | 11 |
1045 | } | - |
1046 | | - |
1047 | | - |
1048 | | - |
1049 | | - |
1050 | QLayoutItem *QGridLayout::takeAt(int index) | - |
1051 | { | - |
1052 | QGridLayoutPrivate * const d = d_func(); | - |
1053 | return d->takeAt(index); executed: return d->takeAt(index); Execution Count:264 | 264 |
1054 | } | - |
1055 | void QGridLayout::getItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan) const | - |
1056 | { | - |
1057 | const QGridLayoutPrivate * const d = d_func(); | - |
1058 | d->getItemPosition(index, row, column, rowSpan, columnSpan); | - |
1059 | } executed: } Execution Count:4 | 4 |
1060 | | - |
1061 | | - |
1062 | | - |
1063 | | - |
1064 | | - |
1065 | void QGridLayout::setGeometry(const QRect &rect) | - |
1066 | { | - |
1067 | QGridLayoutPrivate * const d = d_func(); | - |
1068 | if (d->isDirty() || rect != geometry()) { evaluated: d->isDirty() yes Evaluation Count:810 | yes Evaluation Count:601 |
evaluated: rect != geometry() yes Evaluation Count:399 | yes Evaluation Count:202 |
| 202-810 |
1069 | QRect cr = alignment() ? alignmentRect(rect) : rect; partially evaluated: alignment() no Evaluation Count:0 | yes Evaluation Count:1209 |
| 0-1209 |
1070 | d->distribute(cr, horizontalSpacing(), verticalSpacing()); | - |
1071 | QLayout::setGeometry(rect); | - |
1072 | } executed: } Execution Count:1209 | 1209 |
1073 | } executed: } Execution Count:1411 | 1411 |
1074 | QRect QGridLayout::cellRect(int row, int column) const | - |
1075 | { | - |
1076 | const QGridLayoutPrivate * const d = d_func(); | - |
1077 | return d->cellRect(row, column); never executed: return d->cellRect(row, column); | 0 |
1078 | } | - |
1079 | | - |
1080 | | - |
1081 | | - |
1082 | | - |
1083 | void QGridLayout::addItem(QLayoutItem *item) | - |
1084 | { | - |
1085 | QGridLayoutPrivate * const d = d_func(); | - |
1086 | int r, c; | - |
1087 | d->getNextPos(r, c); | - |
1088 | addItem(item, r, c); | - |
1089 | } executed: } Execution Count:1 | 1 |
1090 | void QGridLayout::addItem(QLayoutItem *item, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment) | - |
1091 | { | - |
1092 | QGridLayoutPrivate * const d = d_func(); | - |
1093 | QGridBox *b = new QGridBox(item); | - |
1094 | b->setAlignment(alignment); | - |
1095 | d->add(b, row, (rowSpan < 0) ? -1 : row + rowSpan - 1, column, (columnSpan < 0) ? -1 : column + columnSpan - 1); | - |
1096 | invalidate(); | - |
1097 | } executed: } Execution Count:492 | 492 |
1098 | | - |
1099 | | - |
1100 | | - |
1101 | | - |
1102 | | - |
1103 | static bool checkWidget(QLayout *l, QWidget *w) | - |
1104 | { | - |
1105 | if (!w) { partially evaluated: !w no Evaluation Count:0 | yes Evaluation Count:2134 |
| 0-2134 |
1106 | QMessageLogger("kernel/qgridlayout.cpp", 1427, __PRETTY_FUNCTION__).warning("QLayout: Cannot add null widget to %s/%s", l->metaObject()->className(), | - |
1107 | l->objectName().toLocal8Bit().data()); | - |
1108 | return false; never executed: return false; | 0 |
1109 | } | - |
1110 | return true; executed: return true; Execution Count:2134 | 2134 |
1111 | } | - |
1112 | void QGridLayout::addWidget(QWidget *widget, int row, int column, Qt::Alignment alignment) | - |
1113 | { | - |
1114 | if (!checkWidget(this, widget)) partially evaluated: !checkWidget(this, widget) no Evaluation Count:0 | yes Evaluation Count:452 |
| 0-452 |
1115 | return; | 0 |
1116 | if (row < 0 || column < 0) { partially evaluated: row < 0 no Evaluation Count:0 | yes Evaluation Count:452 |
partially evaluated: column < 0 no Evaluation Count:0 | yes Evaluation Count:452 |
| 0-452 |
1117 | QMessageLogger("kernel/qgridlayout.cpp", 1447, __PRETTY_FUNCTION__).warning("QGridLayout: Cannot add %s/%s to %s/%s at row %d column %d", | - |
1118 | widget->metaObject()->className(), widget->objectName().toLocal8Bit().data(), | - |
1119 | metaObject()->className(), objectName().toLocal8Bit().data(), row, column); | - |
1120 | return; | 0 |
1121 | } | - |
1122 | addChildWidget(widget); | - |
1123 | QWidgetItem *b = QLayoutPrivate::createWidgetItem(this, widget); | - |
1124 | addItem(b, row, column, 1, 1, alignment); | - |
1125 | } executed: } Execution Count:452 | 452 |
1126 | void QGridLayout::addWidget(QWidget *widget, int fromRow, int fromColumn, | - |
1127 | int rowSpan, int columnSpan, Qt::Alignment alignment) | - |
1128 | { | - |
1129 | QGridLayoutPrivate * const d = d_func(); | - |
1130 | if (!checkWidget(this, widget)) partially evaluated: !checkWidget(this, widget) no Evaluation Count:0 | yes Evaluation Count:1682 |
| 0-1682 |
1131 | return; | 0 |
1132 | int toRow = (rowSpan < 0) ? -1 : fromRow + rowSpan - 1; evaluated: (rowSpan < 0) yes Evaluation Count:3 | yes Evaluation Count:1679 |
| 3-1679 |
1133 | int toColumn = (columnSpan < 0) ? -1 : fromColumn + columnSpan - 1; partially evaluated: (columnSpan < 0) no Evaluation Count:0 | yes Evaluation Count:1682 |
| 0-1682 |
1134 | addChildWidget(widget); | - |
1135 | QGridBox *b = new QGridBox(this, widget); | - |
1136 | b->setAlignment(alignment); | - |
1137 | d->add(b, fromRow, toRow, fromColumn, toColumn); | - |
1138 | invalidate(); | - |
1139 | } executed: } Execution Count:1682 | 1682 |
1140 | void QGridLayout::addLayout(QLayout *layout, int row, int column, Qt::Alignment alignment) | - |
1141 | { | - |
1142 | QGridLayoutPrivate * const d = d_func(); | - |
1143 | addChildLayout(layout); | - |
1144 | QGridBox *b = new QGridBox(layout); | - |
1145 | b->setAlignment(alignment); | - |
1146 | d->add(b, row, column); | - |
1147 | } executed: } Execution Count:1 | 1 |
1148 | void QGridLayout::addLayout(QLayout *layout, int row, int column, | - |
1149 | int rowSpan, int columnSpan, Qt::Alignment alignment) | - |
1150 | { | - |
1151 | QGridLayoutPrivate * const d = d_func(); | - |
1152 | addChildLayout(layout); | - |
1153 | QGridBox *b = new QGridBox(layout); | - |
1154 | b->setAlignment(alignment); | - |
1155 | d->add(b, row, (rowSpan < 0) ? -1 : row + rowSpan - 1, column, (columnSpan < 0) ? -1 : column + columnSpan - 1); | - |
1156 | } executed: } Execution Count:285 | 285 |
1157 | void QGridLayout::setRowStretch(int row, int stretch) | - |
1158 | { | - |
1159 | QGridLayoutPrivate * const d = d_func(); | - |
1160 | d->setRowStretch(row, stretch); | - |
1161 | invalidate(); | - |
1162 | } executed: } Execution Count:23 | 23 |
1163 | | - |
1164 | | - |
1165 | | - |
1166 | | - |
1167 | | - |
1168 | | - |
1169 | int QGridLayout::rowStretch(int row) const | - |
1170 | { | - |
1171 | const QGridLayoutPrivate * const d = d_func(); | - |
1172 | return d->rowStretch(row); never executed: return d->rowStretch(row); | 0 |
1173 | } | - |
1174 | | - |
1175 | | - |
1176 | | - |
1177 | | - |
1178 | | - |
1179 | | - |
1180 | int QGridLayout::columnStretch(int column) const | - |
1181 | { | - |
1182 | const QGridLayoutPrivate * const d = d_func(); | - |
1183 | return d->colStretch(column); never executed: return d->colStretch(column); | 0 |
1184 | } | - |
1185 | void QGridLayout::setColumnStretch(int column, int stretch) | - |
1186 | { | - |
1187 | QGridLayoutPrivate * const d = d_func(); | - |
1188 | d->setColStretch(column, stretch); | - |
1189 | invalidate(); | - |
1190 | } executed: } Execution Count:34 | 34 |
1191 | void QGridLayout::setRowMinimumHeight(int row, int minSize) | - |
1192 | { | - |
1193 | QGridLayoutPrivate * const d = d_func(); | - |
1194 | d->setRowMinimumHeight(row, minSize); | - |
1195 | invalidate(); | - |
1196 | } executed: } Execution Count:388 | 388 |
1197 | | - |
1198 | | - |
1199 | | - |
1200 | | - |
1201 | | - |
1202 | | - |
1203 | int QGridLayout::rowMinimumHeight(int row) const | - |
1204 | { | - |
1205 | const QGridLayoutPrivate * const d = d_func(); | - |
1206 | return d->rowSpacing(row); never executed: return d->rowSpacing(row); | 0 |
1207 | } | - |
1208 | | - |
1209 | | - |
1210 | | - |
1211 | | - |
1212 | | - |
1213 | | - |
1214 | void QGridLayout::setColumnMinimumWidth(int column, int minSize) | - |
1215 | { | - |
1216 | QGridLayoutPrivate * const d = d_func(); | - |
1217 | d->setColumnMinimumWidth(column, minSize); | - |
1218 | invalidate(); | - |
1219 | } executed: } Execution Count:291 | 291 |
1220 | | - |
1221 | | - |
1222 | | - |
1223 | | - |
1224 | | - |
1225 | | - |
1226 | int QGridLayout::columnMinimumWidth(int column) const | - |
1227 | { | - |
1228 | const QGridLayoutPrivate * const d = d_func(); | - |
1229 | return d->colSpacing(column); executed: return d->colSpacing(column); Execution Count:1 | 1 |
1230 | } | - |
1231 | | - |
1232 | | - |
1233 | | - |
1234 | | - |
1235 | Qt::Orientations QGridLayout::expandingDirections() const | - |
1236 | { | - |
1237 | const QGridLayoutPrivate * const d = d_func(); | - |
1238 | return d->expandingDirections(horizontalSpacing(), verticalSpacing()); executed: return d->expandingDirections(horizontalSpacing(), verticalSpacing()); Execution Count:267 | 267 |
1239 | } | - |
1240 | | - |
1241 | | - |
1242 | | - |
1243 | | - |
1244 | void QGridLayout::setOriginCorner(Qt::Corner corner) | - |
1245 | { | - |
1246 | QGridLayoutPrivate * const d = d_func(); | - |
1247 | d->setReversed(corner == Qt::BottomLeftCorner || corner == Qt::BottomRightCorner, | - |
1248 | corner == Qt::TopRightCorner || corner == Qt::BottomRightCorner); | - |
1249 | } | 0 |
1250 | | - |
1251 | | - |
1252 | | - |
1253 | | - |
1254 | | - |
1255 | Qt::Corner QGridLayout::originCorner() const | - |
1256 | { | - |
1257 | const QGridLayoutPrivate * const d = d_func(); | - |
1258 | if (d->horReversed()) { never evaluated: d->horReversed() | 0 |
1259 | return d->verReversed() ? Qt::BottomRightCorner : Qt::TopRightCorner; never executed: return d->verReversed() ? Qt::BottomRightCorner : Qt::TopRightCorner; | 0 |
1260 | } else { | - |
1261 | return d->verReversed() ? Qt::BottomLeftCorner : Qt::TopLeftCorner; never executed: return d->verReversed() ? Qt::BottomLeftCorner : Qt::TopLeftCorner; | 0 |
1262 | } | - |
1263 | } | - |
1264 | | - |
1265 | | - |
1266 | | - |
1267 | | - |
1268 | void QGridLayout::invalidate() | - |
1269 | { | - |
1270 | QGridLayoutPrivate * const d = d_func(); | - |
1271 | d->setDirty(); | - |
1272 | QLayout::invalidate(); | - |
1273 | } executed: } Execution Count:20877 | 20877 |
1274 | | - |
1275 | | - |
1276 | | - |
| | |