Qt 4.8
|
The QDeclarativeTimeLine class provides a timeline for controlling animations. More...
#include <qdeclarativetimeline_p_p.h>
Public Types | |
enum | SyncMode { LocalSync, GlobalSync } |
Public Types inherited from QAbstractAnimation | |
enum | DeletionPolicy { KeepWhenStopped = 0, DeleteWhenStopped } |
enum | Direction { Forward, Backward } |
This enum describes the direction of the animation when in Running state. More... | |
enum | State { Stopped, Paused, Running } |
This enum describes the state of the animation. More... | |
Signals | |
void | completed () |
void | updated () |
Emitted each time the timeline modifies QDeclarativeTimeLineValues. More... | |
Signals inherited from QAbstractAnimation | |
void | currentLoopChanged (int currentLoop) |
QAbstractAnimation emits this signal whenever the current loop changes. More... | |
void | directionChanged (QAbstractAnimation::Direction) |
QAbstractAnimation emits this signal whenever the direction has been changed. More... | |
void | finished () |
QAbstractAnimation emits this signal after the animation has stopped and has reached the end. More... | |
void | stateChanged (QAbstractAnimation::State newState, QAbstractAnimation::State oldState) |
QAbstractAnimation emits this signal whenever the state of the animation has changed from oldState to newState. More... | |
Signals inherited from QObject | |
void | destroyed (QObject *=0) |
This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More... | |
Public Functions | |
int | accel (QDeclarativeTimeLineValue &, qreal velocity, qreal accel) |
Decelerate timeLineValue from the starting velocity to zero at the given acceleration rate. More... | |
int | accel (QDeclarativeTimeLineValue &, qreal velocity, qreal accel, qreal maxDistance) |
Decelerate timeLineValue from the starting velocity to zero at the given acceleration rate over a maximum distance of maxDistance. More... | |
int | accelDistance (QDeclarativeTimeLineValue &, qreal velocity, qreal distance) |
Decelerate timeLineValue from the starting velocity to zero over the given distance. More... | |
void | callback (const QDeclarativeTimeLineCallback &) |
Execute the event. More... | |
void | clear () |
Resets the timeline. More... | |
void | complete () |
Completes the timeline. More... | |
virtual int | duration () const |
bool | isActive () const |
Returns true if the timeline is active. More... | |
void | move (QDeclarativeTimeLineValue &, qreal destination, int time=500) |
Linearly change the timeLineValue from its current value to the given destination value over time milliseconds. More... | |
void | move (QDeclarativeTimeLineValue &, qreal destination, const QEasingCurve &, int time=500) |
Change the timeLineValue from its current value to the given destination value over time milliseconds using the easing curve. More... | |
void | moveBy (QDeclarativeTimeLineValue &, qreal change, int time=500) |
Linearly change the timeLineValue from its current value by the change amount over time milliseconds. More... | |
void | moveBy (QDeclarativeTimeLineValue &, qreal change, const QEasingCurve &, int time=500) |
Change the timeLineValue from its current value by the change amount over time milliseconds using the easing curve. More... | |
void | pause (QDeclarativeTimeLineObject &, int) |
Pause obj for time milliseconds. More... | |
QDeclarativeTimeLine (QObject *parent=0) | |
Construct a new QDeclarativeTimeLine with the specified parent. More... | |
void | reset (QDeclarativeTimeLineValue &) |
Cancel (but don't complete) all scheduled actions for timeLineValue. More... | |
void | set (QDeclarativeTimeLineValue &, qreal) |
Set the value of timeLineValue. More... | |
void | setSyncMode (SyncMode) |
Set the timeline's synchronization mode to syncMode. More... | |
void | setSyncPoint (int) |
Temporary hack. More... | |
void | sync () |
void | sync (QDeclarativeTimeLineValue &) |
Synchronize the end point of timeLineValue to the endpoint of the longest action cursrently scheduled in the timeline. More... | |
void | sync (QDeclarativeTimeLineValue &, QDeclarativeTimeLineValue &) |
Synchronize the end point of timeLineValue to the endpoint of syncTo within this timeline. More... | |
SyncMode | syncMode () const |
Return the timeline's synchronization mode. More... | |
int | syncPoint () const |
Temporary hack. More... | |
int | time () const |
~QDeclarativeTimeLine () | |
Destroys the time line. More... | |
Public Functions inherited from QAbstractAnimation | |
int | currentLoop () const |
int | currentLoopTime () const |
Returns the current time inside the current loop. More... | |
int | currentTime () const |
Direction | direction () const |
QAnimationGroup * | group () const |
If this animation is part of a QAnimationGroup, this function returns a pointer to the group; otherwise, it returns 0. More... | |
int | loopCount () const |
QAbstractAnimation (QObject *parent=0) | |
Constructs the QAbstractAnimation base class, and passes parent to QObject's constructor. More... | |
void | setDirection (Direction direction) |
void | setLoopCount (int loopCount) |
State | state () const |
int | totalDuration () const |
Returns the total and effective duration of the animation, including the loop count. More... | |
virtual | ~QAbstractAnimation () |
Stops the animation if it's running, then destroys the QAbstractAnimation. More... | |
Public Functions inherited from QObject | |
bool | blockSignals (bool b) |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More... | |
const QObjectList & | children () const |
Returns a list of child objects. More... | |
bool | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0) |
bool | disconnect (const QObject *receiver, const char *member=0) |
void | dumpObjectInfo () |
Dumps information about signal connections, etc. More... | |
void | dumpObjectTree () |
Dumps a tree of children to the debug output. More... | |
QList< QByteArray > | dynamicPropertyNames () const |
Returns the names of all properties that were dynamically added to the object using setProperty(). More... | |
virtual bool | eventFilter (QObject *, QEvent *) |
Filters events if this object has been installed as an event filter for the watched object. More... | |
template<typename T > | |
T | findChild (const QString &aName=QString()) const |
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More... | |
template<typename T > | |
QList< T > | findChildren (const QString &aName=QString()) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More... | |
template<typename T > | |
QList< T > | findChildren (const QRegExp &re) const |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More... | |
void | installEventFilter (QObject *) |
Installs an event filter filterObj on this object. More... | |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false. More... | |
void | killTimer (int id) |
Kills the timer with timer identifier, id. More... | |
virtual const QMetaObject * | metaObject () const |
Returns a pointer to the meta-object of this object. More... | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. More... | |
QString | objectName () const |
QObject * | parent () const |
Returns a pointer to the parent object. More... | |
QVariant | property (const char *name) const |
Returns the value of the object's name property. More... | |
Q_INVOKABLE | QObject (QObject *parent=0) |
Constructs an object with parent object parent. More... | |
void | removeEventFilter (QObject *) |
Removes an event filter object obj from this object. More... | |
void | setObjectName (const QString &name) |
void | setParent (QObject *) |
Makes the object a child of parent. More... | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. More... | |
void | setUserData (uint id, QObjectUserData *data) |
bool | signalsBlocked () const |
Returns true if signals are blocked; otherwise returns false. More... | |
int | startTimer (int interval) |
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More... | |
QThread * | thread () const |
Returns the thread in which the object lives. More... | |
QObjectUserData * | userData (uint id) const |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. More... | |
Protected Functions | |
virtual void | updateCurrentTime (int) |
This pure virtual function is called every time the animation's currentTime changes. More... | |
Protected Functions inherited from QAbstractAnimation | |
bool | event (QEvent *event) |
Reimplemented Function More... | |
QAbstractAnimation (QAbstractAnimationPrivate &dd, QObject *parent=0) | |
virtual void | updateDirection (QAbstractAnimation::Direction direction) |
This virtual function is called by QAbstractAnimation when the direction of the animation is changed. More... | |
virtual void | updateState (QAbstractAnimation::State newState, QAbstractAnimation::State oldState) |
This virtual function is called by QAbstractAnimation when the state of the animation is changed from oldState to newState. More... | |
Protected Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *) |
This event handler can be reimplemented in a subclass to receive child events. More... | |
virtual void | connectNotify (const char *signal) |
This virtual function is called when something has been connected to signal in this object. More... | |
virtual void | customEvent (QEvent *) |
This event handler can be reimplemented in a subclass to receive custom events. More... | |
virtual void | disconnectNotify (const char *signal) |
This virtual function is called when something has been disconnected from signal in this object. More... | |
QObject (QObjectPrivate &dd, QObject *parent=0) | |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. More... | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More... | |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *) |
This event handler can be reimplemented in a subclass to receive timer events for the object. More... | |
Private Functions | |
void | remove (QDeclarativeTimeLineObject *) |
Properties | |
QDeclarativeTimeLinePrivate * | d |
Friends | |
class | QDeclarativeTimeLineObject |
struct | QDeclarativeTimeLinePrivate |
Additional Inherited Members | |
Public Slots inherited from QAbstractAnimation | |
void | pause () |
Pauses the animation. More... | |
void | resume () |
Resumes the animation after it was paused. More... | |
void | setCurrentTime (int msecs) |
void | setPaused (bool) |
If paused is true, the animation is paused. More... | |
void | start (QAbstractAnimation::DeletionPolicy policy=KeepWhenStopped) |
Starts the animation. More... | |
void | stop () |
Stops the animation. More... | |
Public Slots inherited from QObject | |
void | deleteLater () |
Schedules this object for deletion. More... | |
Static Public Functions inherited from QObject | |
static bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More... | |
static bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
Disconnects signal in object sender from method in object receiver. More... | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static uint | registerUserData () |
static QString | tr (const char *sourceText, const char *comment=0, int n=-1) |
static QString | trUtf8 (const char *sourceText, const char *comment=0, int n=-1) |
Static Public Variables inherited from QObject | |
static const QMetaObject | staticMetaObject |
This variable stores the meta-object for the class. More... | |
Protected Variables inherited from QObject | |
QScopedPointer< QObjectData > | d_ptr |
Static Protected Variables inherited from QObject | |
static const QMetaObject | staticQtMetaObject |
Related Functions inherited from QObject | |
T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QRegExp ®Exp)() |
T * | qobject_cast (QObject *object) |
QObjectList | |
void * | qt_find_obj_child (QObject *parent, const char *type, const QString &name) |
Returns a pointer to the object named name that inherits type and with a given parent. More... | |
The QDeclarativeTimeLine class provides a timeline for controlling animations.
QDeclarativeTimeLine is similar to QTimeLine except:
It updates QDeclarativeTimeLineValue instances directly, rather than maintaining a single current value.
For example, the following animates a simple value over 200 milliseconds:
If your program needs to know when values are changed, it can either connect to the QDeclarativeTimeLine's updated() signal, or inherit from QDeclarativeTimeLineValue and reimplement the QDeclarativeTimeLineValue::setValue() method.
Supports multiple QDeclarativeTimeLineValue, arbitrary start and end values and allows animations to be strung together for more complex effects.
For example, the following animation moves the x and y coordinates of an object from wherever they are to the position (100, 100) in 50 milliseconds and then further animates them to (100, 200) in 50 milliseconds:
All QDeclarativeTimeLine instances share a single, synchronized clock.
Actions scheduled within the same event loop tick are scheduled synchronously against each other, regardless of the wall time between the scheduling. Synchronized scheduling applies both to within the same QDeclarativeTimeLine and across separate QDeclarativeTimeLine's within the same process.
Currently easing functions are not supported.
Definition at line 66 of file qdeclarativetimeline_p_p.h.
QDeclarativeTimeLine::QDeclarativeTimeLine | ( | QObject * | parent = 0 | ) |
Construct a new QDeclarativeTimeLine with the specified parent.
Definition at line 316 of file qdeclarativetimeline.cpp.
QDeclarativeTimeLine::~QDeclarativeTimeLine | ( | ) |
Destroys the time line.
Any inprogress animations are canceled, but not completed.
Definition at line 326 of file qdeclarativetimeline.cpp.
int QDeclarativeTimeLine::accel | ( | QDeclarativeTimeLineValue & | timeLineValue, |
qreal | velocity, | ||
qreal | acceleration | ||
) |
Decelerate timeLineValue from the starting velocity to zero at the given acceleration rate.
Although the acceleration is technically a deceleration, it should always be positive. The QDeclarativeTimeLine will ensure that the deceleration is in the opposite direction to the initial velocity.
Definition at line 390 of file qdeclarativetimeline.cpp.
Referenced by QDeclarativeFlickablePrivate::flick().
int QDeclarativeTimeLine::accel | ( | QDeclarativeTimeLineValue & | timeLineValue, |
qreal | velocity, | ||
qreal | acceleration, | ||
qreal | maxDistance | ||
) |
Decelerate timeLineValue from the starting velocity to zero at the given acceleration rate over a maximum distance of maxDistance.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
If necessary, QDeclarativeTimeLine will reduce the acceleration to ensure that the entire operation does not require a move of more than maxDistance. maxDistance should always be positive.
Definition at line 419 of file qdeclarativetimeline.cpp.
int QDeclarativeTimeLine::accelDistance | ( | QDeclarativeTimeLineValue & | timeLineValue, |
qreal | velocity, | ||
qreal | distance | ||
) |
Decelerate timeLineValue from the starting velocity to zero over the given distance.
This is like accel(), but the QDeclarativeTimeLine calculates the exact deceleration to use.
distance should be positive.
Definition at line 448 of file qdeclarativetimeline.cpp.
void QDeclarativeTimeLine::callback | ( | const QDeclarativeTimeLineCallback & | callback | ) |
Execute the event.
Definition at line 369 of file qdeclarativetimeline.cpp.
Referenced by QDeclarativeFlickablePrivate::flick().
void QDeclarativeTimeLine::clear | ( | ) |
Resets the timeline.
All queued actions are discarded and QDeclarativeTimeLineValue's retain their current value. For example,
Definition at line 674 of file qdeclarativetimeline.cpp.
void QDeclarativeTimeLine::complete | ( | ) |
Completes the timeline.
All queued actions are played to completion, and then discarded. For example,
Definition at line 657 of file qdeclarativetimeline.cpp.
|
signal |
Referenced by updateCurrentTime().
|
virtual |
Implements QAbstractAnimation.
Definition at line 522 of file qdeclarativetimeline.cpp.
bool QDeclarativeTimeLine::isActive | ( | ) | const |
Returns true if the timeline is active.
An active timeline is one where QDeclarativeTimeLineValue actions are still pending.
Definition at line 640 of file qdeclarativetimeline.cpp.
void QDeclarativeTimeLine::move | ( | QDeclarativeTimeLineValue & | timeLineValue, |
qreal | destination, | ||
int | time = 500 |
||
) |
Linearly change the timeLineValue from its current value to the given destination value over time milliseconds.
Definition at line 467 of file qdeclarativetimeline.cpp.
Referenced by QDeclarativeFlickablePrivate::fixup().
void QDeclarativeTimeLine::move | ( | QDeclarativeTimeLineValue & | timeLineValue, |
qreal | destination, | ||
const QEasingCurve & | easing, | ||
int | time = 500 |
||
) |
Change the timeLineValue from its current value to the given destination value over time milliseconds using the easing curve.
Definition at line 478 of file qdeclarativetimeline.cpp.
void QDeclarativeTimeLine::moveBy | ( | QDeclarativeTimeLineValue & | timeLineValue, |
qreal | change, | ||
int | time = 500 |
||
) |
Linearly change the timeLineValue from its current value by the change amount over time milliseconds.
Definition at line 489 of file qdeclarativetimeline.cpp.
void QDeclarativeTimeLine::moveBy | ( | QDeclarativeTimeLineValue & | timeLineValue, |
qreal | change, | ||
const QEasingCurve & | easing, | ||
int | time = 500 |
||
) |
Change the timeLineValue from its current value by the change amount over time milliseconds using the easing curve.
Definition at line 500 of file qdeclarativetimeline.cpp.
void QDeclarativeTimeLine::pause | ( | QDeclarativeTimeLineObject & | obj, |
int | time | ||
) |
Pause obj for time milliseconds.
Definition at line 359 of file qdeclarativetimeline.cpp.
Referenced by QDeclarativeTimeLinePrivate::add().
|
private |
GfxClock::isActive()
Definition at line 841 of file qdeclarativetimeline.cpp.
Referenced by QDeclarativeTimeLineObject::~QDeclarativeTimeLineObject().
void QDeclarativeTimeLine::reset | ( | QDeclarativeTimeLineValue & | timeLineValue | ) |
Cancel (but don't complete) all scheduled actions for timeLineValue.
Definition at line 510 of file qdeclarativetimeline.cpp.
Referenced by QDeclarativeFlickablePrivate::fixup(), and QDeclarativeFlickablePrivate::flick().
void QDeclarativeTimeLine::set | ( | QDeclarativeTimeLineValue & | timeLineValue, |
qreal | value | ||
) |
Set the value of timeLineValue.
Definition at line 378 of file qdeclarativetimeline.cpp.
Referenced by QDeclarativeFlickablePrivate::fixup().
void QDeclarativeTimeLine::setSyncMode | ( | SyncMode | syncMode | ) |
Set the timeline's synchronization mode to syncMode.
Definition at line 351 of file qdeclarativetimeline.cpp.
void QDeclarativeTimeLine::setSyncPoint | ( | int | sp | ) |
Temporary hack.
Definition at line 618 of file qdeclarativetimeline.cpp.
void QDeclarativeTimeLine::sync | ( | ) |
void QDeclarativeTimeLine::sync | ( | QDeclarativeTimeLineValue & | timeLineValue | ) |
Synchronize the end point of timeLineValue to the endpoint of the longest action cursrently scheduled in the timeline.
In pseudo-code, this is equivalent to:
Definition at line 563 of file qdeclarativetimeline.cpp.
void QDeclarativeTimeLine::sync | ( | QDeclarativeTimeLineValue & | timeLineValue, |
QDeclarativeTimeLineValue & | syncTo | ||
) |
Synchronize the end point of timeLineValue to the endpoint of syncTo within this timeline.
Following operations on timeLineValue in this timeline will be scheduled after all the currently scheduled actions on syncTo are complete. In pseudo-code this is equivalent to:
Definition at line 538 of file qdeclarativetimeline.cpp.
QDeclarativeTimeLine::SyncMode QDeclarativeTimeLine::syncMode | ( | ) | const |
Return the timeline's synchronization mode.
Definition at line 343 of file qdeclarativetimeline.cpp.
Referenced by setSyncMode().
int QDeclarativeTimeLine::syncPoint | ( | ) | const |
Temporary hack.
Definition at line 631 of file qdeclarativetimeline.cpp.
Referenced by QDeclarativeTimeLinePrivate::advance().
int QDeclarativeTimeLine::time | ( | ) | const |
Definition at line 684 of file qdeclarativetimeline.cpp.
Referenced by accel(), accelDistance(), and QDeclarativeFlickablePrivate::fixup().
|
protectedvirtual |
This pure virtual function is called every time the animation's currentTime changes.
GfxClock::isActive()
Implements QAbstractAnimation.
Definition at line 699 of file qdeclarativetimeline.cpp.
|
signal |
Emitted each time the timeline modifies QDeclarativeTimeLineValues.
Even if multiple QDeclarativeTimeLineValues are changed, this signal is only emitted once for each clock tick.
Referenced by updateCurrentTime().
|
friend |
Definition at line 115 of file qdeclarativetimeline_p_p.h.
|
friend |
Definition at line 116 of file qdeclarativetimeline_p_p.h.
Referenced by QDeclarativeTimeLine().
|
private |
Definition at line 117 of file qdeclarativetimeline_p_p.h.
Referenced by accel(), accelDistance(), callback(), clear(), complete(), isActive(), move(), moveBy(), pause(), QDeclarativeTimeLine(), remove(), set(), setSyncMode(), setSyncPoint(), sync(), syncMode(), syncPoint(), time(), updateCurrentTime(), and ~QDeclarativeTimeLine().