mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
QML UI: fix profile scaling
The scaling needs to happen before we draw the profile on the viewport, not before we render that viewport into the pixmap. This is why prior to this patch the first time the profile was rendered it was way off, but then if it got re-rendered things worked better. I'm still not 100% happy with the size and position of the profile, but this is a huge improvement. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
84a47c0cb4
commit
1bfcf5c0f8
1 changed files with 5 additions and 3 deletions
|
@ -19,9 +19,6 @@ QMLProfile::~QMLProfile()
|
|||
|
||||
void QMLProfile::paint(QPainter *painter)
|
||||
{
|
||||
QTransform profileTransform;
|
||||
profileTransform.scale(width() / 100, height() / 100);
|
||||
m_profileWidget->setTransform(profileTransform);
|
||||
m_profileWidget->render(painter);
|
||||
}
|
||||
|
||||
|
@ -43,6 +40,11 @@ void QMLProfile::setDiveId(const QString &diveId)
|
|||
if (!d)
|
||||
return;
|
||||
|
||||
// set the profile widget's geometry and scale the viewport so
|
||||
// the scene fills it, then plot the dive on that widget
|
||||
m_profileWidget->setGeometry(QRect(x(), y(), width(), height()));
|
||||
QTransform profileTransform;
|
||||
profileTransform.scale(width() / 100, height() / 100);
|
||||
m_profileWidget->setTransform(profileTransform);
|
||||
m_profileWidget->plotDive(d);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue