| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | class QMainWindowPrivate : public QWidgetPrivate | - |
| 9 | { | - |
| 10 | inline QMainWindow* q_func() { return static_cast<QMainWindow *>(q_ptr); } inline const QMainWindow* q_func() const { return static_cast<const QMainWindow *>(q_ptr); } friend class QMainWindow; | - |
| 11 | public: | - |
| 12 | inline QMainWindowPrivate() | - |
| 13 | : layout(0), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly) | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | , hasOldCursor(false) , cursorAdjusted(false) | - |
| 20 | | - |
| 21 | { } executed: }Execution Count:44 | 44 |
| 22 | QMainWindowLayout *layout; | - |
| 23 | QSize iconSize; | - |
| 24 | bool explicitIconSize; | - |
| 25 | Qt::ToolButtonStyle toolButtonStyle; | - |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | | - |
| 30 | void init(); | - |
| 31 | QList<int> hoverSeparator; | - |
| 32 | QPoint hoverPos; | - |
| 33 | | - |
| 34 | | - |
| 35 | QCursor separatorCursor(const QList<int> &path) const; | - |
| 36 | void adjustCursor(const QPoint &pos); | - |
| 37 | QCursor oldCursor; | - |
| 38 | QCursor adjustedCursor; | - |
| 39 | uint hasOldCursor : 1; | - |
| 40 | uint cursorAdjusted : 1; | - |
| 41 | | - |
| 42 | | - |
| 43 | static inline QMainWindowLayout *mainWindowLayout(const QMainWindow *mainWindow) | - |
| 44 | { | - |
| 45 | return mainWindow ? mainWindow->d_func()->layout : static_cast<QMainWindowLayout *>(0); executed: return mainWindow ? mainWindow->d_func()->layout : static_cast<QMainWindowLayout *>(0);Execution Count:2347 | 2347 |
| 46 | } | - |
| 47 | }; | - |
| 48 | | - |
| 49 | QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *mainWindow) | - |
| 50 | { | - |
| 51 | return QMainWindowPrivate::mainWindowLayout(mainWindow); executed: return QMainWindowPrivate::mainWindowLayout(mainWindow);Execution Count:2347 | 2347 |
| 52 | } | - |
| 53 | void QMainWindowPrivate::init() | - |
| 54 | { | - |
| 55 | QMainWindow * const q = q_func(); | - |
| 56 | layout = new QMainWindowLayout(q, 0); | - |
| 57 | | - |
| 58 | | - |
| 59 | const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q); | - |
| 60 | iconSize = QSize(metric, metric); | - |
| 61 | q->setAttribute(Qt::WA_Hover); | - |
| 62 | } executed: }Execution Count:44 | 44 |
| 63 | QMainWindow::QMainWindow(QWidget *parent, Qt::WindowFlags flags) | - |
| 64 | : QWidget(*(new QMainWindowPrivate()), parent, flags | Qt::Window) | - |
| 65 | { | - |
| 66 | d_func()->init(); | - |
| 67 | } executed: }Execution Count:44 | 44 |
| 68 | | - |
| 69 | | - |
| 70 | | - |
| 71 | | - |
| 72 | | - |
| 73 | QMainWindow::~QMainWindow() | - |
| 74 | { } | - |
| 75 | void QMainWindow::setDockOptions(DockOptions opt) | - |
| 76 | { | - |
| 77 | QMainWindowPrivate * const d = d_func(); | - |
| 78 | d->layout->setDockOptions(opt); | - |
| 79 | } | 0 |
| 80 | | - |
| 81 | QMainWindow::DockOptions QMainWindow::dockOptions() const | - |
| 82 | { | - |
| 83 | const QMainWindowPrivate * const d = d_func(); | - |
| 84 | return d->layout->dockOptions; never executed: return d->layout->dockOptions; | 0 |
| 85 | } | - |
| 86 | | - |
| 87 | QSize QMainWindow::iconSize() const | - |
| 88 | { return d_func()->iconSize; } never executed: return d_func()->iconSize; | 0 |
| 89 | | - |
| 90 | void QMainWindow::setIconSize(const QSize &iconSize) | - |
| 91 | { | - |
| 92 | QMainWindowPrivate * const d = d_func(); | - |
| 93 | QSize sz = iconSize; | - |
| 94 | if (!sz.isValid()) { partially evaluated: !sz.isValid()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 95 | const int metric = style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, this); | - |
| 96 | sz = QSize(metric, metric); | - |
| 97 | } executed: }Execution Count:1 | 1 |
| 98 | if (d->iconSize != sz) { partially evaluated: d->iconSize != sz| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 99 | d->iconSize = sz; | - |
| 100 | iconSizeChanged(d->iconSize); | - |
| 101 | } | 0 |
| 102 | d->explicitIconSize = iconSize.isValid(); | - |
| 103 | } executed: }Execution Count:1 | 1 |
| 104 | | - |
| 105 | | - |
| 106 | | - |
| 107 | | - |
| 108 | | - |
| 109 | | - |
| 110 | | - |
| 111 | Qt::ToolButtonStyle QMainWindow::toolButtonStyle() const | - |
| 112 | { return d_func()->toolButtonStyle; } never executed: return d_func()->toolButtonStyle; | 0 |
| 113 | | - |
| 114 | void QMainWindow::setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle) | - |
| 115 | { | - |
| 116 | QMainWindowPrivate * const d = d_func(); | - |
| 117 | if (d->toolButtonStyle == toolButtonStyle) never evaluated: d->toolButtonStyle == toolButtonStyle | 0 |
| 118 | return; | 0 |
| 119 | d->toolButtonStyle = toolButtonStyle; | - |
| 120 | toolButtonStyleChanged(d->toolButtonStyle); | - |
| 121 | } | 0 |
| 122 | QMenuBar *QMainWindow::menuBar() const | - |
| 123 | { | - |
| 124 | QMenuBar *menuBar = qobject_cast<QMenuBar *>(layout()->menuBar()); | - |
| 125 | if (!menuBar) { evaluated: !menuBar| yes Evaluation Count:14 | yes Evaluation Count:140 |
| 14-140 |
| 126 | QMainWindow *self = const_cast<QMainWindow *>(this); | - |
| 127 | menuBar = new QMenuBar(self); | - |
| 128 | self->setMenuBar(menuBar); | - |
| 129 | } executed: }Execution Count:14 | 14 |
| 130 | return menuBar; executed: return menuBar;Execution Count:154 | 154 |
| 131 | } | - |
| 132 | void QMainWindow::setMenuBar(QMenuBar *menuBar) | - |
| 133 | { | - |
| 134 | QLayout *topLayout = layout(); | - |
| 135 | | - |
| 136 | if (topLayout->menuBar() && topLayout->menuBar() != menuBar) { evaluated: topLayout->menuBar()| yes Evaluation Count:2 | yes Evaluation Count:16 |
partially evaluated: topLayout->menuBar() != menuBar| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-16 |
| 137 | | - |
| 138 | QMenuBar *oldMenuBar = qobject_cast<QMenuBar *>(topLayout->menuBar()); | - |
| 139 | if (menuBar) { evaluated: menuBar| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 140 | | - |
| 141 | QWidget *cornerWidget = oldMenuBar->cornerWidget(Qt::TopLeftCorner); | - |
| 142 | if (cornerWidget) partially evaluated: cornerWidget| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 143 | menuBar->setCornerWidget(cornerWidget, Qt::TopLeftCorner); executed: menuBar->setCornerWidget(cornerWidget, Qt::TopLeftCorner);Execution Count:1 | 1 |
| 144 | | - |
| 145 | cornerWidget = oldMenuBar->cornerWidget(Qt::TopRightCorner); | - |
| 146 | if (cornerWidget) partially evaluated: cornerWidget| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 147 | menuBar->setCornerWidget(cornerWidget, Qt::TopRightCorner); executed: menuBar->setCornerWidget(cornerWidget, Qt::TopRightCorner);Execution Count:1 | 1 |
| 148 | } executed: }Execution Count:1 | 1 |
| 149 | oldMenuBar->hide(); | - |
| 150 | oldMenuBar->deleteLater(); | - |
| 151 | } executed: }Execution Count:2 | 2 |
| 152 | topLayout->setMenuBar(menuBar); | - |
| 153 | } executed: }Execution Count:18 | 18 |
| 154 | | - |
| 155 | | - |
| 156 | | - |
| 157 | | - |
| 158 | | - |
| 159 | | - |
| 160 | | - |
| 161 | QWidget *QMainWindow::menuWidget() const | - |
| 162 | { | - |
| 163 | QWidget *menuBar = d_func()->layout->menuBar(); | - |
| 164 | return menuBar; executed: return menuBar;Execution Count:7368 | 7368 |
| 165 | } | - |
| 166 | void QMainWindow::setMenuWidget(QWidget *menuBar) | - |
| 167 | { | - |
| 168 | QMainWindowPrivate * const d = d_func(); | - |
| 169 | if (d->layout->menuBar() && d->layout->menuBar() != menuBar) { partially evaluated: d->layout->menuBar()| no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: d->layout->menuBar() != menuBar | 0-1 |
| 170 | d->layout->menuBar()->hide(); | - |
| 171 | d->layout->menuBar()->deleteLater(); | - |
| 172 | } | 0 |
| 173 | d->layout->setMenuBar(menuBar); | - |
| 174 | } executed: }Execution Count:1 | 1 |
| 175 | QStatusBar *QMainWindow::statusBar() const | - |
| 176 | { | - |
| 177 | QStatusBar *statusbar = d_func()->layout->statusBar(); | - |
| 178 | if (!statusbar) { evaluated: !statusbar| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
| 179 | QMainWindow *self = const_cast<QMainWindow *>(this); | - |
| 180 | statusbar = new QStatusBar(self); | - |
| 181 | statusbar->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed); | - |
| 182 | self->setStatusBar(statusbar); | - |
| 183 | } executed: }Execution Count:3 | 3 |
| 184 | return statusbar; executed: return statusbar;Execution Count:4 | 4 |
| 185 | } | - |
| 186 | void QMainWindow::setStatusBar(QStatusBar *statusbar) | - |
| 187 | { | - |
| 188 | QMainWindowPrivate * const d = d_func(); | - |
| 189 | if (d->layout->statusBar() && d->layout->statusBar() != statusbar) { evaluated: d->layout->statusBar()| yes Evaluation Count:1 | yes Evaluation Count:4 |
partially evaluated: d->layout->statusBar() != statusbar| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-4 |
| 190 | d->layout->statusBar()->hide(); | - |
| 191 | d->layout->statusBar()->deleteLater(); | - |
| 192 | } executed: }Execution Count:1 | 1 |
| 193 | d->layout->setStatusBar(statusbar); | - |
| 194 | } executed: }Execution Count:5 | 5 |
| 195 | QWidget *QMainWindow::centralWidget() const | - |
| 196 | { return d_func()->layout->centralWidget(); } never executed: return d_func()->layout->centralWidget(); | 0 |
| 197 | void QMainWindow::setCentralWidget(QWidget *widget) | - |
| 198 | { | - |
| 199 | QMainWindowPrivate * const d = d_func(); | - |
| 200 | if (d->layout->centralWidget() && d->layout->centralWidget() != widget) { partially evaluated: d->layout->centralWidget()| no Evaluation Count:0 | yes Evaluation Count:18 |
never evaluated: d->layout->centralWidget() != widget | 0-18 |
| 201 | d->layout->centralWidget()->hide(); | - |
| 202 | d->layout->centralWidget()->deleteLater(); | - |
| 203 | } | 0 |
| 204 | d->layout->setCentralWidget(widget); | - |
| 205 | } executed: }Execution Count:18 | 18 |
| 206 | void QMainWindow::setCorner(Qt::Corner corner, Qt::DockWidgetArea area) | - |
| 207 | { | - |
| 208 | bool valid = false; | - |
| 209 | switch (corner) { | - |
| 210 | case Qt::TopLeftCorner: | - |
| 211 | valid = (area == Qt::TopDockWidgetArea || area == Qt::LeftDockWidgetArea); never evaluated: area == Qt::TopDockWidgetArea never evaluated: area == Qt::LeftDockWidgetArea | 0 |
| 212 | break; | 0 |
| 213 | case Qt::TopRightCorner: | - |
| 214 | valid = (area == Qt::TopDockWidgetArea || area == Qt::RightDockWidgetArea); never evaluated: area == Qt::TopDockWidgetArea never evaluated: area == Qt::RightDockWidgetArea | 0 |
| 215 | break; | 0 |
| 216 | case Qt::BottomLeftCorner: | - |
| 217 | valid = (area == Qt::BottomDockWidgetArea || area == Qt::LeftDockWidgetArea); never evaluated: area == Qt::BottomDockWidgetArea never evaluated: area == Qt::LeftDockWidgetArea | 0 |
| 218 | break; | 0 |
| 219 | case Qt::BottomRightCorner: | - |
| 220 | valid = (area == Qt::BottomDockWidgetArea || area == Qt::RightDockWidgetArea); never evaluated: area == Qt::BottomDockWidgetArea never evaluated: area == Qt::RightDockWidgetArea | 0 |
| 221 | break; | 0 |
| 222 | } | - |
| 223 | if (!valid) | 0 |
| 224 | QMessageLogger("widgets/qmainwindow.cpp", 657, __PRETTY_FUNCTION__).warning("QMainWindow::setCorner(): 'area' is not valid for 'corner'"); never executed: QMessageLogger("widgets/qmainwindow.cpp", 657, __PRETTY_FUNCTION__).warning("QMainWindow::setCorner(): 'area' is not valid for 'corner'"); | 0 |
| 225 | else | - |
| 226 | d_func()->layout->setCorner(corner, area); never executed: d_func()->layout->setCorner(corner, area); | 0 |
| 227 | } | - |
| 228 | | - |
| 229 | | - |
| 230 | | - |
| 231 | | - |
| 232 | | - |
| 233 | | - |
| 234 | | - |
| 235 | Qt::DockWidgetArea QMainWindow::corner(Qt::Corner corner) const | - |
| 236 | { return d_func()->layout->corner(corner); } never executed: return d_func()->layout->corner(corner); | 0 |
| 237 | | - |
| 238 | | - |
| 239 | | - |
| 240 | | - |
| 241 | static bool checkToolBarArea(Qt::ToolBarArea area, const char *where) | - |
| 242 | { | - |
| 243 | switch (area) { | - |
| 244 | case Qt::LeftToolBarArea: | - |
| 245 | case Qt::RightToolBarArea: | - |
| 246 | case Qt::TopToolBarArea: | - |
| 247 | case Qt::BottomToolBarArea: | - |
| 248 | return true; executed: return true;Execution Count:2 | 2 |
| 249 | default: | - |
| 250 | break; | 0 |
| 251 | } | - |
| 252 | QMessageLogger("widgets/qmainwindow.cpp", 685, __PRETTY_FUNCTION__).warning("%s: invalid 'area' argument", where); | - |
| 253 | return false; never executed: return false; | 0 |
| 254 | } | - |
| 255 | | - |
| 256 | | - |
| 257 | | - |
| 258 | | - |
| 259 | | - |
| 260 | void QMainWindow::addToolBarBreak(Qt::ToolBarArea area) | - |
| 261 | { | - |
| 262 | if (!checkToolBarArea(area, "QMainWindow::addToolBarBreak")) never evaluated: !checkToolBarArea(area, "QMainWindow::addToolBarBreak") | 0 |
| 263 | return; | 0 |
| 264 | d_func()->layout->addToolBarBreak(area); | - |
| 265 | } | 0 |
| 266 | | - |
| 267 | | - |
| 268 | | - |
| 269 | | - |
| 270 | void QMainWindow::insertToolBarBreak(QToolBar *before) | - |
| 271 | { d_func()->layout->insertToolBarBreak(before); } | 0 |
| 272 | | - |
| 273 | | - |
| 274 | | - |
| 275 | | - |
| 276 | | - |
| 277 | void QMainWindow::removeToolBarBreak(QToolBar *before) | - |
| 278 | { | - |
| 279 | QMainWindowPrivate * const d = d_func(); | - |
| 280 | d->layout->removeToolBarBreak(before); | - |
| 281 | } | 0 |
| 282 | void QMainWindow::addToolBar(Qt::ToolBarArea area, QToolBar *toolbar) | - |
| 283 | { | - |
| 284 | if (!checkToolBarArea(area, "QMainWindow::addToolBar")) partially evaluated: !checkToolBarArea(area, "QMainWindow::addToolBar")| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 285 | return; | 0 |
| 286 | | - |
| 287 | QMainWindowPrivate * const d = d_func(); | - |
| 288 | | - |
| 289 | disconnect(this, "2""iconSizeChanged(QSize)", | - |
| 290 | toolbar, "1""_q_updateIconSize(QSize)"); | - |
| 291 | disconnect(this, "2""toolButtonStyleChanged(Qt::ToolButtonStyle)", | - |
| 292 | toolbar, "1""_q_updateToolButtonStyle(Qt::ToolButtonStyle)"); | - |
| 293 | | - |
| 294 | if(toolbar->d_func()->state && toolbar->d_func()->state->dragging) { partially evaluated: toolbar->d_func()->state| no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: toolbar->d_func()->state->dragging | 0-2 |
| 295 | | - |
| 296 | | - |
| 297 | bool animated = isAnimated(); | - |
| 298 | setAnimated(false); | - |
| 299 | | - |
| 300 | toolbar->d_func()->endDrag(); | - |
| 301 | | - |
| 302 | setAnimated(animated); | - |
| 303 | | - |
| 304 | } | 0 |
| 305 | | - |
| 306 | if (!d->layout->usesHIToolBar(toolbar)) { partially evaluated: !d->layout->usesHIToolBar(toolbar)| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 307 | d->layout->removeWidget(toolbar); | - |
| 308 | } else { executed: }Execution Count:2 | 2 |
| 309 | d->layout->removeToolBar(toolbar); | - |
| 310 | } | 0 |
| 311 | | - |
| 312 | toolbar->d_func()->_q_updateIconSize(d->iconSize); | - |
| 313 | toolbar->d_func()->_q_updateToolButtonStyle(d->toolButtonStyle); | - |
| 314 | connect(this, "2""iconSizeChanged(QSize)", | - |
| 315 | toolbar, "1""_q_updateIconSize(QSize)"); | - |
| 316 | connect(this, "2""toolButtonStyleChanged(Qt::ToolButtonStyle)", | - |
| 317 | toolbar, "1""_q_updateToolButtonStyle(Qt::ToolButtonStyle)"); | - |
| 318 | | - |
| 319 | d->layout->addToolBar(area, toolbar); | - |
| 320 | } executed: }Execution Count:2 | 2 |
| 321 | | - |
| 322 | | - |
| 323 | | - |
| 324 | | - |
| 325 | void QMainWindow::addToolBar(QToolBar *toolbar) | - |
| 326 | { addToolBar(Qt::TopToolBarArea, toolbar); } executed: }Execution Count:2 | 2 |
| 327 | QToolBar *QMainWindow::addToolBar(const QString &title) | - |
| 328 | { | - |
| 329 | QToolBar *toolBar = new QToolBar(this); | - |
| 330 | toolBar->setWindowTitle(title); | - |
| 331 | addToolBar(toolBar); | - |
| 332 | return toolBar; executed: return toolBar;Execution Count:1 | 1 |
| 333 | } | - |
| 334 | void QMainWindow::insertToolBar(QToolBar *before, QToolBar *toolbar) | - |
| 335 | { | - |
| 336 | QMainWindowPrivate * const d = d_func(); | - |
| 337 | | - |
| 338 | d->layout->removeToolBar(toolbar); | - |
| 339 | | - |
| 340 | toolbar->d_func()->_q_updateIconSize(d->iconSize); | - |
| 341 | toolbar->d_func()->_q_updateToolButtonStyle(d->toolButtonStyle); | - |
| 342 | connect(this, "2""iconSizeChanged(QSize)", | - |
| 343 | toolbar, "1""_q_updateIconSize(QSize)"); | - |
| 344 | connect(this, "2""toolButtonStyleChanged(Qt::ToolButtonStyle)", | - |
| 345 | toolbar, "1""_q_updateToolButtonStyle(Qt::ToolButtonStyle)"); | - |
| 346 | | - |
| 347 | d->layout->insertToolBar(before, toolbar); | - |
| 348 | } | 0 |
| 349 | | - |
| 350 | | - |
| 351 | | - |
| 352 | | - |
| 353 | | - |
| 354 | void QMainWindow::removeToolBar(QToolBar *toolbar) | - |
| 355 | { | - |
| 356 | if (toolbar) { | 0 |
| 357 | d_func()->layout->removeToolBar(toolbar); | - |
| 358 | toolbar->hide(); | - |
| 359 | } | 0 |
| 360 | } | 0 |
| 361 | Qt::ToolBarArea QMainWindow::toolBarArea(QToolBar *toolbar) const | - |
| 362 | { return d_func()->layout->toolBarArea(toolbar); } never executed: return d_func()->layout->toolBarArea(toolbar); | 0 |
| 363 | bool QMainWindow::toolBarBreak(QToolBar *toolbar) const | - |
| 364 | { | - |
| 365 | return d_func()->layout->toolBarBreak(toolbar); never executed: return d_func()->layout->toolBarBreak(toolbar); | 0 |
| 366 | } | - |
| 367 | bool QMainWindow::isAnimated() const | - |
| 368 | { | - |
| 369 | const QMainWindowPrivate * const d = d_func(); | - |
| 370 | return d->layout->dockOptions & AnimatedDocks; never executed: return d->layout->dockOptions & AnimatedDocks; | 0 |
| 371 | } | - |
| 372 | | - |
| 373 | void QMainWindow::setAnimated(bool enabled) | - |
| 374 | { | - |
| 375 | QMainWindowPrivate * const d = d_func(); | - |
| 376 | | - |
| 377 | DockOptions opts = d->layout->dockOptions; | - |
| 378 | if (enabled) | 0 |
| 379 | opts |= AnimatedDocks; never executed: opts |= AnimatedDocks; | 0 |
| 380 | else | - |
| 381 | opts &= ~AnimatedDocks; never executed: opts &= ~AnimatedDocks; | 0 |
| 382 | | - |
| 383 | d->layout->setDockOptions(opts); | - |
| 384 | } | 0 |
| 385 | bool QMainWindow::isDockNestingEnabled() const | - |
| 386 | { | - |
| 387 | const QMainWindowPrivate * const d = d_func(); | - |
| 388 | return d->layout->dockOptions & AllowNestedDocks; never executed: return d->layout->dockOptions & AllowNestedDocks; | 0 |
| 389 | } | - |
| 390 | | - |
| 391 | void QMainWindow::setDockNestingEnabled(bool enabled) | - |
| 392 | { | - |
| 393 | QMainWindowPrivate * const d = d_func(); | - |
| 394 | | - |
| 395 | DockOptions opts = d->layout->dockOptions; | - |
| 396 | if (enabled) | 0 |
| 397 | opts |= AllowNestedDocks; never executed: opts |= AllowNestedDocks; | 0 |
| 398 | else | - |
| 399 | opts &= ~AllowNestedDocks; never executed: opts &= ~AllowNestedDocks; | 0 |
| 400 | | - |
| 401 | d->layout->setDockOptions(opts); | - |
| 402 | } | 0 |
| 403 | static bool checkDockWidgetArea(Qt::DockWidgetArea area, const char *where) | - |
| 404 | { | - |
| 405 | switch (area) { | - |
| 406 | case Qt::LeftDockWidgetArea: | - |
| 407 | case Qt::RightDockWidgetArea: | - |
| 408 | case Qt::TopDockWidgetArea: | - |
| 409 | case Qt::BottomDockWidgetArea: | - |
| 410 | return true; executed: return true;Execution Count:35 | 35 |
| 411 | default: | - |
| 412 | break; | 0 |
| 413 | } | - |
| 414 | QMessageLogger("widgets/qmainwindow.cpp", 962, __PRETTY_FUNCTION__).warning("%s: invalid 'area' argument", where); | - |
| 415 | return false; never executed: return false; | 0 |
| 416 | } | - |
| 417 | bool QMainWindow::documentMode() const | - |
| 418 | { | - |
| 419 | return d_func()->layout->documentMode(); never executed: return d_func()->layout->documentMode(); | 0 |
| 420 | } | - |
| 421 | | - |
| 422 | void QMainWindow::setDocumentMode(bool enabled) | - |
| 423 | { | - |
| 424 | d_func()->layout->setDocumentMode(enabled); | - |
| 425 | } | 0 |
| 426 | QTabWidget::TabShape QMainWindow::tabShape() const | - |
| 427 | { | - |
| 428 | return d_func()->layout->tabShape(); never executed: return d_func()->layout->tabShape(); | 0 |
| 429 | } | - |
| 430 | | - |
| 431 | void QMainWindow::setTabShape(QTabWidget::TabShape tabShape) | - |
| 432 | { | - |
| 433 | d_func()->layout->setTabShape(tabShape); | - |
| 434 | } | 0 |
| 435 | QTabWidget::TabPosition QMainWindow::tabPosition(Qt::DockWidgetArea area) const | - |
| 436 | { | - |
| 437 | if (!checkDockWidgetArea(area, "QMainWindow::tabPosition")) never evaluated: !checkDockWidgetArea(area, "QMainWindow::tabPosition") | 0 |
| 438 | return QTabWidget::South; never executed: return QTabWidget::South; | 0 |
| 439 | return d_func()->layout->tabPosition(area); never executed: return d_func()->layout->tabPosition(area); | 0 |
| 440 | } | - |
| 441 | void QMainWindow::setTabPosition(Qt::DockWidgetAreas areas, QTabWidget::TabPosition tabPosition) | - |
| 442 | { | - |
| 443 | d_func()->layout->setTabPosition(areas, tabPosition); | - |
| 444 | } | 0 |
| 445 | | - |
| 446 | | - |
| 447 | | - |
| 448 | | - |
| 449 | | - |
| 450 | void QMainWindow::addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget) | - |
| 451 | { | - |
| 452 | if (!checkDockWidgetArea(area, "QMainWindow::addDockWidget")) partially evaluated: !checkDockWidgetArea(area, "QMainWindow::addDockWidget")| no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
| 453 | return; | 0 |
| 454 | | - |
| 455 | Qt::Orientation orientation = Qt::Vertical; | - |
| 456 | switch (area) { | - |
| 457 | case Qt::TopDockWidgetArea: | - |
| 458 | case Qt::BottomDockWidgetArea: | - |
| 459 | orientation = Qt::Horizontal; | - |
| 460 | break; executed: break;Execution Count:4 | 4 |
| 461 | default: | - |
| 462 | break; executed: break;Execution Count:13 | 13 |
| 463 | } | - |
| 464 | d_func()->layout->removeWidget(dockwidget); | - |
| 465 | addDockWidget(area, dockwidget, orientation); | - |
| 466 | } executed: }Execution Count:17 | 17 |
| 467 | bool QMainWindow::restoreDockWidget(QDockWidget *dockwidget) | - |
| 468 | { | - |
| 469 | return d_func()->layout->restoreDockWidget(dockwidget); never executed: return d_func()->layout->restoreDockWidget(dockwidget); | 0 |
| 470 | } | - |
| 471 | | - |
| 472 | | - |
| 473 | | - |
| 474 | | - |
| 475 | | - |
| 476 | void QMainWindow::addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget, | - |
| 477 | Qt::Orientation orientation) | - |
| 478 | { | - |
| 479 | if (!checkDockWidgetArea(area, "QMainWindow::addDockWidget")) partially evaluated: !checkDockWidgetArea(area, "QMainWindow::addDockWidget")| no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
| 480 | return; | 0 |
| 481 | | - |
| 482 | | - |
| 483 | d_func()->layout->addDockWidget(area, dockwidget, orientation); | - |
| 484 | } executed: }Execution Count:18 | 18 |
| 485 | void QMainWindow::splitDockWidget(QDockWidget *after, QDockWidget *dockwidget, | - |
| 486 | Qt::Orientation orientation) | - |
| 487 | { | - |
| 488 | d_func()->layout->splitDockWidget(after, dockwidget, orientation); | - |
| 489 | } executed: }Execution Count:1 | 1 |
| 490 | void QMainWindow::tabifyDockWidget(QDockWidget *first, QDockWidget *second) | - |
| 491 | { | - |
| 492 | d_func()->layout->tabifyDockWidget(first, second); | - |
| 493 | } executed: }Execution Count:4 | 4 |
| 494 | QList<QDockWidget*> QMainWindow::tabifiedDockWidgets(QDockWidget *dockwidget) const | - |
| 495 | { | - |
| 496 | QList<QDockWidget*> ret; | - |
| 497 | | - |
| 498 | | - |
| 499 | | - |
| 500 | const QDockAreaLayoutInfo *info = d_func()->layout->layoutState.dockAreaLayout.info(dockwidget); | - |
| 501 | if (info && info->tabbed && info->tabBar) { never evaluated: info->tabbed never evaluated: info->tabBar | 0 |
| 502 | for(int i = 0; i < info->item_list.count(); ++i) { never evaluated: i < info->item_list.count() | 0 |
| 503 | const QDockAreaLayoutItem &item = info->item_list.at(i); | - |
| 504 | if (item.widgetItem) { never evaluated: item.widgetItem | 0 |
| 505 | if (QDockWidget *dock = qobject_cast<QDockWidget*>(item.widgetItem->widget())) { never evaluated: QDockWidget *dock = qobject_cast<QDockWidget*>(item.widgetItem->widget()) | 0 |
| 506 | if (dock != dockwidget) { never evaluated: dock != dockwidget | 0 |
| 507 | ret += dock; | - |
| 508 | } | 0 |
| 509 | } | 0 |
| 510 | } | 0 |
| 511 | } | 0 |
| 512 | } | 0 |
| 513 | | - |
| 514 | return ret; never executed: return ret; | 0 |
| 515 | } | - |
| 516 | | - |
| 517 | | - |
| 518 | | - |
| 519 | | - |
| 520 | | - |
| 521 | | - |
| 522 | void QMainWindow::removeDockWidget(QDockWidget *dockwidget) | - |
| 523 | { | - |
| 524 | if (dockwidget) { partially evaluated: dockwidget| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 525 | d_func()->layout->removeWidget(dockwidget); | - |
| 526 | dockwidget->hide(); | - |
| 527 | } executed: }Execution Count:1 | 1 |
| 528 | } executed: }Execution Count:1 | 1 |
| 529 | Qt::DockWidgetArea QMainWindow::dockWidgetArea(QDockWidget *dockwidget) const | - |
| 530 | { return d_func()->layout->dockWidgetArea(dockwidget); } executed: return d_func()->layout->dockWidgetArea(dockwidget);Execution Count:2 | 2 |
| 531 | QByteArray QMainWindow::saveState(int version) const | - |
| 532 | { | - |
| 533 | QByteArray data; | - |
| 534 | QDataStream stream(&data, QIODevice::WriteOnly); | - |
| 535 | stream << QMainWindowLayout::VersionMarker; | - |
| 536 | stream << version; | - |
| 537 | d_func()->layout->saveState(stream); | - |
| 538 | return data; executed: return data;Execution Count:2 | 2 |
| 539 | } | - |
| 540 | bool QMainWindow::restoreState(const QByteArray &state, int version) | - |
| 541 | { | - |
| 542 | if (state.isEmpty()) partially evaluated: state.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 543 | return false; never executed: return false; | 0 |
| 544 | QByteArray sd = state; | - |
| 545 | QDataStream stream(&sd, QIODevice::ReadOnly); | - |
| 546 | int marker, v; | - |
| 547 | stream >> marker; | - |
| 548 | stream >> v; | - |
| 549 | if (stream.status() != QDataStream::Ok || marker != QMainWindowLayout::VersionMarker || v != version) partially evaluated: stream.status() != QDataStream::Ok| no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: marker != QMainWindowLayout::VersionMarker| no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: v != version| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 550 | return false; never executed: return false; | 0 |
| 551 | bool restored = d_func()->layout->restoreState(stream); | - |
| 552 | return restored; executed: return restored;Execution Count:2 | 2 |
| 553 | } | - |
| 554 | | - |
| 555 | | - |
| 556 | QCursor QMainWindowPrivate::separatorCursor(const QList<int> &path) const | - |
| 557 | { | - |
| 558 | QDockAreaLayoutInfo *info = layout->layoutState.dockAreaLayout.info(path); | - |
| 559 | qt_noop(); | - |
| 560 | if (path.size() == 1) { never evaluated: path.size() == 1 | 0 |
| 561 | | - |
| 562 | switch (path.first()) { | - |
| 563 | case QInternal::LeftDock: | - |
| 564 | case QInternal::RightDock: | - |
| 565 | return Qt::SplitHCursor; never executed: return Qt::SplitHCursor; | 0 |
| 566 | case QInternal::TopDock: | - |
| 567 | case QInternal::BottomDock: | - |
| 568 | return Qt::SplitVCursor; never executed: return Qt::SplitVCursor; | 0 |
| 569 | default: | - |
| 570 | break; | 0 |
| 571 | } | - |
| 572 | } | 0 |
| 573 | | - |
| 574 | | - |
| 575 | | - |
| 576 | return info->o == Qt::Horizontal | 0 |
| 577 | ? Qt::SplitHCursor : Qt::SplitVCursor; never executed: return info->o == Qt::Horizontal ? Qt::SplitHCursor : Qt::SplitVCursor; | 0 |
| 578 | } | - |
| 579 | | - |
| 580 | void QMainWindowPrivate::adjustCursor(const QPoint &pos) | - |
| 581 | { | - |
| 582 | QMainWindow * const q = q_func(); | - |
| 583 | | - |
| 584 | hoverPos = pos; | - |
| 585 | | - |
| 586 | if (pos == QPoint(0, 0)) { evaluated: pos == QPoint(0, 0)| yes Evaluation Count:193 | yes Evaluation Count:28 |
| 28-193 |
| 587 | if (!hoverSeparator.isEmpty()) partially evaluated: !hoverSeparator.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:193 |
| 0-193 |
| 588 | q->update(layout->layoutState.dockAreaLayout.separatorRect(hoverSeparator)); never executed: q->update(layout->layoutState.dockAreaLayout.separatorRect(hoverSeparator)); | 0 |
| 589 | hoverSeparator.clear(); | - |
| 590 | | - |
| 591 | if (cursorAdjusted) { partially evaluated: cursorAdjusted| no Evaluation Count:0 | yes Evaluation Count:193 |
| 0-193 |
| 592 | cursorAdjusted = false; | - |
| 593 | if (hasOldCursor) never evaluated: hasOldCursor | 0 |
| 594 | q->setCursor(oldCursor); never executed: q->setCursor(oldCursor); | 0 |
| 595 | else | - |
| 596 | q->unsetCursor(); never executed: q->unsetCursor(); | 0 |
| 597 | } | - |
| 598 | } else if (layout->movingSeparator.isEmpty()) { executed: }Execution Count:193 partially evaluated: layout->movingSeparator.isEmpty()| yes Evaluation Count:28 | no Evaluation Count:0 |
| 0-193 |
| 599 | QList<int> pathToSeparator | - |
| 600 | = layout->layoutState.dockAreaLayout.findSeparator(pos); | - |
| 601 | | - |
| 602 | if (pathToSeparator != hoverSeparator) { partially evaluated: pathToSeparator != hoverSeparator| no Evaluation Count:0 | yes Evaluation Count:28 |
| 0-28 |
| 603 | if (!hoverSeparator.isEmpty()) never evaluated: !hoverSeparator.isEmpty() | 0 |
| 604 | q->update(layout->layoutState.dockAreaLayout.separatorRect(hoverSeparator)); never executed: q->update(layout->layoutState.dockAreaLayout.separatorRect(hoverSeparator)); | 0 |
| 605 | | - |
| 606 | hoverSeparator = pathToSeparator; | - |
| 607 | | - |
| 608 | if (hoverSeparator.isEmpty()) { never evaluated: hoverSeparator.isEmpty() | 0 |
| 609 | if (cursorAdjusted) { never evaluated: cursorAdjusted | 0 |
| 610 | cursorAdjusted = false; | - |
| 611 | if (hasOldCursor) never evaluated: hasOldCursor | 0 |
| 612 | q->setCursor(oldCursor); never executed: q->setCursor(oldCursor); | 0 |
| 613 | else | - |
| 614 | q->unsetCursor(); never executed: q->unsetCursor(); | 0 |
| 615 | } | - |
| 616 | } else { | 0 |
| 617 | q->update(layout->layoutState.dockAreaLayout.separatorRect(hoverSeparator)); | - |
| 618 | if (!cursorAdjusted) { never evaluated: !cursorAdjusted | 0 |
| 619 | oldCursor = q->cursor(); | - |
| 620 | hasOldCursor = q->testAttribute(Qt::WA_SetCursor); | - |
| 621 | } | 0 |
| 622 | adjustedCursor = separatorCursor(hoverSeparator); | - |
| 623 | q->setCursor(adjustedCursor); | - |
| 624 | cursorAdjusted = true; | - |
| 625 | } | 0 |
| 626 | } | - |
| 627 | } executed: }Execution Count:28 | 28 |
| 628 | } | - |
| 629 | | - |
| 630 | | - |
| 631 | | - |
| 632 | bool QMainWindow::event(QEvent *event) | - |
| 633 | { | - |
| 634 | QMainWindowPrivate * const d = d_func(); | - |
| 635 | switch (event->type()) { | - |
| 636 | | - |
| 637 | | - |
| 638 | case QEvent::Paint: { | - |
| 639 | QPainter p(this); | - |
| 640 | QRegion r = static_cast<QPaintEvent*>(event)->region(); | - |
| 641 | d->layout->layoutState.dockAreaLayout.paintSeparators(&p, this, r, d->hoverPos); | - |
| 642 | break; executed: break;Execution Count:89 | 89 |
| 643 | } | - |
| 644 | | - |
| 645 | | - |
| 646 | case QEvent::HoverMove: { | - |
| 647 | d->adjustCursor(static_cast<QHoverEvent*>(event)->pos()); | - |
| 648 | break; executed: break;Execution Count:28 | 28 |
| 649 | } | - |
| 650 | | - |
| 651 | | - |
| 652 | | - |
| 653 | case QEvent::HoverEnter: | - |
| 654 | return true; executed: return true;Execution Count:23 | 23 |
| 655 | case QEvent::HoverLeave: | - |
| 656 | d->adjustCursor(QPoint(0, 0)); | - |
| 657 | return true; executed: return true;Execution Count:6 | 6 |
| 658 | case QEvent::ShortcutOverride: | - |
| 659 | d->adjustCursor(QPoint(0, 0)); | - |
| 660 | break; executed: break;Execution Count:187 | 187 |
| 661 | | - |
| 662 | | - |
| 663 | case QEvent::MouseButtonPress: { | - |
| 664 | QMouseEvent *e = static_cast<QMouseEvent*>(event); | - |
| 665 | if (e->button() == Qt::LeftButton && d->layout->startSeparatorMove(e->pos())) { partially evaluated: e->button() == Qt::LeftButton| no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: d->layout->startSeparatorMove(e->pos()) | 0-1 |
| 666 | | - |
| 667 | e->accept(); | - |
| 668 | return true; never executed: return true; | 0 |
| 669 | } | - |
| 670 | break; executed: break;Execution Count:1 | 1 |
| 671 | } | - |
| 672 | | - |
| 673 | case QEvent::MouseMove: { | - |
| 674 | QMouseEvent *e = static_cast<QMouseEvent*>(event); | - |
| 675 | | - |
| 676 | | - |
| 677 | d->adjustCursor(e->pos()); | - |
| 678 | | - |
| 679 | if (e->buttons() & Qt::LeftButton) { never evaluated: e->buttons() & Qt::LeftButton | 0 |
| 680 | if (d->layout->separatorMove(e->pos())) { never evaluated: d->layout->separatorMove(e->pos()) | 0 |
| 681 | | - |
| 682 | e->accept(); | - |
| 683 | return true; never executed: return true; | 0 |
| 684 | } | - |
| 685 | } | 0 |
| 686 | | - |
| 687 | break; | 0 |
| 688 | } | - |
| 689 | | - |
| 690 | case QEvent::MouseButtonRelease: { | - |
| 691 | QMouseEvent *e = static_cast<QMouseEvent*>(event); | - |
| 692 | if (d->layout->endSeparatorMove(e->pos())) { never evaluated: d->layout->endSeparatorMove(e->pos()) | 0 |
| 693 | | - |
| 694 | e->accept(); | - |
| 695 | return true; never executed: return true; | 0 |
| 696 | } | - |
| 697 | break; | 0 |
| 698 | } | - |
| 699 | | - |
| 700 | | - |
| 701 | | - |
| 702 | | - |
| 703 | case QEvent::ToolBarChange: { | - |
| 704 | d->layout->toggleToolBarsVisible(); | - |
| 705 | return true; never executed: return true; | 0 |
| 706 | } | - |
| 707 | | - |
| 708 | | - |
| 709 | | - |
| 710 | case QEvent::StatusTip: | - |
| 711 | | - |
| 712 | if (QStatusBar *sb = d->layout->statusBar()) evaluated: QStatusBar *sb = d->layout->statusBar()| yes Evaluation Count:2 | yes Evaluation Count:83 |
| 2-83 |
| 713 | sb->showMessage(static_cast<QStatusTipEvent*>(event)->tip()); executed: sb->showMessage(static_cast<QStatusTipEvent*>(event)->tip());Execution Count:2 | 2 |
| 714 | else | - |
| 715 | | - |
| 716 | static_cast<QStatusTipEvent*>(event)->ignore(); executed: static_cast<QStatusTipEvent*>(event)->ignore();Execution Count:83 | 83 |
| 717 | return true; executed: return true;Execution Count:85 | 85 |
| 718 | | - |
| 719 | | - |
| 720 | case QEvent::StyleChange: | - |
| 721 | | - |
| 722 | d->layout->layoutState.dockAreaLayout.styleChangedEvent(); | - |
| 723 | | - |
| 724 | if (!d->explicitIconSize) partially evaluated: !d->explicitIconSize| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 725 | setIconSize(QSize()); executed: setIconSize(QSize());Execution Count:1 | 1 |
| 726 | break; executed: break;Execution Count:1 | 1 |
| 727 | case QEvent::CursorChange: | - |
| 728 | | - |
| 729 | | - |
| 730 | | - |
| 731 | if (d->cursorAdjusted && d->adjustedCursor.shape() != cursor().shape()) { partially evaluated: d->cursorAdjusted| no Evaluation Count:0 | yes Evaluation Count:87 |
never evaluated: d->adjustedCursor.shape() != cursor().shape() | 0-87 |
| 732 | d->oldCursor = cursor(); | - |
| 733 | d->hasOldCursor = testAttribute(Qt::WA_SetCursor); | - |
| 734 | | - |
| 735 | | - |
| 736 | setCursor(d->adjustedCursor); | - |
| 737 | } | 0 |
| 738 | break; executed: break;Execution Count:87 | 87 |
| 739 | | - |
| 740 | default: | - |
| 741 | break; executed: break;Execution Count:1754 | 1754 |
| 742 | } | - |
| 743 | | - |
| 744 | return QWidget::event(event); executed: return QWidget::event(event);Execution Count:2147 | 2147 |
| 745 | } | - |
| 746 | void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set) | - |
| 747 | { | - |
| 748 | (void)set; | - |
| 749 | | - |
| 750 | } | 0 |
| 751 | | - |
| 752 | bool QMainWindow::unifiedTitleAndToolBarOnMac() const | - |
| 753 | { | - |
| 754 | | - |
| 755 | | - |
| 756 | | - |
| 757 | return false; executed: return false;Execution Count:239 | 239 |
| 758 | } | - |
| 759 | | - |
| 760 | | - |
| 761 | | - |
| 762 | | - |
| 763 | | - |
| 764 | | - |
| 765 | bool QMainWindow::isSeparator(const QPoint &pos) const | - |
| 766 | { | - |
| 767 | | - |
| 768 | const QMainWindowPrivate * const d = d_func(); | - |
| 769 | return !d->layout->layoutState.dockAreaLayout.findSeparator(pos).isEmpty(); never executed: return !d->layout->layoutState.dockAreaLayout.findSeparator(pos).isEmpty(); | 0 |
| 770 | | - |
| 771 | | - |
| 772 | | - |
| 773 | | - |
| 774 | } | - |
| 775 | | - |
| 776 | | - |
| 777 | | - |
| 778 | | - |
| 779 | | - |
| 780 | void QMainWindow::contextMenuEvent(QContextMenuEvent *event) | - |
| 781 | { | - |
| 782 | event->ignore(); | - |
| 783 | | - |
| 784 | | - |
| 785 | QWidget *child = childAt(event->pos()); | - |
| 786 | while (child && child != this) { never evaluated: child != this | 0 |
| 787 | | - |
| 788 | if (QMenuBar *mb = qobject_cast<QMenuBar *>(child)) { never evaluated: QMenuBar *mb = qobject_cast<QMenuBar *>(child) | 0 |
| 789 | if (mb->parentWidget() != this) never evaluated: mb->parentWidget() != this | 0 |
| 790 | return; | 0 |
| 791 | break; | 0 |
| 792 | } | - |
| 793 | | - |
| 794 | | - |
| 795 | if (QDockWidget *dw = qobject_cast<QDockWidget *>(child)) { never evaluated: QDockWidget *dw = qobject_cast<QDockWidget *>(child) | 0 |
| 796 | if (dw->parentWidget() != this) never evaluated: dw->parentWidget() != this | 0 |
| 797 | return; | 0 |
| 798 | if (dw->widget() never evaluated: dw->widget() | 0 |
| 799 | && dw->widget()->geometry().contains(child->mapFrom(this, event->pos()))) { never evaluated: dw->widget()->geometry().contains(child->mapFrom(this, event->pos())) | 0 |
| 800 | | - |
| 801 | return; | 0 |
| 802 | } | - |
| 803 | break; | 0 |
| 804 | } | - |
| 805 | | - |
| 806 | | - |
| 807 | if (QToolBar *tb = qobject_cast<QToolBar *>(child)) { never evaluated: QToolBar *tb = qobject_cast<QToolBar *>(child) | 0 |
| 808 | if (tb->parentWidget() != this) never evaluated: tb->parentWidget() != this | 0 |
| 809 | return; | 0 |
| 810 | break; | 0 |
| 811 | } | - |
| 812 | | - |
| 813 | child = child->parentWidget(); | - |
| 814 | } | 0 |
| 815 | if (child == this) never evaluated: child == this | 0 |
| 816 | return; | 0 |
| 817 | | - |
| 818 | | - |
| 819 | QMenu *popup = createPopupMenu(); | - |
| 820 | if (popup) { | 0 |
| 821 | if (!popup->isEmpty()) { never evaluated: !popup->isEmpty() | 0 |
| 822 | popup->setAttribute(Qt::WA_DeleteOnClose); | - |
| 823 | popup->popup(event->globalPos()); | - |
| 824 | event->accept(); | - |
| 825 | } else { | 0 |
| 826 | delete popup; | - |
| 827 | } | 0 |
| 828 | } | - |
| 829 | | - |
| 830 | } | 0 |
| 831 | QMenu *QMainWindow::createPopupMenu() | - |
| 832 | { | - |
| 833 | QMainWindowPrivate * const d = d_func(); | - |
| 834 | QMenu *menu = 0; | - |
| 835 | | - |
| 836 | QList<QDockWidget *> dockwidgets = findChildren<QDockWidget *>(); | - |
| 837 | if (dockwidgets.size()) { never evaluated: dockwidgets.size() | 0 |
| 838 | menu = new QMenu(this); | - |
| 839 | for (int i = 0; i < dockwidgets.size(); ++i) { never evaluated: i < dockwidgets.size() | 0 |
| 840 | QDockWidget *dockWidget = dockwidgets.at(i); | - |
| 841 | if (dockWidget->parentWidget() == this never evaluated: dockWidget->parentWidget() == this | 0 |
| 842 | && !d->layout->layoutState.dockAreaLayout.indexOf(dockWidget).isEmpty()) { never evaluated: !d->layout->layoutState.dockAreaLayout.indexOf(dockWidget).isEmpty() | 0 |
| 843 | menu->addAction(dockwidgets.at(i)->toggleViewAction()); | - |
| 844 | } | 0 |
| 845 | } | 0 |
| 846 | menu->addSeparator(); | - |
| 847 | } | 0 |
| 848 | | - |
| 849 | | - |
| 850 | QList<QToolBar *> toolbars = findChildren<QToolBar *>(); | - |
| 851 | if (toolbars.size()) { never evaluated: toolbars.size() | 0 |
| 852 | if (!menu) | 0 |
| 853 | menu = new QMenu(this); never executed: menu = new QMenu(this); | 0 |
| 854 | for (int i = 0; i < toolbars.size(); ++i) { never evaluated: i < toolbars.size() | 0 |
| 855 | QToolBar *toolBar = toolbars.at(i); | - |
| 856 | if (toolBar->parentWidget() == this never evaluated: toolBar->parentWidget() == this | 0 |
| 857 | && (!d->layout->layoutState.toolBarAreaLayout.indexOf(toolBar).isEmpty() never evaluated: !d->layout->layoutState.toolBarAreaLayout.indexOf(toolBar).isEmpty() | 0 |
| 858 | || (unifiedTitleAndToolBarOnMac() never evaluated: unifiedTitleAndToolBarOnMac() | 0 |
| 859 | && toolBarArea(toolBar) == Qt::TopToolBarArea))) { never evaluated: toolBarArea(toolBar) == Qt::TopToolBarArea | 0 |
| 860 | menu->addAction(toolbars.at(i)->toggleViewAction()); | - |
| 861 | } | 0 |
| 862 | } | 0 |
| 863 | } | 0 |
| 864 | | - |
| 865 | (void)d;; | - |
| 866 | return menu; never executed: return menu; | 0 |
| 867 | } | - |
| 868 | | - |
| 869 | | - |
| 870 | | - |
| 871 | | - |
| | |