QAbstractFunctor Class | Qt 3D 6.4.1

- Qt 6.4
- Qt 3D
- C++ Classes
- Qt3DCore
- QAbstractFunctor
- Qt 6.4.1 Reference Documentation

# QAbstractFunctor Class

class Qt3DCore::QAbstractFunctor

QAbstractFunctor is an abstract base class for all functors. More...

Header: | #include <QAbstractFunctor>
CMake: | find_package(Qt6 REQUIRED COMPONENTS 3dcore) target_link_libraries(mytarget PRIVATE Qt6::3dcore)
qmake: | QT += 3dcore
Since: | Qt 5.7
Inherited By: | Qt3DRender::QTextureGenerator

- List of all members, including inherited members

## Public Functions

virtual | ~QAbstractFunctor()
const T * | functor_cast(const Qt3DCore::QAbstractFunctor *other) const
virtual qintptr | id() const = 0

## Macros

| QT3D_FUNCTOR(Class)

## Detailed Description

The QAbstractFunctor is used as a base class for all functors and data generators in Qt3DCore module.

When user defines a new functor or generator, they need to implement the QAbstractFunctor::id() method, which should be done using the `QT3D_FUNCTOR` macro in the class definition.

## Member Function Documentation

### `[virtual]` QAbstractFunctor::~QAbstractFunctor()

Desctructor

### template <typename T> const T *QAbstractFunctor::functor_cast(const Qt3DCore::QAbstractFunctor *other) const

This method is used to cast functor other to type T if the other is of type T (or of subclass); otherwise returns 0. This method works similarly to qobject_cast(), except with functors derived from QAbstractFunctor.

Warning: If T was not declared with QT3D_FUNCTOR macro, then the results are undefined.

### `[pure virtual]` qintptr QAbstractFunctor::id() const

Returns a pointer to the id of the functor.

## Macro Documentation

### QT3D_FUNCTOR(Class)

This macro assigns functor id to the Class, which is used by QAbstractFunctor::functor_cast to determine if the cast can be done.