@@ -223,6 +223,7 @@ void MainWindow::on_awake()
223223 ui->actionScriptSettings ->setEnabled (frm && !frm->canStopScript ());
224224 _actionRunMode->setEnabled (frm && !frm->canStopScript ());
225225
226+ ui->actionTabbedView ->setChecked (ui->mdiArea ->viewMode () == QMdiArea::TabbedView);
226227 ui->actionToolbar ->setChecked (ui->toolBarMain ->isVisible ());
227228 ui->actionStatusBar ->setChecked (statusBar ()->isVisible ());
228229 ui->actionDisplayBar ->setChecked (ui->toolBarDisplay ->isVisible ());
@@ -231,6 +232,9 @@ void MainWindow::on_awake()
231232 ui->actionEnglish ->setChecked (_lang == " en" );
232233 ui->actionRussian ->setChecked (_lang == " ru" );
233234
235+ ui->actionTile ->setEnabled (ui->mdiArea ->viewMode () == QMdiArea::SubWindowView);
236+ ui->actionCascade ->setEnabled (ui->mdiArea ->viewMode () == QMdiArea::SubWindowView);
237+
234238 if (ui->mdiArea ->subWindowList ().empty ())
235239 {
236240 ui->toolBarEdit ->setVisible (false );
@@ -865,6 +869,19 @@ void MainWindow::on_actionCaptureOff_triggered()
865869 frm->stopTextCapture ();
866870}
867871
872+ // /
873+ // / \brief MainWindow::on_actionTabbedView_triggered
874+ // /
875+ void MainWindow::on_actionTabbedView_triggered ()
876+ {
877+ if (ui->mdiArea ->viewMode () == QMdiArea::SubWindowView) {
878+ ui->mdiArea ->setViewMode (QMdiArea::TabbedView);
879+ }
880+ else {
881+ ui->mdiArea ->setViewMode (QMdiArea::SubWindowView);
882+ }
883+ }
884+
868885// /
869886// / \brief MainWindow::on_actionToolbar_triggered
870887// /
@@ -1782,17 +1799,20 @@ void MainWindow::loadSettings()
17821799 setGeometry (geometry);
17831800 }
17841801
1785- const auto displaybarArea = (Qt::ToolBarArea)qBound (0 , m.value (" DisplayBarArea" , 0x4 ).toInt (), 0xf );
1802+ const auto viewMode = (QMdiArea::ViewMode)qBound (0 , m.value (" ViewMode" , QMdiArea::SubWindowView).toInt (), 1 );
1803+ ui->mdiArea ->setViewMode (viewMode);
1804+
1805+ const auto displaybarArea = (Qt::ToolBarArea)qBound (0 , m.value (" DisplayBarArea" , Qt::TopToolBarArea).toInt (), 0xf );
17861806 const auto displaybarBreak = m.value (" DisplayBarBreak" ).toBool ();
17871807 if (displaybarBreak) addToolBarBreak (displaybarArea);
17881808 addToolBar (displaybarArea, ui->toolBarDisplay );
17891809
1790- const auto scriptbarArea = (Qt::ToolBarArea)qBound (0 , m.value (" ScriptBarArea" , 0x4 ).toInt (), 0xf );
1810+ const auto scriptbarArea = (Qt::ToolBarArea)qBound (0 , m.value (" ScriptBarArea" , Qt::TopToolBarArea ).toInt (), 0xf );
17911811 const auto scriptbarBreak = m.value (" ScriptBarBreak" ).toBool ();
17921812 if (scriptbarBreak) addToolBarBreak (scriptbarArea);
17931813 addToolBar (scriptbarArea, ui->toolBarScript );
17941814
1795- const auto editbarArea = (Qt::ToolBarArea)qBound (0 , m.value (" EditBarArea" , 0x4 ).toInt (), 0xf );
1815+ const auto editbarArea = (Qt::ToolBarArea)qBound (0 , m.value (" EditBarArea" , Qt::TopToolBarArea ).toInt (), 0xf );
17961816 const auto editbarBreak = m.value (" EditBarBreak" ).toBool ();
17971817 if (editbarBreak) addToolBarBreak (editbarArea);
17981818 addToolBar (editbarArea, ui->toolBarEdit );
@@ -1819,6 +1839,19 @@ void MainWindow::loadSettings()
18191839 m.endGroup ();
18201840 }
18211841 }
1842+
1843+ // activate window
1844+ const auto activeWindowTitle = m.value (" ActiveWindow" ).toString ();
1845+ if (!activeWindowTitle.isEmpty ()) {
1846+ for (auto && wnd : ui->mdiArea ->subWindowList ())
1847+ {
1848+ const auto frm = qobject_cast<FormModSim*>(wnd->widget ());
1849+ if (frm && frm->windowTitle () == activeWindowTitle) {
1850+ ui->mdiArea ->setActiveSubWindow (wnd);
1851+ break ;
1852+ }
1853+ }
1854+ }
18221855}
18231856
18241857// /
@@ -1860,6 +1893,10 @@ void MainWindow::saveSettings()
18601893 m.setValue (" WindowGeometry" , geometry ());
18611894 }
18621895
1896+ const auto frm = currentMdiChild ();
1897+ if (frm) m.setValue (" ActiveWindow" , frm->windowTitle ());
1898+
1899+ m.setValue (" ViewMode" , ui->mdiArea ->viewMode ());
18631900 m.setValue (" DisplayBarArea" , toolBarArea (ui->toolBarDisplay ));
18641901 m.setValue (" DisplayBarBreak" , toolBarBreak (ui->toolBarDisplay ));
18651902 m.setValue (" ScriptBarArea" , toolBarArea (ui->toolBarScript ));
0 commit comments