9#if QT_CONFIG(dockwidget)
21#if QT_CONFIG(statusbar)
30#include <private/qwidget_p.h>
35#include <QtGui/qpa/qplatformwindow.h>
36#include <QtGui/qpa/qplatformwindow_p.h>
49 , useUnifiedToolBar(
false)
57 bool useUnifiedToolBar;
72#ifdef QT_EXPERIMENTAL_CLIENT_DECORATIONS
99 Q_ASSERT_X(
false,
"qt_setMainWindowTitleWidget",
"Unknown area");
104 delete oldItem->widget();
113#ifdef QT_EXPERIMENTAL_CLIENT_DECORATIONS
127 q->setAcceptDrops(
true);
310#if QT_CONFIG(dockwidget)
400 d->layout->setDockOptions(
opt);
406 return d->layout->dockOptions;
410{
return d_func()->iconSize; }
420 if (
d->iconSize != sz) {
438{
return d_func()->toolButtonStyle; }
449#if QT_CONFIG(menubar)
465QMenuBar *QMainWindow::menuBar()
const
488 if (
QWidget *existingMenuBar = topLayout->
menuBar(); existingMenuBar && existingMenuBar !=
menuBar) {
490 QMenuBar *oldMenuBar = qobject_cast<QMenuBar *>(existingMenuBar);
502 existingMenuBar->hide();
503 existingMenuBar->setParent(
nullptr);
504 existingMenuBar->deleteLater();
515QWidget *QMainWindow::menuWidget()
const
532 if (
d->layout->menuBar() &&
d->layout->menuBar() !=
menuBar) {
533 d->layout->menuBar()->hide();
534 d->layout->menuBar()->deleteLater();
540#if QT_CONFIG(statusbar)
554 self->setStatusBar(statusbar);
568void QMainWindow::setStatusBar(
QStatusBar *statusbar)
571 if (
d->layout->statusBar() &&
d->layout->statusBar() != statusbar) {
572 d->layout->statusBar()->hide();
573 d->layout->statusBar()->deleteLater();
575 d->layout->setStatusBar(statusbar);
586{
return d_func()->
layout->centralWidget(); }
599 if (
d->layout->centralWidget() &&
d->layout->centralWidget() !=
widget) {
600 d->layout->centralWidget()->hide();
601 d->layout->centralWidget()->deleteLater();
603 d->layout->setCentralWidget(
widget);
616 QWidget *oldcentralwidget =
d->layout->centralWidget();
617 if (oldcentralwidget) {
619 d->layout->setCentralWidget(
nullptr);
621 return oldcentralwidget;
624#if QT_CONFIG(dockwidget)
649 qWarning(
"QMainWindow::setCorner(): 'area' is not valid for 'corner'");
651 d_func()->layout->setCorner(corner,
area);
661{
return d_func()->layout->corner(corner); }
664#if QT_CONFIG(toolbar)
677 qWarning(
"%s: invalid 'area' argument", where);
687 if (!checkToolBarArea(
area,
"QMainWindow::addToolBarBreak"))
689 d_func()->layout->addToolBarBreak(
area);
695void QMainWindow::insertToolBarBreak(
QToolBar *before)
696{ d_func()->layout->insertToolBarBreak(before); }
702void QMainWindow::removeToolBarBreak(
QToolBar *before)
705 d->layout->removeToolBarBreak(before);
718 if (!checkToolBarArea(
area,
"QMainWindow::addToolBar"))
724 toolbar,
SLOT(_q_updateIconSize(
QSize)));
728 if (toolbar->d_func()->state && toolbar->d_func()->state->dragging) {
730#if QT_CONFIG(dockwidget)
731 bool animated = isAnimated();
734 toolbar->d_func()->endDrag();
735#if QT_CONFIG(dockwidget)
736 setAnimated(animated);
740 d->layout->removeToolBar(toolbar);
742 toolbar->d_func()->_q_updateIconSize(
d->iconSize);
743 toolbar->d_func()->_q_updateToolButtonStyle(
d->toolButtonStyle);
745 toolbar,
SLOT(_q_updateIconSize(
QSize)));
749 d->layout->addToolBar(
area, toolbar);
755void QMainWindow::addToolBar(
QToolBar *toolbar)
786 d->layout->removeToolBar(toolbar);
788 toolbar->d_func()->_q_updateIconSize(
d->iconSize);
789 toolbar->d_func()->_q_updateToolButtonStyle(
d->toolButtonStyle);
791 toolbar,
SLOT(_q_updateIconSize(
QSize)));
795 d->layout->insertToolBar(before, toolbar);
802void QMainWindow::removeToolBar(
QToolBar *toolbar)
805 d_func()->layout->removeToolBar(toolbar);
818{
return d_func()->layout->toolBarArea(toolbar); }
827bool QMainWindow::toolBarBreak(
QToolBar *toolbar)
const
829 return d_func()->layout->toolBarBreak(toolbar);
834#if QT_CONFIG(dockwidget)
856bool QMainWindow::isAnimated()
const
862void QMainWindow::setAnimated(
bool enabled)
866 DockOptions opts =
d->layout->dockOptions;
869 d->layout->setDockOptions(opts);
892bool QMainWindow::isDockNestingEnabled()
const
898void QMainWindow::setDockNestingEnabled(
bool enabled)
902 DockOptions opts =
d->layout->dockOptions;
905 d->layout->setDockOptions(opts);
924bool QMainWindow::verticalTabsEnabled()
const
926 return d_func()->layout->verticalTabsEnabled();
929void QMainWindow::setVerticalTabsEnabled(
bool enabled)
931 d_func()->layout->setVerticalTabsEnabled(
enabled);
946 qWarning(
"%s: invalid 'area' argument", where);
960bool QMainWindow::documentMode()
const
962 return d_func()->layout->documentMode();
965void QMainWindow::setDocumentMode(
bool enabled)
967 d_func()->layout->setDocumentMode(
enabled);
971#if QT_CONFIG(tabwidget)
983 return d_func()->layout->tabShape();
988 d_func()->layout->setTabShape(tabShape);
1003 if (!checkDockWidgetArea(
area,
"QMainWindow::tabPosition"))
1005 return d_func()->layout->tabPosition(
area);
1021 d_func()->layout->setTabPosition(areas, tabPosition);
1030 if (!checkDockWidgetArea(
area,
"QMainWindow::addDockWidget"))
1042 d_func()->layout->removeWidget(dockwidget);
1043 addDockWidget(
area, dockwidget, orientation);
1054bool QMainWindow::restoreDockWidget(
QDockWidget *dockwidget)
1056 return d_func()->layout->restoreDockWidget(dockwidget);
1066 if (!checkDockWidgetArea(
area,
"QMainWindow::addDockWidget"))
1070 d_func()->layout->addDockWidget(
area, dockwidget, orientation);
1097 d_func()->layout->splitDockWidget(after, dockwidget, orientation);
1100#if QT_CONFIG(tabbar)
1111 d_func()->layout->tabifyDockWidget(
first, second);
1131 if (
item.widgetItem) {
1132 if (
QDockWidget *dock = qobject_cast<QDockWidget*>(
item.widgetItem->widget())) {
1133 if (dock != dockwidget) {
1149void QMainWindow::removeDockWidget(
QDockWidget *dockwidget)
1152 d_func()->layout->removeWidget(dockwidget);
1165{
return d_func()->layout->dockWidgetArea(dockwidget); }
1190 d_func()->layout->layoutState.dockAreaLayout.resizeDocks(docks,
sizes, orientation);
1191 d_func()->layout->invalidate();
1225 d_func()->layout->saveState(
stream);
1247 if (
state.isEmpty())
1257 bool restored = d_func()->layout->restoreState(
stream);
1266#if QT_CONFIG(dockwidget)
1267 if (
d->layout &&
d->layout->windowEvent(
event))
1271 switch (
event->type()) {
1273#if QT_CONFIG(toolbar)
1276 d->layout->toggleToolBarsVisible();
1281#if QT_CONFIG(statustip)
1283#if QT_CONFIG(statusbar)
1294#if QT_CONFIG(dockwidget)
1296 d->layout->layoutState.dockAreaLayout.styleChangedEvent();
1298 if (!
d->explicitIconSize)
1301#if QT_CONFIG(draganddrop)
1304 if (!
d->layout->draggingWidget)
1309 if (!
d->layout->draggingWidget)
1311 auto dragMoveEvent =
static_cast<QDragMoveEvent *
>(
event);
1312 d->layout->hover(
d->layout->draggingWidget, dragMoveEvent->position().toPoint());
1324#if QT_CONFIG(toolbar)
1338void QMainWindow::setUnifiedTitleAndToolBarOnMac(
bool enabled)
1357 platformWindow->setContentBorderEnabled(
enabled);
1365bool QMainWindow::unifiedTitleAndToolBarOnMac()
const
1368 return d_func()->useUnifiedToolBar;
1380#if QT_CONFIG(dockwidget)
1382 return !
d->layout->layoutState.dockAreaLayout.findSeparator(
pos).isEmpty();
1389#ifndef QT_NO_CONTEXTMENU
1400#if QT_CONFIG(menubar)
1402 if (mb->parentWidget() !=
this)
1407#if QT_CONFIG(dockwidget)
1409 if (dw->parentWidget() !=
this)
1412 && dw->widget()->geometry().contains(
child->mapFrom(
this,
event->pos()))) {
1419#if QT_CONFIG(toolbar)
1421 if (tb->parentWidget() !=
this)
1432 QMenu *popup = createPopupMenu();
1462QMenu *QMainWindow::createPopupMenu()
1466#if QT_CONFIG(dockwidget)
1468 if (dockwidgets.
size()) {
1470 for (
int i = 0;
i < dockwidgets.
size(); ++
i) {
1474 if (
d->layout->layoutState.dockAreaLayout.indexOf(
dockWidget).isEmpty())
1478 if (dwgw->parentWidget() !=
this)
1480 if (dwgw->layoutInfo()->indexOf(
dockWidget).isEmpty())
1490#if QT_CONFIG(toolbar)
1492 if (toolbars.
size()) {
1495 for (
int i = 0;
i < toolbars.
size(); ++
i) {
1498 && (!
d->layout->layoutState.toolBarAreaLayout.indexOf(toolBar).isEmpty())) {
1511#include "moc_qmainwindow.cpp"
\inmodule QtCore\reentrant
qint64 size() const
Returns the file size in bytes.
The QGridLayout class lays out widgets in a grid.
void addWidget(QWidget *w)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QLayoutItem * itemAtPosition(int row, int column) const
void addItem(QLayoutItem *item, int row, int column, int rowSpan=1, int columnSpan=1, Qt::Alignment=Qt::Alignment())
Adds item at position row, column, spanning rowSpan rows and columnSpan columns, and aligns it accord...
The QLayoutItem class provides an abstract item that a QLayout manipulates.
The QLayout class is the base class of geometry managers.
QWidget * menuBar() const
Returns the menu bar set for this layout, or \nullptr if no menu bar is set.
void setMenuBar(QWidget *w)
Tells the geometry manager to place the menu bar widget at the top of parentWidget(),...
void setContentsMargins(int left, int top, int right, int bottom)
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
Qt::ToolButtonStyle toolButtonStyle
QMainWindowLayout * layout
static QMainWindowLayout * mainWindowLayout(const QMainWindow *mainWindow)
The QMainWindow class provides a main application window.
void iconSizeChanged(const QSize &iconSize)
This signal is emitted when the size of the icons used in the window is changed.
QByteArray saveState(int version=0) const
Saves the current state of this mainwindow's toolbars and dockwidgets.
DockOptions dockOptions
the docking behavior of QMainWindow
void contextMenuEvent(QContextMenuEvent *event) override
\reimp
bool event(QEvent *event) override
\reimp
void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle)
This signal is emitted when the style used for tool buttons in the window is changed.
QSize iconSize
size of toolbar icons in this mainwindow.
QWidget * takeCentralWidget()
Removes the central widget from this main window.
void setIconSize(const QSize &iconSize)
QWidget * centralWidget() const
Returns the central widget for the main window.
QMainWindow(QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags())
Constructs a QMainWindow with the given parent and the specified widget flags.
Qt::ToolButtonStyle toolButtonStyle
style of toolbar buttons in this mainwindow.
bool isSeparator(const QPoint &pos) const
friend class QDockWidgetGroupWindow
void setCentralWidget(QWidget *widget)
Sets the given widget to be the main window's central widget.
void setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle)
void setDockOptions(DockOptions options)
bool restoreState(const QByteArray &state, int version=0)
Restores the state of this mainwindow's toolbars and dockwidgets.
~QMainWindow()
Destroys the main window.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
\inmodule QtCore\reentrant
constexpr bool isValid() const noexcept
Returns true if both the width and height is equal to or greater than 0; otherwise returns false.
The QStatusBar class provides a horizontal bar suitable for presenting status information.
The QStatusTipEvent class provides an event that is used to show messages in a status bar.
\macro QT_RESTRICTED_CAST_FROM_ASCII
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
Returns the value of the given pixel metric.
Combined button and popup list for selecting options.
@ WA_TranslucentBackground
MyMainWidget * mainWindow
static int area(const QSize &s)
QMainWindowLayout * qt_mainwindow_layout(const QMainWindow *mainWindow)
GLsizei const GLfloat * v
[13]
GLuint64 GLenum void * handle
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei void GLsizei void * column
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLsizei void * row
#define Q_ASSERT_X(cond, x, msg)
QFileInfo info(fileName)
[8]
myObject disconnect()
[26]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent