diff --git a/src/ui/CommConfigurationWindow.cc b/src/ui/CommConfigurationWindow.cc index 43a3698a1e0edbb25dba5723a0c45044f79fa75a..b1fbac86e5ebe36232ded67f319358698c4573c9 100644 --- a/src/ui/CommConfigurationWindow.cc +++ b/src/ui/CommConfigurationWindow.cc @@ -62,6 +62,11 @@ CommConfigurationWindow::CommConfigurationWindow(LinkInterface* link, ProtocolIn // Setup the user interface according to link type ui.setupUi(this); + // Center the window on the screen. + QRect position = frameGeometry(); + position.moveCenter(QDesktopWidget().availableGeometry().center()); + move(position.topLeft()); + // Initialize basic ui state // Do not allow changes here unless advanced is checked diff --git a/src/ui/JoystickWidget.cc b/src/ui/JoystickWidget.cc index 21b077b554ae5610d16b28bf999ddf65935ca022..1fb49e249e11a975507c7bd8fedf082f9df239c2 100644 --- a/src/ui/JoystickWidget.cc +++ b/src/ui/JoystickWidget.cc @@ -1,13 +1,20 @@ #include "JoystickWidget.h" #include "ui_JoystickWidget.h" #include +#include JoystickWidget::JoystickWidget(JoystickInput* joystick, QWidget *parent) : QDialog(parent), m_ui(new Ui::JoystickWidget) { m_ui->setupUi(this); - clearKeys(); + + // Center the window on the screen. + QRect position = frameGeometry(); + position.moveCenter(QDesktopWidget().availableGeometry().center()); + move(position.topLeft()); + + clearKeys(); this->joystick = joystick; m_ui->rollMapSpinBox->setValue(joystick->getMappingXAxis()); diff --git a/src/ui/QGCSettingsWidget.cc b/src/ui/QGCSettingsWidget.cc index eab0fbdcad6659e1fef58869c59fe93f957b0577..5f16ce1170e0cea32dca5a85e275164254d6a421 100644 --- a/src/ui/QGCSettingsWidget.cc +++ b/src/ui/QGCSettingsWidget.cc @@ -18,6 +18,11 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) : { ui->setupUi(this); + // Center the window on the screen. + QRect position = frameGeometry(); + position.moveCenter(QDesktopWidget().availableGeometry().center()); + move(position.topLeft()); + // Add all protocols QList protocols = LinkManager::instance()->getProtocols(); foreach (ProtocolInterface* protocol, protocols) {