12 #include "MainWindowInstantiator_p.h"
13 #include "MainWindowQuick_p.h"
16 #include "DockWidgetInstantiator_p.h"
18 #include "../DockRegistry_p.h"
22 MainWindowInstantiator::MainWindowInstantiator()
27 QString MainWindowInstantiator::uniqueName()
const
32 void MainWindowInstantiator::setUniqueName(
const QString &name)
34 if (name != m_uniqueName) {
36 Q_EMIT uniqueNameChanged();
40 MainWindowOptions MainWindowInstantiator::options()
const
45 void MainWindowInstantiator::setOptions(MainWindowOptions options)
47 if (m_options != options) {
49 Q_EMIT optionsChanged();
53 QStringList MainWindowInstantiator::affinities()
const
55 return m_mainWindow ? m_mainWindow->affinities() :
QStringList();
58 bool MainWindowInstantiator::isMDI()
const
60 return m_mainWindow && m_mainWindow->isMDI();
68 qWarning() << Q_FUNC_INFO <<
"No MainWindow created yet";
72 m_mainWindow->addDockWidget(dockWidget, location, relativeTo, { option, initialSize });
75 void MainWindowInstantiator::addDockWidget(DockWidgetInstantiator *dockWidget,
Location location,
76 DockWidgetInstantiator *relativeTo,
QSize initialSize,
79 addDockWidget(dockWidget ? dockWidget->dockWidget() :
nullptr, location,
80 relativeTo ? relativeTo->dockWidget() :
nullptr, initialSize, option);
83 void MainWindowInstantiator::layoutEqually()
86 m_mainWindow->layoutEqually();
89 void MainWindowInstantiator::layoutParentContainerEqually(
DockWidgetBase *dw)
92 m_mainWindow->layoutParentContainerEqually(dw);
98 m_mainWindow->moveToSideBar(dw);
104 m_mainWindow->moveToSideBar(dw, loc);
107 void MainWindowInstantiator::restoreFromSideBar(
DockWidgetBase *dw)
110 m_mainWindow->restoreFromSideBar(dw);
116 m_mainWindow->overlayOnSideBar(dw);
119 void MainWindowInstantiator::toggleOverlayOnSideBar(
DockWidgetBase *dw)
122 m_mainWindow->toggleOverlayOnSideBar(dw);
125 void MainWindowInstantiator::clearSideBarOverlay(
bool deleteFrame)
128 m_mainWindow->clearSideBarOverlay(deleteFrame);
131 SideBar *MainWindowInstantiator::sideBarForDockWidget(
const DockWidgetBase *dw)
const
133 return m_mainWindow ? m_mainWindow->sideBarForDockWidget(dw) :
nullptr;
136 bool MainWindowInstantiator::sideBarIsVisible(
SideBarLocation loc)
const
138 return m_mainWindow && m_mainWindow->sideBarIsVisible(loc);
141 bool MainWindowInstantiator::closeDockWidgets(
bool force)
143 return m_mainWindow && m_mainWindow->closeDockWidgets(force);
146 void MainWindowInstantiator::classBegin()
151 void MainWindowInstantiator::componentComplete()
153 if (m_uniqueName.isEmpty()) {
154 qWarning() << Q_FUNC_INFO
155 <<
"Each DockWidget need an unique name. Set the uniqueName property.";
159 if (DockRegistry::self()->containsMainWindow(m_uniqueName)) {
164 if (m_uniqueName.isEmpty()) {
165 qWarning() << Q_FUNC_INFO <<
"Name can't be empty";
170 qWarning() << Q_FUNC_INFO <<
"Main window is already initialized";
174 const auto mainWindowOptions = MainWindowOptions(m_options);
179 m_mainWindow =
new MainWindowQuick(m_uniqueName, mainWindowOptions,
this);