Qt3DAnimation::QCallbackMapping Class

class Qt3DAnimation::QCallbackMapping

允许将片段中的通道映射到回调对象的调用上。更多

Header: #include <QCallbackMapping>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3danimation)
target_link_libraries(mytarget PRIVATE Qt6::3danimation)
qmake: QT += 3danimation
继承于Qt3DAnimation::QAbstractChannelMapping
状态:已废弃

公共函数

QString channelName() const
void setCallback(int type, Qt3DAnimation::QAnimationCallback *callback, Qt3DAnimation::QAnimationCallback::Flags flags = QAnimationCallback::OnOwningThread)

公共插槽

void setChannelName(const QString &channelName)

信号

void channelNameChanged(QString channelName)

详细说明

成员函数文档

void QCallbackMapping::setCallback(int type, Qt3DAnimation::QAnimationCallback *callback, Qt3DAnimation::QAnimationCallback::Flags flags = QAnimationCallback::OnOwningThread)

callback 对象与此通道映射关联起来。

这种映射不一定要有目标对象和属性名称。设置callback 对象后,动画值的每次变化都会导致在 gui/main 线程或直接在线程池的工作线程中调用回调的valueChanged 函数。这由flags 控制。

type 指定动画值的类型(例如, 、 或 )。在动画节点属性时,不需要单独提供,但在只有回调时,就必须提供。QMetaType::QVector3D QMetaType::QColor QMetaType::Float

注: 映射可同时与节点属性和回调相关联。在这种情况下,type 与属性类型相匹配是非常重要的。另请注意,对于QVariant 类型的属性(例如 QParameter::value),type 是存储在QVariant 中的值的类型。

注意: callback 指针应在任何相关动画运行时保持有效。

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