From a8bb96bc59182a1d249d11d5ec07937f2fac5766 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Mon, 29 Oct 2018 13:49:55 +0100 Subject: ivigenerator: Don't load the default values in initialize() in the simulation QML The initialize() function can be called multiple times. Setting the default values from the JSON files here every time is wrong and it would overwrite all values set in between. Instead only load it on the first call. Using Component.onCompleted doesn't work as it would try to set values before the zones are created. Change-Id: I0252874824ddd5afa3562d4052664e83f88a4e77 Reviewed-by: Robert Griebl --- src/tools/ivigenerator/templates_backend_simulator/backend.qml.tpl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tools/ivigenerator/templates_backend_simulator/backend.qml.tpl b/src/tools/ivigenerator/templates_backend_simulator/backend.qml.tpl index 0107549..ad83229 100644 --- a/src/tools/ivigenerator/templates_backend_simulator/backend.qml.tpl +++ b/src/tools/ivigenerator/templates_backend_simulator/backend.qml.tpl @@ -44,12 +44,15 @@ import {{module.name|lower}}.simulation 1.0 QtObject { property var settings : IviSimulator.findData(IviSimulator.simulationData, "{{interface}}") + property bool defaultInitialized: false property var backend : {{interface|upperfirst}}Backend { - function initialize() { print("{{interface}}Simulation INITIALIZE") - IviSimulator.initializeDefault(settings, backend) + if (!defaultInitialized) { + IviSimulator.initializeDefault(settings, backend) + defaultInitialized = true + } Base.initialize() } -- cgit v1.2.3