Skip to content

Commit

Permalink
ticket:4234 Added a menu item to toggle between tab and sub window view.
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Jan 27, 2017
1 parent d4d7d13 commit 354a8d1
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
46 changes: 46 additions & 0 deletions OMEdit/OMEditGUI/MainWindow.cpp
Expand Up @@ -1618,6 +1618,46 @@ void MainWindow::tileSubWindowsVertically()
}
}

/*!
* \brief MainWindow::toggleTabOrSubWindowView
* Slot activated when mpToggleTabOrSubWindowView triggered signal is raised.\n
* Toggles between tab or sub-window view mode.
*/
void MainWindow::toggleTabOrSubWindowView()
{
QMdiArea *pMdiArea = 0;
// get the current QMdiArea
switch (mpCentralStackedWidget->currentIndex()) {
case 1:
pMdiArea = mpModelWidgetContainer;
break;
case 2:
pMdiArea = mpPlotWindowContainer;
break;
default:
return;
}
// set the QMdiArea view mode
if (pMdiArea) {
QMdiSubWindow *pSubWindow = 0;
switch (pMdiArea->viewMode()) {
case QMdiArea::SubWindowView:
pMdiArea->setViewMode(QMdiArea::TabbedView);
break;
case QMdiArea::TabbedView:
pMdiArea->setViewMode(QMdiArea::SubWindowView);
pSubWindow = pMdiArea->currentSubWindow();
if (pSubWindow) {
pSubWindow->show();
pSubWindow->setWindowState(Qt::WindowMaximized);
}
break;
default:
break;
}
}
}

void MainWindow::instantiateModel()
{
ModelWidget *pModelWidget = mpModelWidgetContainer->getCurrentModelWidget();
Expand Down Expand Up @@ -2545,6 +2585,10 @@ void MainWindow::createActions()
mpTileWindowsVerticallyAction = new QAction(tr("Tile Windows Vertically"), this);
mpTileWindowsVerticallyAction->setStatusTip(tr("Arranges all child windows in a vertically tiled pattern"));
connect(mpTileWindowsVerticallyAction, SIGNAL(triggered()), SLOT(tileSubWindowsVertically()));
// Toggle between tab or sub-window view
mpToggleTabOrSubWindowView = new QAction(tr("Toggle Tab/Sub-window View"), this);
mpToggleTabOrSubWindowView->setStatusTip(tr("Toggle between tab or sub-window view mode"));
connect(mpToggleTabOrSubWindowView, SIGNAL(triggered()), SLOT(toggleTabOrSubWindowView()));
// Simulation Menu
// instantiate model action
mpInstantiateModelAction = new QAction(QIcon(":/Resources/icons/flatmodel.svg"), tr("Instantiate Model"), this);
Expand Down Expand Up @@ -2915,6 +2959,8 @@ void MainWindow::createMenus()
pViewMenu->addAction(pViewToolbarsMenu->menuAction());
pViewMenu->addAction(pViewWindowsMenu->menuAction());
pViewMenu->addSeparator();
pViewMenu->addAction(mpToggleTabOrSubWindowView);
pViewMenu->addSeparator();
pViewMenu->addAction(mpShowGridLinesAction);
pViewMenu->addAction(mpResetZoomAction);
pViewMenu->addAction(mpZoomInAction);
Expand Down
2 changes: 2 additions & 0 deletions OMEdit/OMEditGUI/MainWindow.h
Expand Up @@ -274,6 +274,7 @@ class MainWindow : public QMainWindow
QAction *mpCascadeWindowsAction;
QAction *mpTileWindowsHorizontallyAction;
QAction *mpTileWindowsVerticallyAction;
QAction *mpToggleTabOrSubWindowView;
// Simulation Menu
QAction *mpInstantiateModelAction;
QAction *mpCheckModelAction;
Expand Down Expand Up @@ -389,6 +390,7 @@ public slots:
void cascadeSubWindows();
void tileSubWindowsHorizontally();
void tileSubWindowsVertically();
void toggleTabOrSubWindowView();
void instantiateModel();
void checkModel();
void checkAllModels();
Expand Down
4 changes: 2 additions & 2 deletions OMEdit/OMEditGUI/Options/OptionsDialog.cpp
Expand Up @@ -1502,7 +1502,7 @@ GeneralSettingsPage::GeneralSettingsPage(OptionsDialog *pOptionsDialog)
pLibrariesBrowserLayout->addWidget(mpShowProtectedClasses, 1, 0, 1, 2);
mpLibrariesBrowserGroupBox->setLayout(pLibrariesBrowserLayout);
// Modeling View Mode
mpModelingViewModeGroupBox = new QGroupBox(tr("Modeling View Mode"));
mpModelingViewModeGroupBox = new QGroupBox(tr("Default Modeling View Mode"));
mpModelingTabbedViewRadioButton = new QRadioButton(tr("Tabbed View"));
mpModelingTabbedViewRadioButton->setChecked(true);
mpModelingSubWindowViewRadioButton = new QRadioButton(tr("SubWindow View"));
Expand Down Expand Up @@ -3768,7 +3768,7 @@ PlottingPage::PlottingPage(OptionsDialog *pOptionsDialog)
pGeneralGroupBoxLayout->addWidget(mpAutoScaleCheckBox, 0, 0);
mpGeneralGroupBox->setLayout(pGeneralGroupBoxLayout);
// Plotting View Mode
mpPlottingViewModeGroupBox = new QGroupBox(tr("Plotting View Mode"));
mpPlottingViewModeGroupBox = new QGroupBox(tr("Default Plotting View Mode"));
mpPlottingTabbedViewRadioButton = new QRadioButton(tr("Tabbed View"));
mpPlottingTabbedViewRadioButton->setChecked(true);
mpPlottingSubWindowViewRadioButton = new QRadioButton(tr("SubWindow View"));
Expand Down

0 comments on commit 354a8d1

Please sign in to comment.