Qt 5.7 | Qt 3D | C++ Classes | QMaterial

Qt 5.7.1 Reference Documentation

# QMaterial Class

(Qt3DRender::QMaterial)

Provides an abstract class that should be the base of all material component classes in a scene. More...

Header: | #include <QMaterial>
qmake: | QT += 3drender
Since: | Qt 5.5
Instantiated By: | Material
Inherits: | Qt3DCore::QComponent
Inherited By: | Qt3DExtras::QDiffuseMapMaterial, Qt3DExtras::QDiffuseSpecularMapMaterial, Qt3DExtras::QGoochMaterial, Qt3DExtras::QNormalDiffuseMapMaterial, Qt3DExtras::QNormalDiffuseSpecularMapMaterial, Qt3DExtras::QPerVertexColorMaterial, Qt3DExtras::QPhongAlphaMaterial, and Qt3DExtras::QPhongMaterial

- List of all members, including inherited members

## Properties

- effect : Qt3DRender::QEffect *

- 1 property inherited from Qt3DCore::QComponent
- 2 properties inherited from Qt3DCore::QNode

## Public Functions

| QMaterial(Qt3DCore::QNode *parent = nullptr)
| ~QMaterial()
void | addParameter(QParameter *parameter)
QEffect * | effect() const
QVector<QParameter *> | parameters() const
void | removeParameter(QParameter *parameter)

- 2 public functions inherited from Qt3DCore::QComponent
- 6 public functions inherited from Qt3DCore::QNode

## Public Slots

void | setEffect(QEffect *effect)

- 1 public slot inherited from Qt3DCore::QComponent
- 2 public slots inherited from Qt3DCore::QNode

## Signals

void | effectChanged(QEffect *effect)

- 1 signal inherited from Qt3DCore::QComponent
- 3 signals inherited from Qt3DCore::QNode

## Protected Functions

| QMaterial(QMaterialPrivate &dd, Qt3DCore::QNode *parent = nullptr)

- 2 protected functions inherited from Qt3DCore::QNode

## Detailed Description

Provides an abstract class that should be the base of all material component classes in a scene.

QMaterial provides a way to specify the rendering of an entity. Any aspect can define its own subclass of QMaterial so that a Material can be used to describe a visual element; for example, the way sound should reflect off an element, the temperature of a surface, and so on.

See also QEffect.

## Property Documentation

### effect : Qt3DRender::QEffect *

Specifies the effect to be used with the material.

Access functions:

QEffect * | effect() const
void | setEffect(QEffect *effect)

Notifier signal:

void | effectChanged(QEffect *effect)

## Member Function Documentation

### QMaterial::QMaterial(Qt3DCore::QNode *parent = nullptr)

Default constructs an instance of QMaterial.

### `[protected]` QMaterial::QMaterial(QMaterialPrivate &dd, Qt3DCore::QNode *parent = nullptr)

Copy constructor.

### QMaterial::~QMaterial()

Destroys the instance of QMaterial.

### void QMaterial::addParameter(QParameter *parameter)

Add a parameter to the material's parameters.

### QVector<QParameter *> QMaterial::parameters() const

Returns a vector of the material's current parameters

### void QMaterial::removeParameter(QParameter *parameter)

Remove a parameter from the material's parameters.