mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Printing: export grayscale filter value to template
Export grayscale value to Grantlee template, So we must declare print_options as QMetatype. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
d2bc70a570
commit
599920c6cf
2 changed files with 13 additions and 0 deletions
|
@ -47,6 +47,7 @@ QString TemplateLayout::generate()
|
||||||
|
|
||||||
Grantlee::registerMetaType<Dive>();
|
Grantlee::registerMetaType<Dive>();
|
||||||
Grantlee::registerMetaType<template_options>();
|
Grantlee::registerMetaType<template_options>();
|
||||||
|
Grantlee::registerMetaType<print_options>();
|
||||||
|
|
||||||
QVariantHash mapping;
|
QVariantHash mapping;
|
||||||
QVariantList diveList;
|
QVariantList diveList;
|
||||||
|
@ -64,6 +65,7 @@ QString TemplateLayout::generate()
|
||||||
}
|
}
|
||||||
mapping.insert("dives", diveList);
|
mapping.insert("dives", diveList);
|
||||||
mapping.insert("template_options", QVariant::fromValue(*templateOptions));
|
mapping.insert("template_options", QVariant::fromValue(*templateOptions));
|
||||||
|
mapping.insert("print_options", QVariant::fromValue(*PrintOptions));
|
||||||
|
|
||||||
Grantlee::Context c(mapping);
|
Grantlee::Context c(mapping);
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,7 @@ public:
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Dive)
|
Q_DECLARE_METATYPE(Dive)
|
||||||
Q_DECLARE_METATYPE(template_options)
|
Q_DECLARE_METATYPE(template_options)
|
||||||
|
Q_DECLARE_METATYPE(print_options)
|
||||||
|
|
||||||
GRANTLEE_BEGIN_LOOKUP(Dive)
|
GRANTLEE_BEGIN_LOOKUP(Dive)
|
||||||
if (property == "number")
|
if (property == "number")
|
||||||
|
@ -136,4 +137,14 @@ if (property == "font") {
|
||||||
}
|
}
|
||||||
GRANTLEE_END_LOOKUP
|
GRANTLEE_END_LOOKUP
|
||||||
|
|
||||||
|
GRANTLEE_BEGIN_LOOKUP(print_options)
|
||||||
|
if (property == "grayscale") {
|
||||||
|
if (object.color_selected) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
return "-webkit-filter: grayscale(100%)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GRANTLEE_END_LOOKUP
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue