diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp index 3ba1df668..887bf5fdf 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp @@ -174,6 +174,7 @@ void ConfigFixedWingWidget::setupUI(QString frameType) QGraphicsScene *scene = new QGraphicsScene(); scene->addItem(planeimg); scene->setSceneRect(planeimg->boundingRect()); + m_aircraft->planeShape->fitInView(planeimg, Qt::KeepAspectRatio); m_aircraft->planeShape->setScene(scene); } @@ -620,3 +621,18 @@ bool ConfigFixedWingWidget::throwConfigError(QString airframeType) return error; } + + +void ConfigFixedWingWidget::resizeEvent(QResizeEvent *) +{ + if (planeimg) { + m_aircraft->planeShape->fitInView(planeimg, Qt::KeepAspectRatio); + } +} + +void ConfigFixedWingWidget::showEvent(QShowEvent *) +{ + if (planeimg) { + m_aircraft->planeShape->fitInView(planeimg, Qt::KeepAspectRatio); + } +} diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h index f749d4ae0..e4bc8f115 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h @@ -65,10 +65,13 @@ private: protected: void enableControls(bool enable); + void resizeEvent(QResizeEvent *); + void showEvent(QShowEvent *); private slots: virtual void setupUI(QString airframeType); virtual bool throwConfigError(QString airframeType); + }; #endif // CONFIGFIXEDWINGWIDGET_H