diff options
author | Rick Walsh <rickmwalsh@gmail.com> | 2015-12-31 00:22:30 +1100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-12-30 07:26:02 -0800 |
commit | 7f22984d18d6a6fa3b799ff7d1810710864aa828 (patch) | |
tree | c7143cc5d9f9324990ef7a8d0e11eb517c390ff5 /qt-mobile | |
parent | 2cce4ec3a4f41fbefd72577ff2f38e4310b582c2 (diff) | |
download | subsurface-7f22984d18d6a6fa3b799ff7d1810710864aa828.tar.gz |
QML UI: scale profile in two stages
Scale the QML profile in two stages. Firstly, scale to fit. Secondly, scale
again to 95% to create a margin around the profile.
The previous method scales to fit a create a margin in one step. It appears
more elegant, and the margin is calculated more rationally. Unfortunately on
some devices, including mine, the resulting profile is cropped for no obvious
reason.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile')
-rw-r--r-- | qt-mobile/qmlprofile.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/qt-mobile/qmlprofile.cpp b/qt-mobile/qmlprofile.cpp index d428364f4..ee0eea7bb 100644 --- a/qt-mobile/qmlprofile.cpp +++ b/qt-mobile/qmlprofile.cpp @@ -51,10 +51,8 @@ void QMLProfile::setDiveId(const QString &diveId) // the scene fills it, then plot the dive on that widget if (firstRun) { firstRun = false; - double w = contentsBoundingRect().width(); - double h = contentsBoundingRect().height(); - double m = m_margin; - profileTransform.scale((w - 2 * m) / 100, (h - 2 * m) / 100); + m_profileWidget->setGeometry(QRect(x(), y(), width(), height())); + profileTransform.scale(width() / 100, height() / 100); } m_profileWidget->setTransform(profileTransform); qDebug() << "effective transformation:" << @@ -69,4 +67,6 @@ void QMLProfile::setDiveId(const QString &diveId) m_profileWidget->transform().m33(); m_profileWidget->plotDive(d); + // scale the profile to create a margin + m_profileWidget->scale(0.95, 0.95); } |