| 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 "qlayout.h" | - |
| 43 | | - |
| 44 | #include "qapplication.h" | - |
| 45 | #include "qdebug.h" | - |
| 46 | #include "qlayoutengine_p.h" | - |
| 47 | #include "qmenubar.h" | - |
| 48 | #include "qtoolbar.h" | - |
| 49 | #include "qevent.h" | - |
| 50 | #include "qstyle.h" | - |
| 51 | #include "qvariant.h" | - |
| 52 | #include "qwidget_p.h" | - |
| 53 | | - |
| 54 | QT_BEGIN_NAMESPACE | - |
| 55 | | - |
| 56 | inline static QRect fromLayoutItemRect(QWidgetPrivate *priv, const QRect &rect) | - |
| 57 | { | - |
| 58 | return rect.adjusted(priv->leftLayoutItemMargin, priv->topLayoutItemMargin, executed: return rect.adjusted(priv->leftLayoutItemMargin, priv->topLayoutItemMargin, -priv->rightLayoutItemMargin, -priv->bottomLayoutItemMargin);Execution Count:11409 | 11409 |
| 59 | -priv->rightLayoutItemMargin, -priv->bottomLayoutItemMargin); executed: return rect.adjusted(priv->leftLayoutItemMargin, priv->topLayoutItemMargin, -priv->rightLayoutItemMargin, -priv->bottomLayoutItemMargin);Execution Count:11409 | 11409 |
| 60 | } | - |
| 61 | | - |
| 62 | inline static QSize fromLayoutItemSize(QWidgetPrivate *priv, const QSize &size) | - |
| 63 | { | - |
| 64 | return fromLayoutItemRect(priv, QRect(QPoint(0, 0), size)).size(); executed: return fromLayoutItemRect(priv, QRect(QPoint(0, 0), size)).size();Execution Count:274 | 274 |
| 65 | } | - |
| 66 | | - |
| 67 | inline static QRect toLayoutItemRect(QWidgetPrivate *priv, const QRect &rect) | - |
| 68 | { | - |
| 69 | return rect.adjusted(-priv->leftLayoutItemMargin, -priv->topLayoutItemMargin, executed: return rect.adjusted(-priv->leftLayoutItemMargin, -priv->topLayoutItemMargin, priv->rightLayoutItemMargin, priv->bottomLayoutItemMargin);Execution Count:35043 | 35043 |
| 70 | priv->rightLayoutItemMargin, priv->bottomLayoutItemMargin); executed: return rect.adjusted(-priv->leftLayoutItemMargin, -priv->topLayoutItemMargin, priv->rightLayoutItemMargin, priv->bottomLayoutItemMargin);Execution Count:35043 | 35043 |
| 71 | } | - |
| 72 | | - |
| 73 | inline static QSize toLayoutItemSize(QWidgetPrivate *priv, const QSize &size) | - |
| 74 | { | - |
| 75 | return toLayoutItemRect(priv, QRect(QPoint(0, 0), size)).size(); executed: return toLayoutItemRect(priv, QRect(QPoint(0, 0), size)).size();Execution Count:30542 | 30542 |
| 76 | } | - |
| 77 | | - |
| 78 | /*! | - |
| 79 | Returns a QVariant storing this QSizePolicy. | - |
| 80 | */ | - |
| 81 | QSizePolicy::operator QVariant() const | - |
| 82 | { | - |
| 83 | return QVariant(QVariant::SizePolicy, this); executed: return QVariant(QVariant::SizePolicy, this);Execution Count:2 | 2 |
| 84 | } | - |
| 85 | | - |
| 86 | /*! | - |
| 87 | \class QLayoutItem | - |
| 88 | \brief The QLayoutItem class provides an abstract item that a | - |
| 89 | QLayout manipulates. | - |
| 90 | | - |
| 91 | \ingroup geomanagement | - |
| 92 | \inmodule QtWidgets | - |
| 93 | | - |
| 94 | This is used by custom layouts. | - |
| 95 | | - |
| 96 | Pure virtual functions are provided to return information about | - |
| 97 | the layout, including, sizeHint(), minimumSize(), maximumSize() | - |
| 98 | and expanding(). | - |
| 99 | | - |
| 100 | The layout's geometry can be set and retrieved with setGeometry() | - |
| 101 | and geometry(), and its alignment with setAlignment() and | - |
| 102 | alignment(). | - |
| 103 | | - |
| 104 | isEmpty() returns whether the layout item is empty. If the | - |
| 105 | concrete item is a QWidget, it can be retrieved using widget(). | - |
| 106 | Similarly for layout() and spacerItem(). | - |
| 107 | | - |
| 108 | Some layouts have width and height interdependencies. These can | - |
| 109 | be expressed using hasHeightForWidth(), heightForWidth(), and | - |
| 110 | minimumHeightForWidth(). For more explanation see the \e{Qt | - |
| 111 | Quarterly} article | - |
| 112 | \l{http://doc.qt.digia.com/qq/qq04-height-for-width.html}{Trading | - |
| 113 | Height for Width}. | - |
| 114 | | - |
| 115 | \sa QLayout | - |
| 116 | */ | - |
| 117 | | - |
| 118 | /*! | - |
| 119 | \class QSpacerItem | - |
| 120 | \ingroup geomanagement | - |
| 121 | \brief The QSpacerItem class provides blank space in a layout. | - |
| 122 | | - |
| 123 | \inmodule QtWidgets | - |
| 124 | | - |
| 125 | Normally, you don't need to use this class directly. Qt's | - |
| 126 | built-in layout managers provide the following functions for | - |
| 127 | manipulating empty space in layouts: | - |
| 128 | | - |
| 129 | \table | - |
| 130 | \header \li Class | - |
| 131 | \li Functions | - |
| 132 | \row \li QHBoxLayout | - |
| 133 | \li \l{QBoxLayout::addSpacing()}{addSpacing()}, | - |
| 134 | \l{QBoxLayout::addStretch()}{addStretch()}, | - |
| 135 | \l{QBoxLayout::insertSpacing()}{insertSpacing()}, | - |
| 136 | \l{QBoxLayout::insertStretch()}{insertStretch()} | - |
| 137 | \row \li QGridLayout | - |
| 138 | \li \l{QGridLayout::setRowMinimumHeight()}{setRowMinimumHeight()}, | - |
| 139 | \l{QGridLayout::setRowStretch()}{setRowStretch()}, | - |
| 140 | \l{QGridLayout::setColumnMinimumWidth()}{setColumnMinimumWidth()}, | - |
| 141 | \l{QGridLayout::setColumnStretch()}{setColumnStretch()} | - |
| 142 | \endtable | - |
| 143 | | - |
| 144 | \sa QLayout, QWidgetItem, QLayoutItem::spacerItem() | - |
| 145 | */ | - |
| 146 | | - |
| 147 | /*! | - |
| 148 | \class QWidgetItem | - |
| 149 | \ingroup geomanagement | - |
| 150 | \brief The QWidgetItem class is a layout item that represents a widget. | - |
| 151 | | - |
| 152 | \inmodule QtWidgets | - |
| 153 | | - |
| 154 | Normally, you don't need to use this class directly. Qt's | - |
| 155 | built-in layout managers provide the following functions for | - |
| 156 | manipulating widgets in layouts: | - |
| 157 | | - |
| 158 | \table | - |
| 159 | \header \li Class | - |
| 160 | \li Functions | - |
| 161 | \row \li QBoxLayout | - |
| 162 | \li \l{QBoxLayout::addWidget()}{addWidget()}, | - |
| 163 | \l{QBoxLayout::insertWidget()}{insertWidget()}, | - |
| 164 | \l{QBoxLayout::setStretchFactor()}{setStretchFactor()} | - |
| 165 | \row \li QGridLayout | - |
| 166 | \li \l{QGridLayout::addWidget()}{addWidget()} | - |
| 167 | \row \li QStackedLayout | - |
| 168 | \li \l{QStackedLayout::addWidget()}{addWidget()}, | - |
| 169 | \l{QStackedLayout::insertWidget()}{insertWidget()}, | - |
| 170 | \l{QStackedLayout::currentWidget()}{currentWidget()}, | - |
| 171 | \l{QStackedLayout::setCurrentWidget()}{setCurrentWidget()}, | - |
| 172 | \l{QStackedLayout::widget()}{widget()} | - |
| 173 | \endtable | - |
| 174 | | - |
| 175 | \sa QLayout, QSpacerItem, QLayoutItem::widget() | - |
| 176 | */ | - |
| 177 | | - |
| 178 | /*! | - |
| 179 | \fn QLayoutItem::QLayoutItem(Qt::Alignment alignment) | - |
| 180 | | - |
| 181 | Constructs a layout item with an \a alignment. | - |
| 182 | Not all subclasses support alignment. | - |
| 183 | */ | - |
| 184 | | - |
| 185 | /*! | - |
| 186 | \fn Qt::Alignment QLayoutItem::alignment() const | - |
| 187 | | - |
| 188 | Returns the alignment of this item. | - |
| 189 | */ | - |
| 190 | | - |
| 191 | /*! | - |
| 192 | Sets the alignment of this item to \a alignment. | - |
| 193 | | - |
| 194 | \b{Note:} Item alignment is only supported by QLayoutItem subclasses | - |
| 195 | where it would have a visual effect. Except for QSpacerItem, which provides | - |
| 196 | blank space for layouts, all public Qt classes that inherit QLayoutItem | - |
| 197 | support item alignment. | - |
| 198 | */ | - |
| 199 | void QLayoutItem::setAlignment(Qt::Alignment alignment) | - |
| 200 | { | - |
| 201 | align = alignment; executed (the execution status of this line is deduced): align = alignment; | - |
| 202 | } executed: }Execution Count:18140 | 18140 |
| 203 | | - |
| 204 | /*! | - |
| 205 | \fn QSize QLayoutItem::maximumSize() const | - |
| 206 | | - |
| 207 | Implemented in subclasses to return the maximum size of this item. | - |
| 208 | */ | - |
| 209 | | - |
| 210 | /*! | - |
| 211 | \fn QSize QLayoutItem::minimumSize() const | - |
| 212 | | - |
| 213 | Implemented in subclasses to return the minimum size of this item. | - |
| 214 | */ | - |
| 215 | | - |
| 216 | /*! | - |
| 217 | \fn QSize QLayoutItem::sizeHint() const | - |
| 218 | | - |
| 219 | Implemented in subclasses to return the preferred size of this item. | - |
| 220 | */ | - |
| 221 | | - |
| 222 | /*! | - |
| 223 | \fn Qt::Orientations QLayoutItem::expandingDirections() const | - |
| 224 | | - |
| 225 | Returns whether this layout item can make use of more space than | - |
| 226 | sizeHint(). A value of Qt::Vertical or Qt::Horizontal means that | - |
| 227 | it wants to grow in only one dimension, whereas Qt::Vertical | | - |
| 228 | Qt::Horizontal means that it wants to grow in both dimensions. | - |
| 229 | */ | - |
| 230 | | - |
| 231 | /*! | - |
| 232 | \fn void QLayoutItem::setGeometry(const QRect &r) | - |
| 233 | | - |
| 234 | Implemented in subclasses to set this item's geometry to \a r. | - |
| 235 | | - |
| 236 | \sa geometry() | - |
| 237 | */ | - |
| 238 | | - |
| 239 | /*! | - |
| 240 | \fn QRect QLayoutItem::geometry() const | - |
| 241 | | - |
| 242 | Returns the rectangle covered by this layout item. | - |
| 243 | | - |
| 244 | \sa setGeometry() | - |
| 245 | */ | - |
| 246 | | - |
| 247 | /*! | - |
| 248 | \fn virtual bool QLayoutItem::isEmpty() const | - |
| 249 | | - |
| 250 | Implemented in subclasses to return whether this item is empty, | - |
| 251 | i.e. whether it contains any widgets. | - |
| 252 | */ | - |
| 253 | | - |
| 254 | /*! | - |
| 255 | \fn QSpacerItem::QSpacerItem(int w, int h, QSizePolicy::Policy hPolicy, QSizePolicy::Policy vPolicy) | - |
| 256 | | - |
| 257 | Constructs a spacer item with preferred width \a w, preferred | - |
| 258 | height \a h, horizontal size policy \a hPolicy and vertical size | - |
| 259 | policy \a vPolicy. | - |
| 260 | | - |
| 261 | The default values provide a gap that is able to stretch if | - |
| 262 | nothing else wants the space. | - |
| 263 | */ | - |
| 264 | | - |
| 265 | /*! | - |
| 266 | Destructor. | - |
| 267 | */ | - |
| 268 | QSpacerItem::~QSpacerItem() {} | - |
| 269 | | - |
| 270 | /*! | - |
| 271 | Changes this spacer item to have preferred width \a w, preferred | - |
| 272 | height \a h, horizontal size policy \a hPolicy and vertical size | - |
| 273 | policy \a vPolicy. | - |
| 274 | | - |
| 275 | The default values provide a gap that is able to stretch if | - |
| 276 | nothing else wants the space. | - |
| 277 | | - |
| 278 | Note that if changeSize() is called after the spacer item has been added | - |
| 279 | to a layout, it is necessary to invalidate the layout in order for the | - |
| 280 | spacer item's new size to take effect. | - |
| 281 | | - |
| 282 | \sa QSpacerItem::invalidate() | - |
| 283 | */ | - |
| 284 | void QSpacerItem::changeSize(int w, int h, QSizePolicy::Policy hPolicy, | - |
| 285 | QSizePolicy::Policy vPolicy) | - |
| 286 | { | - |
| 287 | width = w; executed (the execution status of this line is deduced): width = w; | - |
| 288 | height = h; executed (the execution status of this line is deduced): height = h; | - |
| 289 | sizeP = QSizePolicy(hPolicy, vPolicy); executed (the execution status of this line is deduced): sizeP = QSizePolicy(hPolicy, vPolicy); | - |
| 290 | } executed: }Execution Count:1483 | 1483 |
| 291 | | - |
| 292 | /*! | - |
| 293 | \fn QWidgetItem::QWidgetItem(QWidget *widget) | - |
| 294 | | - |
| 295 | Creates an item containing the given \a widget. | - |
| 296 | */ | - |
| 297 | | - |
| 298 | /*! | - |
| 299 | Destructor. | - |
| 300 | */ | - |
| 301 | QWidgetItem::~QWidgetItem() {} | - |
| 302 | | - |
| 303 | /*! | - |
| 304 | Destroys the QLayoutItem. | - |
| 305 | */ | - |
| 306 | QLayoutItem::~QLayoutItem() | - |
| 307 | { | - |
| 308 | } | - |
| 309 | | - |
| 310 | /*! | - |
| 311 | Invalidates any cached information in this layout item. | - |
| 312 | */ | - |
| 313 | void QLayoutItem::invalidate() | - |
| 314 | { | - |
| 315 | } | - |
| 316 | | - |
| 317 | /*! | - |
| 318 | If this item is a QLayout, it is returned as a QLayout; otherwise | - |
| 319 | 0 is returned. This function provides type-safe casting. | - |
| 320 | */ | - |
| 321 | QLayout * QLayoutItem::layout() | - |
| 322 | { | - |
| 323 | return 0; executed: return 0;Execution Count:19142 | 19142 |
| 324 | } | - |
| 325 | | - |
| 326 | /*! | - |
| 327 | If this item is a QSpacerItem, it is returned as a QSpacerItem; | - |
| 328 | otherwise 0 is returned. This function provides type-safe casting. | - |
| 329 | */ | - |
| 330 | QSpacerItem * QLayoutItem::spacerItem() | - |
| 331 | { | - |
| 332 | return 0; never executed: return 0; | 0 |
| 333 | } | - |
| 334 | | - |
| 335 | /*! | - |
| 336 | \reimp | - |
| 337 | */ | - |
| 338 | QLayout * QLayout::layout() | - |
| 339 | { | - |
| 340 | return this; executed: return this;Execution Count:7000 | 7000 |
| 341 | } | - |
| 342 | | - |
| 343 | /*! | - |
| 344 | Returns a pointer to this object. | - |
| 345 | */ | - |
| 346 | QSpacerItem * QSpacerItem::spacerItem() | - |
| 347 | { | - |
| 348 | return this; executed: return this;Execution Count:1479 | 1479 |
| 349 | } | - |
| 350 | | - |
| 351 | /*! | - |
| 352 | If this item is a QWidget, it is returned as a QWidget; otherwise | - |
| 353 | 0 is returned. This function provides type-safe casting. | - |
| 354 | */ | - |
| 355 | QWidget * QLayoutItem::widget() | - |
| 356 | { | - |
| 357 | return 0; executed: return 0;Execution Count:13640 | 13640 |
| 358 | } | - |
| 359 | | - |
| 360 | /*! | - |
| 361 | Returns the widget managed by this item. | - |
| 362 | */ | - |
| 363 | QWidget *QWidgetItem::widget() | - |
| 364 | { | - |
| 365 | return wid; executed: return wid;Execution Count:82691 | 82691 |
| 366 | } | - |
| 367 | | - |
| 368 | /*! | - |
| 369 | Returns true if this layout's preferred height depends on its | - |
| 370 | width; otherwise returns false. The default implementation returns | - |
| 371 | false. | - |
| 372 | | - |
| 373 | Reimplement this function in layout managers that support height | - |
| 374 | for width. | - |
| 375 | | - |
| 376 | \sa heightForWidth(), QWidget::heightForWidth() | - |
| 377 | */ | - |
| 378 | bool QLayoutItem::hasHeightForWidth() const | - |
| 379 | { | - |
| 380 | return false; executed: return false;Execution Count:3448 | 3448 |
| 381 | } | - |
| 382 | | - |
| 383 | /*! | - |
| 384 | Returns the minimum height this widget needs for the given width, | - |
| 385 | \a w. The default implementation simply returns heightForWidth(\a | - |
| 386 | w). | - |
| 387 | */ | - |
| 388 | int QLayoutItem::minimumHeightForWidth(int w) const | - |
| 389 | { | - |
| 390 | return heightForWidth(w); executed: return heightForWidth(w);Execution Count:3 | 3 |
| 391 | } | - |
| 392 | | - |
| 393 | | - |
| 394 | /*! | - |
| 395 | Returns the preferred height for this layout item, given the width | - |
| 396 | \a w. | - |
| 397 | | - |
| 398 | The default implementation returns -1, indicating that the | - |
| 399 | preferred height is independent of the width of the item. Using | - |
| 400 | the function hasHeightForWidth() will typically be much faster | - |
| 401 | than calling this function and testing for -1. | - |
| 402 | | - |
| 403 | Reimplement this function in layout managers that support height | - |
| 404 | for width. A typical implementation will look like this: | - |
| 405 | \snippet code/src_gui_kernel_qlayoutitem.cpp 0 | - |
| 406 | | - |
| 407 | Caching is strongly recommended; without it layout will take | - |
| 408 | exponential time. | - |
| 409 | | - |
| 410 | \sa hasHeightForWidth() | - |
| 411 | */ | - |
| 412 | int QLayoutItem::heightForWidth(int /* w */) const | - |
| 413 | { | - |
| 414 | return -1; never executed: return -1; | 0 |
| 415 | } | - |
| 416 | | - |
| 417 | /*! | - |
| 418 | Returns the control type(s) for the layout item. For a | - |
| 419 | QWidgetItem, the control type comes from the widget's size | - |
| 420 | policy; for a QLayoutItem, the control types is derived from the | - |
| 421 | layout's contents. | - |
| 422 | | - |
| 423 | \sa QSizePolicy::controlType() | - |
| 424 | */ | - |
| 425 | QSizePolicy::ControlTypes QLayoutItem::controlTypes() const | - |
| 426 | { | - |
| 427 | return QSizePolicy::DefaultType; executed: return QSizePolicy::DefaultType;Execution Count:28 | 28 |
| 428 | } | - |
| 429 | | - |
| 430 | /*! | - |
| 431 | \reimp | - |
| 432 | */ | - |
| 433 | void QSpacerItem::setGeometry(const QRect &r) | - |
| 434 | { | - |
| 435 | rect = r; executed (the execution status of this line is deduced): rect = r; | - |
| 436 | } executed: }Execution Count:1999 | 1999 |
| 437 | | - |
| 438 | /*! | - |
| 439 | \reimp | - |
| 440 | */ | - |
| 441 | void QWidgetItem::setGeometry(const QRect &rect) | - |
| 442 | { | - |
| 443 | if (isEmpty()) evaluated: isEmpty()| yes Evaluation Count:1430 | yes Evaluation Count:11174 |
| 1430-11174 |
| 444 | return; executed: return;Execution Count:1430 | 1430 |
| 445 | | - |
| 446 | QRect r = !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) evaluated: !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect)| yes Evaluation Count:11135 | yes Evaluation Count:39 |
| 39-11135 |
| 447 | ? fromLayoutItemRect(wid->d_func(), rect) executed (the execution status of this line is deduced): ? fromLayoutItemRect(wid->d_func(), rect) | - |
| 448 | : rect; executed (the execution status of this line is deduced): : rect; | - |
| 449 | const QSize widgetRectSurplus = r.size() - rect.size(); executed (the execution status of this line is deduced): const QSize widgetRectSurplus = r.size() - rect.size(); | - |
| 450 | | - |
| 451 | /* | - |
| 452 | For historical reasons, this code is done using widget rect | - |
| 453 | coordinates, not layout item rect coordinates. However, | - |
| 454 | QWidgetItem's sizeHint(), maximumSize(), and heightForWidth() | - |
| 455 | all work in terms of layout item rect coordinates, so we have to | - |
| 456 | add or subtract widgetRectSurplus here and there. The code could | - |
| 457 | be much simpler if we did everything using layout item rect | - |
| 458 | coordinates and did the conversion right before the call to | - |
| 459 | QWidget::setGeometry(). | - |
| 460 | */ | - |
| 461 | | - |
| 462 | QSize s = r.size().boundedTo(maximumSize() + widgetRectSurplus); executed (the execution status of this line is deduced): QSize s = r.size().boundedTo(maximumSize() + widgetRectSurplus); | - |
| 463 | int x = r.x(); executed (the execution status of this line is deduced): int x = r.x(); | - |
| 464 | int y = r.y(); executed (the execution status of this line is deduced): int y = r.y(); | - |
| 465 | if (align & (Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask)) { evaluated: align & (Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask)| yes Evaluation Count:295 | yes Evaluation Count:10879 |
| 295-10879 |
| 466 | QSize pref(sizeHint()); executed (the execution status of this line is deduced): QSize pref(sizeHint()); | - |
| 467 | QSizePolicy sp = wid->sizePolicy(); executed (the execution status of this line is deduced): QSizePolicy sp = wid->sizePolicy(); | - |
| 468 | if (sp.horizontalPolicy() == QSizePolicy::Ignored) partially evaluated: sp.horizontalPolicy() == QSizePolicy::Ignored| no Evaluation Count:0 | yes Evaluation Count:295 |
| 0-295 |
| 469 | pref.setWidth(wid->sizeHint().expandedTo(wid->minimumSize()).width()); never executed: pref.setWidth(wid->sizeHint().expandedTo(wid->minimumSize()).width()); | 0 |
| 470 | if (sp.verticalPolicy() == QSizePolicy::Ignored) partially evaluated: sp.verticalPolicy() == QSizePolicy::Ignored| no Evaluation Count:0 | yes Evaluation Count:295 |
| 0-295 |
| 471 | pref.setHeight(wid->sizeHint().expandedTo(wid->minimumSize()).height()); never executed: pref.setHeight(wid->sizeHint().expandedTo(wid->minimumSize()).height()); | 0 |
| 472 | pref += widgetRectSurplus; executed (the execution status of this line is deduced): pref += widgetRectSurplus; | - |
| 473 | if (align & Qt::AlignHorizontal_Mask) evaluated: align & Qt::AlignHorizontal_Mask| yes Evaluation Count:31 | yes Evaluation Count:264 |
| 31-264 |
| 474 | s.setWidth(qMin(s.width(), pref.width())); executed: s.setWidth(qMin(s.width(), pref.width()));Execution Count:31 | 31 |
| 475 | if (align & Qt::AlignVertical_Mask) { evaluated: align & Qt::AlignVertical_Mask| yes Evaluation Count:293 | yes Evaluation Count:2 |
| 2-293 |
| 476 | if (hasHeightForWidth()) partially evaluated: hasHeightForWidth()| no Evaluation Count:0 | yes Evaluation Count:293 |
| 0-293 |
| 477 | s.setHeight(qMin(s.height(), never executed: s.setHeight(qMin(s.height(), heightForWidth(s.width() - widgetRectSurplus.width()) + widgetRectSurplus.height())); | 0 |
| 478 | heightForWidth(s.width() - widgetRectSurplus.width()) never executed: s.setHeight(qMin(s.height(), heightForWidth(s.width() - widgetRectSurplus.width()) + widgetRectSurplus.height())); | 0 |
| 479 | + widgetRectSurplus.height())); never executed: s.setHeight(qMin(s.height(), heightForWidth(s.width() - widgetRectSurplus.width()) + widgetRectSurplus.height())); | 0 |
| 480 | else | - |
| 481 | s.setHeight(qMin(s.height(), pref.height())); executed: s.setHeight(qMin(s.height(), pref.height()));Execution Count:293 | 293 |
| 482 | } | - |
| 483 | } executed: }Execution Count:295 | 295 |
| 484 | Qt::Alignment alignHoriz = QStyle::visualAlignment(wid->layoutDirection(), align); executed (the execution status of this line is deduced): Qt::Alignment alignHoriz = QStyle::visualAlignment(wid->layoutDirection(), align); | - |
| 485 | if (alignHoriz & Qt::AlignRight) evaluated: alignHoriz & Qt::AlignRight| yes Evaluation Count:181 | yes Evaluation Count:10993 |
| 181-10993 |
| 486 | x = x + (r.width() - s.width()); executed: x = x + (r.width() - s.width());Execution Count:181 | 181 |
| 487 | else if (!(alignHoriz & Qt::AlignLeft)) evaluated: !(alignHoriz & Qt::AlignLeft)| yes Evaluation Count:6 | yes Evaluation Count:10987 |
| 6-10987 |
| 488 | x = x + (r.width() - s.width()) / 2; executed: x = x + (r.width() - s.width()) / 2;Execution Count:6 | 6 |
| 489 | | - |
| 490 | if (align & Qt::AlignBottom) evaluated: align & Qt::AlignBottom| yes Evaluation Count:16 | yes Evaluation Count:11158 |
| 16-11158 |
| 491 | y = y + (r.height() - s.height()); executed: y = y + (r.height() - s.height());Execution Count:16 | 16 |
| 492 | else if (!(align & Qt::AlignTop)) evaluated: !(align & Qt::AlignTop)| yes Evaluation Count:10885 | yes Evaluation Count:273 |
| 273-10885 |
| 493 | y = y + (r.height() - s.height()) / 2; executed: y = y + (r.height() - s.height()) / 2;Execution Count:10885 | 10885 |
| 494 | | - |
| 495 | wid->setGeometry(x, y, s.width(), s.height()); executed (the execution status of this line is deduced): wid->setGeometry(x, y, s.width(), s.height()); | - |
| 496 | } executed: }Execution Count:11174 | 11174 |
| 497 | | - |
| 498 | /*! | - |
| 499 | \reimp | - |
| 500 | */ | - |
| 501 | QRect QSpacerItem::geometry() const | - |
| 502 | { | - |
| 503 | return rect; never executed: return rect; | 0 |
| 504 | } | - |
| 505 | | - |
| 506 | /*! | - |
| 507 | \reimp | - |
| 508 | */ | - |
| 509 | QRect QWidgetItem::geometry() const | - |
| 510 | { | - |
| 511 | return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) executed: return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) ? toLayoutItemRect(wid->d_func(), wid->geometry()) : wid->geometry();Execution Count:4501 | 4501 |
| 512 | ? toLayoutItemRect(wid->d_func(), wid->geometry()) executed: return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) ? toLayoutItemRect(wid->d_func(), wid->geometry()) : wid->geometry();Execution Count:4501 | 4501 |
| 513 | : wid->geometry(); executed: return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) ? toLayoutItemRect(wid->d_func(), wid->geometry()) : wid->geometry();Execution Count:4501 | 4501 |
| 514 | } | - |
| 515 | | - |
| 516 | | - |
| 517 | /*! | - |
| 518 | \reimp | - |
| 519 | */ | - |
| 520 | bool QWidgetItem::hasHeightForWidth() const | - |
| 521 | { | - |
| 522 | if (isEmpty()) evaluated: isEmpty()| yes Evaluation Count:2541 | yes Evaluation Count:18198 |
| 2541-18198 |
| 523 | return false; executed: return false;Execution Count:2541 | 2541 |
| 524 | return wid->hasHeightForWidth(); executed: return wid->hasHeightForWidth();Execution Count:18198 | 18198 |
| 525 | } | - |
| 526 | | - |
| 527 | /*! | - |
| 528 | \reimp | - |
| 529 | */ | - |
| 530 | int QWidgetItem::heightForWidth(int w) const | - |
| 531 | { | - |
| 532 | if (isEmpty()) partially evaluated: isEmpty()| no Evaluation Count:0 | yes Evaluation Count:274 |
| 0-274 |
| 533 | return -1; never executed: return -1; | 0 |
| 534 | | - |
| 535 | w = !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) partially evaluated: !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect)| yes Evaluation Count:274 | no Evaluation Count:0 |
| 0-274 |
| 536 | ? fromLayoutItemSize(wid->d_func(), QSize(w, 0)).width() executed (the execution status of this line is deduced): ? fromLayoutItemSize(wid->d_func(), QSize(w, 0)).width() | - |
| 537 | : w; executed (the execution status of this line is deduced): : w; | - |
| 538 | | - |
| 539 | int hfw; executed (the execution status of this line is deduced): int hfw; | - |
| 540 | if (wid->layout()) evaluated: wid->layout()| yes Evaluation Count:69 | yes Evaluation Count:205 |
| 69-205 |
| 541 | hfw = wid->layout()->totalHeightForWidth(w); executed: hfw = wid->layout()->totalHeightForWidth(w);Execution Count:69 | 69 |
| 542 | else | - |
| 543 | hfw = wid->heightForWidth(w); executed: hfw = wid->heightForWidth(w);Execution Count:205 | 205 |
| 544 | | - |
| 545 | if (hfw > wid->maximumHeight()) evaluated: hfw > wid->maximumHeight()| yes Evaluation Count:4 | yes Evaluation Count:270 |
| 4-270 |
| 546 | hfw = wid->maximumHeight(); executed: hfw = wid->maximumHeight();Execution Count:4 | 4 |
| 547 | if (hfw < wid->minimumHeight()) evaluated: hfw < wid->minimumHeight()| yes Evaluation Count:57 | yes Evaluation Count:217 |
| 57-217 |
| 548 | hfw = wid->minimumHeight(); executed: hfw = wid->minimumHeight();Execution Count:57 | 57 |
| 549 | | - |
| 550 | hfw = !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) partially evaluated: !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect)| yes Evaluation Count:274 | no Evaluation Count:0 |
| 0-274 |
| 551 | ? toLayoutItemSize(wid->d_func(), QSize(0, hfw)).height() executed (the execution status of this line is deduced): ? toLayoutItemSize(wid->d_func(), QSize(0, hfw)).height() | - |
| 552 | : hfw; executed (the execution status of this line is deduced): : hfw; | - |
| 553 | | - |
| 554 | if (hfw < 0) partially evaluated: hfw < 0| no Evaluation Count:0 | yes Evaluation Count:274 |
| 0-274 |
| 555 | hfw = 0; | 0 |
| 556 | return hfw; executed: return hfw;Execution Count:274 | 274 |
| 557 | } | - |
| 558 | | - |
| 559 | /*! | - |
| 560 | \reimp | - |
| 561 | */ | - |
| 562 | Qt::Orientations QSpacerItem::expandingDirections() const | - |
| 563 | { | - |
| 564 | return sizeP.expandingDirections(); executed: return sizeP.expandingDirections();Execution Count:3047 | 3047 |
| 565 | } | - |
| 566 | | - |
| 567 | /*! | - |
| 568 | \reimp | - |
| 569 | */ | - |
| 570 | Qt::Orientations QWidgetItem::expandingDirections() const | - |
| 571 | { | - |
| 572 | if (isEmpty()) evaluated: isEmpty()| yes Evaluation Count:1917 | yes Evaluation Count:20188 |
| 1917-20188 |
| 573 | return Qt::Orientations(0); executed: return Qt::Orientations(0);Execution Count:1917 | 1917 |
| 574 | | - |
| 575 | Qt::Orientations e = wid->sizePolicy().expandingDirections(); executed (the execution status of this line is deduced): Qt::Orientations e = wid->sizePolicy().expandingDirections(); | - |
| 576 | /* | - |
| 577 | If the layout is expanding, we make the widget expanding, even if | - |
| 578 | its own size policy isn't expanding. | - |
| 579 | */ | - |
| 580 | if (wid->layout()) { evaluated: wid->layout()| yes Evaluation Count:2893 | yes Evaluation Count:17295 |
| 2893-17295 |
| 581 | if (wid->sizePolicy().horizontalPolicy() & QSizePolicy::GrowFlag evaluated: wid->sizePolicy().horizontalPolicy() & QSizePolicy::GrowFlag| yes Evaluation Count:2464 | yes Evaluation Count:429 |
| 429-2464 |
| 582 | && (wid->layout()->expandingDirections() & Qt::Horizontal)) evaluated: (wid->layout()->expandingDirections() & Qt::Horizontal)| yes Evaluation Count:915 | yes Evaluation Count:1549 |
| 915-1549 |
| 583 | e |= Qt::Horizontal; executed: e |= Qt::Horizontal;Execution Count:915 | 915 |
| 584 | if (wid->sizePolicy().verticalPolicy() & QSizePolicy::GrowFlag evaluated: wid->sizePolicy().verticalPolicy() & QSizePolicy::GrowFlag| yes Evaluation Count:2511 | yes Evaluation Count:382 |
| 382-2511 |
| 585 | && (wid->layout()->expandingDirections() & Qt::Vertical)) evaluated: (wid->layout()->expandingDirections() & Qt::Vertical)| yes Evaluation Count:1003 | yes Evaluation Count:1508 |
| 1003-1508 |
| 586 | e |= Qt::Vertical; executed: e |= Qt::Vertical;Execution Count:1003 | 1003 |
| 587 | } executed: }Execution Count:2893 | 2893 |
| 588 | | - |
| 589 | if (align & Qt::AlignHorizontal_Mask) evaluated: align & Qt::AlignHorizontal_Mask| yes Evaluation Count:42 | yes Evaluation Count:20146 |
| 42-20146 |
| 590 | e &= ~Qt::Horizontal; executed: e &= ~Qt::Horizontal;Execution Count:42 | 42 |
| 591 | if (align & Qt::AlignVertical_Mask) evaluated: align & Qt::AlignVertical_Mask| yes Evaluation Count:275 | yes Evaluation Count:19913 |
| 275-19913 |
| 592 | e &= ~Qt::Vertical; executed: e &= ~Qt::Vertical;Execution Count:275 | 275 |
| 593 | return e; executed: return e;Execution Count:20188 | 20188 |
| 594 | } | - |
| 595 | | - |
| 596 | /*! | - |
| 597 | \reimp | - |
| 598 | */ | - |
| 599 | QSize QSpacerItem::minimumSize() const | - |
| 600 | { | - |
| 601 | return QSize(sizeP.horizontalPolicy() & QSizePolicy::ShrinkFlag ? 0 : width, executed: return QSize(sizeP.horizontalPolicy() & QSizePolicy::ShrinkFlag ? 0 : width, sizeP.verticalPolicy() & QSizePolicy::ShrinkFlag ? 0 : height);Execution Count:3038 | 3038 |
| 602 | sizeP.verticalPolicy() & QSizePolicy::ShrinkFlag ? 0 : height); executed: return QSize(sizeP.horizontalPolicy() & QSizePolicy::ShrinkFlag ? 0 : width, sizeP.verticalPolicy() & QSizePolicy::ShrinkFlag ? 0 : height);Execution Count:3038 | 3038 |
| 603 | } | - |
| 604 | | - |
| 605 | /*! | - |
| 606 | \reimp | - |
| 607 | */ | - |
| 608 | QSize QWidgetItem::minimumSize() const | - |
| 609 | { | - |
| 610 | if (isEmpty()) evaluated: isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:29 |
| 2-29 |
| 611 | return QSize(0, 0); executed: return QSize(0, 0);Execution Count:2 | 2 |
| 612 | return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) executed: return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) ? toLayoutItemSize(wid->d_func(), qSmartMinSize(this)) : qSmartMinSize(this);Execution Count:29 | 29 |
| 613 | ? toLayoutItemSize(wid->d_func(), qSmartMinSize(this)) executed: return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) ? toLayoutItemSize(wid->d_func(), qSmartMinSize(this)) : qSmartMinSize(this);Execution Count:29 | 29 |
| 614 | : qSmartMinSize(this); executed: return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) ? toLayoutItemSize(wid->d_func(), qSmartMinSize(this)) : qSmartMinSize(this);Execution Count:29 | 29 |
| 615 | } | - |
| 616 | | - |
| 617 | /*! | - |
| 618 | \reimp | - |
| 619 | */ | - |
| 620 | QSize QSpacerItem::maximumSize() const | - |
| 621 | { | - |
| 622 | return QSize(sizeP.horizontalPolicy() & QSizePolicy::GrowFlag ? QLAYOUTSIZE_MAX : width, executed: return QSize(sizeP.horizontalPolicy() & QSizePolicy::GrowFlag ? QLAYOUTSIZE_MAX : width, sizeP.verticalPolicy() & QSizePolicy::GrowFlag ? QLAYOUTSIZE_MAX : height);Execution Count:3014 | 3014 |
| 623 | sizeP.verticalPolicy() & QSizePolicy::GrowFlag ? QLAYOUTSIZE_MAX : height); executed: return QSize(sizeP.horizontalPolicy() & QSizePolicy::GrowFlag ? QLAYOUTSIZE_MAX : width, sizeP.verticalPolicy() & QSizePolicy::GrowFlag ? QLAYOUTSIZE_MAX : height);Execution Count:3014 | 3014 |
| 624 | } | - |
| 625 | | - |
| 626 | /*! | - |
| 627 | \reimp | - |
| 628 | */ | - |
| 629 | QSize QWidgetItem::maximumSize() const | - |
| 630 | { | - |
| 631 | if (isEmpty()) { evaluated: isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:56 |
| 2-56 |
| 632 | return QSize(0, 0); executed: return QSize(0, 0);Execution Count:2 | 2 |
| 633 | } else { | - |
| 634 | return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) executed: return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) ? toLayoutItemSize(wid->d_func(), qSmartMaxSize(this, align)) : qSmartMaxSize(this, align);Execution Count:56 | 56 |
| 635 | ? toLayoutItemSize(wid->d_func(), qSmartMaxSize(this, align)) executed: return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) ? toLayoutItemSize(wid->d_func(), qSmartMaxSize(this, align)) : qSmartMaxSize(this, align);Execution Count:56 | 56 |
| 636 | : qSmartMaxSize(this, align); executed: return !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) ? toLayoutItemSize(wid->d_func(), qSmartMaxSize(this, align)) : qSmartMaxSize(this, align);Execution Count:56 | 56 |
| 637 | } | - |
| 638 | } | - |
| 639 | | - |
| 640 | /*! | - |
| 641 | \reimp | - |
| 642 | */ | - |
| 643 | QSize QSpacerItem::sizeHint() const | - |
| 644 | { | - |
| 645 | return QSize(width, height); executed: return QSize(width, height);Execution Count:3038 | 3038 |
| 646 | } | - |
| 647 | | - |
| 648 | /*! | - |
| 649 | \reimp | - |
| 650 | */ | - |
| 651 | QSize QWidgetItem::sizeHint() const | - |
| 652 | { | - |
| 653 | QSize s(0, 0); executed (the execution status of this line is deduced): QSize s(0, 0); | - |
| 654 | if (!isEmpty()) { evaluated: !isEmpty()| yes Evaluation Count:90 | yes Evaluation Count:2 |
| 2-90 |
| 655 | s = wid->sizeHint().expandedTo(wid->minimumSizeHint()); executed (the execution status of this line is deduced): s = wid->sizeHint().expandedTo(wid->minimumSizeHint()); | - |
| 656 | s = s.boundedTo(wid->maximumSize()) executed (the execution status of this line is deduced): s = s.boundedTo(wid->maximumSize()) | - |
| 657 | .expandedTo(wid->minimumSize()); executed (the execution status of this line is deduced): .expandedTo(wid->minimumSize()); | - |
| 658 | s = !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect) evaluated: !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect)| yes Evaluation Count:60 | yes Evaluation Count:30 |
| 30-60 |
| 659 | ? toLayoutItemSize(wid->d_func(), s) executed (the execution status of this line is deduced): ? toLayoutItemSize(wid->d_func(), s) | - |
| 660 | : s; executed (the execution status of this line is deduced): : s; | - |
| 661 | | - |
| 662 | if (wid->sizePolicy().horizontalPolicy() == QSizePolicy::Ignored) partially evaluated: wid->sizePolicy().horizontalPolicy() == QSizePolicy::Ignored| no Evaluation Count:0 | yes Evaluation Count:90 |
| 0-90 |
| 663 | s.setWidth(0); never executed: s.setWidth(0); | 0 |
| 664 | if (wid->sizePolicy().verticalPolicy() == QSizePolicy::Ignored) partially evaluated: wid->sizePolicy().verticalPolicy() == QSizePolicy::Ignored| no Evaluation Count:0 | yes Evaluation Count:90 |
| 0-90 |
| 665 | s.setHeight(0); never executed: s.setHeight(0); | 0 |
| 666 | } executed: }Execution Count:90 | 90 |
| 667 | return s; executed: return s;Execution Count:92 | 92 |
| 668 | } | - |
| 669 | | - |
| 670 | /*! | - |
| 671 | Returns true. | - |
| 672 | */ | - |
| 673 | bool QSpacerItem::isEmpty() const | - |
| 674 | { | - |
| 675 | return true; executed: return true;Execution Count:8744 | 8744 |
| 676 | } | - |
| 677 | | - |
| 678 | /*! | - |
| 679 | Returns true if the widget is hidden; otherwise returns false. | - |
| 680 | | - |
| 681 | \sa QWidget::isHidden() | - |
| 682 | */ | - |
| 683 | bool QWidgetItem::isEmpty() const | - |
| 684 | { | - |
| 685 | return wid->isHidden() || wid->isWindow(); executed: return wid->isHidden() || wid->isWindow();Execution Count:172371 | 172371 |
| 686 | } | - |
| 687 | | - |
| 688 | /*! | - |
| 689 | Returns the control type associated with the widget for which | - |
| 690 | this size policy applies. | - |
| 691 | | - |
| 692 | \sa QSizePolicy::controlType() | - |
| 693 | */ | - |
| 694 | QSizePolicy::ControlTypes QWidgetItem::controlTypes() const | - |
| 695 | { | - |
| 696 | return wid->sizePolicy().controlType(); executed: return wid->sizePolicy().controlType();Execution Count:1227 | 1227 |
| 697 | } | - |
| 698 | | - |
| 699 | /*! | - |
| 700 | \class QWidgetItemV2 | - |
| 701 | \internal | - |
| 702 | */ | - |
| 703 | | - |
| 704 | inline bool QWidgetItemV2::useSizeCache() const | - |
| 705 | { | - |
| 706 | return wid->d_func()->widgetItem == this; executed: return wid->d_func()->widgetItem == this;Execution Count:61258 | 61258 |
| 707 | } | - |
| 708 | | - |
| 709 | void QWidgetItemV2::updateCacheIfNecessary() const | - |
| 710 | { | - |
| 711 | if (q_cachedMinimumSize.width() != Dirty) evaluated: q_cachedMinimumSize.width() != Dirty| yes Evaluation Count:51183 | yes Evaluation Count:10075 |
| 10075-51183 |
| 712 | return; executed: return;Execution Count:51183 | 51183 |
| 713 | | - |
| 714 | const QSize sizeHint(wid->sizeHint()); executed (the execution status of this line is deduced): const QSize sizeHint(wid->sizeHint()); | - |
| 715 | const QSize minimumSizeHint(wid->minimumSizeHint()); executed (the execution status of this line is deduced): const QSize minimumSizeHint(wid->minimumSizeHint()); | - |
| 716 | const QSize minimumSize(wid->minimumSize()); executed (the execution status of this line is deduced): const QSize minimumSize(wid->minimumSize()); | - |
| 717 | const QSize maximumSize(wid->maximumSize()); executed (the execution status of this line is deduced): const QSize maximumSize(wid->maximumSize()); | - |
| 718 | const QSizePolicy sizePolicy(wid->sizePolicy()); executed (the execution status of this line is deduced): const QSizePolicy sizePolicy(wid->sizePolicy()); | - |
| 719 | const QSize expandedSizeHint(sizeHint.expandedTo(minimumSizeHint)); executed (the execution status of this line is deduced): const QSize expandedSizeHint(sizeHint.expandedTo(minimumSizeHint)); | - |
| 720 | | - |
| 721 | const QSize smartMinSize(qSmartMinSize(sizeHint, minimumSizeHint, minimumSize, maximumSize, sizePolicy)); executed (the execution status of this line is deduced): const QSize smartMinSize(qSmartMinSize(sizeHint, minimumSizeHint, minimumSize, maximumSize, sizePolicy)); | - |
| 722 | const QSize smartMaxSize(qSmartMaxSize(expandedSizeHint, minimumSize, maximumSize, sizePolicy, align)); executed (the execution status of this line is deduced): const QSize smartMaxSize(qSmartMaxSize(expandedSizeHint, minimumSize, maximumSize, sizePolicy, align)); | - |
| 723 | | - |
| 724 | const bool useLayoutItemRect = !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect); executed (the execution status of this line is deduced): const bool useLayoutItemRect = !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect); | - |
| 725 | | - |
| 726 | q_cachedMinimumSize = useLayoutItemRect evaluated: useLayoutItemRect| yes Evaluation Count:10066 | yes Evaluation Count:9 |
| 9-10066 |
| 727 | ? toLayoutItemSize(wid->d_func(), smartMinSize) executed (the execution status of this line is deduced): ? toLayoutItemSize(wid->d_func(), smartMinSize) | - |
| 728 | : smartMinSize; executed (the execution status of this line is deduced): : smartMinSize; | - |
| 729 | | - |
| 730 | q_cachedSizeHint = expandedSizeHint; executed (the execution status of this line is deduced): q_cachedSizeHint = expandedSizeHint; | - |
| 731 | q_cachedSizeHint = q_cachedSizeHint.boundedTo(maximumSize) executed (the execution status of this line is deduced): q_cachedSizeHint = q_cachedSizeHint.boundedTo(maximumSize) | - |
| 732 | .expandedTo(minimumSize); executed (the execution status of this line is deduced): .expandedTo(minimumSize); | - |
| 733 | q_cachedSizeHint = useLayoutItemRect evaluated: useLayoutItemRect| yes Evaluation Count:10066 | yes Evaluation Count:9 |
| 9-10066 |
| 734 | ? toLayoutItemSize(wid->d_func(), q_cachedSizeHint) executed (the execution status of this line is deduced): ? toLayoutItemSize(wid->d_func(), q_cachedSizeHint) | - |
| 735 | : q_cachedSizeHint; executed (the execution status of this line is deduced): : q_cachedSizeHint; | - |
| 736 | | - |
| 737 | if (wid->sizePolicy().horizontalPolicy() == QSizePolicy::Ignored) evaluated: wid->sizePolicy().horizontalPolicy() == QSizePolicy::Ignored| yes Evaluation Count:250 | yes Evaluation Count:9825 |
| 250-9825 |
| 738 | q_cachedSizeHint.setWidth(0); executed: q_cachedSizeHint.setWidth(0);Execution Count:250 | 250 |
| 739 | if (wid->sizePolicy().verticalPolicy() == QSizePolicy::Ignored) evaluated: wid->sizePolicy().verticalPolicy() == QSizePolicy::Ignored| yes Evaluation Count:16 | yes Evaluation Count:10059 |
| 16-10059 |
| 740 | q_cachedSizeHint.setHeight(0); executed: q_cachedSizeHint.setHeight(0);Execution Count:16 | 16 |
| 741 | | - |
| 742 | q_cachedMaximumSize = useLayoutItemRect evaluated: useLayoutItemRect| yes Evaluation Count:10066 | yes Evaluation Count:9 |
| 9-10066 |
| 743 | ? toLayoutItemSize(wid->d_func(), smartMaxSize) executed (the execution status of this line is deduced): ? toLayoutItemSize(wid->d_func(), smartMaxSize) | - |
| 744 | : smartMaxSize; executed (the execution status of this line is deduced): : smartMaxSize; | - |
| 745 | } executed: }Execution Count:10075 | 10075 |
| 746 | | - |
| 747 | QWidgetItemV2::QWidgetItemV2(QWidget *widget) | - |
| 748 | : QWidgetItem(widget), | - |
| 749 | q_cachedMinimumSize(Dirty, Dirty), | - |
| 750 | q_cachedSizeHint(Dirty, Dirty), | - |
| 751 | q_cachedMaximumSize(Dirty, Dirty), | - |
| 752 | q_firstCachedHfw(0), | - |
| 753 | q_hfwCacheSize(0), | - |
| 754 | d(0) | - |
| 755 | { | - |
| 756 | QWidgetPrivate *wd = wid->d_func(); executed (the execution status of this line is deduced): QWidgetPrivate *wd = wid->d_func(); | - |
| 757 | if (!wd->widgetItem) evaluated: !wd->widgetItem| yes Evaluation Count:18553 | yes Evaluation Count:1 |
| 1-18553 |
| 758 | wd->widgetItem = this; executed: wd->widgetItem = this;Execution Count:18553 | 18553 |
| 759 | } executed: }Execution Count:18554 | 18554 |
| 760 | | - |
| 761 | QWidgetItemV2::~QWidgetItemV2() | - |
| 762 | { | - |
| 763 | if (wid) { evaluated: wid| yes Evaluation Count:17174 | yes Evaluation Count:59 |
| 59-17174 |
| 764 | QWidgetPrivate *wd = wid->d_func(); executed (the execution status of this line is deduced): QWidgetPrivate *wd = wid->d_func(); | - |
| 765 | if (wd->widgetItem == this) partially evaluated: wd->widgetItem == this| yes Evaluation Count:17174 | no Evaluation Count:0 |
| 0-17174 |
| 766 | wd->widgetItem = 0; executed: wd->widgetItem = 0;Execution Count:17174 | 17174 |
| 767 | } executed: }Execution Count:17174 | 17174 |
| 768 | } executed: }Execution Count:17233 | 17233 |
| 769 | | - |
| 770 | QSize QWidgetItemV2::sizeHint() const | - |
| 771 | { | - |
| 772 | if (isEmpty()) evaluated: isEmpty()| yes Evaluation Count:1945 | yes Evaluation Count:16972 |
| 1945-16972 |
| 773 | return QSize(0, 0); executed: return QSize(0, 0);Execution Count:1945 | 1945 |
| 774 | | - |
| 775 | if (useSizeCache()) { partially evaluated: useSizeCache()| yes Evaluation Count:16972 | no Evaluation Count:0 |
| 0-16972 |
| 776 | updateCacheIfNecessary(); executed (the execution status of this line is deduced): updateCacheIfNecessary(); | - |
| 777 | return q_cachedSizeHint; executed: return q_cachedSizeHint;Execution Count:16972 | 16972 |
| 778 | } else { | - |
| 779 | return QWidgetItem::sizeHint(); never executed: return QWidgetItem::sizeHint(); | 0 |
| 780 | } | - |
| 781 | } | - |
| 782 | | - |
| 783 | QSize QWidgetItemV2::minimumSize() const | - |
| 784 | { | - |
| 785 | if (isEmpty()) evaluated: isEmpty()| yes Evaluation Count:1950 | yes Evaluation Count:17074 |
| 1950-17074 |
| 786 | return QSize(0, 0); executed: return QSize(0, 0);Execution Count:1950 | 1950 |
| 787 | | - |
| 788 | if (useSizeCache()) { partially evaluated: useSizeCache()| yes Evaluation Count:17074 | no Evaluation Count:0 |
| 0-17074 |
| 789 | updateCacheIfNecessary(); executed (the execution status of this line is deduced): updateCacheIfNecessary(); | - |
| 790 | return q_cachedMinimumSize; executed: return q_cachedMinimumSize;Execution Count:17074 | 17074 |
| 791 | } else { | - |
| 792 | return QWidgetItem::minimumSize(); never executed: return QWidgetItem::minimumSize(); | 0 |
| 793 | } | - |
| 794 | } | - |
| 795 | | - |
| 796 | QSize QWidgetItemV2::maximumSize() const | - |
| 797 | { | - |
| 798 | if (isEmpty()) evaluated: isEmpty()| yes Evaluation Count:1941 | yes Evaluation Count:27212 |
| 1941-27212 |
| 799 | return QSize(0, 0); executed: return QSize(0, 0);Execution Count:1941 | 1941 |
| 800 | | - |
| 801 | if (useSizeCache()) { partially evaluated: useSizeCache()| yes Evaluation Count:27212 | no Evaluation Count:0 |
| 0-27212 |
| 802 | updateCacheIfNecessary(); executed (the execution status of this line is deduced): updateCacheIfNecessary(); | - |
| 803 | return q_cachedMaximumSize; executed: return q_cachedMaximumSize;Execution Count:27212 | 27212 |
| 804 | } else { | - |
| 805 | return QWidgetItem::maximumSize(); never executed: return QWidgetItem::maximumSize(); | 0 |
| 806 | } | - |
| 807 | } | - |
| 808 | | - |
| 809 | /* | - |
| 810 | The height-for-width cache is organized as a circular buffer. The entries | - |
| 811 | | - |
| 812 | q_hfwCachedHfws[q_firstCachedHfw], | - |
| 813 | ..., | - |
| 814 | q_hfwCachedHfws[(q_firstCachedHfw + q_hfwCacheSize - 1) % HfwCacheMaxSize] | - |
| 815 | | - |
| 816 | contain the last cached values. When the cache is full, the first entry to | - |
| 817 | be erased is the entry before q_hfwCachedHfws[q_firstCachedHfw]. When | - |
| 818 | values are looked up, we try to move q_firstCachedHfw to point to that new | - |
| 819 | entry (unless the cache is not full, in which case it would leave the cache | - |
| 820 | in a broken state), so that the most recently used entry is also the last | - |
| 821 | to be erased. | - |
| 822 | */ | - |
| 823 | | - |
| 824 | int QWidgetItemV2::heightForWidth(int width) const | - |
| 825 | { | - |
| 826 | if (isEmpty()) evaluated: isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:580 |
| 1-580 |
| 827 | return -1; executed: return -1;Execution Count:1 | 1 |
| 828 | | - |
| 829 | for (int i = 0; i < q_hfwCacheSize; ++i) { evaluated: i < q_hfwCacheSize| yes Evaluation Count:570 | yes Evaluation Count:274 |
| 274-570 |
| 830 | int offset = q_firstCachedHfw + i; executed (the execution status of this line is deduced): int offset = q_firstCachedHfw + i; | - |
| 831 | const QSize &size = q_cachedHfws[offset % HfwCacheMaxSize]; executed (the execution status of this line is deduced): const QSize &size = q_cachedHfws[offset % HfwCacheMaxSize]; | - |
| 832 | if (size.width() == width) { evaluated: size.width() == width| yes Evaluation Count:306 | yes Evaluation Count:264 |
| 264-306 |
| 833 | if (q_hfwCacheSize == HfwCacheMaxSize) evaluated: q_hfwCacheSize == HfwCacheMaxSize| yes Evaluation Count:102 | yes Evaluation Count:204 |
| 102-204 |
| 834 | q_firstCachedHfw = offset; executed: q_firstCachedHfw = offset;Execution Count:102 | 102 |
| 835 | return size.height(); executed: return size.height();Execution Count:306 | 306 |
| 836 | } | - |
| 837 | } executed: }Execution Count:264 | 264 |
| 838 | | - |
| 839 | if (q_hfwCacheSize < HfwCacheMaxSize) evaluated: q_hfwCacheSize < HfwCacheMaxSize| yes Evaluation Count:268 | yes Evaluation Count:6 |
| 6-268 |
| 840 | ++q_hfwCacheSize; executed: ++q_hfwCacheSize;Execution Count:268 | 268 |
| 841 | q_firstCachedHfw = (q_firstCachedHfw + HfwCacheMaxSize - 1) % HfwCacheMaxSize; executed (the execution status of this line is deduced): q_firstCachedHfw = (q_firstCachedHfw + HfwCacheMaxSize - 1) % HfwCacheMaxSize; | - |
| 842 | | - |
| 843 | int height = QWidgetItem::heightForWidth(width); executed (the execution status of this line is deduced): int height = QWidgetItem::heightForWidth(width); | - |
| 844 | q_cachedHfws[q_firstCachedHfw] = QSize(width, height); executed (the execution status of this line is deduced): q_cachedHfws[q_firstCachedHfw] = QSize(width, height); | - |
| 845 | return height; executed: return height;Execution Count:274 | 274 |
| 846 | } | - |
| 847 | | - |
| 848 | #ifndef QT_NO_DEBUG_STREAM | - |
| 849 | QDebug operator<<(QDebug dbg, const QSizePolicy &p) | - |
| 850 | { | - |
| 851 | dbg.nospace() << "QSizePolicy(horizontalPolicy = " << p.horizontalPolicy() executed (the execution status of this line is deduced): dbg.nospace() << "QSizePolicy(horizontalPolicy = " << p.horizontalPolicy() | - |
| 852 | << ", verticalPolicy = " << p.verticalPolicy() << ')'; executed (the execution status of this line is deduced): << ", verticalPolicy = " << p.verticalPolicy() << ')'; | - |
| 853 | return dbg.space(); executed: return dbg.space();Execution Count:1 | 1 |
| 854 | } | - |
| 855 | #endif | - |
| 856 | | - |
| 857 | QT_END_NAMESPACE | - |
| 858 | | - |
| | |