Qt 4.8
Public Types | Signals | Public Functions | Protected Functions | Private Functions | Properties | Friends | List of all members
QDeclarativeTimeLine Class Reference

The QDeclarativeTimeLine class provides a timeline for controlling animations. More...

#include <qdeclarativetimeline_p_p.h>

Inheritance diagram for QDeclarativeTimeLine:
QAbstractAnimation QObject

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
 
QAnimationGroupgroup () 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 QObjectListchildren () 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< QByteArraydynamicPropertyNames () 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 >
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 QMetaObjectmetaObject () 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
 
QObjectparent () 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...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (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...
 
QObjectsender () 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

QDeclarativeTimeLinePrivated
 

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< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

The QDeclarativeTimeLine class provides a timeline for controlling animations.

Warning
This function is not part of the public interface.

QDeclarativeTimeLine is similar to QTimeLine except:

Currently easing functions are not supported.

Definition at line 66 of file qdeclarativetimeline_p_p.h.

Enumerations

◆ SyncMode

Constructors and Destructors

◆ QDeclarativeTimeLine()

QDeclarativeTimeLine::QDeclarativeTimeLine ( QObject parent = 0)

Construct a new QDeclarativeTimeLine with the specified parent.

Definition at line 316 of file qdeclarativetimeline.cpp.

317 : QAbstractAnimation(parent)
318 {
319  d = new QDeclarativeTimeLinePrivate(this);
320 }
friend struct QDeclarativeTimeLinePrivate
QAbstractAnimation(QObject *parent=0)
Constructs the QAbstractAnimation base class, and passes parent to QObject&#39;s constructor.
QDeclarativeTimeLinePrivate * d

◆ ~QDeclarativeTimeLine()

QDeclarativeTimeLine::~QDeclarativeTimeLine ( )

Destroys the time line.

Any inprogress animations are canceled, but not completed.

Definition at line 326 of file qdeclarativetimeline.cpp.

327 {
329  iter != d->ops.end();
330  ++iter)
331  iter.key()->_t = 0;
332 
333  delete d; d = 0;
334 }
QDeclarativeTimeLinePrivate * d
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
iterator begin()
Returns an STL-style iterator pointing to the first item in the hash.
Definition: qhash.h:464
iterator Iterator
Qt-style synonym for QHash::iterator.
Definition: qhash.h:473

Functions

◆ accel() [1/2]

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().

391 {
392  if (acceleration == 0.0f)
393  return -1;
394 
395  if ((velocity > 0.0f) == (acceleration > 0.0f))
396  acceleration = acceleration * -1.0f;
397 
398  int time = static_cast<int>(-1000 * velocity / acceleration);
399 
401  d->add(timeLineValue, op);
402 
403  return time;
404 }
QDeclarativeTimeLinePrivate * d
void add(QDeclarativeTimeLineObject &, const Op &)

◆ accel() [2/2]

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.

420 {
421  if (maxDistance == 0.0f || acceleration == 0.0f)
422  return -1;
423 
424  Q_ASSERT(acceleration > 0.0f && maxDistance > 0.0f);
425 
426  qreal maxAccel = (velocity * velocity) / (2.0f * maxDistance);
427  if (maxAccel > acceleration)
428  acceleration = maxAccel;
429 
430  if ((velocity > 0.0f) == (acceleration > 0.0f))
431  acceleration = acceleration * -1.0f;
432 
433  int time = static_cast<int>(-1000 * velocity / acceleration);
434 
436  d->add(timeLineValue, op);
437 
438  return time;
439 }
double qreal
Definition: qglobal.h:1193
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QDeclarativeTimeLinePrivate * d
void add(QDeclarativeTimeLineObject &, const Op &)

◆ accelDistance()

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.

449 {
450  if (distance == 0.0f || velocity == 0.0f)
451  return -1;
452 
453  Q_ASSERT((distance >= 0.0f) == (velocity >= 0.0f));
454 
455  int time = static_cast<int>(1000 * (2.0f * distance) / velocity);
456 
458  d->add(timeLineValue, op);
459 
460  return time;
461 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static int distance(QWidget *source, QWidget *target, QAccessible::RelationFlag relation)
QDeclarativeTimeLinePrivate * d
void add(QDeclarativeTimeLineObject &, const Op &)

◆ callback()

void QDeclarativeTimeLine::callback ( const QDeclarativeTimeLineCallback callback)

Execute the event.

Definition at line 369 of file qdeclarativetimeline.cpp.

Referenced by QDeclarativeFlickablePrivate::flick().

◆ clear()

void QDeclarativeTimeLine::clear ( )

Resets the timeline.

All queued actions are discarded and QDeclarativeTimeLineValue's retain their current value. For example,

tl.move(v, 100., 1000.);
// 500 ms passes
// v.value() == 50.
tl.clear();
// v.value() == 50.

Definition at line 674 of file qdeclarativetimeline.cpp.

675 {
676  for (QDeclarativeTimeLinePrivate::Ops::ConstIterator iter = d->ops.begin(); iter != d->ops.end(); ++iter)
677  iter.key()->_t = 0;
678  d->ops.clear();
679  d->length = 0;
680  d->syncPoint = 0;
681  //XXX need stop here?
682 }
void clear()
Removes all items from the hash.
Definition: qhash.h:574
const_iterator ConstIterator
Qt-style synonym for QHash::const_iterator.
Definition: qhash.h:474
QDeclarativeTimeLinePrivate * d
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
iterator begin()
Returns an STL-style iterator pointing to the first item in the hash.
Definition: qhash.h:464

◆ complete()

void QDeclarativeTimeLine::complete ( )

Completes the timeline.

All queued actions are played to completion, and then discarded. For example,

tl.move(v, 100., 1000.);
// 500 ms passes
// v.value() == 50.
tl.complete();
// v.value() == 100.

Definition at line 657 of file qdeclarativetimeline.cpp.

◆ completed

void QDeclarativeTimeLine::completed ( )
signal

Referenced by updateCurrentTime().

◆ duration()

int QDeclarativeTimeLine::duration ( ) const
virtual

Implements QAbstractAnimation.

Definition at line 522 of file qdeclarativetimeline.cpp.

523 {
524  return -1;
525 }

◆ isActive()

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.

641 {
642  return !d->ops.isEmpty();
643 }
bool isEmpty() const
Returns true if the hash contains no items; otherwise returns false.
Definition: qhash.h:297
QDeclarativeTimeLinePrivate * d

◆ move() [1/2]

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().

468 {
469  if (time <= 0) return;
471  d->add(timeLineValue, op);
472 }
QDeclarativeTimeLinePrivate * d
void add(QDeclarativeTimeLineObject &, const Op &)

◆ move() [2/2]

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.

◆ moveBy() [1/2]

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.

◆ moveBy() [2/2]

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.

◆ pause()

void QDeclarativeTimeLine::pause ( QDeclarativeTimeLineObject obj,
int  time 
)

Pause obj for time milliseconds.

Definition at line 359 of file qdeclarativetimeline.cpp.

Referenced by QDeclarativeTimeLinePrivate::add().

◆ remove()

void QDeclarativeTimeLine::remove ( QDeclarativeTimeLineObject v)
private

GfxClock::isActive()

Definition at line 841 of file qdeclarativetimeline.cpp.

Referenced by QDeclarativeTimeLineObject::~QDeclarativeTimeLineObject().

842 {
844  Q_ASSERT(iter != d->ops.end());
845 
846  int len = iter->length;
847  d->ops.erase(iter);
848  if (len == d->length) {
849  // We need to recalculate the length
850  d->length = 0;
852  iter != d->ops.end();
853  ++iter) {
854 
855  if (iter->length > d->length)
856  d->length = iter->length;
857 
858  }
859  }
860  if (d->ops.isEmpty()) {
861  stop();
862  d->clockRunning = false;
863  } else if ( state() != Running) {
864  stop();
865  d->prevTime = 0;
866  d->clockRunning = true;
867 
869  d->syncAdj = -1;
870  } else {
871  d->syncAdj = 0;
872  }
873  start();
874  }
875 
876  if (d->updateQueue) {
877  for (int ii = 0; ii < d->updateQueue->count(); ++ii) {
878  if (d->updateQueue->at(ii).second.g == v ||
879  d->updateQueue->at(ii).second.e.callbackObject() == v) {
880  d->updateQueue->removeAt(ii);
881  --ii;
882  }
883  }
884  }
885 
886 
887 }
QDeclarativeTimeLine::SyncMode syncMode
State state() const
void start(QAbstractAnimation::DeletionPolicy policy=KeepWhenStopped)
Starts the animation.
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void stop()
Stops the animation.
QList< QPair< int, Update > > * updateQueue
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
bool isEmpty() const
Returns true if the hash contains no items; otherwise returns false.
Definition: qhash.h:297
QDeclarativeTimeLinePrivate * d
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
iterator begin()
Returns an STL-style iterator pointing to the first item in the hash.
Definition: qhash.h:464
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
Definition: qhash.h:865
iterator erase(iterator it)
Removes the (key, value) pair associated with the iterator pos from the hash, and returns an iterator...
Definition: qhash.h:827
iterator Iterator
Qt-style synonym for QHash::iterator.
Definition: qhash.h:473
void removeAt(int i)
Removes the item at index position i.
Definition: qlist.h:480

◆ reset()

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().

511 {
512  if (!timeLineValue._t)
513  return;
514  if (timeLineValue._t != this) {
515  qWarning() << "QDeclarativeTimeLine: Cannot reset a QDeclarativeTimeLineValue owned by another timeline.";
516  return;
517  }
518  remove(&timeLineValue);
519  timeLineValue._t = 0;
520 }
Q_CORE_EXPORT void qWarning(const char *,...)

◆ set()

void QDeclarativeTimeLine::set ( QDeclarativeTimeLineValue timeLineValue,
qreal  value 
)

Set the value of timeLineValue.

Definition at line 378 of file qdeclarativetimeline.cpp.

Referenced by QDeclarativeFlickablePrivate::fixup().

◆ setSyncMode()

void QDeclarativeTimeLine::setSyncMode ( SyncMode  syncMode)

Set the timeline's synchronization mode to syncMode.

Definition at line 351 of file qdeclarativetimeline.cpp.

352 {
353  d->syncMode = syncMode;
354 }
QDeclarativeTimeLine::SyncMode syncMode
SyncMode syncMode() const
Return the timeline&#39;s synchronization mode.
QDeclarativeTimeLinePrivate * d

◆ setSyncPoint()

void QDeclarativeTimeLine::setSyncPoint ( int  sp)

Temporary hack.

Warning
This function is not part of the public interface.

Definition at line 618 of file qdeclarativetimeline.cpp.

619 {
620  d->syncPoint = sp;
621 }
QDeclarativeTimeLinePrivate * d

◆ sync() [1/3]

void QDeclarativeTimeLine::sync ( )

◆ sync() [2/3]

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:

QDeclarativeTimeLine::pause(timeLineValue, length_of(timeline) - length_of(timeLineValue))

Definition at line 563 of file qdeclarativetimeline.cpp.

564 {
565  QDeclarativeTimeLinePrivate::Ops::Iterator iter = d->ops.find(&timeLineValue);
566  if (iter == d->ops.end()) {
567  pause(timeLineValue, d->length);
568  } else {
569  pause(timeLineValue, d->length - iter->length);
570  }
571 }
QDeclarativeTimeLinePrivate * d
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
void pause()
Pauses the animation.
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
Definition: qhash.h:865
iterator Iterator
Qt-style synonym for QHash::iterator.
Definition: qhash.h:473

◆ sync() [3/3]

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:

QDeclarativeTimeLine::pause(timeLineValue, min(0, length_of(syncTo) - length_of(timeLineValue)))

Definition at line 538 of file qdeclarativetimeline.cpp.

539 {
541  if (iter == d->ops.end())
542  return;
543  int length = iter->length;
544 
545  iter = d->ops.find(&timeLineValue);
546  if (iter == d->ops.end()) {
547  pause(timeLineValue, length);
548  } else {
549  int glength = iter->length;
550  pause(timeLineValue, length - glength);
551  }
552 }
QDeclarativeTimeLinePrivate * d
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
void pause()
Pauses the animation.
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
Definition: qhash.h:865
iterator Iterator
Qt-style synonym for QHash::iterator.
Definition: qhash.h:473

◆ syncMode()

QDeclarativeTimeLine::SyncMode QDeclarativeTimeLine::syncMode ( ) const

Return the timeline's synchronization mode.

Definition at line 343 of file qdeclarativetimeline.cpp.

Referenced by setSyncMode().

344 {
345  return d->syncMode;
346 }
QDeclarativeTimeLine::SyncMode syncMode
QDeclarativeTimeLinePrivate * d

◆ syncPoint()

int QDeclarativeTimeLine::syncPoint ( ) const

Temporary hack.

Warning
This function is not part of the public interface.

Definition at line 631 of file qdeclarativetimeline.cpp.

Referenced by QDeclarativeTimeLinePrivate::advance().

632 {
633  return d->syncPoint;
634 }
QDeclarativeTimeLinePrivate * d

◆ time()

int QDeclarativeTimeLine::time ( ) const

Definition at line 684 of file qdeclarativetimeline.cpp.

Referenced by accel(), accelDistance(), and QDeclarativeFlickablePrivate::fixup().

685 {
686  return d->prevTime;
687 }
QDeclarativeTimeLinePrivate * d

◆ updateCurrentTime()

void QDeclarativeTimeLine::updateCurrentTime ( int  currentTime)
protectedvirtual

This pure virtual function is called every time the animation's currentTime changes.

See also
updateState()

GfxClock::isActive()

Implements QAbstractAnimation.

Definition at line 699 of file qdeclarativetimeline.cpp.

700 {
701  if (d->syncAdj == -1)
702  d->syncAdj = v;
703  v -= d->syncAdj;
704 
705  int timeChanged = v - d->prevTime;
706 #if 0
707  if (!timeChanged)
708  return;
709 #endif
710  d->prevTime = v;
711  d->advance(timeChanged);
712  emit updated();
713 
714  // Do we need to stop the clock?
715  if (d->ops.isEmpty()) {
716  stop();
717  d->prevTime = 0;
718  d->clockRunning = false;
719  emit completed();
720  } /*else if (pauseTime > 0) {
721  GfxClock::cancelClock();
722  d->prevTime = 0;
723  GfxClock::pauseFor(pauseTime);
724  d->syncAdj = 0;
725  d->clockRunning = false;
726  }*/ else if ( state() != Running) {
727  stop();
728  d->prevTime = 0;
729  d->clockRunning = true;
730  d->syncAdj = 0;
731  start();
732  }
733 }
State state() const
void start(QAbstractAnimation::DeletionPolicy policy=KeepWhenStopped)
Starts the animation.
void stop()
Stops the animation.
#define emit
Definition: qobjectdefs.h:76
bool isEmpty() const
Returns true if the hash contains no items; otherwise returns false.
Definition: qhash.h:297
void updated()
Emitted each time the timeline modifies QDeclarativeTimeLineValues.
QDeclarativeTimeLinePrivate * d

◆ updated

void QDeclarativeTimeLine::updated ( )
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().

Friends and Related Functions

◆ QDeclarativeTimeLineObject

Definition at line 115 of file qdeclarativetimeline_p_p.h.

◆ QDeclarativeTimeLinePrivate

friend struct QDeclarativeTimeLinePrivate
friend

Definition at line 116 of file qdeclarativetimeline_p_p.h.

Referenced by QDeclarativeTimeLine().

Properties

◆ d

QDeclarativeTimeLinePrivate* QDeclarativeTimeLine::d
private

The documentation for this class was generated from the following files: