QCustom3DItem Class
The QCustom3DItem class adds a custom item to a graph. More...
Header: | #include <QCustom3DItem> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS DataVisualization) target_link_libraries(mytarget PRIVATE Qt6::DataVisualization) |
qmake: | QT += datavisualization |
Since: | QtDataVisualization 1.1 |
Instantiated By: | Custom3DItem |
Inherited By: |
Properties
|
|
Public Functions
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() |
void | setPosition() |
void | setPositionAbsolute() |
void | setRotation() |
void | setScaling() |
void | setScalingAbsolute() |
void | setShadowCasting() |
void | setTextureFile() |
void | setVisible() |
QString | textureFile() const |
Signals
void | meshFileChanged() |
void | positionAbsoluteChanged() |
void | positionChanged() |
void | rotationChanged() |
void | scalingAbsoluteChanged() |
void | scalingChanged() |
void | shadowCastingChanged() |
void | textureFileChanged() |
void | visibleChanged() |
Detailed Description
A custom item has a custom mesh, position, scaling, rotation, and an optional texture.
See also QAbstract3DGraph::addCustomItem().
Property Documentation
meshFile : QString
This property holds the item mesh file name.
The item in the file must be in Wavefront OBJ format and include vertices, normals, and UVs. It also needs to be in triangles. If the file is missing either normals or UVs, loading will fail with an error message to the console output and the item will not be rendered.
Access functions:
QString | meshFile() const |
void | setMeshFile() |
Notifier signal:
void | meshFileChanged() |
position : QVector3D
This property holds the item position as a QVector3D.
Defaults to QVector3D(0.0, 0.0, 0.0)
.
Item position is specified either in data coordinates or in absolute coordinates, depending on the 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() |
Notifier signal:
void | positionChanged() |
See also positionAbsolute.
positionAbsolute : bool
This property holds whether 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() |
Notifier signal:
void | positionAbsoluteChanged() |
See also position.
rotation : QQuaternion
This property holds the item rotation as a QQuaternion.
Defaults to QQuaternion(0.0, 0.0, 0.0, 0.0)
.
Access functions:
QQuaternion | rotation() |
void | setRotation() |
Notifier signal:
void | rotationChanged() |
scaling : QVector3D
This property 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 have not been changed from the defaults.
Access functions:
QVector3D | scaling() const |
void | setScaling() |
Notifier signal:
void | scalingChanged() |
See also scalingAbsolute.
[since QtDataVisualization 1.2]
scalingAbsolute : bool
This property holds whether 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 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 the 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() |
Notifier signal:
void | scalingAbsoluteChanged() |
See also scaling and positionAbsolute.
shadowCasting : bool
This property holds whether shadow casting for the item is enabled.
Defaults to true
. If false
, the item does not cast shadows regardless of QAbstract3DGraph::ShadowQuality.
Access functions:
bool | isShadowCasting() const |
void | setShadowCasting() |
Notifier signal:
void | shadowCastingChanged() |
textureFile : QString
This property holds the texture file name for the item.
If both this property and the 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() |
Notifier signal:
void | textureFileChanged() |
visible : bool
This property holds the visibility of the item.
Defaults to true
.
Access functions:
bool | isVisible() const |
void | setVisible() |
Notifier signal:
void | visibleChanged() |
Member Function Documentation
[virtual]
QCustom3DItem::~QCustom3DItem()
Deletes the custom 3D item.