| 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 "qboxlayout.h" | - |
| 43 | #include "qapplication.h" | - |
| 44 | #include "qwidget.h" | - |
| 45 | #include "qlist.h" | - |
| 46 | #include "qsizepolicy.h" | - |
| 47 | #include "qvector.h" | - |
| 48 | | - |
| 49 | #include "qlayoutengine_p.h" | - |
| 50 | #include "qlayout_p.h" | - |
| 51 | | - |
| 52 | QT_BEGIN_NAMESPACE | - |
| 53 | | - |
| 54 | /* | - |
| 55 | Returns true if the \a widget can be added to the \a layout; | - |
| 56 | otherwise returns false. | - |
| 57 | */ | - |
| 58 | static bool checkWidget(QLayout *layout, QWidget *widget) | - |
| 59 | { | - |
| 60 | if (!widget) { partially evaluated: !widget| no Evaluation Count:0 | yes Evaluation Count:15667 |
| 0-15667 |
| 61 | qWarning("QLayout: Cannot add null widget to %s/%s", layout->metaObject()->className(), never executed (the execution status of this line is deduced): QMessageLogger("kernel/qboxlayout.cpp", 61, __PRETTY_FUNCTION__).warning("QLayout: Cannot add null widget to %s/%s", layout->metaObject()->className(), | - |
| 62 | layout->objectName().toLocal8Bit().data()); never executed (the execution status of this line is deduced): layout->objectName().toLocal8Bit().data()); | - |
| 63 | return false; never executed: return false; | 0 |
| 64 | } | - |
| 65 | return true; executed: return true;Execution Count:15667 | 15667 |
| 66 | } | - |
| 67 | | - |
| 68 | struct QBoxLayoutItem | - |
| 69 | { | - |
| 70 | QBoxLayoutItem(QLayoutItem *it, int stretch_ = 0) | - |
| 71 | : item(it), stretch(stretch_), magic(false) { } executed: }Execution Count:18202 | 18202 |
| 72 | ~QBoxLayoutItem() { delete item; } executed: }Execution Count:16892 | 16892 |
| 73 | | - |
| 74 | int hfw(int w) { | - |
| 75 | if (item->hasHeightForWidth()) { evaluated: item->hasHeightForWidth()| yes Evaluation Count:92 | yes Evaluation Count:38 |
| 38-92 |
| 76 | return item->heightForWidth(w); executed: return item->heightForWidth(w);Execution Count:92 | 92 |
| 77 | } else { | - |
| 78 | return item->sizeHint().height(); executed: return item->sizeHint().height();Execution Count:38 | 38 |
| 79 | } | - |
| 80 | } | - |
| 81 | int mhfw(int w) { | - |
| 82 | if (item->hasHeightForWidth()) { evaluated: item->hasHeightForWidth()| yes Evaluation Count:92 | yes Evaluation Count:38 |
| 38-92 |
| 83 | return item->heightForWidth(w); executed: return item->heightForWidth(w);Execution Count:92 | 92 |
| 84 | } else { | - |
| 85 | return item->minimumSize().height(); executed: return item->minimumSize().height();Execution Count:38 | 38 |
| 86 | } | - |
| 87 | } | - |
| 88 | int hStretch() { | - |
| 89 | if (stretch == 0 && item->widget()) { partially evaluated: stretch == 0| yes Evaluation Count:7941 | no Evaluation Count:0 |
evaluated: item->widget()| yes Evaluation Count:7079 | yes Evaluation Count:862 |
| 0-7941 |
| 90 | return item->widget()->sizePolicy().horizontalStretch(); executed: return item->widget()->sizePolicy().horizontalStretch();Execution Count:7079 | 7079 |
| 91 | } else { | - |
| 92 | return stretch; executed: return stretch;Execution Count:862 | 862 |
| 93 | } | - |
| 94 | } | - |
| 95 | int vStretch() { | - |
| 96 | if (stretch == 0 && item->widget()) { partially evaluated: stretch == 0| yes Evaluation Count:6920 | no Evaluation Count:0 |
evaluated: item->widget()| yes Evaluation Count:5141 | yes Evaluation Count:1779 |
| 0-6920 |
| 97 | return item->widget()->sizePolicy().verticalStretch(); executed: return item->widget()->sizePolicy().verticalStretch();Execution Count:5141 | 5141 |
| 98 | } else { | - |
| 99 | return stretch; executed: return stretch;Execution Count:1779 | 1779 |
| 100 | } | - |
| 101 | } | - |
| 102 | | - |
| 103 | QLayoutItem *item; | - |
| 104 | int stretch; | - |
| 105 | bool magic; | - |
| 106 | }; | - |
| 107 | | - |
| 108 | class QBoxLayoutPrivate : public QLayoutPrivate | - |
| 109 | { | - |
| 110 | Q_DECLARE_PUBLIC(QBoxLayout) | - |
| 111 | public: | - |
| 112 | QBoxLayoutPrivate() : hfwWidth(-1), dirty(true), spacing(-1) { } executed: }Execution Count:12513 | 12513 |
| 113 | ~QBoxLayoutPrivate(); | - |
| 114 | | - |
| 115 | void setDirty() { | - |
| 116 | geomArray.clear(); executed (the execution status of this line is deduced): geomArray.clear(); | - |
| 117 | hfwWidth = -1; executed (the execution status of this line is deduced): hfwWidth = -1; | - |
| 118 | hfwHeight = -1; executed (the execution status of this line is deduced): hfwHeight = -1; | - |
| 119 | dirty = true; executed (the execution status of this line is deduced): dirty = true; | - |
| 120 | } executed: }Execution Count:79457 | 79457 |
| 121 | | - |
| 122 | QList<QBoxLayoutItem *> list; | - |
| 123 | QVector<QLayoutStruct> geomArray; | - |
| 124 | int hfwWidth; | - |
| 125 | int hfwHeight; | - |
| 126 | int hfwMinHeight; | - |
| 127 | QSize sizeHint; | - |
| 128 | QSize minSize; | - |
| 129 | QSize maxSize; | - |
| 130 | int leftMargin, topMargin, rightMargin, bottomMargin; | - |
| 131 | Qt::Orientations expanding; | - |
| 132 | uint hasHfw : 1; | - |
| 133 | uint dirty : 1; | - |
| 134 | QBoxLayout::Direction dir; | - |
| 135 | int spacing; | - |
| 136 | | - |
| 137 | inline void deleteAll() { while (!list.isEmpty()) delete list.takeFirst(); } executed: delete list.takeFirst();Execution Count:14850 executed: }Execution Count:11213 evaluated: !list.isEmpty()| yes Evaluation Count:14850 | yes Evaluation Count:11213 |
| 11213-14850 |
| 138 | | - |
| 139 | void setupGeom(); | - |
| 140 | void calcHfw(int); | - |
| 141 | | - |
| 142 | void effectiveMargins(int *left, int *top, int *right, int *bottom) const; | - |
| 143 | }; | - |
| 144 | | - |
| 145 | QBoxLayoutPrivate::~QBoxLayoutPrivate() | - |
| 146 | { | - |
| 147 | } | - |
| 148 | | - |
| 149 | static inline bool horz(QBoxLayout::Direction dir) | - |
| 150 | { | - |
| 151 | return dir == QBoxLayout::RightToLeft || dir == QBoxLayout::LeftToRight; executed: return dir == QBoxLayout::RightToLeft || dir == QBoxLayout::LeftToRight;Execution Count:44564 | 44564 |
| 152 | } | - |
| 153 | | - |
| 154 | /** | - |
| 155 | * The purpose of this function is to make sure that widgets are not laid out outside its layout. | - |
| 156 | * E.g. the layoutItemRect margins are only meant to take of the surrounding margins/spacings. | - |
| 157 | * However, if the margin is 0, it can easily cover the area of a widget above it. | - |
| 158 | */ | - |
| 159 | void QBoxLayoutPrivate::effectiveMargins(int *left, int *top, int *right, int *bottom) const | - |
| 160 | { | - |
| 161 | int l = leftMargin; executed (the execution status of this line is deduced): int l = leftMargin; | - |
| 162 | int t = topMargin; executed (the execution status of this line is deduced): int t = topMargin; | - |
| 163 | int r = rightMargin; executed (the execution status of this line is deduced): int r = rightMargin; | - |
| 164 | int b = bottomMargin; executed (the execution status of this line is deduced): int b = bottomMargin; | - |
| 165 | #ifdef Q_OS_MAC | - |
| 166 | Q_Q(const QBoxLayout); | - |
| 167 | if (horz(dir)) { | - |
| 168 | QBoxLayoutItem *leftBox = 0; | - |
| 169 | QBoxLayoutItem *rightBox = 0; | - |
| 170 | | - |
| 171 | if (left || right) { | - |
| 172 | leftBox = list.value(0); | - |
| 173 | rightBox = list.value(list.count() - 1); | - |
| 174 | if (dir == QBoxLayout::RightToLeft) | - |
| 175 | qSwap(leftBox, rightBox); | - |
| 176 | | - |
| 177 | int leftDelta = 0; | - |
| 178 | int rightDelta = 0; | - |
| 179 | if (leftBox) { | - |
| 180 | QLayoutItem *itm = leftBox->item; | - |
| 181 | if (QWidget *w = itm->widget()) | - |
| 182 | leftDelta = itm->geometry().left() - w->geometry().left(); | - |
| 183 | } | - |
| 184 | if (rightBox) { | - |
| 185 | QLayoutItem *itm = rightBox->item; | - |
| 186 | if (QWidget *w = itm->widget()) | - |
| 187 | rightDelta = w->geometry().right() - itm->geometry().right(); | - |
| 188 | } | - |
| 189 | QWidget *w = q->parentWidget(); | - |
| 190 | Qt::LayoutDirection layoutDirection = w ? w->layoutDirection() : QApplication::layoutDirection(); | - |
| 191 | if (layoutDirection == Qt::RightToLeft) | - |
| 192 | qSwap(leftDelta, rightDelta); | - |
| 193 | | - |
| 194 | l = qMax(l, leftDelta); | - |
| 195 | r = qMax(r, rightDelta); | - |
| 196 | } | - |
| 197 | | - |
| 198 | int count = top || bottom ? list.count() : 0; | - |
| 199 | for (int i = 0; i < count; ++i) { | - |
| 200 | QBoxLayoutItem *box = list.at(i); | - |
| 201 | QLayoutItem *itm = box->item; | - |
| 202 | QWidget *w = itm->widget(); | - |
| 203 | if (w) { | - |
| 204 | QRect lir = itm->geometry(); | - |
| 205 | QRect wr = w->geometry(); | - |
| 206 | if (top) | - |
| 207 | t = qMax(t, lir.top() - wr.top()); | - |
| 208 | if (bottom) | - |
| 209 | b = qMax(b, wr.bottom() - lir.bottom()); | - |
| 210 | } | - |
| 211 | } | - |
| 212 | } else { // vertical layout | - |
| 213 | QBoxLayoutItem *topBox = 0; | - |
| 214 | QBoxLayoutItem *bottomBox = 0; | - |
| 215 | | - |
| 216 | if (top || bottom) { | - |
| 217 | topBox = list.value(0); | - |
| 218 | bottomBox = list.value(list.count() - 1); | - |
| 219 | if (dir == QBoxLayout::BottomToTop) { | - |
| 220 | qSwap(topBox, bottomBox); | - |
| 221 | } | - |
| 222 | | - |
| 223 | if (top && topBox) { | - |
| 224 | QLayoutItem *itm = topBox->item; | - |
| 225 | QWidget *w = itm->widget(); | - |
| 226 | if (w) | - |
| 227 | t = qMax(t, itm->geometry().top() - w->geometry().top()); | - |
| 228 | } | - |
| 229 | | - |
| 230 | if (bottom && bottomBox) { | - |
| 231 | QLayoutItem *itm = bottomBox->item; | - |
| 232 | QWidget *w = itm->widget(); | - |
| 233 | if (w) | - |
| 234 | b = qMax(b, w->geometry().bottom() - itm->geometry().bottom()); | - |
| 235 | } | - |
| 236 | } | - |
| 237 | | - |
| 238 | int count = left || right ? list.count() : 0; | - |
| 239 | for (int i = 0; i < count; ++i) { | - |
| 240 | QBoxLayoutItem *box = list.at(i); | - |
| 241 | QLayoutItem *itm = box->item; | - |
| 242 | QWidget *w = itm->widget(); | - |
| 243 | if (w) { | - |
| 244 | QRect lir = itm->geometry(); | - |
| 245 | QRect wr = w->geometry(); | - |
| 246 | if (left) | - |
| 247 | l = qMax(l, lir.left() - wr.left()); | - |
| 248 | if (right) | - |
| 249 | r = qMax(r, wr.right() - lir.right()); | - |
| 250 | } | - |
| 251 | } | - |
| 252 | } | - |
| 253 | #endif | - |
| 254 | if (left) evaluated: left| yes Evaluation Count:11265 | yes Evaluation Count:17 |
| 17-11265 |
| 255 | *left = l; executed: *left = l;Execution Count:11265 | 11265 |
| 256 | if (top) partially evaluated: top| yes Evaluation Count:11282 | no Evaluation Count:0 |
| 0-11282 |
| 257 | *top = t; executed: *top = t;Execution Count:11282 | 11282 |
| 258 | if (right) evaluated: right| yes Evaluation Count:11265 | yes Evaluation Count:17 |
| 17-11265 |
| 259 | *right = r; executed: *right = r;Execution Count:11265 | 11265 |
| 260 | if (bottom) partially evaluated: bottom| yes Evaluation Count:11282 | no Evaluation Count:0 |
| 0-11282 |
| 261 | *bottom = b; executed: *bottom = b;Execution Count:11282 | 11282 |
| 262 | } executed: }Execution Count:11282 | 11282 |
| 263 | | - |
| 264 | | - |
| 265 | /* | - |
| 266 | Initializes the data structure needed by qGeomCalc and | - |
| 267 | recalculates max/min and size hint. | - |
| 268 | */ | - |
| 269 | void QBoxLayoutPrivate::setupGeom() | - |
| 270 | { | - |
| 271 | if (!dirty) partially evaluated: !dirty| no Evaluation Count:0 | yes Evaluation Count:6458 |
| 0-6458 |
| 272 | return; | 0 |
| 273 | | - |
| 274 | Q_Q(QBoxLayout); executed (the execution status of this line is deduced): QBoxLayout * const q = q_func(); | - |
| 275 | int maxw = horz(dir) ? 0 : QLAYOUTSIZE_MAX; evaluated: horz(dir)| yes Evaluation Count:2653 | yes Evaluation Count:3805 |
| 2653-3805 |
| 276 | int maxh = horz(dir) ? QLAYOUTSIZE_MAX : 0; evaluated: horz(dir)| yes Evaluation Count:2653 | yes Evaluation Count:3805 |
| 2653-3805 |
| 277 | int minw = 0; executed (the execution status of this line is deduced): int minw = 0; | - |
| 278 | int minh = 0; executed (the execution status of this line is deduced): int minh = 0; | - |
| 279 | int hintw = 0; executed (the execution status of this line is deduced): int hintw = 0; | - |
| 280 | int hinth = 0; executed (the execution status of this line is deduced): int hinth = 0; | - |
| 281 | | - |
| 282 | bool horexp = false; executed (the execution status of this line is deduced): bool horexp = false; | - |
| 283 | bool verexp = false; executed (the execution status of this line is deduced): bool verexp = false; | - |
| 284 | | - |
| 285 | hasHfw = false; executed (the execution status of this line is deduced): hasHfw = false; | - |
| 286 | | - |
| 287 | int n = list.count(); executed (the execution status of this line is deduced): int n = list.count(); | - |
| 288 | geomArray.clear(); executed (the execution status of this line is deduced): geomArray.clear(); | - |
| 289 | QVector<QLayoutStruct> a(n); executed (the execution status of this line is deduced): QVector<QLayoutStruct> a(n); | - |
| 290 | | - |
| 291 | QSizePolicy::ControlTypes controlTypes1; executed (the execution status of this line is deduced): QSizePolicy::ControlTypes controlTypes1; | - |
| 292 | QSizePolicy::ControlTypes controlTypes2; executed (the execution status of this line is deduced): QSizePolicy::ControlTypes controlTypes2; | - |
| 293 | int fixedSpacing = q->spacing(); executed (the execution status of this line is deduced): int fixedSpacing = q->spacing(); | - |
| 294 | int previousNonEmptyIndex = -1; executed (the execution status of this line is deduced): int previousNonEmptyIndex = -1; | - |
| 295 | | - |
| 296 | QStyle *style = 0; executed (the execution status of this line is deduced): QStyle *style = 0; | - |
| 297 | if (fixedSpacing < 0) { evaluated: fixedSpacing < 0| yes Evaluation Count:5 | yes Evaluation Count:6453 |
| 5-6453 |
| 298 | if (QWidget *parentWidget = q->parentWidget()) partially evaluated: QWidget *parentWidget = q->parentWidget()| yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
| 299 | style = parentWidget->style(); executed: style = parentWidget->style();Execution Count:5 | 5 |
| 300 | } executed: }Execution Count:5 | 5 |
| 301 | | - |
| 302 | for (int i = 0; i < n; i++) { evaluated: i < n| yes Evaluation Count:15309 | yes Evaluation Count:6458 |
| 6458-15309 |
| 303 | QBoxLayoutItem *box = list.at(i); executed (the execution status of this line is deduced): QBoxLayoutItem *box = list.at(i); | - |
| 304 | QSize max = box->item->maximumSize(); executed (the execution status of this line is deduced): QSize max = box->item->maximumSize(); | - |
| 305 | QSize min = box->item->minimumSize(); executed (the execution status of this line is deduced): QSize min = box->item->minimumSize(); | - |
| 306 | QSize hint = box->item->sizeHint(); executed (the execution status of this line is deduced): QSize hint = box->item->sizeHint(); | - |
| 307 | Qt::Orientations exp = box->item->expandingDirections(); executed (the execution status of this line is deduced): Qt::Orientations exp = box->item->expandingDirections(); | - |
| 308 | bool empty = box->item->isEmpty(); executed (the execution status of this line is deduced): bool empty = box->item->isEmpty(); | - |
| 309 | int spacing = 0; executed (the execution status of this line is deduced): int spacing = 0; | - |
| 310 | | - |
| 311 | if (!empty) { evaluated: !empty| yes Evaluation Count:10418 | yes Evaluation Count:4891 |
| 4891-10418 |
| 312 | if (fixedSpacing >= 0) { evaluated: fixedSpacing >= 0| yes Evaluation Count:10388 | yes Evaluation Count:30 |
| 30-10388 |
| 313 | spacing = (previousNonEmptyIndex >= 0) ? fixedSpacing : 0; evaluated: (previousNonEmptyIndex >= 0)| yes Evaluation Count:4268 | yes Evaluation Count:6120 |
| 4268-6120 |
| 314 | #ifdef Q_OS_MAC | - |
| 315 | if (!horz(dir) && previousNonEmptyIndex >= 0) { | - |
| 316 | QBoxLayoutItem *sibling = (dir == QBoxLayout::TopToBottom ? box : list.at(previousNonEmptyIndex)); | - |
| 317 | if (sibling) { | - |
| 318 | QWidget *wid = sibling->item->widget(); | - |
| 319 | if (wid) | - |
| 320 | spacing = qMax(spacing, sibling->item->geometry().top() - wid->geometry().top()); | - |
| 321 | } | - |
| 322 | } | - |
| 323 | #endif | - |
| 324 | } else { executed: }Execution Count:10388 | 10388 |
| 325 | controlTypes1 = controlTypes2; executed (the execution status of this line is deduced): controlTypes1 = controlTypes2; | - |
| 326 | controlTypes2 = box->item->controlTypes(); executed (the execution status of this line is deduced): controlTypes2 = box->item->controlTypes(); | - |
| 327 | if (previousNonEmptyIndex >= 0) { evaluated: previousNonEmptyIndex >= 0| yes Evaluation Count:25 | yes Evaluation Count:5 |
| 5-25 |
| 328 | QSizePolicy::ControlTypes actual1 = controlTypes1; executed (the execution status of this line is deduced): QSizePolicy::ControlTypes actual1 = controlTypes1; | - |
| 329 | QSizePolicy::ControlTypes actual2 = controlTypes2; executed (the execution status of this line is deduced): QSizePolicy::ControlTypes actual2 = controlTypes2; | - |
| 330 | if (dir == QBoxLayout::RightToLeft || dir == QBoxLayout::BottomToTop) partially evaluated: dir == QBoxLayout::RightToLeft| no Evaluation Count:0 | yes Evaluation Count:25 |
partially evaluated: dir == QBoxLayout::BottomToTop| no Evaluation Count:0 | yes Evaluation Count:25 |
| 0-25 |
| 331 | qSwap(actual1, actual2); never executed: qSwap(actual1, actual2); | 0 |
| 332 | | - |
| 333 | if (style) { partially evaluated: style| yes Evaluation Count:25 | no Evaluation Count:0 |
| 0-25 |
| 334 | spacing = style->combinedLayoutSpacing(actual1, actual2, executed (the execution status of this line is deduced): spacing = style->combinedLayoutSpacing(actual1, actual2, | - |
| 335 | horz(dir) ? Qt::Horizontal : Qt::Vertical, executed (the execution status of this line is deduced): horz(dir) ? Qt::Horizontal : Qt::Vertical, | - |
| 336 | 0, q->parentWidget()); executed (the execution status of this line is deduced): 0, q->parentWidget()); | - |
| 337 | if (spacing < 0) partially evaluated: spacing < 0| no Evaluation Count:0 | yes Evaluation Count:25 |
| 0-25 |
| 338 | spacing = 0; never executed: spacing = 0; | 0 |
| 339 | } executed: }Execution Count:25 | 25 |
| 340 | } executed: }Execution Count:25 | 25 |
| 341 | } executed: }Execution Count:30 | 30 |
| 342 | | - |
| 343 | if (previousNonEmptyIndex >= 0) evaluated: previousNonEmptyIndex >= 0| yes Evaluation Count:4293 | yes Evaluation Count:6125 |
| 4293-6125 |
| 344 | a[previousNonEmptyIndex].spacing = spacing; executed: a[previousNonEmptyIndex].spacing = spacing;Execution Count:4293 | 4293 |
| 345 | previousNonEmptyIndex = i; executed (the execution status of this line is deduced): previousNonEmptyIndex = i; | - |
| 346 | } executed: }Execution Count:10418 | 10418 |
| 347 | | - |
| 348 | bool ignore = empty && box->item->widget(); // ignore hidden widgets evaluated: empty| yes Evaluation Count:4891 | yes Evaluation Count:10418 |
evaluated: box->item->widget()| yes Evaluation Count:1915 | yes Evaluation Count:2976 |
| 1915-10418 |
| 349 | bool dummy = true; executed (the execution status of this line is deduced): bool dummy = true; | - |
| 350 | if (horz(dir)) { evaluated: horz(dir)| yes Evaluation Count:8386 | yes Evaluation Count:6923 |
| 6923-8386 |
| 351 | bool expand = (exp & Qt::Horizontal || box->stretch > 0); evaluated: exp & Qt::Horizontal| yes Evaluation Count:1207 | yes Evaluation Count:7179 |
partially evaluated: box->stretch > 0| no Evaluation Count:0 | yes Evaluation Count:7179 |
| 0-7179 |
| 352 | horexp = horexp || expand; evaluated: horexp| yes Evaluation Count:3578 | yes Evaluation Count:4808 |
evaluated: expand| yes Evaluation Count:959 | yes Evaluation Count:3849 |
| 959-4808 |
| 353 | maxw += spacing + max.width(); executed (the execution status of this line is deduced): maxw += spacing + max.width(); | - |
| 354 | minw += spacing + min.width(); executed (the execution status of this line is deduced): minw += spacing + min.width(); | - |
| 355 | hintw += spacing + hint.width(); executed (the execution status of this line is deduced): hintw += spacing + hint.width(); | - |
| 356 | if (!ignore) evaluated: !ignore| yes Evaluation Count:7423 | yes Evaluation Count:963 |
| 963-7423 |
| 357 | qMaxExpCalc(maxh, verexp, dummy, executed: qMaxExpCalc(maxh, verexp, dummy, max.height(), exp & Qt::Vertical, box->item->isEmpty());Execution Count:7423 | 7423 |
| 358 | max.height(), exp & Qt::Vertical, box->item->isEmpty()); executed: qMaxExpCalc(maxh, verexp, dummy, max.height(), exp & Qt::Vertical, box->item->isEmpty());Execution Count:7423 | 7423 |
| 359 | minh = qMax(minh, min.height()); executed (the execution status of this line is deduced): minh = qMax(minh, min.height()); | - |
| 360 | hinth = qMax(hinth, hint.height()); executed (the execution status of this line is deduced): hinth = qMax(hinth, hint.height()); | - |
| 361 | | - |
| 362 | a[i].sizeHint = hint.width(); executed (the execution status of this line is deduced): a[i].sizeHint = hint.width(); | - |
| 363 | a[i].maximumSize = max.width(); executed (the execution status of this line is deduced): a[i].maximumSize = max.width(); | - |
| 364 | a[i].minimumSize = min.width(); executed (the execution status of this line is deduced): a[i].minimumSize = min.width(); | - |
| 365 | a[i].expansive = expand; executed (the execution status of this line is deduced): a[i].expansive = expand; | - |
| 366 | a[i].stretch = box->stretch ? box->stretch : box->hStretch(); evaluated: box->stretch| yes Evaluation Count:445 | yes Evaluation Count:7941 |
| 445-7941 |
| 367 | } else { executed: }Execution Count:8386 | 8386 |
| 368 | bool expand = (exp & Qt::Vertical || box->stretch > 0); evaluated: exp & Qt::Vertical| yes Evaluation Count:1374 | yes Evaluation Count:5549 |
partially evaluated: box->stretch > 0| no Evaluation Count:0 | yes Evaluation Count:5549 |
| 0-5549 |
| 369 | verexp = verexp || expand; evaluated: verexp| yes Evaluation Count:88 | yes Evaluation Count:6835 |
evaluated: expand| yes Evaluation Count:1371 | yes Evaluation Count:5464 |
| 88-6835 |
| 370 | maxh += spacing + max.height(); executed (the execution status of this line is deduced): maxh += spacing + max.height(); | - |
| 371 | minh += spacing + min.height(); executed (the execution status of this line is deduced): minh += spacing + min.height(); | - |
| 372 | hinth += spacing + hint.height(); executed (the execution status of this line is deduced): hinth += spacing + hint.height(); | - |
| 373 | if (!ignore) evaluated: !ignore| yes Evaluation Count:5971 | yes Evaluation Count:952 |
| 952-5971 |
| 374 | qMaxExpCalc(maxw, horexp, dummy, executed: qMaxExpCalc(maxw, horexp, dummy, max.width(), exp & Qt::Horizontal, box->item->isEmpty());Execution Count:5971 | 5971 |
| 375 | max.width(), exp & Qt::Horizontal, box->item->isEmpty()); executed: qMaxExpCalc(maxw, horexp, dummy, max.width(), exp & Qt::Horizontal, box->item->isEmpty());Execution Count:5971 | 5971 |
| 376 | minw = qMax(minw, min.width()); executed (the execution status of this line is deduced): minw = qMax(minw, min.width()); | - |
| 377 | hintw = qMax(hintw, hint.width()); executed (the execution status of this line is deduced): hintw = qMax(hintw, hint.width()); | - |
| 378 | | - |
| 379 | a[i].sizeHint = hint.height(); executed (the execution status of this line is deduced): a[i].sizeHint = hint.height(); | - |
| 380 | a[i].maximumSize = max.height(); executed (the execution status of this line is deduced): a[i].maximumSize = max.height(); | - |
| 381 | a[i].minimumSize = min.height(); executed (the execution status of this line is deduced): a[i].minimumSize = min.height(); | - |
| 382 | a[i].expansive = expand; executed (the execution status of this line is deduced): a[i].expansive = expand; | - |
| 383 | a[i].stretch = box->stretch ? box->stretch : box->vStretch(); evaluated: box->stretch| yes Evaluation Count:3 | yes Evaluation Count:6920 |
| 3-6920 |
| 384 | } executed: }Execution Count:6923 | 6923 |
| 385 | | - |
| 386 | a[i].empty = empty; executed (the execution status of this line is deduced): a[i].empty = empty; | - |
| 387 | a[i].spacing = 0; // might be initialized with a non-zero value in a later iteration executed (the execution status of this line is deduced): a[i].spacing = 0; | - |
| 388 | hasHfw = hasHfw || box->item->hasHeightForWidth(); evaluated: hasHfw| yes Evaluation Count:20 | yes Evaluation Count:15289 |
evaluated: box->item->hasHeightForWidth()| yes Evaluation Count:42 | yes Evaluation Count:15247 |
| 20-15289 |
| 389 | } executed: }Execution Count:15309 | 15309 |
| 390 | | - |
| 391 | geomArray = a; executed (the execution status of this line is deduced): geomArray = a; | - |
| 392 | | - |
| 393 | expanding = (Qt::Orientations) executed (the execution status of this line is deduced): expanding = (Qt::Orientations) | - |
| 394 | ((horexp ? Qt::Horizontal : 0) executed (the execution status of this line is deduced): ((horexp ? Qt::Horizontal : 0) | - |
| 395 | | (verexp ? Qt::Vertical : 0)); executed (the execution status of this line is deduced): | (verexp ? Qt::Vertical : 0)); | - |
| 396 | | - |
| 397 | minSize = QSize(minw, minh); executed (the execution status of this line is deduced): minSize = QSize(minw, minh); | - |
| 398 | maxSize = QSize(maxw, maxh).expandedTo(minSize); executed (the execution status of this line is deduced): maxSize = QSize(maxw, maxh).expandedTo(minSize); | - |
| 399 | sizeHint = QSize(hintw, hinth).expandedTo(minSize).boundedTo(maxSize); executed (the execution status of this line is deduced): sizeHint = QSize(hintw, hinth).expandedTo(minSize).boundedTo(maxSize); | - |
| 400 | | - |
| 401 | q->getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin); executed (the execution status of this line is deduced): q->getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin); | - |
| 402 | int left, top, right, bottom; executed (the execution status of this line is deduced): int left, top, right, bottom; | - |
| 403 | effectiveMargins(&left, &top, &right, &bottom); executed (the execution status of this line is deduced): effectiveMargins(&left, &top, &right, &bottom); | - |
| 404 | QSize extra(left + right, top + bottom); executed (the execution status of this line is deduced): QSize extra(left + right, top + bottom); | - |
| 405 | | - |
| 406 | minSize += extra; executed (the execution status of this line is deduced): minSize += extra; | - |
| 407 | maxSize += extra; executed (the execution status of this line is deduced): maxSize += extra; | - |
| 408 | sizeHint += extra; executed (the execution status of this line is deduced): sizeHint += extra; | - |
| 409 | | - |
| 410 | dirty = false; executed (the execution status of this line is deduced): dirty = false; | - |
| 411 | } executed: }Execution Count:6458 | 6458 |
| 412 | | - |
| 413 | /* | - |
| 414 | Calculates and stores the preferred height given the width \a w. | - |
| 415 | */ | - |
| 416 | void QBoxLayoutPrivate::calcHfw(int w) | - |
| 417 | { | - |
| 418 | QVector<QLayoutStruct> &a = geomArray; executed (the execution status of this line is deduced): QVector<QLayoutStruct> &a = geomArray; | - |
| 419 | int n = a.count(); executed (the execution status of this line is deduced): int n = a.count(); | - |
| 420 | int h = 0; executed (the execution status of this line is deduced): int h = 0; | - |
| 421 | int mh = 0; executed (the execution status of this line is deduced): int mh = 0; | - |
| 422 | | - |
| 423 | Q_ASSERT(n == list.size()); executed (the execution status of this line is deduced): qt_noop(); | - |
| 424 | | - |
| 425 | if (horz(dir)) { partially evaluated: horz(dir)| no Evaluation Count:0 | yes Evaluation Count:92 |
| 0-92 |
| 426 | qGeomCalc(a, 0, n, 0, w); never executed (the execution status of this line is deduced): qGeomCalc(a, 0, n, 0, w); | - |
| 427 | for (int i = 0; i < n; i++) { | 0 |
| 428 | QBoxLayoutItem *box = list.at(i); never executed (the execution status of this line is deduced): QBoxLayoutItem *box = list.at(i); | - |
| 429 | h = qMax(h, box->hfw(a.at(i).size)); never executed (the execution status of this line is deduced): h = qMax(h, box->hfw(a.at(i).size)); | - |
| 430 | mh = qMax(mh, box->mhfw(a.at(i).size)); never executed (the execution status of this line is deduced): mh = qMax(mh, box->mhfw(a.at(i).size)); | - |
| 431 | } | 0 |
| 432 | } else { | 0 |
| 433 | for (int i = 0; i < n; ++i) { evaluated: i < n| yes Evaluation Count:130 | yes Evaluation Count:92 |
| 92-130 |
| 434 | QBoxLayoutItem *box = list.at(i); executed (the execution status of this line is deduced): QBoxLayoutItem *box = list.at(i); | - |
| 435 | int spacing = a.at(i).spacing; executed (the execution status of this line is deduced): int spacing = a.at(i).spacing; | - |
| 436 | h += box->hfw(w); executed (the execution status of this line is deduced): h += box->hfw(w); | - |
| 437 | mh += box->mhfw(w); executed (the execution status of this line is deduced): mh += box->mhfw(w); | - |
| 438 | h += spacing; executed (the execution status of this line is deduced): h += spacing; | - |
| 439 | mh += spacing; executed (the execution status of this line is deduced): mh += spacing; | - |
| 440 | } executed: }Execution Count:130 | 130 |
| 441 | } executed: }Execution Count:92 | 92 |
| 442 | hfwWidth = w; executed (the execution status of this line is deduced): hfwWidth = w; | - |
| 443 | hfwHeight = h; executed (the execution status of this line is deduced): hfwHeight = h; | - |
| 444 | hfwMinHeight = mh; executed (the execution status of this line is deduced): hfwMinHeight = mh; | - |
| 445 | } executed: }Execution Count:92 | 92 |
| 446 | | - |
| 447 | | - |
| 448 | /*! | - |
| 449 | \class QBoxLayout | - |
| 450 | | - |
| 451 | \brief The QBoxLayout class lines up child widgets horizontally or | - |
| 452 | vertically. | - |
| 453 | | - |
| 454 | \ingroup geomanagement | - |
| 455 | \inmodule QtWidgets | - |
| 456 | | - |
| 457 | QBoxLayout takes the space it gets (from its parent layout or from | - |
| 458 | the parentWidget()), divides it up into a row of boxes, and makes | - |
| 459 | each managed widget fill one box. | - |
| 460 | | - |
| 461 | \image qhboxlayout-with-5-children.png Horizontal box layout with five child widgets | - |
| 462 | | - |
| 463 | If the QBoxLayout's orientation is Qt::Horizontal the boxes are | - |
| 464 | placed in a row, with suitable sizes. Each widget (or other box) | - |
| 465 | will get at least its minimum size and at most its maximum size. | - |
| 466 | Any excess space is shared according to the stretch factors (more | - |
| 467 | about that below). | - |
| 468 | | - |
| 469 | \image qvboxlayout-with-5-children.png Vertical box layout with five child widgets | - |
| 470 | | - |
| 471 | If the QBoxLayout's orientation is Qt::Vertical, the boxes are | - |
| 472 | placed in a column, again with suitable sizes. | - |
| 473 | | - |
| 474 | The easiest way to create a QBoxLayout is to use one of the | - |
| 475 | convenience classes, e.g. QHBoxLayout (for Qt::Horizontal boxes) | - |
| 476 | or QVBoxLayout (for Qt::Vertical boxes). You can also use the | - |
| 477 | QBoxLayout constructor directly, specifying its direction as | - |
| 478 | LeftToRight, RightToLeft, TopToBottom, or BottomToTop. | - |
| 479 | | - |
| 480 | If the QBoxLayout is not the top-level layout (i.e. it is not | - |
| 481 | managing all of the widget's area and children), you must add it | - |
| 482 | to its parent layout before you can do anything with it. The | - |
| 483 | normal way to add a layout is by calling | - |
| 484 | parentLayout-\>addLayout(). | - |
| 485 | | - |
| 486 | Once you have done this, you can add boxes to the QBoxLayout using | - |
| 487 | one of four functions: | - |
| 488 | | - |
| 489 | \list | - |
| 490 | \li addWidget() to add a widget to the QBoxLayout and set the | - |
| 491 | widget's stretch factor. (The stretch factor is along the row of | - |
| 492 | boxes.) | - |
| 493 | | - |
| 494 | \li addSpacing() to create an empty box; this is one of the | - |
| 495 | functions you use to create nice and spacious dialogs. See below | - |
| 496 | for ways to set margins. | - |
| 497 | | - |
| 498 | \li addStretch() to create an empty, stretchable box. | - |
| 499 | | - |
| 500 | \li addLayout() to add a box containing another QLayout to the row | - |
| 501 | and set that layout's stretch factor. | - |
| 502 | \endlist | - |
| 503 | | - |
| 504 | Use insertWidget(), insertSpacing(), insertStretch() or | - |
| 505 | insertLayout() to insert a box at a specified position in the | - |
| 506 | layout. | - |
| 507 | | - |
| 508 | QBoxLayout also includes two margin widths: | - |
| 509 | | - |
| 510 | \list | - |
| 511 | \li setContentsMargins() sets the width of the outer border on | - |
| 512 | each side of the widget. This is the width of the reserved space | - |
| 513 | along each of the QBoxLayout's four sides. | - |
| 514 | \li setSpacing() sets the width between neighboring boxes. (You | - |
| 515 | can use addSpacing() to get more space at a particular spot.) | - |
| 516 | \endlist | - |
| 517 | | - |
| 518 | The margin default is provided by the style. The default margin | - |
| 519 | most Qt styles specify is 9 for child widgets and 11 for windows. | - |
| 520 | The spacing defaults to the same as the margin width for a | - |
| 521 | top-level layout, or to the same as the parent layout. | - |
| 522 | | - |
| 523 | To remove a widget from a layout, call removeWidget(). Calling | - |
| 524 | QWidget::hide() on a widget also effectively removes the widget | - |
| 525 | from the layout until QWidget::show() is called. | - |
| 526 | | - |
| 527 | You will almost always want to use QVBoxLayout and QHBoxLayout | - |
| 528 | rather than QBoxLayout because of their convenient constructors. | - |
| 529 | | - |
| 530 | \sa QGridLayout, QStackedLayout, {Layout Management} | - |
| 531 | */ | - |
| 532 | | - |
| 533 | /*! | - |
| 534 | \enum QBoxLayout::Direction | - |
| 535 | | - |
| 536 | This type is used to determine the direction of a box layout. | - |
| 537 | | - |
| 538 | \value LeftToRight Horizontal from left to right. | - |
| 539 | \value RightToLeft Horizontal from right to left. | - |
| 540 | \value TopToBottom Vertical from top to bottom. | - |
| 541 | \value BottomToTop Vertical from bottom to top. | - |
| 542 | | - |
| 543 | \omitvalue Down | - |
| 544 | \omitvalue Up | - |
| 545 | */ | - |
| 546 | | - |
| 547 | /*! | - |
| 548 | Constructs a new QBoxLayout with direction \a dir and parent widget \a | - |
| 549 | parent. | - |
| 550 | | - |
| 551 | \sa direction() | - |
| 552 | */ | - |
| 553 | QBoxLayout::QBoxLayout(Direction dir, QWidget *parent) | - |
| 554 | : QLayout(*new QBoxLayoutPrivate, 0, parent) | - |
| 555 | { | - |
| 556 | Q_D(QBoxLayout); executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 557 | d->dir = dir; executed (the execution status of this line is deduced): d->dir = dir; | - |
| 558 | } executed: }Execution Count:12513 | 12513 |
| 559 | | - |
| 560 | | - |
| 561 | | - |
| 562 | /*! | - |
| 563 | Destroys this box layout. | - |
| 564 | | - |
| 565 | The layout's widgets aren't destroyed. | - |
| 566 | */ | - |
| 567 | QBoxLayout::~QBoxLayout() | - |
| 568 | { | - |
| 569 | Q_D(QBoxLayout); executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 570 | d->deleteAll(); // must do it before QObject deletes children, so can't be in ~QBoxLayoutPrivate executed (the execution status of this line is deduced): d->deleteAll(); | - |
| 571 | } executed: }Execution Count:11213 | 11213 |
| 572 | | - |
| 573 | /*! | - |
| 574 | Reimplements QLayout::spacing(). If the spacing property is | - |
| 575 | valid, that value is returned. Otherwise, a value for the spacing | - |
| 576 | property is computed and returned. Since layout spacing in a widget | - |
| 577 | is style dependent, if the parent is a widget, it queries the style | - |
| 578 | for the (horizontal or vertical) spacing of the layout. Otherwise, | - |
| 579 | the parent is a layout, and it queries the parent layout for the | - |
| 580 | spacing(). | - |
| 581 | | - |
| 582 | \sa QLayout::spacing(), setSpacing() | - |
| 583 | */ | - |
| 584 | int QBoxLayout::spacing() const | - |
| 585 | { | - |
| 586 | Q_D(const QBoxLayout); executed (the execution status of this line is deduced): const QBoxLayoutPrivate * const d = d_func(); | - |
| 587 | if (d->spacing >=0) { evaluated: d->spacing >=0| yes Evaluation Count:4586 | yes Evaluation Count:2240 |
| 2240-4586 |
| 588 | return d->spacing; executed: return d->spacing;Execution Count:4586 | 4586 |
| 589 | } else { | - |
| 590 | return qSmartSpacing(this, d->dir == LeftToRight || d->dir == RightToLeft executed: return qSmartSpacing(this, d->dir == LeftToRight || d->dir == RightToLeft ? QStyle::PM_LayoutHorizontalSpacing : QStyle::PM_LayoutVerticalSpacing);Execution Count:2240 | 2240 |
| 591 | ? QStyle::PM_LayoutHorizontalSpacing executed: return qSmartSpacing(this, d->dir == LeftToRight || d->dir == RightToLeft ? QStyle::PM_LayoutHorizontalSpacing : QStyle::PM_LayoutVerticalSpacing);Execution Count:2240 | 2240 |
| 592 | : QStyle::PM_LayoutVerticalSpacing); executed: return qSmartSpacing(this, d->dir == LeftToRight || d->dir == RightToLeft ? QStyle::PM_LayoutHorizontalSpacing : QStyle::PM_LayoutVerticalSpacing);Execution Count:2240 | 2240 |
| 593 | } | - |
| 594 | } | - |
| 595 | | - |
| 596 | /*! | - |
| 597 | Reimplements QLayout::setSpacing(). Sets the spacing | - |
| 598 | property to \a spacing. | - |
| 599 | | - |
| 600 | \sa QLayout::setSpacing(), spacing() | - |
| 601 | */ | - |
| 602 | void QBoxLayout::setSpacing(int spacing) | - |
| 603 | { | - |
| 604 | Q_D(QBoxLayout); executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 605 | d->spacing = spacing; executed (the execution status of this line is deduced): d->spacing = spacing; | - |
| 606 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
| 607 | } executed: }Execution Count:11366 | 11366 |
| 608 | | - |
| 609 | /*! | - |
| 610 | \reimp | - |
| 611 | */ | - |
| 612 | QSize QBoxLayout::sizeHint() const | - |
| 613 | { | - |
| 614 | Q_D(const QBoxLayout); executed (the execution status of this line is deduced): const QBoxLayoutPrivate * const d = d_func(); | - |
| 615 | if (d->dirty) evaluated: d->dirty| yes Evaluation Count:2171 | yes Evaluation Count:8493 |
| 2171-8493 |
| 616 | const_cast<QBoxLayout*>(this)->d_func()->setupGeom(); executed: const_cast<QBoxLayout*>(this)->d_func()->setupGeom();Execution Count:2171 | 2171 |
| 617 | return d->sizeHint; executed: return d->sizeHint;Execution Count:10664 | 10664 |
| 618 | } | - |
| 619 | | - |
| 620 | /*! | - |
| 621 | \reimp | - |
| 622 | */ | - |
| 623 | QSize QBoxLayout::minimumSize() const | - |
| 624 | { | - |
| 625 | Q_D(const QBoxLayout); executed (the execution status of this line is deduced): const QBoxLayoutPrivate * const d = d_func(); | - |
| 626 | if (d->dirty) evaluated: d->dirty| yes Evaluation Count:1635 | yes Evaluation Count:4075 |
| 1635-4075 |
| 627 | const_cast<QBoxLayout*>(this)->d_func()->setupGeom(); executed: const_cast<QBoxLayout*>(this)->d_func()->setupGeom();Execution Count:1635 | 1635 |
| 628 | return d->minSize; executed: return d->minSize;Execution Count:5710 | 5710 |
| 629 | } | - |
| 630 | | - |
| 631 | /*! | - |
| 632 | \reimp | - |
| 633 | */ | - |
| 634 | QSize QBoxLayout::maximumSize() const | - |
| 635 | { | - |
| 636 | Q_D(const QBoxLayout); executed (the execution status of this line is deduced): const QBoxLayoutPrivate * const d = d_func(); | - |
| 637 | if (d->dirty) evaluated: d->dirty| yes Evaluation Count:1288 | yes Evaluation Count:1123 |
| 1123-1288 |
| 638 | const_cast<QBoxLayout*>(this)->d_func()->setupGeom(); executed: const_cast<QBoxLayout*>(this)->d_func()->setupGeom();Execution Count:1288 | 1288 |
| 639 | | - |
| 640 | QSize s = d->maxSize.boundedTo(QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX)); executed (the execution status of this line is deduced): QSize s = d->maxSize.boundedTo(QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX)); | - |
| 641 | | - |
| 642 | if (alignment() & Qt::AlignHorizontal_Mask) evaluated: alignment() & Qt::AlignHorizontal_Mask| yes Evaluation Count:1 | yes Evaluation Count:2410 |
| 1-2410 |
| 643 | s.setWidth(QLAYOUTSIZE_MAX); executed: s.setWidth(QLAYOUTSIZE_MAX);Execution Count:1 | 1 |
| 644 | if (alignment() & Qt::AlignVertical_Mask) partially evaluated: alignment() & Qt::AlignVertical_Mask| no Evaluation Count:0 | yes Evaluation Count:2411 |
| 0-2411 |
| 645 | s.setHeight(QLAYOUTSIZE_MAX); never executed: s.setHeight(QLAYOUTSIZE_MAX); | 0 |
| 646 | return s; executed: return s;Execution Count:2411 | 2411 |
| 647 | } | - |
| 648 | | - |
| 649 | /*! | - |
| 650 | \reimp | - |
| 651 | */ | - |
| 652 | bool QBoxLayout::hasHeightForWidth() const | - |
| 653 | { | - |
| 654 | Q_D(const QBoxLayout); executed (the execution status of this line is deduced): const QBoxLayoutPrivate * const d = d_func(); | - |
| 655 | if (d->dirty) evaluated: d->dirty| yes Evaluation Count:144 | yes Evaluation Count:13646 |
| 144-13646 |
| 656 | const_cast<QBoxLayout*>(this)->d_func()->setupGeom(); executed: const_cast<QBoxLayout*>(this)->d_func()->setupGeom();Execution Count:144 | 144 |
| 657 | return d->hasHfw; executed: return d->hasHfw;Execution Count:13790 | 13790 |
| 658 | } | - |
| 659 | | - |
| 660 | /*! | - |
| 661 | \reimp | - |
| 662 | */ | - |
| 663 | int QBoxLayout::heightForWidth(int w) const | - |
| 664 | { | - |
| 665 | Q_D(const QBoxLayout); executed (the execution status of this line is deduced): const QBoxLayoutPrivate * const d = d_func(); | - |
| 666 | if (!hasHeightForWidth()) evaluated: !hasHeightForWidth()| yes Evaluation Count:19 | yes Evaluation Count:149 |
| 19-149 |
| 667 | return -1; executed: return -1;Execution Count:19 | 19 |
| 668 | | - |
| 669 | int left, top, right, bottom; executed (the execution status of this line is deduced): int left, top, right, bottom; | - |
| 670 | d->effectiveMargins(&left, &top, &right, &bottom); executed (the execution status of this line is deduced): d->effectiveMargins(&left, &top, &right, &bottom); | - |
| 671 | | - |
| 672 | w -= left + right; executed (the execution status of this line is deduced): w -= left + right; | - |
| 673 | if (w != d->hfwWidth) evaluated: w != d->hfwWidth| yes Evaluation Count:92 | yes Evaluation Count:57 |
| 57-92 |
| 674 | const_cast<QBoxLayout*>(this)->d_func()->calcHfw(w); executed: const_cast<QBoxLayout*>(this)->d_func()->calcHfw(w);Execution Count:92 | 92 |
| 675 | | - |
| 676 | return d->hfwHeight + top + bottom; executed: return d->hfwHeight + top + bottom;Execution Count:149 | 149 |
| 677 | } | - |
| 678 | | - |
| 679 | /*! | - |
| 680 | \reimp | - |
| 681 | */ | - |
| 682 | int QBoxLayout::minimumHeightForWidth(int w) const | - |
| 683 | { | - |
| 684 | Q_D(const QBoxLayout); executed (the execution status of this line is deduced): const QBoxLayoutPrivate * const d = d_func(); | - |
| 685 | (void) heightForWidth(w); executed (the execution status of this line is deduced): (void) heightForWidth(w); | - |
| 686 | int top, bottom; executed (the execution status of this line is deduced): int top, bottom; | - |
| 687 | d->effectiveMargins(0, &top, 0, &bottom); executed (the execution status of this line is deduced): d->effectiveMargins(0, &top, 0, &bottom); | - |
| 688 | return d->hasHfw ? (d->hfwMinHeight + top + bottom) : -1; executed: return d->hasHfw ? (d->hfwMinHeight + top + bottom) : -1;Execution Count:17 | 17 |
| 689 | } | - |
| 690 | | - |
| 691 | /*! | - |
| 692 | Resets cached information. | - |
| 693 | */ | - |
| 694 | void QBoxLayout::invalidate() | - |
| 695 | { | - |
| 696 | Q_D(QBoxLayout); executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 697 | d->setDirty(); executed (the execution status of this line is deduced): d->setDirty(); | - |
| 698 | QLayout::invalidate(); executed (the execution status of this line is deduced): QLayout::invalidate(); | - |
| 699 | } executed: }Execution Count:79457 | 79457 |
| 700 | | - |
| 701 | /*! | - |
| 702 | \reimp | - |
| 703 | */ | - |
| 704 | int QBoxLayout::count() const | - |
| 705 | { | - |
| 706 | Q_D(const QBoxLayout); executed (the execution status of this line is deduced): const QBoxLayoutPrivate * const d = d_func(); | - |
| 707 | return d->list.count(); executed: return d->list.count();Execution Count:17150 | 17150 |
| 708 | } | - |
| 709 | | - |
| 710 | /*! | - |
| 711 | \reimp | - |
| 712 | */ | - |
| 713 | QLayoutItem *QBoxLayout::itemAt(int index) const | - |
| 714 | { | - |
| 715 | Q_D(const QBoxLayout); executed (the execution status of this line is deduced): const QBoxLayoutPrivate * const d = d_func(); | - |
| 716 | return index >= 0 && index < d->list.count() ? d->list.at(index)->item : 0; executed: return index >= 0 && index < d->list.count() ? d->list.at(index)->item : 0;Execution Count:30797 | 30797 |
| 717 | } | - |
| 718 | | - |
| 719 | /*! | - |
| 720 | \reimp | - |
| 721 | */ | - |
| 722 | QLayoutItem *QBoxLayout::takeAt(int index) | - |
| 723 | { | - |
| 724 | Q_D(QBoxLayout); executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 725 | if (index < 0 || index >= d->list.count()) partially evaluated: index < 0| no Evaluation Count:0 | yes Evaluation Count:2042 |
partially evaluated: index >= d->list.count()| no Evaluation Count:0 | yes Evaluation Count:2042 |
| 0-2042 |
| 726 | return 0; never executed: return 0; | 0 |
| 727 | QBoxLayoutItem *b = d->list.takeAt(index); executed (the execution status of this line is deduced): QBoxLayoutItem *b = d->list.takeAt(index); | - |
| 728 | QLayoutItem *item = b->item; executed (the execution status of this line is deduced): QLayoutItem *item = b->item; | - |
| 729 | b->item = 0; executed (the execution status of this line is deduced): b->item = 0; | - |
| 730 | delete b; executed (the execution status of this line is deduced): delete b; | - |
| 731 | | - |
| 732 | if (QLayout *l = item->layout()) { evaluated: QLayout *l = item->layout()| yes Evaluation Count:1 | yes Evaluation Count:2041 |
| 1-2041 |
| 733 | // sanity check in case the user passed something weird to QObject::setParent() | - |
| 734 | if (l->parent() == this) partially evaluated: l->parent() == this| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 735 | l->setParent(0); executed: l->setParent(0);Execution Count:1 | 1 |
| 736 | } executed: }Execution Count:1 | 1 |
| 737 | | - |
| 738 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
| 739 | return item; executed: return item;Execution Count:2042 | 2042 |
| 740 | } | - |
| 741 | | - |
| 742 | | - |
| 743 | /*! | - |
| 744 | \reimp | - |
| 745 | */ | - |
| 746 | Qt::Orientations QBoxLayout::expandingDirections() const | - |
| 747 | { | - |
| 748 | Q_D(const QBoxLayout); executed (the execution status of this line is deduced): const QBoxLayoutPrivate * const d = d_func(); | - |
| 749 | if (d->dirty) evaluated: d->dirty| yes Evaluation Count:5 | yes Evaluation Count:6020 |
| 5-6020 |
| 750 | const_cast<QBoxLayout*>(this)->d_func()->setupGeom(); executed: const_cast<QBoxLayout*>(this)->d_func()->setupGeom();Execution Count:5 | 5 |
| 751 | return d->expanding; executed: return d->expanding;Execution Count:6025 | 6025 |
| 752 | } | - |
| 753 | | - |
| 754 | /*! | - |
| 755 | \reimp | - |
| 756 | */ | - |
| 757 | void QBoxLayout::setGeometry(const QRect &r) | - |
| 758 | { | - |
| 759 | Q_D(QBoxLayout); executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 760 | if (d->dirty || r != geometry()) { evaluated: d->dirty| yes Evaluation Count:1215 | yes Evaluation Count:4877 |
evaluated: r != geometry()| yes Evaluation Count:3443 | yes Evaluation Count:1434 |
| 1215-4877 |
| 761 | QRect oldRect = geometry(); executed (the execution status of this line is deduced): QRect oldRect = geometry(); | - |
| 762 | QLayout::setGeometry(r); executed (the execution status of this line is deduced): QLayout::setGeometry(r); | - |
| 763 | if (d->dirty) evaluated: d->dirty| yes Evaluation Count:1215 | yes Evaluation Count:3443 |
| 1215-3443 |
| 764 | d->setupGeom(); executed: d->setupGeom();Execution Count:1215 | 1215 |
| 765 | QRect cr = alignment() ? alignmentRect(r) : r; evaluated: alignment()| yes Evaluation Count:3 | yes Evaluation Count:4655 |
| 3-4655 |
| 766 | | - |
| 767 | int left, top, right, bottom; executed (the execution status of this line is deduced): int left, top, right, bottom; | - |
| 768 | d->effectiveMargins(&left, &top, &right, &bottom); executed (the execution status of this line is deduced): d->effectiveMargins(&left, &top, &right, &bottom); | - |
| 769 | QRect s(cr.x() + left, cr.y() + top, executed (the execution status of this line is deduced): QRect s(cr.x() + left, cr.y() + top, | - |
| 770 | cr.width() - (left + right), executed (the execution status of this line is deduced): cr.width() - (left + right), | - |
| 771 | cr.height() - (top + bottom)); executed (the execution status of this line is deduced): cr.height() - (top + bottom)); | - |
| 772 | | - |
| 773 | QVector<QLayoutStruct> a = d->geomArray; executed (the execution status of this line is deduced): QVector<QLayoutStruct> a = d->geomArray; | - |
| 774 | int pos = horz(d->dir) ? s.x() : s.y(); evaluated: horz(d->dir)| yes Evaluation Count:1880 | yes Evaluation Count:2778 |
| 1880-2778 |
| 775 | int space = horz(d->dir) ? s.width() : s.height(); evaluated: horz(d->dir)| yes Evaluation Count:1880 | yes Evaluation Count:2778 |
| 1880-2778 |
| 776 | int n = a.count(); executed (the execution status of this line is deduced): int n = a.count(); | - |
| 777 | if (d->hasHfw && !horz(d->dir)) { evaluated: d->hasHfw| yes Evaluation Count:34 | yes Evaluation Count:4624 |
partially evaluated: !horz(d->dir)| yes Evaluation Count:34 | no Evaluation Count:0 |
| 0-4624 |
| 778 | for (int i = 0; i < n; i++) { evaluated: i < n| yes Evaluation Count:52 | yes Evaluation Count:34 |
| 34-52 |
| 779 | QBoxLayoutItem *box = d->list.at(i); executed (the execution status of this line is deduced): QBoxLayoutItem *box = d->list.at(i); | - |
| 780 | if (box->item->hasHeightForWidth()) { evaluated: box->item->hasHeightForWidth()| yes Evaluation Count:34 | yes Evaluation Count:18 |
| 18-34 |
| 781 | int width = qBound(box->item->minimumSize().width(), s.width(), box->item->maximumSize().width()); executed (the execution status of this line is deduced): int width = qBound(box->item->minimumSize().width(), s.width(), box->item->maximumSize().width()); | - |
| 782 | a[i].sizeHint = a[i].minimumSize = executed (the execution status of this line is deduced): a[i].sizeHint = a[i].minimumSize = | - |
| 783 | box->item->heightForWidth(width); executed (the execution status of this line is deduced): box->item->heightForWidth(width); | - |
| 784 | } executed: }Execution Count:34 | 34 |
| 785 | } executed: }Execution Count:52 | 52 |
| 786 | } executed: }Execution Count:34 | 34 |
| 787 | | - |
| 788 | Direction visualDir = d->dir; executed (the execution status of this line is deduced): Direction visualDir = d->dir; | - |
| 789 | QWidget *parent = parentWidget(); executed (the execution status of this line is deduced): QWidget *parent = parentWidget(); | - |
| 790 | if (parent && parent->isRightToLeft()) { partially evaluated: parent| yes Evaluation Count:4658 | no Evaluation Count:0 |
evaluated: parent->isRightToLeft()| yes Evaluation Count:59 | yes Evaluation Count:4599 |
| 0-4658 |
| 791 | if (d->dir == LeftToRight) evaluated: d->dir == LeftToRight| yes Evaluation Count:36 | yes Evaluation Count:23 |
| 23-36 |
| 792 | visualDir = RightToLeft; executed: visualDir = RightToLeft;Execution Count:36 | 36 |
| 793 | else if (d->dir == RightToLeft) partially evaluated: d->dir == RightToLeft| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 794 | visualDir = LeftToRight; never executed: visualDir = LeftToRight; | 0 |
| 795 | } | - |
| 796 | | - |
| 797 | qGeomCalc(a, 0, n, pos, space); executed (the execution status of this line is deduced): qGeomCalc(a, 0, n, pos, space); | - |
| 798 | | - |
| 799 | bool reverse = (horz(visualDir) evaluated: horz(visualDir)| yes Evaluation Count:1880 | yes Evaluation Count:2778 |
| 1880-2778 |
| 800 | ? ((r.right() > oldRect.right()) != (visualDir == RightToLeft)) executed (the execution status of this line is deduced): ? ((r.right() > oldRect.right()) != (visualDir == RightToLeft)) | - |
| 801 | : r.bottom() > oldRect.bottom()); executed (the execution status of this line is deduced): : r.bottom() > oldRect.bottom()); | - |
| 802 | for (int j = 0; j < n; j++) { evaluated: j < n| yes Evaluation Count:10794 | yes Evaluation Count:4658 |
| 4658-10794 |
| 803 | int i = reverse ? n-j-1 : j; evaluated: reverse| yes Evaluation Count:9640 | yes Evaluation Count:1154 |
| 1154-9640 |
| 804 | QBoxLayoutItem *box = d->list.at(i); executed (the execution status of this line is deduced): QBoxLayoutItem *box = d->list.at(i); | - |
| 805 | | - |
| 806 | switch (visualDir) { | - |
| 807 | case LeftToRight: | - |
| 808 | box->item->setGeometry(QRect(a.at(i).pos, s.y(), a.at(i).size, s.height())); executed (the execution status of this line is deduced): box->item->setGeometry(QRect(a.at(i).pos, s.y(), a.at(i).size, s.height())); | - |
| 809 | break; executed: break;Execution Count:6004 | 6004 |
| 810 | case RightToLeft: | - |
| 811 | box->item->setGeometry(QRect(s.left() + s.right() - a.at(i).pos - a.at(i).size + 1, executed (the execution status of this line is deduced): box->item->setGeometry(QRect(s.left() + s.right() - a.at(i).pos - a.at(i).size + 1, | - |
| 812 | s.y(), a.at(i).size, s.height())); executed (the execution status of this line is deduced): s.y(), a.at(i).size, s.height())); | - |
| 813 | break; executed: break;Execution Count:184 | 184 |
| 814 | case TopToBottom: | - |
| 815 | box->item->setGeometry(QRect(s.x(), a.at(i).pos, s.width(), a.at(i).size)); executed (the execution status of this line is deduced): box->item->setGeometry(QRect(s.x(), a.at(i).pos, s.width(), a.at(i).size)); | - |
| 816 | break; executed: break;Execution Count:4606 | 4606 |
| 817 | case BottomToTop: | - |
| 818 | box->item->setGeometry(QRect(s.x(), never executed (the execution status of this line is deduced): box->item->setGeometry(QRect(s.x(), | - |
| 819 | s.top() + s.bottom() - a.at(i).pos - a.at(i).size + 1, never executed (the execution status of this line is deduced): s.top() + s.bottom() - a.at(i).pos - a.at(i).size + 1, | - |
| 820 | s.width(), a.at(i).size)); never executed (the execution status of this line is deduced): s.width(), a.at(i).size)); | - |
| 821 | } | 0 |
| 822 | } executed: }Execution Count:10794 | 10794 |
| 823 | } executed: }Execution Count:4658 | 4658 |
| 824 | } executed: }Execution Count:6092 | 6092 |
| 825 | | - |
| 826 | /*! | - |
| 827 | \reimp | - |
| 828 | */ | - |
| 829 | void QBoxLayout::addItem(QLayoutItem *item) | - |
| 830 | { | - |
| 831 | Q_D(QBoxLayout); executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 832 | QBoxLayoutItem *it = new QBoxLayoutItem(item); executed (the execution status of this line is deduced): QBoxLayoutItem *it = new QBoxLayoutItem(item); | - |
| 833 | d->list.append(it); executed (the execution status of this line is deduced): d->list.append(it); | - |
| 834 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
| 835 | } executed: }Execution Count:219 | 219 |
| 836 | | - |
| 837 | /*! | - |
| 838 | Inserts \a item into this box layout at position \a index. If \a | - |
| 839 | index is negative, the item is added at the end. | - |
| 840 | | - |
| 841 | \sa addItem(), insertWidget(), insertLayout(), insertStretch(), | - |
| 842 | insertSpacing() | - |
| 843 | */ | - |
| 844 | void QBoxLayout::insertItem(int index, QLayoutItem *item) | - |
| 845 | { | - |
| 846 | Q_D(QBoxLayout); never executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 847 | if (index < 0) // append never evaluated: index < 0 | 0 |
| 848 | index = d->list.count(); never executed: index = d->list.count(); | 0 |
| 849 | | - |
| 850 | QBoxLayoutItem *it = new QBoxLayoutItem(item); never executed (the execution status of this line is deduced): QBoxLayoutItem *it = new QBoxLayoutItem(item); | - |
| 851 | d->list.insert(index, it); never executed (the execution status of this line is deduced): d->list.insert(index, it); | - |
| 852 | invalidate(); never executed (the execution status of this line is deduced): invalidate(); | - |
| 853 | } | 0 |
| 854 | | - |
| 855 | /*! | - |
| 856 | Inserts a non-stretchable space (a QSpacerItem) at position \a index, with | - |
| 857 | size \a size. If \a index is negative the space is added at the end. | - |
| 858 | | - |
| 859 | The box layout has default margin and spacing. This function adds | - |
| 860 | additional space. | - |
| 861 | | - |
| 862 | \sa addSpacing(), insertItem(), QSpacerItem | - |
| 863 | */ | - |
| 864 | void QBoxLayout::insertSpacing(int index, int size) | - |
| 865 | { | - |
| 866 | Q_D(QBoxLayout); executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 867 | if (index < 0) // append evaluated: index < 0| yes Evaluation Count:544 | yes Evaluation Count:339 |
| 339-544 |
| 868 | index = d->list.count(); executed: index = d->list.count();Execution Count:544 | 544 |
| 869 | | - |
| 870 | QLayoutItem *b; executed (the execution status of this line is deduced): QLayoutItem *b; | - |
| 871 | if (horz(d->dir)) evaluated: horz(d->dir)| yes Evaluation Count:71 | yes Evaluation Count:812 |
| 71-812 |
| 872 | b = QLayoutPrivate::createSpacerItem(this, size, 0, QSizePolicy::Fixed, QSizePolicy::Minimum); executed: b = QLayoutPrivate::createSpacerItem(this, size, 0, QSizePolicy::Fixed, QSizePolicy::Minimum);Execution Count:71 | 71 |
| 873 | else | - |
| 874 | b = QLayoutPrivate::createSpacerItem(this, 0, size, QSizePolicy::Minimum, QSizePolicy::Fixed); executed: b = QLayoutPrivate::createSpacerItem(this, 0, size, QSizePolicy::Minimum, QSizePolicy::Fixed);Execution Count:812 | 812 |
| 875 | | - |
| 876 | QT_TRY { partially evaluated: true| yes Evaluation Count:883 | no Evaluation Count:0 |
| 0-883 |
| 877 | QBoxLayoutItem *it = new QBoxLayoutItem(b); executed (the execution status of this line is deduced): QBoxLayoutItem *it = new QBoxLayoutItem(b); | - |
| 878 | it->magic = true; executed (the execution status of this line is deduced): it->magic = true; | - |
| 879 | d->list.insert(index, it); executed (the execution status of this line is deduced): d->list.insert(index, it); | - |
| 880 | | - |
| 881 | } QT_CATCH(...) { executed: }Execution Count:883 | 883 |
| 882 | delete b; never executed (the execution status of this line is deduced): delete b; | - |
| 883 | QT_RETHROW; never executed (the execution status of this line is deduced): qt_noop(); | - |
| 884 | } | 0 |
| 885 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
| 886 | } executed: }Execution Count:883 | 883 |
| 887 | | - |
| 888 | /*! | - |
| 889 | Inserts a stretchable space (a QSpacerItem) at position \a | - |
| 890 | index, with zero minimum size and stretch factor \a stretch. If \a | - |
| 891 | index is negative the space is added at the end. | - |
| 892 | | - |
| 893 | \sa addStretch(), insertItem(), QSpacerItem | - |
| 894 | */ | - |
| 895 | void QBoxLayout::insertStretch(int index, int stretch) | - |
| 896 | { | - |
| 897 | Q_D(QBoxLayout); executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 898 | if (index < 0) // append evaluated: index < 0| yes Evaluation Count:1241 | yes Evaluation Count:54 |
| 54-1241 |
| 899 | index = d->list.count(); executed: index = d->list.count();Execution Count:1241 | 1241 |
| 900 | | - |
| 901 | QLayoutItem *b; executed (the execution status of this line is deduced): QLayoutItem *b; | - |
| 902 | if (horz(d->dir)) evaluated: horz(d->dir)| yes Evaluation Count:687 | yes Evaluation Count:608 |
| 608-687 |
| 903 | b = QLayoutPrivate::createSpacerItem(this, 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); executed: b = QLayoutPrivate::createSpacerItem(this, 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);Execution Count:687 | 687 |
| 904 | else | - |
| 905 | b = QLayoutPrivate::createSpacerItem(this, 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); executed: b = QLayoutPrivate::createSpacerItem(this, 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);Execution Count:608 | 608 |
| 906 | | - |
| 907 | QBoxLayoutItem *it = new QBoxLayoutItem(b, stretch); executed (the execution status of this line is deduced): QBoxLayoutItem *it = new QBoxLayoutItem(b, stretch); | - |
| 908 | it->magic = true; executed (the execution status of this line is deduced): it->magic = true; | - |
| 909 | d->list.insert(index, it); executed (the execution status of this line is deduced): d->list.insert(index, it); | - |
| 910 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
| 911 | } executed: }Execution Count:1295 | 1295 |
| 912 | | - |
| 913 | /*! | - |
| 914 | \since 4.4 | - |
| 915 | | - |
| 916 | Inserts \a spacerItem at position \a index, with zero minimum | - |
| 917 | size and stretch factor. If \a index is negative the | - |
| 918 | space is added at the end. | - |
| 919 | | - |
| 920 | \sa addSpacerItem(), insertStretch(), insertSpacing() | - |
| 921 | */ | - |
| 922 | void QBoxLayout::insertSpacerItem(int index, QSpacerItem *spacerItem) | - |
| 923 | { | - |
| 924 | Q_D(QBoxLayout); executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 925 | if (index < 0) // append evaluated: index < 0| yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
| 926 | index = d->list.count(); executed: index = d->list.count();Execution Count:2 | 2 |
| 927 | | - |
| 928 | QBoxLayoutItem *it = new QBoxLayoutItem(spacerItem); executed (the execution status of this line is deduced): QBoxLayoutItem *it = new QBoxLayoutItem(spacerItem); | - |
| 929 | it->magic = true; executed (the execution status of this line is deduced): it->magic = true; | - |
| 930 | d->list.insert(index, it); executed (the execution status of this line is deduced): d->list.insert(index, it); | - |
| 931 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
| 932 | } executed: }Execution Count:3 | 3 |
| 933 | | - |
| 934 | /*! | - |
| 935 | Inserts \a layout at position \a index, with stretch factor \a | - |
| 936 | stretch. If \a index is negative, the layout is added at the end. | - |
| 937 | | - |
| 938 | \a layout becomes a child of the box layout. | - |
| 939 | | - |
| 940 | \sa addLayout(), insertItem() | - |
| 941 | */ | - |
| 942 | void QBoxLayout::insertLayout(int index, QLayout *layout, int stretch) | - |
| 943 | { | - |
| 944 | Q_D(QBoxLayout); executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 945 | addChildLayout(layout); executed (the execution status of this line is deduced): addChildLayout(layout); | - |
| 946 | if (index < 0) // append partially evaluated: index < 0| yes Evaluation Count:99 | no Evaluation Count:0 |
| 0-99 |
| 947 | index = d->list.count(); executed: index = d->list.count();Execution Count:99 | 99 |
| 948 | QBoxLayoutItem *it = new QBoxLayoutItem(layout, stretch); executed (the execution status of this line is deduced): QBoxLayoutItem *it = new QBoxLayoutItem(layout, stretch); | - |
| 949 | d->list.insert(index, it); executed (the execution status of this line is deduced): d->list.insert(index, it); | - |
| 950 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
| 951 | } executed: }Execution Count:99 | 99 |
| 952 | | - |
| 953 | /*! | - |
| 954 | Inserts \a widget at position \a index, with stretch factor \a | - |
| 955 | stretch and alignment \a alignment. If \a index is negative, the | - |
| 956 | widget is added at the end. | - |
| 957 | | - |
| 958 | The stretch factor applies only in the \l{direction()}{direction} | - |
| 959 | of the QBoxLayout, and is relative to the other boxes and widgets | - |
| 960 | in this QBoxLayout. Widgets and boxes with higher stretch factors | - |
| 961 | grow more. | - |
| 962 | | - |
| 963 | If the stretch factor is 0 and nothing else in the QBoxLayout has | - |
| 964 | a stretch factor greater than zero, the space is distributed | - |
| 965 | according to the QWidget:sizePolicy() of each widget that's | - |
| 966 | involved. | - |
| 967 | | - |
| 968 | The alignment is specified by \a alignment. The default alignment | - |
| 969 | is 0, which means that the widget fills the entire cell. | - |
| 970 | | - |
| 971 | \sa addWidget(), insertItem() | - |
| 972 | */ | - |
| 973 | void QBoxLayout::insertWidget(int index, QWidget *widget, int stretch, | - |
| 974 | Qt::Alignment alignment) | - |
| 975 | { | - |
| 976 | Q_D(QBoxLayout); executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 977 | if (!checkWidget(this, widget)) partially evaluated: !checkWidget(this, widget)| no Evaluation Count:0 | yes Evaluation Count:15667 |
| 0-15667 |
| 978 | return; | 0 |
| 979 | addChildWidget(widget); executed (the execution status of this line is deduced): addChildWidget(widget); | - |
| 980 | if (index < 0) // append evaluated: index < 0| yes Evaluation Count:15071 | yes Evaluation Count:596 |
| 596-15071 |
| 981 | index = d->list.count(); executed: index = d->list.count();Execution Count:15071 | 15071 |
| 982 | QWidgetItem *b = QLayoutPrivate::createWidgetItem(this, widget); executed (the execution status of this line is deduced): QWidgetItem *b = QLayoutPrivate::createWidgetItem(this, widget); | - |
| 983 | b->setAlignment(alignment); executed (the execution status of this line is deduced): b->setAlignment(alignment); | - |
| 984 | | - |
| 985 | QBoxLayoutItem *it; executed (the execution status of this line is deduced): QBoxLayoutItem *it; | - |
| 986 | QT_TRY{ partially evaluated: true| yes Evaluation Count:15667 | no Evaluation Count:0 |
| 0-15667 |
| 987 | it = new QBoxLayoutItem(b, stretch); executed (the execution status of this line is deduced): it = new QBoxLayoutItem(b, stretch); | - |
| 988 | } QT_CATCH(...) { executed: }Execution Count:15667 | 15667 |
| 989 | delete b; never executed (the execution status of this line is deduced): delete b; | - |
| 990 | QT_RETHROW; never executed (the execution status of this line is deduced): qt_noop(); | - |
| 991 | } | 0 |
| 992 | | - |
| 993 | QT_TRY{ partially evaluated: true| yes Evaluation Count:15667 | no Evaluation Count:0 |
| 0-15667 |
| 994 | d->list.insert(index, it); executed (the execution status of this line is deduced): d->list.insert(index, it); | - |
| 995 | } QT_CATCH(...) { executed: }Execution Count:15667 | 15667 |
| 996 | delete it; never executed (the execution status of this line is deduced): delete it; | - |
| 997 | QT_RETHROW; never executed (the execution status of this line is deduced): qt_noop(); | - |
| 998 | } | 0 |
| 999 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
| 1000 | } executed: }Execution Count:15667 | 15667 |
| 1001 | | - |
| 1002 | /*! | - |
| 1003 | Adds a non-stretchable space (a QSpacerItem) with size \a size | - |
| 1004 | to the end of this box layout. QBoxLayout provides default margin | - |
| 1005 | and spacing. This function adds additional space. | - |
| 1006 | | - |
| 1007 | \sa insertSpacing(), addItem(), QSpacerItem | - |
| 1008 | */ | - |
| 1009 | void QBoxLayout::addSpacing(int size) | - |
| 1010 | { | - |
| 1011 | insertSpacing(-1, size); executed (the execution status of this line is deduced): insertSpacing(-1, size); | - |
| 1012 | } executed: }Execution Count:544 | 544 |
| 1013 | | - |
| 1014 | /*! | - |
| 1015 | Adds a stretchable space (a QSpacerItem) with zero minimum | - |
| 1016 | size and stretch factor \a stretch to the end of this box layout. | - |
| 1017 | | - |
| 1018 | \sa insertStretch(), addItem(), QSpacerItem | - |
| 1019 | */ | - |
| 1020 | void QBoxLayout::addStretch(int stretch) | - |
| 1021 | { | - |
| 1022 | insertStretch(-1, stretch); executed (the execution status of this line is deduced): insertStretch(-1, stretch); | - |
| 1023 | } executed: }Execution Count:1241 | 1241 |
| 1024 | | - |
| 1025 | /*! | - |
| 1026 | \since 4.4 | - |
| 1027 | | - |
| 1028 | Adds \a spacerItem to the end of this box layout. | - |
| 1029 | | - |
| 1030 | \sa addSpacing(), addStretch() | - |
| 1031 | */ | - |
| 1032 | void QBoxLayout::addSpacerItem(QSpacerItem *spacerItem) | - |
| 1033 | { | - |
| 1034 | insertSpacerItem(-1, spacerItem); executed (the execution status of this line is deduced): insertSpacerItem(-1, spacerItem); | - |
| 1035 | } executed: }Execution Count:2 | 2 |
| 1036 | | - |
| 1037 | /*! | - |
| 1038 | Adds \a widget to the end of this box layout, with a stretch | - |
| 1039 | factor of \a stretch and alignment \a alignment. | - |
| 1040 | | - |
| 1041 | The stretch factor applies only in the \l{direction()}{direction} | - |
| 1042 | of the QBoxLayout, and is relative to the other boxes and widgets | - |
| 1043 | in this QBoxLayout. Widgets and boxes with higher stretch factors | - |
| 1044 | grow more. | - |
| 1045 | | - |
| 1046 | If the stretch factor is 0 and nothing else in the QBoxLayout has | - |
| 1047 | a stretch factor greater than zero, the space is distributed | - |
| 1048 | according to the QWidget:sizePolicy() of each widget that's | - |
| 1049 | involved. | - |
| 1050 | | - |
| 1051 | The alignment is specified by \a alignment. The default | - |
| 1052 | alignment is 0, which means that the widget fills the entire cell. | - |
| 1053 | | - |
| 1054 | \sa insertWidget(), addItem(), addLayout(), addStretch(), | - |
| 1055 | addSpacing(), addStrut() | - |
| 1056 | */ | - |
| 1057 | void QBoxLayout::addWidget(QWidget *widget, int stretch, Qt::Alignment alignment) | - |
| 1058 | { | - |
| 1059 | insertWidget(-1, widget, stretch, alignment); executed (the execution status of this line is deduced): insertWidget(-1, widget, stretch, alignment); | - |
| 1060 | } executed: }Execution Count:15071 | 15071 |
| 1061 | | - |
| 1062 | /*! | - |
| 1063 | Adds \a layout to the end of the box, with serial stretch factor | - |
| 1064 | \a stretch. | - |
| 1065 | | - |
| 1066 | \sa insertLayout(), addItem(), addWidget() | - |
| 1067 | */ | - |
| 1068 | void QBoxLayout::addLayout(QLayout *layout, int stretch) | - |
| 1069 | { | - |
| 1070 | insertLayout(-1, layout, stretch); executed (the execution status of this line is deduced): insertLayout(-1, layout, stretch); | - |
| 1071 | } executed: }Execution Count:99 | 99 |
| 1072 | | - |
| 1073 | /*! | - |
| 1074 | Limits the perpendicular dimension of the box (e.g. height if the | - |
| 1075 | box is \l LeftToRight) to a minimum of \a size. Other constraints | - |
| 1076 | may increase the limit. | - |
| 1077 | | - |
| 1078 | \sa addItem() | - |
| 1079 | */ | - |
| 1080 | void QBoxLayout::addStrut(int size) | - |
| 1081 | { | - |
| 1082 | Q_D(QBoxLayout); executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 1083 | QLayoutItem *b; executed (the execution status of this line is deduced): QLayoutItem *b; | - |
| 1084 | if (horz(d->dir)) partially evaluated: horz(d->dir)| yes Evaluation Count:36 | no Evaluation Count:0 |
| 0-36 |
| 1085 | b = QLayoutPrivate::createSpacerItem(this, 0, size, QSizePolicy::Fixed, QSizePolicy::Minimum); executed: b = QLayoutPrivate::createSpacerItem(this, 0, size, QSizePolicy::Fixed, QSizePolicy::Minimum);Execution Count:36 | 36 |
| 1086 | else | - |
| 1087 | b = QLayoutPrivate::createSpacerItem(this, size, 0, QSizePolicy::Minimum, QSizePolicy::Fixed); never executed: b = QLayoutPrivate::createSpacerItem(this, size, 0, QSizePolicy::Minimum, QSizePolicy::Fixed); | 0 |
| 1088 | | - |
| 1089 | QBoxLayoutItem *it = new QBoxLayoutItem(b); executed (the execution status of this line is deduced): QBoxLayoutItem *it = new QBoxLayoutItem(b); | - |
| 1090 | it->magic = true; executed (the execution status of this line is deduced): it->magic = true; | - |
| 1091 | d->list.append(it); executed (the execution status of this line is deduced): d->list.append(it); | - |
| 1092 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
| 1093 | } executed: }Execution Count:36 | 36 |
| 1094 | | - |
| 1095 | /*! | - |
| 1096 | Sets the stretch factor for \a widget to \a stretch and returns | - |
| 1097 | true if \a widget is found in this layout (not including child | - |
| 1098 | layouts); otherwise returns false. | - |
| 1099 | | - |
| 1100 | \sa setAlignment() | - |
| 1101 | */ | - |
| 1102 | bool QBoxLayout::setStretchFactor(QWidget *widget, int stretch) | - |
| 1103 | { | - |
| 1104 | Q_D(QBoxLayout); never executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 1105 | if (!widget) | 0 |
| 1106 | return false; never executed: return false; | 0 |
| 1107 | for (int i = 0; i < d->list.size(); ++i) { never evaluated: i < d->list.size() | 0 |
| 1108 | QBoxLayoutItem *box = d->list.at(i); never executed (the execution status of this line is deduced): QBoxLayoutItem *box = d->list.at(i); | - |
| 1109 | if (box->item->widget() == widget) { never evaluated: box->item->widget() == widget | 0 |
| 1110 | box->stretch = stretch; never executed (the execution status of this line is deduced): box->stretch = stretch; | - |
| 1111 | invalidate(); never executed (the execution status of this line is deduced): invalidate(); | - |
| 1112 | return true; never executed: return true; | 0 |
| 1113 | } | - |
| 1114 | } | 0 |
| 1115 | return false; never executed: return false; | 0 |
| 1116 | } | - |
| 1117 | | - |
| 1118 | /*! | - |
| 1119 | \overload | - |
| 1120 | | - |
| 1121 | Sets the stretch factor for the layout \a layout to \a stretch and | - |
| 1122 | returns true if \a layout is found in this layout (not including | - |
| 1123 | child layouts); otherwise returns false. | - |
| 1124 | */ | - |
| 1125 | bool QBoxLayout::setStretchFactor(QLayout *layout, int stretch) | - |
| 1126 | { | - |
| 1127 | Q_D(QBoxLayout); never executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 1128 | for (int i = 0; i < d->list.size(); ++i) { never evaluated: i < d->list.size() | 0 |
| 1129 | QBoxLayoutItem *box = d->list.at(i); never executed (the execution status of this line is deduced): QBoxLayoutItem *box = d->list.at(i); | - |
| 1130 | if (box->item->layout() == layout) { never evaluated: box->item->layout() == layout | 0 |
| 1131 | if (box->stretch != stretch) { never evaluated: box->stretch != stretch | 0 |
| 1132 | box->stretch = stretch; never executed (the execution status of this line is deduced): box->stretch = stretch; | - |
| 1133 | invalidate(); never executed (the execution status of this line is deduced): invalidate(); | - |
| 1134 | } | 0 |
| 1135 | return true; never executed: return true; | 0 |
| 1136 | } | - |
| 1137 | } | 0 |
| 1138 | return false; never executed: return false; | 0 |
| 1139 | } | - |
| 1140 | | - |
| 1141 | /*! | - |
| 1142 | Sets the stretch factor at position \a index. to \a stretch. | - |
| 1143 | | - |
| 1144 | \since 4.5 | - |
| 1145 | */ | - |
| 1146 | | - |
| 1147 | void QBoxLayout::setStretch(int index, int stretch) | - |
| 1148 | { | - |
| 1149 | Q_D(QBoxLayout); never executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 1150 | if (index >= 0 && index < d->list.size()) { never evaluated: index >= 0 never evaluated: index < d->list.size() | 0 |
| 1151 | QBoxLayoutItem *box = d->list.at(index); never executed (the execution status of this line is deduced): QBoxLayoutItem *box = d->list.at(index); | - |
| 1152 | if (box->stretch != stretch) { never evaluated: box->stretch != stretch | 0 |
| 1153 | box->stretch = stretch; never executed (the execution status of this line is deduced): box->stretch = stretch; | - |
| 1154 | invalidate(); never executed (the execution status of this line is deduced): invalidate(); | - |
| 1155 | } | 0 |
| 1156 | } | 0 |
| 1157 | } | 0 |
| 1158 | | - |
| 1159 | /*! | - |
| 1160 | Returns the stretch factor at position \a index. | - |
| 1161 | | - |
| 1162 | \since 4.5 | - |
| 1163 | */ | - |
| 1164 | | - |
| 1165 | int QBoxLayout::stretch(int index) const | - |
| 1166 | { | - |
| 1167 | Q_D(const QBoxLayout); never executed (the execution status of this line is deduced): const QBoxLayoutPrivate * const d = d_func(); | - |
| 1168 | if (index >= 0 && index < d->list.size()) never evaluated: index >= 0 never evaluated: index < d->list.size() | 0 |
| 1169 | return d->list.at(index)->stretch; never executed: return d->list.at(index)->stretch; | 0 |
| 1170 | return -1; never executed: return -1; | 0 |
| 1171 | } | - |
| 1172 | | - |
| 1173 | /*! | - |
| 1174 | Sets the direction of this layout to \a direction. | - |
| 1175 | */ | - |
| 1176 | void QBoxLayout::setDirection(Direction direction) | - |
| 1177 | { | - |
| 1178 | Q_D(QBoxLayout); never executed (the execution status of this line is deduced): QBoxLayoutPrivate * const d = d_func(); | - |
| 1179 | if (d->dir == direction) never evaluated: d->dir == direction | 0 |
| 1180 | return; | 0 |
| 1181 | if (horz(d->dir) != horz(direction)) { never evaluated: horz(d->dir) != horz(direction) | 0 |
| 1182 | //swap around the spacers (the "magic" bits) | - |
| 1183 | //#### a bit yucky, knows too much. | - |
| 1184 | //#### probably best to add access functions to spacerItem | - |
| 1185 | //#### or even a QSpacerItem::flip() | - |
| 1186 | for (int i = 0; i < d->list.size(); ++i) { never evaluated: i < d->list.size() | 0 |
| 1187 | QBoxLayoutItem *box = d->list.at(i); never executed (the execution status of this line is deduced): QBoxLayoutItem *box = d->list.at(i); | - |
| 1188 | if (box->magic) { never evaluated: box->magic | 0 |
| 1189 | QSpacerItem *sp = box->item->spacerItem(); never executed (the execution status of this line is deduced): QSpacerItem *sp = box->item->spacerItem(); | - |
| 1190 | if (sp) { | 0 |
| 1191 | if (sp->expandingDirections() == Qt::Orientations(0) /*No Direction*/) { never evaluated: sp->expandingDirections() == Qt::Orientations(0) | 0 |
| 1192 | //spacing or strut | - |
| 1193 | QSize s = sp->sizeHint(); never executed (the execution status of this line is deduced): QSize s = sp->sizeHint(); | - |
| 1194 | sp->changeSize(s.height(), s.width(), never executed (the execution status of this line is deduced): sp->changeSize(s.height(), s.width(), | - |
| 1195 | horz(direction) ? QSizePolicy::Fixed:QSizePolicy::Minimum, never executed (the execution status of this line is deduced): horz(direction) ? QSizePolicy::Fixed:QSizePolicy::Minimum, | - |
| 1196 | horz(direction) ? QSizePolicy::Minimum:QSizePolicy::Fixed); never executed (the execution status of this line is deduced): horz(direction) ? QSizePolicy::Minimum:QSizePolicy::Fixed); | - |
| 1197 | | - |
| 1198 | } else { | 0 |
| 1199 | //stretch | - |
| 1200 | if (horz(direction)) never evaluated: horz(direction) | 0 |
| 1201 | sp->changeSize(0, 0, QSizePolicy::Expanding, never executed: sp->changeSize(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); | 0 |
| 1202 | QSizePolicy::Minimum); never executed: sp->changeSize(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); | 0 |
| 1203 | else | - |
| 1204 | sp->changeSize(0, 0, QSizePolicy::Minimum, never executed: sp->changeSize(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); | 0 |
| 1205 | QSizePolicy::Expanding); never executed: sp->changeSize(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); | 0 |
| 1206 | } | - |
| 1207 | } | - |
| 1208 | } | 0 |
| 1209 | } | 0 |
| 1210 | } | 0 |
| 1211 | d->dir = direction; never executed (the execution status of this line is deduced): d->dir = direction; | - |
| 1212 | invalidate(); never executed (the execution status of this line is deduced): invalidate(); | - |
| 1213 | } | 0 |
| 1214 | | - |
| 1215 | /*! | - |
| 1216 | \fn QBoxLayout::Direction QBoxLayout::direction() const | - |
| 1217 | | - |
| 1218 | Returns the direction of the box. addWidget() and addSpacing() | - |
| 1219 | work in this direction; the stretch stretches in this direction. | - |
| 1220 | | - |
| 1221 | \sa QBoxLayout::Direction, addWidget(), addSpacing() | - |
| 1222 | */ | - |
| 1223 | | - |
| 1224 | QBoxLayout::Direction QBoxLayout::direction() const | - |
| 1225 | { | - |
| 1226 | Q_D(const QBoxLayout); never executed (the execution status of this line is deduced): const QBoxLayoutPrivate * const d = d_func(); | - |
| 1227 | return d->dir; never executed: return d->dir; | 0 |
| 1228 | } | - |
| 1229 | | - |
| 1230 | /*! | - |
| 1231 | \class QHBoxLayout | - |
| 1232 | \brief The QHBoxLayout class lines up widgets horizontally. | - |
| 1233 | | - |
| 1234 | \ingroup geomanagement | - |
| 1235 | \inmodule QtWidgets | - |
| 1236 | | - |
| 1237 | This class is used to construct horizontal box layout objects. See | - |
| 1238 | QBoxLayout for details. | - |
| 1239 | | - |
| 1240 | The simplest use of the class is like this: | - |
| 1241 | | - |
| 1242 | \snippet layouts/layouts.cpp 0 | - |
| 1243 | \snippet layouts/layouts.cpp 1 | - |
| 1244 | \snippet layouts/layouts.cpp 2 | - |
| 1245 | \codeline | - |
| 1246 | \snippet layouts/layouts.cpp 3 | - |
| 1247 | \snippet layouts/layouts.cpp 4 | - |
| 1248 | \snippet layouts/layouts.cpp 5 | - |
| 1249 | | - |
| 1250 | First, we create the widgets we want in the layout. Then, we | - |
| 1251 | create the QHBoxLayout object and add the widgets into the | - |
| 1252 | layout. Finally, we call QWidget::setLayout() to install the | - |
| 1253 | QHBoxLayout object onto the widget. At that point, the widgets in | - |
| 1254 | the layout are reparented to have \c window as their parent. | - |
| 1255 | | - |
| 1256 | \image qhboxlayout-with-5-children.png Horizontal box layout with five child widgets | - |
| 1257 | | - |
| 1258 | \sa QVBoxLayout, QGridLayout, QStackedLayout, {Layout Management}, {Basic Layouts Example} | - |
| 1259 | */ | - |
| 1260 | | - |
| 1261 | | - |
| 1262 | /*! | - |
| 1263 | Constructs a new top-level horizontal box with | - |
| 1264 | parent \a parent. | - |
| 1265 | */ | - |
| 1266 | QHBoxLayout::QHBoxLayout(QWidget *parent) | - |
| 1267 | : QBoxLayout(LeftToRight, parent) | - |
| 1268 | { | - |
| 1269 | } executed: }Execution Count:420 | 420 |
| 1270 | | - |
| 1271 | /*! | - |
| 1272 | Constructs a new horizontal box. You must add | - |
| 1273 | it to another layout. | - |
| 1274 | */ | - |
| 1275 | QHBoxLayout::QHBoxLayout() | - |
| 1276 | : QBoxLayout(LeftToRight) | - |
| 1277 | { | - |
| 1278 | } executed: }Execution Count:361 | 361 |
| 1279 | | - |
| 1280 | | - |
| 1281 | | - |
| 1282 | | - |
| 1283 | | - |
| 1284 | /*! | - |
| 1285 | Destroys this box layout. | - |
| 1286 | | - |
| 1287 | The layout's widgets aren't destroyed. | - |
| 1288 | */ | - |
| 1289 | QHBoxLayout::~QHBoxLayout() | - |
| 1290 | { | - |
| 1291 | } | - |
| 1292 | | - |
| 1293 | /*! | - |
| 1294 | \class QVBoxLayout | - |
| 1295 | \brief The QVBoxLayout class lines up widgets vertically. | - |
| 1296 | | - |
| 1297 | \ingroup geomanagement | - |
| 1298 | \inmodule QtWidgets | - |
| 1299 | | - |
| 1300 | This class is used to construct vertical box layout objects. See | - |
| 1301 | QBoxLayout for details. | - |
| 1302 | | - |
| 1303 | The simplest use of the class is like this: | - |
| 1304 | | - |
| 1305 | \snippet layouts/layouts.cpp 6 | - |
| 1306 | \snippet layouts/layouts.cpp 7 | - |
| 1307 | \snippet layouts/layouts.cpp 8 | - |
| 1308 | \codeline | - |
| 1309 | \snippet layouts/layouts.cpp 9 | - |
| 1310 | \snippet layouts/layouts.cpp 10 | - |
| 1311 | \snippet layouts/layouts.cpp 11 | - |
| 1312 | | - |
| 1313 | First, we create the widgets we want in the layout. Then, we | - |
| 1314 | create the QVBoxLayout object and add the widgets into the | - |
| 1315 | layout. Finally, we call QWidget::setLayout() to install the | - |
| 1316 | QVBoxLayout object onto the widget. At that point, the widgets in | - |
| 1317 | the layout are reparented to have \c window as their parent. | - |
| 1318 | | - |
| 1319 | \image qvboxlayout-with-5-children.png Horizontal box layout with five child widgets | - |
| 1320 | | - |
| 1321 | \sa QHBoxLayout, QGridLayout, QStackedLayout, {Layout Management}, {Basic Layouts Example} | - |
| 1322 | */ | - |
| 1323 | | - |
| 1324 | /*! | - |
| 1325 | Constructs a new top-level vertical box with | - |
| 1326 | parent \a parent. | - |
| 1327 | */ | - |
| 1328 | QVBoxLayout::QVBoxLayout(QWidget *parent) | - |
| 1329 | : QBoxLayout(TopToBottom, parent) | - |
| 1330 | { | - |
| 1331 | } executed: }Execution Count:974 | 974 |
| 1332 | | - |
| 1333 | /*! | - |
| 1334 | Constructs a new vertical box. You must add | - |
| 1335 | it to another layout. | - |
| 1336 | | - |
| 1337 | */ | - |
| 1338 | QVBoxLayout::QVBoxLayout() | - |
| 1339 | : QBoxLayout(TopToBottom) | - |
| 1340 | { | - |
| 1341 | } executed: }Execution Count:217 | 217 |
| 1342 | | - |
| 1343 | | - |
| 1344 | /*! | - |
| 1345 | Destroys this box layout. | - |
| 1346 | | - |
| 1347 | The layout's widgets aren't destroyed. | - |
| 1348 | */ | - |
| 1349 | QVBoxLayout::~QVBoxLayout() | - |
| 1350 | { | - |
| 1351 | } | - |
| 1352 | | - |
| 1353 | QT_END_NAMESPACE | - |
| 1354 | | - |
| | |