diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-12-21 04:42:04 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-12-21 13:12:37 -0800 |
commit | a3e0d1ceb4bdf97c6e11c98efa0cc8b6c56e1f78 (patch) | |
tree | 1ed72e4dd0cd5a4baec08867e96f4c4633b4c762 /profile-widget/qmlprofile.cpp | |
parent | 1228dec19f7d26886498d6a0dd0e7e1cc543c611 (diff) | |
download | subsurface-a3e0d1ceb4bdf97c6e11c98efa0cc8b6c56e1f78.tar.gz |
mobile/profile: listen to dive changes and redraw profile
If a dive changes, we should simply redraw the profile. This could be
improved by checking for the fields that might impact the profile at
all, but this is definitely a step in the right direction.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile-widget/qmlprofile.cpp')
-rw-r--r-- | profile-widget/qmlprofile.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/profile-widget/qmlprofile.cpp b/profile-widget/qmlprofile.cpp index 80bedfad8..3d4351ea2 100644 --- a/profile-widget/qmlprofile.cpp +++ b/profile-widget/qmlprofile.cpp @@ -25,6 +25,7 @@ QMLProfile::QMLProfile(QQuickItem *parent) : m_profileWidget->setFontPrintScale(fontScale); connect(QMLManager::instance(), &QMLManager::sendScreenChanged, this, &QMLProfile::screenChanged); connect(this, &QMLProfile::scaleChanged, this, &QMLProfile::triggerUpdate); + connect(&diveListNotifier, &DiveListNotifier::divesChanged, this, &QMLProfile::divesChanged); setDevicePixelRatio(QMLManager::instance()->lastDevicePixelRatio()); } @@ -182,3 +183,16 @@ void QMLProfile::screenChanged(QScreen *screen) { setDevicePixelRatio(screen->devicePixelRatio()); } + +void QMLProfile::divesChanged(const QVector<dive *> &dives, DiveField) +{ + for (struct dive *d: dives) { + if (d->id == m_diveId) { + qDebug() << "dive #" << d->number << "changed, trigger profile update"; + m_profileWidget->plotDive(d, true); + triggerUpdate(); + return; + } + } + +} |