Qt 5.9 | Qt 3D | C++ Classes | QAbstractFunctor

Qt 5.9.9 Reference Documentation

# QAbstractFunctor Class

(Qt3DRender::QAbstractFunctor)

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

Header: | #include <QAbstractFunctor>
qmake: | QT += 3drender
Since: | Qt 5.7
Inherited By: | Qt3DRender::QBufferDataGenerator and Qt3DRender::QTextureImageDataGenerator

- List of all members, including inherited members

## Public Functions

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

## Macros

| QT3D_FUNCTOR(Class)

## Detailed Description

QAbstractFunctor is an abstract base class for all functors.

The QAbstractFunctor is used as a base class for all functors and data generators in Qt3DRender 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

### `[default]` QAbstractFunctor::QAbstractFunctor()

Default constructs an instance of QAbstractFunctor.

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

Desctructor

### const T *QAbstractFunctor::functor_cast(const 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::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

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