Timer still running when main QML is not loaded
-
yup i changed the someloader to mainLoader which is the id of my Loader element but still when i click the mousearea that triggers to load the 2nd QML, the timer stops
-
@ Timer {
id: decrementTimer
interval: 2000 // 2 seconds
repeat: true
running: (mainLoader.source != "home_aspin.qml")onTriggered: { // do your decrement code here Storage.setSetting("setting",hungertext.text) JScript.decrementcode(); } Component.onCompleted: { Storage.initialize() } }@@ MouseArea {
id: sleep2home
x: 138
y: 407
width: 95
height: 76
onClicked: {
decrementTimer.start();
mainLoader.source = "QML2";}
}@this is inside my main QML, and i dont put timer codes on my QML2
-
But the Timer and the MouseArea are in the same file, correct?
Just trying to make sure I understand the layout fully.
(If the Timer is in a piece of QML which is loaded by a Loader, and that QML is unloaded, then the timer will stop because it doesn't exist anymore. So the timer has to be persistent somewhere.)
-
yup the timer and mousearea is in the same file, ah ok so i nid to create a new timer in the loaded QML to start again the timer,
thank you again sir
-
there is no stop, the timer needs to continue until the application is running,
the problem is i am using Loader element, and i used loader in viewing multiple QML's, and when i load a new QML the timer stops decrementing numbers
-
jr_jags, I might be able to help you if you let me see your code at school. :D
-
haha, cge, ill show my code to u at school ^ ^