aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2018-10-29 13:49:55 +0100
committerDominik Holland <dominik.holland@pelagicore.com>2018-11-07 10:35:07 +0000
commita8bb96bc59182a1d249d11d5ec07937f2fac5766 (patch)
tree7768099f44959e8201a4a0d4450769f6873cdb30
parentb54b9c3f0866045c78d1af15bbaaf10a7a06d70d (diff)
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 <robert.griebl@pelagicore.com>
-rw-r--r--src/tools/ivigenerator/templates_backend_simulator/backend.qml.tpl7
1 files 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()
}