diff options
-rw-r--r-- | profile-widget/qmlprofile.cpp | 17 | ||||
-rw-r--r-- | profile-widget/qmlprofile.h | 3 |
2 files changed, 14 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; diff --git a/profile-widget/qmlprofile.h b/profile-widget/qmlprofile.h index 17a88ba04..6074fb846 100644 --- a/profile-widget/qmlprofile.h +++ b/profile-widget/qmlprofile.h @@ -20,6 +20,8 @@ public: void setDiveId(int diveId); qreal devicePixelRatio() const; void setDevicePixelRatio(qreal dpr); + void setXOffset(qreal value); + void setYOffset(qreal value); public slots: void setMargin(int margin); @@ -29,6 +31,7 @@ private: qreal m_devicePixelRatio; int m_margin; QScopedPointer<ProfileWidget2> m_profileWidget; + void updateProfile(); signals: void rightAlignedChanged(); |