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() 直接设置。

QSequentialAnimationGroup 提供了方便的函数addPause() 和insertPause() 。这些函数只需获取暂停应持续的毫秒数。

另请参阅 QSequentialAnimationGroup

属性文档

[bindable] duration : int

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

该属性表示暂停的持续时间。

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

成员函数文档

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)。

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