[solved]Loader element load objects twice
-
so I have two loaders here:
@ Loader {
id: episodeLoader
anchors.fill: parent
}
Loader {
id: levelLoader
anchors.fill: parent
}@and two Connections:
@ Connections {
id: episodeConnection
target: episodeLoader.item
onEpisodechosen: {
levelLoader.source = "SceneLevel.qml"
console.log("asd");
episodeLoader.source = "";
episodeConnection.target = null;
}
}
Connections {
id: levelConnection
target: levelLoader.item
onLevelchosen: {
gameLoader.source = "LevelBase.qml"
gameLoader.focus = true;
levelLoader.source = "";
levelConnection.target = null;
}
onBacktoepisode: {
episodeLoader.source = "SceneEpisode.qml"
levelLoader.source = "";
levelConnection.target = null;
}
}@When episodechosen signal in episodeConnection is activated, levelLoader's source will be changed. Then on levelLoader's QML item, I activated backtoepisode and change episodeLoader's source back to SceneEpisode.qml. The problem is, when I repeat the same procedure on SceneEpisode, which is to activate episodechosen again, levelLoader doesn't load its item anymore. Any help with this?