本页内容

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 轴的标题
@zTitlez 轴的标题
@xLabel使用 x 轴格式格式化的项目值。有关详细信息,请参阅QValue3DAxis::setLabelFormat()。
@yLabel使用y轴格式设置的项目值。有关详细信息,请参阅QValue3DAxis::setLabelFormat()。
@zLabel项目值采用 z 轴的格式进行格式化。有关详细信息,请参阅QValue3DAxis::setLabelFormat()。
@seriesName系列名称

例如:

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

另请参阅 Qt Data Visualization 数据处理。

成员类型文档

enum QSurface3DSeries::DrawFlag
flags QSurface3DSeries::DrawFlags

曲面的绘制模式。该枚举的取值可与“或”(OR)运算符结合使用。

常量值描述
QSurface3DSeries::DrawWireframe1仅绘制网格。
QSurface3DSeries::DrawSurface2仅绘制曲面。
QSurface3DSeries::DrawSurfaceAndWireframeDrawWireframe | DrawSurface同时绘制曲面和网格。

DrawFlags 类型是QFlags<DrawFlag> 的 typedef。它存储 DrawFlag 值的按“或”运算组合。

属性文档

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 : bool

该属性用于指示当前系统是否支持曲面平铺着色。

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

注意:此 只读属性将在首次渲染通过后设置为正确值。在此之前,其值始终为true 。

访问函数:

bool isFlatShadingSupported() const

通知器信号:

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)

通知器信号:

void wireframeColorChanged(const QColor &color)

成员函数文档

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

使用父对象parent 构建一个曲面3D系列。

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

使用数据代理dataProxy 和父对象parent 构建一个3D曲面系列。

[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()。

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