本页内容

QSurfaceDataProxy Class

QSurfaceDataProxy 类是 3D 曲面图的数据代理。更多内容...

头文件: #include <QSurfaceDataProxy>
CMake: find_package(Qt6 REQUIRED COMPONENTS DataVisualization)
target_link_libraries(mytarget PRIVATE Qt6::DataVisualization)
qmake: QT += datavisualization
自: QtDataVisualization 1.0
在 QML 中: SurfaceDataProxy
继承自: QAbstractDataProxy
被继承者:

QHeightMapSurfaceDataProxy 以及QItemModelSurfaceDataProxy

状态: 已弃用

该类已弃用。我们强烈建议不要在新代码中使用它。

属性

公共函数

QSurfaceDataProxy(QObject *parent = nullptr)
virtual ~QSurfaceDataProxy()
int addRow(QSurfaceDataRow *row)
int addRows(const QSurfaceDataArray &rows)
const QSurfaceDataArray *array() const
int columnCount() const
void insertRow(int rowIndex, QSurfaceDataRow *row)
void insertRows(int rowIndex, const QSurfaceDataArray &rows)
const QSurfaceDataItem *itemAt(const QPoint &position) const
const QSurfaceDataItem *itemAt(int rowIndex, int columnIndex) const
void removeRows(int rowIndex, int removeCount)
void resetArray(QSurfaceDataArray *newArray)
int rowCount() const
QSurface3DSeries *series() const
void setItem(const QPoint &position, const QSurfaceDataItem &item)
void setItem(int rowIndex, int columnIndex, const QSurfaceDataItem &item)
void setRow(int rowIndex, QSurfaceDataRow *row)
void setRows(int rowIndex, const QSurfaceDataArray &rows)

信号

void arrayReset()
void columnCountChanged(int count)
void itemChanged(int rowIndex, int columnIndex)
void rowCountChanged(int count)
void rowsAdded(int startIndex, int count)
void rowsChanged(int startIndex, int count)
void rowsInserted(int startIndex, int count)
void rowsRemoved(int startIndex, int count)
void seriesChanged(QSurface3DSeries *series)

详细说明

表面数据代理以行为单位处理与表面相关的数据。为此,它提供了两个辅助类型定义:QtDataVisualization::QSurfaceDataArray 和 QtDataVisualization::QSurfaceDataRow。QSurfaceDataArray 是一个用于控制行的QList 。QSurfaceDataRow 是一个QList ,其中包含QSurfaceDataItem 对象。 有关如何将数据提供给代理的更多信息,请参阅Q3DSurface 文档中的示例代码。

所有行必须具有相同数量的项目。

QSurfaceDataProxy 会拥有传入的所有QSurfaceDataRow 对象的所有权,无论这些对象是直接传入的,还是通过QSurfaceDataArray 容器传入的。若要在将数组添加到代理后使用表面数据行指针直接修改数据,必须发出相应的信号以更新图形。

要构建合理的表面,所有行中每个相邻项的 x 值在整行范围内必须呈递增或递减趋势。同样,所有列中每个相邻项的 z 值在整列范围内必须呈递增或递减趋势。

注意:目前仅 完全支持行和列均为直线的曲面。如果整个曲面无法完全位于可见的 x 轴或 z 轴范围内,则任何行中元素的 z 值不完全相同,或任何列中元素的 x 值不完全相同的曲面,都可能出现裁剪错误。

注意: 行数或列数少于两的曲面 不被视为有效曲面,因此不会被渲染。

注意:在某些环境中, 具有大量可见顶点的曲面可能无法渲染,因为它们超出了图形驱动程序支持的每次渲染顶点数限制。这主要发生在 32 位和 OpenGL ES2 平台上。

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

属性文档

[read-only] columnCount : int

该属性存储数据数组中的列数。

访问函数:

int columnCount() const

通知信号:

void columnCountChanged(int count)

[read-only] rowCount : int

该属性存储数据数组中的行数。

访问函数:

int rowCount() const

通知信号:

void rowCountChanged(int count)

[read-only] series : QSurface3DSeries*

该属性保存了此代理所关联的系列。

访问函数:

QSurface3DSeries *series() const

通知器信号:

void seriesChanged(QSurface3DSeries *series)

成员函数文档

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

使用给定的parent 实例化QSurfaceDataProxy。

[virtual noexcept] QSurfaceDataProxy::~QSurfaceDataProxy()

删除曲面数据代理。

int QSurfaceDataProxy::addRow(QSurfaceDataRow *row)

将新行row 添加到数组的末尾。新行必须与初始数组中的行具有相同的列数。

返回已添加行的索引。

int QSurfaceDataProxy::addRows(const QSurfaceDataArray &rows)

将新的rows 添加到数组的末尾。新行必须与初始数组中的行具有相同的列数。

返回第一个添加行的索引。

const QSurfaceDataArray *QSurfaceDataProxy::array() const

返回指向数据数组的指针。

[signal] void QSurfaceDataProxy::arrayReset()

当数据数组被重置时,会发出此信号。如果在未调用resetArray()的情况下更改了整个数组的内容,则需要发出此信号以更新图形。

void QSurfaceDataProxy::insertRow(int rowIndex, QSurfaceDataRow *row)

将新行row 插入到rowIndex 中。如果rowIndex 等于数组大小,则新行将被添加到数组末尾。新行的列数必须与初始数组中各行的列数相同。

void QSurfaceDataProxy::insertRows(int rowIndex, const QSurfaceDataArray &rows)

将新的rows 插入到rowIndex 中。如果rowIndex 等于数组大小,则行将添加到数组的末尾。新的rows 必须与初始数组中的行数具有相同的列数。

const QSurfaceDataItem *QSurfaceDataProxy::itemAt(const QPoint &position) const

position 返回位于坐标position 处项的指针。坐标 中的x值表示行,y值表示列。该项的有效性仅保证至下一次修改数据的调用为止。

const QSurfaceDataItem *QSurfaceDataProxy::itemAt(int rowIndex, int columnIndex) const

返回指向由 `rowIndex ` 和 `columnIndex` 指定的位置处的项的指针。该指针仅在下次调用修改数据之前保证有效。

[signal] void QSurfaceDataProxy::itemChanged(int rowIndex, int columnIndex)

当位于rowIndex 和columnIndex 所指定位置的项目发生变化时,会触发此信号。如果在数组中修改了该项目而未调用setItem(),则需要触发此信号以更新图形。

void QSurfaceDataProxy::removeRows(int rowIndex, int removeCount)

删除从位置rowIndex 开始、行数为removeCount 所指定的行。若尝试删除数组末尾之后的行,则不执行任何操作。

void QSurfaceDataProxy::resetArray(QSurfaceDataArray *newArray)

接管数组newArray 的所有权。如果新数组与该数组不同,则清空现有数组。如果两个数组相同,则该函数仅触发arrayReset()信号。

传递一个空数组将删除旧数组并创建一个新的空数组。newArray 中的所有行必须具有相同的长度。

[signal] void QSurfaceDataProxy::rowsAdded(int startIndex, int count)

当从位置startIndex 开始添加由count 指定的行数时,将发出此信号。如果在未调用addRow()或addRows()的情况下向数组添加行,则需要发出此信号以更新图形。

[signal] void QSurfaceDataProxy::rowsChanged(int startIndex, int count)

当从位置startIndex 开始更改由count 指定的行数时,将发出此信号。如果在未调用setRow() 或setRows() 的情况下更改数组中的行,则需要发出此信号以更新图表。

[signal] void QSurfaceDataProxy::rowsInserted(int startIndex, int count)

当在位置startIndex 插入由count 指定的行数时,会触发此信号。

如果未调用insertRow() 或insertRows() 便向数组中插入行,则需要发出此信号以更新图形。

[signal] void QSurfaceDataProxy::rowsRemoved(int startIndex, int count)

当从位置startIndex 开始移除由 `count ` 指定的行数时,会发出此信号。

如果从数组末尾移除了行,则该索引即为当前数组大小。如果未调用removeRows() 函数就从数组中移除了行,则需要发出此信号以更新图形。

void QSurfaceDataProxy::setItem(const QPoint &position, const QSurfaceDataItem &item)

将位于坐标position 处的单个项目更改为项目item 。坐标position 中的x值表示行,y值表示列。

void QSurfaceDataProxy::setItem(int rowIndex, int columnIndex, const QSurfaceDataItem &item)

将位于rowIndex 和columnIndex 指定位置的单个项目更改为项目item 。

void QSurfaceDataProxy::setRow(int rowIndex, QSurfaceDataRow *row)

通过将位于位置rowIndex 的行替换为由row 指定的新行,来修改现有行。新行可以与已存储在rowIndex 位置的现有行相同。新行的列数必须与被替换的行相同。

void QSurfaceDataProxy::setRows(int rowIndex, const QSurfaceDataArray &rows)

通过将从位置rowIndex 开始的行替换为由rows 指定的新行,来修改现有行。rows 数组中的行可以与已存储在rowIndex 中的现有行相同。新行必须与被替换的行具有相同的列数。

相关非成员

QSurfaceDataArray

一个指向QSurfaceDataRow 对象的指针列表。

QSurfaceDataRow

QSurfaceDataItem 对象的列表。

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