QSurface3DSeries Class

QSurface3DSeries 类表示三维曲面图中的数据序列。更多

头文件: #include <QSurface3DSeries>
CMake: find_package(Qt6 REQUIRED COMPONENTS DataVisualization)
target_link_libraries(mytarget PRIVATE Qt6::DataVisualization)
qmake: QT += datavisualization
QtDataVisualization 1.0
在 QML 中: Surface3DSeries
继承: QAbstract3DSeries

公共类型

enum DrawFlag { DrawWireframe, DrawSurface, DrawSurfaceAndWireframe }
flags DrawFlags

属性

公共功能

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

信号

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)

静态公共成员

详细说明

该类管理系列的特定可视化元素以及系列数据(通过数据代理)。

如果没有为系列明确设置数据代理,则系列会创建一个默认代理。设置另一个代理将销毁现有代理和添加到其中的所有数据。

通过QAbstract3DSeries::mesh 属性设置的对象网格定义了曲面系列中的选择指针形状。

QSurface3DSeries 支持以下用于QAbstract3DSeries::setItemLabelFormat() 的格式标记:

@xTitle来自 x 轴的标题
@yTitle来自 y 轴的标题
@zTitle来自 Z 轴的标题
@xLabel使用 x 轴格式的项目值。更多信息,请参阅QValue3DAxis::setLabelFormat() 。
y 标签使用 Y 轴格式的项目值。更多信息,请参见QValue3DAxis::setLabelFormat().
@zLabel使用 Z 轴格式的项目值。更多信息,请参阅QValue3DAxis::setLabelFormat().
@seriesName系列名称

例如

proxy->setItemLabelFormat(QStringLiteral("@valueTitle for (@rowLabel, @colLabel): %.1f"));

另请参阅 Qt Data Visualization 数据处理

成员类型文档

枚举 QSurface3DSeries::DrawFlag
flags QSurface3DSeries::DrawFlags

曲面的绘制模式。此枚举的值可与 OR 运算符组合。

常量说明
QSurface3DSeries::DrawWireframe1只绘制网格。
QSurface3DSeries::DrawSurface2只绘制曲面。
QSurface3DSeries::DrawSurfaceAndWireframeDrawWireframe | DrawSurface同时绘制曲面和网格。

DrawFlags 类型是QFlags<DrawFlag> 的类型定义。它存储 DrawFlag 值的 OR 组合。

属性文档

dataProxy : QSurfaceDataProxy*

此属性保存活动数据代理。

该系列拥有任何设置给它的代理的所有权,并在添加新代理时删除任何以前设置的代理。代理不能为空或设置为其他系列。

访问功能:

QSurfaceDataProxy *dataProxy() const
void setDataProxy(QSurfaceDataProxy *proxy)

通知信号:

void dataProxyChanged(QSurfaceDataProxy *proxy)

drawMode : DrawFlags

绘图模式。

可能的值是DrawFlag 的值。不允许清除所有标记。

访问功能:

QSurface3DSeries::DrawFlags drawMode() const
void setDrawMode(QSurface3DSeries::DrawFlags mode)

通知信号:

void drawModeChanged(QSurface3DSeries::DrawFlags mode)

flatShadingEnabled : bool

此属性表示是否启用曲面平铺阴影。

默认设置为true

禁用时,曲面上的法线将被内插,使边缘看起来更圆。启用后,三角形上的法线将保持不变,使三角形的颜色为纯色。这将使数据更容易从模型中读取。

注意: 平着色曲面至少需要 GLSL 1.2 版本和 GL_EXT_gpu_shader4 扩展。flatShadingSupported 属性的值表示运行时是否支持平面着色。

访问功能:

bool isFlatShadingEnabled() const
void setFlatShadingEnabled(bool enabled)

通知信号

void flatShadingEnabledChanged(bool enable)

[read-only] flatShadingSupported : const bool

此属性表示当前系统是否支持曲面平铺着色。

曲面平铺着色至少需要 GLSL 1.2 版本和 GL_EXT_gpu_shader4 扩展。如果true ,则支持曲面平铺着色。

注意: 此只读属性会在第一次渲染后设置为正确值。在此之前,该值始终为true

访问功能:

bool isFlatShadingSupported() const

Notifier 信号:

void flatShadingSupportedChanged(bool enable)

selectedPoint : QPoint

该属性用于保存在序列中选中的表面网格点。

访问功能:

QPoint selectedPoint() const
void setSelectedPoint(const QPoint &position)

通知信号:

void selectedPointChanged(const QPoint &position)

texture : QImage

此属性以QImage 的形式保存曲面的纹理。

设置为空的QImage 会清除纹理。

访问功能:

QImage texture() const
void setTexture(const QImage &texture)

通知信号:

void textureChanged(const QImage &image)

textureFile : QString

此属性以文件形式保存曲面的纹理。

设置空文件名会清除纹理。

访问功能:

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

通知信号:

void textureFileChanged(const QString &filename)

[since 6.3] wireframeColor : QColor

该属性用于保存曲面线框的颜色。

此属性在 Qt 6.3 中引入。

访问函数:

QColor wireframeColor() const
void setWireframeColor(const QColor &color)

Notifier 信号:

void wireframeColorChanged(const QColor &color)

成员函数文档

[explicit] QSurface3DSeries::QSurface3DSeries(QObject *parent = nullptr)

使用父序列parent 构建曲面 3D 序列。

[explicit] QSurface3DSeries::QSurface3DSeries(QSurfaceDataProxy *dataProxy, QObject *parent = nullptr)

用数据代理dataProxy 和父数据parent 构建曲面三维序列。

[virtual noexcept] QSurface3DSeries::~QSurface3DSeries()

删除曲面 3D 系列。

[static] QPoint QSurface3DSeries::invalidSelectionPosition()

返回表示选择位置无效的QPoint 。将其设置为selectedPoint 属性可清除此系列中的选择。

另请参阅 QAbstract3DGraph::clearSelection().

void QSurface3DSeries::setSelectedPoint(const QPoint &position)

在由行和列指定的系列数据数组中的position 位置选择一个曲面网格点。

每次只能选择一个点。

要清除该系列的选择,invalidSelectionPosition() 设置为position 。如果将此序列添加到图表中,图表会根据用户交互或在选择无效时调整选择。

在所选点的行之前从系列中移除行或插入行将调整选区,使同一点保持被选中。

注: selectedPoint 属性的设置函数。

另请参阅 selectedPoint() 和QAbstract3DGraph::clearSelection()。

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