Qt 4.8
qmainwindow.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 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 //#define QT_EXPERIMENTAL_CLIENT_DECORATIONS
43 
44 #include "qmainwindow.h"
45 #include "qmainwindowlayout_p.h"
46 
47 #ifndef QT_NO_MAINWINDOW
48 
49 #include "qdockwidget.h"
50 #include "qtoolbar.h"
51 
52 #include <qapplication.h>
53 #include <qmenubar.h>
54 #include <qstatusbar.h>
55 #include <qevent.h>
56 #include <qstyle.h>
57 #include <qdebug.h>
58 #include <qpainter.h>
59 
60 #include <private/qwidget_p.h>
61 #include "qtoolbar_p.h"
62 #include "qwidgetanimator_p.h"
63 #ifdef Q_WS_MAC
64 #include <private/qt_mac_p.h>
65 #include <private/qt_cocoa_helpers_mac_p.h>
67 extern OSWindowRef qt_mac_window_for(const QWidget *); // qwidget_mac.cpp
69 #endif
70 
72 
74 {
76 public:
79 #ifdef Q_WS_MAC
80  , useHIToolBar(false)
81 #endif
82 #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR)
83  , hasOldCursor(false) , cursorAdjusted(false)
84 #endif
85  { }
90 #ifdef Q_WS_MAC
92 #endif
93  void init();
96 
97 #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR)
98  QCursor separatorCursor(const QList<int> &path) const;
99  void adjustCursor(const QPoint &pos);
103 #endif
104 
105  static inline QMainWindowLayout *mainWindowLayout(const QMainWindow *mainWindow)
106  {
107  return mainWindow ? mainWindow->d_func()->layout : static_cast<QMainWindowLayout *>(0);
108  }
109 };
110 
112 {
113  return QMainWindowPrivate::mainWindowLayout(mainWindow);
114 }
115 
116 #ifdef QT_EXPERIMENTAL_CLIENT_DECORATIONS
117 Q_GUI_EXPORT void qt_setMainWindowTitleWidget(QMainWindow *mainWindow, Qt::DockWidgetArea area, QWidget *widget)
118 {
119  QGridLayout *topLayout = qobject_cast<QGridLayout *>(mainWindow->layout());
120  Q_ASSERT(topLayout);
121 
122  int row = 0;
123  int column = 0;
124 
125  switch (area) {
127  row = 1;
128  column = 0;
129  break;
131  row = 0;
132  column = 1;
133  break;
135  row = 2;
136  column = 1;
137  break;
139  row = 1;
140  column = 2;
141  break;
142  default:
143  Q_ASSERT_X(false, "qt_setMainWindowTitleWidget", "Unknown area");
144  return;
145  }
146 
147  if (QLayoutItem *oldItem = topLayout->itemAtPosition(row, column))
148  delete oldItem->widget();
149  topLayout->addWidget(widget, row, column);
150 }
151 #endif
152 
154 {
155  Q_Q(QMainWindow);
156 
157 #ifdef QT_EXPERIMENTAL_CLIENT_DECORATIONS
158  QGridLayout *topLayout = new QGridLayout(q);
159  topLayout->setContentsMargins(0, 0, 0, 0);
160 
161  layout = new QMainWindowLayout(q, topLayout);
162 
163  topLayout->addItem(layout, 1, 1);
164 #else
165  layout = new QMainWindowLayout(q, 0);
166 #endif
167 
168  const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q);
169  iconSize = QSize(metric, metric);
170  q->setAttribute(Qt::WA_Hover);
171 }
172 
173 /*
174  The Main Window:
175 
176  +----------------------------------------------------------+
177  | Menu Bar |
178  +----------------------------------------------------------+
179  | Tool Bar Area |
180  | +--------------------------------------------------+ |
181  | | Dock Window Area | |
182  | | +------------------------------------------+ | |
183  | | | | | |
184  | | | Central Widget | | |
185  | | | | | |
186  | | | | | |
187  | | | | | |
188  | | | | | |
189  | | | | | |
190  | | | | | |
191  | | | | | |
192  | | | | | |
193  | | | | | |
194  | | | | | |
195  | | +------------------------------------------+ | |
196  | | | |
197  | +--------------------------------------------------+ |
198  | |
199  +----------------------------------------------------------+
200  | Status Bar |
201  +----------------------------------------------------------+
202 
203 */
204 
374 QMainWindow::QMainWindow(QWidget *parent, Qt::WindowFlags flags)
375  : QWidget(*(new QMainWindowPrivate()), parent, flags | Qt::Window)
376 {
377  d_func()->init();
378 }
379 
380 #ifdef QT3_SUPPORT
381 
389 QMainWindow::QMainWindow(QWidget *parent, const char *name, Qt::WindowFlags flags)
390  : QWidget(*(new QMainWindowPrivate()), parent, flags | Qt::WType_TopLevel)
391 {
393  d_func()->init();
394 }
395 #endif
396 
401 { }
402 
460 void QMainWindow::setDockOptions(DockOptions opt)
461 {
462  Q_D(QMainWindow);
463  d->layout->setDockOptions(opt);
464 }
465 
466 QMainWindow::DockOptions QMainWindow::dockOptions() const
467 {
468  Q_D(const QMainWindow);
469  return d->layout->dockOptions;
470 }
471 
473 { return d_func()->iconSize; }
474 
476 {
477  Q_D(QMainWindow);
478  QSize sz = iconSize;
479  if (!sz.isValid()) {
480  const int metric = style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, this);
481  sz = QSize(metric, metric);
482  }
483  if (d->iconSize != sz) {
484  d->iconSize = sz;
485  emit iconSizeChanged(d->iconSize);
486  }
487  d->explicitIconSize = iconSize.isValid();
488 }
489 
500 { return d_func()->toolButtonStyle; }
501 
503 {
504  Q_D(QMainWindow);
505  if (d->toolButtonStyle == toolButtonStyle)
506  return;
507  d->toolButtonStyle = toolButtonStyle;
508  emit toolButtonStyleChanged(d->toolButtonStyle);
509 }
510 
511 #ifndef QT_NO_MENUBAR
512 
528 {
530  if (!menuBar) {
531  QMainWindow *self = const_cast<QMainWindow *>(this);
532  menuBar = new QMenuBar(self);
533  self->setMenuBar(menuBar);
534  }
535  return menuBar;
536 }
537 
547 {
548  QLayout *topLayout = layout();
549 
550  if (topLayout->menuBar() && topLayout->menuBar() != menuBar) {
551  // Reparent corner widgets before we delete the old menu bar.
552  QMenuBar *oldMenuBar = qobject_cast<QMenuBar *>(topLayout->menuBar());
553  if (menuBar) {
554  // TopLeftCorner widget.
555  QWidget *cornerWidget = oldMenuBar->cornerWidget(Qt::TopLeftCorner);
556  if (cornerWidget)
557  menuBar->setCornerWidget(cornerWidget, Qt::TopLeftCorner);
558  // TopRightCorner widget.
559  cornerWidget = oldMenuBar->cornerWidget(Qt::TopRightCorner);
560  if (cornerWidget)
561  menuBar->setCornerWidget(cornerWidget, Qt::TopRightCorner);
562  }
563  oldMenuBar->hide();
564  oldMenuBar->deleteLater();
565  }
566  topLayout->setMenuBar(menuBar);
567 }
568 
579 {
580  QWidget *menuBar = d_func()->layout->menuBar();
581  return menuBar;
582 }
583 
596 {
597  Q_D(QMainWindow);
598  if (d->layout->menuBar() && d->layout->menuBar() != menuBar) {
599  d->layout->menuBar()->hide();
600  d->layout->menuBar()->deleteLater();
601  }
602  d->layout->setMenuBar(menuBar);
603 }
604 #endif // QT_NO_MENUBAR
605 
606 #ifndef QT_NO_STATUSBAR
607 
614 {
615  QStatusBar *statusbar = d_func()->layout->statusBar();
616  if (!statusbar) {
617  QMainWindow *self = const_cast<QMainWindow *>(this);
618  statusbar = new QStatusBar(self);
620  self->setStatusBar(statusbar);
621  }
622  return statusbar;
623 }
624 
635 {
636  Q_D(QMainWindow);
637  if (d->layout->statusBar() && d->layout->statusBar() != statusbar) {
638  d->layout->statusBar()->hide();
639  d->layout->statusBar()->deleteLater();
640  }
641  d->layout->setStatusBar(statusbar);
642 }
643 #endif // QT_NO_STATUSBAR
644 
652 { return d_func()->layout->centralWidget(); }
653 
663 {
664  Q_D(QMainWindow);
665  if (d->layout->centralWidget() && d->layout->centralWidget() != widget) {
666  d->layout->centralWidget()->hide();
667  d->layout->centralWidget()->deleteLater();
668  }
669  d->layout->setCentralWidget(widget);
670 }
671 
672 #ifndef QT_NO_DOCKWIDGET
673 
680 {
681  bool valid = false;
682  switch (corner) {
683  case Qt::TopLeftCorner:
684  valid = (area == Qt::TopDockWidgetArea || area == Qt::LeftDockWidgetArea);
685  break;
686  case Qt::TopRightCorner:
687  valid = (area == Qt::TopDockWidgetArea || area == Qt::RightDockWidgetArea);
688  break;
690  valid = (area == Qt::BottomDockWidgetArea || area == Qt::LeftDockWidgetArea);
691  break;
693  valid = (area == Qt::BottomDockWidgetArea || area == Qt::RightDockWidgetArea);
694  break;
695  }
696  if (!valid)
697  qWarning("QMainWindow::setCorner(): 'area' is not valid for 'corner'");
698  else
699  d_func()->layout->setCorner(corner, area);
700 }
701 
709 { return d_func()->layout->corner(corner); }
710 #endif
711 
712 #ifndef QT_NO_TOOLBAR
713 
714 static bool checkToolBarArea(Qt::ToolBarArea area, const char *where)
715 {
716  switch (area) {
717  case Qt::LeftToolBarArea:
719  case Qt::TopToolBarArea:
721  return true;
722  default:
723  break;
724  }
725  qWarning("%s: invalid 'area' argument", where);
726  return false;
727 }
728 
734 {
735  if (!checkToolBarArea(area, "QMainWindow::addToolBarBreak"))
736  return;
737  d_func()->layout->addToolBarBreak(area);
738 }
739 
744 { d_func()->layout->insertToolBarBreak(before); }
745 
751 {
752  Q_D(QMainWindow);
753  d->layout->removeToolBarBreak(before);
754 }
755 
765 {
766  if (!checkToolBarArea(area, "QMainWindow::addToolBar"))
767  return;
768 
769  Q_D(QMainWindow);
770 
772  toolbar, SLOT(_q_updateIconSize(QSize)));
774  toolbar, SLOT(_q_updateToolButtonStyle(Qt::ToolButtonStyle)));
775 
776  if(toolbar->d_func()->state && toolbar->d_func()->state->dragging) {
777  //removing a toolbar which is dragging will cause crash
778 #ifndef QT_NO_DOCKWIDGET
779  bool animated = isAnimated();
780  setAnimated(false);
781 #endif
782  toolbar->d_func()->endDrag();
783 #ifndef QT_NO_DOCKWIDGET
784  setAnimated(animated);
785 #endif
786  }
787 
788  if (!d->layout->usesHIToolBar(toolbar)) {
789  d->layout->removeWidget(toolbar);
790  } else {
791  d->layout->removeToolBar(toolbar);
792  }
793 
794  toolbar->d_func()->_q_updateIconSize(d->iconSize);
795  toolbar->d_func()->_q_updateToolButtonStyle(d->toolButtonStyle);
797  toolbar, SLOT(_q_updateIconSize(QSize)));
799  toolbar, SLOT(_q_updateToolButtonStyle(Qt::ToolButtonStyle)));
800 
801  d->layout->addToolBar(area, toolbar);
802 }
803 
808 { addToolBar(Qt::TopToolBarArea, toolbar); }
809 
822 {
823  QToolBar *toolBar = new QToolBar(this);
824  toolBar->setWindowTitle(title);
825  addToolBar(toolBar);
826  return toolBar;
827 }
828 
838 {
839  Q_D(QMainWindow);
840 
841  d->layout->removeToolBar(toolbar);
842 
843  toolbar->d_func()->_q_updateIconSize(d->iconSize);
844  toolbar->d_func()->_q_updateToolButtonStyle(d->toolButtonStyle);
846  toolbar, SLOT(_q_updateIconSize(QSize)));
848  toolbar, SLOT(_q_updateToolButtonStyle(Qt::ToolButtonStyle)));
849 
850  d->layout->insertToolBar(before, toolbar);
851 }
852 
858 {
859  if (toolbar) {
860  d_func()->layout->removeToolBar(toolbar);
861  toolbar->hide();
862  }
863 }
864 
873 { return d_func()->layout->toolBarArea(toolbar); }
874 
883 {
884  return d_func()->layout->toolBarBreak(toolbar);
885 }
886 
887 #endif // QT_NO_TOOLBAR
888 
889 #ifndef QT_NO_DOCKWIDGET
890 
915 {
916  Q_D(const QMainWindow);
917  return d->layout->dockOptions & AnimatedDocks;
918 }
919 
921 {
922  Q_D(QMainWindow);
923 
924  DockOptions opts = d->layout->dockOptions;
925  if (enabled)
926  opts |= AnimatedDocks;
927  else
928  opts &= ~AnimatedDocks;
929 
930  d->layout->setDockOptions(opts);
931 }
932 
957 {
958  Q_D(const QMainWindow);
959  return d->layout->dockOptions & AllowNestedDocks;
960 }
961 
963 {
964  Q_D(QMainWindow);
965 
966  DockOptions opts = d->layout->dockOptions;
967  if (enabled)
968  opts |= AllowNestedDocks;
969  else
970  opts &= ~AllowNestedDocks;
971 
972  d->layout->setDockOptions(opts);
973 }
974 
975 #if 0
976 
992 bool QMainWindow::verticalTabsEnabled() const
993 {
994  return d_func()->layout->verticalTabsEnabled();
995 }
996 
997 void QMainWindow::setVerticalTabsEnabled(bool enabled)
998 {
999  d_func()->layout->setVerticalTabsEnabled(enabled);
1000 }
1001 #endif
1002 
1003 static bool checkDockWidgetArea(Qt::DockWidgetArea area, const char *where)
1004 {
1005  switch (area) {
1008  case Qt::TopDockWidgetArea:
1010  return true;
1011  default:
1012  break;
1013  }
1014  qWarning("%s: invalid 'area' argument", where);
1015  return false;
1016 }
1017 
1018 #ifndef QT_NO_TABBAR
1019 
1031 bool QMainWindow::documentMode() const
1032 {
1033  return d_func()->layout->documentMode();
1034 }
1035 
1037 {
1038  d_func()->layout->setDocumentMode(enabled);
1039 }
1040 #endif // QT_NO_TABBAR
1041 
1042 #ifndef QT_NO_TABWIDGET
1043 
1056 {
1057  return d_func()->layout->tabShape();
1058 }
1059 
1061 {
1062  d_func()->layout->setTabShape(tabShape);
1063 }
1064 
1079 {
1080  if (!checkDockWidgetArea(area, "QMainWindow::tabPosition"))
1081  return QTabWidget::South;
1082  return d_func()->layout->tabPosition(area);
1083 }
1084 
1100 {
1101  d_func()->layout->setTabPosition(areas, tabPosition);
1102 }
1103 #endif // QT_NO_TABWIDGET
1104 
1109 {
1110  if (!checkDockWidgetArea(area, "QMainWindow::addDockWidget"))
1111  return;
1112 
1113  Qt::Orientation orientation = Qt::Vertical;
1114  switch (area) {
1115  case Qt::TopDockWidgetArea:
1117  orientation = Qt::Horizontal;
1118  break;
1119  default:
1120  break;
1121  }
1122  d_func()->layout->removeWidget(dockwidget); // in case it was already in here
1123  addDockWidget(area, dockwidget, orientation);
1124 
1125 #ifdef Q_WS_MAC //drawer support
1127  extern bool qt_mac_is_macdrawer(const QWidget *); //qwidget_mac.cpp
1128  if (qt_mac_is_macdrawer(dockwidget)) {
1129  extern bool qt_mac_set_drawer_preferred_edge(QWidget *, Qt::DockWidgetArea); //qwidget_mac.cpp
1130  window()->createWinId();
1131  dockwidget->window()->createWinId();
1132  qt_mac_set_drawer_preferred_edge(dockwidget, area);
1133  if (dockwidget->isVisible()) {
1134  dockwidget->hide();
1135  dockwidget->show();
1136  }
1137  }
1138 #endif
1139 }
1140 
1150 {
1151  return d_func()->layout->restoreDockWidget(dockwidget);
1152 }
1153 
1159  Qt::Orientation orientation)
1160 {
1161  if (!checkDockWidgetArea(area, "QMainWindow::addDockWidget"))
1162  return;
1163 
1164  // add a window to an area, placing done relative to the previous
1165  d_func()->layout->addDockWidget(area, dockwidget, orientation);
1166 }
1167 
1190  Qt::Orientation orientation)
1191 {
1192  d_func()->layout->splitDockWidget(after, dockwidget, orientation);
1193 }
1194 
1204 {
1205  d_func()->layout->tabifyDockWidget(first, second);
1206 }
1207 
1208 
1219 {
1220  QList<QDockWidget*> ret;
1221 #if defined(QT_NO_TABBAR)
1222  Q_UNUSED(dockwidget);
1223 #else
1224  const QDockAreaLayoutInfo *info = d_func()->layout->layoutState.dockAreaLayout.info(dockwidget);
1225  if (info && info->tabbed && info->tabBar) {
1226  for(int i = 0; i < info->item_list.count(); ++i) {
1227  const QDockAreaLayoutItem &item = info->item_list.at(i);
1228  if (item.widgetItem) {
1229  if (QDockWidget *dock = qobject_cast<QDockWidget*>(item.widgetItem->widget())) {
1230  if (dock != dockwidget) {
1231  ret += dock;
1232  }
1233  }
1234  }
1235  }
1236  }
1237 #endif
1238  return ret;
1239 }
1240 
1241 
1247 {
1248  if (dockwidget) {
1249  d_func()->layout->removeWidget(dockwidget);
1250  dockwidget->hide();
1251  }
1252 }
1253 
1262 { return d_func()->layout->dockWidgetArea(dockwidget); }
1263 
1264 #endif // QT_NO_DOCKWIDGET
1265 
1286 {
1287  QByteArray data;
1290  stream << version;
1291  d_func()->layout->saveState(stream);
1292  return data;
1293 }
1294 
1310 bool QMainWindow::restoreState(const QByteArray &state, int version)
1311 {
1312  if (state.isEmpty())
1313  return false;
1314  QByteArray sd = state;
1316  int marker, v;
1317  stream >> marker;
1318  stream >> v;
1319  if (stream.status() != QDataStream::Ok || marker != QMainWindowLayout::VersionMarker || v != version)
1320  return false;
1321  bool restored = d_func()->layout->restoreState(stream);
1322  return restored;
1323 }
1324 
1325 #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR)
1327 {
1328  QDockAreaLayoutInfo *info = layout->layoutState.dockAreaLayout.info(path);
1329  Q_ASSERT(info != 0);
1330  if (path.size() == 1) { // is this the "top-level" separator which separates a dock area
1331  // from the central widget?
1332  switch (path.first()) {
1333  case QInternal::LeftDock:
1334  case QInternal::RightDock:
1335  return Qt::SplitHCursor;
1336  case QInternal::TopDock:
1337  case QInternal::BottomDock:
1338  return Qt::SplitVCursor;
1339  default:
1340  break;
1341  }
1342  }
1343 
1344  // no, it's a splitter inside a dock area, separating two dock widgets
1345 
1346  return info->o == Qt::Horizontal
1348 }
1349 
1351 {
1352  Q_Q(QMainWindow);
1353 
1354  hoverPos = pos;
1355 
1356  if (pos == QPoint(0, 0)) {
1357  if (!hoverSeparator.isEmpty())
1358  q->update(layout->layoutState.dockAreaLayout.separatorRect(hoverSeparator));
1359  hoverSeparator.clear();
1360 
1361  if (cursorAdjusted) {
1362  cursorAdjusted = false;
1363  if (hasOldCursor)
1364  q->setCursor(oldCursor);
1365  else
1366  q->unsetCursor();
1367  }
1368  } else {
1369  QList<int> pathToSeparator
1370  = layout->layoutState.dockAreaLayout.findSeparator(pos);
1371 
1372  if (pathToSeparator != hoverSeparator) {
1373  if (!hoverSeparator.isEmpty())
1374  q->update(layout->layoutState.dockAreaLayout.separatorRect(hoverSeparator));
1375 
1376  hoverSeparator = pathToSeparator;
1377 
1378  if (hoverSeparator.isEmpty()) {
1379  if (cursorAdjusted) {
1380  cursorAdjusted = false;
1381  if (hasOldCursor)
1382  q->setCursor(oldCursor);
1383  else
1384  q->unsetCursor();
1385  }
1386  } else {
1387  q->update(layout->layoutState.dockAreaLayout.separatorRect(hoverSeparator));
1388  if (!cursorAdjusted) {
1389  oldCursor = q->cursor();
1390  hasOldCursor = q->testAttribute(Qt::WA_SetCursor);
1391  }
1392  QCursor cursor = separatorCursor(hoverSeparator);
1393  cursorAdjusted = false; //to not reset the oldCursor in event(CursorChange)
1394  q->setCursor(cursor);
1395  cursorAdjusted = true;
1396  }
1397  }
1398  }
1399 }
1400 #endif
1401 
1404 {
1405  Q_D(QMainWindow);
1406  switch (event->type()) {
1407 
1408 #ifndef QT_NO_DOCKWIDGET
1409  case QEvent::Paint: {
1410  QPainter p(this);
1411  QRegion r = static_cast<QPaintEvent*>(event)->region();
1412  d->layout->layoutState.dockAreaLayout.paintSeparators(&p, this, r, d->hoverPos);
1413  break;
1414  }
1415 
1416 #ifndef QT_NO_CURSOR
1417  case QEvent::HoverMove: {
1418  d->adjustCursor(static_cast<QHoverEvent*>(event)->pos());
1419  break;
1420  }
1421 
1422  // We don't want QWidget to call update() on the entire QMainWindow
1423  // on HoverEnter and HoverLeave, hence accept the event (return true).
1424  case QEvent::HoverEnter:
1425  return true;
1426  case QEvent::HoverLeave:
1427  d->adjustCursor(QPoint(0, 0));
1428  return true;
1429  case QEvent::ShortcutOverride: // when a menu pops up
1430  d->adjustCursor(QPoint(0, 0));
1431  break;
1432 #endif // QT_NO_CURSOR
1433 
1434  case QEvent::MouseButtonPress: {
1435  QMouseEvent *e = static_cast<QMouseEvent*>(event);
1436  if (e->button() == Qt::LeftButton && d->layout->startSeparatorMove(e->pos())) {
1437  // The click was on a separator, eat this event
1438  e->accept();
1439  return true;
1440  }
1441  break;
1442  }
1443 
1444  case QEvent::MouseMove: {
1445  QMouseEvent *e = static_cast<QMouseEvent*>(event);
1446 
1447 #ifndef QT_NO_CURSOR
1448  d->adjustCursor(e->pos());
1449 #endif
1450  if (e->buttons() & Qt::LeftButton) {
1451  if (d->layout->separatorMove(e->pos())) {
1452  // We're moving a separator, eat this event
1453  e->accept();
1454  return true;
1455  }
1456  }
1457 
1458  break;
1459  }
1460 
1462  QMouseEvent *e = static_cast<QMouseEvent*>(event);
1463  if (d->layout->endSeparatorMove(e->pos())) {
1464  // We've released a separator, eat this event
1465  e->accept();
1466  return true;
1467  }
1468  break;
1469  }
1470 
1471 #endif
1472 
1473 #ifndef QT_NO_TOOLBAR
1474  case QEvent::ToolBarChange: {
1475  d->layout->toggleToolBarsVisible();
1476  return true;
1477  }
1478 #endif
1479 
1480 #ifndef QT_NO_STATUSTIP
1481  case QEvent::StatusTip:
1482 #ifndef QT_NO_STATUSBAR
1483  if (QStatusBar *sb = d->layout->statusBar())
1484  sb->showMessage(static_cast<QStatusTipEvent*>(event)->tip());
1485  else
1486 #endif
1487  static_cast<QStatusTipEvent*>(event)->ignore();
1488  return true;
1489 #endif // QT_NO_STATUSTIP
1490 
1491  case QEvent::StyleChange:
1492 #ifndef QT_NO_DOCKWIDGET
1493  d->layout->layoutState.dockAreaLayout.styleChangedEvent();
1494 #endif
1495  if (!d->explicitIconSize)
1496  setIconSize(QSize());
1497  break;
1498 #ifdef Q_WS_MAC
1499  case QEvent::Show:
1500  d->layout->blockVisiblityCheck = false;
1502  d->layout->syncUnifiedToolbarVisibility();
1503  break;
1505  {
1506  if (isHidden()) {
1507  // We are coming out of a minimize, leave things as is.
1508  d->layout->blockVisiblityCheck = true;
1509  }
1510 # ifdef QT_MAC_USE_COCOA
1511  // We need to update the HIToolbar status when we go out of or into fullscreen.
1512  QWindowStateChangeEvent *wce = static_cast<QWindowStateChangeEvent *>(event);
1514  d->layout->updateHIToolBarStatus();
1515  }
1516 # endif // Cocoa
1517  }
1518  break;
1519 #endif // Q_WS_MAC
1520 #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR)
1521  case QEvent::CursorChange:
1522  if (d->cursorAdjusted) {
1523  d->oldCursor = cursor();
1524  d->hasOldCursor = testAttribute(Qt::WA_SetCursor);
1525  }
1526  break;
1527 #endif
1528  default:
1529  break;
1530  }
1531 
1532  return QWidget::event(event);
1533 }
1534 
1535 #ifndef QT_NO_TOOLBAR
1536 
1568 {
1569 #ifdef Q_WS_MAC
1570  Q_D(QMainWindow);
1571  if (!isWindow() || d->useHIToolBar == set || QSysInfo::MacintoshVersion < QSysInfo::MV_10_3)
1572  return;
1573 
1574  d->useHIToolBar = set;
1575  createWinId(); // We need the hiview for down below.
1576 
1577 #ifdef QT_MAC_USE_COCOA
1578  // Activate the unified toolbar with the raster engine.
1579  if (windowSurface() && set) {
1580  d->layout->unifiedSurface = new QUnifiedToolbarSurface(this);
1581  }
1582 #endif // QT_MAC_USE_COCOA
1583 
1584  d->layout->updateHIToolBarStatus();
1585 
1586 #ifdef QT_MAC_USE_COCOA
1587  // Deactivate the unified toolbar with the raster engine.
1588  if (windowSurface() && !set) {
1589  if (d->layout->unifiedSurface) {
1590  delete d->layout->unifiedSurface;
1591  d->layout->unifiedSurface = 0;
1592  }
1593  }
1594 #endif // QT_MAC_USE_COCOA
1595 
1596  // Enabling the unified toolbar clears the opaque size grip setting, update it.
1597  d->macUpdateOpaqueSizeGrip();
1598 #else
1599  Q_UNUSED(set)
1600 #endif
1601 }
1602 
1604 {
1605 #ifdef Q_WS_MAC
1606  return d_func()->useHIToolBar && !testAttribute(Qt::WA_MacBrushedMetal) && !(windowFlags() & Qt::FramelessWindowHint);
1607 #endif
1608  return false;
1609 }
1610 
1611 #endif // QT_NO_TOOLBAR
1612 
1617 {
1618 #ifndef QT_NO_DOCKWIDGET
1619  Q_D(const QMainWindow);
1620  return !d->layout->layoutState.dockAreaLayout.findSeparator(pos).isEmpty();
1621 #else
1622  Q_UNUSED(pos);
1623  return false;
1624 #endif
1625 }
1626 
1627 #ifndef QT_NO_CONTEXTMENU
1628 
1632 {
1633  event->ignore();
1634  // only show the context menu for direct QDockWidget and QToolBar
1635  // children and for the menu bar as well
1636  QWidget *child = childAt(event->pos());
1637  while (child && child != this) {
1638 #ifndef QT_NO_MENUBAR
1639  if (QMenuBar *mb = qobject_cast<QMenuBar *>(child)) {
1640  if (mb->parentWidget() != this)
1641  return;
1642  break;
1643  }
1644 #endif
1645 #ifndef QT_NO_DOCKWIDGET
1646  if (QDockWidget *dw = qobject_cast<QDockWidget *>(child)) {
1647  if (dw->parentWidget() != this)
1648  return;
1649  if (dw->widget()
1650  && dw->widget()->geometry().contains(child->mapFrom(this, event->pos()))) {
1651  // ignore the event if the mouse is over the QDockWidget contents
1652  return;
1653  }
1654  break;
1655  }
1656 #endif // QT_NO_DOCKWIDGET
1657 #ifndef QT_NO_TOOLBAR
1658  if (QToolBar *tb = qobject_cast<QToolBar *>(child)) {
1659  if (tb->parentWidget() != this)
1660  return;
1661  break;
1662  }
1663 #endif
1664  child = child->parentWidget();
1665  }
1666  if (child == this)
1667  return;
1668 
1669 #ifndef QT_NO_MENU
1670  QMenu *popup = createPopupMenu();
1671  if (popup) {
1672  if (!popup->isEmpty()) {
1674  popup->popup(event->globalPos());
1675  event->accept();
1676  } else {
1677  delete popup;
1678  }
1679  }
1680 #endif
1681 }
1682 #endif // QT_NO_CONTEXTMENU
1683 
1684 #ifndef QT_NO_MENU
1685 
1701 {
1702  Q_D(QMainWindow);
1703  QMenu *menu = 0;
1704 #ifndef QT_NO_DOCKWIDGET
1705  QList<QDockWidget *> dockwidgets = findChildren<QDockWidget *>();
1706  if (dockwidgets.size()) {
1707  menu = new QMenu(this);
1708  for (int i = 0; i < dockwidgets.size(); ++i) {
1709  QDockWidget *dockWidget = dockwidgets.at(i);
1710  if (dockWidget->parentWidget() == this
1711  && !d->layout->layoutState.dockAreaLayout.indexOf(dockWidget).isEmpty()) {
1712  menu->addAction(dockwidgets.at(i)->toggleViewAction());
1713  }
1714  }
1715  menu->addSeparator();
1716  }
1717 #endif // QT_NO_DOCKWIDGET
1718 #ifndef QT_NO_TOOLBAR
1719  QList<QToolBar *> toolbars = findChildren<QToolBar *>();
1720  if (toolbars.size()) {
1721  if (!menu)
1722  menu = new QMenu(this);
1723  for (int i = 0; i < toolbars.size(); ++i) {
1724  QToolBar *toolBar = toolbars.at(i);
1725  if (toolBar->parentWidget() == this
1726  && (!d->layout->layoutState.toolBarAreaLayout.indexOf(toolBar).isEmpty()
1728  && toolBarArea(toolBar) == Qt::TopToolBarArea))) {
1729  menu->addAction(toolbars.at(i)->toggleViewAction());
1730  }
1731  }
1732  }
1733 #endif
1734  Q_UNUSED(d);
1735  return menu;
1736 }
1737 #endif // QT_NO_MENU
1738 
1740 
1741 #endif // QT_NO_MAINWINDOW
QPoint pos() const
T qobject_cast(QObject *object)
Definition: qobject.h:375
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
double d
Definition: qnumeric_p.h:62
Status status() const
Returns the status of the data stream.
bool enabled
whether the widget is enabled
Definition: qwidget.h:157
Qt::WindowStates oldState() const
Returns the state of the window before the change.
Definition: qevent.h:712
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
virtual QMenu * createPopupMenu()
Returns a popup menu containing checkable entries for the toolbars and dock widgets present in the ma...
QList< QDockAreaLayoutItem > item_list
QLayoutItem * itemAtPosition(int row, int column) const
Returns the layout item that occupies cell (row, column), or 0 if the cell is empty.
void setDockNestingEnabled(bool enabled)
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition: qcursor.h:89
static mach_timebase_info_data_t info
void setTabPosition(Qt::DockWidgetAreas areas, QTabWidget::TabPosition tabPosition)
Sets the tab position for the given dock widget areas to the specified tabPosition.
void setCentralWidget(QWidget *widget)
Sets the given widget to be the main window&#39;s central widget.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
int metric(PaintDeviceMetric) const
Internal implementation of the virtual QPaintDevice::metric() function.
QPointer< QWidget > widget
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
Definition: qstring.cpp:4276
bool unifiedTitleAndToolBarOnMac() const
QCursor cursor() const
Qt::WindowStates windowState() const
Returns the current window state.
Definition: qwidget.cpp:3086
The QDockWidget class provides a widget that can be docked inside a QMainWindow or floated as a top-l...
Definition: qdockwidget.h:60
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
void popup(const QPoint &pos, QAction *at=0)
Displays the menu so that the action atAction will be at the specified global position p...
Definition: qmenu.cpp:1847
QMainWindow(QWidget *parent=0, Qt::WindowFlags flags=0)
Constructs a QMainWindow with the given parent and the specified widget flags.
The QContextMenuEvent class contains parameters that describe a context menu event.
Definition: qevent.h:396
QAction * toggleViewAction() const
Returns a checkable action that can be used to show or close this dock widget.
bool isVisible() const
Definition: qwidget.h:1005
const QPoint & pos() const
Returns the position of the mouse pointer relative to the widget that received the event...
Definition: qevent.h:412
void splitDockWidget(QDockWidget *after, QDockWidget *dockwidget, Qt::Orientation orientation)
Splits the space covered by the first dock widget into two parts, moves the first dock widget into th...
TabPosition
This enum type defines where QTabWidget draws the tab row:
Definition: qtabwidget.h:112
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
void adjustCursor(const QPoint &pos)
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
DockOptions dockOptions() const
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
#define SLOT(a)
Definition: qobjectdefs.h:226
Qt::DockWidgetArea corner(Qt::Corner corner) const
Returns the dock widget area that occupies the specified corner.
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
Qt::ToolButtonStyle toolButtonStyle() const
static bool ignore(const char *test, const char *const *table)
Definition: qaxserver.cpp:660
void insertToolBarBreak(QToolBar *before)
Inserts a toolbar break before the toolbar specified by before.
Qt::DockWidgetArea dockWidgetArea(QDockWidget *dockwidget) const
Returns the Qt::DockWidgetArea for dockwidget.
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
The QString class provides a Unicode character string.
Definition: qstring.h:83
T * qobject_cast(QObject *object)
Definition: qobject.h:375
QList< QDockWidget * > tabifiedDockWidgets(QDockWidget *dockwidget) const
Returns the dock widgets that are tabified together with dockwidget.
void setAnimated(bool enabled)
QAction * addAction(const QString &text)
This convenience function creates a new action with text.
Definition: qmenu.cpp:1453
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void setIconSize(const QSize &iconSize)
#define Q_D(Class)
Definition: qglobal.h:2482
QWidget * menuBar() const
Returns the menu bar set for this layout, or 0 if no menu bar is set.
Definition: qlayout.cpp:1149
NSToolbar * toolbar
QWidget * centralWidget() const
Returns the central widget for the main window.
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
Definition: qevent.h:95
QStyle * style() const
Definition: qwidget.cpp:2742
void setStatusBar(QStatusBar *statusbar)
Sets the status bar for the main window to statusbar.
void setObjectName(const QString &name)
Definition: qobject.cpp:1112
#define Q_Q(Class)
Definition: qglobal.h:2483
The QStatusBar class provides a horizontal bar suitable for presenting status information.
Definition: qstatusbar.h:57
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008
void contextMenuEvent(QContextMenuEvent *event)
Reimplemented Function
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static bool checkDockWidgetArea(Qt::DockWidgetArea area, const char *where)
void setWindowTitle(const QString &)
Definition: qwidget.cpp:6312
void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle)
This signal is emitted when the style used for tool buttons in the window is changed.
QWidget * cornerWidget(Qt::Corner corner=Qt::TopRightCorner) const
Returns the widget on the left of the first or on the right of the last menu item, depending on corner.
Definition: qmenubar.cpp:2022
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QTabWidget::TabPosition tabPosition(Qt::DockWidgetArea area) const
Returns the tab position for area.
bool isEmpty() const
Returns true if there are no visible actions inserted into the menu, false otherwise.
Definition: qmenu.cpp:1737
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Definition: qlayoutitem.h:64
static FILE * stream
bool restoreState(const QByteArray &state, int version=0)
Restores the state of this mainwindow&#39;s toolbars and dockwidgets.
WindowRef OSWindowRef
Qt::ToolBarArea toolBarArea(QToolBar *toolbar) const
Returns the Qt::ToolBarArea for toolbar.
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
void update()
Updates the layout for parentWidget().
Definition: qlayout.cpp:1225
QWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a widget which is a child of parent, with widget flags set to f.
Definition: qwidget.cpp:1189
QMainWindowLayout * qt_mainwindow_layout(const QMainWindow *mainWindow)
The QToolBar class provides a movable panel that contains a set of controls.
Definition: qtoolbar.h:62
The QLayout class is the base class of geometry managers.
Definition: qlayout.h:90
const char * name
QWidget * childAt(int x, int y) const
Returns the visible child widget at the position ({x}, {y}) in the widget&#39;s coordinate system...
Definition: qwidget.h:934
QAction * toggleViewAction() const
Returns a checkable action that can be used to show or hide this toolbar.
Definition: qtoolbar.cpp:1327
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
void tabifyDockWidget(QDockWidget *first, QDockWidget *second)
Moves second dock widget on top of first dock widget, creating a tabbed docked area in the main windo...
static bool checkToolBarArea(Qt::ToolBarArea area, const char *where)
QWidgetData * data
Definition: qwidget.h:815
Q_CORE_EXPORT void qWarning(const char *,...)
QAction * addSeparator()
This convenience function creates a new separator action, i.e.
Definition: qmenu.cpp:1583
unsigned int uint
Definition: qglobal.h:996
QWindowSurface * windowSurface() const
Returns the QWindowSurface this widget will be drawn into.
Definition: qwidget.cpp:12819
QCursor separatorCursor(const QList< int > &path) const
OSWindowRef qt_mac_window_for(const QWidget *)
Definition: qwidget_mac.mm:484
QWidget * menuWidget() const
Returns the menu bar for the main window.
QSize iconSize() const
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
#define QT_NO_CURSOR
void setMenuBar(QWidget *w)
Tells the geometry manager to place the menu bar widget at the top of parentWidget(), outside QWidget::contentsMargins().
Definition: qlayout.cpp:1131
bool toolBarBreak(QToolBar *toolbar) const
Returns whether there is a toolbar break before the toolbar.
void show()
Shows the widget and its child widgets.
Qt::MouseButton button() const
Returns the button that caused the event.
Definition: qevent.h:101
bool event(QEvent *event)
Reimplemented Function
void setTabShape(QTabWidget::TabShape tabShape)
void removeDockWidget(QDockWidget *dockwidget)
Removes the dockwidget from the main window layout and hides it.
void hide()
Hides the widget.
Definition: qwidget.h:501
QMenuBar * menuBar() const
Returns the menu bar for the main window.
#define QT_NO_DOCKWIDGET
ToolBarArea
Definition: qnamespace.h:1353
void setCorner(Qt::Corner corner, Qt::DockWidgetArea area)
Sets the given dock widget area to occupy the specified corner.
Corner
Definition: qnamespace.h:1456
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
T & first()
Returns a reference to the first item in the list.
Definition: qlist.h:282
void setCornerWidget(QWidget *w, Qt::Corner corner=Qt::TopRightCorner)
This sets the given widget to be shown directly on the left of the first menu item, or on the right of the last menu item, depending on corner.
Definition: qmenubar.cpp:1980
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
Definition: qobject.cpp:2895
DockWidgetArea
Definition: qnamespace.h:1337
bool isAnimated() const
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget)
Adds the given dockwidget to the specified area.
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
~QMainWindow()
Destroys the main window.
The QMenuBar class provides a horizontal menu bar.
Definition: qmenubar.h:62
bool isDockNestingEnabled() const
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
Definition: qevent.h:102
The QWindowStateChangeEvent class provides the window state before a window state change...
Definition: qevent.h:705
void addToolBar(Qt::ToolBarArea area, QToolBar *toolbar)
Adds the toolbar into the specified area in this main window.
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus...
Definition: qmenu.h:72
void setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle)
QTabWidget::TabShape tabShape() const
void insertToolBar(QToolBar *before, QToolBar *toolbar)
Inserts the toolbar into the area occupied by the before toolbar so that it appears before it...
The QStatusTipEvent class provides an event that is used to show messages in a status bar...
Definition: qevent.h:606
void setDockOptions(DockOptions options)
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QGridLayout class lays out widgets in a grid.
Definition: qgridlayout.h:60
The QMainWindow class provides a main application window.
Definition: qmainwindow.h:63
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
void setDocumentMode(bool enabled)
bool documentMode() const
if(void) toggleToolbarShown
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
Definition: qsize.h:123
Definition: qnamespace.h:54
bool qt_mac_set_drawer_preferred_edge(QWidget *w, Qt::DockWidgetArea where)
Definition: qwidget_mac.mm:321
bool isSeparator(const QPoint &pos) const
void addToolBarBreak(Qt::ToolBarArea area=Qt::TopToolBarArea)
Adds a toolbar break to the given area after all the other objects that are present.
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
QObject * parent
Definition: qobject.h:92
void setContentsMargins(int left, int top, int right, int bottom)
Sets the left, top, right, and bottom margins to use around the layout.
Definition: qlayout.cpp:502
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
void createWinId()
Definition: qwidget.cpp:2626
static QMainWindowLayout * mainWindowLayout(const QMainWindow *mainWindow)
QLayout * layout() const
Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed...
Definition: qwidget.cpp:10073
static const MacVersion MacintoshVersion
the version of the Macintosh operating system on which the application is run (Mac only)...
Definition: qglobal.h:1646
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
Definition: qcoreevent.h:309
QByteArray saveState(int version=0) const
Saves the current state of this mainwindow&#39;s toolbars and dockwidgets.
void removeToolBarBreak(QToolBar *before)
Removes a toolbar break previously inserted before the toolbar specified by before.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
ToolButtonStyle
Definition: qnamespace.h:1572
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:71
const QPoint & globalPos() const
Returns the global position of the mouse pointer at the time of the event.
Definition: qevent.h:413
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
bool event(QEvent *)
This is the main event handler; it handles event event.
Definition: qwidget.cpp:8636
void addWidget(QWidget *w)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qgridlayout.h:116
QStatusBar * statusBar() const
Returns the status bar for the main window.
QPoint mapFrom(QWidget *, const QPoint &) const
Translates the widget coordinate pos from the coordinate system of parent to this widget&#39;s coordinate...
Definition: qwidget.cpp:4433
void setUnifiedTitleAndToolBarOnMac(bool set)
The QPaintEvent class contains event parameters for paint events.
Definition: qevent.h:298
QMainWindowLayout * layout
Definition: qmainwindow.cpp:86
void setSizePolicy(QSizePolicy)
Definition: qwidget.cpp:10198
Orientation
Definition: qnamespace.h:174
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
bool qt_mac_is_macdrawer(const QWidget *w)
Definition: qwidget_mac.mm:306
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
bool animated
whether manipulating dock widgets and tool bars is animated
Definition: qmainwindow.h:72
void deleteLater()
Schedules this object for deletion.
Definition: qobject.cpp:2145
bool restoreDockWidget(QDockWidget *dockwidget)
Restores the state of dockwidget if it is created after the call to restoreState().
friend class QUnifiedToolbarSurface
Definition: qwidget.h:782
void setMenuWidget(QWidget *menubar)
Sets the menu bar for the main window to menuBar.
void addItem(QLayoutItem *item, int row, int column, int rowSpan=1, int columnSpan=1, Qt::Alignment=0)
Adds item at position row, column, spanning rowSpan rows and columnSpan columns, and aligns it accord...
void removeToolBar(QToolBar *toolbar)
Removes the toolbar from the main window layout and hides it.
TabShape
This enum type defines the shape of the tabs:
Definition: qtabwidget.h:126
void iconSizeChanged(const QSize &iconSize)
This signal is emitted when the size of the icons used in the window is changed.
void setMenuBar(QMenuBar *menubar)
Sets the menu bar for the main window to menuBar.
Qt::ToolButtonStyle toolButtonStyle
Definition: qmainwindow.cpp:89
static int area(const QSize &s)
Definition: qicon.cpp:155
QLayoutItem * widgetItem
QList< int > hoverSeparator
Definition: qmainwindow.cpp:94