diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-08-13 07:28:24 +0200 |
---|---|---|
committer | bstoeger <32835590+bstoeger@users.noreply.github.com> | 2019-09-14 13:20:59 +0200 |
commit | be763452adc110cfcc011322d989698d897dd6ed (patch) | |
tree | b4185f9d99a237621caa262a44340a9300396e7b /core/subsurface-qt/DiveObjectHelper.cpp | |
parent | a79c45e4010a18f8ffe0742ab844743eeeebab9e (diff) | |
download | subsurface-be763452adc110cfcc011322d989698d897dd6ed.tar.gz |
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>
Diffstat (limited to 'core/subsurface-qt/DiveObjectHelper.cpp')
-rw-r--r-- | core/subsurface-qt/DiveObjectHelper.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp index e4945f007..c19c03eb4 100644 --- a/core/subsurface-qt/DiveObjectHelper.cpp +++ b/core/subsurface-qt/DiveObjectHelper.cpp @@ -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) { |