Struct Timer
Defined in File slint.h
Struct Documentation
-
struct slint::Timer
A Timer that can call a callback at repeated interval
Use the static single_shot function to make a single shot timer
Public Functions
-
inline Timer()
Construct a null timer. Use the start() method to activate the timer with a mode, interval and callback.
-
template<typename F>
inline Timer(std::chrono::milliseconds interval, F callback) Construct a timer which will repeat the callback every
interval
milliseconds until the destructor of the timer is called.This is a convenience function and equivalent to calling
start(slint::TimerMode::Repeated, interval, callback);
on a default constructed Timer.
-
inline ~Timer()
-
template<typename F>
inline void start(TimerMode mode, std::chrono::milliseconds interval, F callback) Starts the timer with the given mode and interval, in order for the callback to called when the timer fires. If the timer has been started previously and not fired yet, then it will be restarted.
-
inline void stop()
Stops the previously started timer. Does nothing if the timer has never been started. A stopped timer cannot be restarted with restart() — instead you need to call start().
-
inline void restart()
Restarts the timer. If the timer was previously started by calling [
Self::start()
] with a duration and callback, then the time when the callback will be next invoked is re-calculated to be in the specified duration relative to when this function is called.Does nothing if the timer was never started.
-
inline bool running() const
Returns true if the timer is running; false otherwise.
-
inline Timer()