QAnimationGroup Class

QAnimationGroupクラスは、アニメーショングループの抽象基底クラスです。さらに...

ヘッダー #include <QAnimationGroup>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
を継承する: QAbstractAnimation
によって継承される:

QParallelAnimationGroup そしてQSequentialAnimationGroup

パブリック関数

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)

再実装された保護された関数

virtual bool event(QEvent *event) override

詳細説明

アニメーショングループは、アニメーション(QAbstractAnimation のサブクラス)のコンテナです。グループは通常、そのアニメーションのstate を管理する責任があります。つまり、いつアニメーションを開始、停止、再開、一時停止するかを決定します。現在、Qt はQParallelAnimationGroupQSequentialAnimationGroup の2つのグループを提供しています。詳細はそれぞれのクラスの説明を参照してください。

QAnimationGroup はQAbstractAnimation を継承しているので、グループを組み合わせることができ、複雑なアニメーション・グラフを簡単に構築できます。group() 関数を使って)QAbstractAnimation に属するグループを問い合わせることができます。

トップレベルのアニメーショングループを開始するには、QAbstractAnimationstart() 関数を使用します。トップレベルのアニメーショングループとは、それ自体が他のグループに含まれないグループのことです。サブグループを直接開始することはサポートされておらず、予期しない動作につながる可能性があります。

QAnimationGroupは、アニメーションの追加と取得のためのメソッドを提供します。それ以外にも、removeAnimation()を呼び出すことでアニメーションを削除し、clear()を呼び出すことでアニメーショングループをクリアすることができます。QEvent::ChildAddedQEvent::ChildRemoved イベントをリッスンすることで、グループのアニメーションの変更を追跡することができます。

QAnimationGroupは、管理するアニメーションの所有権を持ち、アニメーショングループが削除されたときに、それらのアニメーションが削除されるようにします。

QAbstractAnimation,QVariantAnimation,The Animation Frameworkも参照してください

メンバ関数ドキュメント

QAnimationGroup::QAnimationGroup(QObject *parent = nullptr)

QAnimationGroup を構築します。parentQObject のコンストラクタに渡されます。

[virtual noexcept] QAnimationGroup::~QAnimationGroup()

アニメーショングループを破壊する。また、そのアニメーションをすべて破棄します。

void QAnimationGroup::addAnimation(QAbstractAnimation *animation)

animation をこのグループに追加する。これにより、animationCount ()に等しいインデックスを持つinsertAnimation が呼び出される。

注意: このグループはアニメーションの所有権を持ちます。

removeAnimation()も参照してください

QAbstractAnimation *QAnimationGroup::animationAt(int index) const

このグループ内のindex にあるアニメーションへのポインタを返す。この関数は、特定のアニメーションにアクセスする必要がある場合に便利です。index は 0 からanimationCount() - 1 の間です。

animationCount() およびindexOfAnimation()も参照

int QAnimationGroup::animationCount() const

このグループが管理しているアニメーションの数を返します。

indexOfAnimation(),addAnimation(),animationAt()も参照

void QAnimationGroup::clear()

このアニメーショングループ内のすべてのアニメーションを削除・消去し、現在時刻を 0 にリセットする。

addAnimation() およびremoveAnimation()も参照してください

[override virtual protected] bool QAnimationGroup::event(QEvent *event)

再実装:QAbstractAnimation::event(QEvent *event)。

int QAnimationGroup::indexOfAnimation(QAbstractAnimation *animation) const

animation返されたインデックスは、インデックスを引数に取る他の関数に渡すことができる。

insertAnimation()、animationAt()、takeAnimation()も参照

void QAnimationGroup::insertAnimation(int index, QAbstractAnimation *animation)

animation をこのアニメーショングループのindex に挿入する。index が 0 の場合、アニメーションは先頭に挿入されます。indexanimationCount() の場合、アニメーションは最後に挿入されます。

注意: このグループはアニメーションの所有権を持ちます。

takeAnimation()、addAnimation()、indexOfAnimation()、removeAnimation()も参照

void QAnimationGroup::removeAnimation(QAbstractAnimation *animation)

animation をこのグループから削除する。animation の所有権は呼び出し元に移される。

takeAnimation()、insertAnimation()、addAnimation()も参照

QAbstractAnimation *QAnimationGroup::takeAnimation(int index)

アニメーションをindex で返し、アニメーショングループから削除する。

注意: アニメーションの所有権は呼び出し元に移ります。

removeAnimation()、addAnimation()、insertAnimation()、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.