Qt 4.8
Public Functions | Public Variables | List of all members
QParallelAnimationGroupPrivate Class Reference

#include <qparallelanimationgroup_p.h>

Inheritance diagram for QParallelAnimationGroupPrivate:
QAnimationGroupPrivate QAbstractAnimationPrivate QObjectPrivate QObjectData

Public Functions

void _q_uncontrolledAnimationFinished ()
 
void animationRemoved (int index, QAbstractAnimation *)
 
void applyGroupState (QAbstractAnimation *animation)
 
void connectUncontrolledAnimations ()
 
void disconnectUncontrolledAnimations ()
 
bool isUncontrolledAnimationFinished (QAbstractAnimation *anim) const
 
 QParallelAnimationGroupPrivate ()
 
bool shouldAnimationStart (QAbstractAnimation *animation, bool startIfAtEnd) const
 
- Public Functions inherited from QAnimationGroupPrivate
virtual void animationInsertedAt (int)
 
void connectUncontrolledAnimation (QAbstractAnimation *anim)
 
void disconnectUncontrolledAnimation (QAbstractAnimation *anim)
 
 QAnimationGroupPrivate ()
 
- Public Functions inherited from QAbstractAnimationPrivate
 QAbstractAnimationPrivate ()
 
void setState (QAbstractAnimation::State state)
 
virtual ~QAbstractAnimationPrivate ()
 
- 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 lastCurrentTime
 
int lastLoop
 
QHash< QAbstractAnimation *, int > uncontrolledFinishTime
 
- Public Variables inherited from QAnimationGroupPrivate
QList< QAbstractAnimation * > animations
 
- Public Variables inherited from QAbstractAnimationPrivate
int currentLoop
 
int currentTime
 
bool deleteWhenStopped
 
QAbstractAnimation::Direction direction
 
QAnimationGroupgroup
 
bool hasRegisteredTimer
 
bool isGroup
 
bool isPause
 
int loopCount
 
QAbstractAnimation::State state
 
int totalCurrentTime
 
- 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 QAbstractAnimationPrivate
static QAbstractAnimationPrivateget (QAbstractAnimation *q)
 
- 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 64 of file qparallelanimationgroup_p.h.

Constructors and Destructors

◆ QParallelAnimationGroupPrivate()

QParallelAnimationGroupPrivate::QParallelAnimationGroupPrivate ( )
inline

Functions

◆ _q_uncontrolledAnimationFinished()

void QParallelAnimationGroupPrivate::_q_uncontrolledAnimationFinished ( )

Definition at line 218 of file qparallelanimationgroup.cpp.

219 {
221 
222  QAbstractAnimation *animation = qobject_cast<QAbstractAnimation *>(q->sender());
223  Q_ASSERT(animation);
224 
225  int uncontrolledRunningCount = 0;
226  if (animation->duration() == -1 || animation->loopCount() < 0) {
228  while (it != uncontrolledFinishTime.end()) {
229  if (it.key() == animation) {
230  *it = animation->currentTime();
231  }
232  if (it.value() == -1)
233  ++uncontrolledRunningCount;
234  ++it;
235  }
236  }
237 
238  if (uncontrolledRunningCount > 0)
239  return;
240 
241  int maxDuration = 0;
242  for (int i = 0; i < animations.size(); ++i)
243  maxDuration = qMax(maxDuration, animations.at(i)->totalDuration());
244 
245  if (currentTime >= maxDuration)
246  q->stop();
247 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
int totalDuration() const
Returns the total and effective duration of the animation, including the loop count.
#define it(className, varName)
The QHash class is a template class that provides a hash-table-based dictionary.
Definition: qdatastream.h:66
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
#define Q_Q(Class)
Definition: qglobal.h:2483
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QList< QAbstractAnimation * > animations
The QAbstractAnimation class is the base of all animations.
int loopCount
the loop count of the animation
The QParallelAnimationGroup class provides a parallel group of animations.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
QHash< QAbstractAnimation *, int > uncontrolledFinishTime
const Key key(const T &value) const
Returns the first key mapped to value.
Definition: qhash.h:674
int currentTime
the current time and progress of the animation
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
iterator begin()
Returns an STL-style iterator pointing to the first item in the hash.
Definition: qhash.h:464
int duration
the duration of the animation.

◆ animationRemoved()

void QParallelAnimationGroupPrivate::animationRemoved ( int  index,
QAbstractAnimation anim 
)
virtual

Reimplemented from QAnimationGroupPrivate.

Definition at line 306 of file qparallelanimationgroup.cpp.

307 {
311 }
int remove(const Key &key)
Removes all the items that have the key from the hash.
Definition: qhash.h:784
virtual void animationRemoved(int, QAbstractAnimation *)
QHash< QAbstractAnimation *, int > uncontrolledFinishTime
quint16 index
void disconnectUncontrolledAnimation(QAbstractAnimation *anim)

◆ applyGroupState()

void QParallelAnimationGroupPrivate::applyGroupState ( QAbstractAnimation animation)

Definition at line 284 of file qparallelanimationgroup.cpp.

285 {
286  switch (state)
287  {
289  animation->start();
290  break;
292  animation->pause();
293  break;
295  default:
296  break;
297  }
298 }
void start(QAbstractAnimation::DeletionPolicy policy=KeepWhenStopped)
Starts the animation.
QAbstractAnimation::State state
void pause()
Pauses the animation.

◆ connectUncontrolledAnimations()

void QParallelAnimationGroupPrivate::connectUncontrolledAnimations ( )

Definition at line 260 of file qparallelanimationgroup.cpp.

261 {
262  for (int i = 0; i < animations.size(); ++i) {
263  QAbstractAnimation *animation = animations.at(i);
264  if (animation->duration() == -1 || animation->loopCount() < 0) {
265  uncontrolledFinishTime[animation] = -1;
266  connectUncontrolledAnimation(animation);
267  }
268  }
269 }
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void connectUncontrolledAnimation(QAbstractAnimation *anim)
QList< QAbstractAnimation * > animations
The QAbstractAnimation class is the base of all animations.
int loopCount
the loop count of the animation
QHash< QAbstractAnimation *, int > uncontrolledFinishTime
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
int duration
the duration of the animation.

◆ disconnectUncontrolledAnimations()

void QParallelAnimationGroupPrivate::disconnectUncontrolledAnimations ( )

Definition at line 249 of file qparallelanimationgroup.cpp.

250 {
252  while (it != uncontrolledFinishTime.end()) {
254  ++it;
255  }
256 
258 }
void clear()
Removes all items from the hash.
Definition: qhash.h:574
#define it(className, varName)
The QHash class is a template class that provides a hash-table-based dictionary.
Definition: qdatastream.h:66
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
QHash< QAbstractAnimation *, int > uncontrolledFinishTime
const Key key(const T &value) const
Returns the first key mapped to value.
Definition: qhash.h:674
iterator begin()
Returns an STL-style iterator pointing to the first item in the hash.
Definition: qhash.h:464
void disconnectUncontrolledAnimation(QAbstractAnimation *anim)

◆ isUncontrolledAnimationFinished()

bool QParallelAnimationGroupPrivate::isUncontrolledAnimationFinished ( QAbstractAnimation anim) const

Definition at line 301 of file qparallelanimationgroup.cpp.

302 {
303  return uncontrolledFinishTime.value(anim, -1) >= 0;
304 }
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
QHash< QAbstractAnimation *, int > uncontrolledFinishTime

◆ shouldAnimationStart()

bool QParallelAnimationGroupPrivate::shouldAnimationStart ( QAbstractAnimation animation,
bool  startIfAtEnd 
) const

Definition at line 271 of file qparallelanimationgroup.cpp.

272 {
273  const int dura = animation->totalDuration();
274  if (dura == -1)
275  return !isUncontrolledAnimationFinished(animation);
276  if (startIfAtEnd)
277  return currentTime <= dura;
279  return currentTime < dura;
280  else //direction == QAbstractAnimation::Backward
281  return currentTime && currentTime <= dura;
282 }
int totalDuration() const
Returns the total and effective duration of the animation, including the loop count.
QAbstractAnimation::Direction direction
bool isUncontrolledAnimationFinished(QAbstractAnimation *anim) const

Properties

◆ lastCurrentTime

int QParallelAnimationGroupPrivate::lastCurrentTime

Definition at line 75 of file qparallelanimationgroup_p.h.

◆ lastLoop

int QParallelAnimationGroupPrivate::lastLoop

Definition at line 74 of file qparallelanimationgroup_p.h.

◆ uncontrolledFinishTime

QHash<QAbstractAnimation*, int> QParallelAnimationGroupPrivate::uncontrolledFinishTime

Definition at line 73 of file qparallelanimationgroup_p.h.


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