From e87124ba02669e1dbffb803441e1fc25b7e7d959 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 28 Jul 2009 15:49:42 +1000 Subject: Don't wait for componentComplete if never a classBegin. Otherwise QmlTimer cannot be used outside QML. --- src/declarative/util/qmltimer.cpp | 11 +++++++++-- src/declarative/util/qmltimer.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qmltimer.cpp b/src/declarative/util/qmltimer.cpp index 456b2ef..2d3a343 100644 --- a/src/declarative/util/qmltimer.cpp +++ b/src/declarative/util/qmltimer.cpp @@ -55,12 +55,13 @@ class QmlTimerPrivate : public QObjectPrivate public: QmlTimerPrivate() : interval(1000), running(false), repeating(false), triggeredOnStart(false) - , componentComplete(false) {} + , classBegun(false), componentComplete(false) {} int interval; bool running; bool repeating; bool triggeredOnStart; QPauseAnimation pause; + bool classBegun; bool componentComplete; }; @@ -190,7 +191,7 @@ void QmlTimer::setTriggeredOnStart(bool triggeredOnStart) void QmlTimer::update() { Q_D(QmlTimer); - if (!d->componentComplete) + if (d->classBegun && !d->componentComplete) return; d->pause.stop(); if (d->running) { @@ -204,6 +205,12 @@ void QmlTimer::update() } } +void QmlTimer::classBegin() +{ + Q_D(QmlTimer); + d->classBegun = true; +} + void QmlTimer::componentComplete() { Q_D(QmlTimer); diff --git a/src/declarative/util/qmltimer.h b/src/declarative/util/qmltimer.h index 0df4cb9..d376834 100644 --- a/src/declarative/util/qmltimer.h +++ b/src/declarative/util/qmltimer.h @@ -80,6 +80,7 @@ public: void setTriggeredOnStart(bool triggeredOnStart); protected: + void classBegin(); void componentComplete(); Q_SIGNALS: -- cgit v0.12