summaryrefslogtreecommitdiffstats
path: root/qt-mobile
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-12-02 11:26:32 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-12-02 11:28:35 -0800
commit1bfcf5c0f820633e7f9387722438370f0a3a5a48 (patch)
treeec21689c6698f17f99d26e7e9c675be65c0cb860 /qt-mobile
parent84a47c0cb4e71e1e1e602abdd94d8c1fdf134e7d (diff)
downloadsubsurface-1bfcf5c0f820633e7f9387722438370f0a3a5a48.tar.gz
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>
Diffstat (limited to 'qt-mobile')
-rw-r--r--qt-mobile/qmlprofile.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/qt-mobile/qmlprofile.cpp b/qt-mobile/qmlprofile.cpp
index a55bf8d32..1ad84e735 100644
--- a/qt-mobile/qmlprofile.cpp
+++ b/qt-mobile/qmlprofile.cpp
@@ -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);
}