Qt 4.8
Public Functions | Public Variables | List of all members
QTimeLinePrivate Class Reference
Inheritance diagram for QTimeLinePrivate:
QObjectPrivate QObjectData

Public Functions

 QTimeLinePrivate ()
 
void setCurrentTime (int msecs)
 
void setState (QTimeLine::State newState)
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Public Variables

int currentLoopCount
 
int currentTime
 
QTimeLine::Direction direction
 
int duration
 
QEasingCurve easingCurve
 
int endFrame
 
int startFrame
 
int startTime
 
QTimeLine::State state
 
QElapsedTimer timer
 
int timerId
 
int totalLoopCount
 
int updateInterval
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Additional Inherited Members

- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 

Detailed Description

Definition at line 51 of file qtimeline.cpp.

Constructors and Destructors

◆ QTimeLinePrivate()

QTimeLinePrivate::QTimeLinePrivate ( )
inline

Functions

◆ setCurrentTime()

void QTimeLinePrivate::setCurrentTime ( int  msecs)
Warning
This function is not part of the public interface.

Definition at line 91 of file qtimeline.cpp.

Referenced by setState().

92 {
93  Q_Q(QTimeLine);
94 
95  qreal lastValue = q->currentValue();
96  int lastFrame = q->currentFrame();
97 
98  // Determine if we are looping.
99  int elapsed = (direction == QTimeLine::Backward) ? (-msecs + duration) : msecs;
100  int loopCount = elapsed / duration;
101 
102  bool looping = (loopCount != currentLoopCount);
103 #ifdef QTIMELINE_DEBUG
104  qDebug() << "QTimeLinePrivate::setCurrentTime:" << msecs << duration << "with loopCount" << loopCount
105  << "currentLoopCount" << currentLoopCount
106  << "looping" << looping;
107 #endif
108  if (looping)
109  currentLoopCount = loopCount;
110 
111  // Normalize msecs to be between 0 and duration, inclusive.
112  currentTime = elapsed % duration;
115 
116  // Check if we have reached the end of loopcount.
117  bool finished = false;
119  finished = true;
120  currentTime = (direction == QTimeLine::Backward) ? 0 : duration;
122  }
123 
124  int currentFrame = q->frameForTime(currentTime);
125 #ifdef QTIMELINE_DEBUG
126  qDebug() << "QTimeLinePrivate::setCurrentTime: frameForTime" << currentTime << currentFrame;
127 #endif
128  if (!qFuzzyCompare(lastValue, q->currentValue()))
129  emit q->valueChanged(q->currentValue());
130  if (lastFrame != currentFrame) {
131  const int transitionframe = (direction == QTimeLine::Forward ? endFrame : startFrame);
132  if (looping && !finished && transitionframe != currentFrame) {
133 #ifdef QTIMELINE_DEBUG
134  qDebug() << "QTimeLinePrivate::setCurrentTime: transitionframe";
135 #endif
136  emit q->frameChanged(transitionframe);
137  }
138 #ifdef QTIMELINE_DEBUG
139  else {
140  QByteArray reason;
141  if (!looping)
142  reason += " not looping";
143  if (finished) {
144  if (!reason.isEmpty())
145  reason += " and";
146  reason += " finished";
147  }
148  if (transitionframe == currentFrame) {
149  if (!reason.isEmpty())
150  reason += " and";
151  reason += " transitionframe is equal to currentFrame: " + QByteArray::number(currentFrame);
152  }
153  qDebug("QTimeLinePrivate::setCurrentTime: not transitionframe because %s", reason.constData());
154  }
155 #endif
156  emit q->frameChanged(currentFrame);
157  }
158  if (finished && state == QTimeLine::Running) {
159  q->stop();
160  emit q->finished();
161  }
162 }
QTimeLine::State state
Definition: qtimeline.cpp:77
double qreal
Definition: qglobal.h:1193
static double elapsed(qint64 after, qint64 before)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
static Q_DECL_CONSTEXPR bool qFuzzyCompare(double p1, double p2)
Definition: qglobal.h:2030
#define Q_Q(Class)
Definition: qglobal.h:2483
The QTimeLine class provides a timeline for controlling animations.
Definition: qtimeline.h:55
Q_CORE_EXPORT void qDebug(const char *,...)
QTimeLine::Direction direction
Definition: qtimeline.cpp:75
#define emit
Definition: qobjectdefs.h:76
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
static QByteArray number(int, int base=10)
Returns a byte array containing the string equivalent of the number n to base base (10 by default)...

◆ setState()

void QTimeLinePrivate::setState ( QTimeLine::State  newState)
inline

Definition at line 78 of file qtimeline.cpp.

79  {
80  Q_Q(QTimeLine);
81  if (newState != state)
82  emit q->stateChanged(state = newState);
83  }
QTimeLine::State state
Definition: qtimeline.cpp:77
#define Q_Q(Class)
Definition: qglobal.h:2483
The QTimeLine class provides a timeline for controlling animations.
Definition: qtimeline.h:55
#define emit
Definition: qobjectdefs.h:76

Properties

◆ currentLoopCount

int QTimeLinePrivate::currentLoopCount

Definition at line 69 of file qtimeline.cpp.

Referenced by setCurrentTime().

◆ currentTime

int QTimeLinePrivate::currentTime

Definition at line 71 of file qtimeline.cpp.

Referenced by setCurrentTime().

◆ direction

QTimeLine::Direction QTimeLinePrivate::direction

Definition at line 75 of file qtimeline.cpp.

Referenced by setCurrentTime().

◆ duration

int QTimeLinePrivate::duration

Definition at line 64 of file qtimeline.cpp.

Referenced by setCurrentTime().

◆ easingCurve

QEasingCurve QTimeLinePrivate::easingCurve

Definition at line 76 of file qtimeline.cpp.

◆ endFrame

int QTimeLinePrivate::endFrame

Definition at line 66 of file qtimeline.cpp.

Referenced by setCurrentTime().

◆ startFrame

int QTimeLinePrivate::startFrame

Definition at line 65 of file qtimeline.cpp.

Referenced by setCurrentTime().

◆ startTime

int QTimeLinePrivate::startTime

Definition at line 63 of file qtimeline.cpp.

◆ state

QTimeLine::State QTimeLinePrivate::state

Definition at line 77 of file qtimeline.cpp.

Referenced by setCurrentTime().

◆ timer

QElapsedTimer QTimeLinePrivate::timer

Definition at line 73 of file qtimeline.cpp.

◆ timerId

int QTimeLinePrivate::timerId

Definition at line 72 of file qtimeline.cpp.

◆ totalLoopCount

int QTimeLinePrivate::totalLoopCount

Definition at line 68 of file qtimeline.cpp.

Referenced by setCurrentTime().

◆ updateInterval

int QTimeLinePrivate::updateInterval

Definition at line 67 of file qtimeline.cpp.


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