From 9d89a023ca57df3bdd1b2c59b35ac1c00ce77e45 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 20 Aug 2009 15:57:30 +1000 Subject: Add start, stop slots to QmlTimer --- src/declarative/QmlChanges.txt | 2 +- src/declarative/util/qmltimer.cpp | 26 ++++++++++++++++++++++++++ src/declarative/util/qmltimer.h | 4 ++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 77839e8..82f2292 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -22,6 +22,7 @@ MouseRegion: ymin -> maximumY Additions: MouseRegion: add "acceptedButtons" property MouseRegion: add "hoverEnabled" property +Timer: add start() and stop() slots Deletions: VerticalPositioner: lost "margins" property @@ -57,4 +58,3 @@ PropertyAction::target (if possible) Additions: MouseRegion: add "pressedButtons" property Connection: add "slot" property -Timer: add start() and stop() slots diff --git a/src/declarative/util/qmltimer.cpp b/src/declarative/util/qmltimer.cpp index 2d3a343..b95d6ad 100644 --- a/src/declarative/util/qmltimer.cpp +++ b/src/declarative/util/qmltimer.cpp @@ -188,6 +188,32 @@ void QmlTimer::setTriggeredOnStart(bool triggeredOnStart) } } +/*! + \qmlmethod Timer::start() + \brief Starts the timer. + + If the timer is already running, calling this method has no effect. The + \c running property will be true following a call to \c start(). +*/ +void QmlTimer::start() +{ + Q_D(QmlTimer); + d->pause.start(); +} + +/*! + \qmlmethod Timer::stop() + \brief stops the timer. + + If the timer is not running, calling this method has no effect. The + \c running property will be false following a call to \c stop(). +*/ +void QmlTimer::stop() +{ + Q_D(QmlTimer); + d->pause.stop(); +} + void QmlTimer::update() { Q_D(QmlTimer); diff --git a/src/declarative/util/qmltimer.h b/src/declarative/util/qmltimer.h index d376834..22478cb 100644 --- a/src/declarative/util/qmltimer.h +++ b/src/declarative/util/qmltimer.h @@ -83,6 +83,10 @@ protected: void classBegin(); void componentComplete(); +public Q_SLOTS: + void start(); + void stop(); + Q_SIGNALS: void triggered(); void runningChanged(); -- cgit v0.12