mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 00:43:24 +00:00
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>
This commit is contained in:
parent
3cf958e658
commit
f277b525c3
2 changed files with 14 additions and 6 deletions
|
@ -85,17 +85,22 @@ int QMLProfile::diveId() const
|
||||||
return m_diveId;
|
return m_diveId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QMLProfile::updateProfile()
|
||||||
|
{
|
||||||
|
struct dive *d = get_dive_by_uniq_id(m_diveId);
|
||||||
|
if (!d)
|
||||||
|
return;
|
||||||
|
if (verbose)
|
||||||
|
qDebug() << "update profile for dive #" << d->number;
|
||||||
|
m_profileWidget->plotDive(d, true);
|
||||||
|
}
|
||||||
|
|
||||||
void QMLProfile::setDiveId(int diveId)
|
void QMLProfile::setDiveId(int diveId)
|
||||||
{
|
{
|
||||||
m_diveId = diveId;
|
m_diveId = diveId;
|
||||||
if (m_diveId < 0)
|
if (m_diveId < 0)
|
||||||
return;
|
return;
|
||||||
struct dive *d = get_dive_by_uniq_id(diveId);
|
updateProfile();
|
||||||
if (!d)
|
|
||||||
return;
|
|
||||||
if (verbose)
|
|
||||||
qDebug() << "setDiveId(" << d->number << ")";
|
|
||||||
m_profileWidget->plotDive(d, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QMLProfile::devicePixelRatio() const
|
qreal QMLProfile::devicePixelRatio() const
|
||||||
|
|
|
@ -20,6 +20,8 @@ public:
|
||||||
void setDiveId(int diveId);
|
void setDiveId(int diveId);
|
||||||
qreal devicePixelRatio() const;
|
qreal devicePixelRatio() const;
|
||||||
void setDevicePixelRatio(qreal dpr);
|
void setDevicePixelRatio(qreal dpr);
|
||||||
|
void setXOffset(qreal value);
|
||||||
|
void setYOffset(qreal value);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setMargin(int margin);
|
void setMargin(int margin);
|
||||||
|
@ -29,6 +31,7 @@ private:
|
||||||
qreal m_devicePixelRatio;
|
qreal m_devicePixelRatio;
|
||||||
int m_margin;
|
int m_margin;
|
||||||
QScopedPointer<ProfileWidget2> m_profileWidget;
|
QScopedPointer<ProfileWidget2> m_profileWidget;
|
||||||
|
void updateProfile();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void rightAlignedChanged();
|
void rightAlignedChanged();
|
||||||
|
|
Loading…
Add table
Reference in a new issue