summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/templatelayout.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-08-12 18:26:42 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-08-22 10:13:40 -0700
commitf25fa2adc5dd37aca17335d8278fd00e39e9b733 (patch)
tree29e7dd254c9ce065871ef9ebbf44b2615a215028 /desktop-widgets/templatelayout.cpp
parent0d045f8c1470e011e0beff0ff0b0ec85975272e6 (diff)
downloadsubsurface-f25fa2adc5dd37aca17335d8278fd00e39e9b733.tar.gz
Cleanup: turn CylinderObjectHelper into value type
CylinderObjectHelper is used for structured formatting of cylinder values in grantlee types. Instead of keeping a reference to a cylinder, turn it into a value type containing the formatted strings. This should be distinctly safer, as we don't risk having stale references flying around. Moreover, we don't have to use pointers but can use containers containing plain CylinderObjectHelper. Thus, no explicit memory management is needed, making the code distinctly easier to understand. Sadly, currently grantlee does not support Q_GADGET based Q_PROPERTY. Therefore a GRANTLEE_*_LOOKUP block has to be added. This can be removed in due course, as a patch to remedy this issue is in current grantlee master. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/templatelayout.cpp')
-rw-r--r--desktop-widgets/templatelayout.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/desktop-widgets/templatelayout.cpp b/desktop-widgets/templatelayout.cpp
index ce70dc44e..99deeef97 100644
--- a/desktop-widgets/templatelayout.cpp
+++ b/desktop-widgets/templatelayout.cpp
@@ -133,6 +133,7 @@ QString TemplateLayout::generate()
Grantlee::Engine engine(this);
Grantlee::registerMetaType<template_options>();
Grantlee::registerMetaType<print_options>();
+ Grantlee::registerMetaType<CylinderObjectHelper>(); // TODO: Remove when grantlee supports Q_GADGET
// Note: Currently, this should not be transformed into a QVector<> or std::vector<>,
// as diveList contains pointers to elements in this list. But vectors might relocate
@@ -196,6 +197,7 @@ QString TemplateLayout::generateStatistics()
Grantlee::registerMetaType<YearInfo>();
Grantlee::registerMetaType<template_options>();
Grantlee::registerMetaType<print_options>();
+ Grantlee::registerMetaType<CylinderObjectHelper>(); // TODO: Remove when grantlee supports Q_GADGET
QVariantList years;