how we can create 2 second delay or wait in qml?
Solved
QML and Qt Quick
-
i don't want use import QtTest 1.0,
i want before that my method executes ,it wait a little and start to execute,thanks for reply. in another way can anyone guide me -
with guidance my dear friend @t3685
i create a some delay functionfunction delay(duration) { // In milliseconds var timeStart = new Date().getTime(); while (new Date().getTime() - timeStart < duration) { // Do nothing } // Duration has passed }
or another way
function delay(delayTime) { timer = new Timer(); timer.interval = delayTime; timer.repeat = false; timer.start(); }
-
Are you looking for something like this?
Timer { id: timer running: false repeat: false property var callback onTriggered: callback() } function setTimeout(callback, delay) { if (timer.running) { console.error("nested calls to setTimeout are not supported!"); return; } timer.callback = callback; // note: an interval of 0 is directly triggered, so add a little padding timer.interval = delay + 1; timer.running = true; }
-
my problem is solved before thanks very much