QSurface3DSeries Class
The QSurface3DSeries class represents a data series in a 3D surface graph. More...
Header: | #include <QSurface3DSeries> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS DataVisualization) target_link_libraries(mytarget PRIVATE Qt6::DataVisualization) |
qmake: | QT += datavisualization |
Since: | QtDataVisualization 1.0 |
Instantiated By: | Surface3DSeries |
Inherits: | QAbstract3DSeries |
Public Types
Properties
|
|
Public Functions
QSurface3DSeries(QObject *parent = nullptr) | |
QSurface3DSeries(QSurfaceDataProxy *dataProxy, QObject *parent = nullptr) | |
virtual | ~QSurface3DSeries() |
QSurfaceDataProxy * | dataProxy() const |
QSurface3DSeries::DrawFlags | drawMode() const |
bool | isFlatShadingEnabled() const |
bool | isFlatShadingSupported() const |
QPoint | selectedPoint() const |
void | setDataProxy(QSurfaceDataProxy *proxy) |
void | setDrawMode(QSurface3DSeries::DrawFlags mode) |
void | setFlatShadingEnabled(bool enabled) |
void | setSelectedPoint(const QPoint &position) |
void | setTexture(const QImage &texture) |
void | setTextureFile(const QString &filename) |
void | setWireframeColor(const QColor &color) |
QImage | texture() const |
QString | textureFile() const |
QColor | wireframeColor() const |
Signals
void | dataProxyChanged(QSurfaceDataProxy *proxy) |
void | drawModeChanged(QSurface3DSeries::DrawFlags mode) |
void | flatShadingEnabledChanged(bool enable) |
void | flatShadingSupportedChanged(bool enable) |
void | selectedPointChanged(const QPoint &position) |
void | textureChanged(const QImage &image) |
void | textureFileChanged(const QString &filename) |
void | wireframeColorChanged(const QColor &color) |
Static Public Members
QPoint | invalidSelectionPosition() |
Detailed Description
This class manages the series specific visual elements, as well as the series data (via a data proxy).
If no data proxy is set explicitly for the series, the series creates a default proxy. Setting another proxy will destroy the existing proxy and all data added to it.
The object mesh set via the QAbstract3DSeries::mesh property defines the selection pointer shape in a surface series.
QSurface3DSeries supports the following format tags for QAbstract3DSeries::setItemLabelFormat():
@xTitle | Title from x-axis |
@yTitle | Title from y-axis |
@zTitle | Title from z-axis |
@xLabel | Item value formatted using the format of the x-axis. For more information, see QValue3DAxis::setLabelFormat(). |
@yLabel | Item value formatted using the format of the y-axis. For more information, see QValue3DAxis::setLabelFormat(). |
@zLabel | Item value formatted using the format of the z-axis. For more information, see QValue3DAxis::setLabelFormat(). |
@seriesName | Name of the series |
For example:
proxy->setItemLabelFormat(QStringLiteral("@valueTitle for (@rowLabel, @colLabel): %.1f"));
See also Qt Data Visualization Data Handling.
Member Type Documentation
enum QSurface3DSeries::DrawFlag
flags QSurface3DSeries::DrawFlags
The drawing mode of the surface. Values of this enumeration can be combined with the OR operator.
Constant | Value | Description |
---|---|---|
QSurface3DSeries::DrawWireframe | 1 | Only the grid is drawn. |
QSurface3DSeries::DrawSurface | 2 | Only the surface is drawn. |
QSurface3DSeries::DrawSurfaceAndWireframe | DrawWireframe | DrawSurface | Both the surface and grid are drawn. |
The DrawFlags type is a typedef for QFlags<DrawFlag>. It stores an OR combination of DrawFlag values.
Property Documentation
dataProxy : QSurfaceDataProxy*
This property holds the active data proxy.
The series assumes ownership of any proxy set to it and deletes any previously set proxy when a new one is added. The proxy cannot be null or set to another series.
Access functions:
QSurfaceDataProxy * | dataProxy() const |
void | setDataProxy(QSurfaceDataProxy *proxy) |
Notifier signal:
void | dataProxyChanged(QSurfaceDataProxy *proxy) |
drawMode : DrawFlags
The drawing mode.
Possible values are the values of DrawFlag. Clearing all flags is not allowed.
Access functions:
QSurface3DSeries::DrawFlags | drawMode() const |
void | setDrawMode(QSurface3DSeries::DrawFlags mode) |
Notifier signal:
void | drawModeChanged(QSurface3DSeries::DrawFlags mode) |
flatShadingEnabled : bool
This property holds whether surface flat shading is enabled.
Preset to true
by default.
When disabled, the normals on the surface are interpolated making the edges look round. When enabled, the normals are kept the same on a triangle making the color of the triangle solid. This makes the data more readable from the model.
Note: Flat shaded surfaces require at least GLSL version 1.2 with GL_EXT_gpu_shader4 extension. The value of the flatShadingSupported property indicates whether flat shading is supported at runtime.
Access functions:
bool | isFlatShadingEnabled() const |
void | setFlatShadingEnabled(bool enabled) |
Notifier signal:
void | flatShadingEnabledChanged(bool enable) |
[read-only]
flatShadingSupported : const bool
This property holds whether surface flat shading is supported by the current system.
Flat shading for surfaces requires at least GLSL version 1.2 with GL_EXT_gpu_shader4 extension. If true
, flat shading for surfaces is supported.
Note: This read-only property is set to its correct value after the first render pass. Until then it is always true
.
Access functions:
bool | isFlatShadingSupported() const |
Notifier signal:
void | flatShadingSupportedChanged(bool enable) |
selectedPoint : QPoint
This property holds the surface grid point that is selected in the series.
Access functions:
QPoint | selectedPoint() const |
void | setSelectedPoint(const QPoint &position) |
Notifier signal:
void | selectedPointChanged(const QPoint &position) |
texture : QImage
This property holds the texture for the surface as a QImage.
Setting an empty QImage clears the texture.
Access functions:
QImage | texture() const |
void | setTexture(const QImage &texture) |
Notifier signal:
void | textureChanged(const QImage &image) |
textureFile : QString
This property holds the texture for the surface as a file.
Setting an empty file name clears the texture.
Access functions:
QString | textureFile() const |
void | setTextureFile(const QString &filename) |
Notifier signal:
void | textureFileChanged(const QString &filename) |
[since 6.3]
wireframeColor : QColor
This property holds the color for the surface wireframe.
This property was introduced in Qt 6.3.
Access functions:
QColor | wireframeColor() const |
void | setWireframeColor(const QColor &color) |
Notifier signal:
void | wireframeColorChanged(const QColor &color) |
Member Function Documentation
[explicit]
QSurface3DSeries::QSurface3DSeries(QObject *parent = nullptr)
Constructs a surface 3D series with the parent parent.
[explicit]
QSurface3DSeries::QSurface3DSeries(QSurfaceDataProxy *dataProxy, QObject *parent = nullptr)
Constructs a surface 3D series with the data proxy dataProxy and the parent parent.
[virtual noexcept]
QSurface3DSeries::~QSurface3DSeries()
Deletes the surface 3D series.
[static]
QPoint QSurface3DSeries::invalidSelectionPosition()
Returns the QPoint signifying an invalid selection position. This is set to the selectedPoint property to clear the selection from this series.
See also QAbstract3DGraph::clearSelection().
void QSurface3DSeries::setSelectedPoint(const QPoint &position)
Selects a surface grid point at the position position in the data array of the series specified by a row and a column.
Only one point can be selected at a time.
To clear selection from this series, invalidSelectionPosition() is set as position. If this series is added to a graph, the graph can adjust the selection according to user interaction or if it becomes invalid.
Removing rows from or inserting rows to the series before the row of the selected point will adjust the selection so that the same point will stay selected.
Note: Setter function for property selectedPoint.
See also selectedPoint() and QAbstract3DGraph::clearSelection().