1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-31 16:52:10 +01:00

OP-1222 Added support for correct image scaling on open and resize.

This commit is contained in:
m_thread 2014-08-27 22:52:30 +02:00
parent 271f6090b5
commit d87cf62c00
2 changed files with 19 additions and 0 deletions

View File

@ -174,6 +174,7 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
QGraphicsScene *scene = new QGraphicsScene(); QGraphicsScene *scene = new QGraphicsScene();
scene->addItem(planeimg); scene->addItem(planeimg);
scene->setSceneRect(planeimg->boundingRect()); scene->setSceneRect(planeimg->boundingRect());
m_aircraft->planeShape->fitInView(planeimg, Qt::KeepAspectRatio);
m_aircraft->planeShape->setScene(scene); m_aircraft->planeShape->setScene(scene);
} }
@ -620,3 +621,18 @@ bool ConfigFixedWingWidget::throwConfigError(QString airframeType)
return error; 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);
}
}

View File

@ -65,10 +65,13 @@ private:
protected: protected:
void enableControls(bool enable); void enableControls(bool enable);
void resizeEvent(QResizeEvent *);
void showEvent(QShowEvent *);
private slots: private slots:
virtual void setupUI(QString airframeType); virtual void setupUI(QString airframeType);
virtual bool throwConfigError(QString airframeType); virtual bool throwConfigError(QString airframeType);
}; };
#endif // CONFIGFIXEDWINGWIDGET_H #endif // CONFIGFIXEDWINGWIDGET_H