From 098e1939cfdf675ae850912d898f1af0b2c660cc Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 25 Jun 2009 08:44:41 +1000 Subject: Fix GridView handling of unrequested items. If unrequested items were added before we had populated any items they would not be laid out at all. --- src/declarative/extra/qmltimer.cpp | 2 +- src/declarative/fx/qfxgridview.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/declarative/extra/qmltimer.cpp b/src/declarative/extra/qmltimer.cpp index 0c13c4a..b891745 100644 --- a/src/declarative/extra/qmltimer.cpp +++ b/src/declarative/extra/qmltimer.cpp @@ -98,7 +98,7 @@ QmlTimer::QmlTimer(QObject *parent) /*! \qmlproperty int Timer::interval - Sets the \a interval between triggering. + Sets the \a interval in milliseconds between triggering. */ void QmlTimer::setInterval(int interval) { diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 0ca9393..a6ffbb9 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -234,6 +234,8 @@ public: int count = columns - 1 - (modelIndex - visibleItems.last()->index - 1) % columns; return visibleItems.last()->colPos() - count * colSize(); } + } else { + return (modelIndex % columns) * colSize(); } return 0; } @@ -252,6 +254,8 @@ public: int rows = col / (columns * colSize()); return visibleItems.last()->rowPos() + rows * rowSize(); } + } else { + return (modelIndex / columns) * rowSize(); } return 0; } -- cgit v0.12 From 4c0c1cbcdecec95c046a6862628621f005c2df56 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 25 Jun 2009 15:11:31 +1000 Subject: QmlTimer::firesOnStart -> triggeredOnStart --- src/declarative/extra/qmltimer.cpp | 20 ++++++++++---------- src/declarative/extra/qmltimer.h | 7 ++++--- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/declarative/extra/qmltimer.cpp b/src/declarative/extra/qmltimer.cpp index b891745..4af83d3 100644 --- a/src/declarative/extra/qmltimer.cpp +++ b/src/declarative/extra/qmltimer.cpp @@ -54,12 +54,12 @@ class QmlTimerPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QmlTimer) public: QmlTimerPrivate() - : interval(1000), running(false), repeating(false), firesOnStart(false) + : interval(1000), running(false), repeating(false), triggeredOnStart(false) , componentComplete(false) {} int interval; bool running; bool repeating; - bool firesOnStart; + bool triggeredOnStart; QPauseAnimation pause; bool componentComplete; }; @@ -165,24 +165,24 @@ void QmlTimer::setRepeating(bool repeating) } /*! - \qmlproperty bool Timer::firesOnStart + \qmlproperty bool Timer::triggeredOnStart - If \a firesOnStart is true, the timer will be triggered immediately + If \a triggeredOnStart is true, the timer will be triggered immediately when started, and subsequently at the specified interval. \sa running */ -bool QmlTimer::firesOnStart() const +bool QmlTimer::triggeredOnStart() const { Q_D(const QmlTimer); - return d->firesOnStart; + return d->triggeredOnStart; } -void QmlTimer::setFiresOnStart(bool firesOnStart) +void QmlTimer::setTriggeredOnStart(bool triggeredOnStart) { Q_D(QmlTimer); - if (d->firesOnStart != firesOnStart) { - d->firesOnStart = firesOnStart; + if (d->triggeredOnStart != triggeredOnStart) { + d->triggeredOnStart = triggeredOnStart; update(); } } @@ -197,7 +197,7 @@ void QmlTimer::update() d->pause.setLoopCount(d->repeating ? -1 : 1); d->pause.setDuration(d->interval); d->pause.start(); - if (d->firesOnStart) { + if (d->triggeredOnStart) { QCoreApplication::removePostedEvents(this, QEvent::MetaCall); QMetaObject::invokeMethod(this, "ticked", Qt::QueuedConnection); } diff --git a/src/declarative/extra/qmltimer.h b/src/declarative/extra/qmltimer.h index 8a94395..8171385 100644 --- a/src/declarative/extra/qmltimer.h +++ b/src/declarative/extra/qmltimer.h @@ -57,10 +57,11 @@ class Q_DECLARATIVE_EXPORT QmlTimer : public QObject, public QmlParserStatus { Q_OBJECT Q_DECLARE_PRIVATE(QmlTimer) + Q_INTERFACES(QmlParserStatus) Q_PROPERTY(int interval READ interval WRITE setInterval) Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged) Q_PROPERTY(bool repeat READ isRepeating WRITE setRepeating) - Q_PROPERTY(bool firesOnStart READ firesOnStart WRITE setFiresOnStart) + Q_PROPERTY(bool triggeredOnStart READ triggeredOnStart WRITE setTriggeredOnStart) public: QmlTimer(QObject *parent=0); @@ -74,8 +75,8 @@ public: bool isRepeating() const; void setRepeating(bool repeating); - bool firesOnStart() const; - void setFiresOnStart(bool firesOnStart); + bool triggeredOnStart() const; + void setTriggeredOnStart(bool triggeredOnStart); protected: void componentComplete(); -- cgit v0.12 From 9803a0ca81d688fdd780b7fe78f7a2b592bb5e3d Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 25 Jun 2009 16:10:39 +1000 Subject: No point running spring physics faster than our timer. --- src/declarative/util/qmlfollow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/declarative/util/qmlfollow.cpp b/src/declarative/util/qmlfollow.cpp index d1ecac4..cf3d629 100644 --- a/src/declarative/util/qmlfollow.cpp +++ b/src/declarative/util/qmlfollow.cpp @@ -93,11 +93,11 @@ void QmlFollowPrivate::tick(int time) if (!elapsed) return; if (mode == Spring) { - if (elapsed < 10) // capped at 100fps. + if (elapsed < 16) // capped at 62fps. return; // Real men solve the spring DEs using RK4. // We'll do something much simpler which gives a result that looks fine. - int count = (elapsed+5) / 10; + int count = (elapsed+8) / 16; for (int i = 0; i < count; ++i) { qreal diff = sourceValue - currentValue; velocity = velocity + spring * diff - damping * velocity; @@ -110,14 +110,14 @@ void QmlFollowPrivate::tick(int time) else if (velocity < -maxVelocity) velocity = -maxVelocity; } - currentValue += velocity * 10.0 / 1000.0; + currentValue += velocity * 16.0 / 1000.0; } if (qAbs(velocity) < epsilon && qAbs(sourceValue - currentValue) < epsilon) { velocity = 0.0; currentValue = sourceValue; clock.stop(); } - lastTime = time - (elapsed - count * 10); + lastTime = time - (elapsed - count * 16); } else { qreal moveBy = elapsed * velocityms; qreal diff = sourceValue - currentValue; -- cgit v0.12