diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index b1500252fa0bf60093f46c275e5c188b2f6bd545..645375d597f2d8f5213ceab56f2296e39b3588b5 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -238,16 +238,8 @@ MainWindow::MainWindow() } // 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); - } + _ui.actionFullscreen->setChecked(isFullScreen()); + _ui.actionNormal->setChecked(!isFullScreen()); // And that they will stay checked properly after user input connect(_ui.actionFullscreen, &QAction::triggered, this, &MainWindow::fullScreenActionItemCallback); @@ -397,6 +389,7 @@ void MainWindow::_createInnerDockWidget(const QString& widgetName) widget = pInfoView; } else { qWarning() << "Attempt to create unknown Inner Dock Widget" << widgetName; + return; } _mapName2DockWidget[widgetName] = widget; @@ -651,7 +644,7 @@ void MainWindow::_loadVisibleWidgetsSettings(void) if (!widgets.isEmpty()) { QStringList nameList = widgets.split(","); - foreach (QString name, nameList) { + foreach (const QString &name, nameList) { _showDockWidget(name, true); } } @@ -662,7 +655,7 @@ void MainWindow::_storeVisibleWidgetsSettings(void) QString widgetNames; bool firstWidget = true; - foreach (QString name, _mapName2DockWidget.keys()) { + foreach (const QString &name, _mapName2DockWidget.keys()) { if (_mapName2DockWidget[name]->isVisible()) { if (!firstWidget) { widgetNames += ","; diff --git a/src/ui/SettingsDialog.cc b/src/ui/SettingsDialog.cc index 46c53c153fc38c3707bb7e1093f021a9901ca896..ac5f6dbbb5e528cbeb017ceeb49ba5e077cdc0ab 100644 --- a/src/ui/SettingsDialog.cc +++ b/src/ui/SettingsDialog.cc @@ -47,8 +47,11 @@ _ui(new Ui::SettingsDialog) _ui->setupUi(this); // Center the window on the screen. + QDesktopWidget *desktop = QApplication::desktop(); + int screen = desktop->screenNumber(parent); + QRect position = frameGeometry(); - position.moveCenter(QApplication::desktop()->availableGeometry().center()); + position.moveCenter(QApplication::desktop()->availableGeometry(screen).center()); move(position.topLeft()); QGCLinkConfiguration* pLinkConf = new QGCLinkConfiguration(this);