summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-04-22 04:52:44 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-04-22 04:52:44 (GMT)
commitf2c5ea07b2ed5f96bd32f9a1d71ec9613c240fa6 (patch)
tree390ae15f24cd5b6af85b9bc74c39fd90ba03144b /src/corelib
parent1139eb432a18d556efb4ecfc079e82c2e2093b96 (diff)
parent3f39c3380f97339a1ffb9d13d7b184a8315d3821 (diff)
downloadQt-f2c5ea07b2ed5f96bd32f9a1d71ec9613c240fa6.zip
Qt-f2c5ea07b2ed5f96bd32f9a1d71ec9613c240fa6.tar.gz
Qt-f2c5ea07b2ed5f96bd32f9a1d71ec9613c240fa6.tar.bz2
Merge branch 'kinetic-animations' of ../../qt/kinetic into kinetic-declarativeui
Conflicts: src/gui/graphicsview/qgraphicsitem.cpp
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/animation/qabstractanimation.cpp94
-rw-r--r--src/corelib/animation/qabstractanimation.h12
-rw-r--r--src/corelib/animation/qabstractanimation_p.h8
-rw-r--r--src/corelib/animation/qanimationgroup.cpp3
-rw-r--r--src/corelib/animation/qparallelanimationgroup.cpp24
-rw-r--r--src/corelib/animation/qparallelanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qpropertyanimation.cpp6
-rw-r--r--src/corelib/animation/qpropertyanimation.h1
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp28
-rw-r--r--src/corelib/animation/qsequentialanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qvariantanimation.cpp6
-rw-r--r--src/corelib/animation/qvariantanimation.h3
-rw-r--r--src/corelib/animation/qvariantanimation_p.h4
-rw-r--r--src/corelib/kernel/qcoreevent.cpp3
-rw-r--r--src/corelib/statemachine/qabstractstate.cpp115
-rw-r--r--src/corelib/statemachine/qabstractstate.h48
-rw-r--r--src/corelib/statemachine/qabstractstate_p.h51
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp88
-rw-r--r--src/corelib/statemachine/qabstracttransition.h46
-rw-r--r--src/corelib/statemachine/qabstracttransition_p.h38
-rw-r--r--src/corelib/statemachine/qactionstate.cpp162
-rw-r--r--src/corelib/statemachine/qactionstate.h47
-rw-r--r--src/corelib/statemachine/qactionstate_p.h36
-rw-r--r--src/corelib/statemachine/qactiontransition.cpp230
-rw-r--r--src/corelib/statemachine/qactiontransition.h96
-rw-r--r--src/corelib/statemachine/qactiontransition_p.h80
-rw-r--r--src/corelib/statemachine/qanimationstate.cpp574
-rw-r--r--src/corelib/statemachine/qanimationstate.h63
-rw-r--r--src/corelib/statemachine/qboundevent_p.h34
-rw-r--r--src/corelib/statemachine/qeventtransition.cpp65
-rw-r--r--src/corelib/statemachine/qeventtransition.h45
-rw-r--r--src/corelib/statemachine/qeventtransition_p.h38
-rw-r--r--src/corelib/statemachine/qfinalstate.cpp35
-rw-r--r--src/corelib/statemachine/qfinalstate.h34
-rw-r--r--src/corelib/statemachine/qhistorystate.cpp35
-rw-r--r--src/corelib/statemachine/qhistorystate.h34
-rw-r--r--src/corelib/statemachine/qhistorystate_p.h34
-rw-r--r--src/corelib/statemachine/qsignalevent.h34
-rw-r--r--src/corelib/statemachine/qsignaleventgenerator_p.h34
-rw-r--r--src/corelib/statemachine/qsignaltransition.cpp53
-rw-r--r--src/corelib/statemachine/qsignaltransition.h41
-rw-r--r--src/corelib/statemachine/qsignaltransition_p.h38
-rw-r--r--src/corelib/statemachine/qstate.cpp149
-rw-r--r--src/corelib/statemachine/qstate.h54
-rw-r--r--src/corelib/statemachine/qstate_p.h34
-rw-r--r--src/corelib/statemachine/qstateaction.cpp187
-rw-r--r--src/corelib/statemachine/qstateaction.h66
-rw-r--r--src/corelib/statemachine/qstateaction_p.h49
-rw-r--r--src/corelib/statemachine/qstatefinishedevent.h34
-rw-r--r--src/corelib/statemachine/qstatefinishedtransition.cpp51
-rw-r--r--src/corelib/statemachine/qstatefinishedtransition.h41
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp409
-rw-r--r--src/corelib/statemachine/qstatemachine.h47
-rw-r--r--src/corelib/statemachine/qstatemachine_p.h69
-rw-r--r--src/corelib/statemachine/qtransition.cpp230
-rw-r--r--src/corelib/statemachine/qtransition.h68
-rw-r--r--src/corelib/statemachine/qtransition_p.h50
-rw-r--r--src/corelib/statemachine/statemachine.pri11
58 files changed, 2190 insertions, 1787 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 08dc11c..6c55a77 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -55,15 +55,15 @@
QVariantAnimation and QAnimationGroup, instead.
QAbstractAnimation provides an interface for the current time and
- duration, the iteration count, and the state of an animation. These properties
+ duration, the loop count, and the state of an animation. These properties
define the base functionality common to all animations in Qt. The virtual
duration() function returns the local duration of the animation; i.e., for
how long the animation should update the current time before
looping. Subclasses can implement this function differently; for example,
QVariantAnimation returns the duration of a simple animated property, whereas
QAnimationGroup returns the duration of a set or sequence of
- animations. You can also set a loop count by calling setIterationCount(); a
- iteration count of 2 will let the animation run twice (the default value is
+ animations. You can also set a loop count by calling setLoopCount(); a
+ loop count of 2 will let the animation run twice (the default value is
1).
Like QTimeLine, QAbstractAnimation also provides an interface for starting
@@ -119,12 +119,12 @@
*/
/*!
- \fn QAbstractAnimation::currentIterationChanged(int currentIteration)
+ \fn QAbstractAnimation::currentLoopChanged(int currentLoop)
- QAbstractAnimation emits this signal whenever the current iteration
- changes. \a currentIteration is the current iteration.
+ QAbstractAnimation emits this signal whenever the current loop
+ changes. \a currentLoop is the current loop.
- \sa currentIteration(), iterationCount()
+ \sa currentLoop(), loopCount()
*/
/*!
@@ -255,7 +255,7 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
QAbstractAnimation::State oldState = state;
int oldCurrentTime = currentTime;
- int oldCurrentIteration = currentIteration;
+ int oldCurrentLoop = currentLoop;
QAbstractAnimation::Direction oldDirection = direction;
state = newState;
@@ -284,7 +284,7 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
if (direction == QAbstractAnimation::Forward)
q->setCurrentTime(0);
else
- q->setCurrentTime(iterationCount == -1 ? q->duration() : q->totalDuration());
+ q->setCurrentTime(loopCount == -1 ? q->duration() : q->totalDuration());
}
// Check if the setCurrentTime() function called stop().
@@ -312,8 +312,8 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
QUnifiedTimer::instance()->unregisterAnimation(q);
- if (dura == -1 || iterationCount < 0
- || (oldDirection == QAbstractAnimation::Forward && (oldCurrentTime * (oldCurrentIteration + 1)) == (dura * iterationCount))
+ if (dura == -1 || loopCount < 0
+ || (oldDirection == QAbstractAnimation::Forward && (oldCurrentTime * (oldCurrentLoop + 1)) == (dura * loopCount))
|| (oldDirection == QAbstractAnimation::Backward && oldCurrentTime == 0)) {
if (guard)
emit q->finished();
@@ -469,10 +469,10 @@ void QAbstractAnimation::setDirection(Direction direction)
if (state() == Stopped) {
if (direction == Backward) {
d->currentTime = duration();
- d->currentIteration = d->iterationCount - 1;
+ d->currentLoop = d->loopCount - 1;
} else {
d->currentTime = 0;
- d->currentIteration = 0;
+ d->currentLoop = 0;
}
}
updateDirection(direction);
@@ -484,14 +484,14 @@ void QAbstractAnimation::setDirection(Direction direction)
\brief the duration of the animation.
If the duration is -1, it means that the duration is undefined.
- In this case, iterationCount is ignored.
+ In this case, loopCount is ignored.
*/
/*!
- \property QAbstractAnimation::iterationCount
- \brief the iteration count of the animation
+ \property QAbstractAnimation::loopCount
+ \brief the loop count of the animation
- This property describes the iteration count of the animation as an integer.
+ This property describes the loop count of the animation as an integer.
By default this value is 1, indicating that the animation
should run once only, and then stop. By changing it you can let the
animation loop several times. With a value of 0, the animation will not
@@ -500,34 +500,34 @@ void QAbstractAnimation::setDirection(Direction direction)
It is not supported to have loop on an animation that has an undefined
duration. It will only run once.
*/
-int QAbstractAnimation::iterationCount() const
+int QAbstractAnimation::loopCount() const
{
Q_D(const QAbstractAnimation);
- return d->iterationCount;
+ return d->loopCount;
}
-void QAbstractAnimation::setIterationCount(int iterationCount)
+void QAbstractAnimation::setLoopCount(int loopCount)
{
Q_D(QAbstractAnimation);
- d->iterationCount = iterationCount;
+ d->loopCount = loopCount;
}
/*!
- \property QAbstractAnimation::currentIteration
- \brief the current iteration of the animation
+ \property QAbstractAnimation::currentLoop
+ \brief the current loop of the animation
- This property describes the current iteration of the animation. By default,
- the animation's iteration count is 1, and so the current iteration will
- always be 0. If the iteration count is 2 and the animation runs past its
+ This property describes the current loop of the animation. By default,
+ the animation's loop count is 1, and so the current loop will
+ always be 0. If the loop count is 2 and the animation runs past its
duration, it will automatically rewind and restart at current time 0, and
- current iteration 1, and so on.
+ current loop 1, and so on.
- When the current iteration changes, QAbstractAnimation emits the
- currentIterationChanged() signal.
+ When the current loop changes, QAbstractAnimation emits the
+ currentLoopChanged() signal.
*/
-int QAbstractAnimation::currentIteration() const
+int QAbstractAnimation::currentLoop() const
{
Q_D(const QAbstractAnimation);
- return d->currentIteration;
+ return d->currentLoop;
}
/*!
@@ -535,7 +535,7 @@ int QAbstractAnimation::currentIteration() const
This pure virtual function returns the duration of the animation, and
defines for how long QAbstractAnimation should update the current
- time. This duration is local, and does not include the iteration count.
+ time. This duration is local, and does not include the loop count.
A return value of -1 indicates that the animation has no defined duration;
the animation should run forever until stopped. This is useful for
@@ -545,24 +545,24 @@ int QAbstractAnimation::currentIteration() const
If the animation is a parallel QAnimationGroup, the duration will be the longest
duration of all its animations. If the animation is a sequential QAnimationGroup,
the duration will be the sum of the duration of all its animations.
- \sa iterationCount
+ \sa loopCount
*/
/*!
Returns the total and effective duration of the animation, including the
- iteration count.
+ loop count.
\sa duration(), currentTime
*/
int QAbstractAnimation::totalDuration() const
{
Q_D(const QAbstractAnimation);
- if (d->iterationCount < 0)
+ if (d->loopCount < 0)
return -1;
int dura = duration();
if (dura == -1)
return -1;
- return dura * d->iterationCount;
+ return dura * d->loopCount;
}
/*!
@@ -575,11 +575,11 @@ int QAbstractAnimation::totalDuration() const
progresses.
The animation's current time starts at 0, and ends at duration(). If the
- animation's iterationCount is larger than 1, the current time will rewind and
+ animation's loopCount is larger than 1, the current time will rewind and
start at 0 again for the consecutive loops. If the animation has a pause.
currentTime will also include the duration of the pause.
- \sa iterationCount
+ \sa loopCount
*/
int QAbstractAnimation::currentTime() const
{
@@ -593,31 +593,31 @@ void QAbstractAnimation::setCurrentTime(int msecs)
// Calculate new time and loop.
int dura = duration();
- int totalDura = (d->iterationCount < 0 || dura == -1) ? -1 : dura * d->iterationCount;
+ int totalDura = (d->loopCount < 0 || dura == -1) ? -1 : dura * d->loopCount;
if (totalDura != -1)
msecs = qMin(totalDura, msecs);
d->totalCurrentTime = msecs;
// Update new values.
- int oldLoop = d->currentIteration;
- d->currentIteration = ((dura <= 0) ? 0 : (msecs / dura));
- if (d->currentIteration == d->iterationCount) {
+ int oldLoop = d->currentLoop;
+ d->currentLoop = ((dura <= 0) ? 0 : (msecs / dura));
+ if (d->currentLoop == d->loopCount) {
//we're at the end
d->currentTime = qMax(0, dura);
- d->currentIteration = qMax(0, d->iterationCount - 1);
+ d->currentLoop = qMax(0, d->loopCount - 1);
} else {
if (d->direction == Forward) {
d->currentTime = (dura <= 0) ? msecs : (msecs % dura);
} else {
d->currentTime = (dura <= 0) ? msecs : ((msecs - 1) % dura) + 1;
if (d->currentTime == dura)
- --d->currentIteration;
+ --d->currentLoop;
}
}
updateCurrentTime(msecs);
- if (d->currentIteration != oldLoop)
- emit currentIterationChanged(d->currentIteration);
+ if (d->currentLoop != oldLoop)
+ emit currentLoopChanged(d->currentLoop);
// All animations are responsible for stopping the animation when their
// own end state is reached; in this case the animation is time driven,
@@ -658,7 +658,7 @@ void QAbstractAnimation::start(DeletionPolicy policy)
signal, and state() returns Stopped. The current time is not changed.
If the animation stops by itself after reaching the end (i.e.,
- currentTime() == duration() and currentIteration() > iterationCount() - 1), the
+ currentTime() == duration() and currentLoop() > loopCount() - 1), the
finished() signal is emitted.
\sa start(), state()
diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h
index d6260cd..a7f0082 100644
--- a/src/corelib/animation/qabstractanimation.h
+++ b/src/corelib/animation/qabstractanimation.h
@@ -60,9 +60,9 @@ class Q_CORE_EXPORT QAbstractAnimation : public QObject
{
Q_OBJECT
Q_PROPERTY(State state READ state NOTIFY stateChanged)
- Q_PROPERTY(int iterationCount READ iterationCount WRITE setIterationCount)
+ Q_PROPERTY(int loopCount READ loopCount WRITE setLoopCount)
Q_PROPERTY(int currentTime READ currentTime WRITE setCurrentTime)
- Q_PROPERTY(int currentIteration READ currentIteration NOTIFY currentIterationChanged)
+ Q_PROPERTY(int currentLoop READ currentLoop NOTIFY currentLoopChanged)
Q_PROPERTY(Direction direction READ direction WRITE setDirection NOTIFY directionChanged)
Q_PROPERTY(int duration READ duration)
@@ -93,9 +93,9 @@ public:
Direction direction() const;
void setDirection(Direction direction);
- int iterationCount() const;
- void setIterationCount(int iterationCount);
- int currentIteration() const;
+ int loopCount() const;
+ void setLoopCount(int loopCount);
+ int currentLoop() const;
virtual int duration() const = 0;
int totalDuration() const;
@@ -105,7 +105,7 @@ public:
Q_SIGNALS:
void finished();
void stateChanged(QAbstractAnimation::State oldState, QAbstractAnimation::State newState);
- void currentIterationChanged(int currentIteration);
+ void currentLoopChanged(int currentLoop);
void directionChanged(QAbstractAnimation::Direction);
public Q_SLOTS:
diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h
index 39cca56..08eed2b 100644
--- a/src/corelib/animation/qabstractanimation_p.h
+++ b/src/corelib/animation/qabstractanimation_p.h
@@ -78,8 +78,8 @@ public:
deleteWhenStopped(false),
totalCurrentTime(0),
currentTime(0),
- iterationCount(1),
- currentIteration(0),
+ loopCount(1),
+ currentLoop(0),
group(0)
{
}
@@ -98,8 +98,8 @@ public:
int totalCurrentTime;
int currentTime;
- int iterationCount;
- int currentIteration;
+ int loopCount;
+ int currentLoop;
QAnimationGroup *group;
#ifdef QT_EXPERIMENTAL_SOLUTION
diff --git a/src/corelib/animation/qanimationgroup.cpp b/src/corelib/animation/qanimationgroup.cpp
index f39738b..03573bb 100644
--- a/src/corelib/animation/qanimationgroup.cpp
+++ b/src/corelib/animation/qanimationgroup.cpp
@@ -164,9 +164,10 @@ void QAnimationGroup::insertAnimationAt(int index, QAbstractAnimation *animation
return;
}
- d->animations.insert(index, animation);
if (QAnimationGroup *oldGroup = animation->group())
oldGroup->removeAnimation(animation);
+
+ d->animations.insert(index, animation);
QAbstractAnimationPrivate::get(animation)->group = this;
// this will make sure that ChildAdded event is sent to 'this'
animation->setParent(this);
diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp
index 993c577..407ffde 100644
--- a/src/corelib/animation/qparallelanimationgroup.cpp
+++ b/src/corelib/animation/qparallelanimationgroup.cpp
@@ -111,7 +111,7 @@ void QParallelAnimationGroup::updateCurrentTime(int)
if (d->animations.isEmpty())
return;
- if (d->currentIteration > d->lastIteration) {
+ if (d->currentLoop > d->lastLoop) {
// simulate completion of the loop
int dura = duration();
if (dura > 0) {
@@ -119,7 +119,7 @@ void QParallelAnimationGroup::updateCurrentTime(int)
animation->setCurrentTime(dura); // will stop
}
}
- } else if (d->currentIteration < d->lastIteration) {
+ } else if (d->currentLoop < d->lastLoop) {
// simulate completion of the loop seeking backwards
foreach (QAbstractAnimation *animation, d->animations) {
animation->setCurrentTime(0);
@@ -127,11 +127,11 @@ void QParallelAnimationGroup::updateCurrentTime(int)
}
}
- bool timeFwd = ((d->currentIteration == d->lastIteration && d->currentTime >= d->lastCurrentTime)
- || d->currentIteration > d->lastIteration);
+ bool timeFwd = ((d->currentLoop == d->lastLoop && d->currentTime >= d->lastCurrentTime)
+ || d->currentLoop > d->lastLoop);
#ifdef QANIMATION_DEBUG
qDebug("QParallellAnimationGroup %5d: setCurrentTime(%d), loop:%d, last:%d, timeFwd:%d, lastcurrent:%d, %d",
- __LINE__, d->currentTime, d->currentIteration, d->lastIteration, timeFwd, d->lastCurrentTime, state());
+ __LINE__, d->currentTime, d->currentLoop, d->lastLoop, timeFwd, d->lastCurrentTime, state());
#endif
// finally move into the actual time of the current loop
foreach (QAbstractAnimation *animation, d->animations) {
@@ -139,7 +139,7 @@ void QParallelAnimationGroup::updateCurrentTime(int)
if (dura == -1 && d->isUncontrolledAnimationFinished(animation))
continue;
if (dura == -1 || (d->currentTime <= dura && dura != 0)
- || (dura == 0 && d->currentIteration != d->lastIteration)) {
+ || (dura == 0 && d->currentLoop != d->lastLoop)) {
switch (state()) {
case Running:
animation->start();
@@ -165,7 +165,7 @@ void QParallelAnimationGroup::updateCurrentTime(int)
if (d->currentTime > dura)
animation->stop();
}
- d->lastIteration = d->currentIteration;
+ d->lastLoop = d->currentLoop;
d->lastCurrentTime = d->currentTime;
}
@@ -207,7 +207,7 @@ void QParallelAnimationGroupPrivate::_q_uncontrolledAnimationFinished()
Q_ASSERT(animation);
int uncontrolledRunningCount = 0;
- if (animation->duration() == -1 || animation->iterationCount() < 0) {
+ if (animation->duration() == -1 || animation->loopCount() < 0) {
QHash<QAbstractAnimation *, int>::iterator it = uncontrolledFinishTime.begin();
while (it != uncontrolledFinishTime.end()) {
if (it.key() == animation) {
@@ -248,7 +248,7 @@ void QParallelAnimationGroupPrivate::connectUncontrolledAnimations()
Q_Q(QParallelAnimationGroup);
foreach (QAbstractAnimation *animation, animations) {
- if (animation->duration() == -1 || animation->iterationCount() < 0) {
+ if (animation->duration() == -1 || animation->loopCount() < 0) {
uncontrolledFinishTime[animation] = -1;
QObject::connect(animation, SIGNAL(finished()), q, SLOT(_q_uncontrolledAnimationFinished()));
}
@@ -273,11 +273,11 @@ void QParallelAnimationGroup::updateDirection(QAbstractAnimation::Direction dire
}
} else {
if (direction == Forward) {
- d->lastIteration = 0;
+ d->lastLoop = 0;
d->lastCurrentTime = 0;
} else {
- // Looping backwards with iterationCount == -1 does not really work well...
- d->lastIteration = (d->iterationCount == -1 ? 0 : d->iterationCount - 1);
+ // Looping backwards with loopCount == -1 does not really work well...
+ d->lastLoop = (d->loopCount == -1 ? 0 : d->loopCount - 1);
d->lastCurrentTime = duration();
}
}
diff --git a/src/corelib/animation/qparallelanimationgroup_p.h b/src/corelib/animation/qparallelanimationgroup_p.h
index 8a4dc1b..f36d972 100644
--- a/src/corelib/animation/qparallelanimationgroup_p.h
+++ b/src/corelib/animation/qparallelanimationgroup_p.h
@@ -64,12 +64,12 @@ class QParallelAnimationGroupPrivate : public QAnimationGroupPrivate
Q_DECLARE_PUBLIC(QParallelAnimationGroup)
public:
QParallelAnimationGroupPrivate()
- : lastIteration(0), lastCurrentTime(0)
+ : lastLoop(0), lastCurrentTime(0)
{
}
QHash<QAbstractAnimation*, int> uncontrolledFinishTime;
- int lastIteration;
+ int lastLoop;
int lastCurrentTime;
bool isUncontrolledAnimationFinished(QAbstractAnimation *anim) const;
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp
index adf3527..edcabaa 100644
--- a/src/corelib/animation/qpropertyanimation.cpp
+++ b/src/corelib/animation/qpropertyanimation.cpp
@@ -233,14 +233,16 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State oldState,
d->updateMetaProperty();
QPropertyAnimation *oldAnim = hash->value(key, 0);
if (oldAnim) {
- //we try to stop the top level group
+ // try to stop the top level group
QAbstractAnimation *current = oldAnim;
while(current->group() && current->state() != Stopped) current = current->group();
current->stop();
}
hash->insert(key, this);
// Initialize start value
- if (d->target && !d->defaultStartValue.isValid() && (d->atBeginning() || d->atEnd())) {
+ // ### review this line below, d->atEnd() ?
+ // ### avoid entering a state where start value is not set
+ if (d->target && (d->atBeginning() || d->atEnd())) {
d->setDefaultStartValue(d->target->property(d->propertyName.constData()));
}
} else if (hash->value(key) == this) {
diff --git a/src/corelib/animation/qpropertyanimation.h b/src/corelib/animation/qpropertyanimation.h
index e5d5305..b619256 100644
--- a/src/corelib/animation/qpropertyanimation.h
+++ b/src/corelib/animation/qpropertyanimation.h
@@ -47,7 +47,6 @@
#else
# include <QtCore/qvariantanimation.h>
#endif
-#include <QtCore/qvariant.h>
QT_BEGIN_HEADER
diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp
index 879532c..61ff98d 100644
--- a/src/corelib/animation/qsequentialanimationgroup.cpp
+++ b/src/corelib/animation/qsequentialanimationgroup.cpp
@@ -77,7 +77,7 @@ bool QSequentialAnimationGroupPrivate::atEnd() const
// 3. the current animation is the last one
// 4. the current animation has reached its end
const int animTotalCurrentTime = QAbstractAnimationPrivate::get(currentAnimation)->totalCurrentTime;
- return (currentIteration == iterationCount - 1
+ return (currentLoop == loopCount - 1
&& direction == QAbstractAnimation::Forward
&& currentAnimation == animations.last()
&& animTotalCurrentTime == animationActualTotalDuration(currentAnimationIndex));
@@ -101,7 +101,7 @@ QSequentialAnimationGroupPrivate::AnimationIndex QSequentialAnimationGroupPrivat
int duration = 0;
// in case duration is -1, currentLoop will always be 0
- ret.timeOffset = currentIteration * q->duration();
+ ret.timeOffset = currentLoop * q->duration();
for (int i = 0; i < animations.size(); ++i) {
duration = animationActualTotalDuration(i);
@@ -133,13 +133,13 @@ void QSequentialAnimationGroupPrivate::restart()
{
// restarting the group by making the first/last animation the current one
if (direction == QAbstractAnimation::Forward) {
- lastIteration = 0;
+ lastLoop = 0;
if (currentAnimationIndex == 0)
activateCurrentAnimation();
else
setCurrentAnimation(0);
} else { // direction == QAbstractAnimation::Backward
- lastIteration = iterationCount - 1;
+ lastLoop = loopCount - 1;
int index = animations.size() - 1;
if (currentAnimationIndex == index)
activateCurrentAnimation();
@@ -156,7 +156,7 @@ void QSequentialAnimationGroupPrivate::restart()
*/
void QSequentialAnimationGroupPrivate::advanceForwards(const AnimationIndex &newAnimationIndex)
{
- if (lastIteration < currentIteration) {
+ if (lastLoop < currentLoop) {
// we need to fast forward to the end
for (int i = currentAnimationIndex; i < animations.size(); ++i) {
QAbstractAnimation *anim = animations.at(i);
@@ -188,7 +188,7 @@ void QSequentialAnimationGroupPrivate::advanceForwards(const AnimationIndex &new
*/
void QSequentialAnimationGroupPrivate::rewindForwards(const AnimationIndex &newAnimationIndex)
{
- if (lastIteration > currentIteration) {
+ if (lastLoop > currentLoop) {
// we need to fast rewind to the beginning
for (int i = currentAnimationIndex; i >= 0 ; --i) {
QAbstractAnimation *anim = animations.at(i);
@@ -329,12 +329,12 @@ void QSequentialAnimationGroup::updateCurrentTime(int msecs)
d->actualDuration.removeLast();
// newAnimationIndex.index is the new current animation
- if (d->lastIteration < d->currentIteration
- || (d->lastIteration == d->currentIteration && d->currentAnimationIndex < newAnimationIndex.index)) {
+ if (d->lastLoop < d->currentLoop
+ || (d->lastLoop == d->currentLoop && d->currentAnimationIndex < newAnimationIndex.index)) {
// advancing with forward direction is the same as rewinding with backwards direction
d->advanceForwards(newAnimationIndex);
- } else if (d->lastIteration > d->currentIteration
- || (d->lastIteration == d->currentIteration && d->currentAnimationIndex > newAnimationIndex.index)) {
+ } else if (d->lastLoop > d->currentLoop
+ || (d->lastLoop == d->currentLoop && d->currentAnimationIndex > newAnimationIndex.index)) {
// rewinding with forward direction is the same as advancing with backwards direction
d->rewindForwards(newAnimationIndex);
}
@@ -358,7 +358,7 @@ void QSequentialAnimationGroup::updateCurrentTime(int msecs)
stop();
}
- d->lastIteration = d->currentIteration;
+ d->lastLoop = d->currentLoop;
}
/*!
@@ -505,7 +505,7 @@ void QSequentialAnimationGroupPrivate::animationInsertedAt(int index)
setCurrentAnimation(0); // initialize the current animation
if (currentAnimationIndex == index
- && currentAnimation->currentTime() == 0 && currentAnimation->currentIteration() == 0) {
+ && currentAnimation->currentTime() == 0 && currentAnimation->currentLoop() == 0) {
//in this case we simply insert an animation before the current one has actually started
setCurrentAnimation(index);
}
@@ -513,7 +513,7 @@ void QSequentialAnimationGroupPrivate::animationInsertedAt(int index)
//we update currentAnimationIndex in case it has changed (the animation pointer is still valid)
currentAnimationIndex = animations.indexOf(currentAnimation);
- if (index < currentAnimationIndex || currentIteration != 0) {
+ if (index < currentAnimationIndex || currentLoop != 0) {
qWarning("QSequentialGroup::insertAnimationAt only supports to add animations after the current one.");
return; //we're not affected because it is added after the current one
}
@@ -562,7 +562,7 @@ void QSequentialAnimationGroupPrivate::animationRemovedAt(int index)
}
//let's also update the total current time
- totalCurrentTime = currentTime + iterationCount * q->duration();
+ totalCurrentTime = currentTime + loopCount * q->duration();
}
QT_END_NAMESPACE
diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h
index 05d2a40..3ac90f8 100644
--- a/src/corelib/animation/qsequentialanimationgroup_p.h
+++ b/src/corelib/animation/qsequentialanimationgroup_p.h
@@ -64,7 +64,7 @@ class QSequentialAnimationGroupPrivate : public QAnimationGroupPrivate
Q_DECLARE_PUBLIC(QSequentialAnimationGroup)
public:
QSequentialAnimationGroupPrivate()
- : currentAnimation(0), currentAnimationIndex(-1), lastIteration(0)
+ : currentAnimation(0), currentAnimationIndex(-1), lastLoop(0)
{ }
@@ -96,7 +96,7 @@ public:
QList<int> actualDuration;
void restart();
- int lastIteration;
+ int lastLoop;
// handle time changes
void rewindForwards(const AnimationIndex &newAnimationIndex);
diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp
index 6b162ae..9f8cbf0 100644
--- a/src/corelib/animation/qvariantanimation.cpp
+++ b/src/corelib/animation/qvariantanimation.cpp
@@ -279,7 +279,7 @@ QVariantAnimation::~QVariantAnimation()
of the interpolated property.
The easing curve is used with the interpolator, the interpolated() virtual
- function, the animation's duration, and iterationCount, to control how the
+ function, the animation's duration, and loopCount, to control how the
current value changes as the animation progresses.
*/
QEasingCurve QVariantAnimation::easingCurve() const
@@ -340,7 +340,7 @@ template<typename T> static inline QVariantAnimation::Interpolator castToInterpo
return reinterpret_cast<QVariantAnimation::Interpolator>(func);
}
-static QVariantAnimation::Interpolator getInterpolator(int interpolationType)
+QVariantAnimation::Interpolator QVariantAnimationPrivate::getInterpolator(int interpolationType)
{
QReadLocker locker(registeredInterpolatorsLock());
QVariantAnimation::Interpolator ret = 0;
@@ -574,7 +574,7 @@ QVariant QVariantAnimation::interpolated(const QVariant &from, const QVariant &t
Q_D(const QVariantAnimation);
if (d->interpolator == 0) {
if (from.userType() == to.userType())
- d->interpolator = getInterpolator(from.userType());
+ d->interpolator = QVariantAnimationPrivate::getInterpolator(from.userType());
if (d->interpolator == 0) //no interpolator found
return QVariant();
}
diff --git a/src/corelib/animation/qvariantanimation.h b/src/corelib/animation/qvariantanimation.h
index 7ce597f..69dbbf3 100644
--- a/src/corelib/animation/qvariantanimation.h
+++ b/src/corelib/animation/qvariantanimation.h
@@ -49,8 +49,7 @@
# include <QtCore/qeasingcurve.h>
# include <QtCore/qabstractanimation.h>
#endif
-#include <QtCore/qlist.h>
-#include <QtCore/qpoint.h>
+#include <QtCore/qvector.h>
#include <QtCore/qvariant.h>
#include <QtCore/qpair.h>
diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h
index e468ac9..66910c1 100644
--- a/src/corelib/animation/qvariantanimation_p.h
+++ b/src/corelib/animation/qvariantanimation_p.h
@@ -97,7 +97,7 @@ public:
bool atEnd() const
{
- return currentTime == duration && currentIteration == (iterationCount - 1);
+ return currentTime == duration && currentLoop == (loopCount - 1);
}
void setDefaultStartValue(const QVariant &value);
@@ -124,6 +124,8 @@ public:
void setValueAt(qreal, const QVariant &);
QVariant valueAt(qreal step) const;
void convertValues(int t);
+
+ static QVariantAnimation::Interpolator getInterpolator(int interpolationType);
};
//this should make the interpolation faster
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 3fcfc98..fc1cefb 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -263,6 +263,9 @@ QT_BEGIN_NAMESPACE
\omitvalue NetworkReplyUpdated
\omitvalue FutureCallOut
\omitvalue CocoaRequestModal
+ \omitvalue Bound
+ \omitvalue Signal
+ \omitvalue StateFinished
*/
/*!
diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp
index 68a7fdc..89dcff9 100644
--- a/src/corelib/statemachine/qabstractstate.cpp
+++ b/src/corelib/statemachine/qabstractstate.cpp
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -13,6 +43,7 @@
#include "qabstractstate_p.h"
#include "qstatemachine.h"
#include "qstatemachine_p.h"
+#include "qstate.h"
QT_BEGIN_NAMESPACE
@@ -21,12 +52,16 @@ QT_BEGIN_NAMESPACE
\brief The QAbstractState class is the base class of states of a QStateMachine.
+ \since 4.6
\ingroup statemachine
The QAbstractState class is the abstract base class of states that are part
of a QStateMachine. It defines the interface that all state objects have in
common. QAbstractState is part of \l{The State Machine Framework}.
+ The assignProperty() function is used for defining property assignments that
+ should be performed when a state is entered.
+
The parentState() function returns the state's parent state.
\section1 Subclassing
@@ -38,7 +73,45 @@ QT_BEGIN_NAMESPACE
function to perform custom processing when the state is exited.
*/
+/*!
+ \enum QAbstractState::RestorePolicy
+
+ This enum specifies the restore policy type for a state. The restore policy
+ takes effect when the machine enters a state which sets one or more
+ properties. If the restore policy of the state is set to RestoreProperties,
+ the state machine will save the original value of the property before the
+ new value is set.
+
+ Later, when the machine either enters a state which has its restore policy
+ set to DoNotRestoreProperties or when it enters a state which does not set
+ a value for the given property, the property will automatically be restored
+ to its initial value.
+
+ Only one initial value will be saved for any given property. If a value for a property has
+ already been saved by the state machine, it will not be overwritten until the property has been
+ successfully restored. Once the property has been restored, the state machine will clear the
+ initial value until it enters a new state which sets the property and which has RestoreProperties
+ as its restore policy.
+
+ \value GlobalRestorePolicy The restore policy for the state should be retrieved using
+ QStateMachine::globalRestorePolicy()
+ \value DoNotRestoreProperties The state machine should not save the initial values of properties
+ set in the state and restore them later.
+ \value RestoreProperties The state machine should save the initial values of properties
+ set in the state and restore them later.
+
+
+ \sa setRestorePolicy(), restorePolicy(), QAbstractState::assignProperty()
+*/
+
+/*!
+ \property QAbstractState::restorePolicy
+
+ \brief the restore policy of this state
+*/
+
QAbstractStatePrivate::QAbstractStatePrivate()
+ : restorePolicy(QAbstractState::GlobalRestorePolicy)
{
}
@@ -131,6 +204,44 @@ QState *QAbstractState::parentState() const
}
/*!
+ Instructs this state to set the property with the given \a name of the given
+ \a object to the given \a value when the state is entered.
+*/
+void QAbstractState::assignProperty(QObject *object, const char *name,
+ const QVariant &value)
+{
+ Q_D(QAbstractState);
+ for (int i = 0; i < d->propertyAssignments.size(); ++i) {
+ QPropertyAssignment &assn = d->propertyAssignments[i];
+ if ((assn.object == object) && (assn.propertyName == name)) {
+ assn.value = value;
+ return;
+ }
+ }
+ d->propertyAssignments.append(QPropertyAssignment(object, name, value));
+}
+
+/*!
+ Sets the restore policy of this state to \a restorePolicy.
+
+ The default restore policy is QAbstractState::GlobalRestorePolicy.
+*/
+void QAbstractState::setRestorePolicy(RestorePolicy restorePolicy)
+{
+ Q_D(QAbstractState);
+ d->restorePolicy = restorePolicy;
+}
+
+/*!
+ Returns the restore policy for this state.
+*/
+QAbstractState::RestorePolicy QAbstractState::restorePolicy() const
+{
+ Q_D(const QAbstractState);
+ return d->restorePolicy;
+}
+
+/*!
\fn QAbstractState::onExit()
This function is called when the state is exited. Reimplement this function
diff --git a/src/corelib/statemachine/qabstractstate.h b/src/corelib/statemachine/qabstractstate.h
index cbf7ab5..b788a88 100644
--- a/src/corelib/statemachine/qabstractstate.h
+++ b/src/corelib/statemachine/qabstractstate.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -26,11 +56,25 @@ class QAbstractStatePrivate;
class Q_CORE_EXPORT QAbstractState : public QObject
{
Q_OBJECT
+ Q_ENUMS(RestorePolicy)
+ Q_PROPERTY(RestorePolicy restorePolicy READ restorePolicy WRITE setRestorePolicy)
public:
+ enum RestorePolicy {
+ GlobalRestorePolicy,
+ DoNotRestoreProperties,
+ RestoreProperties
+ };
+
~QAbstractState();
QState *parentState() const;
+ void assignProperty(QObject *object, const char *name,
+ const QVariant &value);
+
+ void setRestorePolicy(RestorePolicy restorePolicy);
+ RestorePolicy restorePolicy() const;
+
protected:
QAbstractState(QState *parent = 0);
diff --git a/src/corelib/statemachine/qabstractstate_p.h b/src/corelib/statemachine/qabstractstate_p.h
index 631d0b4..7c565f0 100644
--- a/src/corelib/statemachine/qabstractstate_p.h
+++ b/src/corelib/statemachine/qabstractstate_p.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -28,6 +58,8 @@
#endif
#include <QtCore/qlist.h>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qvariant.h>
QT_BEGIN_NAMESPACE
@@ -35,6 +67,18 @@ class QAbstractTransition;
class QHistoryState;
class QStateMachine;
+struct QPropertyAssignment
+{
+ QPropertyAssignment(QObject *o, const QByteArray &n,
+ const QVariant &v, bool es = true)
+ : object(o), propertyName(n), value(v), explicitlySet(es)
+ {}
+ QObject *object;
+ QByteArray propertyName;
+ QVariant value;
+ bool explicitlySet;
+};
+
class QAbstractState;
class Q_CORE_EXPORT QAbstractStatePrivate
#ifndef QT_STATEMACHINE_SOLUTION
@@ -54,6 +98,9 @@ public:
void callOnEntry();
void callOnExit();
+ QAbstractState::RestorePolicy restorePolicy;
+ QList<QPropertyAssignment> propertyAssignments;
+
#ifdef QT_STATEMACHINE_SOLUTION
QAbstractState *q_ptr;
#endif
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index d9ca154..dfce310 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -22,6 +52,7 @@ QT_BEGIN_NAMESPACE
\brief The QAbstractTransition class is the base class of transitions between QAbstractState objects.
+ \since 4.6
\ingroup statemachine
The QAbstractTransition class is the abstract base class of transitions
@@ -29,12 +60,12 @@ QT_BEGIN_NAMESPACE
QStateMachine. QAbstractTransition is part of \l{The State Machine
Framework}.
- The QTransition class provides a default (action-based) implementation of
- the QAbstractTransition interface.
-
The sourceState() function returns the source of the transition. The
targetStates() function returns the targets of the transition.
+ Transitions can cause animations to be played. Use the addAnimation()
+ function to add an animation to the transition.
+
\section1 Subclassing
The eventTest() function is called by the state machine to determine whether
@@ -255,6 +286,53 @@ void QAbstractTransition::setTargetStates(const QList<QAbstractState*> &targets)
d->targetStates = targets;
}
+#ifndef QT_NO_ANIMATION
+
+/*!
+ Adds the given \a animation to this transition.
+ The transition does not take ownership of the animation.
+
+ \sa removeAnimation(), animations()
+*/
+void QAbstractTransition::addAnimation(QAbstractAnimation *animation)
+{
+ Q_D(QAbstractTransition);
+ if (!animation) {
+ qWarning("QAbstractTransition::addAnimation: cannot add null animation");
+ return;
+ }
+ d->animations.append(animation);
+}
+
+/*!
+ Removes the given \a animation from this transition.
+
+ \sa addAnimation()
+*/
+void QAbstractTransition::removeAnimation(QAbstractAnimation *animation)
+{
+ Q_D(QAbstractTransition);
+ if (!animation) {
+ qWarning("QAbstractTransition::removeAnimation: cannot remove null animation");
+ return;
+ }
+ d->animations.removeOne(animation);
+}
+
+/*!
+ Returns the list of animations associated with this transition, or an empty
+ list if it has no animations.
+
+ \sa addAnimation()
+*/
+QList<QAbstractAnimation*> QAbstractTransition::animations() const
+{
+ Q_D(const QAbstractTransition);
+ return d->animations;
+}
+
+#endif
+
/*!
\fn QAbstractTransition::eventTest(QEvent *event) const
diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h
index 4cf7fae..c49731f 100644
--- a/src/corelib/statemachine/qabstracttransition.h
+++ b/src/corelib/statemachine/qabstracttransition.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -14,6 +44,8 @@
#include <QtCore/qobject.h>
+#include <QtCore/qlist.h>
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -24,6 +56,10 @@ class QEvent;
class QAbstractState;
class QState;
+#ifndef QT_NO_ANIMATION
+class QAbstractAnimation;
+#endif
+
class QAbstractTransitionPrivate;
class Q_CORE_EXPORT QAbstractTransition : public QObject
{
@@ -42,6 +78,12 @@ public:
QList<QAbstractState*> targetStates() const;
void setTargetStates(const QList<QAbstractState*> &targets);
+#ifndef QT_NO_ANIMATION
+ void addAnimation(QAbstractAnimation *animation);
+ void removeAnimation(QAbstractAnimation *animation);
+ QList<QAbstractAnimation*> animations() const;
+#endif
+
protected:
virtual bool eventTest(QEvent *event) const = 0;
diff --git a/src/corelib/statemachine/qabstracttransition_p.h b/src/corelib/statemachine/qabstracttransition_p.h
index 796af11..a48a09c 100644
--- a/src/corelib/statemachine/qabstracttransition_p.h
+++ b/src/corelib/statemachine/qabstracttransition_p.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,6 +85,10 @@ public:
QList<QAbstractState*> targetStates;
+#ifndef QT_NO_ANIMATION
+ QList<QAbstractAnimation*> animations;
+#endif
+
#ifdef QT_STATEMACHINE_SOLUTION
QAbstractTransition *q_ptr;
#endif
diff --git a/src/corelib/statemachine/qactionstate.cpp b/src/corelib/statemachine/qactionstate.cpp
index 312465e..1da0350 100644
--- a/src/corelib/statemachine/qactionstate.cpp
+++ b/src/corelib/statemachine/qactionstate.cpp
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -21,6 +51,7 @@ QT_BEGIN_NAMESPACE
\brief The QActionState class provides an action-based state.
+ \since 4.6
\ingroup statemachine
QActionState executes \l{QStateAction}{state actions} when the state is
@@ -30,19 +61,6 @@ QT_BEGIN_NAMESPACE
functions. The state executes the actions when the state is entered and
exited, respectively.
- Built-in actions are provided for setting properties and invoking methods of
- QObjects. The setPropertyOnEntry() and setPropertyOnExit() functions are
- used for defining property assignments that should be performed when a state
- is entered and exited, respectively.
-
- \code
- QLabel label;
- QStateMachine machine;
- QState *s1 = new QState();
- s1->setPropertyOnEntry(&label, "text", "Entered state s1");
- machine.addState(s1);
- \endcode
-
The invokeMethodOnEntry() and invokeMethodOnExit() functions are used for
defining method invocations that should be performed when a state is entered
and exited, respectively.
@@ -56,43 +74,7 @@ QT_BEGIN_NAMESPACE
\sa QStateAction
*/
-/*!
- \enum QActionState::RestorePolicy
-
- This enum specifies the restore policy type for a state. The restore policy takes effect when
- the machine enters a state which has entry actions of the type QStateSetPropertyAction. If the
- restore policy of the state is set to RestoreProperties, the state machine will save the
- value of the property before the QStateSetPropertyAction is executed.
-
- Later, when the machine either enters a state which has its restore policy set to
- DoNotRestoreProperties or when it enters a state which does not set a value for the given
- property, the property will automatically be restored to its initial value. The state machine
- will only detect which properties are being set if they are being set using a
- QStateSetPropertyAction object set as entry action on a state.
-
- Special rules apply when using QAnimationState. If a QAnimationState registers that a property
- should be restored before entering the target state of its QStateFinishedTransition, it will
- restore this property using a QPropertyAnimation.
-
- Only one initial value will be saved for any given property. If a value for a property has
- already been saved by the state machine, it will not be overwritten until the property has been
- successfully restored. Once the property has been restored, the state machine will clear the
- initial value until it enters a new state which sets the property and which has RestoreProperties
- as its restore policy.
-
- \value GlobalRestorePolicy The restore policy for the state should be retrieved using
- QStateMachine::globalRestorePolicy()
- \value DoNotRestoreProperties The state machine should not save the initial values of properties
- set in the state and restore them later.
- \value RestoreProperties The state machine should save the initial values of properties
- set in the state and restore them later.
-
-
- \sa setRestorePolicy(), restorePolicy(), addEntryAction(), setPropertyOnEntry()
-*/
-
QActionStatePrivate::QActionStatePrivate()
- : restorePolicy(QActionState::GlobalRestorePolicy)
{
}
@@ -165,66 +147,12 @@ QActionState::~QActionState()
}
/*!
- Instructs this state to set the property with the given \a name of the given
- \a object to the given \a value when the state is entered. This function
- will create a QStateSetPropertyAction object and add it to the entry actions
- of the state. If there is already an existing action associated with the
- property, the value of that action is updated.
-
- \sa setPropertyOnExit(), invokeMethodOnEntry(), addEntryAction()
-*/
-void QActionState::setPropertyOnEntry(QObject *object, const char *name,
- const QVariant &value)
-{
- Q_D(QActionState);
- QList<QStateAction*> actions = d->entryActions();
- for (int i=0; i<actions.size(); ++i) {
- QStateAction *action = actions.at(i);
- if (QStateSetPropertyAction *spa = qobject_cast<QStateSetPropertyAction*>(action)) {
- if (spa->targetObject() == object && spa->propertyName() == name) {
- QStateSetPropertyActionPrivate::get(spa)->value = value;
- return;
- }
- }
- }
-
- addEntryAction(new QStateSetPropertyAction(object, name, value));
-}
-
-/*!
- Instructs this state to set the property with the given \a name of the given
- \a object to the given \a value when the state is exited. This function will
- create a QStateSetPropertyAction object and add it to the exit actions of
- the state. If there is already an existing action associated with the
- property, the value of that action is updated.
-
- \sa setPropertyOnEntry(), invokeMethodOnExit(), addExitAction()
-*/
-void QActionState::setPropertyOnExit(QObject *object, const char *name,
- const QVariant &value)
-{
- Q_D(QActionState);
- QList<QStateAction*> actions = d->exitActions();
- for (int i=0; i<actions.size(); ++i) {
- QStateAction *action = actions.at(i);
- if (QStateSetPropertyAction *spa = qobject_cast<QStateSetPropertyAction*>(action)) {
- if (spa->targetObject() == object && spa->propertyName() == name) {
- QStateSetPropertyActionPrivate::get(spa)->value = value;
- return;
- }
- }
- }
-
- addExitAction(new QStateSetPropertyAction(object, name, value));
-}
-
-/*!
Instructs this state to invoke the given \a method of the given \a object
with the given \a arguments when the state is entered. This function will
create a QStateInvokeMethodAction object and add it to the entry actions of
the state.
- \sa invokeMethodOnExit(), setPropertyOnEntry(), addEntryAction()
+ \sa invokeMethodOnExit(), addEntryAction()
*/
void QActionState::invokeMethodOnEntry(QObject *object, const char *method,
const QList<QVariant> &arguments)
@@ -238,7 +166,7 @@ void QActionState::invokeMethodOnEntry(QObject *object, const char *method,
create a QStateInvokeMethodAction object and add it to the exit actions of
the state.
- \sa invokeMethodOnEntry(), setPropertyOnExit(), addExitAction()
+ \sa invokeMethodOnEntry(), addExitAction()
*/
void QActionState::invokeMethodOnExit(QObject *object, const char *method,
const QList<QVariant> &arguments)
@@ -333,26 +261,6 @@ QList<QStateAction*> QActionState::exitActions() const
}
/*!
- Sets the restore policy of this state to \a restorePolicy.
-
- The default restore policy is QActionState::GlobalRestorePolicy.
-*/
-void QActionState::setRestorePolicy(RestorePolicy restorePolicy)
-{
- Q_D(QActionState);
- d->restorePolicy = restorePolicy;
-}
-
-/*!
- Returns the restore policy for this state.
-*/
-QActionState::RestorePolicy QActionState::restorePolicy() const
-{
- Q_D(const QActionState);
- return d->restorePolicy;
-}
-
-/*!
\reimp
*/
void QActionState::onEntry()
diff --git a/src/corelib/statemachine/qactionstate.h b/src/corelib/statemachine/qactionstate.h
index 2af9d4a..517b4b2 100644
--- a/src/corelib/statemachine/qactionstate.h
+++ b/src/corelib/statemachine/qactionstate.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -34,19 +64,9 @@ class Q_CORE_EXPORT QActionState : public QAbstractState
{
Q_OBJECT
public:
- enum RestorePolicy {
- GlobalRestorePolicy,
- DoNotRestoreProperties,
- RestoreProperties
- };
-
QActionState(QState *parent = 0);
~QActionState();
- void setPropertyOnEntry(QObject *object, const char *name,
- const QVariant &value);
- void setPropertyOnExit(QObject *object, const char *name,
- const QVariant &value);
void invokeMethodOnEntry(QObject *object, const char *method,
const QList<QVariant> &args = QList<QVariant>());
void invokeMethodOnExit(QObject *object, const char *method,
@@ -61,9 +81,6 @@ public:
QList<QStateAction*> entryActions() const;
QList<QStateAction*> exitActions() const;
- void setRestorePolicy(RestorePolicy restorePolicy);
- RestorePolicy restorePolicy() const;
-
protected:
void onEntry();
void onExit();
diff --git a/src/corelib/statemachine/qactionstate_p.h b/src/corelib/statemachine/qactionstate_p.h
index 69343f8..a06dde2 100644
--- a/src/corelib/statemachine/qactionstate_p.h
+++ b/src/corelib/statemachine/qactionstate_p.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -46,8 +76,6 @@ public:
QList<QStateAction*> entryActions() const;
QList<QStateAction*> exitActions() const;
-
- QActionState::RestorePolicy restorePolicy;
};
QT_END_NAMESPACE
diff --git a/src/corelib/statemachine/qactiontransition.cpp b/src/corelib/statemachine/qactiontransition.cpp
new file mode 100644
index 0000000..7c53e15
--- /dev/null
+++ b/src/corelib/statemachine/qactiontransition.cpp
@@ -0,0 +1,230 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qactiontransition.h"
+#include "qactiontransition_p.h"
+#include "qstateaction.h"
+#include "qstateaction_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QActionTransition
+
+ \brief The QActionTransition class provides an action-based transition.
+
+ \since 4.6
+ \ingroup statemachine
+
+ QActionTransition provides an action-based transition; you add actions with
+ the addAction() function. The transition executes the actions when the
+ transition is triggered. QActionTransition is part of \l{The State Machine
+ Framework}.
+
+ The invokeMethodOnTransition() function is used for defining method
+ invocations that should be performed when a transition is taken.
+
+ \code
+ QStateMachine machine;
+ QState *s1 = new QState();
+ machine.addState(s1);
+ QActionTransition *t1 = new QActionTransition();
+ QLabel label;
+ t1->invokeMethodOnTransition(&label, "clear");
+ QState *s2 = new QState();
+ machine.addState(s2);
+ t1->setTargetState(s2);
+ s1->addTransition(t1);
+ \endcode
+
+ Actions are executed in the order in which they were added.
+
+ \sa QState::addTransition(), QStateAction
+*/
+
+QActionTransitionPrivate::QActionTransitionPrivate()
+{
+}
+
+QActionTransitionPrivate::~QActionTransitionPrivate()
+{
+}
+
+QActionTransitionPrivate *QActionTransitionPrivate::get(QActionTransition *q)
+{
+ return q->d_func();
+}
+
+const QActionTransitionPrivate *QActionTransitionPrivate::get(const QActionTransition *q)
+{
+ return q->d_func();
+}
+
+QList<QStateAction*> QActionTransitionPrivate::actions() const
+{
+ QList<QStateAction*> result;
+ QList<QObject*>::const_iterator it;
+#ifdef QT_STATEMACHINE_SOLUTION
+ const QObjectList &children = q_func()->children();
+#endif
+ for (it = children.constBegin(); it != children.constEnd(); ++it) {
+ QStateAction *s = qobject_cast<QStateAction*>(*it);
+ if (s)
+ result.append(s);
+ }
+ return result;
+}
+
+/*!
+ Constructs a new QActionTransition object with the given \a sourceState.
+*/
+QActionTransition::QActionTransition(QState *sourceState)
+ : QAbstractTransition(*new QActionTransitionPrivate, sourceState)
+{
+}
+
+/*!
+ Constructs a new QActionTransition object with the given \a targets and \a
+ sourceState.
+*/
+QActionTransition::QActionTransition(const QList<QAbstractState*> &targets, QState *sourceState)
+ : QAbstractTransition(*new QActionTransitionPrivate, targets, sourceState)
+{
+}
+
+/*!
+ \internal
+*/
+QActionTransition::QActionTransition(QActionTransitionPrivate &dd, QState *parent)
+ : QAbstractTransition(dd, parent)
+{
+}
+
+/*!
+ \internal
+*/
+QActionTransition::QActionTransition(QActionTransitionPrivate &dd, const QList<QAbstractState*> &targets, QState *parent)
+ : QAbstractTransition(dd, targets, parent)
+{
+}
+
+/*!
+ Destroys this transition.
+*/
+QActionTransition::~QActionTransition()
+{
+}
+
+/*!
+ Instructs this QActionTransition to invoke the given \a method of the given \a
+ object with the given \a arguments when the transition is taken. This
+ function will create a QStateInvokeMethodAction object and add it to the
+ actions of the transition.
+*/
+void QActionTransition::invokeMethodOnTransition(QObject *object, const char *method,
+ const QList<QVariant> &arguments)
+{
+ addAction(new QStateInvokeMethodAction(object, method, arguments));
+}
+
+/*!
+ Adds the given \a action to this transition.
+ The action will be executed when the transition is triggered.
+ The transition takes ownership of the action.
+
+ \sa removeAction()
+*/
+void QActionTransition::addAction(QStateAction *action)
+{
+ if (!action) {
+ qWarning("QActionTransition::addAction: cannot add null action");
+ return;
+ }
+ action->setParent(this);
+}
+
+/*!
+ Removes the given \a action from this transition.
+ The transition releases ownership of the action.
+
+ \sa addAction()
+*/
+void QActionTransition::removeAction(QStateAction *action)
+{
+ if (!action) {
+ qWarning("QActionTransition::removeAction: cannot remove null action");
+ return;
+ }
+ action->setParent(0);
+}
+
+/*!
+ Returns this transitions's actions, or an empty list if the transition has
+ no actions.
+
+ \sa addAction()
+*/
+QList<QStateAction*> QActionTransition::actions() const
+{
+ Q_D(const QActionTransition);
+ return d->actions();
+}
+
+/*!
+ \reimp
+*/
+void QActionTransition::onTransition()
+{
+ Q_D(QActionTransition);
+ QList<QStateAction*> actions = d->actions();
+ for (int i = 0; i < actions.size(); ++i)
+ QStateActionPrivate::get(actions.at(i))->callExecute();
+}
+
+/*!
+ \reimp
+*/
+bool QActionTransition::event(QEvent *e)
+{
+ return QAbstractTransition::event(e);
+}
+
+QT_END_NAMESPACE
diff --git a/src/corelib/statemachine/qactiontransition.h b/src/corelib/statemachine/qactiontransition.h
new file mode 100644
index 0000000..1a779fa
--- /dev/null
+++ b/src/corelib/statemachine/qactiontransition.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QACTIONTRANSITION_H
+#define QACTIONTRANSITION_H
+
+#ifndef QT_STATEMACHINE_SOLUTION
+#include <QtCore/qabstracttransition.h>
+#else
+#include "qabstracttransition.h"
+#endif
+
+#include <QtCore/qvariant.h>
+#include <QtCore/qlist.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Core)
+
+class QStateAction;
+
+class QActionTransitionPrivate;
+class Q_CORE_EXPORT QActionTransition : public QAbstractTransition
+{
+ Q_OBJECT
+public:
+ QActionTransition(QState *sourceState = 0);
+ QActionTransition(const QList<QAbstractState*> &targets, QState *sourceState = 0);
+ ~QActionTransition();
+
+ void invokeMethodOnTransition(QObject *object, const char *method,
+ const QList<QVariant> &args = QList<QVariant>());
+
+ void addAction(QStateAction *action);
+ void removeAction(QStateAction *action);
+ QList<QStateAction*> actions() const;
+
+protected:
+ virtual void onTransition();
+
+ bool event(QEvent *e);
+
+protected:
+ QActionTransition(QActionTransitionPrivate &dd, QState *parent);
+ QActionTransition(QActionTransitionPrivate &dd, const QList<QAbstractState*> &targets, QState *parent);
+
+private:
+ Q_DISABLE_COPY(QActionTransition)
+ Q_DECLARE_PRIVATE(QActionTransition)
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/corelib/statemachine/qactiontransition_p.h b/src/corelib/statemachine/qactiontransition_p.h
new file mode 100644
index 0000000..34f80d1
--- /dev/null
+++ b/src/corelib/statemachine/qactiontransition_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QACTIONTRANSITION_P_H
+#define QACTIONTRANSITION_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qabstracttransition_p.h"
+
+#include <QtCore/qlist.h>
+
+QT_BEGIN_NAMESPACE
+
+class QStateAction;
+
+class QActionTransition;
+class Q_CORE_EXPORT QActionTransitionPrivate : public QAbstractTransitionPrivate
+{
+ Q_DECLARE_PUBLIC(QActionTransition)
+public:
+ QActionTransitionPrivate();
+ ~QActionTransitionPrivate();
+
+ static QActionTransitionPrivate *get(QActionTransition *q);
+ static const QActionTransitionPrivate *get(const QActionTransition *q);
+
+ QList<QStateAction*> actions() const;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/corelib/statemachine/qanimationstate.cpp b/src/corelib/statemachine/qanimationstate.cpp
deleted file mode 100644
index b963950..0000000
--- a/src/corelib/statemachine/qanimationstate.cpp
+++ /dev/null
@@ -1,574 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the $MODULE$ of the Qt Toolkit.
-**
-** $TROLLTECH_DUAL_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT_NO_ANIMATION
-
-#include "qanimationstate.h"
-#include "qparallelanimationgroup.h"
-#include "qabstracttransition.h"
-#include "qabstracttransition_p.h"
-#include "qstatefinishedtransition.h"
-#include "qsignaltransition.h"
-#include "qpropertyanimation.h"
-#include "qstatemachine.h"
-#include "qstatemachine_p.h"
-#include "qstateaction.h"
-#include "qstateaction_p.h"
-#include "qstate.h"
-#include "qstate_p.h"
-#include "qfinalstate.h"
-#include "qsignaltransition_p.h"
-#ifdef QT_STATEMACHINE_SOLUTION
-#include "qvariantanimation_p.h"
-#else
-#include "private/qvariantanimation_p.h"
-#endif
-#include "qpauseanimation.h"
-
-#include <QtCore/qhash.h>
-#include <QtCore/qstack.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qsize.h>
-#include <QtCore/qrect.h>
-#include <QtCore/qpoint.h>
-#include <QtCore/qbitarray.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QAnimationState
- \brief The QAnimationState class provides a state that plays one or more animations.
- \ingroup statemachine
- \preliminary
-
- QAnimationState is part of \l{The State Machine Framework}.
-
- The addAnimation() function adds an animation to be played by the state.
-
- When the state is entered, it will call each of the animations' start() functions.
- When the animation is finished, a QStateFinishedEvent is posted; you can
- use the QStateFinishedTransition class to associate a transition with this
- event.
-
- \code
- QPushButton button;
- QPropertyAnimation animation(&button, "geometry");
- animation.setEndValue(QRect(100, 100, 400, 400));
-
- QStateMachine machine;
- QAnimationState *s1 = new QAnimationState(&animation, machine.rootState());
- QState *s2 = new QState(machine.rootState());
- s1->addFinishedTransition(s2);
- \endcode
-
- If the state is exited before the animation has finished, the animations will
- be stopped, and no event is generated.
-
- For convenience, the QState::addAnimatedTransition() functions can be used to set up the
- animated transition between two states.
-
- \section1 Initializing animations automatically
- QAnimationState will try to automatically initialize any QPropertyAnimation for which no
- specific end value has been set. It will set the animation's end value based on actions in the
- target state of the animation state's QStateFinishedTransition.
-
- The only actions evaluated are the entry actions of the very first states entered after the
- animation state has finished.
-
- QAnimationState will match its QPropertyAnimation objects with QStateSetPropertyAction objects
- in the target states that manipulate the same property on the same object. The end values of the
- animations will be initialized to the values set by the actions.
-
- \code
- QPushButton button;
- QPropertyAnimation animation(&button, "geometry");
-
- QStateMachine machine;
- QAnimationState *s1 = new QAnimationState(&animation, machine.rootState());
- QState *s2 = new QState(machine.rootState());
- s2->setPropertyOnEntry(&button, "geometry", QRect(100, 100, 400, 400));
-
- s1->addFinishedTransition(s2);
- \endcode
-
- Specifically, QAnimationState will evaluate the actions set for the target state itself, and
- also look in following locations:
- objects:
- \list
- \i If the state has children and is not parallel, actions set for its initial
- state will be evaluated.
- \i If the state has children and is parallel, actions set for any of its children will be
- evaluated.
- \endlist
-
- Children of the target state will be evaluated recursively.
-
- \section1 Animated restoring of properties
-
- When a state has restore policy QActionState::RestoreProperties, any
- property that is set in the state using the QStateSetPropertyAction will
- potentially be restored to its original value later on. When regular,
- unanimated transitions are used, the properties will be restored when the
- state machine enters one or more states that do not explicitly set the
- property.
-
- When QAnimationState is used, it will restore the property with an
- animation. Rather than have the state machine restore the properties as it
- enters the target state, they will be restored by the QAnimationState in
- parallel to the regular animations that have been added to the state.
-
- If no animation has been added to the state, only the restore animations
- will be played.
-
- The animations used to restore the properties are QPropertyAnimations with
- with the default easing curve and duration.
-
- \sa QActionState::RestorePolicy, QPropertyAnimation, QStateSetPropertyAction,
- QState::addAnimatedTransition()
-
-*/
-
-namespace {
-
-class AnimatingState : public QState
-{
-public:
- AnimatingState(QState *parent)
- : QState(parent) {}
-protected:
- void onEntry() {}
- void onExit() {}
-};
-
-class AnimationFinishedState : public QFinalState
-{
-public:
- AnimationFinishedState(QState *parent)
- : QFinalState(parent)
- {
- }
-
-protected:
- void onEntry() {}
- void onExit() {}
-};
-
-class AnimationFinishedTransition: public QSignalTransition
-{
-public:
- AnimationFinishedTransition(QAbstractAnimation *animation,
- QAnimationStatePrivate *animationState_d,
- QAbstractState *target)
- : QSignalTransition(animation, SIGNAL(finished()), QList<QAbstractState*>() << target),
- m_animationState_d(animationState_d)
- {
- }
-
- virtual bool eventTest(QEvent *) const;
-
-private:
- QAnimationStatePrivate *m_animationState_d;
-};
-
-} // namespace
-
-class QAnimationStatePrivate : public QStatePrivate
-{
- Q_DECLARE_PUBLIC(QAnimationState)
-
-public:
- typedef QStateMachinePrivate::RestorableId RestorableId;
-
- QAnimationStatePrivate();
- void init();
- QAbstractTransition *finishedTransition() const;
-
- void initializeAnimation(const QList<QStateAction*> &actions, QActionState::RestorePolicy restorePolicy);
- void initializeAnimation(const QList<QAbstractState*> &targets);
- void initializeAnimationFromAction(QAbstractAnimation *anim,
- QStateAction *action,
- QActionState::RestorePolicy restorePolicy);
-
- void restoreAnimations();
-
- void addAnimation(QAbstractAnimation *animation, QList<QAbstractAnimation*> &list);
- void removeAnimation(QAbstractAnimation *animation, QList<QAbstractAnimation*> &list);
-
- QList<QAbstractAnimation *> animations;
- QList<QAbstractAnimation *> restorationAnimations;
- QList<QPropertyAnimation *> resetEndValues;
- QState *animatingState;
- QFinalState *finishedState;
- QTimer *timer;
-
- uint initializeAnimationFromTargetStates : 1;
- uint initializeAnimationFromRestorableVariables : 1;
- uint reserved : 30;
-
- QHash<RestorableId, QVariant> pendingRestorables;
-};
-
-// implement here because it requires the definition of QAnimationStatePrivate.
-namespace {
- bool AnimationFinishedTransition::eventTest(QEvent *e) const
- {
- if (!QSignalTransition::eventTest(e))
- return false;
-
- QList<QAbstractAnimation *> animations = m_animationState_d->animations;
- QList<QAbstractAnimation *> restorationAnimations = m_animationState_d->restorationAnimations;
-
- for (int i=0; i<animations.size(); ++i) {
- if (animations.at(i)->state() != QAbstractAnimation::Stopped)
- return false;
- }
-
- for (int i=0; i<restorationAnimations.size(); ++i) {
- if (restorationAnimations.at(i)->state() != QAbstractAnimation::Stopped)
- return false;
- }
-
- return true;
- }
-}
-
-QAnimationStatePrivate::QAnimationStatePrivate()
-{
-}
-
-void QAnimationStatePrivate::init()
-{
- Q_Q(QAnimationState);
-
- // ### make it a configurable property, as it is highly magical
- initializeAnimationFromTargetStates = true;
- initializeAnimationFromRestorableVariables = true;
-
- animatingState = new AnimatingState(q);
- q->setInitialState(animatingState);
- finishedState = new AnimationFinishedState(q);
-
- timer = 0;
-}
-
-void QAnimationStatePrivate::addAnimation(QAbstractAnimation *animation,
- QList<QAbstractAnimation*> &list)
-{
- if (animation != 0 && !list.contains(animation)) {
- list.append(animation);
- AnimationFinishedTransition *transition = new AnimationFinishedTransition(animation, this, finishedState);
- animatingState->addTransition(transition);
- }
-}
-
-void QAnimationStatePrivate::removeAnimation(QAbstractAnimation *animation,
- QList<QAbstractAnimation*> &list)
-{
- if (animation != 0 && list.contains(animation)) {
- QStatePrivate *state_d = QStatePrivate::get(animatingState);
- QList<QAbstractTransition *> transitions = state_d->transitions();
- Q_ASSERT(transitions.size() > 0);
- for (int i=0; i<transitions.size(); ++i) {
- QSignalTransition *transition = qobject_cast<QSignalTransition *>(transitions.at(i));
-
- if (transition != 0) {
- QSignalTransitionPrivate *transition_p = QSignalTransitionPrivate::get(transition);
- if (transition_p->sender == animation) {
- delete transition;
- break;
- }
- }
- }
-
- list.removeAll(animation);
- }
-}
-
-/*!
- \internal
-
- Returns a transition from this state that is triggered when this state is
- finished, or 0 if there is no such transition.
-*/
-QAbstractTransition *QAnimationStatePrivate::finishedTransition() const
-{
- QList<QAbstractTransition*> trans = transitions();
- for (int i = 0; i < trans.size(); ++i) {
- QAbstractTransition *t = trans.at(i);
- if (QStateFinishedTransition *sft = qobject_cast<QStateFinishedTransition*>(t))
- return sft;
- }
- return 0;
-}
-
-void QAnimationStatePrivate::initializeAnimationFromAction(QAbstractAnimation *abstractAnimation,
- QStateAction *action,
- QActionState::RestorePolicy restorePolicy)
-{
- QAnimationGroup *group = qobject_cast<QAnimationGroup*>(abstractAnimation);
- if (group) {
- for (int i = 0; i < group->animationCount(); ++i) {
- QAbstractAnimation *animationChild = group->animationAt(i);
- initializeAnimationFromAction(animationChild, action, restorePolicy);
- }
- } else {
- QPropertyAnimation *animation = qobject_cast<QPropertyAnimation *>(abstractAnimation);
- QStateSetPropertyAction *propertyAction = qobject_cast<QStateSetPropertyAction*>(action);
- if (propertyAction != 0
- && animation != 0
- && propertyAction->targetObject() == animation->targetObject()
- && propertyAction->propertyName() == animation->propertyName()) {
-
- if (!animation->startValue().isValid()) {
- QByteArray propertyName = animation->propertyName();
- QVariant currentValue = animation->targetObject()->property(propertyName);
-
- QVariantAnimationPrivate::get(animation)->setDefaultStartValue(currentValue);
- }
-
- // Only change end value if it is undefined
- if (!animation->endValue().isValid()) {
- QStateMachinePrivate *machine_d = QStateMachinePrivate::get(machine());
- if (restorePolicy == QActionState::RestoreProperties)
- machine_d->registerRestorable(animation);
-
- RestorableId id(animation->targetObject(), animation->propertyName());
- pendingRestorables.remove(id);
-
- animation->setEndValue(propertyAction->value());
- resetEndValues.append(animation);
- }
- }
- }
-}
-
-void QAnimationStatePrivate::initializeAnimation(const QList<QStateAction*> &actions,
- QActionState::RestorePolicy restorePolicy)
-{
-
- for (int i = 0; i < actions.size(); ++i) {
- QStateAction *act = actions.at(i);
-
- for (int j=0; j<animations.size(); ++j)
- initializeAnimationFromAction(animations.at(j), act, restorePolicy);
- }
-
-
-}
-
-void QAnimationStatePrivate::initializeAnimation(const QList<QAbstractState*> &targets)
-{
- // ### consider resulting action order, and how to resolve conflicts (two actions that set the same property)
- for (int i = 0; i < targets.size(); ++i) {
- QActionState *s = qobject_cast<QActionState*>(targets.at(i));
- if (s != 0) {
- QActionState::RestorePolicy restorePolicy = s->restorePolicy();
- if (restorePolicy == QActionState::GlobalRestorePolicy)
- restorePolicy = machine()->globalRestorePolicy();
- initializeAnimation(QActionStatePrivate::get(s)->entryActions(), restorePolicy);
- }
-
- if (QStateMachinePrivate::isParallel(s)) {
- initializeAnimation(QStatePrivate::get(qobject_cast<QState*>(s))->childStates());
- } else if (QStateMachinePrivate::isCompound(s)) {
- initializeAnimation(QList<QAbstractState*>() << qobject_cast<QState*>(s)->initialState());
- }
- }
-}
-
-void QAnimationStatePrivate::restoreAnimations()
-{
- QStateMachinePrivate *machine_d = QStateMachinePrivate::get(machine());
-
- QHash<RestorableId, QVariant>::const_iterator it;
- for (it=pendingRestorables.constBegin(); it != pendingRestorables.constEnd(); ++it) {
- QPropertyAnimation *animation = machine_d->registeredRestorableAnimations.value(it.key());
- if (animation == 0)
- continue;
-
- // ### Check if this works
- // animation->setDirection(QAbstractAnimation::Backward);
-
- QPropertyAnimation *clonedAnimation = new QPropertyAnimation(animation->targetObject(),
- animation->propertyName());
- clonedAnimation->setEasingCurve(animation->easingCurve());
- clonedAnimation->setEndValue(it.value());
-
- addAnimation(clonedAnimation, restorationAnimations);
- }
-
- pendingRestorables.clear();
-}
-
-
-/*!
- Constructs a new QAnimationState object with the given \a animation and \a
- parent state
-*/
-QAnimationState::QAnimationState(QAbstractAnimation *animation, QState *parent)
- : QState(*new QAnimationStatePrivate, parent)
-{
- Q_D(QAnimationState);
- d->init();
-
- if (animation != 0)
- addAnimation(animation);
-}
-
-/*!
- Constructs a new QAnimationState object with the given \a parent state.
-*/
-QAnimationState::QAnimationState(QState *parent)
- : QState(*new QAnimationStatePrivate, parent)
-{
- Q_D(QAnimationState);
- d->init();
-}
-
-/*!
- Destroys this QAnimationState.
-*/
-QAnimationState::~QAnimationState()
-{
-}
-
-/*!
- Returns the number of animations added to this QAnimationState.
-*/
-int QAnimationState::animationCount() const
-{
- Q_D(const QAnimationState);
- return d->animations.size();
-}
-
-/*!
- Returns the animation associated with this QAnimationState at index \a i.
-*/
-QAbstractAnimation *QAnimationState::animationAt(int i) const
-{
- Q_D(const QAnimationState);
- return d->animations.at(i);
-}
-
-/*!
- Adds \a animation to this QAnimationState.
-*/
-void QAnimationState::addAnimation(QAbstractAnimation *animation)
-{
- Q_D(QAnimationState);
- if (animation == 0) {
- qWarning("QAnimationState::addAnimation: Cannot add null animation");
- return;
- }
-
- d->addAnimation(animation, d->animations);
-}
-
-/*!
- Removes \a animation from this QAnimationState.
-*/
-void QAnimationState::removeAnimation(QAbstractAnimation *animation)
-{
- Q_D(QAnimationState);
- d->removeAnimation(animation, d->animations);
-}
-
-/*!
- \reimp
-*/
-void QAnimationState::onEntry()
-{
- Q_D(QAnimationState);
-
- {
- QStateMachinePrivate *machine_d = QStateMachinePrivate::get(d->machine());
- d->pendingRestorables = machine_d->registeredRestorables;
- }
-
- if (d->initializeAnimationFromTargetStates) {
- if (QAbstractTransition *t = d->finishedTransition())
- d->initializeAnimation(t->targetStates());
- }
-
- if (d->initializeAnimationFromRestorableVariables)
- d->restoreAnimations();
-
- for (int i=0; i<d->animations.size(); ++i)
- d->animations.at(i)->start();
-
- for (int i=0; i<d->restorationAnimations.size(); ++i)
- d->restorationAnimations.at(i)->start();
-
- // If there are no animations playing, we use a 0 timer to trigger the transition
- // to the final state
- if (d->animations.size()+d->restorationAnimations.size() == 0) {
- if (d->timer == 0) {
- d->timer = new QTimer(this);
- d->timer->setInterval(0);
- d->timer->setSingleShot(true);
-
- d->animatingState->addTransition(d->timer, SIGNAL(timeout()), d->finishedState);
- }
-
- d->timer->start();
- }
-
-}
-
-/*!
- \reimp
-*/
-void QAnimationState::onExit()
-{
- Q_D(QAnimationState);
-
- for (int i=0; i<d->animations.size(); ++i) {
- if (d->animations.at(i)->state() != QAbstractAnimation::Stopped)
- d->animations.at(i)->stop();
- }
-
- QList<QAbstractAnimation *> restorationAnimations = d->restorationAnimations;
- for (int i=0; i<restorationAnimations.size(); ++i) {
- QAbstractAnimation *restorationAnimation = restorationAnimations.at(i);
- if (restorationAnimation->state() != QAbstractAnimation::Stopped) {
- restorationAnimation->stop();
- d->removeAnimation(restorationAnimation, d->restorationAnimations);
-
- // ###
- delete restorationAnimation;
- } else {
- QPropertyAnimation *propertyAnimation = qobject_cast<QPropertyAnimation*>(restorationAnimation);
- if (propertyAnimation != 0) {
- QStateMachinePrivate *machine_d = QStateMachinePrivate::get(d->machine());
- machine_d->unregisterRestorable(propertyAnimation->targetObject(),
- propertyAnimation->propertyName());
- }
- }
- }
-
- for (int i=0; i<d->resetEndValues.size(); ++i)
- d->resetEndValues.at(i)->setEndValue(QVariant());
-
- if (d->timer != 0)
- d->timer->stop();
-}
-
-/*!
- \reimp
-*/
-bool QAnimationState::event(QEvent *e)
-{
- return QState::event(e);
-}
-
-QT_END_NAMESPACE
-
-#endif //QT_NO_ANIMATION
diff --git a/src/corelib/statemachine/qanimationstate.h b/src/corelib/statemachine/qanimationstate.h
deleted file mode 100644
index 5d11041..0000000
--- a/src/corelib/statemachine/qanimationstate.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the $MODULE$ of the Qt Toolkit.
-**
-** $TROLLTECH_DUAL_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANIMATIONSTATE_H
-#define QANIMATIONSTATE_H
-
-#ifndef QT_STATEMACHINE_SOLUTION
-#include <QtCore/qstate.h>
-#else
-#include "qstate.h"
-#endif
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Core)
-
-#ifndef QT_NO_ANIMATION
-
-class QAbstractAnimation;
-
-class QAnimationStatePrivate;
-class Q_CORE_EXPORT QAnimationState : public QState
-{
- Q_OBJECT
-public:
-
- QAnimationState(QAbstractAnimation *animation, QState *parent = 0);
- QAnimationState(QState *parent = 0);
- ~QAnimationState();
-
- int animationCount() const;
- QAbstractAnimation *animationAt(int i) const;
- void addAnimation(QAbstractAnimation *animation);
- void removeAnimation(QAbstractAnimation *animation);
-
-protected:
- virtual void onEntry();
- virtual void onExit();
-
- bool event(QEvent *e);
-
-private:
- Q_DISABLE_COPY(QAnimationState)
- Q_DECLARE_PRIVATE(QAnimationState)
-};
-
-#endif //QT_NO_ANIMATION
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QANIMATIONSTATE_H
diff --git a/src/corelib/statemachine/qboundevent_p.h b/src/corelib/statemachine/qboundevent_p.h
index 5f31372..b641ff3 100644
--- a/src/corelib/statemachine/qboundevent_p.h
+++ b/src/corelib/statemachine/qboundevent_p.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp
index 65f0075..87ed77a 100644
--- a/src/corelib/statemachine/qeventtransition.cpp
+++ b/src/corelib/statemachine/qeventtransition.cpp
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -25,10 +55,11 @@ QT_BEGIN_NAMESPACE
\brief The QEventTransition class provides a QObject-specific transition for Qt events.
+ \since 4.6
\ingroup statemachine
- A QEventTransition object binds an event or transition to a particular
- QObject. QEventTransition is part of \l{The State Machine Framework}.
+ A QEventTransition object binds an event to a particular QObject.
+ QEventTransition is part of \l{The State Machine Framework}.
Example:
@@ -62,6 +93,11 @@ QT_BEGIN_NAMESPACE
\brief the event source that this event transition is associated with
*/
+/*!
+ \property QEventTransition::eventType
+
+ \brief the type of event that this event transition is associated with
+*/
QEventTransitionPrivate::QEventTransitionPrivate()
{
object = 0;
@@ -93,7 +129,7 @@ void QEventTransitionPrivate::invalidate()
Constructs a new QEventTransition object with the given \a sourceState.
*/
QEventTransition::QEventTransition(QState *sourceState)
- : QTransition(*new QEventTransitionPrivate, sourceState)
+ : QActionTransition(*new QEventTransitionPrivate, sourceState)
{
}
@@ -103,7 +139,7 @@ QEventTransition::QEventTransition(QState *sourceState)
*/
QEventTransition::QEventTransition(QObject *object, QEvent::Type type,
QState *sourceState)
- : QTransition(*new QEventTransitionPrivate, sourceState)
+ : QActionTransition(*new QEventTransitionPrivate, sourceState)
{
Q_D(QEventTransition);
d->registered = false;
@@ -119,7 +155,7 @@ QEventTransition::QEventTransition(QObject *object, QEvent::Type type,
QEventTransition::QEventTransition(QObject *object, QEvent::Type type,
const QList<QAbstractState*> &targets,
QState *sourceState)
- : QTransition(*new QEventTransitionPrivate, targets, sourceState)
+ : QActionTransition(*new QEventTransitionPrivate, targets, sourceState)
{
Q_D(QEventTransition);
d->registered = false;
@@ -131,7 +167,7 @@ QEventTransition::QEventTransition(QObject *object, QEvent::Type type,
\internal
*/
QEventTransition::QEventTransition(QEventTransitionPrivate &dd, QState *parent)
- : QTransition(dd, parent)
+ : QActionTransition(dd, parent)
{
}
@@ -140,7 +176,7 @@ QEventTransition::QEventTransition(QEventTransitionPrivate &dd, QState *parent)
*/
QEventTransition::QEventTransition(QEventTransitionPrivate &dd, QObject *object,
QEvent::Type type, QState *parent)
- : QTransition(dd, parent)
+ : QActionTransition(dd, parent)
{
Q_D(QEventTransition);
d->registered = false;
@@ -154,7 +190,7 @@ QEventTransition::QEventTransition(QEventTransitionPrivate &dd, QObject *object,
QEventTransition::QEventTransition(QEventTransitionPrivate &dd, QObject *object,
QEvent::Type type, const QList<QAbstractState*> &targets,
QState *parent)
- : QTransition(dd, targets, parent)
+ : QActionTransition(dd, targets, parent)
{
Q_D(QEventTransition);
d->registered = false;
@@ -248,16 +284,9 @@ bool QEventTransition::testEventCondition(QEvent *event) const
/*!
\reimp
*/
-void QEventTransition::onTransition()
-{
-}
-
-/*!
- \reimp
-*/
bool QEventTransition::event(QEvent *e)
{
- return QTransition::event(e);
+ return QActionTransition::event(e);
}
QT_END_NAMESPACE
diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h
index ece79e8..21a696c 100644
--- a/src/corelib/statemachine/qeventtransition.h
+++ b/src/corelib/statemachine/qeventtransition.h
@@ -3,16 +3,50 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QEVENTTRANSITION_H
#define QEVENTTRANSITION_H
-#include "qtransition.h"
+#ifndef QT_STATEMACHINE_SOLUTION
+#include <QtCore/qactiontransition.h>
+#else
+#include "qactiontransition.h"
+#endif
#include <QtCore/qcoreevent.h>
QT_BEGIN_HEADER
@@ -22,11 +56,13 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
class QEventTransitionPrivate;
-class Q_CORE_EXPORT QEventTransition : public QTransition
+class Q_CORE_EXPORT QEventTransition : public QActionTransition
{
Q_OBJECT
Q_PROPERTY(QObject* object READ eventSource WRITE setEventSource)
+#ifndef QT_STATEMACHINE_SOLUTION
Q_PROPERTY(QEvent::Type eventType READ eventType WRITE setEventType)
+#endif
public:
QEventTransition(QState *sourceState = 0);
QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = 0);
@@ -44,7 +80,6 @@ protected:
virtual bool testEventCondition(QEvent *event) const; // ### name
bool eventTest(QEvent *event) const;
- void onTransition();
bool event(QEvent *e);
diff --git a/src/corelib/statemachine/qeventtransition_p.h b/src/corelib/statemachine/qeventtransition_p.h
index 55ea9e6..2bb5aaa 100644
--- a/src/corelib/statemachine/qeventtransition_p.h
+++ b/src/corelib/statemachine/qeventtransition_p.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -23,12 +53,12 @@
// We mean it.
//
-#include "qtransition_p.h"
+#include "qactiontransition_p.h"
QT_BEGIN_NAMESPACE
class QEventTransition;
-class Q_CORE_EXPORT QEventTransitionPrivate : public QTransitionPrivate
+class Q_CORE_EXPORT QEventTransitionPrivate : public QActionTransitionPrivate
{
Q_DECLARE_PUBLIC(QEventTransition)
public:
diff --git a/src/corelib/statemachine/qfinalstate.cpp b/src/corelib/statemachine/qfinalstate.cpp
index c4dbcc9..abf9d2e 100644
--- a/src/corelib/statemachine/qfinalstate.cpp
+++ b/src/corelib/statemachine/qfinalstate.cpp
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -19,6 +49,7 @@ QT_BEGIN_NAMESPACE
\brief The QFinalState class provides a final state.
+ \since 4.6
\ingroup statemachine
A final state is used to communicate that (part of) a QStateMachine has
diff --git a/src/corelib/statemachine/qfinalstate.h b/src/corelib/statemachine/qfinalstate.h
index ba69c36..36813f5 100644
--- a/src/corelib/statemachine/qfinalstate.h
+++ b/src/corelib/statemachine/qfinalstate.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp
index a3da4be..8143d41 100644
--- a/src/corelib/statemachine/qhistorystate.cpp
+++ b/src/corelib/statemachine/qhistorystate.cpp
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -19,6 +49,7 @@ QT_BEGIN_NAMESPACE
\brief The QHistoryState class provides a means of returning to a previously active substate.
+ \since 4.6
\ingroup statemachine
A history state is a pseudo-state that represents the child state that the
diff --git a/src/corelib/statemachine/qhistorystate.h b/src/corelib/statemachine/qhistorystate.h
index a18d064..9cd7f0b 100644
--- a/src/corelib/statemachine/qhistorystate.h
+++ b/src/corelib/statemachine/qhistorystate.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/statemachine/qhistorystate_p.h b/src/corelib/statemachine/qhistorystate_p.h
index 1a2461b..84648b5 100644
--- a/src/corelib/statemachine/qhistorystate_p.h
+++ b/src/corelib/statemachine/qhistorystate_p.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/statemachine/qsignalevent.h b/src/corelib/statemachine/qsignalevent.h
index 50ac380..5dcabc4 100644
--- a/src/corelib/statemachine/qsignalevent.h
+++ b/src/corelib/statemachine/qsignalevent.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/statemachine/qsignaleventgenerator_p.h b/src/corelib/statemachine/qsignaleventgenerator_p.h
index 1d4e7d7..d18def8 100644
--- a/src/corelib/statemachine/qsignaleventgenerator_p.h
+++ b/src/corelib/statemachine/qsignaleventgenerator_p.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp
index 48add0d..32f2d02 100644
--- a/src/corelib/statemachine/qsignaltransition.cpp
+++ b/src/corelib/statemachine/qsignaltransition.cpp
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -25,6 +55,7 @@ QT_BEGIN_NAMESPACE
\brief The QSignalTransition class provides a transition based on a Qt signal.
+ \since 4.6
\ingroup statemachine
Typically you would use the overload of QState::addTransition() that takes a
@@ -106,7 +137,7 @@ void QSignalTransitionPrivate::invalidate()
Constructs a new signal transition with the given \a sourceState.
*/
QSignalTransition::QSignalTransition(QState *sourceState)
- : QTransition(*new QSignalTransitionPrivate, sourceState)
+ : QActionTransition(*new QSignalTransitionPrivate, sourceState)
{
}
@@ -116,7 +147,7 @@ QSignalTransition::QSignalTransition(QState *sourceState)
*/
QSignalTransition::QSignalTransition(QObject *sender, const char *signal,
QState *sourceState)
- : QTransition(*new QSignalTransitionPrivate, sourceState)
+ : QActionTransition(*new QSignalTransitionPrivate, sourceState)
{
Q_D(QSignalTransition);
d->sender = sender;
@@ -131,7 +162,7 @@ QSignalTransition::QSignalTransition(QObject *sender, const char *signal,
QSignalTransition::QSignalTransition(QObject *sender, const char *signal,
const QList<QAbstractState*> &targets,
QState *sourceState)
- : QTransition(*new QSignalTransitionPrivate, targets, sourceState)
+ : QActionTransition(*new QSignalTransitionPrivate, targets, sourceState)
{
Q_D(QSignalTransition);
d->sender = sender;
@@ -202,8 +233,9 @@ bool QSignalTransition::eventTest(QEvent *event) const
#else
if (event->type() == QEvent::Type(QEvent::User-1)) {
#endif
+ if (d->signalIndex == -1)
+ return false;
QSignalEvent *se = static_cast<QSignalEvent*>(event);
- Q_ASSERT(d->signalIndex != -1);
return (se->sender() == d->sender)
&& (se->signalIndex() == d->signalIndex);
}
@@ -213,16 +245,9 @@ bool QSignalTransition::eventTest(QEvent *event) const
/*!
\reimp
*/
-void QSignalTransition::onTransition()
-{
-}
-
-/*!
- \reimp
-*/
bool QSignalTransition::event(QEvent *e)
{
- return QTransition::event(e);
+ return QActionTransition::event(e);
}
QT_END_NAMESPACE
diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h
index c090bd8..c1a41ae 100644
--- a/src/corelib/statemachine/qsignaltransition.h
+++ b/src/corelib/statemachine/qsignaltransition.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -13,9 +43,9 @@
#define QSIGNALTRANSITION_H
#ifndef QT_STATEMACHINE_SOLUTION
-#include <QtCore/qtransition.h>
+#include <QtCore/qactiontransition.h>
#else
-#include "qtransition.h"
+#include "qactiontransition.h"
#endif
QT_BEGIN_HEADER
@@ -25,7 +55,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
class QSignalTransitionPrivate;
-class Q_CORE_EXPORT QSignalTransition : public QTransition
+class Q_CORE_EXPORT QSignalTransition : public QActionTransition
{
Q_OBJECT
Q_PROPERTY(QObject* object READ senderObject WRITE setSenderObject)
@@ -47,7 +77,6 @@ public:
protected:
bool eventTest(QEvent *event) const;
- void onTransition();
bool event(QEvent *e);
diff --git a/src/corelib/statemachine/qsignaltransition_p.h b/src/corelib/statemachine/qsignaltransition_p.h
index d200676..bd815d9 100644
--- a/src/corelib/statemachine/qsignaltransition_p.h
+++ b/src/corelib/statemachine/qsignaltransition_p.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -23,12 +53,12 @@
// We mean it.
//
-#include "qtransition_p.h"
+#include "qactiontransition_p.h"
QT_BEGIN_NAMESPACE
class QSignalTransition;
-class QSignalTransitionPrivate : public QTransitionPrivate
+class QSignalTransitionPrivate : public QActionTransitionPrivate
{
Q_DECLARE_PUBLIC(QSignalTransition)
public:
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index 26dbd89..e3da1c5 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -19,9 +49,6 @@
#include "qstatefinishedtransition.h"
#include "qstatemachine.h"
#include "qstatemachine_p.h"
-#ifndef QT_NO_ANIMATION
-#include "qanimationstate.h"
-#endif
QT_BEGIN_NAMESPACE
@@ -30,6 +57,7 @@ QT_BEGIN_NAMESPACE
\brief The QState class provides a general-purpose state for QStateMachine.
+ \since 4.6
\ingroup statemachine
QState objects can have child states, and can have transitions to other
@@ -47,6 +75,9 @@ QT_BEGIN_NAMESPACE
The addHistoryState() function adds a history state.
+ The addFinishedTransition() function creates and adds a transition that's
+ triggered when a final child state is entered.
+
The setErrorState() sets the state's error state. The error state is the
state that the state machine will transition to if an error is detected when
attempting to enter the state (e.g. because no initial state has been set).
@@ -242,36 +273,42 @@ void QState::addTransition(QAbstractTransition *transition)
/*!
Adds a transition associated with the given \a signal of the given \a sender
- object. The transition has this state as the source, and the given \a target
- as the target state.
+ object, and returns the new QSignalTransition object. The transition has
+ this state as the source, and the given \a target as the target state.
*/
-void QState::addTransition(QObject *sender, const char *signal,
- QAbstractState *target)
+QSignalTransition *QState::addTransition(QObject *sender, const char *signal,
+ QAbstractState *target)
{
if (!sender) {
qWarning("QState::addTransition: sender cannot be null");
- return;
+ return 0;
}
if (!signal) {
qWarning("QState::addTransition: signal cannot be null");
- return;
+ return 0;
}
- addTransition(new QSignalTransition(sender, signal, QList<QAbstractState*>() << target));
+ QSignalTransition *trans = new QSignalTransition(sender, signal, QList<QAbstractState*>() << target);
+ addTransition(trans);
+ return trans;
}
/*!
Adds a transition that's triggered by the finished event of this state, and
- that has the given \a target state.
+ returns the new QStateFinishedTransition object. The transition has the
+ given \a target state.
\sa QStateFinishedEvent
*/
-void QState::addFinishedTransition(QAbstractState *target)
+QStateFinishedTransition *QState::addFinishedTransition(QAbstractState *target)
{
- addTransition(new QStateFinishedTransition(this, QList<QAbstractState*>() << target));
+ QStateFinishedTransition *trans = new QStateFinishedTransition(this, QList<QAbstractState*>() << target);
+ addTransition(trans);
+ return trans;
}
namespace {
+// ### Make public?
class UnconditionalTransition : public QAbstractTransition
{
public:
@@ -286,11 +323,13 @@ protected:
/*!
Adds an unconditional transition from this state to the given \a target
- state.
+ state, and returns then new transition object.
*/
-void QState::addTransition(QAbstractState *target)
+QAbstractTransition *QState::addTransition(QAbstractState *target)
{
- addTransition(new UnconditionalTransition(target));
+ UnconditionalTransition *trans = new UnconditionalTransition(target);
+ addTransition(trans);
+ return trans;
}
/*!
@@ -355,80 +394,6 @@ void QState::onExit()
QActionState::onExit();
}
-#ifndef QT_NO_ANIMATION
-
-/*!
- \overload addAnimatedTransition()
-
- Adds an animated transition from the current state to \a targetState for \a animation.
-
- This function creates a QSignalTransition for the \a sender and \a signal, and calls
- addAnimatedTransition() with this transition object.
-*/
-QAnimationState *QState::addAnimatedTransition(QObject *sender, const char *signal,
- QAbstractState *targetState,
- QAbstractAnimation *animation)
-{
- if (!targetState) {
- qWarning("QState::addAnimatedTransition: cannot add transition to null state");
- return 0;
- }
- return addAnimatedTransition(
- new QSignalTransition(sender, signal,
- QList<QAbstractState*>() << targetState), animation);
-}
-
-/*!
- Adds an animated transition from the current state.
-
- The animated transition has an intermediate QAnimationState which plays \a
- animation before entering the target state(s). This QAnimationState will be
- entered when \a transition is taken by the state machine. When the animation
- has finished playing, the transition's target state(s) will be entered.
-
- The new QAnimationState object will become a child of this state's parent state.
-
- \code
- QPushButton button;
- QPropertyAnimation animation(&button, "geometry");
- animation.setEndValue(QRect(100, 100, 400, 400));
-
- QStateMachine machine;
-
- QState *s1 = new QState();
- QState *s2 = new QState();
-
- QTransition *transition = new QTransition(MyEventType);
- s1->addAnimatedTransition(transition, s2, &animation);
- \endcode
-
- The function returns the new QAnimationState. This state can be used if you want to add additional
- transitions into or out from the animation state, and if you want to add additional animations.
-
- \sa QAnimationState
-*/
-QAnimationState *QState::addAnimatedTransition(QAbstractTransition *transition,
- QAbstractAnimation *animation)
-{
- if (!transition) {
- qWarning("QState::addAnimatedTransition: cannot add null transition");
- return 0;
- }
- QList<QAbstractState*> targets = transition->targetStates();
- Q_ASSERT(!targets.isEmpty());
- if (!targets.at(0)->parentState()) {
- qWarning("QState::addAnimatedTransition: cannot add transition to target that doesn't have a parent state");
- return 0;
- }
- QAnimationState *animState = new QAnimationState(animation, targets.at(0)->parentState());
- animState->addTransition(new QStateFinishedTransition(animState, targets));
- transition->setTargetStates(QList<QAbstractState*>() << animState);
- addTransition(transition);
- return animState;
-}
-
-#endif
-
/*!
Returns this state's initial state, or 0 if the state has no initial state.
*/
diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h
index ba2d034..4c86e02 100644
--- a/src/corelib/statemachine/qstate.h
+++ b/src/corelib/statemachine/qstate.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -26,10 +56,8 @@ QT_MODULE(Core)
class QAbstractTransition;
class QHistoryState;
-#ifndef QT_NO_ANIMATION
-class QAbstractAnimation;
-class QAnimationState;
-#endif
+class QSignalTransition;
+class QStateFinishedTransition;
class QStatePrivate;
class Q_CORE_EXPORT QState : public QActionState
@@ -54,20 +82,12 @@ public:
void setErrorState(QAbstractState *state);
void addTransition(QAbstractTransition *transition);
- void addTransition(QObject *sender, const char *signal, QAbstractState *target);
- void addTransition(QAbstractState *target);
- void addFinishedTransition(QAbstractState *target);
+ QSignalTransition *addTransition(QObject *sender, const char *signal, QAbstractState *target);
+ QAbstractTransition *addTransition(QAbstractState *target);
+ QStateFinishedTransition *addFinishedTransition(QAbstractState *target);
void removeTransition(QAbstractTransition *transition);
QList<QAbstractTransition*> transitions() const;
-#ifndef QT_NO_ANIMATION
- QAnimationState *addAnimatedTransition(QObject *sender, const char *signal,
- QAbstractState *targetState,
- QAbstractAnimation *animation = 0);
- QAnimationState *addAnimatedTransition(QAbstractTransition *transition,
- QAbstractAnimation *animation = 0);
-#endif
-
QHistoryState *addHistoryState(HistoryType type = ShallowHistory);
QAbstractState *initialState() const;
diff --git a/src/corelib/statemachine/qstate_p.h b/src/corelib/statemachine/qstate_p.h
index fe9b24a..17b312a 100644
--- a/src/corelib/statemachine/qstate_p.h
+++ b/src/corelib/statemachine/qstate_p.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/statemachine/qstateaction.cpp b/src/corelib/statemachine/qstateaction.cpp
index c12b093..569d5d5 100644
--- a/src/corelib/statemachine/qstateaction.cpp
+++ b/src/corelib/statemachine/qstateaction.cpp
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -41,11 +71,12 @@ void QStateActionPrivate::callExecute()
\brief The QStateAction class is the base class of QState actions.
+ \since 4.6
\ingroup statemachine
- A state action is added to a state by calling QState::addEntryAction() or
- QState::addExitAction(). QStateAction is part of \l{The State Machine
- Framework}.
+ A state action is added to a state by calling QActionState::addEntryAction()
+ or QActionState::addExitAction(). QStateAction is part of \l{The State
+ Machine Framework}.
\section1 Subclassing
@@ -112,151 +143,6 @@ bool QStateAction::event(QEvent *e)
return QObject::event(e);
}
-QStateSetPropertyActionPrivate *QStateSetPropertyActionPrivate::get(QStateSetPropertyAction *q)
-{
- return q->d_func();
-}
-
-/*!
- \class QStateSetPropertyAction
-
- \brief The QStateSetPropertyAction class provides a set property action for QObjects.
-
- \ingroup statemachine
-
- The QStateSetPropertyAction class provides an action that sets a property of
- a QObject to a pre-defined value when a QState is entered or exited.
- QStateSetPropertyAction is part of \l{The State Machine Framework}.
-
- Typically you don't construct QStateSetPropertyAction objects directly, but
- rather call the QState::setPropertyOnEntry() function or the
- QState::setPropertyOnExit() function.
-*/
-
-/*!
- \property QStateSetPropertyAction::target
-
- \brief the object for which this action sets a property
-*/
-
-/*!
- \property QStateSetPropertyAction::propertyName
-
- \brief the name of the property set by this action
-*/
-
-/*!
- \property QStateSetPropertyAction::value
-
- \brief the value set by this action
-*/
-
-/*!
- Constructs a new QStateSetPropertyAction object for the property named \a
- propertyName of the given \a target object, with the given \a value, and
- with the given \a parent.
-*/
-QStateSetPropertyAction::QStateSetPropertyAction(
- QObject *target, const QByteArray &propertyName,
- const QVariant &value, QObject *parent)
- : QStateAction(*new QStateSetPropertyActionPrivate, parent)
-{
- Q_D(QStateSetPropertyAction);
- d->target = target;
- d->propertyName = propertyName;
- d->value = value;
-}
-
-/*!
- Constructs a new QStateSetPropertyAction object with the given \a parent.
-*/
-QStateSetPropertyAction::QStateSetPropertyAction(QObject *parent)
- : QStateAction(*new QStateSetPropertyActionPrivate, parent)
-{
- Q_D(QStateSetPropertyAction);
- d->target = 0;
-}
-
-/*!
- Destroys this QStateAbstractSetPropertyAction object.
-*/
-QStateSetPropertyAction::~QStateSetPropertyAction()
-{
-}
-
-/*!
- Returns the object for which this action sets a property.
-*/
-QObject *QStateSetPropertyAction::targetObject() const
-{
- Q_D(const QStateSetPropertyAction);
- return d->target;
-}
-
-/*!
- Sets the object for which this action sets a property.
-*/
-void QStateSetPropertyAction::setTargetObject(QObject *target)
-{
- Q_D(QStateSetPropertyAction);
- d->target = target;
-}
-
-/*!
- Returns the name of the property set by this action.
-*/
-QByteArray QStateSetPropertyAction::propertyName() const
-{
- Q_D(const QStateSetPropertyAction);
- return d->propertyName;
-}
-
-/*!
- Sets the name of the property set by this action.
-*/
-void QStateSetPropertyAction::setPropertyName(const QByteArray &propertyName)
-{
- Q_D(QStateSetPropertyAction);
- d->propertyName = propertyName;
-}
-
-/*!
- Returns the value set by this action.
-*/
-QVariant QStateSetPropertyAction::value() const
-{
- Q_D(const QStateSetPropertyAction);
- return d->value;
-}
-
-/*!
- Sets the value set by this action.
-*/
-void QStateSetPropertyAction::setValue(const QVariant &value)
-{
- Q_D(QStateSetPropertyAction);
- d->value = value;
-}
-
-/*!
- \reimp
-*/
-void QStateSetPropertyAction::execute()
-{
- Q_D(QStateSetPropertyAction);
- if (!d->target)
- return;
- d->target->setProperty(d->propertyName, d->value);
-}
-
-/*!
- \reimp
-*/
-bool QStateSetPropertyAction::event(QEvent *e)
-{
- return QStateAction::event(e);
-}
-
QStateInvokeMethodActionPrivate *QStateInvokeMethodActionPrivate::get(QStateInvokeMethodAction *q)
{
return q->d_func();
@@ -267,6 +153,7 @@ QStateInvokeMethodActionPrivate *QStateInvokeMethodActionPrivate::get(QStateInvo
\brief The QStateInvokeMethodAction class provides an invoke method action for QObjects.
+ \since 4.6
\ingroup statemachine
The QStateInvokeMethodAction class provides an action that calls a method of
diff --git a/src/corelib/statemachine/qstateaction.h b/src/corelib/statemachine/qstateaction.h
index df1e0f0..6843080 100644
--- a/src/corelib/statemachine/qstateaction.h
+++ b/src/corelib/statemachine/qstateaction.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,38 +78,6 @@ private:
Q_DECLARE_PRIVATE(QStateAction)
};
-class QStateSetPropertyActionPrivate;
-class Q_CORE_EXPORT QStateSetPropertyAction : public QStateAction
-{
- Q_OBJECT
- Q_PROPERTY(QObject* target READ targetObject WRITE setTargetObject)
- Q_PROPERTY(QByteArray propertyName READ propertyName WRITE setPropertyName)
- Q_PROPERTY(QVariant value READ value WRITE setValue)
-public:
- QStateSetPropertyAction(QObject *target, const QByteArray &propertyName,
- const QVariant &value, QObject *parent = 0);
- QStateSetPropertyAction(QObject *parent = 0);
- ~QStateSetPropertyAction();
-
- QObject *targetObject() const;
- void setTargetObject(QObject *target);
-
- QByteArray propertyName() const;
- void setPropertyName(const QByteArray &name);
-
- QVariant value() const;
- void setValue(const QVariant &value);
-
-protected:
- void execute();
-
- bool event(QEvent *e);
-
-private:
- Q_DISABLE_COPY(QStateSetPropertyAction)
- Q_DECLARE_PRIVATE(QStateSetPropertyAction)
-};
-
class QStateInvokeMethodActionPrivate;
class Q_CORE_EXPORT QStateInvokeMethodAction : public QStateAction
{
diff --git a/src/corelib/statemachine/qstateaction_p.h b/src/corelib/statemachine/qstateaction_p.h
index 54e3a05..4016b74 100644
--- a/src/corelib/statemachine/qstateaction_p.h
+++ b/src/corelib/statemachine/qstateaction_p.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -56,21 +86,6 @@ public:
#endif
};
-class QStateSetPropertyAction;
-class QStateSetPropertyActionPrivate : public QStateActionPrivate
-{
- Q_DECLARE_PUBLIC(QStateSetPropertyAction)
-public:
- QStateSetPropertyActionPrivate() {}
- ~QStateSetPropertyActionPrivate() {}
-
- static QStateSetPropertyActionPrivate *get(QStateSetPropertyAction *q);
-
- QObject *target;
- QByteArray propertyName;
- QVariant value;
-};
-
class QStateInvokeMethodAction;
class QStateInvokeMethodActionPrivate : public QStateActionPrivate
{
diff --git a/src/corelib/statemachine/qstatefinishedevent.h b/src/corelib/statemachine/qstatefinishedevent.h
index d6a1146..c2f81f7 100644
--- a/src/corelib/statemachine/qstatefinishedevent.h
+++ b/src/corelib/statemachine/qstatefinishedevent.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/statemachine/qstatefinishedtransition.cpp b/src/corelib/statemachine/qstatefinishedtransition.cpp
index 3d8c588..33c3d22 100644
--- a/src/corelib/statemachine/qstatefinishedtransition.cpp
+++ b/src/corelib/statemachine/qstatefinishedtransition.cpp
@@ -3,15 +3,45 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
#include "qstatefinishedtransition.h"
#include "qstatefinishedevent.h"
-#include "qtransition_p.h"
+#include "qactiontransition_p.h"
QT_BEGIN_NAMESPACE
@@ -50,7 +80,7 @@ QT_BEGIN_NAMESPACE
\brief the state whose QStateFinishedEvent this transition is associated with
*/
-class QStateFinishedTransitionPrivate : public QTransitionPrivate
+class QStateFinishedTransitionPrivate : public QActionTransitionPrivate
{
Q_DECLARE_PUBLIC(QStateFinishedTransition)
public:
@@ -76,7 +106,7 @@ QStateFinishedTransitionPrivate *QStateFinishedTransitionPrivate::get(QStateFini
sourceState.
*/
QStateFinishedTransition::QStateFinishedTransition(QState *sourceState)
- : QTransition(*new QStateFinishedTransitionPrivate, sourceState)
+ : QActionTransition(*new QStateFinishedTransitionPrivate, sourceState)
{
}
@@ -86,7 +116,7 @@ QStateFinishedTransition::QStateFinishedTransition(QState *sourceState)
*/
QStateFinishedTransition::QStateFinishedTransition(
QState *state, const QList<QAbstractState*> &targets, QState *sourceState)
- : QTransition(*new QStateFinishedTransitionPrivate, targets, sourceState)
+ : QActionTransition(*new QStateFinishedTransitionPrivate, targets, sourceState)
{
Q_D(QStateFinishedTransition);
d->state = state;
@@ -137,16 +167,9 @@ bool QStateFinishedTransition::eventTest(QEvent *event) const
/*!
\reimp
*/
-void QStateFinishedTransition::onTransition()
-{
-}
-
-/*!
- \reimp
-*/
bool QStateFinishedTransition::event(QEvent *e)
{
- return QTransition::event(e);
+ return QActionTransition::event(e);
}
QT_END_NAMESPACE
diff --git a/src/corelib/statemachine/qstatefinishedtransition.h b/src/corelib/statemachine/qstatefinishedtransition.h
index bcd82fa..f9320f5 100644
--- a/src/corelib/statemachine/qstatefinishedtransition.h
+++ b/src/corelib/statemachine/qstatefinishedtransition.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -13,9 +43,9 @@
#define QSTATEFINISHEDTRANSITION_H
#ifndef QT_STATEMACHINE_SOLUTION
-#include <QtCore/qtransition.h>
+#include <QtCore/qactiontransition.h>
#else
-#include "qtransition.h"
+#include "qactiontransition.h"
#endif
QT_BEGIN_HEADER
@@ -27,7 +57,7 @@ QT_MODULE(Core)
class QState;
class QStateFinishedTransitionPrivate;
-class Q_CORE_EXPORT QStateFinishedTransition : public QTransition
+class Q_CORE_EXPORT QStateFinishedTransition : public QActionTransition
{
Q_OBJECT
Q_PROPERTY(QState* state READ state WRITE setState)
@@ -42,7 +72,6 @@ public:
protected:
bool eventTest(QEvent *event) const;
- void onTransition();
bool event(QEvent *e);
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index 208c6a9..0a1d248 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -26,7 +56,6 @@
#include "qhistorystate_p.h"
#include "qstatefinishedevent.h"
#include "qstatefinishedtransition.h"
-#include "qmetaobject.h"
#include "qstate.h"
#include "qstate_p.h"
#include "qstateaction.h"
@@ -44,9 +73,15 @@
#ifndef QT_NO_ANIMATION
#include "qpropertyanimation.h"
-#include "qanimationstate.h"
+#include "qanimationgroup.h"
+# ifndef QT_STATEMACHINE_SOLUTION
+# include <private/qvariantanimation_p.h>
+# else
+# include "qvariantanimation_p.h"
+# endif
#endif
+#include <QtCore/qmetaobject.h>
#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -57,6 +92,7 @@ QT_BEGIN_NAMESPACE
\brief The QStateMachine class provides a hierarchical finite state machine.
+ \since 4.6
\ingroup statemachine
The QStateMachine class provides a hierarchical finite state machine based
@@ -75,7 +111,7 @@ QT_BEGIN_NAMESPACE
invoke methods on QObjects when the state is entered or exited. This is
typically used in conjunction with \l{Signals and Slots}{signals}; the
signals determine the flow of the state graph, whereas the states' property
- assigments and method invocations are the actions.
+ assignments and method invocations are the actions.
Use the addState() function to add a state to the state machine;
alternatively, pass the machine's rootState() to the state constructor. Use
@@ -89,7 +125,7 @@ QT_BEGIN_NAMESPACE
QStateMachine machine;
QState *s1 = new QState();
- s1->setPropertyOnEntry(&button, "text", "Click me");
+ s1->assignProperty(&button, "text", "Click me");
QFinalState *s2 = new QFinalState();
s1->addTransition(&button, SIGNAL(clicked()), s2);
@@ -148,7 +184,6 @@ QT_BEGIN_NAMESPACE
*/
// #define QSTATEMACHINE_DEBUG
-// #define QT_NO_STATEMACHINE_RESTOREPROPERTIES
QStateMachinePrivate::QStateMachinePrivate()
{
@@ -157,7 +192,7 @@ QStateMachinePrivate::QStateMachinePrivate()
processingScheduled = false;
stop = false;
error = QStateMachine::NoError;
- globalRestorePolicy = QState::DoNotRestoreProperties;
+ globalRestorePolicy = QAbstractState::DoNotRestoreProperties;
rootState = 0;
initialErrorStateForRoot = 0;
#ifndef QT_STATEMACHINE_SOLUTION
@@ -320,14 +355,15 @@ void QStateMachinePrivate::microstep(const QList<QAbstractTransition*> &enabledT
qDebug() << q_func() << ": configuration after exiting states:" << configuration;
#endif
executeTransitionContent(enabledTransitions);
- enterStates(enabledTransitions);
+ QList<QAbstractState*> enteredStates = enterStates(enabledTransitions);
+ applyProperties(enabledTransitions, enteredStates);
#ifdef QSTATEMACHINE_DEBUG
qDebug() << q_func() << ": configuration after entering states:" << configuration;
qDebug() << q_func() << ": end microstep";
#endif
}
-void QStateMachinePrivate::exitStates(const QList<QAbstractTransition*> &enabledTransitions)
+QList<QAbstractState*> QStateMachinePrivate::exitStates(const QList<QAbstractTransition*> &enabledTransitions)
{
// qDebug() << "exitStates(" << enabledTransitions << ")";
QSet<QAbstractState*> statesToExit;
@@ -382,6 +418,7 @@ void QStateMachinePrivate::exitStates(const QList<QAbstractTransition*> &enabled
QAbstractStatePrivate::get(s)->callOnExit();
configuration.remove(s);
}
+ return statesToExit_sorted;
}
void QStateMachinePrivate::executeTransitionContent(const QList<QAbstractTransition*> &enabledTransitions)
@@ -395,7 +432,7 @@ void QStateMachinePrivate::executeTransitionContent(const QList<QAbstractTransit
}
}
-void QStateMachinePrivate::enterStates(const QList<QAbstractTransition*> &enabledTransitions)
+QList<QAbstractState*> QStateMachinePrivate::enterStates(const QList<QAbstractTransition*> &enabledTransitions)
{
#ifdef QSTATEMACHINE_DEBUG
Q_Q(QStateMachine);
@@ -458,65 +495,6 @@ void QStateMachinePrivate::enterStates(const QList<QAbstractTransition*> &enable
QList<QAbstractState*> statesToEnter_sorted = statesToEnter.toList();
qSort(statesToEnter_sorted.begin(), statesToEnter_sorted.end(), stateEntryLessThan);
-
-#ifndef QT_NO_STATEMACHINE_RESTOREPROPERTIES
- bool hasAnimationState = false;
-
- QHash<RestorableId, QVariant> pendingRestorables = registeredRestorables;
- for (int i = 0; i < statesToEnter_sorted.size(); ++i) {
- QAbstractState *as = statesToEnter_sorted.at(i);
-
-#ifndef QT_NO_ANIMATION
- // If we are going to an animation state, it will restore properties for us
- hasAnimationState = hasAnimationState
- || qobject_cast<QAnimationState*>(as) != 0;
-#endif
-
- QActionState *s = qobject_cast<QActionState*>(as);
- if (s == 0)
- continue;
-
- QActionState::RestorePolicy restorePolicy = s->restorePolicy();
- if (restorePolicy == QActionState::GlobalRestorePolicy)
- restorePolicy = globalRestorePolicy;
-
- if (restorePolicy == QActionState::DoNotRestoreProperties)
- continue;
-
- QActionStatePrivate *s_d = QActionStatePrivate::get(s);
- QList<QStateAction*> actions = s_d->entryActions();
-
- for (int j = 0; j < actions.size(); ++j) {
- QStateSetPropertyAction *spa = qobject_cast<QStateSetPropertyAction*>(actions.at(j));
- if (spa == 0 || spa->targetObject() == 0)
- continue;
-
- registerRestorable(spa->targetObject(), spa->propertyName());
- pendingRestorables.remove(RestorableId(spa->targetObject(), spa->propertyName()));
- }
- }
-
-#ifndef QT_NO_ANIMATION
- // If the configuration has an animation state, we do not want to restore here, as we
- // might be transitioning inside the animation state (into the final state for instance.)
- // We let the animation state handle the restoration.
- QSet<QAbstractState*>::const_iterator it;
- for (it=configuration.constBegin(); !hasAnimationState && it!=configuration.constEnd(); ++it)
- hasAnimationState = qobject_cast<QAnimationState*>(*it) != 0;
-#endif
-
- if (!hasAnimationState) {
- QHash<RestorableId, QVariant>::const_iterator it;
- for (it = pendingRestorables.constBegin(); it != pendingRestorables.constEnd(); ++it) {
- QObject *object = it.key().first;
- QByteArray propertyName = it.key().second;
-
- object->setProperty(propertyName, it.value());
- unregisterRestorable(object, propertyName);
- }
- }
-
-#endif // QT_NO_STATEMACHINE_RESTOREPROPERTIES
for (int i = 0; i < statesToEnter_sorted.size(); ++i) {
QAbstractState *s = statesToEnter_sorted.at(i);
@@ -568,6 +546,7 @@ void QStateMachinePrivate::enterStates(const QList<QAbstractTransition*> &enable
}
}
// qDebug() << "configuration:" << configuration.toList();
+ return statesToEnter_sorted;
}
void QStateMachinePrivate::addStatesToEnter(QAbstractState *s, QState *root,
@@ -618,6 +597,115 @@ void QStateMachinePrivate::addStatesToEnter(QAbstractState *s, QState *root,
}
}
+void QStateMachinePrivate::applyProperties(const QList<QAbstractTransition*> &transitionList,
+ const QList<QAbstractState*> &enteredStates)
+{
+#ifndef QT_NO_ANIMATION
+ Q_Q(QStateMachine);
+ // Gracefully terminate playing animations.
+ for (int i = 0; i < playingAnimations.size(); ++i)
+ playingAnimations.at(i)->stop();
+ playingAnimations.clear();
+ for (int i = 0; i < resetEndValues.size(); ++i)
+ qobject_cast<QVariantAnimation*>(resetEndValues.at(i))->setEndValue(QVariant()); // ### generalize
+ resetEndValues.clear();
+
+ // Find the animations to use for the state change.
+ QList<QAbstractAnimation*> selectedAnimations;
+ for (int i = 0; i < transitionList.size(); ++i)
+ selectedAnimations << transitionList.at(i)->animations();
+#else
+ Q_UNUSED(transitionList);
+#endif
+
+ // Process the SetProperty definitions of the entered states.
+ QList<QPropertyAssignment> propertyAssignments;
+ QHash<RestorableId, QVariant> pendingRestorables = registeredRestorables;
+ for (int i = 0; i < enteredStates.size(); ++i) {
+ QAbstractState *s = enteredStates.at(i);
+
+ QAbstractState::RestorePolicy restorePolicy = s->restorePolicy();
+ if (restorePolicy == QAbstractState::GlobalRestorePolicy)
+ restorePolicy = globalRestorePolicy;
+
+ QList<QPropertyAssignment> assignments = QAbstractStatePrivate::get(s)->propertyAssignments;
+ for (int j = 0; j < assignments.size(); ++j) {
+ const QPropertyAssignment &assn = assignments.at(j);
+ if (restorePolicy == QAbstractState::RestoreProperties) {
+ registerRestorable(assn.object, assn.propertyName);
+ }
+ pendingRestorables.remove(RestorableId(assn.object, assn.propertyName));
+ propertyAssignments.append(assn);
+ }
+ }
+ propertyAssignments << restorablesToPropertyList(pendingRestorables);
+
+#ifndef QT_NO_ANIMATION
+ // Set the animated properties that did not finish animating and that are not
+ // set in the new state.
+ for (int i = 0; i < propertiesForAnimations.size(); ++i) {
+ QPropertyAssignment assn = propertiesForAnimations.at(i).second;
+ bool found = false;
+ for (int j = 0; j < propertyAssignments.size(); ++j) {
+ if ((propertyAssignments.at(j).object == assn.object)
+ && (propertyAssignments.at(j).propertyName == assn.propertyName)) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ assn.object->setProperty(assn.propertyName, assn.value);
+ }
+ }
+
+ // Initialize animations from SetProperty definitions.
+ propertiesForAnimations.clear();
+ for (int i = 0; i < selectedAnimations.size(); ++i) {
+ QAbstractAnimation *anim = selectedAnimations.at(i);
+ QList<QPropertyAssignment>::iterator it;
+ for (it = propertyAssignments.begin(); it != propertyAssignments.end(); ) {
+ QPair<QList<QAbstractAnimation*>, QList<QAbstractAnimation*> > ret;
+ ret = initializeAnimation(anim, *it);
+ QList<QAbstractAnimation*> handlers = ret.first;
+ if (!handlers.isEmpty()) {
+ for (int j = 0; j < handlers.size(); ++j)
+ propertiesForAnimations.append(qMakePair(handlers.at(j), *it));
+ it = propertyAssignments.erase(it);
+ } else {
+ ++it;
+ }
+ resetEndValues << ret.second;
+ }
+
+ // We require that at least one animation is valid.
+ // ### generalize
+ QList<QVariantAnimation*> variantAnims = qFindChildren<QVariantAnimation*>(anim);
+ if (QVariantAnimation *va = qobject_cast<QVariantAnimation*>(anim))
+ variantAnims.append(va);
+ bool hasValidEndValue = false;
+ for (int j = 0; j < variantAnims.size(); ++j) {
+ if (variantAnims.at(j)->endValue().isValid()) {
+ hasValidEndValue = true;
+ break;
+ }
+ }
+
+ if (hasValidEndValue) {
+ QObject::disconnect(anim, SIGNAL(finished()), q, SLOT(_q_animationFinished()));
+ QObject::connect(anim, SIGNAL(finished()), q, SLOT(_q_animationFinished()));
+ anim->start();
+ playingAnimations.append(anim);
+ }
+ }
+#endif // !QT_NO_ANIMATION
+
+ // Immediately set the properties that are not animated.
+ for (int i = 0; i < propertyAssignments.size(); ++i) {
+ const QPropertyAssignment &assn = propertyAssignments.at(i);
+ assn.object->setProperty(assn.propertyName, assn.value);
+ }
+}
+
bool QStateMachinePrivate::isFinal(const QAbstractState *s)
{
return qobject_cast<const QFinalState*>(s) != 0;
@@ -696,7 +784,18 @@ void QStateMachinePrivate::registerRestorable(QObject *object, const QByteArray
{
RestorableId id(object, propertyName);
if (!registeredRestorables.contains(id))
- registeredRestorables.insert(id, object->property(propertyName));
+ registeredRestorables.insert(id, object->property(propertyName));
+}
+
+QList<QPropertyAssignment> QStateMachinePrivate::restorablesToPropertyList(const QHash<RestorableId, QVariant> &restorables) const
+{
+ QList<QPropertyAssignment> result;
+ QHash<RestorableId, QVariant>::const_iterator it;
+ for (it = restorables.constBegin(); it != restorables.constEnd(); ++it) {
+// qDebug() << "restorable:" << it.key().first << it.key().second << it.value();
+ result.append(QPropertyAssignment(it.key().first, it.key().second, it.value(), /*explicitlySet=*/false));
+ }
+ return result;
}
/*!
@@ -720,48 +819,11 @@ QVariant QStateMachinePrivate::restorableValue(QObject *object, const QByteArray
*/
void QStateMachinePrivate::unregisterRestorable(QObject *object, const QByteArray &propertyName)
{
+// qDebug() << "unregisterRestorable(" << object << propertyName << ")";
RestorableId id(object, propertyName);
registeredRestorables.remove(id);
-
-#ifndef QT_NO_ANIMATION
- registeredRestorableAnimations.remove(id);
-#endif
-
}
-#ifndef QT_NO_ANIMATION
-void QStateMachinePrivate::registerRestorable(QPropertyAnimation *animation)
-{
- // We always want to restore to the first registered value, so if one is already present, we
- // leave it be.
- RestorableId id(animation->targetObject(), animation->propertyName());
- if (!registeredRestorableAnimations.contains(id))
- registeredRestorableAnimations.insert(id, animation);
- registerRestorable(animation->targetObject(), animation->propertyName());
-}
-
-
-/*!
- \internal
- Returns all variables currently registered. The list returned is in no particular order.
-*/
-QList<QPropertyAnimation*> QStateMachinePrivate::restorableAnimations() const
-{
- return registeredRestorableAnimations.values();
-}
-
-/*!
- \internal
- Returns a reference to the restorable identified by \a id.
-*/
-QPropertyAnimation *QStateMachinePrivate::restorableAnimation(QObject *object,
- const QByteArray &propertyName)
-{
- return registeredRestorableAnimations.value(RestorableId(object, propertyName), 0);
-}
-
-#endif // QT_NO_ANIMATION
-
QAbstractState *QStateMachinePrivate::findErrorState(QAbstractState *context)
{
// If the user sets the root state's error state to 0, we return the initial error state
@@ -820,6 +882,82 @@ void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractSta
}
}
+#ifndef QT_NO_ANIMATION
+
+QPair<QList<QAbstractAnimation*>, QList<QAbstractAnimation*> >
+QStateMachinePrivate::initializeAnimation(QAbstractAnimation *abstractAnimation,
+ const QPropertyAssignment &prop)
+{
+ QList<QAbstractAnimation*> handledAnimations;
+ QList<QAbstractAnimation*> localResetEndValues;
+ QAnimationGroup *group = qobject_cast<QAnimationGroup*>(abstractAnimation);
+ if (group) {
+ for (int i = 0; i < group->animationCount(); ++i) {
+ QAbstractAnimation *animationChild = group->animationAt(i);
+ QPair<QList<QAbstractAnimation*>, QList<QAbstractAnimation*> > ret;
+ ret = initializeAnimation(animationChild, prop);
+ handledAnimations << ret.first;
+ localResetEndValues << ret.second;
+ }
+ } else {
+ QPropertyAnimation *animation = qobject_cast<QPropertyAnimation *>(abstractAnimation);
+ if (animation != 0
+ && prop.object == animation->targetObject()
+ && prop.propertyName == animation->propertyName()) {
+
+ if (!animation->startValue().isValid()) {
+ QByteArray propertyName = animation->propertyName();
+ QVariant currentValue = animation->targetObject()->property(propertyName);
+
+ QVariantAnimationPrivate::get(animation)->setDefaultStartValue(currentValue);
+ }
+
+ // Only change end value if it is undefined
+ if (!animation->endValue().isValid()) {
+ animation->setEndValue(prop.value);
+ localResetEndValues.append(animation);
+ }
+ handledAnimations.append(animation);
+ }
+ }
+ return qMakePair(handledAnimations, localResetEndValues);
+}
+
+static bool isAncestorOf(QObject *anc, QObject *o)
+{
+ for (o = o->parent() ; o != 0; o = o->parent()) {
+ if (o == anc)
+ return true;
+ }
+ return false;
+}
+
+void QStateMachinePrivate::_q_animationFinished()
+{
+ Q_Q(QStateMachine);
+ QAbstractAnimation *animation = qobject_cast<QAbstractAnimation*>(q->sender());
+ Q_ASSERT(animation != 0);
+ QList<QPair<QAbstractAnimation*, QPropertyAssignment> >::iterator it;
+ for (it = propertiesForAnimations.begin(); it != propertiesForAnimations.end(); ) {
+ QAbstractAnimation *a = (*it).first;
+ if (a == animation || isAncestorOf(animation, a)) {
+ QPropertyAssignment assn = (*it).second;
+ assn.object->setProperty(assn.propertyName, assn.value);
+ if (!assn.explicitlySet)
+ unregisterRestorable(assn.object, assn.propertyName);
+ it = propertiesForAnimations.erase(it);
+ } else {
+ ++it;
+ }
+ }
+
+ playingAnimations.removeOne(animation);
+ if (playingAnimations.isEmpty())
+ emit q->animationsFinished();
+}
+
+#endif // !QT_NO_ANIMATION
+
namespace {
class StartState : public QState
@@ -876,6 +1014,7 @@ void QStateMachinePrivate::_q_start()
transitions.append(initialTransition);
executeTransitionContent(transitions);
enterStates(transitions);
+ applyProperties(transitions, QList<QAbstractState*>() << initial);
delete start;
#ifdef QSTATEMACHINE_DEBUG
@@ -911,7 +1050,7 @@ void QStateMachinePrivate::_q_process()
if (enabledTransitions.isEmpty() && !internalEventQueue.isEmpty()) {
e = internalEventQueue.takeFirst();
#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": dequeued internal event" << e;
+ qDebug() << q << ": dequeued internal event" << e << "of type" << e->type();
#endif
enabledTransitions = selectTransitions(e);
if (enabledTransitions.isEmpty()) {
@@ -928,7 +1067,7 @@ void QStateMachinePrivate::_q_process()
} else {
e = externalEventQueue.takeFirst();
#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": dequeued external event" << e;
+ qDebug() << q << ": dequeued external event" << e << "of type" << e->type();
#endif
enabledTransitions = selectTransitions(e);
if (enabledTransitions.isEmpty()) {
@@ -1075,6 +1214,7 @@ void QStateMachinePrivate::unregisterSignalTransition(QSignalTransition *transit
int signalIndex = QSignalTransitionPrivate::get(transition)->signalIndex;
if (signalIndex == -1)
return; // not registered
+#ifndef QT_STATEMACHINE_SOLUTION
const QObject *sender = QSignalTransitionPrivate::get(transition)->sender;
QList<int> &connectedSignalIndexes = connections[sender];
Q_ASSERT(connectedSignalIndexes.contains(signalIndex));
@@ -1087,6 +1227,7 @@ void QStateMachinePrivate::unregisterSignalTransition(QSignalTransition *transit
connections.remove(sender);
QSignalTransitionPrivate::get(transition)->signalIndex = -1;
}
+#endif
}
#ifndef QT_NO_STATEMACHINE_EVENTFILTER
@@ -1174,6 +1315,24 @@ QStateMachine::QStateMachine(QObject *parent)
}
/*!
+ \internal
+*/
+QStateMachine::QStateMachine(QStateMachinePrivate &dd, QObject *parent)
+ : QObject(
+#ifndef QT_STATEMACHINE_SOLUTION
+ dd,
+#endif
+ parent)
+#ifdef QT_STATEMACHINE_SOLUTION
+ , d_ptr(&dd)
+#endif
+{
+#ifdef QT_STATEMACHINE_SOLUTION
+ d_ptr->q_ptr = this;
+#endif
+}
+
+/*!
Destroys this state machine.
*/
QStateMachine::~QStateMachine()
@@ -1332,13 +1491,13 @@ QActionState::RestorePolicy QStateMachine::globalRestorePolicy() const
/*!
Sets the global restore policy of the state machine to \a restorePolicy. The default global
- restore policy is QActionState::DoNotRestoreProperties.
+ restore policy is QAbstractState::DoNotRestoreProperties.
- The global restore policy cannot be set to QActionState::GlobalRestorePolicy.
+ The global restore policy cannot be set to QAbstractState::GlobalRestorePolicy.
- \sa QActionState::setRestorePolicy()
+ \sa QAbstractState::setRestorePolicy()
*/
-void QStateMachine::setGlobalRestorePolicy(QActionState::RestorePolicy restorePolicy)
+void QStateMachine::setGlobalRestorePolicy(QAbstractState::RestorePolicy restorePolicy)
{
Q_D(QStateMachine);
if (restorePolicy == QState::GlobalRestorePolicy) {
@@ -1564,6 +1723,18 @@ QSet<QAbstractState*> QStateMachine::configuration() const
\sa QStateMachine::stop()
*/
+#ifndef QT_NO_ANIMATION
+
+/*!
+ \fn QStateMachine::animationsFinished()
+
+ This signal is emitted when the state machine has finished playing all
+ animations associated with the latest transition (i.e., all properties have
+ reached their target values).
+*/
+
+#endif
+
/*!
\reimp
*/
@@ -1737,6 +1908,7 @@ QSignalEventGenerator::QSignalEventGenerator(
\brief The QSignalEvent class represents a Qt signal event.
+ \since 4.6
\ingroup statemachine
A signal event is generated by a QStateMachine in response to a Qt
@@ -1751,6 +1923,8 @@ QSignalEventGenerator::QSignalEventGenerator(
*/
/*!
+ \internal
+
Constructs a new QSignalEvent object with the given \a sender, \a
signalIndex and \a arguments.
*/
@@ -1800,6 +1974,7 @@ QSignalEvent::~QSignalEvent()
\brief The QStateFinishedEvent class contains parameters that describe a state that has finished.
+ \since 4.6
\ingroup statemachine
A state is finished when one of its final child states (a QFinalState) is
@@ -1814,6 +1989,8 @@ QSignalEvent::~QSignalEvent()
*/
/*!
+ \internal
+
Constructs a new QStateFinishedEvent object associated with the given \a state.
*/
QStateFinishedEvent::QStateFinishedEvent(QState *state)
@@ -1823,7 +2000,7 @@ QStateFinishedEvent::QStateFinishedEvent(QState *state)
#else
QEvent(QEvent::Type(QEvent::User-2))
#endif
- , m_state(state)
+ , m_state(state), d(0)
{
}
diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h
index e3b09e0..c7de171 100644
--- a/src/corelib/statemachine/qstatemachine.h
+++ b/src/corelib/statemachine/qstatemachine.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -66,8 +96,8 @@ public:
QString errorString() const;
void clearError();
- QActionState::RestorePolicy globalRestorePolicy() const;
- void setGlobalRestorePolicy(QActionState::RestorePolicy restorePolicy);
+ QAbstractState::RestorePolicy globalRestorePolicy() const;
+ void setGlobalRestorePolicy(QAbstractState::RestorePolicy restorePolicy);
void postEvent(QEvent *event, int delay = 0);
@@ -87,6 +117,10 @@ Q_SIGNALS:
void stopped();
void finished();
+#ifndef QT_NO_ANIMATION
+ void animationsFinished();
+#endif
+
protected:
void postInternalEvent(QEvent *event);
@@ -98,15 +132,20 @@ protected:
bool event(QEvent *e);
+protected:
#ifdef QT_STATEMACHINE_SOLUTION
QStateMachinePrivate *d_ptr;
#endif
+ QStateMachine(QStateMachinePrivate &dd, QObject *parent);
private:
Q_DISABLE_COPY(QStateMachine)
Q_DECLARE_PRIVATE(QStateMachine)
Q_PRIVATE_SLOT(d_func(), void _q_start())
Q_PRIVATE_SLOT(d_func(), void _q_process())
+#ifndef QT_NO_ANIMATION
+ Q_PRIVATE_SLOT(d_func(), void _q_animationFinished())
+#endif
};
QT_END_NAMESPACE
diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h
index dfa95e5..04dc71e 100644
--- a/src/corelib/statemachine/qstatemachine_p.h
+++ b/src/corelib/statemachine/qstatemachine_p.h
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -29,9 +59,10 @@
#include <QtCore/qcoreevent.h>
#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
+#include <QtCore/qpair.h>
#include <QtCore/qset.h>
-#include "qstate.h"
+#include "qabstractstate_p.h"
QT_BEGIN_NAMESPACE
@@ -46,7 +77,7 @@ class QAbstractTransition;
class QState;
#ifndef QT_NO_ANIMATION
-class QPropertyAnimation;
+class QAbstractAnimation;
#endif
class QStateMachine;
@@ -84,17 +115,23 @@ public:
// private slots
void _q_start();
void _q_process();
+#ifndef QT_NO_ANIMATION
+ void _q_animationFinished();
+#endif
void microstep(const QList<QAbstractTransition*> &transitionList);
bool isPreempted(const QAbstractState *s, const QSet<QAbstractTransition*> &transitions) const;
QSet<QAbstractTransition*> selectTransitions(QEvent *event) const;
- void exitStates(const QList<QAbstractTransition*> &transitionList);
+ QList<QAbstractState*> exitStates(const QList<QAbstractTransition*> &transitionList);
void executeTransitionContent(const QList<QAbstractTransition*> &transitionList);
- void enterStates(const QList<QAbstractTransition*> &enabledTransitions);
+ QList<QAbstractState*> enterStates(const QList<QAbstractTransition*> &enabledTransitions);
void addStatesToEnter(QAbstractState *s, QState *root,
QSet<QAbstractState*> &statesToEnter,
QSet<QAbstractState*> &statesForDefaultEntry);
+ void applyProperties(const QList<QAbstractTransition*> &transitionList,
+ const QList<QAbstractState*> &enteredStates);
+
bool isInFinalState(QAbstractState *s) const;
static bool isFinal(const QAbstractState *s);
static bool isParallel(const QAbstractState *s);
@@ -121,15 +158,7 @@ public:
void unregisterRestorable(QObject *object, const QByteArray &propertyName);
bool hasRestorable(QObject *object, const QByteArray &propertyName) const;
QVariant restorableValue(QObject *object, const QByteArray &propertyName) const;
-
-#ifndef QT_NO_ANIMATION
- void registerRestorable(QPropertyAnimation *animation);
-
- QPropertyAnimation *restorableAnimation(QObject *object, const QByteArray &propertyName);
- QList<QPropertyAnimation *> restorableAnimations() const;
-
- QHash<RestorableId, QPropertyAnimation*> registeredRestorableAnimations;
-#endif // QT_NO_ANIMATION
+ QList<QPropertyAssignment> restorablesToPropertyList(const QHash<RestorableId, QVariant> &restorables) const;
State state;
bool processing;
@@ -149,6 +178,16 @@ public:
QSet<QAbstractState *> pendingErrorStatesForDefaultEntry;
QAbstractState *initialErrorStateForRoot;
+#ifndef QT_NO_ANIMATION
+ QPair<QList<QAbstractAnimation*>, QList<QAbstractAnimation*> >
+ initializeAnimation(QAbstractAnimation *abstractAnimation,
+ const QPropertyAssignment &prop);
+
+ QList<QPair<QAbstractAnimation*, QPropertyAssignment> > propertiesForAnimations;
+ QList<QAbstractAnimation*> playingAnimations;
+ QList<QAbstractAnimation*> resetEndValues;
+#endif
+
#ifndef QT_STATEMACHINE_SOLUTION
QSignalEventGenerator *signalEventGenerator;
#endif
diff --git a/src/corelib/statemachine/qtransition.cpp b/src/corelib/statemachine/qtransition.cpp
deleted file mode 100644
index ebd972c..0000000
--- a/src/corelib/statemachine/qtransition.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the $MODULE$ of the Qt Toolkit.
-**
-** $TROLLTECH_DUAL_LICENSE$
-**
-****************************************************************************/
-
-#include "qtransition.h"
-#include "qtransition_p.h"
-#include "qstateaction.h"
-#include "qstateaction_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QTransition
-
- \brief The QTransition class provides an action-based transition.
-
- \ingroup statemachine
-
- QTransition provides an action-based transition; you add actions with the
- addAction() function. The transition executes the actions when the
- transition is triggered. QTransition is part of \l{The State Machine
- Framework}.
-
- Built-in actions are provided for setting properties and invoking methods of
- QObjects. The setPropertyOnTransition() function is used for defining
- property assignments that should be performed when a transition is taken.
- The invokeMethodOnTransition() function is used for defining method
- invocations that should be performed when a transition is taken.
-
- \code
- QStateMachine machine;
- QState *s1 = new QState();
- machine.addState(s1);
- QTransition *t1 = new QTransition();
- QLabel label;
- t1->setPropertyOnTransition(&label, "text", "Transition t1 was triggered");
- QState *s2 = new QState();
- machine.addState(s2);
- t1->setTargetState(s2);
- s1->addTransition(t1);
- \endcode
-
- Actions are executed in the order in which they were added.
-
- \sa QState::addTransition(), QStateAction
-*/
-
-QTransitionPrivate::QTransitionPrivate()
-{
-}
-
-QTransitionPrivate::~QTransitionPrivate()
-{
-}
-
-QTransitionPrivate *QTransitionPrivate::get(QTransition *q)
-{
- return q->d_func();
-}
-
-const QTransitionPrivate *QTransitionPrivate::get(const QTransition *q)
-{
- return q->d_func();
-}
-
-QList<QStateAction*> QTransitionPrivate::actions() const
-{
- QList<QStateAction*> result;
- QList<QObject*>::const_iterator it;
-#ifdef QT_STATEMACHINE_SOLUTION
- const QObjectList &children = q_func()->children();
-#endif
- for (it = children.constBegin(); it != children.constEnd(); ++it) {
- QStateAction *s = qobject_cast<QStateAction*>(*it);
- if (s)
- result.append(s);
- }
- return result;
-}
-
-/*!
- Constructs a new QTransition object with the given \a sourceState.
-*/
-QTransition::QTransition(QState *sourceState)
- : QAbstractTransition(*new QTransitionPrivate, sourceState)
-{
-}
-
-/*!
- Constructs a new QTransition object with the given \a targets and \a
- sourceState.
-*/
-QTransition::QTransition(const QList<QAbstractState*> &targets, QState *sourceState)
- : QAbstractTransition(*new QTransitionPrivate, targets, sourceState)
-{
-}
-
-/*!
- \internal
-*/
-QTransition::QTransition(QTransitionPrivate &dd, QState *parent)
- : QAbstractTransition(dd, parent)
-{
-}
-
-/*!
- \internal
-*/
-QTransition::QTransition(QTransitionPrivate &dd, const QList<QAbstractState*> &targets, QState *parent)
- : QAbstractTransition(dd, targets, parent)
-{
-}
-
-/*!
- Destroys this transition.
-*/
-QTransition::~QTransition()
-{
-}
-
-/*!
- Instructs this QTransition to set the property with the given \a name of the
- given \a object to the given \a value when the transition is taken. This
- function will create a QStateSetPropertyAction object and add it to the
- actions of the transition. If there is already an existing action associated
- with the property, the value of that action is updated.
-
- \sa invokeMethodOnTransition()
-*/
-void QTransition::setPropertyOnTransition(QObject *object, const char *name,
- const QVariant &value)
-{
- Q_D(QTransition);
- QList<QStateAction*> actions = d->actions();
- for (int i = 0; i < actions.size(); ++i) {
- QStateAction *action = actions.at(i);
- if (QStateSetPropertyAction *spa = qobject_cast<QStateSetPropertyAction*>(action)) {
- if (spa->targetObject() == object && spa->propertyName() == name) {
- QStateSetPropertyActionPrivate::get(spa)->value = value;
- return;
- }
- }
- }
- addAction(new QStateSetPropertyAction(object, name, value));
-}
-
-/*!
- Instructs this QTransition to invoke the given \a method of the given \a
- object with the given \a arguments when the transition is taken. This
- function will create a QStateInvokeMethodAction object and add it to the
- actions of the transition.
-
- \sa setPropertyOnTransition()
-*/
-void QTransition::invokeMethodOnTransition(QObject *object, const char *method,
- const QList<QVariant> &arguments)
-{
- addAction(new QStateInvokeMethodAction(object, method, arguments));
-}
-
-/*!
- Adds the given \a action to this transition.
- The action will be executed when the transition is triggered.
- The transition takes ownership of the action.
-
- \sa removeAction()
-*/
-void QTransition::addAction(QStateAction *action)
-{
- if (!action) {
- qWarning("QTransition::addAction: cannot add null action");
- return;
- }
- action->setParent(this);
-}
-
-/*!
- Removes the given \a action from this transition.
- The transition releases ownership of the action.
-
- \sa addAction()
-*/
-void QTransition::removeAction(QStateAction *action)
-{
- if (!action) {
- qWarning("QTransition::removeAction: cannot remove null action");
- return;
- }
- action->setParent(0);
-}
-
-/*!
- Returns this transitions's actions, or an empty list if the transition has
- no actions.
-
- \sa addAction()
-*/
-QList<QStateAction*> QTransition::actions() const
-{
- Q_D(const QTransition);
- return d->actions();
-}
-
-/*!
- \reimp
-*/
-void QTransition::onTransition()
-{
- Q_D(QTransition);
- QList<QStateAction*> actions = d->actions();
- for (int i = 0; i < actions.size(); ++i)
- QStateActionPrivate::get(actions.at(i))->callExecute();
-}
-
-/*!
- \reimp
-*/
-bool QTransition::event(QEvent *e)
-{
- return QAbstractTransition::event(e);
-}
-
-QT_END_NAMESPACE
diff --git a/src/corelib/statemachine/qtransition.h b/src/corelib/statemachine/qtransition.h
deleted file mode 100644
index 57d9718..0000000
--- a/src/corelib/statemachine/qtransition.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the $MODULE$ of the Qt Toolkit.
-**
-** $TROLLTECH_DUAL_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTRANSITION_H
-#define QTRANSITION_H
-
-#ifndef QT_STATEMACHINE_SOLUTION
-#include <QtCore/qabstracttransition.h>
-#else
-#include "qabstracttransition.h"
-#endif
-
-#include <QtCore/qvariant.h>
-#include <QtCore/qlist.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Core)
-
-class QStateAction;
-
-class QTransitionPrivate;
-class Q_CORE_EXPORT QTransition : public QAbstractTransition
-{
- Q_OBJECT
-public:
- QTransition(QState *sourceState = 0);
- QTransition(const QList<QAbstractState*> &targets, QState *sourceState = 0);
- ~QTransition();
-
- void setPropertyOnTransition(QObject *object, const char *name,
- const QVariant &value);
- void invokeMethodOnTransition(QObject *object, const char *method,
- const QList<QVariant> &args = QList<QVariant>());
-
- void addAction(QStateAction *action);
- void removeAction(QStateAction *action);
- QList<QStateAction*> actions() const;
-
-protected:
- virtual void onTransition();
-
- bool event(QEvent *e);
-
-protected:
- QTransition(QTransitionPrivate &dd, QState *parent);
- QTransition(QTransitionPrivate &dd, const QList<QAbstractState*> &targets, QState *parent);
-
-private:
- Q_DISABLE_COPY(QTransition)
- Q_DECLARE_PRIVATE(QTransition)
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/corelib/statemachine/qtransition_p.h b/src/corelib/statemachine/qtransition_p.h
deleted file mode 100644
index e5da6de..0000000
--- a/src/corelib/statemachine/qtransition_p.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the $MODULE$ of the Qt Toolkit.
-**
-** $TROLLTECH_DUAL_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTRANSITION_P_H
-#define QTRANSITION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qabstracttransition_p.h"
-
-#include <QtCore/qlist.h>
-
-QT_BEGIN_NAMESPACE
-
-class QStateAction;
-
-class QTransition;
-class Q_CORE_EXPORT QTransitionPrivate : public QAbstractTransitionPrivate
-{
- Q_DECLARE_PUBLIC(QTransition)
-public:
- QTransitionPrivate();
- ~QTransitionPrivate();
-
- static QTransitionPrivate *get(QTransition *q);
- static const QTransitionPrivate *get(const QTransition *q);
-
- QList<QStateAction*> actions() const;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/statemachine/statemachine.pri b/src/corelib/statemachine/statemachine.pri
index 8409b4d..4179e45 100644
--- a/src/corelib/statemachine/statemachine.pri
+++ b/src/corelib/statemachine/statemachine.pri
@@ -14,8 +14,8 @@ HEADERS += $$PWD/qstatemachine.h \
$$PWD/qhistorystate_p.h \
$$PWD/qabstracttransition.h \
$$PWD/qabstracttransition_p.h \
- $$PWD/qtransition.h \
- $$PWD/qtransition_p.h \
+ $$PWD/qactiontransition.h \
+ $$PWD/qactiontransition_p.h \
$$PWD/qstatefinishedevent.h \
$$PWD/qstatefinishedtransition.h \
$$PWD/qsignalevent.h \
@@ -30,7 +30,7 @@ SOURCES += $$PWD/qstatemachine.cpp \
$$PWD/qfinalstate.cpp \
$$PWD/qhistorystate.cpp \
$$PWD/qabstracttransition.cpp \
- $$PWD/qtransition.cpp \
+ $$PWD/qactiontransition.cpp \
$$PWD/qstatefinishedtransition.cpp \
$$PWD/qsignaltransition.cpp
@@ -40,8 +40,3 @@ HEADERS += $$PWD/qboundevent_p.h \
$$PWD/qeventtransition_p.h
SOURCES += $$PWD/qeventtransition.cpp
}
-
-!contains(DEFINES, QT_NO_ANIMATION) {
-HEADERS += $$PWD/qanimationstate.h
-SOURCES += $$PWD/qanimationstate.cpp
-}