23#include "private/DockRegistry_p.h"
24#include "private/DropAreaWithCentralFrame_p.h"
25#include "private/DropArea_p.h"
26#include "private/Frame_p.h"
27#include "private/Logging_p.h"
28#include "private/SideBar_p.h"
40class MyCentralWidget :
public QWidget
49 ~MyCentralWidget()
override;
53class MainWindow::Private
58 , m_supportsAutoHide(
Config::self().flags() &
Config::Flag_AutoHideSupport)
59 , m_centralWidget(
new MyCentralWidget(mainWindow))
62 if (m_supportsAutoHide) {
69 m_layout->setSpacing(0);
76 m_layout->setContentsMargins(m_centerWidgetMargins *
factor);
80 const bool m_supportsAutoHide;
82 MyCentralWidget *
const m_centralWidget;
84 QMargins m_centerWidgetMargins = { 1, 5, 1, 1 };
87MyCentralWidget::~MyCentralWidget() =
default;
93 , d(new Private(options, this))
95 if (d->m_supportsAutoHide) {
109 setCentralWidget(d->m_centralWidget);
135void MainWindow::setCentralWidget(
QWidget *w)
142 return d->m_sideBars.value(location);
153 return d->m_centerWidgetMargins;
158 if (d->m_centerWidgetMargins == margins)
160 d->m_centerWidgetMargins = margins;
Application-wide config to tune certain behaviours of the framework.
QMainWindow sub-class to enable KDDockWidgets support.
The MainWindow base-class. MainWindow and MainWindowBase are only split in two so we can share some c...
void onResized(QResizeEvent *)
LayoutWidget * layoutWidget() const
void onCloseEvent(QCloseEvent *)
The QMainwindow sub-class that the application should use to be able to dock KDDockWidget::DockWidget...
~MainWindow() override
Destructor.
void resizeEvent(QResizeEvent *) override
void closeEvent(QCloseEvent *) override
QRect centralAreaGeometry() const override
QMargins centerWidgetMargins() const override
void setCenterWidgetMargins(QMargins)
QHBoxLayout * internalLayout() const
returns the internal layout this is rarely needed unless you want to layout other widgets next to the...
MainWindow(const QString &uniqueName, MainWindowOptions options=MainWindowOption_None, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags())
Constructor. Use it as you would use QMainWindow.
SideBar * sideBar(SideBarLocation) const override
returns the sidebar for the specified location
QWidget * centralWidget() const const
void setCentralWidget(QWidget *widget)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setObjectName(const QString &name)
QObject * parent() const const
T qobject_cast(QObject *object)
void screenChanged(QScreen *screen)