diff options
author | Dominik Holland <dominik.holland@pelagicore.com> | 2018-10-29 13:49:55 +0100 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2018-11-07 10:35:07 +0000 |
commit | a8bb96bc59182a1d249d11d5ec07937f2fac5766 (patch) | |
tree | 7768099f44959e8201a4a0d4450769f6873cdb30 /src/tools/ivigenerator/templates_backend_simulator/backend.qml.tpl | |
parent | b54b9c3f0866045c78d1af15bbaaf10a7a06d70d (diff) | |
download | qtivi-a8bb96bc59182a1d249d11d5ec07937f2fac5766.tar.gz |
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>
Diffstat (limited to 'src/tools/ivigenerator/templates_backend_simulator/backend.qml.tpl')
-rw-r--r-- | src/tools/ivigenerator/templates_backend_simulator/backend.qml.tpl | 7 |
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() } |