onStatusChanged not getting called always
Unsolved
QML and Qt Quick
-
Hello,
I have a piece of code where i am trying to initialize the data and trying to load the respective qml file using Loader as a property.
I am executing this in a device and this loader is getting called on ever boot up but it is getting called when ever i perform some operation after the boot up (let's say deleting one of the screen's from list of screens).
Below is my code snippet
ScreenInfo.qmlQtObject{ id:root function screenInfo() { // iterate the screenModel and stores the information in storeConfigGaugesObject var jsonString = JSON.stringify(storeConfigGaugesObject) root.jsonUpdated(jsonString) } function delete(index) { screen.remove(index) screeninfo() } }
Data.qml
QtObject{ id:root property ModelData gaugesModel: ModelData { onJsonUpdated: { dataLoader.item.gCD1 = json console.error("====>ONJSONUPDATED::Json"+json) console.error("====>ONJSONUPDATED::gCD1"+dataLoader.item.gCD1) } } property Loader dataLoader: Loader{ source: "./Model.qml" onStatusChanged: { /*The problem are is here, this part of code is only getting called on every bootup, when we are performing some operation like delete this part of code is not getting triggered*/ console.error("dataLoaderStatus"+dataLoader.status) console.error("IsLoaderReady"+Loader.Ready) if (dataLoader.status === Loader.Ready) { // populate the PTD root.screenTypeDetails = dataLoader.item.screenTypeDetails // populate the GTA root.gaugeTypeArray = dataLoader.item.gaugeTypeArray root.optionGauges = Qt.binding(function () { return dataLoader.item.optionGauges }) // populate the STA for (var i = 0; i < screenTypeDetails.length; i++) { screenTypeArray.push(screenTypeDetails[i].type) } gM.initData(dataLoader.item.gCD1) } } } }
Model.qml
QtObject{ id:root function initScreenInfo(){ //The received screen info in JSON format Data will be parsed and displayed here } }
The Qt-5.15 is the version, any suggestion here are helpful.
Thanks in advance !
Regard's,
Rohith.G