Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 2.1 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | #include "qglobal.h" | - |
43 | | - |
44 | #ifndef QT_NO_GRAPHICSVIEW | - |
45 | | - |
46 | #include <math.h> | - |
47 | | - |
48 | #include "qgraphicslayoutitem.h" | - |
49 | #include "qgridlayoutengine_p.h" | - |
50 | #include "qstyleoption.h" | - |
51 | #include "qvarlengtharray.h" | - |
52 | | - |
53 | #include <QtDebug> | - |
54 | #include <QtCore/qmath.h> | - |
55 | | - |
56 | QT_BEGIN_NAMESPACE | - |
57 | | - |
58 | template <typename T> | - |
59 | static void insertOrRemoveItems(QVector<T> &items, int index, int delta) | - |
60 | { | - |
61 | int count = items.count(); executed (the execution status of this line is deduced): int count = items.count(); | - |
62 | if (index < count) { evaluated: index < count yes Evaluation Count:160 | yes Evaluation Count:5800 |
| 160-5800 |
63 | if (delta > 0) { evaluated: delta > 0 yes Evaluation Count:2 | yes Evaluation Count:158 |
| 2-158 |
64 | items.insert(index, delta, T()); executed (the execution status of this line is deduced): items.insert(index, delta, T()); | - |
65 | } else if (delta < 0) { executed: } Execution Count:2 partially evaluated: delta < 0 yes Evaluation Count:158 | no Evaluation Count:0 |
| 0-158 |
66 | items.remove(index, qMin(-delta, count - index)); executed (the execution status of this line is deduced): items.remove(index, qMin(-delta, count - index)); | - |
67 | } executed: } Execution Count:158 | 158 |
68 | } | - |
69 | } executed: } Execution Count:5960 | 5960 |
70 | | - |
71 | static qreal growthFactorBelowPreferredSize(qreal desired, qreal sumAvailable, qreal sumDesired) | - |
72 | { | - |
73 | Q_ASSERT(sumDesired != 0.0); executed (the execution status of this line is deduced): qt_noop(); | - |
74 | return desired * qPow(sumAvailable / sumDesired, desired / sumDesired); executed: return desired * qPow(sumAvailable / sumDesired, desired / sumDesired); Execution Count:115 | 115 |
75 | } | - |
76 | | - |
77 | static qreal fixedDescent(qreal descent, qreal ascent, qreal targetSize) | - |
78 | { | - |
79 | if (descent < 0.0) partially evaluated: descent < 0.0 yes Evaluation Count:562 | no Evaluation Count:0 |
| 0-562 |
80 | return -1.0; executed: return -1.0; Execution Count:562 | 562 |
81 | | - |
82 | Q_ASSERT(descent >= 0.0); never executed (the execution status of this line is deduced): qt_noop(); | - |
83 | Q_ASSERT(ascent >= 0.0); never executed (the execution status of this line is deduced): qt_noop(); | - |
84 | Q_ASSERT(targetSize >= ascent + descent); never executed (the execution status of this line is deduced): qt_noop(); | - |
85 | | - |
86 | qreal extra = targetSize - (ascent + descent); never executed (the execution status of this line is deduced): qreal extra = targetSize - (ascent + descent); | - |
87 | return descent + (extra / 2.0); never executed: return descent + (extra / 2.0); | 0 |
88 | } | - |
89 | | - |
90 | static qreal compare(const QGridLayoutBox &box1, const QGridLayoutBox &box2, int which) | - |
91 | { | - |
92 | qreal size1 = box1.q_sizes(which); executed (the execution status of this line is deduced): qreal size1 = box1.q_sizes(which); | - |
93 | qreal size2 = box2.q_sizes(which); executed (the execution status of this line is deduced): qreal size2 = box2.q_sizes(which); | - |
94 | | - |
95 | if (which == MaximumSize) { evaluated: which == MaximumSize yes Evaluation Count:157 | yes Evaluation Count:314 |
| 157-314 |
96 | return size2 - size1; executed: return size2 - size1; Execution Count:157 | 157 |
97 | } else { | - |
98 | return size1 - size2; executed: return size1 - size2; Execution Count:314 | 314 |
99 | } | - |
100 | } | - |
101 | | - |
102 | void QGridLayoutBox::add(const QGridLayoutBox &other, int stretch, qreal spacing) | - |
103 | { | - |
104 | Q_ASSERT(q_minimumDescent < 0.0); executed (the execution status of this line is deduced): qt_noop(); | - |
105 | | - |
106 | q_minimumSize += other.q_minimumSize + spacing; executed (the execution status of this line is deduced): q_minimumSize += other.q_minimumSize + spacing; | - |
107 | q_preferredSize += other.q_preferredSize + spacing; executed (the execution status of this line is deduced): q_preferredSize += other.q_preferredSize + spacing; | - |
108 | q_maximumSize += ((stretch == 0) ? other.q_preferredSize : other.q_maximumSize) + spacing; evaluated: (stretch == 0) yes Evaluation Count:82 | yes Evaluation Count:6213 |
| 82-6213 |
109 | } executed: } Execution Count:6295 | 6295 |
110 | | - |
111 | void QGridLayoutBox::combine(const QGridLayoutBox &other) | - |
112 | { | - |
113 | q_minimumDescent = qMax(q_minimumDescent, other.q_minimumDescent); executed (the execution status of this line is deduced): q_minimumDescent = qMax(q_minimumDescent, other.q_minimumDescent); | - |
114 | q_minimumAscent = qMax(q_minimumAscent, other.q_minimumAscent); executed (the execution status of this line is deduced): q_minimumAscent = qMax(q_minimumAscent, other.q_minimumAscent); | - |
115 | | - |
116 | q_minimumSize = qMax(q_minimumAscent + q_minimumDescent, executed (the execution status of this line is deduced): q_minimumSize = qMax(q_minimumAscent + q_minimumDescent, | - |
117 | qMax(q_minimumSize, other.q_minimumSize)); executed (the execution status of this line is deduced): qMax(q_minimumSize, other.q_minimumSize)); | - |
118 | qreal maxMax; executed (the execution status of this line is deduced): qreal maxMax; | - |
119 | if (q_maximumSize == FLT_MAX && other.q_maximumSize != FLT_MAX) evaluated: q_maximumSize == 3.40282347e+38F yes Evaluation Count:5959 | yes Evaluation Count:4583 |
partially evaluated: other.q_maximumSize != 3.40282347e+38F yes Evaluation Count:5959 | no Evaluation Count:0 |
| 0-5959 |
120 | maxMax = other.q_maximumSize; executed: maxMax = other.q_maximumSize; Execution Count:5959 | 5959 |
121 | else if (other.q_maximumSize == FLT_MAX && q_maximumSize != FLT_MAX) evaluated: other.q_maximumSize == 3.40282347e+38F yes Evaluation Count:80 | yes Evaluation Count:4503 |
partially evaluated: q_maximumSize != 3.40282347e+38F yes Evaluation Count:80 | no Evaluation Count:0 |
| 0-4503 |
122 | maxMax = q_maximumSize; executed: maxMax = q_maximumSize; Execution Count:80 | 80 |
123 | else | - |
124 | maxMax = qMax(q_maximumSize, other.q_maximumSize); executed: maxMax = qMax(q_maximumSize, other.q_maximumSize); Execution Count:4503 | 4503 |
125 | | - |
126 | q_maximumSize = qMax(q_minimumSize, maxMax); executed (the execution status of this line is deduced): q_maximumSize = qMax(q_minimumSize, maxMax); | - |
127 | q_preferredSize = qBound(q_minimumSize, qMax(q_preferredSize, other.q_preferredSize), executed (the execution status of this line is deduced): q_preferredSize = qBound(q_minimumSize, qMax(q_preferredSize, other.q_preferredSize), | - |
128 | q_maximumSize); executed (the execution status of this line is deduced): q_maximumSize); | - |
129 | } executed: } Execution Count:10542 | 10542 |
130 | | - |
131 | void QGridLayoutBox::normalize() | - |
132 | { | - |
133 | q_maximumSize = qMax(qreal(0.0), q_maximumSize); executed (the execution status of this line is deduced): q_maximumSize = qMax(qreal(0.0), q_maximumSize); | - |
134 | q_minimumSize = qBound(qreal(0.0), q_minimumSize, q_maximumSize); executed (the execution status of this line is deduced): q_minimumSize = qBound(qreal(0.0), q_minimumSize, q_maximumSize); | - |
135 | q_preferredSize = qBound(q_minimumSize, q_preferredSize, q_maximumSize); executed (the execution status of this line is deduced): q_preferredSize = qBound(q_minimumSize, q_preferredSize, q_maximumSize); | - |
136 | q_minimumDescent = qMin(q_minimumDescent, q_minimumSize); executed (the execution status of this line is deduced): q_minimumDescent = qMin(q_minimumDescent, q_minimumSize); | - |
137 | | - |
138 | Q_ASSERT((q_minimumDescent < 0.0) == (q_minimumAscent < 0.0)); executed (the execution status of this line is deduced): qt_noop(); | - |
139 | } executed: } Execution Count:403 | 403 |
140 | | - |
141 | #ifdef QT_DEBUG | - |
142 | void QGridLayoutBox::dump(int indent) const | - |
143 | { | - |
144 | qDebug("%*sBox (%g <= %g <= %g [%g/%g])", indent, "", q_minimumSize, q_preferredSize, | - |
145 | q_maximumSize, q_minimumAscent, q_minimumDescent); | - |
146 | } | - |
147 | #endif | - |
148 | | - |
149 | bool operator==(const QGridLayoutBox &box1, const QGridLayoutBox &box2) | - |
150 | { | - |
151 | for (int i = 0; i < NSizes; ++i) { evaluated: i < NSizes yes Evaluation Count:96 | yes Evaluation Count:32 |
| 32-96 |
152 | if (box1.q_sizes(i) != box2.q_sizes(i)) partially evaluated: box1.q_sizes(i) != box2.q_sizes(i) no Evaluation Count:0 | yes Evaluation Count:96 |
| 0-96 |
153 | return false; never executed: return false; | 0 |
154 | } executed: } Execution Count:96 | 96 |
155 | return box1.q_minimumDescent == box2.q_minimumDescent executed: return box1.q_minimumDescent == box2.q_minimumDescent && box1.q_minimumAscent == box2.q_minimumAscent; Execution Count:32 | 32 |
156 | && box1.q_minimumAscent == box2.q_minimumAscent; executed: return box1.q_minimumDescent == box2.q_minimumDescent && box1.q_minimumAscent == box2.q_minimumAscent; Execution Count:32 | 32 |
157 | } | - |
158 | | - |
159 | void QGridLayoutRowData::reset(int count) | - |
160 | { | - |
161 | ignore.fill(false, count); executed (the execution status of this line is deduced): ignore.fill(false, count); | - |
162 | boxes.fill(QGridLayoutBox(), count); executed (the execution status of this line is deduced): boxes.fill(QGridLayoutBox(), count); | - |
163 | multiCellMap.clear(); executed (the execution status of this line is deduced): multiCellMap.clear(); | - |
164 | stretches.fill(0, count); executed (the execution status of this line is deduced): stretches.fill(0, count); | - |
165 | spacings.fill(0.0, count); executed (the execution status of this line is deduced): spacings.fill(0.0, count); | - |
166 | hasIgnoreFlag = false; executed (the execution status of this line is deduced): hasIgnoreFlag = false; | - |
167 | } executed: } Execution Count:3700 | 3700 |
168 | | - |
169 | void QGridLayoutRowData::distributeMultiCells(const QGridLayoutRowInfo &rowInfo) | - |
170 | { | - |
171 | MultiCellMap::const_iterator i = multiCellMap.constBegin(); executed (the execution status of this line is deduced): MultiCellMap::const_iterator i = multiCellMap.constBegin(); | - |
172 | for (; i != multiCellMap.constEnd(); ++i) { evaluated: i != multiCellMap.constEnd() yes Evaluation Count:157 | yes Evaluation Count:3700 |
| 157-3700 |
173 | int start = i.key().first; executed (the execution status of this line is deduced): int start = i.key().first; | - |
174 | int span = i.key().second; executed (the execution status of this line is deduced): int span = i.key().second; | - |
175 | int end = start + span; executed (the execution status of this line is deduced): int end = start + span; | - |
176 | const QGridLayoutBox &box = i.value().q_box; executed (the execution status of this line is deduced): const QGridLayoutBox &box = i.value().q_box; | - |
177 | int stretch = i.value().q_stretch; executed (the execution status of this line is deduced): int stretch = i.value().q_stretch; | - |
178 | | - |
179 | QGridLayoutBox totalBox = this->totalBox(start, end); executed (the execution status of this line is deduced): QGridLayoutBox totalBox = this->totalBox(start, end); | - |
180 | QVarLengthArray<QGridLayoutBox> extras(span); executed (the execution status of this line is deduced): QVarLengthArray<QGridLayoutBox> extras(span); | - |
181 | QVarLengthArray<qreal> dummy(span); executed (the execution status of this line is deduced): QVarLengthArray<qreal> dummy(span); | - |
182 | QVarLengthArray<qreal> newSizes(span); executed (the execution status of this line is deduced): QVarLengthArray<qreal> newSizes(span); | - |
183 | | - |
184 | for (int j = 0; j < NSizes; ++j) { evaluated: j < NSizes yes Evaluation Count:471 | yes Evaluation Count:157 |
| 157-471 |
185 | qreal extra = compare(box, totalBox, j); executed (the execution status of this line is deduced): qreal extra = compare(box, totalBox, j); | - |
186 | if (extra > 0.0) { evaluated: extra > 0.0 yes Evaluation Count:341 | yes Evaluation Count:130 |
| 130-341 |
187 | calculateGeometries(start, end, box.q_sizes(j), dummy.data(), newSizes.data(), executed (the execution status of this line is deduced): calculateGeometries(start, end, box.q_sizes(j), dummy.data(), newSizes.data(), | - |
188 | 0, totalBox, rowInfo); executed (the execution status of this line is deduced): 0, totalBox, rowInfo); | - |
189 | | - |
190 | for (int k = 0; k < span; ++k) evaluated: k < span yes Evaluation Count:682 | yes Evaluation Count:341 |
| 341-682 |
191 | extras[k].q_sizes(j) = newSizes[k]; executed: extras[k].q_sizes(j) = newSizes[k]; Execution Count:682 | 682 |
192 | } executed: } Execution Count:341 | 341 |
193 | } executed: } Execution Count:471 | 471 |
194 | | - |
195 | for (int k = 0; k < span; ++k) { evaluated: k < span yes Evaluation Count:314 | yes Evaluation Count:157 |
| 157-314 |
196 | boxes[start + k].combine(extras[k]); executed (the execution status of this line is deduced): boxes[start + k].combine(extras[k]); | - |
197 | if (stretch != 0) evaluated: stretch != 0 yes Evaluation Count:218 | yes Evaluation Count:96 |
| 96-218 |
198 | stretches[start + k] = qMax(stretches[start + k], stretch); executed: stretches[start + k] = qMax(stretches[start + k], stretch); Execution Count:218 | 218 |
199 | } executed: } Execution Count:314 | 314 |
200 | } executed: } Execution Count:157 | 157 |
201 | multiCellMap.clear(); executed (the execution status of this line is deduced): multiCellMap.clear(); | - |
202 | } executed: } Execution Count:3700 | 3700 |
203 | | - |
204 | void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSize, qreal *positions, | - |
205 | qreal *sizes, qreal *descents, | - |
206 | const QGridLayoutBox &totalBox, | - |
207 | const QGridLayoutRowInfo &rowInfo) | - |
208 | { | - |
209 | Q_ASSERT(end > start); executed (the execution status of this line is deduced): qt_noop(); | - |
210 | | - |
211 | targetSize = qMax(totalBox.q_minimumSize, targetSize); executed (the execution status of this line is deduced): targetSize = qMax(totalBox.q_minimumSize, targetSize); | - |
212 | | - |
213 | int n = end - start; executed (the execution status of this line is deduced): int n = end - start; | - |
214 | QVarLengthArray<qreal> newSizes(n); executed (the execution status of this line is deduced): QVarLengthArray<qreal> newSizes(n); | - |
215 | QVarLengthArray<qreal> factors(n); executed (the execution status of this line is deduced): QVarLengthArray<qreal> factors(n); | - |
216 | qreal sumFactors = 0.0; executed (the execution status of this line is deduced): qreal sumFactors = 0.0; | - |
217 | int sumStretches = 0; executed (the execution status of this line is deduced): int sumStretches = 0; | - |
218 | qreal sumAvailable; executed (the execution status of this line is deduced): qreal sumAvailable; | - |
219 | | - |
220 | for (int i = 0; i < n; ++i) { evaluated: i < n yes Evaluation Count:2079 | yes Evaluation Count:1101 |
| 1101-2079 |
221 | if (stretches[start + i] > 0) evaluated: stretches[start + i] > 0 yes Evaluation Count:155 | yes Evaluation Count:1924 |
| 155-1924 |
222 | sumStretches += stretches[start + i]; executed: sumStretches += stretches[start + i]; Execution Count:155 | 155 |
223 | } executed: } Execution Count:2079 | 2079 |
224 | | - |
225 | if (targetSize < totalBox.q_preferredSize) { evaluated: targetSize < totalBox.q_preferredSize yes Evaluation Count:228 | yes Evaluation Count:873 |
| 228-873 |
226 | stealBox(start, end, MinimumSize, positions, sizes); executed (the execution status of this line is deduced): stealBox(start, end, MinimumSize, positions, sizes); | - |
227 | | - |
228 | sumAvailable = targetSize - totalBox.q_minimumSize; executed (the execution status of this line is deduced): sumAvailable = targetSize - totalBox.q_minimumSize; | - |
229 | if (sumAvailable > 0.0) { evaluated: sumAvailable > 0.0 yes Evaluation Count:54 | yes Evaluation Count:174 |
| 54-174 |
230 | qreal sumDesired = totalBox.q_preferredSize - totalBox.q_minimumSize; executed (the execution status of this line is deduced): qreal sumDesired = totalBox.q_preferredSize - totalBox.q_minimumSize; | - |
231 | | - |
232 | for (int i = 0; i < n; ++i) { evaluated: i < n yes Evaluation Count:118 | yes Evaluation Count:54 |
| 54-118 |
233 | if (ignore.testBit(start + i)) { evaluated: ignore.testBit(start + i) yes Evaluation Count:3 | yes Evaluation Count:115 |
| 3-115 |
234 | factors[i] = 0.0; executed (the execution status of this line is deduced): factors[i] = 0.0; | - |
235 | continue; executed: continue; Execution Count:3 | 3 |
236 | } | - |
237 | | - |
238 | const QGridLayoutBox &box = boxes.at(start + i); executed (the execution status of this line is deduced): const QGridLayoutBox &box = boxes.at(start + i); | - |
239 | qreal desired = box.q_preferredSize - box.q_minimumSize; executed (the execution status of this line is deduced): qreal desired = box.q_preferredSize - box.q_minimumSize; | - |
240 | factors[i] = growthFactorBelowPreferredSize(desired, sumAvailable, sumDesired); executed (the execution status of this line is deduced): factors[i] = growthFactorBelowPreferredSize(desired, sumAvailable, sumDesired); | - |
241 | sumFactors += factors[i]; executed (the execution status of this line is deduced): sumFactors += factors[i]; | - |
242 | } executed: } Execution Count:115 | 115 |
243 | | - |
244 | for (int i = 0; i < n; ++i) { evaluated: i < n yes Evaluation Count:118 | yes Evaluation Count:54 |
| 54-118 |
245 | Q_ASSERT(sumFactors > 0.0); executed (the execution status of this line is deduced): qt_noop(); | - |
246 | qreal delta = sumAvailable * factors[i] / sumFactors; executed (the execution status of this line is deduced): qreal delta = sumAvailable * factors[i] / sumFactors; | - |
247 | newSizes[i] = sizes[i] + delta; executed (the execution status of this line is deduced): newSizes[i] = sizes[i] + delta; | - |
248 | } executed: } Execution Count:118 | 118 |
249 | } executed: } Execution Count:54 | 54 |
250 | } else { executed: } Execution Count:228 | 228 |
251 | bool isLargerThanMaximum = (targetSize > totalBox.q_maximumSize); executed (the execution status of this line is deduced): bool isLargerThanMaximum = (targetSize > totalBox.q_maximumSize); | - |
252 | if (isLargerThanMaximum) { evaluated: isLargerThanMaximum yes Evaluation Count:82 | yes Evaluation Count:791 |
| 82-791 |
253 | stealBox(start, end, MaximumSize, positions, sizes); executed (the execution status of this line is deduced): stealBox(start, end, MaximumSize, positions, sizes); | - |
254 | sumAvailable = targetSize - totalBox.q_maximumSize; executed (the execution status of this line is deduced): sumAvailable = targetSize - totalBox.q_maximumSize; | - |
255 | } else { executed: } Execution Count:82 | 82 |
256 | stealBox(start, end, PreferredSize, positions, sizes); executed (the execution status of this line is deduced): stealBox(start, end, PreferredSize, positions, sizes); | - |
257 | sumAvailable = targetSize - totalBox.q_preferredSize; executed (the execution status of this line is deduced): sumAvailable = targetSize - totalBox.q_preferredSize; | - |
258 | } executed: } Execution Count:791 | 791 |
259 | | - |
260 | if (sumAvailable > 0.0) { evaluated: sumAvailable > 0.0 yes Evaluation Count:446 | yes Evaluation Count:427 |
| 427-446 |
261 | qreal sumCurrentAvailable = sumAvailable; executed (the execution status of this line is deduced): qreal sumCurrentAvailable = sumAvailable; | - |
262 | bool somethingHasAMaximumSize = false; executed (the execution status of this line is deduced): bool somethingHasAMaximumSize = false; | - |
263 | | - |
264 | qreal sumSizes = 0.0; executed (the execution status of this line is deduced): qreal sumSizes = 0.0; | - |
265 | for (int i = 0; i < n; ++i) evaluated: i < n yes Evaluation Count:887 | yes Evaluation Count:446 |
| 446-887 |
266 | sumSizes += sizes[i]; executed: sumSizes += sizes[i]; Execution Count:887 | 887 |
267 | | - |
268 | for (int i = 0; i < n; ++i) { evaluated: i < n yes Evaluation Count:887 | yes Evaluation Count:446 |
| 446-887 |
269 | if (ignore.testBit(start + i)) { partially evaluated: ignore.testBit(start + i) no Evaluation Count:0 | yes Evaluation Count:887 |
| 0-887 |
270 | newSizes[i] = 0.0; never executed (the execution status of this line is deduced): newSizes[i] = 0.0; | - |
271 | factors[i] = 0.0; never executed (the execution status of this line is deduced): factors[i] = 0.0; | - |
272 | continue; never executed: continue; | 0 |
273 | } | - |
274 | | - |
275 | const QGridLayoutBox &box = boxes.at(start + i); executed (the execution status of this line is deduced): const QGridLayoutBox &box = boxes.at(start + i); | - |
276 | qreal boxSize; executed (the execution status of this line is deduced): qreal boxSize; | - |
277 | | - |
278 | qreal desired; executed (the execution status of this line is deduced): qreal desired; | - |
279 | if (isLargerThanMaximum) { evaluated: isLargerThanMaximum yes Evaluation Count:153 | yes Evaluation Count:734 |
| 153-734 |
280 | boxSize = box.q_maximumSize; executed (the execution status of this line is deduced): boxSize = box.q_maximumSize; | - |
281 | desired = rowInfo.boxes.value(start + i).q_maximumSize - boxSize; executed (the execution status of this line is deduced): desired = rowInfo.boxes.value(start + i).q_maximumSize - boxSize; | - |
282 | } else { executed: } Execution Count:153 | 153 |
283 | boxSize = box.q_preferredSize; executed (the execution status of this line is deduced): boxSize = box.q_preferredSize; | - |
284 | desired = box.q_maximumSize - boxSize; executed (the execution status of this line is deduced): desired = box.q_maximumSize - boxSize; | - |
285 | } executed: } Execution Count:734 | 734 |
286 | if (desired == 0.0) { evaluated: desired == 0.0 yes Evaluation Count:162 | yes Evaluation Count:725 |
| 162-725 |
287 | newSizes[i] = sizes[i]; executed (the execution status of this line is deduced): newSizes[i] = sizes[i]; | - |
288 | factors[i] = 0.0; executed (the execution status of this line is deduced): factors[i] = 0.0; | - |
289 | } else { executed: } Execution Count:162 | 162 |
290 | Q_ASSERT(desired > 0.0); executed (the execution status of this line is deduced): qt_noop(); | - |
291 | | - |
292 | int stretch = stretches[start + i]; executed (the execution status of this line is deduced): int stretch = stretches[start + i]; | - |
293 | if (sumStretches == 0) { evaluated: sumStretches == 0 yes Evaluation Count:680 | yes Evaluation Count:45 |
| 45-680 |
294 | if (hasIgnoreFlag) { evaluated: hasIgnoreFlag yes Evaluation Count:17 | yes Evaluation Count:663 |
| 17-663 |
295 | factors[i] = (stretch < 0) ? 1.0 : 0.0; evaluated: (stretch < 0) yes Evaluation Count:14 | yes Evaluation Count:3 |
| 3-14 |
296 | } else { executed: } Execution Count:17 | 17 |
297 | factors[i] = (stretch < 0) ? sizes[i] : 0.0; partially evaluated: (stretch < 0) yes Evaluation Count:663 | no Evaluation Count:0 |
| 0-663 |
298 | } executed: } Execution Count:663 | 663 |
299 | } else if (stretch == sumStretches) { evaluated: stretch == sumStretches yes Evaluation Count:12 | yes Evaluation Count:33 |
| 12-33 |
300 | factors[i] = 1.0; executed (the execution status of this line is deduced): factors[i] = 1.0; | - |
301 | } else if (stretch <= 0) { executed: } Execution Count:12 evaluated: stretch <= 0 yes Evaluation Count:9 | yes Evaluation Count:24 |
| 9-24 |
302 | factors[i] = 0.0; executed (the execution status of this line is deduced): factors[i] = 0.0; | - |
303 | } else { executed: } Execution Count:9 | 9 |
304 | qreal ultimateSize; executed (the execution status of this line is deduced): qreal ultimateSize; | - |
305 | qreal ultimateSumSizes; executed (the execution status of this line is deduced): qreal ultimateSumSizes; | - |
306 | qreal x = ((stretch * sumSizes) executed (the execution status of this line is deduced): qreal x = ((stretch * sumSizes) | - |
307 | - (sumStretches * boxSize)) executed (the execution status of this line is deduced): - (sumStretches * boxSize)) | - |
308 | / (sumStretches - stretch); executed (the execution status of this line is deduced): / (sumStretches - stretch); | - |
309 | if (x >= 0.0) { evaluated: x >= 0.0 yes Evaluation Count:14 | yes Evaluation Count:10 |
| 10-14 |
310 | ultimateSize = boxSize + x; executed (the execution status of this line is deduced): ultimateSize = boxSize + x; | - |
311 | ultimateSumSizes = sumSizes + x; executed (the execution status of this line is deduced): ultimateSumSizes = sumSizes + x; | - |
312 | } else { executed: } Execution Count:14 | 14 |
313 | ultimateSize = boxSize; executed (the execution status of this line is deduced): ultimateSize = boxSize; | - |
314 | ultimateSumSizes = (sumStretches * boxSize) executed (the execution status of this line is deduced): ultimateSumSizes = (sumStretches * boxSize) | - |
315 | / stretch; executed (the execution status of this line is deduced): / stretch; | - |
316 | } executed: } Execution Count:10 | 10 |
317 | | - |
318 | /* | - |
319 | We multiply these by 1.5 to give some space for a smooth transition | - |
320 | (at the expense of the stretch factors, which are not fully respected | - |
321 | during the transition). | - |
322 | */ | - |
323 | ultimateSize = ultimateSize * 3 / 2; executed (the execution status of this line is deduced): ultimateSize = ultimateSize * 3 / 2; | - |
324 | ultimateSumSizes = ultimateSumSizes * 3 / 2; executed (the execution status of this line is deduced): ultimateSumSizes = ultimateSumSizes * 3 / 2; | - |
325 | | - |
326 | qreal beta = ultimateSumSizes - sumSizes; executed (the execution status of this line is deduced): qreal beta = ultimateSumSizes - sumSizes; | - |
327 | if (!beta) { partially evaluated: !beta no Evaluation Count:0 | yes Evaluation Count:24 |
| 0-24 |
328 | factors[i] = 1; never executed (the execution status of this line is deduced): factors[i] = 1; | - |
329 | } else { | 0 |
330 | qreal alpha = qMin(sumCurrentAvailable, beta); executed (the execution status of this line is deduced): qreal alpha = qMin(sumCurrentAvailable, beta); | - |
331 | qreal ultimateFactor = (stretch * ultimateSumSizes / sumStretches) executed (the execution status of this line is deduced): qreal ultimateFactor = (stretch * ultimateSumSizes / sumStretches) | - |
332 | - (boxSize); executed (the execution status of this line is deduced): - (boxSize); | - |
333 | qreal transitionalFactor = sumCurrentAvailable * (ultimateSize - boxSize) / beta; executed (the execution status of this line is deduced): qreal transitionalFactor = sumCurrentAvailable * (ultimateSize - boxSize) / beta; | - |
334 | | - |
335 | factors[i] = ((alpha * ultimateFactor) executed (the execution status of this line is deduced): factors[i] = ((alpha * ultimateFactor) | - |
336 | + ((beta - alpha) * transitionalFactor)) / beta; executed (the execution status of this line is deduced): + ((beta - alpha) * transitionalFactor)) / beta; | - |
337 | } executed: } Execution Count:24 | 24 |
338 | | - |
339 | } | - |
340 | sumFactors += factors[i]; executed (the execution status of this line is deduced): sumFactors += factors[i]; | - |
341 | if (desired < sumCurrentAvailable) evaluated: desired < sumCurrentAvailable yes Evaluation Count:81 | yes Evaluation Count:644 |
| 81-644 |
342 | somethingHasAMaximumSize = true; executed: somethingHasAMaximumSize = true; Execution Count:81 | 81 |
343 | | - |
344 | newSizes[i] = -1.0; executed (the execution status of this line is deduced): newSizes[i] = -1.0; | - |
345 | } executed: } Execution Count:725 | 725 |
346 | } | - |
347 | | - |
348 | bool keepGoing = somethingHasAMaximumSize; executed (the execution status of this line is deduced): bool keepGoing = somethingHasAMaximumSize; | - |
349 | while (keepGoing) { evaluated: keepGoing yes Evaluation Count:54 | yes Evaluation Count:446 |
| 54-446 |
350 | keepGoing = false; executed (the execution status of this line is deduced): keepGoing = false; | - |
351 | | - |
352 | for (int i = 0; i < n; ++i) { evaluated: i < n yes Evaluation Count:122 | yes Evaluation Count:31 |
| 31-122 |
353 | if (newSizes[i] >= 0.0) evaluated: newSizes[i] >= 0.0 yes Evaluation Count:12 | yes Evaluation Count:110 |
| 12-110 |
354 | continue; executed: continue; Execution Count:12 | 12 |
355 | | - |
356 | qreal maxBoxSize; executed (the execution status of this line is deduced): qreal maxBoxSize; | - |
357 | if (isLargerThanMaximum) partially evaluated: isLargerThanMaximum no Evaluation Count:0 | yes Evaluation Count:110 |
| 0-110 |
358 | maxBoxSize = rowInfo.boxes.value(start + i).q_maximumSize; never executed: maxBoxSize = rowInfo.boxes.value(start + i).q_maximumSize; | 0 |
359 | else | - |
360 | maxBoxSize = boxes.at(start + i).q_maximumSize; executed: maxBoxSize = boxes.at(start + i).q_maximumSize; Execution Count:110 | 110 |
361 | | - |
362 | qreal avail = sumCurrentAvailable * factors[i] / sumFactors; executed (the execution status of this line is deduced): qreal avail = sumCurrentAvailable * factors[i] / sumFactors; | - |
363 | if (sizes[i] + avail >= maxBoxSize) { evaluated: sizes[i] + avail >= maxBoxSize yes Evaluation Count:56 | yes Evaluation Count:54 |
| 54-56 |
364 | newSizes[i] = maxBoxSize; executed (the execution status of this line is deduced): newSizes[i] = maxBoxSize; | - |
365 | sumCurrentAvailable -= maxBoxSize - sizes[i]; executed (the execution status of this line is deduced): sumCurrentAvailable -= maxBoxSize - sizes[i]; | - |
366 | sumFactors -= factors[i]; executed (the execution status of this line is deduced): sumFactors -= factors[i]; | - |
367 | keepGoing = (sumCurrentAvailable > 0.0); executed (the execution status of this line is deduced): keepGoing = (sumCurrentAvailable > 0.0); | - |
368 | if (!keepGoing) evaluated: !keepGoing yes Evaluation Count:23 | yes Evaluation Count:33 |
| 23-33 |
369 | break; executed: break; Execution Count:23 | 23 |
370 | } executed: } Execution Count:33 | 33 |
371 | } executed: } Execution Count:87 | 87 |
372 | } executed: } Execution Count:54 | 54 |
373 | | - |
374 | for (int i = 0; i < n; ++i) { evaluated: i < n yes Evaluation Count:887 | yes Evaluation Count:446 |
| 446-887 |
375 | if (newSizes[i] < 0.0) { evaluated: newSizes[i] < 0.0 yes Evaluation Count:669 | yes Evaluation Count:218 |
| 218-669 |
376 | qreal delta = (sumFactors == 0.0) ? 0.0 partially evaluated: (sumFactors == 0.0) no Evaluation Count:0 | yes Evaluation Count:669 |
| 0-669 |
377 | : sumCurrentAvailable * factors[i] / sumFactors; executed (the execution status of this line is deduced): : sumCurrentAvailable * factors[i] / sumFactors; | - |
378 | newSizes[i] = sizes[i] + delta; executed (the execution status of this line is deduced): newSizes[i] = sizes[i] + delta; | - |
379 | } executed: } Execution Count:669 | 669 |
380 | } executed: } Execution Count:887 | 887 |
381 | } executed: } Execution Count:446 | 446 |
382 | } executed: } Execution Count:873 | 873 |
383 | | - |
384 | if (sumAvailable > 0) { evaluated: sumAvailable > 0 yes Evaluation Count:500 | yes Evaluation Count:601 |
| 500-601 |
385 | qreal offset = 0; executed (the execution status of this line is deduced): qreal offset = 0; | - |
386 | for (int i = 0; i < n; ++i) { evaluated: i < n yes Evaluation Count:1005 | yes Evaluation Count:500 |
| 500-1005 |
387 | qreal delta = newSizes[i] - sizes[i]; executed (the execution status of this line is deduced): qreal delta = newSizes[i] - sizes[i]; | - |
388 | positions[i] += offset; executed (the execution status of this line is deduced): positions[i] += offset; | - |
389 | sizes[i] += delta; executed (the execution status of this line is deduced): sizes[i] += delta; | - |
390 | offset += delta; executed (the execution status of this line is deduced): offset += delta; | - |
391 | } executed: } Execution Count:1005 | 1005 |
392 | | - |
393 | #if 0 // some "pixel allocation" | - |
394 | int surplus = targetSize - (positions[n - 1] + sizes[n - 1]); | - |
395 | Q_ASSERT(surplus >= 0 && surplus <= n); | - |
396 | | - |
397 | int prevSurplus = -1; | - |
398 | while (surplus > 0 && surplus != prevSurplus) { | - |
399 | prevSurplus = surplus; | - |
400 | | - |
401 | int offset = 0; | - |
402 | for (int i = 0; i < n; ++i) { | - |
403 | const QGridLayoutBox &box = boxes.at(start + i); | - |
404 | int delta = (!ignore.testBit(start + i) && surplus > 0 | - |
405 | && factors[i] > 0 && sizes[i] < box.q_maximumSize) | - |
406 | ? 1 : 0; | - |
407 | | - |
408 | positions[i] += offset; | - |
409 | sizes[i] += delta; | - |
410 | offset += delta; | - |
411 | surplus -= delta; | - |
412 | } | - |
413 | } | - |
414 | Q_ASSERT(surplus == 0); | - |
415 | #endif | - |
416 | } executed: } Execution Count:500 | 500 |
417 | | - |
418 | if (descents) { evaluated: descents yes Evaluation Count:365 | yes Evaluation Count:736 |
| 365-736 |
419 | for (int i = 0; i < n; ++i) { evaluated: i < n yes Evaluation Count:563 | yes Evaluation Count:365 |
| 365-563 |
420 | if (ignore.testBit(start + i)) evaluated: ignore.testBit(start + i) yes Evaluation Count:1 | yes Evaluation Count:562 |
| 1-562 |
421 | continue; executed: continue; Execution Count:1 | 1 |
422 | const QGridLayoutBox &box = boxes.at(start + i); executed (the execution status of this line is deduced): const QGridLayoutBox &box = boxes.at(start + i); | - |
423 | descents[i] = fixedDescent(box.q_minimumDescent, box.q_minimumAscent, sizes[i]); executed (the execution status of this line is deduced): descents[i] = fixedDescent(box.q_minimumDescent, box.q_minimumAscent, sizes[i]); | - |
424 | } executed: } Execution Count:562 | 562 |
425 | } executed: } Execution Count:365 | 365 |
426 | } executed: } Execution Count:1101 | 1101 |
427 | | - |
428 | QGridLayoutBox QGridLayoutRowData::totalBox(int start, int end) const | - |
429 | { | - |
430 | QGridLayoutBox result; executed (the execution status of this line is deduced): QGridLayoutBox result; | - |
431 | if (start < end) { evaluated: start < end yes Evaluation Count:3192 | yes Evaluation Count:665 |
| 665-3192 |
432 | result.q_maximumSize = 0.0; executed (the execution status of this line is deduced): result.q_maximumSize = 0.0; | - |
433 | qreal nextSpacing = 0.0; executed (the execution status of this line is deduced): qreal nextSpacing = 0.0; | - |
434 | for (int i = start; i < end; ++i) { evaluated: i < end yes Evaluation Count:6295 | yes Evaluation Count:3192 |
| 3192-6295 |
435 | result.add(boxes.at(i), stretches.at(i), nextSpacing); executed (the execution status of this line is deduced): result.add(boxes.at(i), stretches.at(i), nextSpacing); | - |
436 | nextSpacing = spacings.at(i); executed (the execution status of this line is deduced): nextSpacing = spacings.at(i); | - |
437 | } executed: } Execution Count:6295 | 6295 |
438 | } executed: } Execution Count:3192 | 3192 |
439 | return result; executed: return result; Execution Count:3857 | 3857 |
440 | } | - |
441 | | - |
442 | void QGridLayoutRowData::stealBox(int start, int end, int which, qreal *positions, qreal *sizes) | - |
443 | { | - |
444 | qreal offset = 0.0; executed (the execution status of this line is deduced): qreal offset = 0.0; | - |
445 | qreal nextSpacing = 0.0; executed (the execution status of this line is deduced): qreal nextSpacing = 0.0; | - |
446 | | - |
447 | for (int i = start; i < end; ++i) { evaluated: i < end yes Evaluation Count:2079 | yes Evaluation Count:1101 |
| 1101-2079 |
448 | qreal avail = 0.0; executed (the execution status of this line is deduced): qreal avail = 0.0; | - |
449 | | - |
450 | if (!ignore.testBit(i)) { evaluated: !ignore.testBit(i) yes Evaluation Count:2068 | yes Evaluation Count:11 |
| 11-2068 |
451 | const QGridLayoutBox &box = boxes.at(i); executed (the execution status of this line is deduced): const QGridLayoutBox &box = boxes.at(i); | - |
452 | avail = box.q_sizes(which); executed (the execution status of this line is deduced): avail = box.q_sizes(which); | - |
453 | offset += nextSpacing; executed (the execution status of this line is deduced): offset += nextSpacing; | - |
454 | nextSpacing = spacings.at(i); executed (the execution status of this line is deduced): nextSpacing = spacings.at(i); | - |
455 | } executed: } Execution Count:2068 | 2068 |
456 | | - |
457 | *positions++ = offset; executed (the execution status of this line is deduced): *positions++ = offset; | - |
458 | *sizes++ = avail; executed (the execution status of this line is deduced): *sizes++ = avail; | - |
459 | offset += avail; executed (the execution status of this line is deduced): offset += avail; | - |
460 | } executed: } Execution Count:2079 | 2079 |
461 | } executed: } Execution Count:1101 | 1101 |
462 | | - |
463 | #ifdef QT_DEBUG | - |
464 | void QGridLayoutRowData::dump(int indent) const | - |
465 | { | - |
466 | qDebug("%*sData", indent, ""); | - |
467 | | - |
468 | for (int i = 0; i < ignore.count(); ++i) { | - |
469 | qDebug("%*s Row %d (stretch %d, spacing %g)", indent, "", i, stretches.at(i), | - |
470 | spacings.at(i)); | - |
471 | if (ignore.testBit(i)) | - |
472 | qDebug("%*s Ignored", indent, ""); | - |
473 | boxes.at(i).dump(indent + 2); | - |
474 | } | - |
475 | | - |
476 | MultiCellMap::const_iterator it = multiCellMap.constBegin(); | - |
477 | while (it != multiCellMap.constEnd()) { | - |
478 | qDebug("%*s Multi-cell entry <%d, %d> (stretch %d)", indent, "", it.key().first, | - |
479 | it.key().second, it.value().q_stretch); | - |
480 | it.value().q_box.dump(indent + 2); | - |
481 | } | - |
482 | } | - |
483 | #endif | - |
484 | | - |
485 | QGridLayoutItem::QGridLayoutItem(QGridLayoutEngine *engine, QGraphicsLayoutItem *layoutItem, | - |
486 | int row, int column, int rowSpan, int columnSpan, | - |
487 | Qt::Alignment alignment, int itemAtIndex) | - |
488 | : q_engine(engine), q_layoutItem(layoutItem), q_alignment(alignment) | - |
489 | { | - |
490 | q_firstRows[Hor] = column; executed (the execution status of this line is deduced): q_firstRows[Hor] = column; | - |
491 | q_firstRows[Ver] = row; executed (the execution status of this line is deduced): q_firstRows[Ver] = row; | - |
492 | q_rowSpans[Hor] = columnSpan; executed (the execution status of this line is deduced): q_rowSpans[Hor] = columnSpan; | - |
493 | q_rowSpans[Ver] = rowSpan; executed (the execution status of this line is deduced): q_rowSpans[Ver] = rowSpan; | - |
494 | q_stretches[Hor] = -1; executed (the execution status of this line is deduced): q_stretches[Hor] = -1; | - |
495 | q_stretches[Ver] = -1; executed (the execution status of this line is deduced): q_stretches[Ver] = -1; | - |
496 | | - |
497 | q_engine->insertItem(this, itemAtIndex); executed (the execution status of this line is deduced): q_engine->insertItem(this, itemAtIndex); | - |
498 | } executed: } Execution Count:1342 | 1342 |
499 | | - |
500 | int QGridLayoutItem::firstRow(Qt::Orientation orientation) const | - |
501 | { | - |
502 | return q_firstRows[orientation == Qt::Vertical]; executed: return q_firstRows[orientation == Qt::Vertical]; Execution Count:30938 | 30938 |
503 | } | - |
504 | | - |
505 | int QGridLayoutItem::firstColumn(Qt::Orientation orientation) const | - |
506 | { | - |
507 | return q_firstRows[orientation == Qt::Horizontal]; executed: return q_firstRows[orientation == Qt::Horizontal]; Execution Count:10810 | 10810 |
508 | } | - |
509 | | - |
510 | int QGridLayoutItem::lastRow(Qt::Orientation orientation) const | - |
511 | { | - |
512 | return firstRow(orientation) + rowSpan(orientation) - 1; executed: return firstRow(orientation) + rowSpan(orientation) - 1; Execution Count:10052 | 10052 |
513 | } | - |
514 | | - |
515 | int QGridLayoutItem::lastColumn(Qt::Orientation orientation) const | - |
516 | { | - |
517 | return firstColumn(orientation) + columnSpan(orientation) - 1; executed: return firstColumn(orientation) + columnSpan(orientation) - 1; Execution Count:224 | 224 |
518 | } | - |
519 | | - |
520 | int QGridLayoutItem::rowSpan(Qt::Orientation orientation) const | - |
521 | { | - |
522 | return q_rowSpans[orientation == Qt::Vertical]; executed: return q_rowSpans[orientation == Qt::Vertical]; Execution Count:20280 | 20280 |
523 | } | - |
524 | | - |
525 | int QGridLayoutItem::columnSpan(Qt::Orientation orientation) const | - |
526 | { | - |
527 | return q_rowSpans[orientation == Qt::Horizontal]; executed: return q_rowSpans[orientation == Qt::Horizontal]; Execution Count:438 | 438 |
528 | } | - |
529 | | - |
530 | void QGridLayoutItem::setFirstRow(int row, Qt::Orientation orientation) | - |
531 | { | - |
532 | q_firstRows[orientation == Qt::Vertical] = row; executed (the execution status of this line is deduced): q_firstRows[orientation == Qt::Vertical] = row; | - |
533 | } executed: } Execution Count:78 | 78 |
534 | | - |
535 | void QGridLayoutItem::setRowSpan(int rowSpan, Qt::Orientation orientation) | - |
536 | { | - |
537 | q_rowSpans[orientation == Qt::Vertical] = rowSpan; never executed (the execution status of this line is deduced): q_rowSpans[orientation == Qt::Vertical] = rowSpan; | - |
538 | } | 0 |
539 | | - |
540 | int QGridLayoutItem::stretchFactor(Qt::Orientation orientation) const | - |
541 | { | - |
542 | int stretch = q_stretches[orientation == Qt::Vertical]; executed (the execution status of this line is deduced): int stretch = q_stretches[orientation == Qt::Vertical]; | - |
543 | if (stretch >= 0) evaluated: stretch >= 0 yes Evaluation Count:36 | yes Evaluation Count:10283 |
| 36-10283 |
544 | return stretch; executed: return stretch; Execution Count:36 | 36 |
545 | | - |
546 | QSizePolicy::Policy policy = sizePolicy(orientation); executed (the execution status of this line is deduced): QSizePolicy::Policy policy = sizePolicy(orientation); | - |
547 | | - |
548 | if (policy & QSizePolicy::ExpandFlag) { evaluated: policy & QSizePolicy::ExpandFlag yes Evaluation Count:714 | yes Evaluation Count:9569 |
| 714-9569 |
549 | return 1; executed: return 1; Execution Count:714 | 714 |
550 | } else if (policy & QSizePolicy::GrowFlag) { evaluated: policy & QSizePolicy::GrowFlag yes Evaluation Count:9120 | yes Evaluation Count:449 |
| 449-9120 |
551 | return -1; // because we max it up executed: return -1; Execution Count:9120 | 9120 |
552 | } else { | - |
553 | return 0; executed: return 0; Execution Count:449 | 449 |
554 | } | - |
555 | } | - |
556 | | - |
557 | void QGridLayoutItem::setStretchFactor(int stretch, Qt::Orientation orientation) | - |
558 | { | - |
559 | Q_ASSERT(stretch >= 0); // ### deal with too big stretches executed (the execution status of this line is deduced): qt_noop(); | - |
560 | q_stretches[orientation == Qt::Vertical] = stretch; executed (the execution status of this line is deduced): q_stretches[orientation == Qt::Vertical] = stretch; | - |
561 | } executed: } Execution Count:9 | 9 |
562 | | - |
563 | QSizePolicy::Policy QGridLayoutItem::sizePolicy(Qt::Orientation orientation) const | - |
564 | { | - |
565 | QSizePolicy sizePolicy(q_layoutItem->sizePolicy()); executed (the execution status of this line is deduced): QSizePolicy sizePolicy(q_layoutItem->sizePolicy()); | - |
566 | return (orientation == Qt::Horizontal) ? sizePolicy.horizontalPolicy() executed: return (orientation == Qt::Horizontal) ? sizePolicy.horizontalPolicy() : sizePolicy.verticalPolicy(); Execution Count:34765 | 34765 |
567 | : sizePolicy.verticalPolicy(); executed: return (orientation == Qt::Horizontal) ? sizePolicy.horizontalPolicy() : sizePolicy.verticalPolicy(); Execution Count:34765 | 34765 |
568 | } | - |
569 | | - |
570 | /* | - |
571 | returns true if the size policy returns true for either hasHeightForWidth() | - |
572 | or hasWidthForHeight() | - |
573 | */ | - |
574 | bool QGridLayoutItem::hasDynamicConstraint() const | - |
575 | { | - |
576 | return QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth() executed: return QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth() || QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight(); Execution Count:3976 | 3976 |
577 | || QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight(); executed: return QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth() || QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight(); Execution Count:3976 | 3976 |
578 | } | - |
579 | | - |
580 | Qt::Orientation QGridLayoutItem::dynamicConstraintOrientation() const | - |
581 | { | - |
582 | if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth()) evaluated: QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth() yes Evaluation Count:588 | yes Evaluation Count:36 |
| 36-588 |
583 | return Qt::Vertical; executed: return Qt::Vertical; Execution Count:588 | 588 |
584 | else //if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight()) | - |
585 | return Qt::Horizontal; executed: return Qt::Horizontal; Execution Count:36 | 36 |
586 | } | - |
587 | | - |
588 | QSizePolicy::ControlTypes QGridLayoutItem::controlTypes(LayoutSide /* side */) const | - |
589 | { | - |
590 | return q_layoutItem->sizePolicy().controlType(); executed: return q_layoutItem->sizePolicy().controlType(); Execution Count:10067 | 10067 |
591 | } | - |
592 | | - |
593 | QSizeF QGridLayoutItem::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const | - |
594 | { | - |
595 | return q_layoutItem->effectiveSizeHint(which, constraint); executed: return q_layoutItem->effectiveSizeHint(which, constraint); Execution Count:39848 | 39848 |
596 | } | - |
597 | | - |
598 | QGridLayoutBox QGridLayoutItem::box(Qt::Orientation orientation, qreal constraint) const | - |
599 | { | - |
600 | QGridLayoutBox result; executed (the execution status of this line is deduced): QGridLayoutBox result; | - |
601 | QSizePolicy::Policy policy = sizePolicy(orientation); executed (the execution status of this line is deduced): QSizePolicy::Policy policy = sizePolicy(orientation); | - |
602 | | - |
603 | if (orientation == Qt::Horizontal) { evaluated: orientation == Qt::Horizontal yes Evaluation Count:5114 | yes Evaluation Count:6366 |
| 5114-6366 |
604 | QSizeF constraintSize(-1.0, constraint); executed (the execution status of this line is deduced): QSizeF constraintSize(-1.0, constraint); | - |
605 | | - |
606 | result.q_preferredSize = sizeHint(Qt::PreferredSize, constraintSize).width(); executed (the execution status of this line is deduced): result.q_preferredSize = sizeHint(Qt::PreferredSize, constraintSize).width(); | - |
607 | | - |
608 | if (policy & QSizePolicy::ShrinkFlag) { evaluated: policy & QSizePolicy::ShrinkFlag yes Evaluation Count:4996 | yes Evaluation Count:118 |
| 118-4996 |
609 | result.q_minimumSize = sizeHint(Qt::MinimumSize, constraintSize).width(); executed (the execution status of this line is deduced): result.q_minimumSize = sizeHint(Qt::MinimumSize, constraintSize).width(); | - |
610 | } else { executed: } Execution Count:4996 | 4996 |
611 | result.q_minimumSize = result.q_preferredSize; executed (the execution status of this line is deduced): result.q_minimumSize = result.q_preferredSize; | - |
612 | } executed: } Execution Count:118 | 118 |
613 | | - |
614 | if (policy & (QSizePolicy::GrowFlag | QSizePolicy::ExpandFlag)) { evaluated: policy & (QSizePolicy::GrowFlag | QSizePolicy::ExpandFlag) yes Evaluation Count:4996 | yes Evaluation Count:118 |
| 118-4996 |
615 | result.q_maximumSize = sizeHint(Qt::MaximumSize, constraintSize).width(); executed (the execution status of this line is deduced): result.q_maximumSize = sizeHint(Qt::MaximumSize, constraintSize).width(); | - |
616 | } else { executed: } Execution Count:4996 | 4996 |
617 | result.q_maximumSize = result.q_preferredSize; executed (the execution status of this line is deduced): result.q_maximumSize = result.q_preferredSize; | - |
618 | } executed: } Execution Count:118 | 118 |
619 | } else { | - |
620 | QSizeF constraintSize(constraint, -1.0); executed (the execution status of this line is deduced): QSizeF constraintSize(constraint, -1.0); | - |
621 | | - |
622 | result.q_preferredSize = sizeHint(Qt::PreferredSize, constraintSize).height(); executed (the execution status of this line is deduced): result.q_preferredSize = sizeHint(Qt::PreferredSize, constraintSize).height(); | - |
623 | | - |
624 | if (policy & QSizePolicy::ShrinkFlag) { evaluated: policy & QSizePolicy::ShrinkFlag yes Evaluation Count:6005 | yes Evaluation Count:361 |
| 361-6005 |
625 | result.q_minimumSize = sizeHint(Qt::MinimumSize, constraintSize).height(); executed (the execution status of this line is deduced): result.q_minimumSize = sizeHint(Qt::MinimumSize, constraintSize).height(); | - |
626 | } else { executed: } Execution Count:6005 | 6005 |
627 | result.q_minimumSize = result.q_preferredSize; executed (the execution status of this line is deduced): result.q_minimumSize = result.q_preferredSize; | - |
628 | } executed: } Execution Count:361 | 361 |
629 | | - |
630 | if (policy & (QSizePolicy::GrowFlag | QSizePolicy::ExpandFlag)) { evaluated: policy & (QSizePolicy::GrowFlag | QSizePolicy::ExpandFlag) yes Evaluation Count:6005 | yes Evaluation Count:361 |
| 361-6005 |
631 | result.q_maximumSize = sizeHint(Qt::MaximumSize, constraintSize).height(); executed (the execution status of this line is deduced): result.q_maximumSize = sizeHint(Qt::MaximumSize, constraintSize).height(); | - |
632 | } else { executed: } Execution Count:6005 | 6005 |
633 | result.q_maximumSize = result.q_preferredSize; executed (the execution status of this line is deduced): result.q_maximumSize = result.q_preferredSize; | - |
634 | } executed: } Execution Count:361 | 361 |
635 | | - |
636 | result.q_minimumDescent = sizeHint(Qt::MinimumDescent, constraintSize).height(); executed (the execution status of this line is deduced): result.q_minimumDescent = sizeHint(Qt::MinimumDescent, constraintSize).height(); | - |
637 | if (result.q_minimumDescent >= 0.0) partially evaluated: result.q_minimumDescent >= 0.0 no Evaluation Count:0 | yes Evaluation Count:6366 |
| 0-6366 |
638 | result.q_minimumAscent = result.q_minimumSize - result.q_minimumDescent; never executed: result.q_minimumAscent = result.q_minimumSize - result.q_minimumDescent; | 0 |
639 | } executed: } Execution Count:6366 | 6366 |
640 | if (policy & QSizePolicy::IgnoreFlag) evaluated: policy & QSizePolicy::IgnoreFlag yes Evaluation Count:242 | yes Evaluation Count:11238 |
| 242-11238 |
641 | result.q_preferredSize = result.q_minimumSize; executed: result.q_preferredSize = result.q_minimumSize; Execution Count:242 | 242 |
642 | | - |
643 | return result; executed: return result; Execution Count:11480 | 11480 |
644 | } | - |
645 | | - |
646 | QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal height, | - |
647 | qreal rowDescent) const | - |
648 | { | - |
649 | rowDescent = -1.0; // ### This disables the descent executed (the execution status of this line is deduced): rowDescent = -1.0; | - |
650 | | - |
651 | QGridLayoutBox vBox = box(Qt::Vertical); executed (the execution status of this line is deduced): QGridLayoutBox vBox = box(Qt::Vertical); | - |
652 | if (vBox.q_minimumDescent < 0.0 || rowDescent < 0.0) { partially evaluated: vBox.q_minimumDescent < 0.0 yes Evaluation Count:1252 | no Evaluation Count:0 |
never evaluated: rowDescent < 0.0 | 0-1252 |
653 | qreal cellWidth = width; executed (the execution status of this line is deduced): qreal cellWidth = width; | - |
654 | qreal cellHeight = height; executed (the execution status of this line is deduced): qreal cellHeight = height; | - |
655 | | - |
656 | | - |
657 | QSizeF size = effectiveMaxSize(QSizeF(-1,-1)); executed (the execution status of this line is deduced): QSizeF size = effectiveMaxSize(QSizeF(-1,-1)); | - |
658 | if (hasDynamicConstraint()) { evaluated: hasDynamicConstraint() yes Evaluation Count:193 | yes Evaluation Count:1059 |
| 193-1059 |
659 | if (dynamicConstraintOrientation() == Qt::Vertical) { evaluated: dynamicConstraintOrientation() == Qt::Vertical yes Evaluation Count:183 | yes Evaluation Count:10 |
| 10-183 |
660 | if (size.width() > cellWidth) evaluated: size.width() > cellWidth yes Evaluation Count:125 | yes Evaluation Count:58 |
| 58-125 |
661 | size = effectiveMaxSize(QSizeF(cellWidth, -1)); executed: size = effectiveMaxSize(QSizeF(cellWidth, -1)); Execution Count:125 | 125 |
662 | } else if (size.height() > cellHeight) { executed: } Execution Count:183 partially evaluated: size.height() > cellHeight yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-183 |
663 | size = effectiveMaxSize(QSizeF(-1, cellHeight)); executed (the execution status of this line is deduced): size = effectiveMaxSize(QSizeF(-1, cellHeight)); | - |
664 | } executed: } Execution Count:10 | 10 |
665 | } | - |
666 | size = size.boundedTo(QSizeF(cellWidth, cellHeight)); executed (the execution status of this line is deduced): size = size.boundedTo(QSizeF(cellWidth, cellHeight)); | - |
667 | width = size.width(); executed (the execution status of this line is deduced): width = size.width(); | - |
668 | height = size.height(); executed (the execution status of this line is deduced): height = size.height(); | - |
669 | | - |
670 | Qt::Alignment align = q_engine->effectiveAlignment(this); executed (the execution status of this line is deduced): Qt::Alignment align = q_engine->effectiveAlignment(this); | - |
671 | switch (align & Qt::AlignHorizontal_Mask) { | - |
672 | case Qt::AlignHCenter: | - |
673 | x += (cellWidth - width)/2; executed (the execution status of this line is deduced): x += (cellWidth - width)/2; | - |
674 | break; executed: break; Execution Count:63 | 63 |
675 | case Qt::AlignRight: | - |
676 | x += cellWidth - width; executed (the execution status of this line is deduced): x += cellWidth - width; | - |
677 | break; executed: break; Execution Count:46 | 46 |
678 | default: | - |
679 | break; executed: break; Execution Count:1143 | 1143 |
680 | } | - |
681 | switch (align & Qt::AlignVertical_Mask) { | - |
682 | case Qt::AlignVCenter: | - |
683 | y += (cellHeight - height)/2; executed (the execution status of this line is deduced): y += (cellHeight - height)/2; | - |
684 | break; executed: break; Execution Count:49 | 49 |
685 | case Qt::AlignBottom: | - |
686 | y += cellHeight - height; executed (the execution status of this line is deduced): y += cellHeight - height; | - |
687 | break; executed: break; Execution Count:37 | 37 |
688 | default: | - |
689 | break; executed: break; Execution Count:1166 | 1166 |
690 | } | - |
691 | return QRectF(x, y, width, height); executed: return QRectF(x, y, width, height); Execution Count:1252 | 1252 |
692 | } else { | - |
693 | qreal descent = vBox.q_minimumDescent; never executed (the execution status of this line is deduced): qreal descent = vBox.q_minimumDescent; | - |
694 | qreal ascent = vBox.q_minimumSize - descent; never executed (the execution status of this line is deduced): qreal ascent = vBox.q_minimumSize - descent; | - |
695 | return QRectF(x, y + height - rowDescent - ascent, width, ascent + descent); never executed: return QRectF(x, y + height - rowDescent - ascent, width, ascent + descent); | 0 |
696 | } | - |
697 | } | - |
698 | | - |
699 | void QGridLayoutItem::setGeometry(const QRectF &rect) | - |
700 | { | - |
701 | q_layoutItem->setGeometry(rect); executed (the execution status of this line is deduced): q_layoutItem->setGeometry(rect); | - |
702 | } executed: } Execution Count:1252 | 1252 |
703 | | - |
704 | void QGridLayoutItem::transpose() | - |
705 | { | - |
706 | qSwap(q_firstRows[Hor], q_firstRows[Ver]); executed (the execution status of this line is deduced): qSwap(q_firstRows[Hor], q_firstRows[Ver]); | - |
707 | qSwap(q_rowSpans[Hor], q_rowSpans[Ver]); executed (the execution status of this line is deduced): qSwap(q_rowSpans[Hor], q_rowSpans[Ver]); | - |
708 | qSwap(q_stretches[Hor], q_stretches[Ver]); executed (the execution status of this line is deduced): qSwap(q_stretches[Hor], q_stretches[Ver]); | - |
709 | } executed: } Execution Count:9 | 9 |
710 | | - |
711 | void QGridLayoutItem::insertOrRemoveRows(int row, int delta, Qt::Orientation orientation) | - |
712 | { | - |
713 | int oldFirstRow = firstRow(orientation); executed (the execution status of this line is deduced): int oldFirstRow = firstRow(orientation); | - |
714 | if (oldFirstRow >= row) { evaluated: oldFirstRow >= row yes Evaluation Count:78 | yes Evaluation Count:3158 |
| 78-3158 |
715 | setFirstRow(oldFirstRow + delta, orientation); executed (the execution status of this line is deduced): setFirstRow(oldFirstRow + delta, orientation); | - |
716 | } else if (lastRow(orientation) >= row) { executed: } Execution Count:78 partially evaluated: lastRow(orientation) >= row no Evaluation Count:0 | yes Evaluation Count:3158 |
| 0-3158 |
717 | setRowSpan(rowSpan(orientation) + delta, orientation); never executed (the execution status of this line is deduced): setRowSpan(rowSpan(orientation) + delta, orientation); | - |
718 | } | 0 |
719 | } | - |
720 | /*! | - |
721 | \internal | - |
722 | returns the effective maximumSize, will take the sizepolicy into | - |
723 | consideration. (i.e. if sizepolicy does not have QSizePolicy::Grow, then | - |
724 | maxSizeHint will be the preferredSize) | - |
725 | Note that effectiveSizeHint does not take sizePolicy into consideration, | - |
726 | (since it only evaluates the hints, as the name implies) | - |
727 | */ | - |
728 | QSizeF QGridLayoutItem::effectiveMaxSize(const QSizeF &constraint) const | - |
729 | { | - |
730 | QSizeF size = constraint; executed (the execution status of this line is deduced): QSizeF size = constraint; | - |
731 | bool vGrow = (sizePolicy(Qt::Vertical) & QSizePolicy::GrowFlag) == QSizePolicy::GrowFlag; executed (the execution status of this line is deduced): bool vGrow = (sizePolicy(Qt::Vertical) & QSizePolicy::GrowFlag) == QSizePolicy::GrowFlag; | - |
732 | bool hGrow = (sizePolicy(Qt::Horizontal) & QSizePolicy::GrowFlag) == QSizePolicy::GrowFlag; executed (the execution status of this line is deduced): bool hGrow = (sizePolicy(Qt::Horizontal) & QSizePolicy::GrowFlag) == QSizePolicy::GrowFlag; | - |
733 | if (!vGrow || !hGrow) { evaluated: !vGrow yes Evaluation Count:30 | yes Evaluation Count:1357 |
evaluated: !hGrow yes Evaluation Count:20 | yes Evaluation Count:1337 |
| 20-1357 |
734 | QSizeF pref = layoutItem()->effectiveSizeHint(Qt::PreferredSize, constraint); executed (the execution status of this line is deduced): QSizeF pref = layoutItem()->effectiveSizeHint(Qt::PreferredSize, constraint); | - |
735 | if (!vGrow) evaluated: !vGrow yes Evaluation Count:30 | yes Evaluation Count:20 |
| 20-30 |
736 | size.setHeight(pref.height()); executed: size.setHeight(pref.height()); Execution Count:30 | 30 |
737 | if (!hGrow) evaluated: !hGrow yes Evaluation Count:42 | yes Evaluation Count:8 |
| 8-42 |
738 | size.setWidth(pref.width()); executed: size.setWidth(pref.width()); Execution Count:42 | 42 |
739 | } executed: } Execution Count:50 | 50 |
740 | | - |
741 | if (!size.isValid()) { evaluated: !size.isValid() yes Evaluation Count:1365 | yes Evaluation Count:22 |
| 22-1365 |
742 | QSizeF maxSize = layoutItem()->effectiveSizeHint(Qt::MaximumSize, size); executed (the execution status of this line is deduced): QSizeF maxSize = layoutItem()->effectiveSizeHint(Qt::MaximumSize, size); | - |
743 | if (size.width() == -1) evaluated: size.width() == -1 yes Evaluation Count:1220 | yes Evaluation Count:145 |
| 145-1220 |
744 | size.setWidth(maxSize.width()); executed: size.setWidth(maxSize.width()); Execution Count:1220 | 1220 |
745 | if (size.height() == -1) evaluated: size.height() == -1 yes Evaluation Count:1347 | yes Evaluation Count:18 |
| 18-1347 |
746 | size.setHeight(maxSize.height()); executed: size.setHeight(maxSize.height()); Execution Count:1347 | 1347 |
747 | } executed: } Execution Count:1365 | 1365 |
748 | return size; executed: return size; Execution Count:1387 | 1387 |
749 | } | - |
750 | | - |
751 | #ifdef QT_DEBUG | - |
752 | void QGridLayoutItem::dump(int indent) const | - |
753 | { | - |
754 | qDebug("%*s%p (%d, %d) %d x %d", indent, "", q_layoutItem, firstRow(), firstColumn(), | - |
755 | rowSpan(), columnSpan()); | - |
756 | | - |
757 | if (q_stretches[Hor] >= 0) | - |
758 | qDebug("%*s Horizontal stretch: %d", indent, "", q_stretches[Hor]); | - |
759 | if (q_stretches[Ver] >= 0) | - |
760 | qDebug("%*s Vertical stretch: %d", indent, "", q_stretches[Ver]); | - |
761 | if (q_alignment != 0) | - |
762 | qDebug("%*s Alignment: %x", indent, "", uint(q_alignment)); | - |
763 | qDebug("%*s Horizontal size policy: %x Vertical size policy: %x", | - |
764 | indent, "", sizePolicy(Qt::Horizontal), sizePolicy(Qt::Vertical)); | - |
765 | } | - |
766 | #endif | - |
767 | | - |
768 | void QGridLayoutRowInfo::insertOrRemoveRows(int row, int delta) | - |
769 | { | - |
770 | count += delta; executed (the execution status of this line is deduced): count += delta; | - |
771 | | - |
772 | insertOrRemoveItems(stretches, row, delta); executed (the execution status of this line is deduced): insertOrRemoveItems(stretches, row, delta); | - |
773 | insertOrRemoveItems(spacings, row, delta); executed (the execution status of this line is deduced): insertOrRemoveItems(spacings, row, delta); | - |
774 | insertOrRemoveItems(alignments, row, delta); executed (the execution status of this line is deduced): insertOrRemoveItems(alignments, row, delta); | - |
775 | insertOrRemoveItems(boxes, row, delta); executed (the execution status of this line is deduced): insertOrRemoveItems(boxes, row, delta); | - |
776 | } executed: } Execution Count:1490 | 1490 |
777 | | - |
778 | #ifdef QT_DEBUG | - |
779 | void QGridLayoutRowInfo::dump(int indent) const | - |
780 | { | - |
781 | qDebug("%*sInfo (count: %d)", indent, "", count); | - |
782 | for (int i = 0; i < count; ++i) { | - |
783 | QString message; | - |
784 | | - |
785 | if (stretches.value(i).value() >= 0) | - |
786 | message += QString::fromLatin1(" stretch %1").arg(stretches.value(i).value()); | - |
787 | if (spacings.value(i).value() >= 0.0) | - |
788 | message += QString::fromLatin1(" spacing %1").arg(spacings.value(i).value()); | - |
789 | if (alignments.value(i) != 0) | - |
790 | message += QString::fromLatin1(" alignment %1").arg(int(alignments.value(i)), 16); | - |
791 | | - |
792 | if (!message.isEmpty() || boxes.value(i) != QGridLayoutBox()) { | - |
793 | qDebug("%*s Row %d:%s", indent, "", i, qPrintable(message)); | - |
794 | if (boxes.value(i) != QGridLayoutBox()) | - |
795 | boxes.value(i).dump(indent + 1); | - |
796 | } | - |
797 | } | - |
798 | } | - |
799 | #endif | - |
800 | | - |
801 | QGridLayoutEngine::QGridLayoutEngine() | - |
802 | { | - |
803 | m_visualDirection = Qt::LeftToRight; executed (the execution status of this line is deduced): m_visualDirection = Qt::LeftToRight; | - |
804 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
805 | } executed: } Execution Count:664 | 664 |
806 | | - |
807 | int QGridLayoutEngine::rowCount(Qt::Orientation orientation) const | - |
808 | { | - |
809 | return q_infos[orientation == Qt::Vertical].count; executed: return q_infos[orientation == Qt::Vertical].count; Execution Count:11209 | 11209 |
810 | } | - |
811 | | - |
812 | int QGridLayoutEngine::columnCount(Qt::Orientation orientation) const | - |
813 | { | - |
814 | return q_infos[orientation == Qt::Horizontal].count; never executed: return q_infos[orientation == Qt::Horizontal].count; | 0 |
815 | } | - |
816 | | - |
817 | int QGridLayoutEngine::itemCount() const | - |
818 | { | - |
819 | return q_items.count(); executed: return q_items.count(); Execution Count:7069 | 7069 |
820 | } | - |
821 | | - |
822 | QGridLayoutItem *QGridLayoutEngine::itemAt(int index) const | - |
823 | { | - |
824 | Q_ASSERT(index >= 0 && index < itemCount()); executed (the execution status of this line is deduced): qt_noop(); | - |
825 | return q_items.at(index); executed: return q_items.at(index); Execution Count:4490 | 4490 |
826 | } | - |
827 | | - |
828 | int QGridLayoutEngine::indexOf(QGraphicsLayoutItem *item) const | - |
829 | { | - |
830 | for (int i = 0; i < q_items.size(); ++i) { evaluated: i < q_items.size() yes Evaluation Count:19 | yes Evaluation Count:2 |
| 2-19 |
831 | if (item == q_items.at(i)->layoutItem()) evaluated: item == q_items.at(i)->layoutItem() yes Evaluation Count:2 | yes Evaluation Count:17 |
| 2-17 |
832 | return i; executed: return i; Execution Count:2 | 2 |
833 | } executed: } Execution Count:17 | 17 |
834 | return -1; executed: return -1; Execution Count:2 | 2 |
835 | } | - |
836 | | - |
837 | int QGridLayoutEngine::effectiveFirstRow(Qt::Orientation orientation) const | - |
838 | { | - |
839 | ensureEffectiveFirstAndLastRows(); never executed (the execution status of this line is deduced): ensureEffectiveFirstAndLastRows(); | - |
840 | return q_cachedEffectiveFirstRows[orientation == Qt::Vertical]; never executed: return q_cachedEffectiveFirstRows[orientation == Qt::Vertical]; | 0 |
841 | } | - |
842 | | - |
843 | int QGridLayoutEngine::effectiveLastRow(Qt::Orientation orientation) const | - |
844 | { | - |
845 | ensureEffectiveFirstAndLastRows(); executed (the execution status of this line is deduced): ensureEffectiveFirstAndLastRows(); | - |
846 | return q_cachedEffectiveLastRows[orientation == Qt::Vertical]; executed: return q_cachedEffectiveLastRows[orientation == Qt::Vertical]; Execution Count:1438 | 1438 |
847 | } | - |
848 | | - |
849 | void QGridLayoutEngine::setSpacing(qreal spacing, Qt::Orientations orientations) | - |
850 | { | - |
851 | Q_ASSERT(spacing >= 0.0); executed (the execution status of this line is deduced): qt_noop(); | - |
852 | if (orientations & Qt::Horizontal) evaluated: orientations & Qt::Horizontal yes Evaluation Count:183 | yes Evaluation Count:3 |
| 3-183 |
853 | q_defaultSpacings[Hor].setUserValue(spacing); executed: q_defaultSpacings[Hor].setUserValue(spacing); Execution Count:183 | 183 |
854 | if (orientations & Qt::Vertical) evaluated: orientations & Qt::Vertical yes Evaluation Count:183 | yes Evaluation Count:3 |
| 3-183 |
855 | q_defaultSpacings[Ver].setUserValue(spacing); executed: q_defaultSpacings[Ver].setUserValue(spacing); Execution Count:183 | 183 |
856 | | - |
857 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
858 | } executed: } Execution Count:186 | 186 |
859 | | - |
860 | qreal QGridLayoutEngine::spacing(const QLayoutStyleInfo &styleInfo, Qt::Orientation orientation) const | - |
861 | { | - |
862 | if (q_defaultSpacings[orientation == Qt::Vertical].isDefault()) { evaluated: q_defaultSpacings[orientation == Qt::Vertical].isDefault() yes Evaluation Count:8 | yes Evaluation Count:22 |
| 8-22 |
863 | QStyle *style = styleInfo.style(); executed (the execution status of this line is deduced): QStyle *style = styleInfo.style(); | - |
864 | QStyleOption option; executed (the execution status of this line is deduced): QStyleOption option; | - |
865 | option.initFrom(styleInfo.widget()); executed (the execution status of this line is deduced): option.initFrom(styleInfo.widget()); | - |
866 | qreal defaultSpacing = (qreal)style->pixelMetric(orientation == Qt::Vertical ? QStyle::PM_LayoutVerticalSpacing executed (the execution status of this line is deduced): qreal defaultSpacing = (qreal)style->pixelMetric(orientation == Qt::Vertical ? QStyle::PM_LayoutVerticalSpacing | - |
867 | : QStyle::PM_LayoutHorizontalSpacing, &option, styleInfo.widget()); executed (the execution status of this line is deduced): : QStyle::PM_LayoutHorizontalSpacing, &option, styleInfo.widget()); | - |
868 | q_defaultSpacings[orientation == Qt::Vertical].setCachedValue(defaultSpacing); executed (the execution status of this line is deduced): q_defaultSpacings[orientation == Qt::Vertical].setCachedValue(defaultSpacing); | - |
869 | } executed: } Execution Count:8 | 8 |
870 | return q_defaultSpacings[orientation == Qt::Vertical].value(); executed: return q_defaultSpacings[orientation == Qt::Vertical].value(); Execution Count:30 | 30 |
871 | } | - |
872 | | - |
873 | void QGridLayoutEngine::setRowSpacing(int row, qreal spacing, Qt::Orientation orientation) | - |
874 | { | - |
875 | Q_ASSERT(row >= 0); executed (the execution status of this line is deduced): qt_noop(); | - |
876 | | - |
877 | QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; executed (the execution status of this line is deduced): QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; | - |
878 | if (row >= rowInfo.spacings.count()) evaluated: row >= rowInfo.spacings.count() yes Evaluation Count:34 | yes Evaluation Count:1 |
| 1-34 |
879 | rowInfo.spacings.resize(row + 1); executed: rowInfo.spacings.resize(row + 1); Execution Count:34 | 34 |
880 | if (spacing >= 0) evaluated: spacing >= 0 yes Evaluation Count:34 | yes Evaluation Count:1 |
| 1-34 |
881 | rowInfo.spacings[row].setUserValue(spacing); executed: rowInfo.spacings[row].setUserValue(spacing); Execution Count:34 | 34 |
882 | else | - |
883 | rowInfo.spacings[row] = QLayoutParameter<qreal>(); executed: rowInfo.spacings[row] = QLayoutParameter<qreal>(); Execution Count:1 | 1 |
884 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
885 | } executed: } Execution Count:35 | 35 |
886 | | - |
887 | qreal QGridLayoutEngine::rowSpacing(int row, Qt::Orientation orientation) const | - |
888 | { | - |
889 | QLayoutParameter<qreal> spacing = q_infos[orientation == Qt::Vertical].spacings.value(row); executed (the execution status of this line is deduced): QLayoutParameter<qreal> spacing = q_infos[orientation == Qt::Vertical].spacings.value(row); | - |
890 | if (!spacing.isDefault()) evaluated: !spacing.isDefault() yes Evaluation Count:1 | yes Evaluation Count:14 |
| 1-14 |
891 | return spacing.value(); executed: return spacing.value(); Execution Count:1 | 1 |
892 | return q_defaultSpacings[orientation == Qt::Vertical].value(); executed: return q_defaultSpacings[orientation == Qt::Vertical].value(); Execution Count:14 | 14 |
893 | } | - |
894 | | - |
895 | void QGridLayoutEngine::setRowStretchFactor(int row, int stretch, Qt::Orientation orientation) | - |
896 | { | - |
897 | Q_ASSERT(row >= 0); executed (the execution status of this line is deduced): qt_noop(); | - |
898 | Q_ASSERT(stretch >= 0); executed (the execution status of this line is deduced): qt_noop(); | - |
899 | | - |
900 | maybeExpandGrid(row, -1, orientation); executed (the execution status of this line is deduced): maybeExpandGrid(row, -1, orientation); | - |
901 | | - |
902 | QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; executed (the execution status of this line is deduced): QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; | - |
903 | if (row >= rowInfo.stretches.count()) evaluated: row >= rowInfo.stretches.count() yes Evaluation Count:42 | yes Evaluation Count:2 |
| 2-42 |
904 | rowInfo.stretches.resize(row + 1); executed: rowInfo.stretches.resize(row + 1); Execution Count:42 | 42 |
905 | rowInfo.stretches[row].setUserValue(stretch); executed (the execution status of this line is deduced): rowInfo.stretches[row].setUserValue(stretch); | - |
906 | } executed: } Execution Count:44 | 44 |
907 | | - |
908 | int QGridLayoutEngine::rowStretchFactor(int row, Qt::Orientation orientation) const | - |
909 | { | - |
910 | QStretchParameter stretch = q_infos[orientation == Qt::Vertical].stretches.value(row); executed (the execution status of this line is deduced): QStretchParameter stretch = q_infos[orientation == Qt::Vertical].stretches.value(row); | - |
911 | if (!stretch.isDefault()) partially evaluated: !stretch.isDefault() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
912 | return stretch.value(); never executed: return stretch.value(); | 0 |
913 | return 0; executed: return 0; Execution Count:2 | 2 |
914 | } | - |
915 | | - |
916 | void QGridLayoutEngine::setStretchFactor(QGraphicsLayoutItem *layoutItem, int stretch, | - |
917 | Qt::Orientation orientation) | - |
918 | { | - |
919 | Q_ASSERT(stretch >= 0); executed (the execution status of this line is deduced): qt_noop(); | - |
920 | | - |
921 | if (QGridLayoutItem *item = findLayoutItem(layoutItem)) partially evaluated: QGridLayoutItem *item = findLayoutItem(layoutItem) yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
922 | item->setStretchFactor(stretch, orientation); executed: item->setStretchFactor(stretch, orientation); Execution Count:9 | 9 |
923 | } executed: } Execution Count:9 | 9 |
924 | | - |
925 | int QGridLayoutEngine::stretchFactor(QGraphicsLayoutItem *layoutItem, Qt::Orientation orientation) const | - |
926 | { | - |
927 | if (QGridLayoutItem *item = findLayoutItem(layoutItem)) partially evaluated: QGridLayoutItem *item = findLayoutItem(layoutItem) yes Evaluation Count:91 | no Evaluation Count:0 |
| 0-91 |
928 | return item->stretchFactor(orientation); executed: return item->stretchFactor(orientation); Execution Count:91 | 91 |
929 | return 0; never executed: return 0; | 0 |
930 | } | - |
931 | | - |
932 | void QGridLayoutEngine::setRowSizeHint(Qt::SizeHint which, int row, qreal size, | - |
933 | Qt::Orientation orientation) | - |
934 | { | - |
935 | Q_ASSERT(row >= 0); executed (the execution status of this line is deduced): qt_noop(); | - |
936 | Q_ASSERT(size >= 0.0); executed (the execution status of this line is deduced): qt_noop(); | - |
937 | | - |
938 | maybeExpandGrid(row, -1, orientation); executed (the execution status of this line is deduced): maybeExpandGrid(row, -1, orientation); | - |
939 | | - |
940 | QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; executed (the execution status of this line is deduced): QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; | - |
941 | if (row >= rowInfo.boxes.count()) evaluated: row >= rowInfo.boxes.count() yes Evaluation Count:54 | yes Evaluation Count:14 |
| 14-54 |
942 | rowInfo.boxes.resize(row + 1); executed: rowInfo.boxes.resize(row + 1); Execution Count:54 | 54 |
943 | rowInfo.boxes[row].q_sizes(which) = size; executed (the execution status of this line is deduced): rowInfo.boxes[row].q_sizes(which) = size; | - |
944 | } executed: } Execution Count:68 | 68 |
945 | | - |
946 | qreal QGridLayoutEngine::rowSizeHint(Qt::SizeHint which, int row, Qt::Orientation orientation) const | - |
947 | { | - |
948 | return q_infos[orientation == Qt::Vertical].boxes.value(row).q_sizes(which); executed: return q_infos[orientation == Qt::Vertical].boxes.value(row).q_sizes(which); Execution Count:66 | 66 |
949 | } | - |
950 | | - |
951 | void QGridLayoutEngine::setRowAlignment(int row, Qt::Alignment alignment, | - |
952 | Qt::Orientation orientation) | - |
953 | { | - |
954 | Q_ASSERT(row >= 0); executed (the execution status of this line is deduced): qt_noop(); | - |
955 | | - |
956 | maybeExpandGrid(row, -1, orientation); executed (the execution status of this line is deduced): maybeExpandGrid(row, -1, orientation); | - |
957 | | - |
958 | QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; executed (the execution status of this line is deduced): QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; | - |
959 | if (row >= rowInfo.alignments.count()) partially evaluated: row >= rowInfo.alignments.count() yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
960 | rowInfo.alignments.resize(row + 1); executed: rowInfo.alignments.resize(row + 1); Execution Count:16 | 16 |
961 | rowInfo.alignments[row] = alignment; executed (the execution status of this line is deduced): rowInfo.alignments[row] = alignment; | - |
962 | } executed: } Execution Count:16 | 16 |
963 | | - |
964 | Qt::Alignment QGridLayoutEngine::rowAlignment(int row, Qt::Orientation orientation) const | - |
965 | { | - |
966 | Q_ASSERT(row >= 0); executed (the execution status of this line is deduced): qt_noop(); | - |
967 | return q_infos[orientation == Qt::Vertical].alignments.value(row); executed: return q_infos[orientation == Qt::Vertical].alignments.value(row); Execution Count:2302 | 2302 |
968 | } | - |
969 | | - |
970 | void QGridLayoutEngine::setAlignment(QGraphicsLayoutItem *layoutItem, Qt::Alignment alignment) | - |
971 | { | - |
972 | if (QGridLayoutItem *item = findLayoutItem(layoutItem)) evaluated: QGridLayoutItem *item = findLayoutItem(layoutItem) yes Evaluation Count:296 | yes Evaluation Count:3 |
| 3-296 |
973 | item->setAlignment(alignment); executed: item->setAlignment(alignment); Execution Count:296 | 296 |
974 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
975 | } executed: } Execution Count:299 | 299 |
976 | | - |
977 | Qt::Alignment QGridLayoutEngine::alignment(QGraphicsLayoutItem *layoutItem) const | - |
978 | { | - |
979 | if (QGridLayoutItem *item = findLayoutItem(layoutItem)) evaluated: QGridLayoutItem *item = findLayoutItem(layoutItem) yes Evaluation Count:144 | yes Evaluation Count:5 |
| 5-144 |
980 | return item->alignment(); executed: return item->alignment(); Execution Count:144 | 144 |
981 | return 0; executed: return 0; Execution Count:5 | 5 |
982 | } | - |
983 | | - |
984 | Qt::Alignment QGridLayoutEngine::effectiveAlignment(const QGridLayoutItem *layoutItem) const | - |
985 | { | - |
986 | Qt::Alignment align = layoutItem->alignment(); executed (the execution status of this line is deduced): Qt::Alignment align = layoutItem->alignment(); | - |
987 | if (!(align & Qt::AlignVertical_Mask)) { evaluated: !(align & Qt::AlignVertical_Mask) yes Evaluation Count:1157 | yes Evaluation Count:95 |
| 95-1157 |
988 | // no vertical alignment, respect the row alignment | - |
989 | int y = layoutItem->firstRow(); executed (the execution status of this line is deduced): int y = layoutItem->firstRow(); | - |
990 | align |= (rowAlignment(y, Qt::Vertical) & Qt::AlignVertical_Mask); executed (the execution status of this line is deduced): align |= (rowAlignment(y, Qt::Vertical) & Qt::AlignVertical_Mask); | - |
991 | } executed: } Execution Count:1157 | 1157 |
992 | if (!(align & Qt::AlignHorizontal_Mask)) { evaluated: !(align & Qt::AlignHorizontal_Mask) yes Evaluation Count:1125 | yes Evaluation Count:127 |
| 127-1125 |
993 | // no horizontal alignment, respect the column alignment | - |
994 | int x = layoutItem->firstColumn(); executed (the execution status of this line is deduced): int x = layoutItem->firstColumn(); | - |
995 | align |= (rowAlignment(x, Qt::Horizontal) & Qt::AlignHorizontal_Mask); executed (the execution status of this line is deduced): align |= (rowAlignment(x, Qt::Horizontal) & Qt::AlignHorizontal_Mask); | - |
996 | } executed: } Execution Count:1125 | 1125 |
997 | return align; executed: return align; Execution Count:1252 | 1252 |
998 | } | - |
999 | | - |
1000 | /*! | - |
1001 | \internal | - |
1002 | The \a index is only used by QGraphicsLinearLayout to ensure that itemAt() reflects the order | - |
1003 | of visual arrangement. Strictly speaking it does not have to, but most people expect it to. | - |
1004 | (And if it didn't we would have to add itemArrangedAt(int index) or something..) | - |
1005 | */ | - |
1006 | void QGridLayoutEngine::insertItem(QGridLayoutItem *item, int index) | - |
1007 | { | - |
1008 | maybeExpandGrid(item->lastRow(), item->lastColumn()); executed (the execution status of this line is deduced): maybeExpandGrid(item->lastRow(), item->lastColumn()); | - |
1009 | | - |
1010 | if (index == -1) evaluated: index == -1 yes Evaluation Count:705 | yes Evaluation Count:637 |
| 637-705 |
1011 | q_items.append(item); executed: q_items.append(item); Execution Count:705 | 705 |
1012 | else | - |
1013 | q_items.insert(index, item); executed: q_items.insert(index, item); Execution Count:637 | 637 |
1014 | | - |
1015 | for (int i = item->firstRow(); i <= item->lastRow(); ++i) { evaluated: i <= item->lastRow() yes Evaluation Count:1389 | yes Evaluation Count:1342 |
| 1342-1389 |
1016 | for (int j = item->firstColumn(); j <= item->lastColumn(); ++j) { evaluated: j <= item->lastColumn() yes Evaluation Count:1399 | yes Evaluation Count:1389 |
| 1389-1399 |
1017 | if (itemAt(i, j)) partially evaluated: itemAt(i, j) no Evaluation Count:0 | yes Evaluation Count:1399 |
| 0-1399 |
1018 | qWarning("QGridLayoutEngine::addItem: Cell (%d, %d) already taken", i, j); never executed: QMessageLogger("graphicsview/qgridlayoutengine.cpp", 1018, __PRETTY_FUNCTION__).warning("QGridLayoutEngine::addItem: Cell (%d, %d) already taken", i, j); | 0 |
1019 | setItemAt(i, j, item); executed (the execution status of this line is deduced): setItemAt(i, j, item); | - |
1020 | } executed: } Execution Count:1399 | 1399 |
1021 | } executed: } Execution Count:1389 | 1389 |
1022 | } executed: } Execution Count:1342 | 1342 |
1023 | | - |
1024 | void QGridLayoutEngine::addItem(QGridLayoutItem *item) | - |
1025 | { | - |
1026 | insertItem(item, -1); never executed (the execution status of this line is deduced): insertItem(item, -1); | - |
1027 | } | 0 |
1028 | | - |
1029 | void QGridLayoutEngine::removeItem(QGridLayoutItem *item) | - |
1030 | { | - |
1031 | Q_ASSERT(q_items.contains(item)); executed (the execution status of this line is deduced): qt_noop(); | - |
1032 | | - |
1033 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
1034 | | - |
1035 | for (int i = item->firstRow(); i <= item->lastRow(); ++i) { evaluated: i <= item->lastRow() yes Evaluation Count:1134 | yes Evaluation Count:1127 |
| 1127-1134 |
1036 | for (int j = item->firstColumn(); j <= item->lastColumn(); ++j) { evaluated: j <= item->lastColumn() yes Evaluation Count:1138 | yes Evaluation Count:1134 |
| 1134-1138 |
1037 | if (itemAt(i, j) == item) partially evaluated: itemAt(i, j) == item yes Evaluation Count:1138 | no Evaluation Count:0 |
| 0-1138 |
1038 | setItemAt(i, j, 0); executed: setItemAt(i, j, 0); Execution Count:1138 | 1138 |
1039 | } executed: } Execution Count:1138 | 1138 |
1040 | } executed: } Execution Count:1134 | 1134 |
1041 | | - |
1042 | q_items.removeAll(item); executed (the execution status of this line is deduced): q_items.removeAll(item); | - |
1043 | } executed: } Execution Count:1127 | 1127 |
1044 | | - |
1045 | QGridLayoutItem *QGridLayoutEngine::findLayoutItem(QGraphicsLayoutItem *layoutItem) const | - |
1046 | { | - |
1047 | for (int i = q_items.count() - 1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:1266 | yes Evaluation Count:10 |
| 10-1266 |
1048 | QGridLayoutItem *item = q_items.at(i); executed (the execution status of this line is deduced): QGridLayoutItem *item = q_items.at(i); | - |
1049 | if (item->layoutItem() == layoutItem) evaluated: item->layoutItem() == layoutItem yes Evaluation Count:546 | yes Evaluation Count:720 |
| 546-720 |
1050 | return item; executed: return item; Execution Count:546 | 546 |
1051 | } executed: } Execution Count:720 | 720 |
1052 | return 0; executed: return 0; Execution Count:10 | 10 |
1053 | } | - |
1054 | | - |
1055 | QGridLayoutItem *QGridLayoutEngine::itemAt(int row, int column, Qt::Orientation orientation) const | - |
1056 | { | - |
1057 | if (orientation == Qt::Horizontal) evaluated: orientation == Qt::Horizontal yes Evaluation Count:12803 | yes Evaluation Count:14800 |
| 12803-14800 |
1058 | qSwap(row, column); executed: qSwap(row, column); Execution Count:12803 | 12803 |
1059 | if (uint(row) >= uint(rowCount()) || uint(column) >= uint(columnCount())) partially evaluated: uint(row) >= uint(rowCount()) no Evaluation Count:0 | yes Evaluation Count:27603 |
partially evaluated: uint(column) >= uint(columnCount()) no Evaluation Count:0 | yes Evaluation Count:27603 |
| 0-27603 |
1060 | return 0; never executed: return 0; | 0 |
1061 | return q_grid.at((row * internalGridColumnCount()) + column); executed: return q_grid.at((row * internalGridColumnCount()) + column); Execution Count:27603 | 27603 |
1062 | } | - |
1063 | | - |
1064 | void QGridLayoutEngine::invalidate() | - |
1065 | { | - |
1066 | q_cachedEffectiveFirstRows[Hor] = -1; executed (the execution status of this line is deduced): q_cachedEffectiveFirstRows[Hor] = -1; | - |
1067 | q_cachedEffectiveFirstRows[Ver] = -1; executed (the execution status of this line is deduced): q_cachedEffectiveFirstRows[Ver] = -1; | - |
1068 | q_cachedEffectiveLastRows[Hor] = -1; executed (the execution status of this line is deduced): q_cachedEffectiveLastRows[Hor] = -1; | - |
1069 | q_cachedEffectiveLastRows[Ver] = -1; executed (the execution status of this line is deduced): q_cachedEffectiveLastRows[Ver] = -1; | - |
1070 | q_cachedDataForStyleInfo.invalidate(); executed (the execution status of this line is deduced): q_cachedDataForStyleInfo.invalidate(); | - |
1071 | q_cachedSize = QSizeF(); executed (the execution status of this line is deduced): q_cachedSize = QSizeF(); | - |
1072 | q_cachedConstraintOrientation = UnknownConstraint; executed (the execution status of this line is deduced): q_cachedConstraintOrientation = UnknownConstraint; | - |
1073 | } executed: } Execution Count:10393 | 10393 |
1074 | | - |
1075 | static void visualRect(QRectF *geom, Qt::LayoutDirection dir, const QRectF &contentsRect) | - |
1076 | { | - |
1077 | if (dir == Qt::RightToLeft) evaluated: dir == Qt::RightToLeft yes Evaluation Count:10 | yes Evaluation Count:1242 |
| 10-1242 |
1078 | geom->moveRight(contentsRect.right() - (geom->left() - contentsRect.left())); executed: geom->moveRight(contentsRect.right() - (geom->left() - contentsRect.left())); Execution Count:10 | 10 |
1079 | } executed: } Execution Count:1252 | 1252 |
1080 | | - |
1081 | void QGridLayoutEngine::setGeometries(const QLayoutStyleInfo &styleInfo, | - |
1082 | const QRectF &contentsGeometry) | - |
1083 | { | - |
1084 | if (rowCount() < 1 || columnCount() < 1) evaluated: rowCount() < 1 yes Evaluation Count:52 | yes Evaluation Count:445 |
evaluated: columnCount() < 1 yes Evaluation Count:2 | yes Evaluation Count:443 |
| 2-445 |
1085 | return; executed: return; Execution Count:54 | 54 |
1086 | | - |
1087 | ensureGeometries(styleInfo, contentsGeometry.size()); executed (the execution status of this line is deduced): ensureGeometries(styleInfo, contentsGeometry.size()); | - |
1088 | | - |
1089 | for (int i = q_items.count() - 1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:1252 | yes Evaluation Count:443 |
| 443-1252 |
1090 | QGridLayoutItem *item = q_items.at(i); executed (the execution status of this line is deduced): QGridLayoutItem *item = q_items.at(i); | - |
1091 | | - |
1092 | qreal x = q_xx[item->firstColumn()]; executed (the execution status of this line is deduced): qreal x = q_xx[item->firstColumn()]; | - |
1093 | qreal y = q_yy[item->firstRow()]; executed (the execution status of this line is deduced): qreal y = q_yy[item->firstRow()]; | - |
1094 | qreal width = q_widths[item->lastColumn()]; executed (the execution status of this line is deduced): qreal width = q_widths[item->lastColumn()]; | - |
1095 | qreal height = q_heights[item->lastRow()]; executed (the execution status of this line is deduced): qreal height = q_heights[item->lastRow()]; | - |
1096 | | - |
1097 | if (item->columnSpan() != 1) evaluated: item->columnSpan() != 1 yes Evaluation Count:4 | yes Evaluation Count:1248 |
| 4-1248 |
1098 | width += q_xx[item->lastColumn()] - x; executed: width += q_xx[item->lastColumn()] - x; Execution Count:4 | 4 |
1099 | if (item->rowSpan() != 1) evaluated: item->rowSpan() != 1 yes Evaluation Count:24 | yes Evaluation Count:1228 |
| 24-1228 |
1100 | height += q_yy[item->lastRow()] - y; executed: height += q_yy[item->lastRow()] - y; Execution Count:24 | 24 |
1101 | | - |
1102 | QRectF geom = item->geometryWithin(contentsGeometry.x() + x, contentsGeometry.y() + y, executed (the execution status of this line is deduced): QRectF geom = item->geometryWithin(contentsGeometry.x() + x, contentsGeometry.y() + y, | - |
1103 | width, height, q_descents[item->lastRow()]); executed (the execution status of this line is deduced): width, height, q_descents[item->lastRow()]); | - |
1104 | visualRect(&geom, visualDirection(), contentsGeometry); executed (the execution status of this line is deduced): visualRect(&geom, visualDirection(), contentsGeometry); | - |
1105 | item->setGeometry(geom); executed (the execution status of this line is deduced): item->setGeometry(geom); | - |
1106 | } executed: } Execution Count:1252 | 1252 |
1107 | } executed: } Execution Count:443 | 443 |
1108 | | - |
1109 | // ### candidate for deletion | - |
1110 | QRectF QGridLayoutEngine::cellRect(const QLayoutStyleInfo &styleInfo, | - |
1111 | const QRectF &contentsGeometry, int row, int column, int rowSpan, | - |
1112 | int columnSpan) const | - |
1113 | { | - |
1114 | if (uint(row) >= uint(rowCount()) || uint(column) >= uint(columnCount()) never evaluated: uint(row) >= uint(rowCount()) never evaluated: uint(column) >= uint(columnCount()) | 0 |
1115 | || rowSpan < 1 || columnSpan < 1) never evaluated: rowSpan < 1 never evaluated: columnSpan < 1 | 0 |
1116 | return QRectF(); never executed: return QRectF(); | 0 |
1117 | | - |
1118 | ensureGeometries(styleInfo, contentsGeometry.size()); never executed (the execution status of this line is deduced): ensureGeometries(styleInfo, contentsGeometry.size()); | - |
1119 | | - |
1120 | int lastColumn = qMax(column + columnSpan, columnCount()) - 1; never executed (the execution status of this line is deduced): int lastColumn = qMax(column + columnSpan, columnCount()) - 1; | - |
1121 | int lastRow = qMax(row + rowSpan, rowCount()) - 1; never executed (the execution status of this line is deduced): int lastRow = qMax(row + rowSpan, rowCount()) - 1; | - |
1122 | | - |
1123 | qreal x = q_xx[column]; never executed (the execution status of this line is deduced): qreal x = q_xx[column]; | - |
1124 | qreal y = q_yy[row]; never executed (the execution status of this line is deduced): qreal y = q_yy[row]; | - |
1125 | qreal width = q_widths[lastColumn]; never executed (the execution status of this line is deduced): qreal width = q_widths[lastColumn]; | - |
1126 | qreal height = q_heights[lastRow]; never executed (the execution status of this line is deduced): qreal height = q_heights[lastRow]; | - |
1127 | | - |
1128 | if (columnSpan != 1) never evaluated: columnSpan != 1 | 0 |
1129 | width += q_xx[lastColumn] - x; never executed: width += q_xx[lastColumn] - x; | 0 |
1130 | if (rowSpan != 1) never evaluated: rowSpan != 1 | 0 |
1131 | height += q_yy[lastRow] - y; never executed: height += q_yy[lastRow] - y; | 0 |
1132 | | - |
1133 | return QRectF(contentsGeometry.x() + x, contentsGeometry.y() + y, width, height); never executed: return QRectF(contentsGeometry.x() + x, contentsGeometry.y() + y, width, height); | 0 |
1134 | } | - |
1135 | | - |
1136 | QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHint which, | - |
1137 | const QSizeF &constraint) const | - |
1138 | { | - |
1139 | QGridLayoutBox sizehint_totalBoxes[NOrientations]; executed (the execution status of this line is deduced): QGridLayoutBox sizehint_totalBoxes[NOrientations]; | - |
1140 | | - |
1141 | bool sizeHintCalculated = false; executed (the execution status of this line is deduced): bool sizeHintCalculated = false; | - |
1142 | | - |
1143 | if (hasDynamicConstraint() && rowCount() > 0 && columnCount() > 0) { evaluated: hasDynamicConstraint() yes Evaluation Count:190 | yes Evaluation Count:1331 |
partially evaluated: rowCount() > 0 yes Evaluation Count:190 | no Evaluation Count:0 |
partially evaluated: columnCount() > 0 yes Evaluation Count:190 | no Evaluation Count:0 |
| 0-1331 |
1144 | if (constraintOrientation() == Qt::Vertical) { evaluated: constraintOrientation() == Qt::Vertical yes Evaluation Count:163 | yes Evaluation Count:27 |
| 27-163 |
1145 | //We have items whose height depends on their width | - |
1146 | if (constraint.width() >= 0) { evaluated: constraint.width() >= 0 yes Evaluation Count:18 | yes Evaluation Count:145 |
| 18-145 |
1147 | if (q_cachedDataForStyleInfo != styleInfo) partially evaluated: q_cachedDataForStyleInfo != styleInfo yes Evaluation Count:18 | no Evaluation Count:0 |
| 0-18 |
1148 | ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); executed: ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, __null, __null, Qt::Horizontal); Execution Count:18 | 18 |
1149 | else | - |
1150 | sizehint_totalBoxes[Hor] = q_totalBoxes[Hor]; never executed: sizehint_totalBoxes[Hor] = q_totalBoxes[Hor]; | 0 |
1151 | QVector<qreal> sizehint_xx; executed (the execution status of this line is deduced): QVector<qreal> sizehint_xx; | - |
1152 | QVector<qreal> sizehint_widths; executed (the execution status of this line is deduced): QVector<qreal> sizehint_widths; | - |
1153 | | - |
1154 | sizehint_xx.resize(columnCount()); executed (the execution status of this line is deduced): sizehint_xx.resize(columnCount()); | - |
1155 | sizehint_widths.resize(columnCount()); executed (the execution status of this line is deduced): sizehint_widths.resize(columnCount()); | - |
1156 | qreal width = constraint.width(); executed (the execution status of this line is deduced): qreal width = constraint.width(); | - |
1157 | //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as | - |
1158 | //constraints to find the row heights | - |
1159 | q_columnData.calculateGeometries(0, columnCount(), width, sizehint_xx.data(), sizehint_widths.data(), executed (the execution status of this line is deduced): q_columnData.calculateGeometries(0, columnCount(), width, sizehint_xx.data(), sizehint_widths.data(), | - |
1160 | 0, sizehint_totalBoxes[Hor], q_infos[Hor]); executed (the execution status of this line is deduced): 0, sizehint_totalBoxes[Hor], q_infos[Hor]); | - |
1161 | ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical); executed (the execution status of this line is deduced): ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical); | - |
1162 | sizeHintCalculated = true; executed (the execution status of this line is deduced): sizeHintCalculated = true; | - |
1163 | } executed: } Execution Count:18 | 18 |
1164 | } else { executed: } Execution Count:163 | 163 |
1165 | if (constraint.height() >= 0) { evaluated: constraint.height() >= 0 yes Evaluation Count:12 | yes Evaluation Count:15 |
| 12-15 |
1166 | //We have items whose width depends on their height | - |
1167 | ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); executed (the execution status of this line is deduced): ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, __null, __null, Qt::Vertical); | - |
1168 | QVector<qreal> sizehint_yy; executed (the execution status of this line is deduced): QVector<qreal> sizehint_yy; | - |
1169 | QVector<qreal> sizehint_heights; executed (the execution status of this line is deduced): QVector<qreal> sizehint_heights; | - |
1170 | | - |
1171 | sizehint_yy.resize(rowCount()); executed (the execution status of this line is deduced): sizehint_yy.resize(rowCount()); | - |
1172 | sizehint_heights.resize(rowCount()); executed (the execution status of this line is deduced): sizehint_heights.resize(rowCount()); | - |
1173 | qreal height = constraint.height(); executed (the execution status of this line is deduced): qreal height = constraint.height(); | - |
1174 | //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as | - |
1175 | //constraints to find the column widths | - |
1176 | q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(), executed (the execution status of this line is deduced): q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(), | - |
1177 | 0, sizehint_totalBoxes[Ver], q_infos[Ver]); executed (the execution status of this line is deduced): 0, sizehint_totalBoxes[Ver], q_infos[Ver]); | - |
1178 | ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, sizehint_yy.data(), sizehint_heights.data(), Qt::Horizontal); executed (the execution status of this line is deduced): ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, sizehint_yy.data(), sizehint_heights.data(), Qt::Horizontal); | - |
1179 | sizeHintCalculated = true; executed (the execution status of this line is deduced): sizeHintCalculated = true; | - |
1180 | } executed: } Execution Count:12 | 12 |
1181 | } executed: } Execution Count:27 | 27 |
1182 | } | - |
1183 | | - |
1184 | if (!sizeHintCalculated) { evaluated: !sizeHintCalculated yes Evaluation Count:1491 | yes Evaluation Count:30 |
| 30-1491 |
1185 | //No items with height for width, so it doesn't matter which order we do these in | - |
1186 | if (q_cachedDataForStyleInfo != styleInfo) { evaluated: q_cachedDataForStyleInfo != styleInfo yes Evaluation Count:1455 | yes Evaluation Count:36 |
| 36-1455 |
1187 | ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); executed (the execution status of this line is deduced): ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, __null, __null, Qt::Horizontal); | - |
1188 | ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); executed (the execution status of this line is deduced): ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, __null, __null, Qt::Vertical); | - |
1189 | } else { executed: } Execution Count:1455 | 1455 |
1190 | sizehint_totalBoxes[Hor] = q_totalBoxes[Hor]; executed (the execution status of this line is deduced): sizehint_totalBoxes[Hor] = q_totalBoxes[Hor]; | - |
1191 | sizehint_totalBoxes[Ver] = q_totalBoxes[Ver]; executed (the execution status of this line is deduced): sizehint_totalBoxes[Ver] = q_totalBoxes[Ver]; | - |
1192 | } executed: } Execution Count:36 | 36 |
1193 | } | - |
1194 | | - |
1195 | switch (which) { | - |
1196 | case Qt::MinimumSize: | - |
1197 | return QSizeF(sizehint_totalBoxes[Hor].q_minimumSize, sizehint_totalBoxes[Ver].q_minimumSize); executed: return QSizeF(sizehint_totalBoxes[Hor].q_minimumSize, sizehint_totalBoxes[Ver].q_minimumSize); Execution Count:431 | 431 |
1198 | case Qt::PreferredSize: | - |
1199 | return QSizeF(sizehint_totalBoxes[Hor].q_preferredSize, sizehint_totalBoxes[Ver].q_preferredSize); executed: return QSizeF(sizehint_totalBoxes[Hor].q_preferredSize, sizehint_totalBoxes[Ver].q_preferredSize); Execution Count:673 | 673 |
1200 | case Qt::MaximumSize: | - |
1201 | return QSizeF(sizehint_totalBoxes[Hor].q_maximumSize, sizehint_totalBoxes[Ver].q_maximumSize); executed: return QSizeF(sizehint_totalBoxes[Hor].q_maximumSize, sizehint_totalBoxes[Ver].q_maximumSize); Execution Count:417 | 417 |
1202 | case Qt::MinimumDescent: | - |
1203 | return QSizeF(-1.0, sizehint_totalBoxes[Hor].q_minimumDescent); // ### doesn't work never executed: return QSizeF(-1.0, sizehint_totalBoxes[Hor].q_minimumDescent); | 0 |
1204 | default: | - |
1205 | break; | 0 |
1206 | } | - |
1207 | return QSizeF(); never executed: return QSizeF(); | 0 |
1208 | } | - |
1209 | | - |
1210 | QSizePolicy::ControlTypes QGridLayoutEngine::controlTypes(LayoutSide side) const | - |
1211 | { | - |
1212 | Qt::Orientation orientation = (side == Top || side == Bottom) ? Qt::Vertical : Qt::Horizontal; never evaluated: side == Top never evaluated: side == Bottom | 0 |
1213 | int row = (side == Top || side == Left) ? effectiveFirstRow(orientation) never evaluated: side == Top never evaluated: side == Left | 0 |
1214 | : effectiveLastRow(orientation); never executed (the execution status of this line is deduced): : effectiveLastRow(orientation); | - |
1215 | QSizePolicy::ControlTypes result = 0; never executed (the execution status of this line is deduced): QSizePolicy::ControlTypes result = 0; | - |
1216 | | - |
1217 | for (int column = columnCount(orientation) - 1; column >= 0; --column) { never evaluated: column >= 0 | 0 |
1218 | if (QGridLayoutItem *item = itemAt(row, column, orientation)) never evaluated: QGridLayoutItem *item = itemAt(row, column, orientation) | 0 |
1219 | result |= item->controlTypes(side); never executed: result |= item->controlTypes(side); | 0 |
1220 | } | 0 |
1221 | return result; never executed: return result; | 0 |
1222 | } | - |
1223 | | - |
1224 | void QGridLayoutEngine::transpose() | - |
1225 | { | - |
1226 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
1227 | | - |
1228 | for (int i = q_items.count() - 1; i >= 0; --i) evaluated: i >= 0 yes Evaluation Count:9 | yes Evaluation Count:8 |
| 8-9 |
1229 | q_items.at(i)->transpose(); executed: q_items.at(i)->transpose(); Execution Count:9 | 9 |
1230 | | - |
1231 | qSwap(q_defaultSpacings[Hor], q_defaultSpacings[Ver]); executed (the execution status of this line is deduced): qSwap(q_defaultSpacings[Hor], q_defaultSpacings[Ver]); | - |
1232 | qSwap(q_infos[Hor], q_infos[Ver]); executed (the execution status of this line is deduced): qSwap(q_infos[Hor], q_infos[Ver]); | - |
1233 | | - |
1234 | regenerateGrid(); executed (the execution status of this line is deduced): regenerateGrid(); | - |
1235 | } executed: } Execution Count:8 | 8 |
1236 | | - |
1237 | void QGridLayoutEngine::setVisualDirection(Qt::LayoutDirection direction) | - |
1238 | { | - |
1239 | m_visualDirection = direction; executed (the execution status of this line is deduced): m_visualDirection = direction; | - |
1240 | } executed: } Execution Count:497 | 497 |
1241 | | - |
1242 | Qt::LayoutDirection QGridLayoutEngine::visualDirection() const | - |
1243 | { | - |
1244 | return m_visualDirection; executed: return m_visualDirection; Execution Count:1252 | 1252 |
1245 | } | - |
1246 | | - |
1247 | #ifdef QT_DEBUG | - |
1248 | void QGridLayoutEngine::dump(int indent) const | - |
1249 | { | - |
1250 | qDebug("%*sEngine", indent, ""); | - |
1251 | | - |
1252 | qDebug("%*s Items (%d)", indent, "", q_items.count()); | - |
1253 | int i; | - |
1254 | for (i = 0; i < q_items.count(); ++i) | - |
1255 | q_items.at(i)->dump(indent + 2); | - |
1256 | | - |
1257 | qDebug("%*s Grid (%d x %d)", indent, "", internalGridRowCount(), | - |
1258 | internalGridColumnCount()); | - |
1259 | for (int row = 0; row < internalGridRowCount(); ++row) { | - |
1260 | QString message = QLatin1String("[ "); | - |
1261 | for (int column = 0; column < internalGridColumnCount(); ++column) { | - |
1262 | message += QString::number(q_items.indexOf(itemAt(row, column))).rightJustified(3); | - |
1263 | message += QLatin1Char(' '); | - |
1264 | } | - |
1265 | message += QLatin1Char(']'); | - |
1266 | qDebug("%*s %s", indent, "", qPrintable(message)); | - |
1267 | } | - |
1268 | | - |
1269 | if (q_defaultSpacings[Hor].value() >= 0.0 || q_defaultSpacings[Ver].value() >= 0.0) | - |
1270 | qDebug("%*s Default spacings: %g %g", indent, "", q_defaultSpacings[Hor].value(), | - |
1271 | q_defaultSpacings[Ver].value()); | - |
1272 | | - |
1273 | qDebug("%*s Column and row info", indent, ""); | - |
1274 | q_infos[Hor].dump(indent + 2); | - |
1275 | q_infos[Ver].dump(indent + 2); | - |
1276 | | - |
1277 | qDebug("%*s Column and row data", indent, ""); | - |
1278 | q_columnData.dump(indent + 2); | - |
1279 | q_rowData.dump(indent + 2); | - |
1280 | | - |
1281 | qDebug("%*s Geometries output", indent, ""); | - |
1282 | QVector<qreal> *cellPos = &q_yy; | - |
1283 | for (int pass = 0; pass < 2; ++pass) { | - |
1284 | QString message; | - |
1285 | for (i = 0; i < cellPos->count(); ++i) { | - |
1286 | message += QLatin1String((message.isEmpty() ? "[" : ", ")); | - |
1287 | message += QString::number(cellPos->at(i)); | - |
1288 | } | - |
1289 | message += QLatin1Char(']'); | - |
1290 | qDebug("%*s %s %s", indent, "", (pass == 0 ? "rows:" : "columns:"), qPrintable(message)); | - |
1291 | cellPos = &q_xx; | - |
1292 | } | - |
1293 | } | - |
1294 | #endif | - |
1295 | | - |
1296 | void QGridLayoutEngine::maybeExpandGrid(int row, int column, Qt::Orientation orientation) | - |
1297 | { | - |
1298 | invalidate(); // ### move out of here? executed (the execution status of this line is deduced): invalidate(); | - |
1299 | | - |
1300 | if (orientation == Qt::Horizontal) evaluated: orientation == Qt::Horizontal yes Evaluation Count:613 | yes Evaluation Count:1497 |
| 613-1497 |
1301 | qSwap(row, column); executed: qSwap(row, column); Execution Count:613 | 613 |
1302 | | - |
1303 | if (row < rowCount() && column < columnCount()) evaluated: row < rowCount() yes Evaluation Count:1559 | yes Evaluation Count:551 |
evaluated: column < columnCount() yes Evaluation Count:765 | yes Evaluation Count:794 |
| 551-1559 |
1304 | return; executed: return; Execution Count:765 | 765 |
1305 | | - |
1306 | int oldGridRowCount = internalGridRowCount(); executed (the execution status of this line is deduced): int oldGridRowCount = internalGridRowCount(); | - |
1307 | int oldGridColumnCount = internalGridColumnCount(); executed (the execution status of this line is deduced): int oldGridColumnCount = internalGridColumnCount(); | - |
1308 | | - |
1309 | q_infos[Ver].count = qMax(row + 1, rowCount()); executed (the execution status of this line is deduced): q_infos[Ver].count = qMax(row + 1, rowCount()); | - |
1310 | q_infos[Hor].count = qMax(column + 1, columnCount()); executed (the execution status of this line is deduced): q_infos[Hor].count = qMax(column + 1, columnCount()); | - |
1311 | | - |
1312 | int newGridRowCount = internalGridRowCount(); executed (the execution status of this line is deduced): int newGridRowCount = internalGridRowCount(); | - |
1313 | int newGridColumnCount = internalGridColumnCount(); executed (the execution status of this line is deduced): int newGridColumnCount = internalGridColumnCount(); | - |
1314 | | - |
1315 | int newGridSize = newGridRowCount * newGridColumnCount; executed (the execution status of this line is deduced): int newGridSize = newGridRowCount * newGridColumnCount; | - |
1316 | if (newGridSize != q_grid.count()) { evaluated: newGridSize != q_grid.count() yes Evaluation Count:773 | yes Evaluation Count:572 |
| 572-773 |
1317 | q_grid.resize(newGridSize); executed (the execution status of this line is deduced): q_grid.resize(newGridSize); | - |
1318 | | - |
1319 | if (newGridColumnCount != oldGridColumnCount) { evaluated: newGridColumnCount != oldGridColumnCount yes Evaluation Count:281 | yes Evaluation Count:492 |
| 281-492 |
1320 | for (int i = oldGridRowCount - 1; i >= 1; --i) { evaluated: i >= 1 yes Evaluation Count:168 | yes Evaluation Count:281 |
| 168-281 |
1321 | for (int j = oldGridColumnCount - 1; j >= 0; --j) { evaluated: j >= 0 yes Evaluation Count:168 | yes Evaluation Count:168 |
| 168 |
1322 | int oldIndex = (i * oldGridColumnCount) + j; executed (the execution status of this line is deduced): int oldIndex = (i * oldGridColumnCount) + j; | - |
1323 | int newIndex = (i * newGridColumnCount) + j; executed (the execution status of this line is deduced): int newIndex = (i * newGridColumnCount) + j; | - |
1324 | | - |
1325 | Q_ASSERT(newIndex > oldIndex); executed (the execution status of this line is deduced): qt_noop(); | - |
1326 | q_grid[newIndex] = q_grid[oldIndex]; executed (the execution status of this line is deduced): q_grid[newIndex] = q_grid[oldIndex]; | - |
1327 | q_grid[oldIndex] = 0; executed (the execution status of this line is deduced): q_grid[oldIndex] = 0; | - |
1328 | } executed: } Execution Count:168 | 168 |
1329 | } executed: } Execution Count:168 | 168 |
1330 | } executed: } Execution Count:281 | 281 |
1331 | } executed: } Execution Count:773 | 773 |
1332 | } executed: } Execution Count:1345 | 1345 |
1333 | | - |
1334 | void QGridLayoutEngine::regenerateGrid() | - |
1335 | { | - |
1336 | q_grid.fill(0); executed (the execution status of this line is deduced): q_grid.fill(0); | - |
1337 | | - |
1338 | for (int i = q_items.count() - 1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:3245 | yes Evaluation Count:1498 |
| 1498-3245 |
1339 | QGridLayoutItem *item = q_items.at(i); executed (the execution status of this line is deduced): QGridLayoutItem *item = q_items.at(i); | - |
1340 | | - |
1341 | for (int j = item->firstRow(); j <= item->lastRow(); ++j) { evaluated: j <= item->lastRow() yes Evaluation Count:3266 | yes Evaluation Count:3245 |
| 3245-3266 |
1342 | for (int k = item->firstColumn(); k <= item->lastColumn(); ++k) { evaluated: k <= item->lastColumn() yes Evaluation Count:3278 | yes Evaluation Count:3266 |
| 3266-3278 |
1343 | setItemAt(j, k, item); executed (the execution status of this line is deduced): setItemAt(j, k, item); | - |
1344 | } executed: } Execution Count:3278 | 3278 |
1345 | } executed: } Execution Count:3266 | 3266 |
1346 | } executed: } Execution Count:3245 | 3245 |
1347 | } executed: } Execution Count:1498 | 1498 |
1348 | | - |
1349 | void QGridLayoutEngine::setItemAt(int row, int column, QGridLayoutItem *item) | - |
1350 | { | - |
1351 | Q_ASSERT(row >= 0 && row < rowCount()); executed (the execution status of this line is deduced): qt_noop(); | - |
1352 | Q_ASSERT(column >= 0 && column < columnCount()); executed (the execution status of this line is deduced): qt_noop(); | - |
1353 | q_grid[(row * internalGridColumnCount()) + column] = item; executed (the execution status of this line is deduced): q_grid[(row * internalGridColumnCount()) + column] = item; | - |
1354 | } executed: } Execution Count:5815 | 5815 |
1355 | | - |
1356 | void QGridLayoutEngine::insertOrRemoveRows(int row, int delta, Qt::Orientation orientation) | - |
1357 | { | - |
1358 | int oldRowCount = rowCount(orientation); executed (the execution status of this line is deduced): int oldRowCount = rowCount(orientation); | - |
1359 | Q_ASSERT(uint(row) <= uint(oldRowCount)); executed (the execution status of this line is deduced): qt_noop(); | - |
1360 | | - |
1361 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
1362 | | - |
1363 | // appending rows (or columns) is easy | - |
1364 | if (row == oldRowCount && delta > 0) { evaluated: row == oldRowCount yes Evaluation Count:1021 | yes Evaluation Count:1109 |
evaluated: delta > 0 yes Evaluation Count:640 | yes Evaluation Count:381 |
| 381-1109 |
1365 | maybeExpandGrid(oldRowCount + delta - 1, -1, orientation); executed (the execution status of this line is deduced): maybeExpandGrid(oldRowCount + delta - 1, -1, orientation); | - |
1366 | return; executed: return; Execution Count:640 | 640 |
1367 | } | - |
1368 | | - |
1369 | q_infos[orientation == Qt::Vertical].insertOrRemoveRows(row, delta); executed (the execution status of this line is deduced): q_infos[orientation == Qt::Vertical].insertOrRemoveRows(row, delta); | - |
1370 | | - |
1371 | for (int i = q_items.count() - 1; i >= 0; --i) evaluated: i >= 0 yes Evaluation Count:3236 | yes Evaluation Count:1490 |
| 1490-3236 |
1372 | q_items.at(i)->insertOrRemoveRows(row, delta, orientation); executed: q_items.at(i)->insertOrRemoveRows(row, delta, orientation); Execution Count:3236 | 3236 |
1373 | | - |
1374 | q_grid.resize(internalGridRowCount() * internalGridColumnCount()); executed (the execution status of this line is deduced): q_grid.resize(internalGridRowCount() * internalGridColumnCount()); | - |
1375 | regenerateGrid(); executed (the execution status of this line is deduced): regenerateGrid(); | - |
1376 | } executed: } Execution Count:1490 | 1490 |
1377 | | - |
1378 | void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutStyleInfo &styleInfo, | - |
1379 | qreal *colPositions, qreal *colSizes, | - |
1380 | Qt::Orientation orientation) const | - |
1381 | { | - |
1382 | const int ButtonMask = QSizePolicy::ButtonBox | QSizePolicy::PushButton; executed (the execution status of this line is deduced): const int ButtonMask = QSizePolicy::ButtonBox | QSizePolicy::PushButton; | - |
1383 | const QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; executed (the execution status of this line is deduced): const QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; | - |
1384 | const QGridLayoutRowInfo &columnInfo = q_infos[orientation == Qt::Horizontal]; executed (the execution status of this line is deduced): const QGridLayoutRowInfo &columnInfo = q_infos[orientation == Qt::Horizontal]; | - |
1385 | LayoutSide top = (orientation == Qt::Vertical) ? Top : Left; evaluated: (orientation == Qt::Vertical) yes Evaluation Count:1850 | yes Evaluation Count:1850 |
| 1850 |
1386 | LayoutSide bottom = (orientation == Qt::Vertical) ? Bottom : Right; evaluated: (orientation == Qt::Vertical) yes Evaluation Count:1850 | yes Evaluation Count:1850 |
| 1850 |
1387 | | - |
1388 | QStyle *style = styleInfo.style(); executed (the execution status of this line is deduced): QStyle *style = styleInfo.style(); | - |
1389 | QStyleOption option; executed (the execution status of this line is deduced): QStyleOption option; | - |
1390 | option.initFrom(styleInfo.widget()); executed (the execution status of this line is deduced): option.initFrom(styleInfo.widget()); | - |
1391 | | - |
1392 | const QLayoutParameter<qreal> &defaultSpacing = q_defaultSpacings[orientation == Qt::Vertical]; executed (the execution status of this line is deduced): const QLayoutParameter<qreal> &defaultSpacing = q_defaultSpacings[orientation == Qt::Vertical]; | - |
1393 | qreal innerSpacing = 0.0; executed (the execution status of this line is deduced): qreal innerSpacing = 0.0; | - |
1394 | if (style) partially evaluated: style yes Evaluation Count:3700 | no Evaluation Count:0 |
| 0-3700 |
1395 | innerSpacing = (qreal)style->pixelMetric(orientation == Qt::Vertical ? QStyle::PM_LayoutVerticalSpacing executed: innerSpacing = (qreal)style->pixelMetric(orientation == Qt::Vertical ? QStyle::PM_LayoutVerticalSpacing : QStyle::PM_LayoutHorizontalSpacing, &option, styleInfo.widget()); Execution Count:3700 | 3700 |
1396 | : QStyle::PM_LayoutHorizontalSpacing, executed: innerSpacing = (qreal)style->pixelMetric(orientation == Qt::Vertical ? QStyle::PM_LayoutVerticalSpacing : QStyle::PM_LayoutHorizontalSpacing, &option, styleInfo.widget()); Execution Count:3700 | 3700 |
1397 | &option, styleInfo.widget()); executed: innerSpacing = (qreal)style->pixelMetric(orientation == Qt::Vertical ? QStyle::PM_LayoutVerticalSpacing : QStyle::PM_LayoutHorizontalSpacing, &option, styleInfo.widget()); Execution Count:3700 | 3700 |
1398 | if (innerSpacing >= 0.0) partially evaluated: innerSpacing >= 0.0 yes Evaluation Count:3700 | no Evaluation Count:0 |
| 0-3700 |
1399 | defaultSpacing.setCachedValue(innerSpacing); executed: defaultSpacing.setCachedValue(innerSpacing); Execution Count:3700 | 3700 |
1400 | | - |
1401 | for (int row = 0; row < rowInfo.count; ++row) { evaluated: row < rowInfo.count yes Evaluation Count:5981 | yes Evaluation Count:3700 |
| 3700-5981 |
1402 | bool rowIsEmpty = true; executed (the execution status of this line is deduced): bool rowIsEmpty = true; | - |
1403 | bool rowIsIdenticalToPrevious = (row > 0); executed (the execution status of this line is deduced): bool rowIsIdenticalToPrevious = (row > 0); | - |
1404 | | - |
1405 | for (int column = 0; column < columnInfo.count; ++column) { evaluated: column < columnInfo.count yes Evaluation Count:10864 | yes Evaluation Count:5981 |
| 5981-10864 |
1406 | QGridLayoutItem *item = itemAt(row, column, orientation); executed (the execution status of this line is deduced): QGridLayoutItem *item = itemAt(row, column, orientation); | - |
1407 | | - |
1408 | if (rowIsIdenticalToPrevious && item != itemAt(row - 1, column, orientation)) evaluated: rowIsIdenticalToPrevious yes Evaluation Count:3108 | yes Evaluation Count:7756 |
evaluated: item != itemAt(row - 1, column, orientation) yes Evaluation Count:2912 | yes Evaluation Count:196 |
| 196-7756 |
1409 | rowIsIdenticalToPrevious = false; executed: rowIsIdenticalToPrevious = false; Execution Count:2912 | 2912 |
1410 | | - |
1411 | if (item) evaluated: item yes Evaluation Count:10628 | yes Evaluation Count:236 |
| 236-10628 |
1412 | rowIsEmpty = false; executed: rowIsEmpty = false; Execution Count:10628 | 10628 |
1413 | } executed: } Execution Count:10864 | 10864 |
1414 | | - |
1415 | if ((rowIsEmpty || rowIsIdenticalToPrevious) evaluated: rowIsEmpty yes Evaluation Count:153 | yes Evaluation Count:5828 |
evaluated: rowIsIdenticalToPrevious yes Evaluation Count:26 | yes Evaluation Count:5802 |
| 26-5828 |
1416 | && rowInfo.spacings.value(row).isDefault() evaluated: rowInfo.spacings.value(row).isDefault() yes Evaluation Count:174 | yes Evaluation Count:5 |
| 5-174 |
1417 | && rowInfo.stretches.value(row).isDefault() evaluated: rowInfo.stretches.value(row).isDefault() yes Evaluation Count:32 | yes Evaluation Count:142 |
| 32-142 |
1418 | && rowInfo.boxes.value(row) == QGridLayoutBox()) partially evaluated: rowInfo.boxes.value(row) == QGridLayoutBox() yes Evaluation Count:32 | no Evaluation Count:0 |
| 0-32 |
1419 | rowData->ignore.setBit(row, true); executed: rowData->ignore.setBit(row, true); Execution Count:32 | 32 |
1420 | | - |
1421 | if (rowInfo.spacings.value(row).isUser()) { evaluated: rowInfo.spacings.value(row).isUser() yes Evaluation Count:171 | yes Evaluation Count:5810 |
| 171-5810 |
1422 | rowData->spacings[row] = rowInfo.spacings.at(row).value(); executed (the execution status of this line is deduced): rowData->spacings[row] = rowInfo.spacings.at(row).value(); | - |
1423 | } else if (!defaultSpacing.isDefault()) { executed: } Execution Count:171 partially evaluated: !defaultSpacing.isDefault() yes Evaluation Count:5810 | no Evaluation Count:0 |
| 0-5810 |
1424 | rowData->spacings[row] = defaultSpacing.value(); executed (the execution status of this line is deduced): rowData->spacings[row] = defaultSpacing.value(); | - |
1425 | } executed: } Execution Count:5810 | 5810 |
1426 | | - |
1427 | rowData->stretches[row] = rowInfo.stretches.value(row).value(); executed (the execution status of this line is deduced): rowData->stretches[row] = rowInfo.stretches.value(row).value(); | - |
1428 | } executed: } Execution Count:5981 | 5981 |
1429 | | - |
1430 | struct RowAdHocData { executed (the execution status of this line is deduced): struct RowAdHocData { | - |
1431 | int q_row; executed (the execution status of this line is deduced): int q_row; | - |
1432 | unsigned int q_hasButtons : 8; executed (the execution status of this line is deduced): unsigned int q_hasButtons : 8; | - |
1433 | unsigned int q_hasNonButtons : 8; executed (the execution status of this line is deduced): unsigned int q_hasNonButtons : 8; | - |
1434 | executed (the execution status of this line is deduced):
| - |
1435 | inline RowAdHocData() : q_row(-1), q_hasButtons(false), q_hasNonButtons(false) {} executed: } Execution Count:11100 | 11100 |
1436 | inline void init(int row) { executed (the execution status of this line is deduced): inline void init(int row) { | - |
1437 | this->q_row = row; executed (the execution status of this line is deduced): this->q_row = row; | - |
1438 | q_hasButtons = false; executed (the execution status of this line is deduced): q_hasButtons = false; | - |
1439 | q_hasNonButtons = false; executed (the execution status of this line is deduced): q_hasNonButtons = false; | - |
1440 | } executed: } Execution Count:5949 | 5949 |
1441 | inline bool hasOnlyButtons() const { return q_hasButtons && !q_hasNonButtons; } executed: return q_hasButtons && !q_hasNonButtons; Execution Count:7400 | 7400 |
1442 | inline bool hasOnlyNonButtons() const { return q_hasNonButtons && !q_hasButtons; } never executed: return q_hasNonButtons && !q_hasButtons; | 0 |
1443 | }; executed (the execution status of this line is deduced): }; | - |
1444 | RowAdHocData lastRowAdHocData; executed (the execution status of this line is deduced): RowAdHocData lastRowAdHocData; | - |
1445 | RowAdHocData nextToLastRowAdHocData; executed (the execution status of this line is deduced): RowAdHocData nextToLastRowAdHocData; | - |
1446 | RowAdHocData nextToNextToLastRowAdHocData; executed (the execution status of this line is deduced): RowAdHocData nextToNextToLastRowAdHocData; | - |
1447 | | - |
1448 | rowData->hasIgnoreFlag = false; executed (the execution status of this line is deduced): rowData->hasIgnoreFlag = false; | - |
1449 | for (int row = 0; row < rowInfo.count; ++row) { evaluated: row < rowInfo.count yes Evaluation Count:5981 | yes Evaluation Count:3700 |
| 3700-5981 |
1450 | if (rowData->ignore.testBit(row)) evaluated: rowData->ignore.testBit(row) yes Evaluation Count:32 | yes Evaluation Count:5949 |
| 32-5949 |
1451 | continue; executed: continue; Execution Count:32 | 32 |
1452 | | - |
1453 | QGridLayoutBox &rowBox = rowData->boxes[row]; executed (the execution status of this line is deduced): QGridLayoutBox &rowBox = rowData->boxes[row]; | - |
1454 | if (option.state & QStyle::State_Window) { partially evaluated: option.state & QStyle::State_Window yes Evaluation Count:5949 | no Evaluation Count:0 |
| 0-5949 |
1455 | nextToNextToLastRowAdHocData = nextToLastRowAdHocData; executed (the execution status of this line is deduced): nextToNextToLastRowAdHocData = nextToLastRowAdHocData; | - |
1456 | nextToLastRowAdHocData = lastRowAdHocData; executed (the execution status of this line is deduced): nextToLastRowAdHocData = lastRowAdHocData; | - |
1457 | lastRowAdHocData.init(row); executed (the execution status of this line is deduced): lastRowAdHocData.init(row); | - |
1458 | } executed: } Execution Count:5949 | 5949 |
1459 | | - |
1460 | bool userRowStretch = rowInfo.stretches.value(row).isUser(); executed (the execution status of this line is deduced): bool userRowStretch = rowInfo.stretches.value(row).isUser(); | - |
1461 | int &rowStretch = rowData->stretches[row]; executed (the execution status of this line is deduced): int &rowStretch = rowData->stretches[row]; | - |
1462 | | - |
1463 | bool hasIgnoreFlag = true; executed (the execution status of this line is deduced): bool hasIgnoreFlag = true; | - |
1464 | for (int column = 0; column < columnInfo.count; ++column) { evaluated: column < columnInfo.count yes Evaluation Count:10812 | yes Evaluation Count:5949 |
| 5949-10812 |
1465 | QGridLayoutItem *item = itemAt(row, column, orientation); executed (the execution status of this line is deduced): QGridLayoutItem *item = itemAt(row, column, orientation); | - |
1466 | if (item) { evaluated: item yes Evaluation Count:10576 | yes Evaluation Count:236 |
| 236-10576 |
1467 | int itemRow = item->firstRow(orientation); executed (the execution status of this line is deduced): int itemRow = item->firstRow(orientation); | - |
1468 | int itemColumn = item->firstColumn(orientation); executed (the execution status of this line is deduced): int itemColumn = item->firstColumn(orientation); | - |
1469 | | - |
1470 | if (itemRow == row && itemColumn == column) { evaluated: itemRow == row yes Evaluation Count:10415 | yes Evaluation Count:161 |
evaluated: itemColumn == column yes Evaluation Count:10228 | yes Evaluation Count:187 |
| 161-10415 |
1471 | int itemStretch = item->stretchFactor(orientation); executed (the execution status of this line is deduced): int itemStretch = item->stretchFactor(orientation); | - |
1472 | if (!(item->sizePolicy(orientation) & QSizePolicy::IgnoreFlag)) evaluated: !(item->sizePolicy(orientation) & QSizePolicy::IgnoreFlag) yes Evaluation Count:10016 | yes Evaluation Count:212 |
| 212-10016 |
1473 | hasIgnoreFlag = false; executed: hasIgnoreFlag = false; Execution Count:10016 | 10016 |
1474 | int itemRowSpan = item->rowSpan(orientation); executed (the execution status of this line is deduced): int itemRowSpan = item->rowSpan(orientation); | - |
1475 | | - |
1476 | int effectiveRowSpan = 1; executed (the execution status of this line is deduced): int effectiveRowSpan = 1; | - |
1477 | for (int i = 1; i < itemRowSpan; ++i) { evaluated: i < itemRowSpan yes Evaluation Count:187 | yes Evaluation Count:10228 |
| 187-10228 |
1478 | if (!rowData->ignore.testBit(i)) evaluated: !rowData->ignore.testBit(i) yes Evaluation Count:161 | yes Evaluation Count:26 |
| 26-161 |
1479 | ++effectiveRowSpan; executed: ++effectiveRowSpan; Execution Count:161 | 161 |
1480 | } executed: } Execution Count:187 | 187 |
1481 | | - |
1482 | QGridLayoutBox *box; executed (the execution status of this line is deduced): QGridLayoutBox *box; | - |
1483 | if (effectiveRowSpan == 1) { evaluated: effectiveRowSpan == 1 yes Evaluation Count:10067 | yes Evaluation Count:161 |
| 161-10067 |
1484 | box = &rowBox; executed (the execution status of this line is deduced): box = &rowBox; | - |
1485 | if (!userRowStretch && itemStretch != 0) evaluated: !userRowStretch yes Evaluation Count:9982 | yes Evaluation Count:85 |
evaluated: itemStretch != 0 yes Evaluation Count:9581 | yes Evaluation Count:401 |
| 85-9982 |
1486 | rowStretch = qMax(rowStretch, itemStretch); executed: rowStretch = qMax(rowStretch, itemStretch); Execution Count:9581 | 9581 |
1487 | } else { executed: } Execution Count:10067 | 10067 |
1488 | QGridLayoutMultiCellData &multiCell = executed (the execution status of this line is deduced): QGridLayoutMultiCellData &multiCell = | - |
1489 | rowData->multiCellMap[qMakePair(row, effectiveRowSpan)]; executed (the execution status of this line is deduced): rowData->multiCellMap[qMakePair(row, effectiveRowSpan)]; | - |
1490 | box = &multiCell.q_box; executed (the execution status of this line is deduced): box = &multiCell.q_box; | - |
1491 | multiCell.q_stretch = itemStretch; executed (the execution status of this line is deduced): multiCell.q_stretch = itemStretch; | - |
1492 | } executed: } Execution Count:161 | 161 |
1493 | // Items with constraints need to be passed the constraint | - |
1494 | if (colSizes && colPositions && item->hasDynamicConstraint() && orientation == item->dynamicConstraintOrientation()) { evaluated: colSizes yes Evaluation Count:1199 | yes Evaluation Count:9029 |
partially evaluated: colPositions yes Evaluation Count:1199 | no Evaluation Count:0 |
evaluated: item->hasDynamicConstraint() yes Evaluation Count:214 | yes Evaluation Count:985 |
partially evaluated: orientation == item->dynamicConstraintOrientation() yes Evaluation Count:214 | no Evaluation Count:0 |
| 0-9029 |
1495 | /* Get the width of the item by summing up the widths of the columns that it spans. | - |
1496 | * We need to have already calculated the widths of the columns by calling | - |
1497 | * q_columns->calculateGeometries() before hand and passing the value in the colSizes | - |
1498 | * and colPositions parameters. | - |
1499 | * The variable name is still colSizes even when it actually has the row sizes | - |
1500 | */ | - |
1501 | qreal length = colSizes[item->lastColumn(orientation)]; executed (the execution status of this line is deduced): qreal length = colSizes[item->lastColumn(orientation)]; | - |
1502 | if (item->columnSpan(orientation) != 1) evaluated: item->columnSpan(orientation) != 1 yes Evaluation Count:10 | yes Evaluation Count:204 |
| 10-204 |
1503 | length += colPositions[item->lastColumn(orientation)] - colPositions[item->firstColumn(orientation)]; executed: length += colPositions[item->lastColumn(orientation)] - colPositions[item->firstColumn(orientation)]; Execution Count:10 | 10 |
1504 | box->combine(item->box(orientation, length)); executed (the execution status of this line is deduced): box->combine(item->box(orientation, length)); | - |
1505 | } else { executed: } Execution Count:214 | 214 |
1506 | box->combine(item->box(orientation)); executed (the execution status of this line is deduced): box->combine(item->box(orientation)); | - |
1507 | } executed: } Execution Count:10014 | 10014 |
1508 | | - |
1509 | if (effectiveRowSpan == 1) { evaluated: effectiveRowSpan == 1 yes Evaluation Count:10067 | yes Evaluation Count:161 |
| 161-10067 |
1510 | QSizePolicy::ControlTypes controls = item->controlTypes(top); executed (the execution status of this line is deduced): QSizePolicy::ControlTypes controls = item->controlTypes(top); | - |
1511 | if (controls & ButtonMask) partially evaluated: controls & ButtonMask no Evaluation Count:0 | yes Evaluation Count:10067 |
| 0-10067 |
1512 | lastRowAdHocData.q_hasButtons = true; never executed: lastRowAdHocData.q_hasButtons = true; | 0 |
1513 | if (controls & ~ButtonMask) partially evaluated: controls & ~ButtonMask yes Evaluation Count:10067 | no Evaluation Count:0 |
| 0-10067 |
1514 | lastRowAdHocData.q_hasNonButtons = true; executed: lastRowAdHocData.q_hasNonButtons = true; Execution Count:10067 | 10067 |
1515 | } executed: } Execution Count:10067 | 10067 |
1516 | } executed: } Execution Count:10228 | 10228 |
1517 | } executed: } Execution Count:10576 | 10576 |
1518 | } executed: } Execution Count:10812 | 10812 |
1519 | if (row < rowInfo.boxes.count()) { evaluated: row < rowInfo.boxes.count() yes Evaluation Count:403 | yes Evaluation Count:5546 |
| 403-5546 |
1520 | QGridLayoutBox rowBoxInfo = rowInfo.boxes.at(row); executed (the execution status of this line is deduced): QGridLayoutBox rowBoxInfo = rowInfo.boxes.at(row); | - |
1521 | rowBoxInfo.normalize(); executed (the execution status of this line is deduced): rowBoxInfo.normalize(); | - |
1522 | rowBox.q_minimumSize = qMax(rowBox.q_minimumSize, rowBoxInfo.q_minimumSize); executed (the execution status of this line is deduced): rowBox.q_minimumSize = qMax(rowBox.q_minimumSize, rowBoxInfo.q_minimumSize); | - |
1523 | rowBox.q_maximumSize = qMax(rowBox.q_minimumSize, executed (the execution status of this line is deduced): rowBox.q_maximumSize = qMax(rowBox.q_minimumSize, | - |
1524 | (rowBoxInfo.q_maximumSize != FLT_MAX ? executed (the execution status of this line is deduced): (rowBoxInfo.q_maximumSize != 3.40282347e+38F ? | - |
1525 | rowBoxInfo.q_maximumSize : rowBox.q_maximumSize)); executed (the execution status of this line is deduced): rowBoxInfo.q_maximumSize : rowBox.q_maximumSize)); | - |
1526 | rowBox.q_preferredSize = qBound(rowBox.q_minimumSize, executed (the execution status of this line is deduced): rowBox.q_preferredSize = qBound(rowBox.q_minimumSize, | - |
1527 | qMax(rowBox.q_preferredSize, rowBoxInfo.q_preferredSize), executed (the execution status of this line is deduced): qMax(rowBox.q_preferredSize, rowBoxInfo.q_preferredSize), | - |
1528 | rowBox.q_maximumSize); executed (the execution status of this line is deduced): rowBox.q_maximumSize); | - |
1529 | } executed: } Execution Count:403 | 403 |
1530 | if (hasIgnoreFlag) evaluated: hasIgnoreFlag yes Evaluation Count:208 | yes Evaluation Count:5741 |
| 208-5741 |
1531 | rowData->hasIgnoreFlag = true; executed: rowData->hasIgnoreFlag = true; Execution Count:208 | 208 |
1532 | } executed: } Execution Count:5949 | 5949 |
1533 | | - |
1534 | /* | - |
1535 | Heuristic: Detect button boxes that don't use QSizePolicy::ButtonBox. | - |
1536 | This is somewhat ad hoc but it usually does the trick. | - |
1537 | */ | - |
1538 | bool lastRowIsButtonBox = (lastRowAdHocData.hasOnlyButtons() partially evaluated: lastRowAdHocData.hasOnlyButtons() no Evaluation Count:0 | yes Evaluation Count:3700 |
| 0-3700 |
1539 | && nextToLastRowAdHocData.hasOnlyNonButtons()); never evaluated: nextToLastRowAdHocData.hasOnlyNonButtons() | 0 |
1540 | bool lastTwoRowsIsButtonBox = (lastRowAdHocData.hasOnlyButtons() partially evaluated: lastRowAdHocData.hasOnlyButtons() no Evaluation Count:0 | yes Evaluation Count:3700 |
| 0-3700 |
1541 | && nextToLastRowAdHocData.hasOnlyButtons() never evaluated: nextToLastRowAdHocData.hasOnlyButtons() | 0 |
1542 | && nextToNextToLastRowAdHocData.hasOnlyNonButtons() never evaluated: nextToNextToLastRowAdHocData.hasOnlyNonButtons() | 0 |
1543 | && orientation == Qt::Vertical); never evaluated: orientation == Qt::Vertical | 0 |
1544 | | - |
1545 | if (defaultSpacing.isDefault()) { partially evaluated: defaultSpacing.isDefault() no Evaluation Count:0 | yes Evaluation Count:3700 |
| 0-3700 |
1546 | int prevRow = -1; never executed (the execution status of this line is deduced): int prevRow = -1; | - |
1547 | for (int row = 0; row < rowInfo.count; ++row) { never evaluated: row < rowInfo.count | 0 |
1548 | if (rowData->ignore.testBit(row)) never evaluated: rowData->ignore.testBit(row) | 0 |
1549 | continue; never executed: continue; | 0 |
1550 | | - |
1551 | if (prevRow != -1 && !rowInfo.spacings.value(prevRow).isUser()) { never evaluated: prevRow != -1 never evaluated: !rowInfo.spacings.value(prevRow).isUser() | 0 |
1552 | qreal &rowSpacing = rowData->spacings[prevRow]; never executed (the execution status of this line is deduced): qreal &rowSpacing = rowData->spacings[prevRow]; | - |
1553 | for (int column = 0; column < columnInfo.count; ++column) { never evaluated: column < columnInfo.count | 0 |
1554 | QGridLayoutItem *item1 = itemAt(prevRow, column, orientation); never executed (the execution status of this line is deduced): QGridLayoutItem *item1 = itemAt(prevRow, column, orientation); | - |
1555 | QGridLayoutItem *item2 = itemAt(row, column, orientation); never executed (the execution status of this line is deduced): QGridLayoutItem *item2 = itemAt(row, column, orientation); | - |
1556 | | - |
1557 | if (item1 && item2 && item1 != item2) { never evaluated: item1 never evaluated: item2 never evaluated: item1 != item2 | 0 |
1558 | QSizePolicy::ControlTypes controls1 = item1->controlTypes(bottom); never executed (the execution status of this line is deduced): QSizePolicy::ControlTypes controls1 = item1->controlTypes(bottom); | - |
1559 | QSizePolicy::ControlTypes controls2 = item2->controlTypes(top); never executed (the execution status of this line is deduced): QSizePolicy::ControlTypes controls2 = item2->controlTypes(top); | - |
1560 | | - |
1561 | if (controls2 & QSizePolicy::PushButton) { never evaluated: controls2 & QSizePolicy::PushButton | 0 |
1562 | if ((row == nextToLastRowAdHocData.q_row && lastTwoRowsIsButtonBox) never evaluated: row == nextToLastRowAdHocData.q_row never evaluated: lastTwoRowsIsButtonBox | 0 |
1563 | || (row == lastRowAdHocData.q_row && lastRowIsButtonBox)) { never evaluated: row == lastRowAdHocData.q_row never evaluated: lastRowIsButtonBox | 0 |
1564 | controls2 &= ~QSizePolicy::PushButton; never executed (the execution status of this line is deduced): controls2 &= ~QSizePolicy::PushButton; | - |
1565 | controls2 |= QSizePolicy::ButtonBox; never executed (the execution status of this line is deduced): controls2 |= QSizePolicy::ButtonBox; | - |
1566 | } | 0 |
1567 | } | 0 |
1568 | | - |
1569 | qreal spacing = style->combinedLayoutSpacing(controls1, controls2, never executed (the execution status of this line is deduced): qreal spacing = style->combinedLayoutSpacing(controls1, controls2, | - |
1570 | orientation, &option, never executed (the execution status of this line is deduced): orientation, &option, | - |
1571 | styleInfo.widget()); never executed (the execution status of this line is deduced): styleInfo.widget()); | - |
1572 | if (orientation == Qt::Horizontal) { never evaluated: orientation == Qt::Horizontal | 0 |
1573 | qreal width1 = rowData->boxes.at(prevRow).q_minimumSize; never executed (the execution status of this line is deduced): qreal width1 = rowData->boxes.at(prevRow).q_minimumSize; | - |
1574 | qreal width2 = rowData->boxes.at(row).q_minimumSize; never executed (the execution status of this line is deduced): qreal width2 = rowData->boxes.at(row).q_minimumSize; | - |
1575 | QRectF rect1 = item1->geometryWithin(0.0, 0.0, width1, FLT_MAX, -1.0); never executed (the execution status of this line is deduced): QRectF rect1 = item1->geometryWithin(0.0, 0.0, width1, 3.40282347e+38F, -1.0); | - |
1576 | QRectF rect2 = item2->geometryWithin(0.0, 0.0, width2, FLT_MAX, -1.0); never executed (the execution status of this line is deduced): QRectF rect2 = item2->geometryWithin(0.0, 0.0, width2, 3.40282347e+38F, -1.0); | - |
1577 | spacing -= (width1 - (rect1.x() + rect1.width())) + rect2.x(); never executed (the execution status of this line is deduced): spacing -= (width1 - (rect1.x() + rect1.width())) + rect2.x(); | - |
1578 | } else { | 0 |
1579 | const QGridLayoutBox &box1 = rowData->boxes.at(prevRow); never executed (the execution status of this line is deduced): const QGridLayoutBox &box1 = rowData->boxes.at(prevRow); | - |
1580 | const QGridLayoutBox &box2 = rowData->boxes.at(row); never executed (the execution status of this line is deduced): const QGridLayoutBox &box2 = rowData->boxes.at(row); | - |
1581 | qreal height1 = box1.q_minimumSize; never executed (the execution status of this line is deduced): qreal height1 = box1.q_minimumSize; | - |
1582 | qreal height2 = box2.q_minimumSize; never executed (the execution status of this line is deduced): qreal height2 = box2.q_minimumSize; | - |
1583 | qreal rowDescent1 = fixedDescent(box1.q_minimumDescent, never executed (the execution status of this line is deduced): qreal rowDescent1 = fixedDescent(box1.q_minimumDescent, | - |
1584 | box1.q_minimumAscent, height1); never executed (the execution status of this line is deduced): box1.q_minimumAscent, height1); | - |
1585 | qreal rowDescent2 = fixedDescent(box2.q_minimumDescent, never executed (the execution status of this line is deduced): qreal rowDescent2 = fixedDescent(box2.q_minimumDescent, | - |
1586 | box2.q_minimumAscent, height2); never executed (the execution status of this line is deduced): box2.q_minimumAscent, height2); | - |
1587 | QRectF rect1 = item1->geometryWithin(0.0, 0.0, FLT_MAX, height1, never executed (the execution status of this line is deduced): QRectF rect1 = item1->geometryWithin(0.0, 0.0, 3.40282347e+38F, height1, | - |
1588 | rowDescent1); never executed (the execution status of this line is deduced): rowDescent1); | - |
1589 | QRectF rect2 = item2->geometryWithin(0.0, 0.0, FLT_MAX, height2, never executed (the execution status of this line is deduced): QRectF rect2 = item2->geometryWithin(0.0, 0.0, 3.40282347e+38F, height2, | - |
1590 | rowDescent2); never executed (the execution status of this line is deduced): rowDescent2); | - |
1591 | spacing -= (height1 - (rect1.y() + rect1.height())) + rect2.y(); never executed (the execution status of this line is deduced): spacing -= (height1 - (rect1.y() + rect1.height())) + rect2.y(); | - |
1592 | } | 0 |
1593 | rowSpacing = qMax(spacing, rowSpacing); never executed (the execution status of this line is deduced): rowSpacing = qMax(spacing, rowSpacing); | - |
1594 | } | 0 |
1595 | } | 0 |
1596 | } | 0 |
1597 | prevRow = row; never executed (the execution status of this line is deduced): prevRow = row; | - |
1598 | } | 0 |
1599 | } else if (lastRowIsButtonBox || lastTwoRowsIsButtonBox) { never executed: } partially evaluated: lastRowIsButtonBox no Evaluation Count:0 | yes Evaluation Count:3700 |
partially evaluated: lastTwoRowsIsButtonBox no Evaluation Count:0 | yes Evaluation Count:3700 |
| 0-3700 |
1600 | /* | - |
1601 | Even for styles that define a uniform spacing, we cheat a | - |
1602 | bit and use the window margin as the spacing. This | - |
1603 | significantly improves the look of dialogs. | - |
1604 | */ | - |
1605 | int prevRow = lastRowIsButtonBox ? nextToLastRowAdHocData.q_row never evaluated: lastRowIsButtonBox | 0 |
1606 | : nextToNextToLastRowAdHocData.q_row; never executed (the execution status of this line is deduced): : nextToNextToLastRowAdHocData.q_row; | - |
1607 | if (!defaultSpacing.isUser() && !rowInfo.spacings.value(prevRow).isUser()) { never evaluated: !defaultSpacing.isUser() never evaluated: !rowInfo.spacings.value(prevRow).isUser() | 0 |
1608 | qreal windowMargin = style->pixelMetric(orientation == Qt::Vertical never executed (the execution status of this line is deduced): qreal windowMargin = style->pixelMetric(orientation == Qt::Vertical | - |
1609 | ? QStyle::PM_LayoutBottomMargin never executed (the execution status of this line is deduced): ? QStyle::PM_LayoutBottomMargin | - |
1610 | : QStyle::PM_LayoutRightMargin, never executed (the execution status of this line is deduced): : QStyle::PM_LayoutRightMargin, | - |
1611 | &option, styleInfo.widget()); never executed (the execution status of this line is deduced): &option, styleInfo.widget()); | - |
1612 | | - |
1613 | qreal &rowSpacing = rowData->spacings[prevRow]; never executed (the execution status of this line is deduced): qreal &rowSpacing = rowData->spacings[prevRow]; | - |
1614 | rowSpacing = qMax(windowMargin, rowSpacing); never executed (the execution status of this line is deduced): rowSpacing = qMax(windowMargin, rowSpacing); | - |
1615 | } | 0 |
1616 | } | 0 |
1617 | } | - |
1618 | | - |
1619 | void QGridLayoutEngine::ensureEffectiveFirstAndLastRows() const | - |
1620 | { | - |
1621 | if (q_cachedEffectiveFirstRows[Hor] == -1 && !q_items.isEmpty()) { evaluated: q_cachedEffectiveFirstRows[Hor] == -1 yes Evaluation Count:930 | yes Evaluation Count:508 |
evaluated: !q_items.isEmpty() yes Evaluation Count:711 | yes Evaluation Count:219 |
| 219-930 |
1622 | int rowCount = this->rowCount(); executed (the execution status of this line is deduced): int rowCount = this->rowCount(); | - |
1623 | int columnCount = this->columnCount(); executed (the execution status of this line is deduced): int columnCount = this->columnCount(); | - |
1624 | | - |
1625 | q_cachedEffectiveFirstRows[Ver] = rowCount; executed (the execution status of this line is deduced): q_cachedEffectiveFirstRows[Ver] = rowCount; | - |
1626 | q_cachedEffectiveFirstRows[Hor] = columnCount; executed (the execution status of this line is deduced): q_cachedEffectiveFirstRows[Hor] = columnCount; | - |
1627 | q_cachedEffectiveLastRows[Ver] = -1; executed (the execution status of this line is deduced): q_cachedEffectiveLastRows[Ver] = -1; | - |
1628 | q_cachedEffectiveLastRows[Hor] = -1; executed (the execution status of this line is deduced): q_cachedEffectiveLastRows[Hor] = -1; | - |
1629 | | - |
1630 | for (int i = q_items.count() - 1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:2098 | yes Evaluation Count:711 |
| 711-2098 |
1631 | const QGridLayoutItem *item = q_items.at(i); executed (the execution status of this line is deduced): const QGridLayoutItem *item = q_items.at(i); | - |
1632 | | - |
1633 | for (int j = 0; j < NOrientations; ++j) { evaluated: j < NOrientations yes Evaluation Count:4196 | yes Evaluation Count:2098 |
| 2098-4196 |
1634 | Qt::Orientation orientation = (j == Hor) ? Qt::Horizontal : Qt::Vertical; evaluated: (j == Hor) yes Evaluation Count:2098 | yes Evaluation Count:2098 |
| 2098 |
1635 | if (item->firstRow(orientation) < q_cachedEffectiveFirstRows[j]) evaluated: item->firstRow(orientation) < q_cachedEffectiveFirstRows[j] yes Evaluation Count:2256 | yes Evaluation Count:1940 |
| 1940-2256 |
1636 | q_cachedEffectiveFirstRows[j] = item->firstRow(orientation); executed: q_cachedEffectiveFirstRows[j] = item->firstRow(orientation); Execution Count:2256 | 2256 |
1637 | if (item->lastRow(orientation) > q_cachedEffectiveLastRows[j]) evaluated: item->lastRow(orientation) > q_cachedEffectiveLastRows[j] yes Evaluation Count:1688 | yes Evaluation Count:2508 |
| 1688-2508 |
1638 | q_cachedEffectiveLastRows[j] = item->lastRow(orientation); executed: q_cachedEffectiveLastRows[j] = item->lastRow(orientation); Execution Count:1688 | 1688 |
1639 | } executed: } Execution Count:4196 | 4196 |
1640 | } executed: } Execution Count:2098 | 2098 |
1641 | } executed: } Execution Count:711 | 711 |
1642 | } executed: } Execution Count:1438 | 1438 |
1643 | | - |
1644 | void QGridLayoutEngine::ensureColumnAndRowData(QGridLayoutRowData *rowData, QGridLayoutBox *totalBox, | - |
1645 | const QLayoutStyleInfo &styleInfo, | - |
1646 | qreal *colPositions, qreal *colSizes, | - |
1647 | Qt::Orientation orientation) const | - |
1648 | { | - |
1649 | rowData->reset(rowCount(orientation)); executed (the execution status of this line is deduced): rowData->reset(rowCount(orientation)); | - |
1650 | fillRowData(rowData, styleInfo, colPositions, colSizes, orientation); executed (the execution status of this line is deduced): fillRowData(rowData, styleInfo, colPositions, colSizes, orientation); | - |
1651 | const QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; executed (the execution status of this line is deduced): const QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; | - |
1652 | rowData->distributeMultiCells(rowInfo); executed (the execution status of this line is deduced): rowData->distributeMultiCells(rowInfo); | - |
1653 | *totalBox = rowData->totalBox(0, rowCount(orientation)); executed (the execution status of this line is deduced): *totalBox = rowData->totalBox(0, rowCount(orientation)); | - |
1654 | //We have items whose width depends on their height | - |
1655 | } executed: } Execution Count:3700 | 3700 |
1656 | | - |
1657 | /** | - |
1658 | returns false if the layout has contradicting constraints (i.e. some items with a horizontal | - |
1659 | constraint and other items with a vertical constraint) | - |
1660 | */ | - |
1661 | bool QGridLayoutEngine::ensureDynamicConstraint() const | - |
1662 | { | - |
1663 | if (q_cachedConstraintOrientation == UnknownConstraint) { evaluated: q_cachedConstraintOrientation == UnknownConstraint yes Evaluation Count:615 | yes Evaluation Count:1461 |
| 615-1461 |
1664 | for (int i = q_items.count() - 1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:1525 | yes Evaluation Count:615 |
| 615-1525 |
1665 | QGridLayoutItem *item = q_items.at(i); executed (the execution status of this line is deduced): QGridLayoutItem *item = q_items.at(i); | - |
1666 | if (item->hasDynamicConstraint()) { evaluated: item->hasDynamicConstraint() yes Evaluation Count:217 | yes Evaluation Count:1308 |
| 217-1308 |
1667 | Qt::Orientation itemConstraintOrientation = item->dynamicConstraintOrientation(); executed (the execution status of this line is deduced): Qt::Orientation itemConstraintOrientation = item->dynamicConstraintOrientation(); | - |
1668 | if (q_cachedConstraintOrientation == UnknownConstraint) { evaluated: q_cachedConstraintOrientation == UnknownConstraint yes Evaluation Count:56 | yes Evaluation Count:161 |
| 56-161 |
1669 | q_cachedConstraintOrientation = itemConstraintOrientation; executed (the execution status of this line is deduced): q_cachedConstraintOrientation = itemConstraintOrientation; | - |
1670 | } else if (q_cachedConstraintOrientation != itemConstraintOrientation) { executed: } Execution Count:56 partially evaluated: q_cachedConstraintOrientation != itemConstraintOrientation no Evaluation Count:0 | yes Evaluation Count:161 |
| 0-161 |
1671 | q_cachedConstraintOrientation = UnfeasibleConstraint; never executed (the execution status of this line is deduced): q_cachedConstraintOrientation = UnfeasibleConstraint; | - |
1672 | qWarning("QGridLayoutEngine: Unfeasible, cannot mix horizontal and" never executed (the execution status of this line is deduced): QMessageLogger("graphicsview/qgridlayoutengine.cpp", 1672, __PRETTY_FUNCTION__).warning("QGridLayoutEngine: Unfeasible, cannot mix horizontal and" | - |
1673 | " vertical constraint in the same layout"); never executed (the execution status of this line is deduced): " vertical constraint in the same layout"); | - |
1674 | return false; never executed: return false; | 0 |
1675 | } | - |
1676 | } | - |
1677 | } executed: } Execution Count:1525 | 1525 |
1678 | if (q_cachedConstraintOrientation == UnknownConstraint) evaluated: q_cachedConstraintOrientation == UnknownConstraint yes Evaluation Count:559 | yes Evaluation Count:56 |
| 56-559 |
1679 | q_cachedConstraintOrientation = NoConstraint; executed: q_cachedConstraintOrientation = NoConstraint; Execution Count:559 | 559 |
1680 | } executed: } Execution Count:615 | 615 |
1681 | return true; executed: return true; Execution Count:2076 | 2076 |
1682 | } | - |
1683 | | - |
1684 | bool QGridLayoutEngine::hasDynamicConstraint() const | - |
1685 | { | - |
1686 | if (!ensureDynamicConstraint()) partially evaluated: !ensureDynamicConstraint() no Evaluation Count:0 | yes Evaluation Count:1521 |
| 0-1521 |
1687 | return false; never executed: return false; | 0 |
1688 | return q_cachedConstraintOrientation != NoConstraint; executed: return q_cachedConstraintOrientation != NoConstraint; Execution Count:1521 | 1521 |
1689 | } | - |
1690 | | - |
1691 | /* | - |
1692 | * return value is only valid if hasConstraint() returns true | - |
1693 | */ | - |
1694 | Qt::Orientation QGridLayoutEngine::constraintOrientation() const | - |
1695 | { | - |
1696 | (void)ensureDynamicConstraint(); executed (the execution status of this line is deduced): (void)ensureDynamicConstraint(); | - |
1697 | return (Qt::Orientation)q_cachedConstraintOrientation; executed: return (Qt::Orientation)q_cachedConstraintOrientation; Execution Count:555 | 555 |
1698 | } | - |
1699 | | - |
1700 | void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo, | - |
1701 | const QSizeF &size) const | - |
1702 | { | - |
1703 | if (q_cachedDataForStyleInfo == styleInfo && q_cachedSize == size) evaluated: q_cachedDataForStyleInfo == styleInfo yes Evaluation Count:156 | yes Evaluation Count:287 |
evaluated: q_cachedSize == size yes Evaluation Count:78 | yes Evaluation Count:78 |
| 78-287 |
1704 | return; executed: return; Execution Count:78 | 78 |
1705 | | - |
1706 | q_cachedDataForStyleInfo = styleInfo; executed (the execution status of this line is deduced): q_cachedDataForStyleInfo = styleInfo; | - |
1707 | q_cachedSize = size; executed (the execution status of this line is deduced): q_cachedSize = size; | - |
1708 | | - |
1709 | q_xx.resize(columnCount()); executed (the execution status of this line is deduced): q_xx.resize(columnCount()); | - |
1710 | q_widths.resize(columnCount()); executed (the execution status of this line is deduced): q_widths.resize(columnCount()); | - |
1711 | q_yy.resize(rowCount()); executed (the execution status of this line is deduced): q_yy.resize(rowCount()); | - |
1712 | q_heights.resize(rowCount()); executed (the execution status of this line is deduced): q_heights.resize(rowCount()); | - |
1713 | q_descents.resize(rowCount()); executed (the execution status of this line is deduced): q_descents.resize(rowCount()); | - |
1714 | | - |
1715 | if (constraintOrientation() != Qt::Horizontal) { evaluated: constraintOrientation() != Qt::Horizontal yes Evaluation Count:356 | yes Evaluation Count:9 |
| 9-356 |
1716 | //We might have items whose width depends on their height | - |
1717 | ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); executed (the execution status of this line is deduced): ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, __null, __null, Qt::Horizontal); | - |
1718 | //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as | - |
1719 | //constraints to find the row heights | - |
1720 | q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), executed (the execution status of this line is deduced): q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), | - |
1721 | 0, q_totalBoxes[Hor], q_infos[Hor] ); executed (the execution status of this line is deduced): 0, q_totalBoxes[Hor], q_infos[Hor] ); | - |
1722 | ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, q_xx.data(), q_widths.data(), Qt::Vertical); executed (the execution status of this line is deduced): ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, q_xx.data(), q_widths.data(), Qt::Vertical); | - |
1723 | //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() | - |
1724 | q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), executed (the execution status of this line is deduced): q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), | - |
1725 | q_descents.data(), q_totalBoxes[Ver], q_infos[Ver]); executed (the execution status of this line is deduced): q_descents.data(), q_totalBoxes[Ver], q_infos[Ver]); | - |
1726 | } else { executed: } Execution Count:356 | 356 |
1727 | //We have items whose height depends on their width | - |
1728 | ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); executed (the execution status of this line is deduced): ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, __null, __null, Qt::Vertical); | - |
1729 | //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as | - |
1730 | //constraints to find the column widths | - |
1731 | q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), executed (the execution status of this line is deduced): q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), | - |
1732 | q_descents.data(), q_totalBoxes[Ver], q_infos[Ver]); executed (the execution status of this line is deduced): q_descents.data(), q_totalBoxes[Ver], q_infos[Ver]); | - |
1733 | ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, q_yy.data(), q_heights.data(), Qt::Horizontal); executed (the execution status of this line is deduced): ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, q_yy.data(), q_heights.data(), Qt::Horizontal); | - |
1734 | //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() | - |
1735 | q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), executed (the execution status of this line is deduced): q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), | - |
1736 | 0, q_totalBoxes[Hor], q_infos[Hor]); executed (the execution status of this line is deduced): 0, q_totalBoxes[Hor], q_infos[Hor]); | - |
1737 | } executed: } Execution Count:9 | 9 |
1738 | } | - |
1739 | | - |
1740 | QT_END_NAMESPACE | - |
1741 | | - |
1742 | #endif //QT_NO_GRAPHICSVIEW | - |
1743 | | - |
| | |