summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/extra/qmltimer.cpp22
-rw-r--r--src/declarative/extra/qmltimer.h7
-rw-r--r--src/declarative/fx/qfxgridview.cpp4
-rw-r--r--src/declarative/util/qmlfollow.cpp8
4 files changed, 23 insertions, 18 deletions
diff --git a/src/declarative/extra/qmltimer.cpp b/src/declarative/extra/qmltimer.cpp
index 0c13c4a..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;
};
@@ -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)
{
@@ -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();
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;
}
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;