本页内容

QPauseAnimation Class

QPauseAnimation 类为QSequentialAnimationGroup 提供了暂停功能。更多内容...

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

属性

公共函数

QPauseAnimation(QObject *parent = nullptr)
QPauseAnimation(int msecs, QObject *parent = nullptr)
virtual ~QPauseAnimation()
QBindable<int> bindableDuration()
void setDuration(int msecs)

重新实现的公共函数

virtual int duration() const override

重新实现的受保护函数

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

详细说明

若要在QSequentialAnimationGroup 中的动画之间引入延迟,可以插入一个QPauseAnimation。该类本身不执行任何动画,但在自启动起经过指定毫秒数之前,不会执行finish 。您可以在构造函数中指定暂停时长,也可以通过setDuration()直接设置。

您无需自行创建 QPauseAnimation 对象。QSequentialAnimationGroup 提供了便捷函数addPause() 和insertPause()。这些函数只需传入暂停应持续的毫秒数即可。

另请参阅 QSequentialAnimationGroup 。

属性文档

[bindable] duration : int

注意:此 属性支持QProperty 绑定。

该属性存储暂停的持续时间。

暂停的持续时间。该值不应为负数。默认持续时间为250毫秒。

访问函数:

virtual int duration() const override
void setDuration(int msecs)

成员函数文档

QPauseAnimation::QPauseAnimation(QObject *parent = nullptr)

创建一个 QPauseAnimation 对象。将 `parent ` 作为参数传递给 `QObject` 的构造函数。默认持续时间为 0。

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

创建一个 QPauseAnimation 对象。msecs 表示暂停的持续时间。parent 将作为参数传递给QObject 的构造函数。

[virtual noexcept] QPauseAnimation::~QPauseAnimation()

取消暂停动画。

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

重写了:QAbstractAnimation::event(QEvent *event)。

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

重写了:QAbstractAnimation::updateCurrentTime(int currentTime)。

© 2026 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.