| 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 <qaction.h> | - |
| 43 | #include <qwidgetaction.h> | - |
| 44 | #include <qtoolbar.h> | - |
| 45 | #include <qstyleoption.h> | - |
| 46 | #include <qtoolbutton.h> | - |
| 47 | #include <qmenu.h> | - |
| 48 | #include <qdebug.h> | - |
| 49 | #include <qmath.h> | - |
| 50 | | - |
| 51 | #include "qmainwindowlayout_p.h" | - |
| 52 | #include "qtoolbarextension_p.h" | - |
| 53 | #include "qtoolbarlayout_p.h" | - |
| 54 | #include "qtoolbarseparator_p.h" | - |
| 55 | | - |
| 56 | #ifndef QT_NO_TOOLBAR | - |
| 57 | | - |
| 58 | QT_BEGIN_NAMESPACE | - |
| 59 | | - |
| 60 | // qmainwindow.cpp | - |
| 61 | extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window); | - |
| 62 | | - |
| 63 | /****************************************************************************** | - |
| 64 | ** QToolBarItem | - |
| 65 | */ | - |
| 66 | | - |
| 67 | QToolBarItem::QToolBarItem(QWidget *widget) | - |
| 68 | : QWidgetItem(widget), action(0), customWidget(false) | - |
| 69 | { | - |
| 70 | } executed: }Execution Count:16 | 16 |
| 71 | | - |
| 72 | bool QToolBarItem::isEmpty() const | - |
| 73 | { | - |
| 74 | return action == 0 || !action->isVisible(); executed: return action == 0 || !action->isVisible();Execution Count:222 | 222 |
| 75 | } | - |
| 76 | | - |
| 77 | /****************************************************************************** | - |
| 78 | ** QToolBarLayout | - |
| 79 | */ | - |
| 80 | | - |
| 81 | QToolBarLayout::QToolBarLayout(QWidget *parent) | - |
| 82 | : QLayout(parent), expanded(false), animating(false), dirty(true), | - |
| 83 | expanding(false), empty(true), expandFlag(false), popupMenu(0) | - |
| 84 | { | - |
| 85 | QToolBar *tb = qobject_cast<QToolBar*>(parent); executed (the execution status of this line is deduced): QToolBar *tb = qobject_cast<QToolBar*>(parent); | - |
| 86 | if (!tb) partially evaluated: !tb| no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
| 87 | return; | 0 |
| 88 | | - |
| 89 | extension = new QToolBarExtension(tb); executed (the execution status of this line is deduced): extension = new QToolBarExtension(tb); | - |
| 90 | extension->setFocusPolicy(Qt::NoFocus); executed (the execution status of this line is deduced): extension->setFocusPolicy(Qt::NoFocus); | - |
| 91 | extension->hide(); executed (the execution status of this line is deduced): extension->hide(); | - |
| 92 | QObject::connect(tb, SIGNAL(orientationChanged(Qt::Orientation)), executed (the execution status of this line is deduced): QObject::connect(tb, "2""orientationChanged(Qt::Orientation)", | - |
| 93 | extension, SLOT(setOrientation(Qt::Orientation))); executed (the execution status of this line is deduced): extension, "1""setOrientation(Qt::Orientation)"); | - |
| 94 | | - |
| 95 | setUsePopupMenu(qobject_cast<QMainWindow*>(tb->parentWidget()) == 0); executed (the execution status of this line is deduced): setUsePopupMenu(qobject_cast<QMainWindow*>(tb->parentWidget()) == 0); | - |
| 96 | } executed: }Execution Count:16 | 16 |
| 97 | | - |
| 98 | QToolBarLayout::~QToolBarLayout() | - |
| 99 | { | - |
| 100 | while (!items.isEmpty()) { evaluated: !items.isEmpty()| yes Evaluation Count:6 | yes Evaluation Count:16 |
| 6-16 |
| 101 | QToolBarItem *item = items.takeFirst(); executed (the execution status of this line is deduced): QToolBarItem *item = items.takeFirst(); | - |
| 102 | if (QWidgetAction *widgetAction = qobject_cast<QWidgetAction*>(item->action)) { partially evaluated: QWidgetAction *widgetAction = qobject_cast<QWidgetAction*>(item->action)| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 103 | if (item->customWidget) partially evaluated: item->customWidget| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 104 | widgetAction->releaseWidget(item->widget()); executed: widgetAction->releaseWidget(item->widget());Execution Count:6 | 6 |
| 105 | } executed: }Execution Count:6 | 6 |
| 106 | delete item; executed (the execution status of this line is deduced): delete item; | - |
| 107 | } executed: }Execution Count:6 | 6 |
| 108 | } executed: }Execution Count:16 | 16 |
| 109 | | - |
| 110 | void QToolBarLayout::updateMarginAndSpacing() | - |
| 111 | { | - |
| 112 | QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); executed (the execution status of this line is deduced): QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); | - |
| 113 | if (!tb) partially evaluated: !tb| no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
| 114 | return; | 0 |
| 115 | QStyle *style = tb->style(); executed (the execution status of this line is deduced): QStyle *style = tb->style(); | - |
| 116 | QStyleOptionToolBar opt; executed (the execution status of this line is deduced): QStyleOptionToolBar opt; | - |
| 117 | tb->initStyleOption(&opt); executed (the execution status of this line is deduced): tb->initStyleOption(&opt); | - |
| 118 | setMargin(style->pixelMetric(QStyle::PM_ToolBarItemMargin, &opt, tb) executed (the execution status of this line is deduced): setMargin(style->pixelMetric(QStyle::PM_ToolBarItemMargin, &opt, tb) | - |
| 119 | + style->pixelMetric(QStyle::PM_ToolBarFrameWidth, &opt, tb)); executed (the execution status of this line is deduced): + style->pixelMetric(QStyle::PM_ToolBarFrameWidth, &opt, tb)); | - |
| 120 | setSpacing(style->pixelMetric(QStyle::PM_ToolBarItemSpacing, &opt, tb)); executed (the execution status of this line is deduced): setSpacing(style->pixelMetric(QStyle::PM_ToolBarItemSpacing, &opt, tb)); | - |
| 121 | } executed: }Execution Count:16 | 16 |
| 122 | | - |
| 123 | bool QToolBarLayout::hasExpandFlag() const | - |
| 124 | { | - |
| 125 | return expandFlag; never executed: return expandFlag; | 0 |
| 126 | } | - |
| 127 | | - |
| 128 | void QToolBarLayout::setUsePopupMenu(bool set) | - |
| 129 | { | - |
| 130 | if (!dirty && ((popupMenu == 0) == set)) evaluated: !dirty| yes Evaluation Count:11 | yes Evaluation Count:25 |
evaluated: ((popupMenu == 0) == set)| yes Evaluation Count:1 | yes Evaluation Count:10 |
| 1-25 |
| 131 | invalidate(); executed: invalidate();Execution Count:1 | 1 |
| 132 | if (!set) { evaluated: !set| yes Evaluation Count:12 | yes Evaluation Count:24 |
| 12-24 |
| 133 | QObject::connect(extension, SIGNAL(clicked(bool)), executed (the execution status of this line is deduced): QObject::connect(extension, "2""clicked(bool)", | - |
| 134 | this, SLOT(setExpanded(bool)), Qt::UniqueConnection); executed (the execution status of this line is deduced): this, "1""setExpanded(bool)", Qt::UniqueConnection); | - |
| 135 | extension->setPopupMode(QToolButton::DelayedPopup); executed (the execution status of this line is deduced): extension->setPopupMode(QToolButton::DelayedPopup); | - |
| 136 | extension->setMenu(0); executed (the execution status of this line is deduced): extension->setMenu(0); | - |
| 137 | delete popupMenu; executed (the execution status of this line is deduced): delete popupMenu; | - |
| 138 | popupMenu = 0; executed (the execution status of this line is deduced): popupMenu = 0; | - |
| 139 | } else { executed: }Execution Count:12 | 12 |
| 140 | QObject::disconnect(extension, SIGNAL(clicked(bool)), executed (the execution status of this line is deduced): QObject::disconnect(extension, "2""clicked(bool)", | - |
| 141 | this, SLOT(setExpanded(bool))); executed (the execution status of this line is deduced): this, "1""setExpanded(bool)"); | - |
| 142 | extension->setPopupMode(QToolButton::InstantPopup); executed (the execution status of this line is deduced): extension->setPopupMode(QToolButton::InstantPopup); | - |
| 143 | if (!popupMenu) { evaluated: !popupMenu| yes Evaluation Count:15 | yes Evaluation Count:9 |
| 9-15 |
| 144 | popupMenu = new QMenu(extension); executed (the execution status of this line is deduced): popupMenu = new QMenu(extension); | - |
| 145 | } executed: }Execution Count:15 | 15 |
| 146 | extension->setMenu(popupMenu); executed (the execution status of this line is deduced): extension->setMenu(popupMenu); | - |
| 147 | } executed: }Execution Count:24 | 24 |
| 148 | } | - |
| 149 | | - |
| 150 | void QToolBarLayout::checkUsePopupMenu() | - |
| 151 | { | - |
| 152 | QToolBar *tb = static_cast<QToolBar *>(parent()); executed (the execution status of this line is deduced): QToolBar *tb = static_cast<QToolBar *>(parent()); | - |
| 153 | QMainWindow *mw = qobject_cast<QMainWindow *>(tb->parent()); executed (the execution status of this line is deduced): QMainWindow *mw = qobject_cast<QMainWindow *>(tb->parent()); | - |
| 154 | Qt::Orientation o = tb->orientation(); executed (the execution status of this line is deduced): Qt::Orientation o = tb->orientation(); | - |
| 155 | setUsePopupMenu(!mw || tb->isFloating() || perp(o, expandedSize(mw->size())) >= perp(o, mw->size())); executed (the execution status of this line is deduced): setUsePopupMenu(!mw || tb->isFloating() || perp(o, expandedSize(mw->size())) >= perp(o, mw->size())); | - |
| 156 | } executed: }Execution Count:20 | 20 |
| 157 | | - |
| 158 | void QToolBarLayout::addItem(QLayoutItem*) | - |
| 159 | { | - |
| 160 | qWarning() << "QToolBarLayout::addItem(): please use addAction() instead"; never executed (the execution status of this line is deduced): QMessageLogger("widgets/qtoolbarlayout.cpp", 160, __PRETTY_FUNCTION__).warning() << "QToolBarLayout::addItem(): please use addAction() instead"; | - |
| 161 | return; | 0 |
| 162 | } | - |
| 163 | | - |
| 164 | QLayoutItem *QToolBarLayout::itemAt(int index) const | - |
| 165 | { | - |
| 166 | if (index < 0 || index >= items.count()) partially evaluated: index < 0| no Evaluation Count:0 | yes Evaluation Count:71 |
evaluated: index >= items.count()| yes Evaluation Count:43 | yes Evaluation Count:28 |
| 0-71 |
| 167 | return 0; executed: return 0;Execution Count:43 | 43 |
| 168 | return items.at(index); executed: return items.at(index);Execution Count:28 | 28 |
| 169 | } | - |
| 170 | | - |
| 171 | QLayoutItem *QToolBarLayout::takeAt(int index) | - |
| 172 | { | - |
| 173 | if (index < 0 || index >= items.count()) partially evaluated: index < 0| no Evaluation Count:0 | yes Evaluation Count:10 |
partially evaluated: index >= items.count()| no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
| 174 | return 0; never executed: return 0; | 0 |
| 175 | QToolBarItem *item = items.takeAt(index); executed (the execution status of this line is deduced): QToolBarItem *item = items.takeAt(index); | - |
| 176 | | - |
| 177 | if (popupMenu) evaluated: popupMenu| yes Evaluation Count:9 | yes Evaluation Count:1 |
| 1-9 |
| 178 | popupMenu->removeAction(item->action); executed: popupMenu->removeAction(item->action);Execution Count:9 | 9 |
| 179 | | - |
| 180 | QWidgetAction *widgetAction = qobject_cast<QWidgetAction*>(item->action); executed (the execution status of this line is deduced): QWidgetAction *widgetAction = qobject_cast<QWidgetAction*>(item->action); | - |
| 181 | if (widgetAction != 0 && item->customWidget) { evaluated: widgetAction != 0| yes Evaluation Count:8 | yes Evaluation Count:2 |
evaluated: item->customWidget| yes Evaluation Count:7 | yes Evaluation Count:1 |
| 1-8 |
| 182 | widgetAction->releaseWidget(item->widget()); executed (the execution status of this line is deduced): widgetAction->releaseWidget(item->widget()); | - |
| 183 | } else { executed: }Execution Count:7 | 7 |
| 184 | // destroy the QToolButton/QToolBarSeparator | - |
| 185 | item->widget()->hide(); executed (the execution status of this line is deduced): item->widget()->hide(); | - |
| 186 | item->widget()->deleteLater(); executed (the execution status of this line is deduced): item->widget()->deleteLater(); | - |
| 187 | } executed: }Execution Count:3 | 3 |
| 188 | | - |
| 189 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
| 190 | return item; executed: return item;Execution Count:10 | 10 |
| 191 | } | - |
| 192 | | - |
| 193 | void QToolBarLayout::insertAction(int index, QAction *action) | - |
| 194 | { | - |
| 195 | index = qMax(0, index); executed (the execution status of this line is deduced): index = qMax(0, index); | - |
| 196 | index = qMin(items.count(), index); executed (the execution status of this line is deduced): index = qMin(items.count(), index); | - |
| 197 | | - |
| 198 | QToolBarItem *item = createItem(action); executed (the execution status of this line is deduced): QToolBarItem *item = createItem(action); | - |
| 199 | if (item) { partially evaluated: item| yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
| 200 | items.insert(index, item); executed (the execution status of this line is deduced): items.insert(index, item); | - |
| 201 | invalidate(); executed (the execution status of this line is deduced): invalidate(); | - |
| 202 | } executed: }Execution Count:16 | 16 |
| 203 | } executed: }Execution Count:16 | 16 |
| 204 | | - |
| 205 | int QToolBarLayout::indexOf(QAction *action) const | - |
| 206 | { | - |
| 207 | for (int i = 0; i < items.count(); ++i) { evaluated: i < items.count()| yes Evaluation Count:7 | yes Evaluation Count:3 |
| 3-7 |
| 208 | if (items.at(i)->action == action) partially evaluated: items.at(i)->action == action| yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
| 209 | return i; executed: return i;Execution Count:7 | 7 |
| 210 | } | 0 |
| 211 | return -1; executed: return -1;Execution Count:3 | 3 |
| 212 | } | - |
| 213 | | - |
| 214 | int QToolBarLayout::count() const | - |
| 215 | { | - |
| 216 | return items.count(); executed: return items.count();Execution Count:16 | 16 |
| 217 | } | - |
| 218 | | - |
| 219 | bool QToolBarLayout::isEmpty() const | - |
| 220 | { | - |
| 221 | if (dirty) | 0 |
| 222 | updateGeomArray(); never executed: updateGeomArray(); | 0 |
| 223 | return empty; never executed: return empty; | 0 |
| 224 | } | - |
| 225 | | - |
| 226 | void QToolBarLayout::invalidate() | - |
| 227 | { | - |
| 228 | dirty = true; executed (the execution status of this line is deduced): dirty = true; | - |
| 229 | QLayout::invalidate(); executed (the execution status of this line is deduced): QLayout::invalidate(); | - |
| 230 | } executed: }Execution Count:218 | 218 |
| 231 | | - |
| 232 | Qt::Orientations QToolBarLayout::expandingDirections() const | - |
| 233 | { | - |
| 234 | if (dirty) partially evaluated: dirty| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 235 | updateGeomArray(); never executed: updateGeomArray(); | 0 |
| 236 | QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); executed (the execution status of this line is deduced): QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); | - |
| 237 | if (!tb) partially evaluated: !tb| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 238 | return Qt::Orientations(0); never executed: return Qt::Orientations(0); | 0 |
| 239 | Qt::Orientation o = tb->orientation(); executed (the execution status of this line is deduced): Qt::Orientation o = tb->orientation(); | - |
| 240 | return expanding ? Qt::Orientations(o) : Qt::Orientations(0); executed: return expanding ? Qt::Orientations(o) : Qt::Orientations(0);Execution Count:9 | 9 |
| 241 | } | - |
| 242 | | - |
| 243 | bool QToolBarLayout::movable() const | - |
| 244 | { | - |
| 245 | QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); executed (the execution status of this line is deduced): QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); | - |
| 246 | if (!tb) partially evaluated: !tb| no Evaluation Count:0 | yes Evaluation Count:250 |
| 0-250 |
| 247 | return false; never executed: return false; | 0 |
| 248 | QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget()); executed (the execution status of this line is deduced): QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget()); | - |
| 249 | return tb->isMovable() && win != 0; executed: return tb->isMovable() && win != 0;Execution Count:250 | 250 |
| 250 | } | - |
| 251 | | - |
| 252 | void QToolBarLayout::updateGeomArray() const | - |
| 253 | { | - |
| 254 | if (!dirty) partially evaluated: !dirty| no Evaluation Count:0 | yes Evaluation Count:38 |
| 0-38 |
| 255 | return; | 0 |
| 256 | | - |
| 257 | QToolBarLayout *that = const_cast<QToolBarLayout*>(this); executed (the execution status of this line is deduced): QToolBarLayout *that = const_cast<QToolBarLayout*>(this); | - |
| 258 | | - |
| 259 | QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); executed (the execution status of this line is deduced): QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); | - |
| 260 | if (!tb) partially evaluated: !tb| no Evaluation Count:0 | yes Evaluation Count:38 |
| 0-38 |
| 261 | return; | 0 |
| 262 | QStyle *style = tb->style(); executed (the execution status of this line is deduced): QStyle *style = tb->style(); | - |
| 263 | QStyleOptionToolBar opt; executed (the execution status of this line is deduced): QStyleOptionToolBar opt; | - |
| 264 | tb->initStyleOption(&opt); executed (the execution status of this line is deduced): tb->initStyleOption(&opt); | - |
| 265 | const int handleExtent = movable() evaluated: movable()| yes Evaluation Count:7 | yes Evaluation Count:31 |
| 7-31 |
| 266 | ? style->pixelMetric(QStyle::PM_ToolBarHandleExtent, &opt, tb) : 0; executed (the execution status of this line is deduced): ? style->pixelMetric(QStyle::PM_ToolBarHandleExtent, &opt, tb) : 0; | - |
| 267 | const int margin = this->margin(); executed (the execution status of this line is deduced): const int margin = this->margin(); | - |
| 268 | const int spacing = this->spacing(); executed (the execution status of this line is deduced): const int spacing = this->spacing(); | - |
| 269 | const int extensionExtent = style->pixelMetric(QStyle::PM_ToolBarExtensionExtent, &opt, tb); executed (the execution status of this line is deduced): const int extensionExtent = style->pixelMetric(QStyle::PM_ToolBarExtensionExtent, &opt, tb); | - |
| 270 | Qt::Orientation o = tb->orientation(); executed (the execution status of this line is deduced): Qt::Orientation o = tb->orientation(); | - |
| 271 | | - |
| 272 | that->minSize = QSize(0, 0); executed (the execution status of this line is deduced): that->minSize = QSize(0, 0); | - |
| 273 | that->hint = QSize(0, 0); executed (the execution status of this line is deduced): that->hint = QSize(0, 0); | - |
| 274 | rperp(o, that->minSize) = style->pixelMetric(QStyle::PM_ToolBarHandleExtent, &opt, tb); executed (the execution status of this line is deduced): rperp(o, that->minSize) = style->pixelMetric(QStyle::PM_ToolBarHandleExtent, &opt, tb); | - |
| 275 | rperp(o, that->hint) = style->pixelMetric(QStyle::PM_ToolBarHandleExtent, &opt, tb); executed (the execution status of this line is deduced): rperp(o, that->hint) = style->pixelMetric(QStyle::PM_ToolBarHandleExtent, &opt, tb); | - |
| 276 | | - |
| 277 | that->expanding = false; executed (the execution status of this line is deduced): that->expanding = false; | - |
| 278 | that->empty = false; executed (the execution status of this line is deduced): that->empty = false; | - |
| 279 | | - |
| 280 | QVector<QLayoutStruct> a(items.count() + 1); // + 1 for the stretch executed (the execution status of this line is deduced): QVector<QLayoutStruct> a(items.count() + 1); | - |
| 281 | | - |
| 282 | int count = 0; executed (the execution status of this line is deduced): int count = 0; | - |
| 283 | for (int i = 0; i < items.count(); ++i) { evaluated: i < items.count()| yes Evaluation Count:31 | yes Evaluation Count:38 |
| 31-38 |
| 284 | QToolBarItem *item = items.at(i); executed (the execution status of this line is deduced): QToolBarItem *item = items.at(i); | - |
| 285 | | - |
| 286 | QSize max = item->maximumSize(); executed (the execution status of this line is deduced): QSize max = item->maximumSize(); | - |
| 287 | QSize min = item->minimumSize(); executed (the execution status of this line is deduced): QSize min = item->minimumSize(); | - |
| 288 | QSize hint = item->sizeHint(); executed (the execution status of this line is deduced): QSize hint = item->sizeHint(); | - |
| 289 | Qt::Orientations exp = item->expandingDirections(); executed (the execution status of this line is deduced): Qt::Orientations exp = item->expandingDirections(); | - |
| 290 | bool empty = item->isEmpty(); executed (the execution status of this line is deduced): bool empty = item->isEmpty(); | - |
| 291 | | - |
| 292 | that->expanding = expanding || exp & o; partially evaluated: expanding| no Evaluation Count:0 | yes Evaluation Count:31 |
evaluated: exp & o| yes Evaluation Count:3 | yes Evaluation Count:28 |
| 0-31 |
| 293 | | - |
| 294 | | - |
| 295 | if (item->widget()) { partially evaluated: item->widget()| yes Evaluation Count:31 | no Evaluation Count:0 |
| 0-31 |
| 296 | if ((item->widget()->sizePolicy().horizontalPolicy() & QSizePolicy::ExpandFlag)) { evaluated: (item->widget()->sizePolicy().horizontalPolicy() & QSizePolicy::ExpandFlag)| yes Evaluation Count:3 | yes Evaluation Count:28 |
| 3-28 |
| 297 | that->expandFlag = true; executed (the execution status of this line is deduced): that->expandFlag = true; | - |
| 298 | } executed: }Execution Count:3 | 3 |
| 299 | } executed: }Execution Count:31 | 31 |
| 300 | | - |
| 301 | if (!empty) { evaluated: !empty| yes Evaluation Count:29 | yes Evaluation Count:2 |
| 2-29 |
| 302 | if (count == 0) // the minimum size only displays one widget partially evaluated: count == 0| yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-29 |
| 303 | rpick(o, that->minSize) += pick(o, min); executed: rpick(o, that->minSize) += pick(o, min);Execution Count:29 | 29 |
| 304 | int s = perp(o, minSize); executed (the execution status of this line is deduced): int s = perp(o, minSize); | - |
| 305 | rperp(o, that->minSize) = qMax(s, perp(o, min)); executed (the execution status of this line is deduced): rperp(o, that->minSize) = qMax(s, perp(o, min)); | - |
| 306 | | - |
| 307 | //we only add spacing before item (ie never before the first one) | - |
| 308 | rpick(o, that->hint) += (count == 0 ? 0 : spacing) + pick(o, hint); partially evaluated: count == 0| yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-29 |
| 309 | s = perp(o, that->hint); executed (the execution status of this line is deduced): s = perp(o, that->hint); | - |
| 310 | rperp(o, that->hint) = qMax(s, perp(o, hint)); executed (the execution status of this line is deduced): rperp(o, that->hint) = qMax(s, perp(o, hint)); | - |
| 311 | ++count; executed (the execution status of this line is deduced): ++count; | - |
| 312 | } executed: }Execution Count:29 | 29 |
| 313 | | - |
| 314 | a[i].sizeHint = pick(o, hint); executed (the execution status of this line is deduced): a[i].sizeHint = pick(o, hint); | - |
| 315 | a[i].maximumSize = pick(o, max); executed (the execution status of this line is deduced): a[i].maximumSize = pick(o, max); | - |
| 316 | a[i].minimumSize = pick(o, min); executed (the execution status of this line is deduced): a[i].minimumSize = pick(o, min); | - |
| 317 | a[i].expansive = exp & o; executed (the execution status of this line is deduced): a[i].expansive = exp & o; | - |
| 318 | if (o == Qt::Horizontal) partially evaluated: o == Qt::Horizontal| yes Evaluation Count:31 | no Evaluation Count:0 |
| 0-31 |
| 319 | a[i].stretch = item->widget()->sizePolicy().horizontalStretch(); executed: a[i].stretch = item->widget()->sizePolicy().horizontalStretch();Execution Count:31 | 31 |
| 320 | else | - |
| 321 | a[i].stretch = item->widget()->sizePolicy().verticalStretch(); never executed: a[i].stretch = item->widget()->sizePolicy().verticalStretch(); | 0 |
| 322 | a[i].empty = empty; executed (the execution status of this line is deduced): a[i].empty = empty; | - |
| 323 | } executed: }Execution Count:31 | 31 |
| 324 | | - |
| 325 | that->geomArray = a; executed (the execution status of this line is deduced): that->geomArray = a; | - |
| 326 | that->empty = count == 0; executed (the execution status of this line is deduced): that->empty = count == 0; | - |
| 327 | | - |
| 328 | rpick(o, that->minSize) += handleExtent; executed (the execution status of this line is deduced): rpick(o, that->minSize) += handleExtent; | - |
| 329 | that->minSize += QSize(2*margin, 2*margin); executed (the execution status of this line is deduced): that->minSize += QSize(2*margin, 2*margin); | - |
| 330 | if (items.count() > 1) partially evaluated: items.count() > 1| no Evaluation Count:0 | yes Evaluation Count:38 |
| 0-38 |
| 331 | rpick(o, that->minSize) += spacing + extensionExtent; never executed: rpick(o, that->minSize) += spacing + extensionExtent; | 0 |
| 332 | | - |
| 333 | rpick(o, that->hint) += handleExtent; executed (the execution status of this line is deduced): rpick(o, that->hint) += handleExtent; | - |
| 334 | that->hint += QSize(2*margin, 2*margin); executed (the execution status of this line is deduced): that->hint += QSize(2*margin, 2*margin); | - |
| 335 | that->dirty = false; executed (the execution status of this line is deduced): that->dirty = false; | - |
| 336 | #ifdef Q_WS_MAC | - |
| 337 | if (QMainWindow *mw = qobject_cast<QMainWindow *>(parentWidget()->parentWidget())) { | - |
| 338 | if (mw->unifiedTitleAndToolBarOnMac() | - |
| 339 | && mw->toolBarArea(static_cast<QToolBar *>(parentWidget())) == Qt::TopToolBarArea) { | - |
| 340 | if (expandFlag) { | - |
| 341 | tb->setMaximumSize(0xFFFFFF, 0xFFFFFF); | - |
| 342 | } else { | - |
| 343 | tb->setMaximumSize(hint); | - |
| 344 | } | - |
| 345 | } | - |
| 346 | } | - |
| 347 | #endif | - |
| 348 | | - |
| 349 | that->dirty = false; executed (the execution status of this line is deduced): that->dirty = false; | - |
| 350 | } executed: }Execution Count:38 | 38 |
| 351 | | - |
| 352 | static bool defaultWidgetAction(QToolBarItem *item) | - |
| 353 | { | - |
| 354 | QWidgetAction *a = qobject_cast<QWidgetAction*>(item->action); never executed (the execution status of this line is deduced): QWidgetAction *a = qobject_cast<QWidgetAction*>(item->action); | - |
| 355 | return a != 0 && a->defaultWidget() == item->widget(); never executed: return a != 0 && a->defaultWidget() == item->widget(); | 0 |
| 356 | } | - |
| 357 | | - |
| 358 | void QToolBarLayout::setGeometry(const QRect &rect) | - |
| 359 | { | - |
| 360 | QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); executed (the execution status of this line is deduced): QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); | - |
| 361 | if (!tb) partially evaluated: !tb| no Evaluation Count:0 | yes Evaluation Count:43 |
| 0-43 |
| 362 | return; | 0 |
| 363 | QStyle *style = tb->style(); executed (the execution status of this line is deduced): QStyle *style = tb->style(); | - |
| 364 | QStyleOptionToolBar opt; executed (the execution status of this line is deduced): QStyleOptionToolBar opt; | - |
| 365 | tb->initStyleOption(&opt); executed (the execution status of this line is deduced): tb->initStyleOption(&opt); | - |
| 366 | const int margin = this->margin(); executed (the execution status of this line is deduced): const int margin = this->margin(); | - |
| 367 | const int extensionExtent = style->pixelMetric(QStyle::PM_ToolBarExtensionExtent, &opt, tb); executed (the execution status of this line is deduced): const int extensionExtent = style->pixelMetric(QStyle::PM_ToolBarExtensionExtent, &opt, tb); | - |
| 368 | Qt::Orientation o = tb->orientation(); executed (the execution status of this line is deduced): Qt::Orientation o = tb->orientation(); | - |
| 369 | | - |
| 370 | QLayout::setGeometry(rect); executed (the execution status of this line is deduced): QLayout::setGeometry(rect); | - |
| 371 | | - |
| 372 | bool ranOutOfSpace = false; executed (the execution status of this line is deduced): bool ranOutOfSpace = false; | - |
| 373 | if (!animating) partially evaluated: !animating| yes Evaluation Count:43 | no Evaluation Count:0 |
| 0-43 |
| 374 | ranOutOfSpace = layoutActions(rect.size()); executed: ranOutOfSpace = layoutActions(rect.size());Execution Count:43 | 43 |
| 375 | | - |
| 376 | if (expanded || animating || ranOutOfSpace) { partially evaluated: expanded| no Evaluation Count:0 | yes Evaluation Count:43 |
partially evaluated: animating| no Evaluation Count:0 | yes Evaluation Count:43 |
partially evaluated: ranOutOfSpace| no Evaluation Count:0 | yes Evaluation Count:43 |
| 0-43 |
| 377 | Qt::ToolBarArea area = Qt::TopToolBarArea; never executed (the execution status of this line is deduced): Qt::ToolBarArea area = Qt::TopToolBarArea; | - |
| 378 | if (QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget())) never evaluated: QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget()) | 0 |
| 379 | area = win->toolBarArea(tb); never executed: area = win->toolBarArea(tb); | 0 |
| 380 | QSize hint = sizeHint(); never executed (the execution status of this line is deduced): QSize hint = sizeHint(); | - |
| 381 | | - |
| 382 | QPoint pos; never executed (the execution status of this line is deduced): QPoint pos; | - |
| 383 | rpick(o, pos) = pick(o, rect.bottomRight()) - margin - extensionExtent + 2; never executed (the execution status of this line is deduced): rpick(o, pos) = pick(o, rect.bottomRight()) - margin - extensionExtent + 2; | - |
| 384 | if (area == Qt::LeftToolBarArea || area == Qt::TopToolBarArea) never evaluated: area == Qt::LeftToolBarArea never evaluated: area == Qt::TopToolBarArea | 0 |
| 385 | rperp(o, pos) = perp(o, rect.topLeft()) + margin; never executed: rperp(o, pos) = perp(o, rect.topLeft()) + margin; | 0 |
| 386 | else | - |
| 387 | rperp(o, pos) = perp(o, rect.bottomRight()) - margin - (perp(o, hint) - 2*margin) + 1; never executed: rperp(o, pos) = perp(o, rect.bottomRight()) - margin - (perp(o, hint) - 2*margin) + 1; | 0 |
| 388 | QSize size; never executed (the execution status of this line is deduced): QSize size; | - |
| 389 | rpick(o, size) = extensionExtent; never executed (the execution status of this line is deduced): rpick(o, size) = extensionExtent; | - |
| 390 | rperp(o, size) = perp(o, hint) - 2*margin; never executed (the execution status of this line is deduced): rperp(o, size) = perp(o, hint) - 2*margin; | - |
| 391 | QRect r(pos, size); never executed (the execution status of this line is deduced): QRect r(pos, size); | - |
| 392 | | - |
| 393 | if (o == Qt::Horizontal) never evaluated: o == Qt::Horizontal | 0 |
| 394 | r = QStyle::visualRect(parentWidget()->layoutDirection(), rect, r); never executed: r = QStyle::visualRect(parentWidget()->layoutDirection(), rect, r); | 0 |
| 395 | | - |
| 396 | extension->setGeometry(r); never executed (the execution status of this line is deduced): extension->setGeometry(r); | - |
| 397 | | - |
| 398 | if (extension->isHidden()) never evaluated: extension->isHidden() | 0 |
| 399 | extension->show(); never executed: extension->show(); | 0 |
| 400 | } else { | 0 |
| 401 | if (!extension->isHidden()) partially evaluated: !extension->isHidden()| no Evaluation Count:0 | yes Evaluation Count:43 |
| 0-43 |
| 402 | extension->hide(); never executed: extension->hide(); | 0 |
| 403 | } executed: }Execution Count:43 | 43 |
| 404 | #ifdef Q_WS_MAC | - |
| 405 | if (QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget())) { | - |
| 406 | Qt::ToolBarArea area = win->toolBarArea(tb); | - |
| 407 | if (win->unifiedTitleAndToolBarOnMac() && area == Qt::TopToolBarArea) { | - |
| 408 | qt_mainwindow_layout(win)->fixSizeInUnifiedToolbar(tb); | - |
| 409 | } | - |
| 410 | } | - |
| 411 | #endif | - |
| 412 | | - |
| 413 | } | - |
| 414 | | - |
| 415 | bool QToolBarLayout::layoutActions(const QSize &size) | - |
| 416 | { | - |
| 417 | if (dirty) evaluated: dirty| yes Evaluation Count:6 | yes Evaluation Count:37 |
| 6-37 |
| 418 | updateGeomArray(); executed: updateGeomArray();Execution Count:6 | 6 |
| 419 | | - |
| 420 | QRect rect(0, 0, size.width(), size.height()); executed (the execution status of this line is deduced): QRect rect(0, 0, size.width(), size.height()); | - |
| 421 | | - |
| 422 | QList<QWidget*> showWidgets, hideWidgets; executed (the execution status of this line is deduced): QList<QWidget*> showWidgets, hideWidgets; | - |
| 423 | | - |
| 424 | QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); executed (the execution status of this line is deduced): QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); | - |
| 425 | if (!tb) partially evaluated: !tb| no Evaluation Count:0 | yes Evaluation Count:43 |
| 0-43 |
| 426 | return false; never executed: return false; | 0 |
| 427 | QStyle *style = tb->style(); executed (the execution status of this line is deduced): QStyle *style = tb->style(); | - |
| 428 | QStyleOptionToolBar opt; executed (the execution status of this line is deduced): QStyleOptionToolBar opt; | - |
| 429 | tb->initStyleOption(&opt); executed (the execution status of this line is deduced): tb->initStyleOption(&opt); | - |
| 430 | const int handleExtent = movable() evaluated: movable()| yes Evaluation Count:4 | yes Evaluation Count:39 |
| 4-39 |
| 431 | ? style->pixelMetric(QStyle::PM_ToolBarHandleExtent, &opt, tb) : 0; executed (the execution status of this line is deduced): ? style->pixelMetric(QStyle::PM_ToolBarHandleExtent, &opt, tb) : 0; | - |
| 432 | const int margin = this->margin(); executed (the execution status of this line is deduced): const int margin = this->margin(); | - |
| 433 | const int spacing = this->spacing(); executed (the execution status of this line is deduced): const int spacing = this->spacing(); | - |
| 434 | const int extensionExtent = style->pixelMetric(QStyle::PM_ToolBarExtensionExtent, &opt, tb); executed (the execution status of this line is deduced): const int extensionExtent = style->pixelMetric(QStyle::PM_ToolBarExtensionExtent, &opt, tb); | - |
| 435 | Qt::Orientation o = tb->orientation(); executed (the execution status of this line is deduced): Qt::Orientation o = tb->orientation(); | - |
| 436 | bool extensionMenuContainsOnlyWidgetActions = true; executed (the execution status of this line is deduced): bool extensionMenuContainsOnlyWidgetActions = true; | - |
| 437 | | - |
| 438 | int space = pick(o, rect.size()) - 2*margin - handleExtent; executed (the execution status of this line is deduced): int space = pick(o, rect.size()) - 2*margin - handleExtent; | - |
| 439 | if (space <= 0) evaluated: space <= 0| yes Evaluation Count:6 | yes Evaluation Count:37 |
| 6-37 |
| 440 | return false; // nothing to do. executed: return false;Execution Count:6 | 6 |
| 441 | | - |
| 442 | if(popupMenu) evaluated: popupMenu| yes Evaluation Count:33 | yes Evaluation Count:4 |
| 4-33 |
| 443 | popupMenu->clear(); executed: popupMenu->clear();Execution Count:33 | 33 |
| 444 | | - |
| 445 | bool ranOutOfSpace = false; executed (the execution status of this line is deduced): bool ranOutOfSpace = false; | - |
| 446 | int rows = 0; executed (the execution status of this line is deduced): int rows = 0; | - |
| 447 | int rowPos = perp(o, rect.topLeft()) + margin; executed (the execution status of this line is deduced): int rowPos = perp(o, rect.topLeft()) + margin; | - |
| 448 | int i = 0; executed (the execution status of this line is deduced): int i = 0; | - |
| 449 | while (i < items.count()) { evaluated: i < items.count()| yes Evaluation Count:31 | yes Evaluation Count:6 |
| 6-31 |
| 450 | QVector<QLayoutStruct> a = geomArray; executed (the execution status of this line is deduced): QVector<QLayoutStruct> a = geomArray; | - |
| 451 | | - |
| 452 | int start = i; executed (the execution status of this line is deduced): int start = i; | - |
| 453 | int size = 0; executed (the execution status of this line is deduced): int size = 0; | - |
| 454 | int prev = -1; executed (the execution status of this line is deduced): int prev = -1; | - |
| 455 | int rowHeight = 0; executed (the execution status of this line is deduced): int rowHeight = 0; | - |
| 456 | int count = 0; executed (the execution status of this line is deduced): int count = 0; | - |
| 457 | int maximumSize = 0; executed (the execution status of this line is deduced): int maximumSize = 0; | - |
| 458 | bool expansiveRow = false; executed (the execution status of this line is deduced): bool expansiveRow = false; | - |
| 459 | for (; i < items.count(); ++i) { evaluated: i < items.count()| yes Evaluation Count:31 | yes Evaluation Count:31 |
| 31 |
| 460 | if (a[i].empty) evaluated: a[i].empty| yes Evaluation Count:4 | yes Evaluation Count:27 |
| 4-27 |
| 461 | continue; executed: continue;Execution Count:4 | 4 |
| 462 | | - |
| 463 | int newSize = size + (count == 0 ? 0 : spacing) + a[i].minimumSize; partially evaluated: count == 0| yes Evaluation Count:27 | no Evaluation Count:0 |
| 0-27 |
| 464 | if (prev != -1 && newSize > space) { partially evaluated: prev != -1| no Evaluation Count:0 | yes Evaluation Count:27 |
never evaluated: newSize > space | 0-27 |
| 465 | if (rows == 0) never evaluated: rows == 0 | 0 |
| 466 | ranOutOfSpace = true; never executed: ranOutOfSpace = true; | 0 |
| 467 | // do we have to move the previous item to the next line to make space for | - |
| 468 | // the extension button? | - |
| 469 | if (count > 1 && size + spacing + extensionExtent > space) never evaluated: count > 1 never evaluated: size + spacing + extensionExtent > space | 0 |
| 470 | i = prev; never executed: i = prev; | 0 |
| 471 | break; | 0 |
| 472 | } | - |
| 473 | | - |
| 474 | if (expanded) partially evaluated: expanded| no Evaluation Count:0 | yes Evaluation Count:27 |
| 0-27 |
| 475 | rowHeight = qMax(rowHeight, perp(o, items.at(i)->sizeHint())); never executed: rowHeight = qMax(rowHeight, perp(o, items.at(i)->sizeHint())); | 0 |
| 476 | expansiveRow = expansiveRow || a[i].expansive; partially evaluated: expansiveRow| no Evaluation Count:0 | yes Evaluation Count:27 |
evaluated: a[i].expansive| yes Evaluation Count:2 | yes Evaluation Count:25 |
| 0-27 |
| 477 | size = newSize; executed (the execution status of this line is deduced): size = newSize; | - |
| 478 | maximumSize += spacing + (a[i].expansive ? a[i].maximumSize : a[i].smartSizeHint()); evaluated: a[i].expansive| yes Evaluation Count:2 | yes Evaluation Count:25 |
| 2-25 |
| 479 | prev = i; executed (the execution status of this line is deduced): prev = i; | - |
| 480 | ++count; executed (the execution status of this line is deduced): ++count; | - |
| 481 | } executed: }Execution Count:27 | 27 |
| 482 | | - |
| 483 | // stretch at the end | - |
| 484 | a[i].sizeHint = 0; executed (the execution status of this line is deduced): a[i].sizeHint = 0; | - |
| 485 | a[i].maximumSize = QWIDGETSIZE_MAX; executed (the execution status of this line is deduced): a[i].maximumSize = ((1<<24)-1); | - |
| 486 | a[i].minimumSize = 0; executed (the execution status of this line is deduced): a[i].minimumSize = 0; | - |
| 487 | a[i].expansive = true; executed (the execution status of this line is deduced): a[i].expansive = true; | - |
| 488 | a[i].stretch = 0; executed (the execution status of this line is deduced): a[i].stretch = 0; | - |
| 489 | a[i].empty = true; executed (the execution status of this line is deduced): a[i].empty = true; | - |
| 490 | | - |
| 491 | if (expansiveRow && maximumSize < space) { evaluated: expansiveRow| yes Evaluation Count:2 | yes Evaluation Count:29 |
partially evaluated: maximumSize < space| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-29 |
| 492 | expansiveRow = false; never executed (the execution status of this line is deduced): expansiveRow = false; | - |
| 493 | a[i].maximumSize = space - maximumSize; never executed (the execution status of this line is deduced): a[i].maximumSize = space - maximumSize; | - |
| 494 | } | 0 |
| 495 | | - |
| 496 | qGeomCalc(a, start, i - start + (expansiveRow ? 0 : 1), 0, executed (the execution status of this line is deduced): qGeomCalc(a, start, i - start + (expansiveRow ? 0 : 1), 0, | - |
| 497 | space - (ranOutOfSpace ? (extensionExtent + spacing) : 0), executed (the execution status of this line is deduced): space - (ranOutOfSpace ? (extensionExtent + spacing) : 0), | - |
| 498 | spacing); executed (the execution status of this line is deduced): spacing); | - |
| 499 | | - |
| 500 | for (int j = start; j < i; ++j) { evaluated: j < i| yes Evaluation Count:31 | yes Evaluation Count:31 |
| 31 |
| 501 | QToolBarItem *item = items.at(j); executed (the execution status of this line is deduced): QToolBarItem *item = items.at(j); | - |
| 502 | | - |
| 503 | if (a[j].empty) { evaluated: a[j].empty| yes Evaluation Count:4 | yes Evaluation Count:27 |
| 4-27 |
| 504 | if (!item->widget()->isHidden()) evaluated: !item->widget()->isHidden()| yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
| 505 | hideWidgets << item->widget(); executed: hideWidgets << item->widget();Execution Count:1 | 1 |
| 506 | continue; executed: continue;Execution Count:4 | 4 |
| 507 | } | - |
| 508 | | - |
| 509 | QPoint pos; executed (the execution status of this line is deduced): QPoint pos; | - |
| 510 | rpick(o, pos) = margin + handleExtent + a[j].pos; executed (the execution status of this line is deduced): rpick(o, pos) = margin + handleExtent + a[j].pos; | - |
| 511 | rperp(o, pos) = rowPos; executed (the execution status of this line is deduced): rperp(o, pos) = rowPos; | - |
| 512 | QSize size; executed (the execution status of this line is deduced): QSize size; | - |
| 513 | rpick(o, size) = a[j].size; executed (the execution status of this line is deduced): rpick(o, size) = a[j].size; | - |
| 514 | if (expanded) partially evaluated: expanded| no Evaluation Count:0 | yes Evaluation Count:27 |
| 0-27 |
| 515 | rperp(o, size) = rowHeight; never executed: rperp(o, size) = rowHeight; | 0 |
| 516 | else | - |
| 517 | rperp(o, size) = perp(o, rect.size()) - 2*margin; executed: rperp(o, size) = perp(o, rect.size()) - 2*margin;Execution Count:27 | 27 |
| 518 | QRect r(pos, size); executed (the execution status of this line is deduced): QRect r(pos, size); | - |
| 519 | | - |
| 520 | if (o == Qt::Horizontal) partially evaluated: o == Qt::Horizontal| yes Evaluation Count:27 | no Evaluation Count:0 |
| 0-27 |
| 521 | r = QStyle::visualRect(parentWidget()->layoutDirection(), rect, r); executed: r = QStyle::visualRect(parentWidget()->layoutDirection(), rect, r);Execution Count:27 | 27 |
| 522 | | - |
| 523 | item->setGeometry(r); executed (the execution status of this line is deduced): item->setGeometry(r); | - |
| 524 | | - |
| 525 | if (item->widget()->isHidden()) evaluated: item->widget()->isHidden()| yes Evaluation Count:9 | yes Evaluation Count:18 |
| 9-18 |
| 526 | showWidgets << item->widget(); executed: showWidgets << item->widget();Execution Count:9 | 9 |
| 527 | } executed: }Execution Count:27 | 27 |
| 528 | | - |
| 529 | if (!expanded) { partially evaluated: !expanded| yes Evaluation Count:31 | no Evaluation Count:0 |
| 0-31 |
| 530 | for (int j = i; j < items.count(); ++j) { partially evaluated: j < items.count()| no Evaluation Count:0 | yes Evaluation Count:31 |
| 0-31 |
| 531 | QToolBarItem *item = items.at(j); never executed (the execution status of this line is deduced): QToolBarItem *item = items.at(j); | - |
| 532 | if (!item->widget()->isHidden()) never evaluated: !item->widget()->isHidden() | 0 |
| 533 | hideWidgets << item->widget(); never executed: hideWidgets << item->widget(); | 0 |
| 534 | if (popupMenu) { never evaluated: popupMenu | 0 |
| 535 | if (!defaultWidgetAction(item)) { never evaluated: !defaultWidgetAction(item) | 0 |
| 536 | popupMenu->addAction(item->action); never executed (the execution status of this line is deduced): popupMenu->addAction(item->action); | - |
| 537 | extensionMenuContainsOnlyWidgetActions = false; never executed (the execution status of this line is deduced): extensionMenuContainsOnlyWidgetActions = false; | - |
| 538 | } | 0 |
| 539 | } | 0 |
| 540 | } | 0 |
| 541 | break; executed: break;Execution Count:31 | 31 |
| 542 | } | - |
| 543 | | - |
| 544 | rowPos += rowHeight + spacing; never executed (the execution status of this line is deduced): rowPos += rowHeight + spacing; | - |
| 545 | ++rows; never executed (the execution status of this line is deduced): ++rows; | - |
| 546 | } | 0 |
| 547 | | - |
| 548 | // if we are using a popup menu, not the expadning toolbar effect, we cannot move custom | - |
| 549 | // widgets into the menu. If only custom widget actions are chopped off, the popup menu | - |
| 550 | // is empty. So we show the little extension button to show something is chopped off, | - |
| 551 | // but we make it disabled. | - |
| 552 | extension->setEnabled(popupMenu == 0 || !extensionMenuContainsOnlyWidgetActions); executed (the execution status of this line is deduced): extension->setEnabled(popupMenu == 0 || !extensionMenuContainsOnlyWidgetActions); | - |
| 553 | | - |
| 554 | // we have to do the show/hide here, because it triggers more calls to setGeometry :( | - |
| 555 | for (int i = 0; i < showWidgets.count(); ++i) evaluated: i < showWidgets.count()| yes Evaluation Count:9 | yes Evaluation Count:37 |
| 9-37 |
| 556 | showWidgets.at(i)->show(); executed: showWidgets.at(i)->show();Execution Count:9 | 9 |
| 557 | for (int i = 0; i < hideWidgets.count(); ++i) evaluated: i < hideWidgets.count()| yes Evaluation Count:1 | yes Evaluation Count:37 |
| 1-37 |
| 558 | hideWidgets.at(i)->hide(); executed: hideWidgets.at(i)->hide();Execution Count:1 | 1 |
| 559 | | - |
| 560 | return ranOutOfSpace; executed: return ranOutOfSpace;Execution Count:37 | 37 |
| 561 | } | - |
| 562 | | - |
| 563 | QSize QToolBarLayout::expandedSize(const QSize &size) const | - |
| 564 | { | - |
| 565 | if (dirty) evaluated: dirty| yes Evaluation Count:1 | yes Evaluation Count:10 |
| 1-10 |
| 566 | updateGeomArray(); executed: updateGeomArray();Execution Count:1 | 1 |
| 567 | | - |
| 568 | QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); executed (the execution status of this line is deduced): QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); | - |
| 569 | if (!tb) partially evaluated: !tb| no Evaluation Count:0 | yes Evaluation Count:11 |
| 0-11 |
| 570 | return QSize(0, 0); never executed: return QSize(0, 0); | 0 |
| 571 | QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget()); executed (the execution status of this line is deduced): QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget()); | - |
| 572 | Qt::Orientation o = tb->orientation(); executed (the execution status of this line is deduced): Qt::Orientation o = tb->orientation(); | - |
| 573 | QStyle *style = tb->style(); executed (the execution status of this line is deduced): QStyle *style = tb->style(); | - |
| 574 | QStyleOptionToolBar opt; executed (the execution status of this line is deduced): QStyleOptionToolBar opt; | - |
| 575 | tb->initStyleOption(&opt); executed (the execution status of this line is deduced): tb->initStyleOption(&opt); | - |
| 576 | const int handleExtent = movable() partially evaluated: movable()| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 577 | ? style->pixelMetric(QStyle::PM_ToolBarHandleExtent, &opt, tb) : 0; executed (the execution status of this line is deduced): ? style->pixelMetric(QStyle::PM_ToolBarHandleExtent, &opt, tb) : 0; | - |
| 578 | const int margin = this->margin(); executed (the execution status of this line is deduced): const int margin = this->margin(); | - |
| 579 | const int spacing = this->spacing(); executed (the execution status of this line is deduced): const int spacing = this->spacing(); | - |
| 580 | const int extensionExtent = style->pixelMetric(QStyle::PM_ToolBarExtensionExtent, &opt, tb); executed (the execution status of this line is deduced): const int extensionExtent = style->pixelMetric(QStyle::PM_ToolBarExtensionExtent, &opt, tb); | - |
| 581 | | - |
| 582 | int total_w = 0; executed (the execution status of this line is deduced): int total_w = 0; | - |
| 583 | int count = 0; executed (the execution status of this line is deduced): int count = 0; | - |
| 584 | for (int x = 0; x < items.count(); ++x) { evaluated: x < items.count()| yes Evaluation Count:11 | yes Evaluation Count:11 |
| 11 |
| 585 | if (!geomArray[x].empty) { partially evaluated: !geomArray[x].empty| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 586 | total_w += (count == 0 ? 0 : spacing) + geomArray[x].minimumSize; partially evaluated: count == 0| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 587 | ++count; executed (the execution status of this line is deduced): ++count; | - |
| 588 | } executed: }Execution Count:11 | 11 |
| 589 | } executed: }Execution Count:11 | 11 |
| 590 | if (count == 0) partially evaluated: count == 0| no Evaluation Count:0 | yes Evaluation Count:11 |
| 0-11 |
| 591 | return QSize(0, 0); never executed: return QSize(0, 0); | 0 |
| 592 | | - |
| 593 | int min_w = pick(o, size); executed (the execution status of this line is deduced): int min_w = pick(o, size); | - |
| 594 | int rows = (int)qSqrt(qreal(count)); executed (the execution status of this line is deduced): int rows = (int)qSqrt(qreal(count)); | - |
| 595 | if (rows == 1) partially evaluated: rows == 1| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 596 | ++rows; // we want to expand to at least two rows executed: ++rows;Execution Count:11 | 11 |
| 597 | int space = total_w/rows + spacing + extensionExtent; executed (the execution status of this line is deduced): int space = total_w/rows + spacing + extensionExtent; | - |
| 598 | space = qMax(space, min_w - 2*margin - handleExtent); executed (the execution status of this line is deduced): space = qMax(space, min_w - 2*margin - handleExtent); | - |
| 599 | if (win != 0) partially evaluated: win != 0| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 600 | space = qMin(space, pick(o, win->size()) - 2*margin - handleExtent); executed: space = qMin(space, pick(o, win->size()) - 2*margin - handleExtent);Execution Count:11 | 11 |
| 601 | | - |
| 602 | int w = 0; executed (the execution status of this line is deduced): int w = 0; | - |
| 603 | int h = 0; executed (the execution status of this line is deduced): int h = 0; | - |
| 604 | int i = 0; executed (the execution status of this line is deduced): int i = 0; | - |
| 605 | while (i < items.count()) { evaluated: i < items.count()| yes Evaluation Count:11 | yes Evaluation Count:11 |
| 11 |
| 606 | int count = 0; executed (the execution status of this line is deduced): int count = 0; | - |
| 607 | int size = 0; executed (the execution status of this line is deduced): int size = 0; | - |
| 608 | int prev = -1; executed (the execution status of this line is deduced): int prev = -1; | - |
| 609 | int rowHeight = 0; executed (the execution status of this line is deduced): int rowHeight = 0; | - |
| 610 | for (; i < items.count(); ++i) { evaluated: i < items.count()| yes Evaluation Count:11 | yes Evaluation Count:11 |
| 11 |
| 611 | if (geomArray[i].empty) partially evaluated: geomArray[i].empty| no Evaluation Count:0 | yes Evaluation Count:11 |
| 0-11 |
| 612 | continue; never executed: continue; | 0 |
| 613 | | - |
| 614 | int newSize = size + (count == 0 ? 0 : spacing) + geomArray[i].minimumSize; partially evaluated: count == 0| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 615 | rowHeight = qMax(rowHeight, perp(o, items.at(i)->sizeHint())); executed (the execution status of this line is deduced): rowHeight = qMax(rowHeight, perp(o, items.at(i)->sizeHint())); | - |
| 616 | if (prev != -1 && newSize > space) { partially evaluated: prev != -1| no Evaluation Count:0 | yes Evaluation Count:11 |
never evaluated: newSize > space | 0-11 |
| 617 | if (count > 1 && size + spacing + extensionExtent > space) { never evaluated: count > 1 never evaluated: size + spacing + extensionExtent > space | 0 |
| 618 | size -= spacing + geomArray[prev].minimumSize; never executed (the execution status of this line is deduced): size -= spacing + geomArray[prev].minimumSize; | - |
| 619 | i = prev; never executed (the execution status of this line is deduced): i = prev; | - |
| 620 | } | 0 |
| 621 | break; | 0 |
| 622 | } | - |
| 623 | | - |
| 624 | size = newSize; executed (the execution status of this line is deduced): size = newSize; | - |
| 625 | prev = i; executed (the execution status of this line is deduced): prev = i; | - |
| 626 | ++count; executed (the execution status of this line is deduced): ++count; | - |
| 627 | } executed: }Execution Count:11 | 11 |
| 628 | | - |
| 629 | w = qMax(size, w); executed (the execution status of this line is deduced): w = qMax(size, w); | - |
| 630 | h += rowHeight + spacing; executed (the execution status of this line is deduced): h += rowHeight + spacing; | - |
| 631 | } executed: }Execution Count:11 | 11 |
| 632 | | - |
| 633 | w += 2*margin + handleExtent + spacing + extensionExtent; executed (the execution status of this line is deduced): w += 2*margin + handleExtent + spacing + extensionExtent; | - |
| 634 | w = qMax(w, min_w); executed (the execution status of this line is deduced): w = qMax(w, min_w); | - |
| 635 | if (win != 0) partially evaluated: win != 0| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 636 | w = qMin(w, pick(o, win->size())); executed: w = qMin(w, pick(o, win->size()));Execution Count:11 | 11 |
| 637 | h += 2*margin - spacing; //there is no spacing before the first row executed (the execution status of this line is deduced): h += 2*margin - spacing; | - |
| 638 | | - |
| 639 | QSize result; executed (the execution status of this line is deduced): QSize result; | - |
| 640 | rpick(o, result) = w; executed (the execution status of this line is deduced): rpick(o, result) = w; | - |
| 641 | rperp(o, result) = h; executed (the execution status of this line is deduced): rperp(o, result) = h; | - |
| 642 | return result; executed: return result;Execution Count:11 | 11 |
| 643 | } | - |
| 644 | | - |
| 645 | void QToolBarLayout::setExpanded(bool exp) | - |
| 646 | { | - |
| 647 | QWidget *tb = qobject_cast<QToolBar*>(parentWidget()); never executed (the execution status of this line is deduced): QWidget *tb = qobject_cast<QToolBar*>(parentWidget()); | - |
| 648 | if (!tb) | 0 |
| 649 | return; | 0 |
| 650 | if (exp == expanded && !tb->isWindow()) never evaluated: exp == expanded never evaluated: !tb->isWindow() | 0 |
| 651 | return; | 0 |
| 652 | | - |
| 653 | expanded = exp; never executed (the execution status of this line is deduced): expanded = exp; | - |
| 654 | extension->setChecked(expanded); never executed (the execution status of this line is deduced): extension->setChecked(expanded); | - |
| 655 | | - |
| 656 | if (QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget())) { never evaluated: QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget()) | 0 |
| 657 | #ifdef QT_NO_DOCKWIDGET | - |
| 658 | animating = false; | - |
| 659 | #else | - |
| 660 | animating = !tb->isWindow() && win->isAnimated(); never evaluated: !tb->isWindow() never evaluated: win->isAnimated() | 0 |
| 661 | #endif | - |
| 662 | QMainWindowLayout *layout = qt_mainwindow_layout(win); never executed (the execution status of this line is deduced): QMainWindowLayout *layout = qt_mainwindow_layout(win); | - |
| 663 | if (expanded) { never evaluated: expanded | 0 |
| 664 | tb->raise(); never executed (the execution status of this line is deduced): tb->raise(); | - |
| 665 | } else { | 0 |
| 666 | QList<int> path = layout->layoutState.indexOf(tb); never executed (the execution status of this line is deduced): QList<int> path = layout->layoutState.indexOf(tb); | - |
| 667 | if (!path.isEmpty()) { never evaluated: !path.isEmpty() | 0 |
| 668 | QRect rect = layout->layoutState.itemRect(path); never executed (the execution status of this line is deduced): QRect rect = layout->layoutState.itemRect(path); | - |
| 669 | layoutActions(rect.size()); never executed (the execution status of this line is deduced): layoutActions(rect.size()); | - |
| 670 | } | 0 |
| 671 | } | 0 |
| 672 | layout->layoutState.toolBarAreaLayout.apply(animating); never executed (the execution status of this line is deduced): layout->layoutState.toolBarAreaLayout.apply(animating); | - |
| 673 | } | 0 |
| 674 | } | 0 |
| 675 | | - |
| 676 | QSize QToolBarLayout::minimumSize() const | - |
| 677 | { | - |
| 678 | if (dirty) evaluated: dirty| yes Evaluation Count:27 | yes Evaluation Count:56 |
| 27-56 |
| 679 | updateGeomArray(); executed: updateGeomArray();Execution Count:27 | 27 |
| 680 | return minSize; executed: return minSize;Execution Count:83 | 83 |
| 681 | } | - |
| 682 | | - |
| 683 | QSize QToolBarLayout::sizeHint() const | - |
| 684 | { | - |
| 685 | if (dirty) evaluated: dirty| yes Evaluation Count:4 | yes Evaluation Count:63 |
| 4-63 |
| 686 | updateGeomArray(); executed: updateGeomArray();Execution Count:4 | 4 |
| 687 | return hint; executed: return hint;Execution Count:67 | 67 |
| 688 | } | - |
| 689 | | - |
| 690 | QToolBarItem *QToolBarLayout::createItem(QAction *action) | - |
| 691 | { | - |
| 692 | bool customWidget = false; executed (the execution status of this line is deduced): bool customWidget = false; | - |
| 693 | bool standardButtonWidget = false; executed (the execution status of this line is deduced): bool standardButtonWidget = false; | - |
| 694 | QWidget *widget = 0; executed (the execution status of this line is deduced): QWidget *widget = 0; | - |
| 695 | QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); executed (the execution status of this line is deduced): QToolBar *tb = qobject_cast<QToolBar*>(parentWidget()); | - |
| 696 | if (!tb) partially evaluated: !tb| no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
| 697 | return (QToolBarItem *)0; never executed: return (QToolBarItem *)0; | 0 |
| 698 | | - |
| 699 | if (QWidgetAction *widgetAction = qobject_cast<QWidgetAction *>(action)) { evaluated: QWidgetAction *widgetAction = qobject_cast<QWidgetAction *>(action)| yes Evaluation Count:15 | yes Evaluation Count:1 |
| 1-15 |
| 700 | widget = widgetAction->requestWidget(tb); executed (the execution status of this line is deduced): widget = widgetAction->requestWidget(tb); | - |
| 701 | if (widget != 0) { evaluated: widget != 0| yes Evaluation Count:13 | yes Evaluation Count:2 |
| 2-13 |
| 702 | widget->setAttribute(Qt::WA_LayoutUsesWidgetRect); executed (the execution status of this line is deduced): widget->setAttribute(Qt::WA_LayoutUsesWidgetRect); | - |
| 703 | customWidget = true; executed (the execution status of this line is deduced): customWidget = true; | - |
| 704 | } executed: }Execution Count:13 | 13 |
| 705 | } else if (action->isSeparator()) { executed: }Execution Count:15 partially evaluated: action->isSeparator()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-15 |
| 706 | QToolBarSeparator *sep = new QToolBarSeparator(tb); never executed (the execution status of this line is deduced): QToolBarSeparator *sep = new QToolBarSeparator(tb); | - |
| 707 | connect(tb, SIGNAL(orientationChanged(Qt::Orientation)), never executed (the execution status of this line is deduced): connect(tb, "2""orientationChanged(Qt::Orientation)", | - |
| 708 | sep, SLOT(setOrientation(Qt::Orientation))); never executed (the execution status of this line is deduced): sep, "1""setOrientation(Qt::Orientation)"); | - |
| 709 | widget = sep; never executed (the execution status of this line is deduced): widget = sep; | - |
| 710 | } | 0 |
| 711 | | - |
| 712 | if (!widget) { evaluated: !widget| yes Evaluation Count:3 | yes Evaluation Count:13 |
| 3-13 |
| 713 | QToolButton *button = new QToolButton(tb); executed (the execution status of this line is deduced): QToolButton *button = new QToolButton(tb); | - |
| 714 | button->setAutoRaise(true); executed (the execution status of this line is deduced): button->setAutoRaise(true); | - |
| 715 | button->setFocusPolicy(Qt::NoFocus); executed (the execution status of this line is deduced): button->setFocusPolicy(Qt::NoFocus); | - |
| 716 | button->setIconSize(tb->iconSize()); executed (the execution status of this line is deduced): button->setIconSize(tb->iconSize()); | - |
| 717 | button->setToolButtonStyle(tb->toolButtonStyle()); executed (the execution status of this line is deduced): button->setToolButtonStyle(tb->toolButtonStyle()); | - |
| 718 | QObject::connect(tb, SIGNAL(iconSizeChanged(QSize)), executed (the execution status of this line is deduced): QObject::connect(tb, "2""iconSizeChanged(QSize)", | - |
| 719 | button, SLOT(setIconSize(QSize))); executed (the execution status of this line is deduced): button, "1""setIconSize(QSize)"); | - |
| 720 | QObject::connect(tb, SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)), executed (the execution status of this line is deduced): QObject::connect(tb, "2""toolButtonStyleChanged(Qt::ToolButtonStyle)", | - |
| 721 | button, SLOT(setToolButtonStyle(Qt::ToolButtonStyle))); executed (the execution status of this line is deduced): button, "1""setToolButtonStyle(Qt::ToolButtonStyle)"); | - |
| 722 | button->setDefaultAction(action); executed (the execution status of this line is deduced): button->setDefaultAction(action); | - |
| 723 | QObject::connect(button, SIGNAL(triggered(QAction*)), tb, SIGNAL(actionTriggered(QAction*))); executed (the execution status of this line is deduced): QObject::connect(button, "2""triggered(QAction*)", tb, "2""actionTriggered(QAction*)"); | - |
| 724 | widget = button; executed (the execution status of this line is deduced): widget = button; | - |
| 725 | standardButtonWidget = true; executed (the execution status of this line is deduced): standardButtonWidget = true; | - |
| 726 | } executed: }Execution Count:3 | 3 |
| 727 | | - |
| 728 | widget->hide(); executed (the execution status of this line is deduced): widget->hide(); | - |
| 729 | QToolBarItem *result = new QToolBarItem(widget); executed (the execution status of this line is deduced): QToolBarItem *result = new QToolBarItem(widget); | - |
| 730 | if (standardButtonWidget) evaluated: standardButtonWidget| yes Evaluation Count:3 | yes Evaluation Count:13 |
| 3-13 |
| 731 | result->setAlignment(Qt::AlignJustify); executed: result->setAlignment(Qt::AlignJustify);Execution Count:3 | 3 |
| 732 | result->customWidget = customWidget; executed (the execution status of this line is deduced): result->customWidget = customWidget; | - |
| 733 | result->action = action; executed (the execution status of this line is deduced): result->action = action; | - |
| 734 | return result; executed: return result;Execution Count:16 | 16 |
| 735 | } | - |
| 736 | | - |
| 737 | QT_END_NAMESPACE | - |
| 738 | | - |
| 739 | #endif // QT_NO_TOOLBAR | - |
| 740 | | - |
| | |