QPauseAnimation Class

The QPauseAnimation class provides a pause for QSequentialAnimationGroup . 更多...

Header: #include <QPauseAnimation>
CMake: find_package(Qt6 COMPONENTS Core REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
继承: QAbstractAnimation



QPauseAnimation (int msecs , QObject * parent = nullptr)
QPauseAnimation (QObject * parent = nullptr)
virtual ~QPauseAnimation ()
void setDuration (int msecs )


virtual int duration () const override


virtual bool event (QEvent * e ) override
virtual void updateCurrentTime (int) override


If you wish to introduce a delay between animations in a QSequentialAnimationGroup , you can insert a QPauseAnimation. This class does not animate anything, but does not finish before a specified number of milliseconds have elapsed from when it was started. You specify the duration of the pause in the constructor. It can also be set directly with setDuration ().

It is not necessary to construct a QPauseAnimation yourself. QSequentialAnimationGroup provides the convenience functions addPause() and insertPause() . These functions simply take the number of milliseconds the pause should last.

另请参阅 QSequentialAnimationGroup .


[bindable] duration : int

注意: This property supports QProperty bindings.

This property holds the duration of the pause.

The duration of the pause. The duration should not be negative. The default duration is 250 milliseconds.


QPauseAnimation:: QPauseAnimation ( int msecs , QObject * parent = nullptr)

Constructs a QPauseAnimation. msecs is the duration of the pause. parent 会被传递给 QObject 的构造函数。

QPauseAnimation:: QPauseAnimation ( QObject * parent = nullptr)

Constructs a QPauseAnimation. parent 会被传递给 QObject 's constructor. The default duration is 0.

[virtual] QPauseAnimation:: ~QPauseAnimation ()

Destroys the pause animation.

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

重实现: QAbstractAnimation::event (QEvent *event).

[override virtual protected] void QPauseAnimation:: updateCurrentTime ( int )

重实现: QAbstractAnimation::updateCurrentTime (int currentTime).