diff options
-rw-r--r-- | profile-widget/qmlprofile.cpp | 14 | ||||
-rw-r--r-- | profile-widget/qmlprofile.h | 4 |
2 files changed, 18 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; + } + } + +} diff --git a/profile-widget/qmlprofile.h b/profile-widget/qmlprofile.h index 15bfac0c0..a67bc8c2f 100644 --- a/profile-widget/qmlprofile.h +++ b/profile-widget/qmlprofile.h @@ -3,6 +3,7 @@ #define QMLPROFILE_H #include "profilewidget2.h" +#include "core/subsurface-qt/divelistnotifier.h" #include <QQuickPaintedItem> class QMLProfile : public QQuickPaintedItem @@ -38,6 +39,9 @@ private: QScopedPointer<ProfileWidget2> m_profileWidget; void updateProfile(); +private slots: + void divesChanged(const QVector<dive *> &dives, DiveField); + signals: void rightAlignedChanged(); void devicePixelRatioChanged(); |