A simple stopwatch for measuring elapsed time. More...
| Import Statement: | import Clayground.Common |
ClayStopWatch provides millisecond-precision timing for performance profiling and gameplay mechanics. It wraps Qt's QElapsedTimer for high-resolution timing.
Example usage:
import Clayground.Common
ClayStopWatch {
id: timer
onElapsedChanged: console.log("Elapsed:", elapsed, "ms")
}
Component.onCompleted: {
timer.start()
// ... do some work ...
timer.stop()
}
elapsed : int |
running : bool |
Whether the stopwatch is currently running.
void elapsedChanged() |
Emitted when the elapsed time is captured (after stop()).
Note: The corresponding handler is onElapsedChanged.
void runningChanged() |
Emitted when the running state changes.
Note: The corresponding handler is onRunningChanged.
void start() |
Starts or restarts the stopwatch from zero.
Calling start() while already running restarts the timer.
void stop() |
Stops the stopwatch and captures the elapsed time.
After calling stop(), the elapsed property contains the time in milliseconds since start() was called.