Qt3DCore::QAbstractFunctor Class
class Qt3DCore::QAbstractFunctorQAbstractFunctor 是所有函子共有的抽象基类。更多内容...
| 标题: | #include <QAbstractFunctor> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS 3DCore) target_link_libraries(mytarget PRIVATE Qt6::3DCore) |
| qmake: | QT += 3dcore |
| 由以下项目继承: | |
| 状态: | 已弃用 |
该类已弃用。我们强烈建议不要在新代码中使用它。
公共函数
| QAbstractFunctor() | |
| virtual | ~QAbstractFunctor() |
| const T * | functor_cast(const Qt3DCore::QAbstractFunctor *other) const |
| virtual qintptr | id() const = 0 |
宏
| QT3D_FUNCTOR(Class) |
详细说明
QAbstractFunctor 作为Qt3DCore 模块中所有函子(functors)和数据生成器(data generators)的基类。
当用户定义一个新的函子或生成器时,需要实现QAbstractFunctor::id() 方法,这应通过在类定义中使用QT3D_FUNCTOR 宏来完成。
成员函数文档
[constexpr noexcept default] QAbstractFunctor::QAbstractFunctor()
默认——构造一个QAbstractFunctor 的实例。
[virtual noexcept] QAbstractFunctor::~QAbstractFunctor()
Desctructor
template <typename T> const T *QAbstractFunctor::functor_cast(const Qt3DCore::QAbstractFunctor *other) const
该方法用于将函子other 强制转换为类型T,前提是T属于T类型(或其子类);否则返回0。该方法的工作原理与qobject_cast()类似,但仅适用于从QAbstractFunctor 派生的函子。
警告:如果 T 未使用QT3D_FUNCTOR 宏进行声明,则结果未定义。
[pure virtual] qintptr QAbstractFunctor::id() const
返回指向该函子标识符的指针。
© 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.