JsonWizard: Add option to put evaluated expressions into options

This is necessary to allow for constants that are not re-evaluated all
the time.

Change-Id: I4aec9d71aeae1a25ffa97eac177dd9c6fc6a90ca
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2015-12-07 11:27:07 +01:00
parent 480f40c038
commit 56a9b93a28
4 changed files with 37 additions and 12 deletions

View File

@@ -122,9 +122,8 @@ Core::GeneratedFile JsonWizardFileGenerator::generateFile(const File &file,
// evaluate file options once:
QHash<QString, QString> options;
foreach (const JsonWizard::OptionDefinition &od, file.options) {
if (!JsonWizard::boolFromVariant(od.condition, expander))
continue;
options.insert(od.key, od.value);
if (od.condition(*expander))
options.insert(od.key(), od.value(*expander));
}
nested.registerExtraResolver([&options](QString n, QString *ret) -> bool {