CopperSpice API  1.7.2
QAnimationGroup Class Reference

The QAnimationGroup class is an abstract base class for groups of animations. More...

Inheritance diagram for QAnimationGroup:
QAbstractAnimation QObject QParallelAnimationGroup QSequentialAnimationGroup

Public Methods

 QAnimationGroup (QObject *parent=nullptr)
 
 ~QAnimationGroup ()
 
void addAnimation (QAbstractAnimation *animation)
 
QAbstractAnimationanimationAt (int index) const
 
int animationCount () const
 
void clear ()
 
int indexOfAnimation (QAbstractAnimation *animation) const
 
void insertAnimation (int index, QAbstractAnimation *animation)
 
void removeAnimation (QAbstractAnimation *animation)
 
QAbstractAnimationtakeAnimation (int index)
 
- Public Methods inherited from QAbstractAnimation
 QAbstractAnimation (QObject *parent=nullptr)
 
virtual ~QAbstractAnimation ()
 
int currentLoop () const
 
int currentLoopTime () const
 
int currentTime () const
 
Direction direction () const
 
virtual int duration () const = 0
 
QAnimationGroupgroup () const
 
int loopCount () const
 
void setDirection (Direction direction)
 
void setLoopCount (int loopCount)
 
State state () const
 
int totalDuration () const
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &objName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 

Protected Methods

bool event (QEvent *event) override
 
- Protected Methods inherited from QAbstractAnimation
virtual void updateCurrentTime (int currentTime) = 0
 
virtual void updateDirection (QAbstractAnimation::Direction direction)
 
virtual void updateState (QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Public Types inherited from QAbstractAnimation
enum  DeletionPolicy
 
enum  Direction
 
enum  State
 
- Public Signals inherited from QAbstractAnimation
void currentLoopChanged (int currentLoop)
 
void directionChanged (QAbstractAnimation::Direction newDirection)
 
void finished ()
 
void stateChanged (QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 
- Public Slots inherited from QAbstractAnimation
void pause ()
 
void resume ()
 
void setCurrentTime (int msecs)
 
void setPaused (bool paused)
 
void start (QAbstractAnimation::DeletionPolicy policy=KeepWhenStopped)
 
void stop ()
 
- Public Slots inherited from QObject
void deleteLater ()
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 
- Properties inherited from QAbstractAnimation
 currentLoop
 
 currentTime
 
 direction
 
 duration
 
 loopCount
 
 state
 
- Properties inherited from QObject
 objectName
 

Detailed Description

The QAnimationGroup class is an abstract base class for groups of animations. An animation group is a container for animations (subclasses of QAbstractAnimation). A group is usually responsible for managing the state of its animations, i.e., it decides when to start, stop, resume, and pause them. Currently, CopperSpice provides two such groups: QParallelAnimationGroup and QSequentialAnimationGroup. Look up their class descriptions for details.

Since QAnimationGroup inherits from QAbstractAnimation, you can combine groups, and easily construct complex animation graphs. You can query QAbstractAnimation for the group it belongs to (using the group() function).

To start a top-level animation group, you simply use the start() function from QAbstractAnimation. By a top-level animation group, we think of a group that itself is not contained within another group. Starting sub groups directly is not supported, and may lead to unexpected behavior.

QAnimationGroup provides methods for adding and retrieving animations. Besides that, you can remove animations by calling remove(), and clear the animation group by calling clear(). You may keep track of changes in the group's animations by listening to QEvent::ChildAdded and QEvent::ChildRemoved events.

QAnimationGroup takes ownership of the animations it manages, and ensures that they are deleted when the animation group is deleted.

See also
QAbstractAnimation, QVariantAnimation, Animation Technology

Constructor & Destructor Documentation

QAnimationGroup::QAnimationGroup ( QObject parent = nullptr)

Constructs a QAnimationGroup. parent is passed to QObject's constructor.

QAnimationGroup::~QAnimationGroup ( )

Destroys the animation group. It will also destroy all its animations.

Method Documentation

void QAnimationGroup::addAnimation ( QAbstractAnimation animation)

Adds animation to this group. This will call insertAnimation with index equals to animationCount().

Note
The group takes ownership of the animation.
See also
removeAnimation()
QAbstractAnimation * QAnimationGroup::animationAt ( int  index) const

Returns a pointer to the animation at index in this group. This function is useful when you need access to a particular animation. index is between 0 and animationCount() - 1.

See also
animationCount(), indexOfAnimation()
int QAnimationGroup::animationCount ( ) const

Returns the number of animations managed by this group.

See also
indexOfAnimation(), addAnimation(), animationAt()
void QAnimationGroup::clear ( )

Removes and deletes all animations in this animation group, and resets the current time to 0.

See also
addAnimation(), removeAnimation()
bool QAnimationGroup::event ( QEvent event)
overrideprotectedvirtual

This virtual method receives events to an object and should return true if the event event was recognized and processed. The event() method can be overridden to customize the behavior of an object.

See also
installEventFilter(), timerEvent(), QApplication::sendEvent(), QApplication::postEvent(), QWidget::event()

Reimplemented from QAbstractAnimation.

Reimplemented in QSequentialAnimationGroup, and QParallelAnimationGroup.

int QAnimationGroup::indexOfAnimation ( QAbstractAnimation animation) const

Returns the index of animation. The returned index can be passed to the other functions that take an index as an argument.

See also
insertAnimation(), animationAt(), takeAnimation()
void QAnimationGroup::insertAnimation ( int  index,
QAbstractAnimation animation 
)

Inserts animation into this animation group at index. If index is 0 the animation is inserted at the beginning. If index is animationCount(), the animation is inserted at the end.

Note
The group takes ownership of the animation.
See also
takeAnimation(), addAnimation(), indexOfAnimation(), removeAnimation()
void QAnimationGroup::removeAnimation ( QAbstractAnimation animation)

Removes animation from this group. The ownership of animation is transferred to the caller.

See also
takeAnimation(), insertAnimation(), addAnimation()
QAbstractAnimation * QAnimationGroup::takeAnimation ( int  index)

Returns the animation at index and removes it from the animation group.

Note
The ownership of the animation is transferred to the caller.
See also
removeAnimation(), addAnimation(), insertAnimation(), indexOfAnimation()