本页内容

Qt3DAnimation::QAbstractAnimation Class

class Qt3DAnimation::QAbstractAnimation

Qt3D 动画的抽象基类。更多内容...

头文件: #include <QAbstractAnimation>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3danimation)
target_link_libraries(mytarget PRIVATE Qt6::3danimation)
qmake: QT += 3danimation
在 QML 中: AbstractAnimation
继承自: QObject
被继承类:

Qt3DAnimation::QKeyframeAnimation、Qt3DAnimation::QMorphingAnimation 以及Qt3DAnimation::QVertexBlendAnimation

状态: 技术预览

该类处于技术预览阶段,内容可能会发生变更。

公共类型

enum AnimationType { KeyframeAnimation, MorphingAnimation, VertexBlendAnimation }

属性

公共函数

QString animationName() const
Qt3DAnimation::QAbstractAnimation::AnimationType animationType() const
float duration() const
float position() const

公共槽位

void setAnimationName(const QString &name)
void setPosition(float position)

信号

void animationNameChanged(const QString &name)
void durationChanged(float duration)
void positionChanged(float position)

受保护函数

void setDuration(float duration)

详细说明

Qt3DAnimation::QAbstractAnimation 是所有动画的抽象基类。Qt3DAnimation::QAbstractAnimation 无法直接实例化,而必须通过其子类进行实例化。QAbstractAnimation 规定了所有 Qt3D 动画的通用属性,例如动画名称和类型、当前位置以及动画持续时间,而将实际的动画处理留给子类。

成员类型文档

enum QAbstractAnimation::AnimationType

此枚举指定了动画的类型

常量值描述
Qt3DAnimation::QAbstractAnimation::KeyframeAnimation1用于QTransform
Qt3DAnimation::QAbstractAnimation::MorphingAnimation2混合形状变形动画
Qt3DAnimation::QAbstractAnimation::VertexBlendAnimation3顶点混合动画

属性文档

animationName : QString

存储动画的名称。

访问函数:

QString animationName() const
void setAnimationName(const QString &name)

通知器信号:

void animationNameChanged(const QString &name)

[read-only] animationType : const AnimationType

存储动画的类型。

访问函数:

Qt3DAnimation::QAbstractAnimation::AnimationType animationType() const

[read-only] duration : float

存储动画的持续时间。

访问函数:

float duration() const

通知器信号:

void durationChanged(float duration)

position : float

保存动画的当前位置。

访问函数:

float position() const
void setPosition(float position)

通知器信号:

void positionChanged(float position)

成员函数文档

[protected] void QAbstractAnimation::setDuration(float duration)

设置动画的duration 。

另请参阅 duration()。

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