diff options
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/templatelayout.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/templatelayout.h | 19 |
2 files changed, 21 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; diff --git a/desktop-widgets/templatelayout.h b/desktop-widgets/templatelayout.h index 49aa51613..10c5e96cc 100644 --- a/desktop-widgets/templatelayout.h +++ b/desktop-widgets/templatelayout.h @@ -9,6 +9,7 @@ #include "core/statistics.h" #include "core/qthelper.h" #include "core/subsurface-qt/DiveObjectHelper.h" +#include "core/subsurface-qt/CylinderObjectHelper.h" // TODO: remove once grantlee supports Q_GADGET objects int getTotalWork(print_options *printOptions); void find_all_templates(); @@ -120,4 +121,22 @@ if (property == "year") { } GRANTLEE_END_LOOKUP +// TODO: This is currently needed because our grantlee version +// doesn't support Q_GADGET based classes. A patch to fix this +// exists. Remove in due course. +GRANTLEE_BEGIN_LOOKUP(CylinderObjectHelper) +if (property == "description") { + return object.description; +} else if (property == "size") { + return object.size; +} else if (property == "workingPressure") { + return object.workingPressure; +} else if (property == "startPressure") { + return object.startPressure; +} else if (property == "endPressure") { + return object.endPressure; +} else if (property == "gasMix") { + return object.gasMix; +} +GRANTLEE_END_LOOKUP #endif |