mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
DiveObjectHelper: Turn DiveObjectHelper into Q_GADGET based object
DiveObjectHelper is a tiny wrapper around dive * to allow access to dive data from QML and grantlee. It doesn't have to be a full-fledged QObject with support for signals, etc. Therefore, turn it into a Q_GADGET based object. This allows us passing the object around as object, not as pointer to DiveObjectHelper. This makes memory-management distinctly easier. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
a79c45e401
commit
be763452ad
5 changed files with 101 additions and 20 deletions
|
@ -55,6 +55,13 @@ static QString getPressures(struct dive *dive, int i, enum returnPressureSelecto
|
|||
return fmt;
|
||||
}
|
||||
|
||||
// Qt's metatype system insists on generating a default constructed object,
|
||||
// even if that makes no sense. Usage of this object *will* crash.
|
||||
DiveObjectHelper::DiveObjectHelper() :
|
||||
m_dive(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
DiveObjectHelper::DiveObjectHelper(struct dive *d) :
|
||||
m_dive(d)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue