diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index a8914b4dcf77af681282880d8f3967ed2ca9f34b..c96e983344bf00f46cb72d87f879e6ee8a8294e2 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -347,6 +347,23 @@ void MainWindow::init() } + // Make sure the proper fullscreen/normal menu item is checked properly. + if (isFullScreen()) + { + ui.actionFullscreen->setChecked(true); + ui.actionNormal->setChecked(false); + } + else + { + ui.actionFullscreen->setChecked(false); + ui.actionNormal->setChecked(true); + } + + // And that they will stay checked properly after user input + QObject::connect(ui.actionFullscreen, SIGNAL(triggered()), this, SLOT(fullScreenActionItemCallback())); + QObject::connect(ui.actionNormal, SIGNAL(triggered()), this,SLOT(normalActionItemCallback())); + + // Set OS dependent keyboard shortcuts for the main window, non OS dependent shortcuts are set in MainWindow.ui #ifdef Q_OS_MACX ui.actionFlightView->setShortcut(QApplication::translate("MainWindow", "Meta+1", 0, QApplication::UnicodeUTF8)); @@ -758,6 +775,16 @@ void MainWindow::showDockWidget(const QString& name, bool show) loadDockWidget(name); } +void MainWindow::fullScreenActionItemCallback() +{ + ui.actionNormal->setChecked(false); +} + +void MainWindow::normalActionItemCallback() +{ + ui.actionFullscreen->setChecked(false); +} + void MainWindow::loadDockWidget(const QString& name) { if(menuActionHelper->containsDockWidget(currentView, name)) diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index 8e2ee961b3ab8df7ca88b9285d3db0f0d8de8d8f..49bcd08583a977ac437fa97ef7a123896b8ee601 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -297,6 +297,18 @@ public slots: protected slots: void showDockWidget(const QString &name, bool show); + /** + * @brief Unchecks the normalActionItem. + * Used as a triggered() callback by the fullScreenAction to make sure only one of it or the + * normalAction are checked at a time, as they're mutually exclusive. + */ + void fullScreenActionItemCallback(); + /** + * @brief Unchecks the fullScreenActionItem. + * Used as a triggered() callback by the normalAction to make sure only one of it or the + * fullScreenAction are checked at a time, as they're mutually exclusive. + */ + void normalActionItemCallback(); signals: void styleChanged(MainWindow::QGC_MAINWINDOW_STYLE newTheme); diff --git a/src/ui/MainWindow.ui b/src/ui/MainWindow.ui index 0eadd06077cb4dc1a59858bbed6590c4c7fcfa4d..a457b98e46c6c05a6b91c6d57469990ae0fedcd5 100644 --- a/src/ui/MainWindow.ui +++ b/src/ui/MainWindow.ui @@ -379,11 +379,23 @@ + + true + + + false + Fullscreen + + true + + + false + Normal