QCustom3DItem Class

The QCustom3DItem class is for creating custom items to be added to a graph. More...

Header: #include <QCustom3DItem>
Since: QtDataVisualization 1.1
Instantiated By: Custom3DItem
Inherits: QObject
Inherited By:

QCustom3DLabel and QCustom3DVolume

Properties

  • 1 property inherited from QObject

Public Functions

QCustom3DItem(QObject *parent = Q_NULLPTR)
QCustom3DItem(const QString &meshFile, const QVector3D &position, const QVector3D &scaling, const QQuaternion &rotation, const QImage &texture, QObject *parent = Q_NULLPTR)
virtual ~QCustom3DItem()
bool isPositionAbsolute() const
bool isScalingAbsolute() const
bool isShadowCasting() const
bool isVisible() const
QString meshFile() const
QVector3D position() const
QQuaternion rotation()
QVector3D scaling() const
void setMeshFile(const QString &meshFile)
void setPosition(const QVector3D &position)
void setPositionAbsolute(bool positionAbsolute)
void setRotation(const QQuaternion &rotation)
void setRotationAxisAndAngle(const QVector3D &axis, float angle)
void setScaling(const QVector3D &scaling)
void setScalingAbsolute(bool scalingAbsolute)
void setShadowCasting(bool enabled)
void setTextureFile(const QString &textureFile)
void setTextureImage(const QImage &textureImage)
void setVisible(bool visible)
QString textureFile() const
  • 31 public functions inherited from QObject

Signals

void meshFileChanged(const QString &meshFile)
void positionAbsoluteChanged(bool positionAbsolute)
void positionChanged(const QVector3D &position)
void rotationChanged(const QQuaternion &rotation)
void scalingAbsoluteChanged(bool scalingAbsolute)
void scalingChanged(const QVector3D &scaling)
void shadowCastingChanged(bool shadowCasting)
void textureFileChanged(const QString &textureFile)
void visibleChanged(bool visible)

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 11 static public members inherited from QObject
  • 9 protected functions inherited from QObject

Detailed Description

The QCustom3DItem class is for creating custom items to be added to a graph.

This class is for creating custom items to be added to a graph. The item has a custom mesh, position, scaling, rotation, and an optional texture.

See also QAbstract3DGraph::addCustomItem().

Property Documentation

meshFile : QString

Holds item mesh file name. Item in the file must be in Wavefront obj format and include vertices, normals, and UVs. It also needs to be in triangles.

Access functions:

QString meshFile() const
void setMeshFile(const QString &meshFile)

Notifier signal:

void meshFileChanged(const QString &meshFile)

position : QVector3D

Holds the item position as a QVector3D. Defaults to QVector3D(0.0, 0.0, 0.0).

Item position is either in data coordinates or in absolute coordinates, depending on positionAbsolute property. When using absolute coordinates, values between -1.0...1.0 are within axis ranges.

Note: Items positioned outside any axis range are not rendered if positionAbsolute is false, unless the item is a QCustom3DVolume that would be partially visible and scalingAbsolute is also false. In that case, the visible portion of the volume will be rendered.

Access functions:

QVector3D position() const
void setPosition(const QVector3D &position)

Notifier signal:

void positionChanged(const QVector3D &position)

See also positionAbsolute.

positionAbsolute : bool

This property dictates if item position is to be handled in data coordinates or in absolute coordinates. Defaults to false. Items with absolute coordinates will always be rendered, whereas items with data coordinates are only rendered if they are within axis ranges.

Access functions:

bool isPositionAbsolute() const
void setPositionAbsolute(bool positionAbsolute)

Notifier signal:

void positionAbsoluteChanged(bool positionAbsolute)

See also position.

rotation : QQuaternion

Holds the item rotation as a QQuaternion. Defaults to QQuaternion(0.0, 0.0, 0.0, 0.0).

Access functions:

QQuaternion rotation()
void setRotation(const QQuaternion &rotation)

Notifier signal:

void rotationChanged(const QQuaternion &rotation)

scaling : QVector3D

Holds the item scaling as a QVector3D. Defaults to QVector3D(0.1, 0.1, 0.1).

Item scaling is either in data values or in absolute values, depending on the scalingAbsolute property. The default vector interpreted as absolute values sets the item to 10% of the height of the graph, provided the item mesh is normalized and the graph aspect ratios haven't been changed from the defaults.

Access functions:

QVector3D scaling() const
void setScaling(const QVector3D &scaling)

Notifier signal:

void scalingChanged(const QVector3D &scaling)

See also scalingAbsolute.

scalingAbsolute : bool

This property dictates if item scaling is to be handled in data values or in absolute values. Defaults to true. Items with absolute scaling will be rendered at the same size, regardless of axis ranges. Items with data scaling will change their apparent size according to the axis ranges. If positionAbsolute value is true, this property is ignored and scaling is interpreted as an absolute value. If the item has rotation, the data scaling is calculated on the unrotated item. Similarly, for QCustom3DVolume items, the range clipping is calculated on the unrotated item.

Note: : Only absolute scaling is supported for QCustom3DLabel items or for custom items used in polar graphs.

Note: : The custom item's mesh must be normalized to range [-1 ,1], or the data scaling will not be accurate.

This property was introduced in QtDataVisualization 1.2.

Access functions:

bool isScalingAbsolute() const
void setScalingAbsolute(bool scalingAbsolute)

Notifier signal:

void scalingAbsoluteChanged(bool scalingAbsolute)

See also scaling and positionAbsolute.

shadowCasting : bool

Sets shadow casting for the item to enabled. Defaults to true. If set false, the item does not cast shadows regardless of QAbstract3DGraph::ShadowQuality.

Access functions:

bool isShadowCasting() const
void setShadowCasting(bool enabled)

Notifier signal:

void shadowCastingChanged(bool shadowCasting)

textureFile : QString

Holds the texture file name for the item. If both this and texture image are unset, a solid gray texture will be used.

Note: To conserve memory the QImage loaded from the file is cleared after a texture is created.

Access functions:

QString textureFile() const
void setTextureFile(const QString &textureFile)

Notifier signal:

void textureFileChanged(const QString &textureFile)

visible : bool

Sets the item visible. Defaults to true.

Access functions:

bool isVisible() const
void setVisible(bool visible)

Notifier signal:

void visibleChanged(bool visible)

Member Function Documentation

QCustom3DItem::QCustom3DItem(QObject *parent = Q_NULLPTR)

Constructs QCustom3DItem with given parent.

QCustom3DItem::QCustom3DItem(const QString &meshFile, const QVector3D &position, const QVector3D &scaling, const QQuaternion &rotation, const QImage &texture, QObject *parent = Q_NULLPTR)

Constructs QCustom3DItem with given meshFile, position, scaling, rotation, texture image, and optional parent.

[virtual] QCustom3DItem::~QCustom3DItem()

Destroys QCustom3DItem.

void QCustom3DItem::setRotationAxisAndAngle(const QVector3D &axis, float angle)

A convenience function to construct rotation quaternion from axis and angle.

See also rotation.

void QCustom3DItem::setTextureImage(const QImage &textureImage)

Set the textureImage as a QImage for the item. Texture defaults to solid gray.

Note: To conserve memory the given QImage is cleared after a texture is created.

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