summaryrefslogtreecommitdiffstats
path: root/profile-widget/qmlprofile.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-02-17 10:42:56 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-02-18 07:34:46 -0800
commitf277b525c37bb131910140a19d82ed31053fc0e9 (patch)
treee2ae8648e0144b3a419e5ca79f4ff612da1ef49a /profile-widget/qmlprofile.cpp
parent3cf958e658ad30d0ddd3cb5bac884424955d8340 (diff)
downloadsubsurface-f277b525c37bb131910140a19d82ed31053fc0e9.tar.gz
mobile/profile: create updateProfile method
This allows us to trigger an update even if the dive displayed stays the same. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile-widget/qmlprofile.cpp')
-rw-r--r--profile-widget/qmlprofile.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/profile-widget/qmlprofile.cpp b/profile-widget/qmlprofile.cpp
index 2a92340b5..e77b4d20c 100644
--- a/profile-widget/qmlprofile.cpp
+++ b/profile-widget/qmlprofile.cpp
@@ -85,19 +85,24 @@ int QMLProfile::diveId() const
return m_diveId;
}
-void QMLProfile::setDiveId(int diveId)
+void QMLProfile::updateProfile()
{
- m_diveId = diveId;
- if (m_diveId < 0)
- return;
- struct dive *d = get_dive_by_uniq_id(diveId);
+ struct dive *d = get_dive_by_uniq_id(m_diveId);
if (!d)
return;
if (verbose)
- qDebug() << "setDiveId(" << d->number << ")";
+ qDebug() << "update profile for dive #" << d->number;
m_profileWidget->plotDive(d, true);
}
+void QMLProfile::setDiveId(int diveId)
+{
+ m_diveId = diveId;
+ if (m_diveId < 0)
+ return;
+ updateProfile();
+}
+
qreal QMLProfile::devicePixelRatio() const
{
return m_devicePixelRatio;