48 #include <QHBoxLayout>
56 using namespace DISPLIB;
64 Qt::WindowFlags flags)
65 : QMainWindow(parent, flags)
67 m_sSettingsPath = sSettingsPath;
68 this->setDockNestingEnabled(
true);
69 if(QWidget* pCentralWidget = this->centralWidget()) {
70 pCentralWidget->hide();
86 pDockWidget->setObjectName(sName);
87 pDockWidget->setWindowTitle(sName);
88 pDockWidget->setWidget(pWidget);
92 pDockWidget->setFeatures(QDockWidget::DockWidgetClosable);
95 if(pWidget->layout() && pDockWidget->layout()){
96 pWidget->layout()->setContentsMargins(0,0,0,0);
97 pDockWidget->layout()->setContentsMargins(0,0,0,0);
100 this->addDockWidget(Qt::DockWidgetArea::TopDockWidgetArea, pDockWidget);
102 connect(pDockWidget, &MultiViewWindow::dockLocationChanged, [=]() {
103 emit dockLocationChanged(pWidget);
112 const QString& sName)
115 pDockWidget->setObjectName(sName);
116 pDockWidget->setWindowTitle(sName);
117 pDockWidget->setWidget(pWidget);
119 pWidget->setParent(pDockWidget);
123 pDockWidget->setFeatures(QDockWidget::DockWidgetClosable);
126 if(pWidget->layout() && pDockWidget->layout()){
127 pWidget->layout()->setContentsMargins(0,0,0,0);
128 pDockWidget->layout()->setContentsMargins(0,0,0,0);
131 if(m_lDockWidgets.isEmpty()) {
132 this->addDockWidget(Qt::DockWidgetArea::BottomDockWidgetArea, pDockWidget);
135 for(
int i = 0; i < m_lDockWidgets.size(); ++i) {
136 this->tabifyDockWidget(m_lDockWidgets.at(i), pDockWidget);
139 m_lDockWidgets.append(pDockWidget);
141 connect(pDockWidget, &MultiViewWindow::dockLocationChanged, [=]() {
142 emit dockLocationChanged(pWidget);
152 if(m_sSettingsPath.isEmpty()) {
153 qWarning() <<
"[MultiView::saveSettings] Settings path not set for main window. Cannot save central widget state.";
157 QSettings settings(
"MNECPP");
159 settings.beginGroup(m_sSettingsPath + QString(
"/MultiView"));
160 settings.setValue(
"geometry", saveGeometry());
161 settings.setValue(
"state", saveState());
169 if(m_sSettingsPath.isEmpty()) {
170 qWarning() <<
"[MultiView::loadSettings] Settings path not set for main window. Cannot load central widget state.";
174 QSettings settings(
"MNECPP");
176 settings.beginGroup(m_sSettingsPath + QString(
"/MultiView"));
177 restoreGeometry(settings.value(
"geometry").toByteArray());
178 restoreState(settings.value(
"state").toByteArray());