summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-03-25 00:09:17 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-03-25 00:09:17 (GMT)
commit13d9f49577dd5be8c01792b6d7709c2e9b28aa95 (patch)
tree158d3b0c437fb88a6f103602f1e392c332bb7a0e
parent668c9d63d27b2a925c18f3128747c20b37560569 (diff)
downloadQt-13d9f49577dd5be8c01792b6d7709c2e9b28aa95.zip
Qt-13d9f49577dd5be8c01792b6d7709c2e9b28aa95.tar.gz
Qt-13d9f49577dd5be8c01792b6d7709c2e9b28aa95.tar.bz2
Replace Animation's repeat property with loops.
You can now loop a fixed number of times as well as forever. The old repeat behavior (loop forever) can be acheived with loops: Qt.Infinite.
-rw-r--r--demos/declarative/flickr/common/Loading.qml4
-rw-r--r--demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml2
-rw-r--r--demos/declarative/twitter/TwitterCore/Loading.qml4
-rw-r--r--doc/src/declarative/animation.qdoc2
-rw-r--r--examples/declarative/animations/color-animation.qml10
-rw-r--r--examples/declarative/animations/property-animation.qml2
-rw-r--r--examples/declarative/border-image/content/MyBorderImage.qml4
-rw-r--r--examples/declarative/effects/effects.qml4
-rw-r--r--examples/declarative/fillmode/fillmode.qml2
-rw-r--r--examples/declarative/fonts/banner.qml2
-rw-r--r--examples/declarative/fonts/hello.qml4
-rw-r--r--examples/declarative/listview/content/ClickAutoRepeating.qml2
-rw-r--r--examples/declarative/parallax/qml/Smiley.qml2
-rw-r--r--examples/declarative/progressbar/progressbars.qml6
-rw-r--r--examples/declarative/tvtennis/tvtennis.qml2
-rw-r--r--examples/declarative/webview/content/SpinSquare.qml2
-rw-r--r--src/declarative/QmlChanges.txt1
-rw-r--r--src/declarative/qml/qdeclarativedom.cpp6
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp2
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp52
-rw-r--r--src/declarative/util/qdeclarativeanimation_p.h9
-rw-r--r--src/declarative/util/qdeclarativeanimation_p_p.h8
-rw-r--r--src/declarative/util/qdeclarativespringfollow.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp4
-rw-r--r--tests/auto/declarative/visual/animation/loop/loop.qml2
-rw-r--r--tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml2
-rw-r--r--tests/auto/declarative/visual/qdeclarativeborderimage/content/MyBorderImage.qml4
-rw-r--r--tests/auto/declarative/visual/qdeclarativeeasefollow/easefollow.qml2
-rw-r--r--tests/auto/declarative/visual/qdeclarativespringfollow/follow.qml2
-rw-r--r--tests/auto/declarative/visual/qdeclarativetext/elide/elide2.qml2
-rw-r--r--tests/auto/declarative/visual/qdeclarativetext/elide/multilength.qml2
-rw-r--r--tests/auto/declarative/visual/qdeclarativetextedit/cursorDelegate.qml2
-rw-r--r--tests/auto/declarative/visual/qdeclarativetextinput/cursorDelegate.qml2
-rw-r--r--tests/auto/declarative/visual/webview/zooming/renderControl.qml2
-rw-r--r--tests/auto/declarative/visual/webview/zooming/resolution.qml2
-rw-r--r--tests/auto/declarative/visual/webview/zooming/zoomTextOnly.qml2
37 files changed, 93 insertions, 77 deletions
diff --git a/demos/declarative/flickr/common/Loading.qml b/demos/declarative/flickr/common/Loading.qml
index 938a080..87a4ef9 100644
--- a/demos/declarative/flickr/common/Loading.qml
+++ b/demos/declarative/flickr/common/Loading.qml
@@ -1,8 +1,8 @@
import Qt 4.6
Image {
- id: loading; source: "pics/loading.png"; transformOrigin: "Center"
+ id: loading; source: "pics/loading.png"
NumberAnimation on rotation {
- from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900
+ from: 0; to: 360; running: loading.visible == true; loops: Qt.Infinite; duration: 900
}
}
diff --git a/demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml b/demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml
index 919ac43..fc83766 100644
--- a/demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml
+++ b/demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml
@@ -5,5 +5,5 @@ Image {
property bool on: false
source: "images/busy.png"; visible: container.on
- NumberAnimation on rotation { running: container.on; from: 0; to: 360; repeat: true; duration: 1200 }
+ NumberAnimation on rotation { running: container.on; from: 0; to: 360; loops: Qt.Infinite; duration: 1200 }
}
diff --git a/demos/declarative/twitter/TwitterCore/Loading.qml b/demos/declarative/twitter/TwitterCore/Loading.qml
index 76bf64b..e403b8d 100644
--- a/demos/declarative/twitter/TwitterCore/Loading.qml
+++ b/demos/declarative/twitter/TwitterCore/Loading.qml
@@ -1,8 +1,8 @@
import Qt 4.6
Image {
- id: loading; source: "images/loading.png"; transformOrigin: "Center"
+ id: loading; source: "images/loading.png"
NumberAnimation on rotation {
- from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900
+ from: 0; to: 360; running: loading.visible == true; loops: Qt.Infinite; duration: 900
}
}
diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc
index 7e0a787..00993f0 100644
--- a/doc/src/declarative/animation.qdoc
+++ b/doc/src/declarative/animation.qdoc
@@ -72,7 +72,7 @@ Rectangle {
x: 60-img.width/2
y: 0
SequentialAnimation on y {
- repeat: true
+ loops: Qt.Infinite
NumberAnimation { to: 200-img.height; easing.type: "OutBounce"; duration: 2000 }
PauseAnimation { duration: 1000 }
NumberAnimation { to: 0; easing.type: "OutQuad"; duration: 1000 }
diff --git a/examples/declarative/animations/color-animation.qml b/examples/declarative/animations/color-animation.qml
index 025134b..5d313c1 100644
--- a/examples/declarative/animations/color-animation.qml
+++ b/examples/declarative/animations/color-animation.qml
@@ -12,7 +12,7 @@ Item {
GradientStop {
position: 0.0
SequentialAnimation on color {
- repeat: true
+ loops: Qt.Infinite
ColorAnimation { from: "DeepSkyBlue"; to: "#0E1533"; duration: 5000 }
ColorAnimation { from: "#0E1533"; to: "DeepSkyBlue"; duration: 5000 }
}
@@ -20,7 +20,7 @@ Item {
GradientStop {
position: 1.0
SequentialAnimation on color {
- repeat: true
+ loops: Qt.Infinite
ColorAnimation { from: "SkyBlue"; to: "#437284"; duration: 5000 }
ColorAnimation { from: "#437284"; to: "SkyBlue"; duration: 5000 }
}
@@ -32,7 +32,7 @@ Item {
Item {
width: parent.width; height: 2 * parent.height
transformOrigin: Item.Center
- NumberAnimation on rotation { from: 0; to: 360; duration: 10000; repeat: true }
+ NumberAnimation on rotation { from: 0; to: 360; duration: 10000; loops: Qt.Infinite }
Image {
source: "images/sun.png"; y: 10; anchors.horizontalCenter: parent.horizontalCenter
transformOrigin: Item.Center; rotation: -3 * parent.rotation
@@ -46,7 +46,7 @@ Item {
source: "images/star.png"; angleDeviation: 360; velocity: 0
velocityDeviation: 0; count: parent.width / 10; fadeInDuration: 2800
SequentialAnimation on opacity {
- repeat: true
+ loops: Qt.Infinite
NumberAnimation { from: 0; to: 1; duration: 5000 }
NumberAnimation { from: 1; to: 0; duration: 5000 }
}
@@ -60,7 +60,7 @@ Item {
GradientStop {
position: 0.0
SequentialAnimation on color {
- repeat: true
+ loops: Qt.Infinite
ColorAnimation { from: "ForestGreen"; to: "#001600"; duration: 5000 }
ColorAnimation { from: "#001600"; to: "ForestGreen"; duration: 5000 }
}
diff --git a/examples/declarative/animations/property-animation.qml b/examples/declarative/animations/property-animation.qml
index 4428f34..d33b55d 100644
--- a/examples/declarative/animations/property-animation.qml
+++ b/examples/declarative/animations/property-animation.qml
@@ -43,7 +43,7 @@ Item {
// Animate the y property. Setting repeat to true makes the
// animation repeat indefinitely, otherwise it would only run once.
SequentialAnimation on y {
- repeat: true
+ loops: Qt.Infinite
// Move from minHeight to maxHeight in 300ms, using the OutExpo easing function
NumberAnimation {
diff --git a/examples/declarative/border-image/content/MyBorderImage.qml b/examples/declarative/border-image/content/MyBorderImage.qml
index 5621e18..bd0f5fb 100644
--- a/examples/declarative/border-image/content/MyBorderImage.qml
+++ b/examples/declarative/border-image/content/MyBorderImage.qml
@@ -18,13 +18,13 @@ Item {
id: image; x: container.width / 2 - width / 2; y: container.height / 2 - height / 2
SequentialAnimation on width {
- repeat: true
+ loops: Qt.Infinite
NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing.type: "InOutQuad"}
NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing.type: "InOutQuad" }
}
SequentialAnimation on height {
- repeat: true
+ loops: Qt.Infinite
NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing.type: "InOutQuad"}
NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing.type: "InOutQuad" }
}
diff --git a/examples/declarative/effects/effects.qml b/examples/declarative/effects/effects.qml
index 997d7de..45246a9 100644
--- a/examples/declarative/effects/effects.qml
+++ b/examples/declarative/effects/effects.qml
@@ -16,7 +16,7 @@ Rectangle {
running: false
from: 0; to: 10
duration: 1000
- repeat: true
+ loops: Qt.Infinite
}
}
@@ -33,7 +33,7 @@ Rectangle {
effect: DropShadow {
blurRadius: 3
offset.x: 3
- NumberAnimation on offset.y { id: dropShadowEffect; from: 0; to: 10; duration: 1000; running: false; repeat: true; }
+ NumberAnimation on offset.y { id: dropShadowEffect; from: 0; to: 10; duration: 1000; running: false; loops: Qt.Infinite; }
}
MouseArea { anchors.fill: parent; onClicked: dropShadowEffect.running = !dropShadowEffect.running }
diff --git a/examples/declarative/fillmode/fillmode.qml b/examples/declarative/fillmode/fillmode.qml
index ab0f81c..effb964 100644
--- a/examples/declarative/fillmode/fillmode.qml
+++ b/examples/declarative/fillmode/fillmode.qml
@@ -5,7 +5,7 @@ Image {
height: 250
source: "face.png"
SequentialAnimation on fillMode {
- repeat: true
+ loops: Qt.Infinite
PropertyAction { value: Image.Stretch }
PropertyAction { target: label; property: "text"; value: "Stretch" }
PauseAnimation { duration: 1000 }
diff --git a/examples/declarative/fonts/banner.qml b/examples/declarative/fonts/banner.qml
index 7989f80..bb4fe24 100644
--- a/examples/declarative/fonts/banner.qml
+++ b/examples/declarative/fonts/banner.qml
@@ -10,7 +10,7 @@ Rectangle {
Row {
y: -screen.height / 4.5
- NumberAnimation on x { from: 0; to: -text.width; duration: 6000; repeat: true }
+ NumberAnimation on x { from: 0; to: -text.width; duration: 6000; loops: Qt.Infinite }
Text { id: text; font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text }
Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text }
Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text }
diff --git a/examples/declarative/fonts/hello.qml b/examples/declarative/fonts/hello.qml
index 334409e..f703167 100644
--- a/examples/declarative/fonts/hello.qml
+++ b/examples/declarative/fonts/hello.qml
@@ -10,7 +10,7 @@ Rectangle {
text: "Hello world!"; font.pixelSize: 60
SequentialAnimation on font.letterSpacing {
- repeat: true;
+ loops: Qt.Infinite;
NumberAnimation { from: 100; to: 300; easing.type: "InQuad"; duration: 3000 }
ScriptAction { script: {
container.y = (screen.height / 4) + (Math.random() * screen.height / 2)
@@ -18,7 +18,7 @@ Rectangle {
} }
}
SequentialAnimation on opacity {
- repeat: true;
+ loops: Qt.Infinite;
NumberAnimation { from: 1; to: 0; duration: 2600 }
PauseAnimation { duration: 400 }
}
diff --git a/examples/declarative/listview/content/ClickAutoRepeating.qml b/examples/declarative/listview/content/ClickAutoRepeating.qml
index 5240e65..8ef4a52 100644
--- a/examples/declarative/listview/content/ClickAutoRepeating.qml
+++ b/examples/declarative/listview/content/ClickAutoRepeating.qml
@@ -18,7 +18,7 @@ Item {
ScriptAction { script: page.clicked() }
PauseAnimation { duration: repeatdelay }
SequentialAnimation {
- repeat: true
+ loops: Qt.Infinite
ScriptAction { script: page.clicked() }
PauseAnimation { duration: repeatperiod }
}
diff --git a/examples/declarative/parallax/qml/Smiley.qml b/examples/declarative/parallax/qml/Smiley.qml
index 4442d5e..75302a3 100644
--- a/examples/declarative/parallax/qml/Smiley.qml
+++ b/examples/declarative/parallax/qml/Smiley.qml
@@ -25,7 +25,7 @@ Item {
// Animate the y property. Setting repeat to true makes the
// animation repeat indefinitely, otherwise it would only run once.
SequentialAnimation on y {
- repeat: true
+ loops: Qt.Infinite
// Move from minHeight to maxHeight in 300ms, using the OutExpo easing function
NumberAnimation {
diff --git a/examples/declarative/progressbar/progressbars.qml b/examples/declarative/progressbar/progressbars.qml
index a66d544..ced3ccd 100644
--- a/examples/declarative/progressbar/progressbars.qml
+++ b/examples/declarative/progressbar/progressbars.qml
@@ -14,9 +14,9 @@ Rectangle {
ProgressBar {
property int r: Math.floor(Math.random() * 5000 + 1000)
width: main.width - 20
- NumberAnimation on value { duration: r; from: 0; to: 100; repeat: true }
- ColorAnimation on color { duration: r; from: "lightsteelblue"; to: "thistle"; repeat: true }
- ColorAnimation on secondColor { duration: r; from: "steelblue"; to: "#CD96CD"; repeat: true }
+ NumberAnimation on value { duration: r; from: 0; to: 100; loops: Qt.Infinite }
+ ColorAnimation on color { duration: r; from: "lightsteelblue"; to: "thistle"; loops: Qt.Infinite }
+ ColorAnimation on secondColor { duration: r; from: "steelblue"; to: "#CD96CD"; loops: Qt.Infinite }
}
}
}
diff --git a/examples/declarative/tvtennis/tvtennis.qml b/examples/declarative/tvtennis/tvtennis.qml
index 6022a15..138d587 100644
--- a/examples/declarative/tvtennis/tvtennis.qml
+++ b/examples/declarative/tvtennis/tvtennis.qml
@@ -21,7 +21,7 @@ Rectangle {
// Move the ball to the right and back to the left repeatedly
SequentialAnimation on x {
- repeat: true
+ loops: Qt.Infinite
NumberAnimation { to: page.width - 40; duration: 2000 }
ScriptAction { script: paddle.play() }
PropertyAction { target: ball; property: "direction"; value: "left" }
diff --git a/examples/declarative/webview/content/SpinSquare.qml b/examples/declarative/webview/content/SpinSquare.qml
index b65a29d..b0f568f 100644
--- a/examples/declarative/webview/content/SpinSquare.qml
+++ b/examples/declarative/webview/content/SpinSquare.qml
@@ -18,7 +18,7 @@ Item {
NumberAnimation on rotation {
from: 0
to: 360
- repeat: true
+ loops: Qt.Infinite
duration: root.period
}
}
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt
index fcb1228..b85cfb6 100644
--- a/src/declarative/QmlChanges.txt
+++ b/src/declarative/QmlChanges.txt
@@ -12,6 +12,7 @@ Using Particles now requires "import Qt.labs.particles 1.0"
AnchorAnimation must now be used to animate anchor changes (and not NumberAnimation)
Removed ParentAction (use ParentAnimation instead)
ScriptAction: renamed stateChangeScriptName -> scriptName
+Animation: replace repeat with loops (loops: Qt.Infinite gives the old repeat behavior)
C++ API
-------
diff --git a/src/declarative/qml/qdeclarativedom.cpp b/src/declarative/qml/qdeclarativedom.cpp
index cb56ead..e374a93 100644
--- a/src/declarative/qml/qdeclarativedom.cpp
+++ b/src/declarative/qml/qdeclarativedom.cpp
@@ -1107,8 +1107,7 @@ Rectangle {
x: NumberAnimation {
from: 0
to: 100
- repeat: true
- running: true
+ loops: Qt.Infinite
}
}
\endqml
@@ -1156,8 +1155,7 @@ Rectangle {
x: NumberAnimation {
from: 0
to: 100
- repeat: true
- running: true
+ loops: Qt.Infinite
}
}
\endqml
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index d4872e2..b4362ce 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -218,6 +218,8 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr
// XXX When the above a done some better way, that way should also be
// XXX used to add Qt.Sound class.
+ //for animations that loop forever
+ qtObject.setProperty(QLatin1String("Infinite"), -1);
//types
qtObject.setProperty(QLatin1String("rgba"), newFunction(QDeclarativeEnginePrivate::rgba, 4));
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index c17012c..81ab3d3 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -190,9 +190,13 @@ void QDeclarativeAbstractAnimation::setRunning(bool r)
d->running = r;
if (d->running) {
- if (d->alwaysRunToEnd && d->repeat
+ if (d->alwaysRunToEnd && d->loopCount != 1
&& qtAnimation()->state() == QAbstractAnimation::Running) {
- qtAnimation()->setLoopCount(-1);
+ //we've restarted before the final loop finished; restore proper loop count
+ if (d->loopCount == -1)
+ qtAnimation()->setLoopCount(d->loopCount);
+ else
+ qtAnimation()->setLoopCount(qtAnimation()->currentLoop() + d->loopCount);
}
if (!d->connectedTimeLine) {
@@ -204,8 +208,8 @@ void QDeclarativeAbstractAnimation::setRunning(bool r)
emit started();
} else {
if (d->alwaysRunToEnd) {
- if (d->repeat)
- qtAnimation()->setLoopCount(qtAnimation()->currentLoop()+1);
+ if (d->loopCount != 1)
+ qtAnimation()->setLoopCount(qtAnimation()->currentLoop()+1); //finish the current loop
} else
qtAnimation()->stop();
@@ -300,10 +304,12 @@ void QDeclarativeAbstractAnimation::setAlwaysRunToEnd(bool f)
}
/*!
- \qmlproperty bool Animation::repeat
- This property holds whether the animation should repeat.
+ \qmlproperty int Animation::loops
+ This property holds the number of times the animation should play.
+
+ By default, \c loops is 1: the animation will play through once and then stop.
- If set, the animation will continuously repeat until it is explicitly
+ If set to Qt.Infinite, the animation will continuously repeat until it is explicitly
stopped - either by setting the \c running property to false, or by calling
the \c stop() method.
@@ -311,28 +317,33 @@ void QDeclarativeAbstractAnimation::setAlwaysRunToEnd(bool f)
\code
Rectangle {
- NumberAnimation on rotation { running: true; repeat: true; from: 0 to: 360 }
+ width: 100; height: 100; color: "green"
+ RotationAnimation on rotation {
+ loops: Qt.Infinite
+ from: 0
+ to: 360
+ }
}
\endcode
*/
-bool QDeclarativeAbstractAnimation::repeat() const
+int QDeclarativeAbstractAnimation::loops() const
{
Q_D(const QDeclarativeAbstractAnimation);
- return d->repeat;
+ return d->loopCount;
}
-void QDeclarativeAbstractAnimation::setRepeat(bool r)
+void QDeclarativeAbstractAnimation::setLoops(int loops)
{
Q_D(QDeclarativeAbstractAnimation);
- if (r == d->repeat)
+ if (loops == d->loopCount)
return;
- d->repeat = r;
- int lc = r ? -1 : 1;
- qtAnimation()->setLoopCount(lc);
- emit repeatChanged(r);
+ d->loopCount = loops;
+ qtAnimation()->setLoopCount(loops);
+ emit loopCountChanged(loops);
}
+
int QDeclarativeAbstractAnimation::currentTime()
{
return qtAnimation()->currentLoopTime();
@@ -509,8 +520,9 @@ void QDeclarativeAbstractAnimation::timelineComplete()
{
Q_D(QDeclarativeAbstractAnimation);
setRunning(false);
- if (d->alwaysRunToEnd && d->repeat) {
- qtAnimation()->setLoopCount(-1);
+ if (d->alwaysRunToEnd && d->loopCount != 1) {
+ //restore the proper loopCount for the next run
+ qtAnimation()->setLoopCount(d->loopCount);
}
}
@@ -1586,7 +1598,7 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int
\qml
Rectangle {
SequentialAnimation on x {
- repeat: true
+ loops: Qt.Infinite
PropertyAnimation { to: 50 }
PropertyAnimation { to: 0 }
}
@@ -1995,7 +2007,7 @@ void QDeclarativePropertyAnimation::setProperties(const QString &prop)
id: theRect
width: 100; height: 100
color: Qt.rgba(0,0,1)
- NumberAnimation on x { to: 500; repeat: true } //animate theRect's x property
+ NumberAnimation on x { to: 500; loops: Qt.Infinite } //animate theRect's x property
Behavior on y { NumberAnimation {} } //animate theRect's y property
}
\endqml
diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h
index 33d5c35..2e5b87c 100644
--- a/src/declarative/util/qdeclarativeanimation_p.h
+++ b/src/declarative/util/qdeclarativeanimation_p.h
@@ -73,7 +73,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeAbstractAnimation : public QObject, public Q
Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged)
Q_PROPERTY(bool alwaysRunToEnd READ alwaysRunToEnd WRITE setAlwaysRunToEnd NOTIFY alwaysRunToEndChanged)
- Q_PROPERTY(bool repeat READ repeat WRITE setRepeat NOTIFY repeatChanged)
+ Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopsChanged)
Q_CLASSINFO("DefaultMethod", "start()")
public:
@@ -86,8 +86,9 @@ public:
void setPaused(bool);
bool alwaysRunToEnd() const;
void setAlwaysRunToEnd(bool);
- bool repeat() const;
- void setRepeat(bool);
+
+ int loops() const;
+ void setLoops(int);
int currentTime();
void setCurrentTime(int);
@@ -106,8 +107,8 @@ Q_SIGNALS:
void completed();
void runningChanged(bool);
void pausedChanged(bool);
- void repeatChanged(bool);
void alwaysRunToEndChanged(bool);
+ void loopCountChanged(int);
public Q_SLOTS:
void restart();
diff --git a/src/declarative/util/qdeclarativeanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h
index decd993..3908e50 100644
--- a/src/declarative/util/qdeclarativeanimation_p_p.h
+++ b/src/declarative/util/qdeclarativeanimation_p_p.h
@@ -225,19 +225,21 @@ class QDeclarativeAbstractAnimationPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QDeclarativeAbstractAnimation)
public:
QDeclarativeAbstractAnimationPrivate()
- : running(false), paused(false), alwaysRunToEnd(false), repeat(false),
+ : running(false), paused(false), alwaysRunToEnd(false),
connectedTimeLine(false), componentComplete(true),
- avoidPropertyValueSourceStart(false), disableUserControl(false), group(0) {}
+ avoidPropertyValueSourceStart(false), disableUserControl(false),
+ loopCount(1), group(0) {}
bool running:1;
bool paused:1;
bool alwaysRunToEnd:1;
- bool repeat:1;
bool connectedTimeLine:1;
bool componentComplete:1;
bool avoidPropertyValueSourceStart:1;
bool disableUserControl:1;
+ int loopCount;
+
void commence();
QDeclarativeProperty defaultProperty;
diff --git a/src/declarative/util/qdeclarativespringfollow.cpp b/src/declarative/util/qdeclarativespringfollow.cpp
index 1d69dd3..ca88b24 100644
--- a/src/declarative/util/qdeclarativespringfollow.cpp
+++ b/src/declarative/util/qdeclarativespringfollow.cpp
@@ -224,11 +224,11 @@ void QDeclarativeSpringFollowPrivate::stop()
color: "#00ff00"
y: 200 // initial value
SequentialAnimation on y {
- running: true
- repeat: true
+ loops: Qt.Infinite
NumberAnimation {
to: 200
- easing: "easeOutBounce(amplitude:100)"
+ easing.type: "OutBounce"
+ easing.amplitude: 100
duration: 2000
}
PauseAnimation { duration: 1000 }
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml b/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml
index 408ad87..ed43082 100644
--- a/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml
+++ b/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml
@@ -10,7 +10,7 @@ Rectangle {
width: 100; height: 100
color: Qt.rgba(1,0,0)
Behavior on x {
- NumberAnimation { id: myAnim; objectName: "MyAnim"; target: redRect; property: "y"; to: 300; repeat: true}
+ NumberAnimation { id: myAnim; objectName: "MyAnim"; target: redRect; property: "y"; to: 300; loops: Qt.Infinite}
}
}
diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
index bce7166..f018ce1 100644
--- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
+++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
@@ -204,9 +204,9 @@ void tst_qdeclarativeanimations::alwaysRunToEnd()
animation.setProperty("x");
animation.setTo(200);
animation.setDuration(1000);
- animation.setRepeat(true);
+ animation.setLoops(-1);
animation.setAlwaysRunToEnd(true);
- QVERIFY(animation.repeat() == true);
+ QVERIFY(animation.loops() == -1);
QVERIFY(animation.alwaysRunToEnd() == true);
animation.start();
QTest::qWait(1500);
diff --git a/tests/auto/declarative/visual/animation/loop/loop.qml b/tests/auto/declarative/visual/animation/loop/loop.qml
index f6049ae..36f3ece 100644
--- a/tests/auto/declarative/visual/animation/loop/loop.qml
+++ b/tests/auto/declarative/visual/animation/loop/loop.qml
@@ -14,7 +14,7 @@ Rectangle {
back to 100, jumps to 200, and so on.
*/
x: SequentialAnimation {
- repeat: true
+ loops: Qt.Infinite
NumberAnimation { to: 100; duration: 1000 }
NumberAnimation { from: 200; to: 400; duration: 1000 }
}
diff --git a/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml b/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml
index 24ca76b..0429171 100644
--- a/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml
+++ b/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml
@@ -11,7 +11,7 @@ Rectangle {
x: 60-width/2
y: 200-height
y: SequentialAnimation {
- repeat: true
+ loops: Qt.Infinite
NumberAnimation {
to: 0; duration: 500
easing.type: "InOutQuad"
diff --git a/tests/auto/declarative/visual/qdeclarativeborderimage/content/MyBorderImage.qml b/tests/auto/declarative/visual/qdeclarativeborderimage/content/MyBorderImage.qml
index e268ce7..2beb1dd 100644
--- a/tests/auto/declarative/visual/qdeclarativeborderimage/content/MyBorderImage.qml
+++ b/tests/auto/declarative/visual/qdeclarativeborderimage/content/MyBorderImage.qml
@@ -19,13 +19,13 @@ Item {
id: image; x: container.width / 2 - width / 2; y: container.height / 2 - height / 2
width: SequentialAnimation {
- repeat: true
+ loops: Qt.Infinite
NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing.type: "InOutQuad"}
NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing.type: "InOutQuad" }
}
height: SequentialAnimation {
- repeat: true
+ loops: Qt.Infinite
NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing.type: "InOutQuad"}
NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing.type: "InOutQuad" }
}
diff --git a/tests/auto/declarative/visual/qdeclarativeeasefollow/easefollow.qml b/tests/auto/declarative/visual/qdeclarativeeasefollow/easefollow.qml
index bd3270f..c9e65fe 100644
--- a/tests/auto/declarative/visual/qdeclarativeeasefollow/easefollow.qml
+++ b/tests/auto/declarative/visual/qdeclarativeeasefollow/easefollow.qml
@@ -7,7 +7,7 @@ Rectangle {
id: rect
width: 50; height: 20; y: 30; color: "black"
x: SequentialAnimation {
- repeat: true
+ loops: Qt.Infinite
NumberAnimation { from: 50; to: 700; duration: 2000 }
NumberAnimation { from: 700; to: 50; duration: 2000 }
}
diff --git a/tests/auto/declarative/visual/qdeclarativespringfollow/follow.qml b/tests/auto/declarative/visual/qdeclarativespringfollow/follow.qml
index 62503e4..4809a9c 100644
--- a/tests/auto/declarative/visual/qdeclarativespringfollow/follow.qml
+++ b/tests/auto/declarative/visual/qdeclarativespringfollow/follow.qml
@@ -8,7 +8,7 @@ Rectangle {
color: "#00ff00"
y: 200; width: 60; height: 20
y: SequentialAnimation {
- repeat: true
+ loops: Qt.Infinite
NumberAnimation {
to: 20; duration: 500
easing.type: "InOutQuad"
diff --git a/tests/auto/declarative/visual/qdeclarativetext/elide/elide2.qml b/tests/auto/declarative/visual/qdeclarativetext/elide/elide2.qml
index c163e05..7b1042b 100644
--- a/tests/auto/declarative/visual/qdeclarativetext/elide/elide2.qml
+++ b/tests/auto/declarative/visual/qdeclarativetext/elide/elide2.qml
@@ -5,7 +5,7 @@ Rectangle {
height: 100
Text {
- width: NumberAnimation { from: 500; to: 0; repeat: true; duration: 5000 }
+ width: NumberAnimation { from: 500; to: 0; loops: Qt.Infinite; duration: 5000 }
elide: Text.ElideRight
text: 'Here is some very long text that we should truncate when sizing window'
}
diff --git a/tests/auto/declarative/visual/qdeclarativetext/elide/multilength.qml b/tests/auto/declarative/visual/qdeclarativetext/elide/multilength.qml
index ca41eab..21763b2 100644
--- a/tests/auto/declarative/visual/qdeclarativetext/elide/multilength.qml
+++ b/tests/auto/declarative/visual/qdeclarativetext/elide/multilength.qml
@@ -11,7 +11,7 @@ Rectangle {
anchors.centerIn: parent
Text {
id: myText
- width: NumberAnimation { from: 500; to: 0; repeat: true; duration: 1000 }
+ width: NumberAnimation { from: 500; to: 0; loops: Qt.Infinite; duration: 1000 }
elide: "ElideRight"
text: "Brevity is the soul of wit, and tediousness the limbs and outward flourishes.\x9CBrevity is a great charm of eloquence.\x9CBe concise!\x9CSHHHHHHHHHHHHHHHHHHHHHHHHHHHH"
}
diff --git a/tests/auto/declarative/visual/qdeclarativetextedit/cursorDelegate.qml b/tests/auto/declarative/visual/qdeclarativetextedit/cursorDelegate.qml
index 176a5b8..f50aec6 100644
--- a/tests/auto/declarative/visual/qdeclarativetextedit/cursorDelegate.qml
+++ b/tests/auto/declarative/visual/qdeclarativetextedit/cursorDelegate.qml
@@ -10,7 +10,7 @@ import Qt 4.6
Rectangle { id:top; color: "black"; width: 3; height: 1; x: -1; y:0}
Rectangle { id:bottom; color: "black"; width: 3; height: 1; x: -1; anchors.bottom: parent.bottom;}
opacity: 1
- opacity: SequentialAnimation { running: cPage.parent.focus == true; repeat: true;
+ opacity: SequentialAnimation { running: cPage.parent.focus == true; loops: Qt.Infinite;
NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing.type: "InQuad"}
NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing.type: "OutQuad"}
}
diff --git a/tests/auto/declarative/visual/qdeclarativetextinput/cursorDelegate.qml b/tests/auto/declarative/visual/qdeclarativetextinput/cursorDelegate.qml
index 6a4e7fa..7b981ac 100644
--- a/tests/auto/declarative/visual/qdeclarativetextinput/cursorDelegate.qml
+++ b/tests/auto/declarative/visual/qdeclarativetextinput/cursorDelegate.qml
@@ -10,7 +10,7 @@ import Qt 4.6
Rectangle { id:top; color: "black"; width: 3; height: 1; x: -1; y:0}
Rectangle { id:bottom; color: "black"; width: 3; height: 1; x: -1; anchors.bottom: parent.bottom;}
opacity: 1
- opacity: SequentialAnimation { running: cPage.parent.focus == true; repeat: true;
+ opacity: SequentialAnimation { running: cPage.parent.focus == true; loops: Qt.Infinite;
NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing.type: "InQuad"}
NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing.type: "OutQuad"}
}
diff --git a/tests/auto/declarative/visual/webview/zooming/renderControl.qml b/tests/auto/declarative/visual/webview/zooming/renderControl.qml
index 49eb91b..406e156 100644
--- a/tests/auto/declarative/visual/webview/zooming/renderControl.qml
+++ b/tests/auto/declarative/visual/webview/zooming/renderControl.qml
@@ -10,7 +10,7 @@ Rectangle {
width: 400
url: "renderControl.html"
x: SequentialAnimation {
- repeat: true
+ loops: Qt.Infinite
NumberAnimation { from: 100; to: 0; duration: 200 }
PropertyAction { target: webview; property: "renderingEnabled"; value: false }
NumberAnimation { from: 0; to: -100; duration: 200 }
diff --git a/tests/auto/declarative/visual/webview/zooming/resolution.qml b/tests/auto/declarative/visual/webview/zooming/resolution.qml
index 8542768..57cc17b 100644
--- a/tests/auto/declarative/visual/webview/zooming/resolution.qml
+++ b/tests/auto/declarative/visual/webview/zooming/resolution.qml
@@ -8,7 +8,7 @@ WebView {
url: "resolution.html"
zoomFactor:
SequentialAnimation {
- repeat: true
+ loops: Qt.Infinite
NumberAnimation { from: 1; to: 0.25; duration: 2000 }
NumberAnimation { from: 0.25; to: 1; duration: 2000 }
NumberAnimation { from: 1; to: 5; duration: 2000 }
diff --git a/tests/auto/declarative/visual/webview/zooming/zoomTextOnly.qml b/tests/auto/declarative/visual/webview/zooming/zoomTextOnly.qml
index c2e9348..f4c8aaa 100644
--- a/tests/auto/declarative/visual/webview/zooming/zoomTextOnly.qml
+++ b/tests/auto/declarative/visual/webview/zooming/zoomTextOnly.qml
@@ -8,7 +8,7 @@ WebView {
settings.zoomTextOnly: true
zoomFactor:
SequentialAnimation {
- repeat: true
+ loops: Qt.Infinite
NumberAnimation { from: 2; to: 0.25; duration: 1000 }
NumberAnimation { from: 0.25; to: 2; duration: 1000 }
}