22#include "ViewWrapper_p.h"
23#include "core/DockRegistry_p.h"
28#include "core/Window_p.h"
31#include "core/Logging_p.h"
44class MyCentralWidget :
public QWidget
53 ~MyCentralWidget()
override;
57class MainWindow::Private
62 , m_controller(qq->mainWindow())
63 , m_supportsAutoHide(
Config::self().flags() &
Config::Flag_AutoHideSupport)
64 , m_centralWidget(new MyCentralWidget(qq))
77 m_layout->setContentsMargins(m_centerWidgetMargins * factor);
82 const bool m_supportsAutoHide;
83 MyCentralWidget *
const m_centralWidget;
85 QMargins m_centerWidgetMargins = { 1, 5, 1, 1 };
88MyCentralWidget::~MyCentralWidget() =
default;
94 , MainWindowViewInterface(static_cast<Core::
MainWindow *>(controller()))
95 , d(new Private(this))
97 m_mainWindow->init(uniqueName);
99 d->m_layout->setSpacing(0);
102 if (d->m_supportsAutoHide) {
103 d->m_layout->addWidget(
104 View_qt::asQWidget(d->m_controller->sideBar(SideBarLocation::West)->view()));
106 innerVLayout->setSpacing(0);
107 innerVLayout->setContentsMargins(0, 0, 0, 0);
108 innerVLayout->addWidget(
109 View_qt::asQWidget(d->m_controller->sideBar(SideBarLocation::North)));
110 innerVLayout->addWidget(View_qt::asQWidget(d->m_controller->layout()));
111 innerVLayout->addWidget(
112 View_qt::asQWidget(d->m_controller->sideBar(SideBarLocation::South)));
113 d->m_layout->addLayout(innerVLayout);
114 d->m_layout->addWidget(View_qt::asQWidget(d->m_controller->sideBar(SideBarLocation::East)));
116 d->m_layout->addWidget(View_qt::asQWidget(d->m_controller->layout()->view()));
119 setCentralWidget(d->m_centralWidget);
121 const bool isWindow = !parentWidget() || (flags &
Qt::Window);
133 window()->onScreenChanged(
this, [](
QObject *context,
auto window) {
134 if (
auto mw = qobject_cast<MainWindow *>(context))
146void MainWindow::setCentralWidget(
QWidget *w)
153 return d->m_centerWidgetMargins;
158 if (d->m_centerWidgetMargins == margins)
160 d->m_centerWidgetMargins = margins;
182 return View_qt::asQWidget(view.get());
Application-wide config to tune certain behaviours of the framework.
MainWindow *const m_mainWindow
The MainWindow base-class. MainWindow and MainWindowBase are only split in two so we can share some c...
std::shared_ptr< View > persistentCentralView() const
void setPersistentCentralView(std::shared_ptr< View > widget)
Sets a persistent central widget. It can't be detached.
The QMainwindow sub-class that the application should use to be able to dock KDDockWidget DockWidget ...
void setPersistentCentralWidget(QWidget *widget)
QHBoxLayout * internalLayout() const
returns the internal layout this is rarely needed unless you want to layout other widgets next to the...
void setContentsMargins(int left, int top, int right, int bottom) override
Sets the main window's content margins.
~MainWindow() override
Destructor.
QWidget * persistentCentralWidget() const
friend class Core::MainWindow
void setCenterWidgetMargins(QMargins)
sets the margins for the contents widget
QMargins centerWidgetMargins() const override
returns the margins for the contents widget
void updateMargins()
for internal use only
QRect centralAreaGeometry() const override
A MultiSplitter with support for drop indicators when hovering over.
The MainWindow base-class that's shared between QtWidgets and QtQuick stack.
QWidget * centralWidget() const const
void setCentralWidget(QWidget *widget)
void setObjectName(const QString &name)
QObject * parent() const const
QMainWindow sub-class to enable KDDockWidgets support.
void setContentsMargins(int left, int top, int right, int bottom)