QAnimationGroup Class
Die Klasse QAnimationGroup ist eine abstrakte Basisklasse für Gruppen von Animationen. Mehr...
Kopfzeile: | #include <QAnimationGroup> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
Vererbt: | QAbstractAnimation |
Vererbt von: |
- Liste aller Mitglieder, einschließlich geerbter Mitglieder
- QAnimationGroup ist Teil des Animation Frameworks.
Öffentliche Funktionen
QAnimationGroup(QObject *parent = nullptr) | |
virtual | ~QAnimationGroup() |
void | addAnimation(QAbstractAnimation *animation) |
QAbstractAnimation * | animationAt(int index) const |
int | animationCount() const |
void | clear() |
int | indexOfAnimation(QAbstractAnimation *animation) const |
void | insertAnimation(int index, QAbstractAnimation *animation) |
void | removeAnimation(QAbstractAnimation *animation) |
QAbstractAnimation * | takeAnimation(int index) |
Reimplementierte geschützte Funktionen
virtual bool | event(QEvent *event) override |
Detaillierte Beschreibung
Eine Animationsgruppe ist ein Container für Animationen (Unterklassen von QAbstractAnimation). Eine Gruppe ist normalerweise für die Verwaltung der state ihrer Animationen verantwortlich, d.h. sie entscheidet, wann sie gestartet, gestoppt, fortgesetzt und pausiert werden soll. Derzeit bietet Qt zwei solcher Gruppen: QParallelAnimationGroup und QSequentialAnimationGroup. Schauen Sie in deren Klassenbeschreibungen nach, um Details zu erfahren.
Da QAnimationGroup von QAbstractAnimation erbt, können Sie Gruppen kombinieren und auf einfache Weise komplexe Animationsgraphen konstruieren. Sie können QAbstractAnimation nach der Gruppe abfragen, zu der sie gehört (mit der Funktion group()).
Um eine Top-Level-Animationsgruppe zu starten, verwenden Sie einfach die Funktion start() von QAbstractAnimation. Unter einer Top-Level-Animationsgruppe verstehen wir eine Gruppe, die selbst nicht in einer anderen Gruppe enthalten ist. Das direkte Starten von Untergruppen wird nicht unterstützt und kann zu unerwartetem Verhalten führen.
QAnimationGroup bietet Methoden zum Hinzufügen und Abrufen von Animationen. Darüber hinaus können Sie Animationen durch den Aufruf von removeAnimation() entfernen und die Animationsgruppe durch den Aufruf von clear() löschen. Sie können Änderungen an den Animationen der Gruppe verfolgen, indem Sie auf die Ereignisse QEvent::ChildAdded und QEvent::ChildRemoved hören.
QAnimationGroup übernimmt die Verantwortung für die von ihr verwalteten Animationen und stellt sicher, dass sie gelöscht werden, wenn die Animationsgruppe gelöscht wird.
Siehe auch QAbstractAnimation, QVariantAnimation, und The Animation Framework.
Dokumentation der Mitgliedsfunktionen
QAnimationGroup::QAnimationGroup(QObject *parent = nullptr)
Konstruiert eine QAnimationGroup. parent wird an den Konstruktor von QObject übergeben.
[virtual noexcept]
QAnimationGroup::~QAnimationGroup()
Zerstört die Animationsgruppe. Es werden auch alle ihre Animationen zerstört.
void QAnimationGroup::addAnimation(QAbstractAnimation *animation)
Fügt animation zu dieser Gruppe hinzu. Dadurch wird insertAnimation mit einem Index gleich animationCount() aufgerufen.
Hinweis: Die Gruppe übernimmt das Eigentum an der Animation.
Siehe auch removeAnimation().
QAbstractAnimation *QAnimationGroup::animationAt(int index) const
Gibt einen Zeiger auf die Animation unter index in dieser Gruppe zurück. Diese Funktion ist nützlich, wenn Sie Zugriff auf eine bestimmte Animation benötigen. index liegt zwischen 0 und animationCount() - 1.
Siehe auch animationCount() und indexOfAnimation().
int QAnimationGroup::animationCount() const
Gibt die Anzahl der von dieser Gruppe verwalteten Animationen zurück.
Siehe auch indexOfAnimation(), addAnimation(), und animationAt().
void QAnimationGroup::clear()
Entfernt und löscht alle Animationen in dieser Animationsgruppe und setzt die aktuelle Zeit auf 0 zurück.
Siehe auch addAnimation() und removeAnimation().
[override virtual protected]
bool QAnimationGroup::event(QEvent *event)
Reimplements: QAbstractAnimation::event(QEvent *Event).
int QAnimationGroup::indexOfAnimation(QAbstractAnimation *animation) const
Gibt den Index von animation zurück. Der zurückgegebene Index kann an andere Funktionen weitergegeben werden, die einen Index als Argument benötigen.
Siehe auch insertAnimation(), animationAt(), und takeAnimation().
void QAnimationGroup::insertAnimation(int index, QAbstractAnimation *animation)
Fügt animation in diese Animationsgruppe bei index ein. Wenn index gleich 0 ist, wird die Animation am Anfang eingefügt. Wenn index gleich animationCount() ist, wird die Animation am Ende eingefügt.
Hinweis: Die Gruppe übernimmt das Eigentum an der Animation.
Siehe auch takeAnimation(), addAnimation(), indexOfAnimation(), und removeAnimation().
void QAnimationGroup::removeAnimation(QAbstractAnimation *animation)
Entfernt animation aus dieser Gruppe. Das Eigentum an animation geht auf den Aufrufer über.
Siehe auch takeAnimation(), insertAnimation(), und addAnimation().
QAbstractAnimation *QAnimationGroup::takeAnimation(int index)
Gibt die Animation unter index zurück und entfernt sie aus der Animationsgruppe.
Hinweis: Das Eigentum an der Animation geht auf den Aufrufer über.
Siehe auch removeAnimation(), addAnimation(), insertAnimation(), und indexOfAnimation().
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.