12#include "MainWindowInstantiator_p.h"
13#include "MainWindowQuick_p.h"
16#include "DockWidgetInstantiator_p.h"
18#include "../DockRegistry_p.h"
22MainWindowInstantiator::MainWindowInstantiator()
27QString MainWindowInstantiator::uniqueName()
const
32void MainWindowInstantiator::setUniqueName(
const QString &name)
34 if (name != m_uniqueName) {
36 Q_EMIT uniqueNameChanged();
40MainWindowOptions MainWindowInstantiator::options()
const
45void MainWindowInstantiator::setOptions(MainWindowOptions options)
47 if (m_options != options) {
49 Q_EMIT optionsChanged();
53QStringList MainWindowInstantiator::affinities()
const
55 return m_mainWindow ? m_mainWindow->affinities() :
QStringList();
58bool 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 });
75void 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);
83void MainWindowInstantiator::layoutEqually()
86 m_mainWindow->layoutEqually();
89void MainWindowInstantiator::layoutParentContainerEqually(
DockWidgetBase *dw)
92 m_mainWindow->layoutParentContainerEqually(dw);
98 m_mainWindow->moveToSideBar(dw);
104 m_mainWindow->moveToSideBar(dw, loc);
107void MainWindowInstantiator::restoreFromSideBar(
DockWidgetBase *dw)
110 m_mainWindow->restoreFromSideBar(dw);
116 m_mainWindow->overlayOnSideBar(dw);
119void MainWindowInstantiator::toggleOverlayOnSideBar(
DockWidgetBase *dw)
122 m_mainWindow->toggleOverlayOnSideBar(dw);
125void MainWindowInstantiator::clearSideBarOverlay(
bool deleteFrame)
128 m_mainWindow->clearSideBarOverlay(deleteFrame);
131SideBar *MainWindowInstantiator::sideBarForDockWidget(
const DockWidgetBase *dw)
const
133 return m_mainWindow ? m_mainWindow->sideBarForDockWidget(dw) :
nullptr;
136bool MainWindowInstantiator::sideBarIsVisible(
SideBarLocation loc)
const
138 return m_mainWindow && m_mainWindow->sideBarIsVisible(loc);
141bool MainWindowInstantiator::closeDockWidgets(
bool force)
143 return m_mainWindow && m_mainWindow->closeDockWidgets(force);
146void MainWindowInstantiator::classBegin()
151void 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);
MainWindow sub-class which uses MDI as a layout.
MainWindow sub-class which uses MDI as a layout.