if (m_previousLoop < m_currentLoop) {
// we need to fast forward to the end
for (QAbstractAnimationJob *anim = m_currentAnimation; anim; anim = anim->nextSibling()) {
- setCurrentAnimation(anim, true);
+ RETURN_IF_DELETED(setCurrentAnimation(anim, true));
RETURN_IF_DELETED(anim->setCurrentTime(animationActualTotalDuration(anim)));
}
// this will make sure the current animation is reset to the beginning
- if (firstChild() && !firstChild()->nextSibling()) //count == 1
+ if (firstChild() && !firstChild()->nextSibling()) { //count == 1
// we need to force activation because setCurrentAnimation will have no effect
- activateCurrentAnimation();
- else
- setCurrentAnimation(firstChild(), true);
+ RETURN_IF_DELETED(activateCurrentAnimation());
+ } else {
+ RETURN_IF_DELETED(setCurrentAnimation(firstChild(), true));
+ }
}
// and now we need to fast forward from the current position to
for (QAbstractAnimationJob *anim = m_currentAnimation; anim && anim != newAnimationIndex.animation; anim = anim->nextSibling()) { //### WRONG,
- setCurrentAnimation(anim, true);
+ RETURN_IF_DELETED(setCurrentAnimation(anim, true));
RETURN_IF_DELETED(anim->setCurrentTime(animationActualTotalDuration(anim)));
}
// setting the new current animation will happen later
if (m_previousLoop > m_currentLoop) {
// we need to fast rewind to the beginning
for (QAbstractAnimationJob *anim = m_currentAnimation; anim; anim = anim->previousSibling()) {
- setCurrentAnimation(anim, true);
+ RETURN_IF_DELETED(setCurrentAnimation(anim, true));
RETURN_IF_DELETED(anim->setCurrentTime(0));
}
// this will make sure the current animation is reset to the end
- if (lastChild() && !lastChild()->previousSibling()) //count == 1
+ if (lastChild() && !lastChild()->previousSibling()) { //count == 1
// we need to force activation because setCurrentAnimation will have no effect
- activateCurrentAnimation();
- else {
- setCurrentAnimation(lastChild(), true);
+ RETURN_IF_DELETED(activateCurrentAnimation());
+ } else {
+ RETURN_IF_DELETED(setCurrentAnimation(lastChild(), true));
}
}
// and now we need to fast rewind from the current position to
for (QAbstractAnimationJob *anim = m_currentAnimation; anim && anim != newAnimationIndex.animation; anim = anim->previousSibling()) {
- setCurrentAnimation(anim, true);
+ RETURN_IF_DELETED(setCurrentAnimation(anim, true));
RETURN_IF_DELETED(anim->setCurrentTime(0));
}
// setting the new current animation will happen later
RETURN_IF_DELETED(rewindForwards(newAnimationIndex));
}
- setCurrentAnimation(newAnimationIndex.animation);
+ RETURN_IF_DELETED(setCurrentAnimation(newAnimationIndex.animation));
const int newCurrentTime = currentTime - newAnimationIndex.timeOffset;
if (m_currentAnimation->totalDuration() == -1)
resetUncontrolledAnimationFinishTime(m_currentAnimation);
- m_currentAnimation->start();
+ RETURN_IF_DELETED(m_currentAnimation->start());
if (!intermediate && isPaused())
m_currentAnimation->pause();
}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2014 Jolla Ltd.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ width: 400; height: 400
+
+ Component.onCompleted: rect.state = "wide"
+
+ Rectangle {
+ id: rect
+
+ color: "green"
+ width: 50
+ height: 50
+ anchors.centerIn: parent
+
+ states: State {
+ name: "wide"
+ PropertyChanges {
+ target: rect
+ width: 100
+ }
+ }
+ transitions: Transition {
+ to: "wide"
+ SequentialAnimation {
+ NumberAnimation { duration: 200; property: "width" }
+ ScriptAction { script: { rect.state = ""; rect.state = "wide" } }
+ }
+ }
+ }
+}