C
Timer QML Type
Triggers a handler at a specified interval. More...
Properties
Signals
Methods
Detailed Description
A Timer can be used to trigger an action either once, or repeatedly at a given interval. It wraps Qul::Timer.
Here is a Timer that shows the current date and time, and updates the text every 500 milliseconds.
import QtQuick 2.15 Rectangle { color: "white" property int counter: 0 Timer { interval: 500; running: true; repeat: true onTriggered: counter += 1 } Text { id: label; text: counter } }
The Timer type is synchronized with the animation timer. As the animation timer is usually set to 60fps, the resolution of Timer will be at best 16ms.
Property Documentation
Sets the interval between triggers, in milliseconds.
The default interval is 1000 milliseconds.
Signal Documentation
This signal is emitted when the Timer times out.
Note: The corresponding handler is
onTriggered.
Method Documentation
Restarts the timer
The Timer is started if it is not running, otherwise it is stopped, reset to its initial state, and started. The
running property is set to
true after calling
restart().
Starts the timer
If the timer is already running, calling this method has no effect. The
running property is set to
true after calling
start().
Stops the timer
If the timer is not running, calling this method has no effect. The
running property is set to
false after calling
stop().
Available under certain Qt licenses.
Find out more.