qlayoutengine.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/kernel/qlayoutengine.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtWidgets module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
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 The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include "qlayout.h"-
35#include "private/qlayoutengine_p.h"-
36-
37#include "qvector.h"-
38#include "qwidget.h"-
39-
40#include <qvarlengtharray.h>-
41#include <qdebug.h>-
42-
43#include <algorithm>-
44-
45QT_BEGIN_NAMESPACE-
46-
47//#define QLAYOUT_EXTRA_DEBUG-
48-
49typedef qint64 Fixed64;-
50static
never executed: return (Fixed64)i * 256;
inline Fixed64 toFixed(int i) { return (Fixed64)i * 256; }
never executed: return (Fixed64)i * 256;
0
51static inline int fRound(Fixed64 i) {-
52 return (i % 256 < 128) ? i / 256 : 1 + i / 256;
never executed: return (i % 256 < 128) ? i / 256 : 1 + i / 256;
(i % 256 < 128)Description
TRUEnever evaluated
FALSEnever evaluated
0
53}-
54-
55/*-
56 This is the main workhorse of the QGridLayout. It portions out-
57 available space to the chain's children.-
58-
59 The calculation is done in fixed point: "fixed" variables are-
60 scaled by a factor of 256.-
61-
62 If the layout runs "backwards" (i.e. RightToLeft or Up) the layout-
63 is computed mirror-reversed, and it's the caller's responsibility-
64 do reverse the values before use.-
65-
66 chain contains input and output parameters describing the geometry.-
67 count is the count of items in the chain; pos and space give the-
68 interval (relative to parentWidget topLeft).-
69*/-
70void qGeomCalc(QVector<QLayoutStruct> &chain, int start, int count,-
71 int pos, int space, int spacer)-
72{-
73 int cHint = 0;-
74 int cMin = 0;-
75 int cMax = 0;-
76 int sumStretch = 0;-
77 int sumSpacing = 0;-
78 int expandingCount = 0;-
79-
80 bool allEmptyNonstretch = true;-
81 int pendingSpacing = -1;-
82 int spacerCount = 0;-
83 int i;-
84-
85 for (i = start; i < start + count; i++) {
i < start + countDescription
TRUEnever evaluated
FALSEnever evaluated
0
86 QLayoutStruct *data = &chain[i];-
87-
88 data->done = false;-
89 cHint += data->smartSizeHint();-
90 cMin += data->minimumSize;-
91 cMax += data->maximumSize;-
92 sumStretch += data->stretch;-
93 if (!data->empty) {
!data->emptyDescription
TRUEnever evaluated
FALSEnever evaluated
0
94 /*-
95 Using pendingSpacing, we ensure that the spacing for the last-
96 (non-empty) item is ignored.-
97 */-
98 if (pendingSpacing >= 0) {
pendingSpacing >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
99 sumSpacing += pendingSpacing;-
100 ++spacerCount;-
101 }
never executed: end of block
0
102 pendingSpacing = data->effectiveSpacer(spacer);-
103 }
never executed: end of block
0
104 if (data->expansive)
data->expansiveDescription
TRUEnever evaluated
FALSEnever evaluated
0
105 expandingCount++;
never executed: expandingCount++;
0
106 allEmptyNonstretch = allEmptyNonstretch && data->empty && !data->expansive && data->stretch <= 0;
allEmptyNonstretchDescription
TRUEnever evaluated
FALSEnever evaluated
data->emptyDescription
TRUEnever evaluated
FALSEnever evaluated
!data->expansiveDescription
TRUEnever evaluated
FALSEnever evaluated
data->stretch <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
107 }
never executed: end of block
0
108-
109 int extraspace = 0;-
110-
111 if (space < cMin + sumSpacing) {
space < cMin + sumSpacingDescription
TRUEnever evaluated
FALSEnever evaluated
0
112 /*-
113 Less space than minimumSize; take from the biggest first-
114 */-
115-
116 int minSize = cMin + sumSpacing;-
117-
118 // shrink the spacers proportionally-
119 if (spacer >= 0) {
spacer >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
120 spacer = minSize > 0 ? spacer * space / minSize : 0;
minSize > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
121 sumSpacing = spacer * spacerCount;-
122 }
never executed: end of block
0
123-
124 QVarLengthArray<int, 32> minimumSizes;-
125 minimumSizes.reserve(count);-
126-
127 for (i = start; i < start + count; i++)
i < start + countDescription
TRUEnever evaluated
FALSEnever evaluated
0
128 minimumSizes << chain.at(i).minimumSize;
never executed: minimumSizes << chain.at(i).minimumSize;
0
129-
130 std::sort(minimumSizes.begin(), minimumSizes.end());-
131-
132 int space_left = space - sumSpacing;-
133-
134 int sum = 0;-
135 int idx = 0;-
136 int space_used=0;-
137 int current = 0;-
138 while (idx < count && space_used < space_left) {
idx < countDescription
TRUEnever evaluated
FALSEnever evaluated
space_used < space_leftDescription
TRUEnever evaluated
FALSEnever evaluated
0
139 current = minimumSizes.at(idx);-
140 space_used = sum + current * (count - idx);-
141 sum += current;-
142 ++idx;-
143 }
never executed: end of block
0
144 --idx;-
145 int deficit = space_used - space_left;-
146-
147 int items = count - idx;-
148 /*-
149 * If we truncate all items to "current", we would get "deficit" too many pixels. Therefore, we have to remove-
150 * deficit/items from each item bigger than maxval. The actual value to remove is deficitPerItem + remainder/items-
151 * "rest" is the accumulated error from using integer arithmetic.-
152 */-
153 int deficitPerItem = deficit/items;-
154 int remainder = deficit % items;-
155 int maxval = current - deficitPerItem;-
156-
157 int rest = 0;-
158 for (i = start; i < start + count; i++) {
i < start + countDescription
TRUEnever evaluated
FALSEnever evaluated
0
159 int maxv = maxval;-
160 rest += remainder;-
161 if (rest >= items) {
rest >= itemsDescription
TRUEnever evaluated
FALSEnever evaluated
0
162 maxv--;-
163 rest-=items;-
164 }
never executed: end of block
0
165 QLayoutStruct *data = &chain[i];-
166 data->size = qMin(data->minimumSize, maxv);-
167 data->done = true;-
168 }
never executed: end of block
0
169 } else if (space < cHint + sumSpacing) {
never executed: end of block
space < cHint + sumSpacingDescription
TRUEnever evaluated
FALSEnever evaluated
0
170 /*-
171 Less space than smartSizeHint(), but more than minimumSize.-
172 Currently take space equally from each, as in Qt 2.x.-
173 Commented-out lines will give more space to stretchier-
174 items.-
175 */-
176 int n = count;-
177 int space_left = space - sumSpacing;-
178 int overdraft = cHint - space_left;-
179-
180 // first give to the fixed ones:-
181 for (i = start; i < start + count; i++) {
i < start + countDescription
TRUEnever evaluated
FALSEnever evaluated
0
182 QLayoutStruct *data = &chain[i];-
183 if (!data->done
!data->doneDescription
TRUEnever evaluated
FALSEnever evaluated
0
184 && data->minimumSize >= data->smartSizeHint()) {
data->minimumS...martSizeHint()Description
TRUEnever evaluated
FALSEnever evaluated
0
185 data->size = data->smartSizeHint();-
186 data->done = true;-
187 space_left -= data->smartSizeHint();-
188 // sumStretch -= data->stretch;-
189 n--;-
190 }
never executed: end of block
0
191 }
never executed: end of block
0
192 bool finished = n == 0;-
193 while (!finished) {
!finishedDescription
TRUEnever evaluated
FALSEnever evaluated
0
194 finished = true;-
195 Fixed64 fp_over = toFixed(overdraft);-
196 Fixed64 fp_w = 0;-
197-
198 for (i = start; i < start+count; i++) {
i < start+countDescription
TRUEnever evaluated
FALSEnever evaluated
0
199 QLayoutStruct *data = &chain[i];-
200 if (data->done)
data->doneDescription
TRUEnever evaluated
FALSEnever evaluated
0
201 continue;
never executed: continue;
0
202 // if (sumStretch <= 0)-
203 fp_w += fp_over / n;-
204 // else-
205 // fp_w += (fp_over * data->stretch) / sumStretch;-
206 int w = fRound(fp_w);-
207 data->size = data->smartSizeHint() - w;-
208 fp_w -= toFixed(w); // give the difference to the next-
209 if (data->size < data->minimumSize) {
data->size < data->minimumSizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
210 data->done = true;-
211 data->size = data->minimumSize;-
212 finished = false;-
213 overdraft -= data->smartSizeHint() - data->minimumSize;-
214 // sumStretch -= data->stretch;-
215 n--;-
216 break;
never executed: break;
0
217 }-
218 }
never executed: end of block
0
219 }
never executed: end of block
0
220 } else { // extra space
never executed: end of block
0
221 int n = count;-
222 int space_left = space - sumSpacing;-
223 // first give to the fixed ones, and handle non-expansiveness-
224 for (i = start; i < start + count; i++) {
i < start + countDescription
TRUEnever evaluated
FALSEnever evaluated
0
225 QLayoutStruct *data = &chain[i];-
226 if (!data->done
!data->doneDescription
TRUEnever evaluated
FALSEnever evaluated
0
227 && (data->maximumSize <= data->smartSizeHint()
data->maximumS...martSizeHint()Description
TRUEnever evaluated
FALSEnever evaluated
0
228 || (!allEmptyNonstretch && data->empty &&
!allEmptyNonstretchDescription
TRUEnever evaluated
FALSEnever evaluated
data->emptyDescription
TRUEnever evaluated
FALSEnever evaluated
0
229 !data->expansive && data->stretch == 0))) {
!data->expansiveDescription
TRUEnever evaluated
FALSEnever evaluated
data->stretch == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
230 data->size = data->smartSizeHint();-
231 data->done = true;-
232 space_left -= data->size;-
233 sumStretch -= data->stretch;-
234 if (data->expansive)
data->expansiveDescription
TRUEnever evaluated
FALSEnever evaluated
0
235 expandingCount--;
never executed: expandingCount--;
0
236 n--;-
237 }
never executed: end of block
0
238 }
never executed: end of block
0
239 extraspace = space_left;-
240-
241 /*-
242 Do a trial distribution and calculate how much it is off.-
243 If there are more deficit pixels than surplus pixels, give-
244 the minimum size items what they need, and repeat.-
245 Otherwise give to the maximum size items, and repeat.-
246-
247 Paul Olav Tvete has a wonderful mathematical proof of the-
248 correctness of this principle, but unfortunately this-
249 comment is too small to contain it.-
250 */-
251 int surplus, deficit;-
252 do {-
253 surplus = deficit = 0;-
254 Fixed64 fp_space = toFixed(space_left);-
255 Fixed64 fp_w = 0;-
256 for (i = start; i < start + count; i++) {
i < start + countDescription
TRUEnever evaluated
FALSEnever evaluated
0
257 QLayoutStruct *data = &chain[i];-
258 if (data->done)
data->doneDescription
TRUEnever evaluated
FALSEnever evaluated
0
259 continue;
never executed: continue;
0
260 extraspace = 0;-
261 if (sumStretch > 0) {
sumStretch > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
262 fp_w += (fp_space * data->stretch) / sumStretch;-
263 } else if (expandingCount > 0) {
never executed: end of block
expandingCount > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
264 fp_w += (fp_space * (data->expansive ? 1 : 0)) / expandingCount;-
265 } else {
never executed: end of block
0
266 fp_w += fp_space * 1 / n;-
267 }
never executed: end of block
0
268 int w = fRound(fp_w);-
269 data->size = w;-
270 fp_w -= toFixed(w); // give the difference to the next-
271 if (w < data->smartSizeHint()) {
w < data->smartSizeHint()Description
TRUEnever evaluated
FALSEnever evaluated
0
272 deficit += data->smartSizeHint() - w;-
273 } else if (w > data->maximumSize) {
never executed: end of block
w > data->maximumSizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
274 surplus += w - data->maximumSize;-
275 }
never executed: end of block
0
276 }
never executed: end of block
0
277 if (deficit > 0 && surplus <= deficit) {
deficit > 0Description
TRUEnever evaluated
FALSEnever evaluated
surplus <= deficitDescription
TRUEnever evaluated
FALSEnever evaluated
0
278 // give to the ones that have too little-
279 for (i = start; i < start+count; i++) {
i < start+countDescription
TRUEnever evaluated
FALSEnever evaluated
0
280 QLayoutStruct *data = &chain[i];-
281 if (!data->done && data->size < data->smartSizeHint()) {
!data->doneDescription
TRUEnever evaluated
FALSEnever evaluated
data->size < d...martSizeHint()Description
TRUEnever evaluated
FALSEnever evaluated
0
282 data->size = data->smartSizeHint();-
283 data->done = true;-
284 space_left -= data->smartSizeHint();-
285 sumStretch -= data->stretch;-
286 if (data->expansive)
data->expansiveDescription
TRUEnever evaluated
FALSEnever evaluated
0
287 expandingCount--;
never executed: expandingCount--;
0
288 n--;-
289 }
never executed: end of block
0
290 }
never executed: end of block
0
291 }
never executed: end of block
0
292 if (surplus > 0 && surplus >= deficit) {
surplus > 0Description
TRUEnever evaluated
FALSEnever evaluated
surplus >= deficitDescription
TRUEnever evaluated
FALSEnever evaluated
0
293 // take from the ones that have too much-
294 for (i = start; i < start + count; i++) {
i < start + countDescription
TRUEnever evaluated
FALSEnever evaluated
0
295 QLayoutStruct *data = &chain[i];-
296 if (!data->done && data->size > data->maximumSize) {
!data->doneDescription
TRUEnever evaluated
FALSEnever evaluated
data->size > data->maximumSizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
297 data->size = data->maximumSize;-
298 data->done = true;-
299 space_left -= data->maximumSize;-
300 sumStretch -= data->stretch;-
301 if (data->expansive)
data->expansiveDescription
TRUEnever evaluated
FALSEnever evaluated
0
302 expandingCount--;
never executed: expandingCount--;
0
303 n--;-
304 }
never executed: end of block
0
305 }
never executed: end of block
0
306 }
never executed: end of block
0
307 } while (n > 0 && surplus != deficit);
never executed: end of block
n > 0Description
TRUEnever evaluated
FALSEnever evaluated
surplus != deficitDescription
TRUEnever evaluated
FALSEnever evaluated
0
308 if (n == 0)
n == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
309 extraspace = space_left;
never executed: extraspace = space_left;
0
310 }
never executed: end of block
0
311-
312 /*-
313 As a last resort, we distribute the unwanted space equally-
314 among the spacers (counting the start and end of the chain). We-
315 could, but don't, attempt a sub-pixel allocation of the extra-
316 space.-
317 */-
318 int extra = extraspace / (spacerCount + 2);-
319 int p = pos + extra;-
320 for (i = start; i < start+count; i++) {
i < start+countDescription
TRUEnever evaluated
FALSEnever evaluated
0
321 QLayoutStruct *data = &chain[i];-
322 data->pos = p;-
323 p += data->size;-
324 if (!data->empty)
!data->emptyDescription
TRUEnever evaluated
FALSEnever evaluated
0
325 p += data->effectiveSpacer(spacer) + extra;
never executed: p += data->effectiveSpacer(spacer) + extra;
0
326 }
never executed: end of block
0
327-
328#ifdef QLAYOUT_EXTRA_DEBUG-
329 qDebug() << "qGeomCalc" << "start" << start << "count" << count << "pos" << pos-
330 << "space" << space << "spacer" << spacer;-
331 for (i = start; i < start + count; ++i) {-
332 qDebug() << i << ':' << chain[i].minimumSize << chain[i].smartSizeHint()-
333 << chain[i].maximumSize << "stretch" << chain[i].stretch-
334 << "empty" << chain[i].empty << "expansive" << chain[i].expansive-
335 << "spacing" << chain[i].spacing;-
336 qDebug() << "result pos" << chain[i].pos << "size" << chain[i].size;-
337 }-
338#endif-
339}
never executed: end of block
0
340-
341Q_WIDGETS_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint,-
342 const QSize &minSize, const QSize &maxSize,-
343 const QSizePolicy &sizePolicy)-
344{-
345 QSize s(0, 0);-
346-
347 if (sizePolicy.horizontalPolicy() != QSizePolicy::Ignored) {
sizePolicy.hor...olicy::IgnoredDescription
TRUEnever evaluated
FALSEnever evaluated
0
348 if (sizePolicy.horizontalPolicy() & QSizePolicy::ShrinkFlag)
sizePolicy.hor...cy::ShrinkFlagDescription
TRUEnever evaluated
FALSEnever evaluated
0
349 s.setWidth(minSizeHint.width());
never executed: s.setWidth(minSizeHint.width());
0
350 else-
351 s.setWidth(qMax(sizeHint.width(), minSizeHint.width()));
never executed: s.setWidth(qMax(sizeHint.width(), minSizeHint.width()));
0
352 }-
353-
354 if (sizePolicy.verticalPolicy() != QSizePolicy::Ignored) {
sizePolicy.ver...olicy::IgnoredDescription
TRUEnever evaluated
FALSEnever evaluated
0
355 if (sizePolicy.verticalPolicy() & QSizePolicy::ShrinkFlag) {
sizePolicy.ver...cy::ShrinkFlagDescription
TRUEnever evaluated
FALSEnever evaluated
0
356 s.setHeight(minSizeHint.height());-
357 } else {
never executed: end of block
0
358 s.setHeight(qMax(sizeHint.height(), minSizeHint.height()));-
359 }
never executed: end of block
0
360 }-
361-
362 s = s.boundedTo(maxSize);-
363 if (minSize.width() > 0)
minSize.width() > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
364 s.setWidth(minSize.width());
never executed: s.setWidth(minSize.width());
0
365 if (minSize.height() > 0)
minSize.height() > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
366 s.setHeight(minSize.height());
never executed: s.setHeight(minSize.height());
0
367-
368 return s.expandedTo(QSize(0,0));
never executed: return s.expandedTo(QSize(0,0));
0
369}-
370-
371Q_WIDGETS_EXPORT QSize qSmartMinSize(const QWidgetItem *i)-
372{-
373 QWidget *w = const_cast<QWidgetItem *>(i)->widget();-
374 return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(),
never executed: return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), w->minimumSize(), w->maximumSize(), w->sizePolicy());
0
375 w->minimumSize(), w->maximumSize(),
never executed: return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), w->minimumSize(), w->maximumSize(), w->sizePolicy());
0
376 w->sizePolicy());
never executed: return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), w->minimumSize(), w->maximumSize(), w->sizePolicy());
0
377}-
378-
379Q_WIDGETS_EXPORT QSize qSmartMinSize(const QWidget *w)-
380{-
381 return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(),
never executed: return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), w->minimumSize(), w->maximumSize(), w->sizePolicy());
0
382 w->minimumSize(), w->maximumSize(),
never executed: return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), w->minimumSize(), w->maximumSize(), w->sizePolicy());
0
383 w->sizePolicy());
never executed: return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), w->minimumSize(), w->maximumSize(), w->sizePolicy());
0
384}-
385-
386Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QSize &sizeHint,-
387 const QSize &minSize, const QSize &maxSize,-
388 const QSizePolicy &sizePolicy, Qt::Alignment align)-
389{-
390 if (align & Qt::AlignHorizontal_Mask && align & Qt::AlignVertical_Mask)
align & Qt::Al...orizontal_MaskDescription
TRUEnever evaluated
FALSEnever evaluated
align & Qt::AlignVertical_MaskDescription
TRUEnever evaluated
FALSEnever evaluated
0
391 return QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX);
never executed: return QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX);
0
392 QSize s = maxSize;-
393 QSize hint = sizeHint.expandedTo(minSize);-
394 if (s.width() == QWIDGETSIZE_MAX && !(align & Qt::AlignHorizontal_Mask))
s.width() == ((1<<24)-1)Description
TRUEnever evaluated
FALSEnever evaluated
!(align & Qt::...rizontal_Mask)Description
TRUEnever evaluated
FALSEnever evaluated
0
395 if (!(sizePolicy.horizontalPolicy() & QSizePolicy::GrowFlag))
!(sizePolicy.h...icy::GrowFlag)Description
TRUEnever evaluated
FALSEnever evaluated
0
396 s.setWidth(hint.width());
never executed: s.setWidth(hint.width());
0
397-
398 if (s.height() == QWIDGETSIZE_MAX && !(align & Qt::AlignVertical_Mask))
s.height() == ((1<<24)-1)Description
TRUEnever evaluated
FALSEnever evaluated
!(align & Qt::...Vertical_Mask)Description
TRUEnever evaluated
FALSEnever evaluated
0
399 if (!(sizePolicy.verticalPolicy() & QSizePolicy::GrowFlag))
!(sizePolicy.v...icy::GrowFlag)Description
TRUEnever evaluated
FALSEnever evaluated
0
400 s.setHeight(hint.height());
never executed: s.setHeight(hint.height());
0
401-
402 if (align & Qt::AlignHorizontal_Mask)
align & Qt::Al...orizontal_MaskDescription
TRUEnever evaluated
FALSEnever evaluated
0
403 s.setWidth(QLAYOUTSIZE_MAX);
never executed: s.setWidth(QLAYOUTSIZE_MAX);
0
404 if (align & Qt::AlignVertical_Mask)
align & Qt::AlignVertical_MaskDescription
TRUEnever evaluated
FALSEnever evaluated
0
405 s.setHeight(QLAYOUTSIZE_MAX);
never executed: s.setHeight(QLAYOUTSIZE_MAX);
0
406 return s;
never executed: return s;
0
407}-
408-
409Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidgetItem *i, Qt::Alignment align)-
410{-
411 QWidget *w = const_cast<QWidgetItem*>(i)->widget();-
412-
413 return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(),
never executed: return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(), w->sizePolicy(), align);
0
414 w->sizePolicy(), align);
never executed: return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(), w->sizePolicy(), align);
0
415}-
416-
417Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidget *w, Qt::Alignment align)-
418{-
419 return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(),
never executed: return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(), w->sizePolicy(), align);
0
420 w->sizePolicy(), align);
never executed: return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(), w->sizePolicy(), align);
0
421}-
422-
423Q_WIDGETS_EXPORT int qSmartSpacing(const QLayout *layout, QStyle::PixelMetric pm)-
424{-
425 QObject *parent = layout->parent();-
426 if (!parent) {
!parentDescription
TRUEnever evaluated
FALSEnever evaluated
0
427 return -1;
never executed: return -1;
0
428 } else if (parent->isWidgetType()) {
parent->isWidgetType()Description
TRUEnever evaluated
FALSEnever evaluated
0
429 QWidget *pw = static_cast<QWidget *>(parent);-
430 return pw->style()->pixelMetric(pm, 0, pw);
never executed: return pw->style()->pixelMetric(pm, 0, pw);
0
431 } else {-
432 return static_cast<QLayout *>(parent)->spacing();
never executed: return static_cast<QLayout *>(parent)->spacing();
0
433 }-
434}-
435-
436QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

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