QSurfaceDataProxy Class
QSurfaceDataProxy 类是三维曲面图的数据代理。更多
头文件: | #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 |
继承于: |
属性
- columnCount : const int
- rowCount : const int
- series : QSurface3DSeries* const
公共功能
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
是包含QSurfaceDataItem 对象的QList 。有关如何向代理馈送数据的详细信息,请参阅Q3DSurface 文档中的示例代码。
所有行的条目数必须相同。
QSurfaceDataProxy 拥有传递给它的所有QSurfaceDataRow
对象的所有权,无论是直接传递还是在QSurfaceDataArray
容器中传递。将数组添加到代理后,要使用曲面数据行指针直接修改数据,必须发出适当的信号以更新图形。
要制作合理的曲面,所有行中每个连续项的 x 值必须在整行中以升或降的方式排列。同样,所有列中每个连续项的 z 值也必须在整列中升高或降低。
注: 目前只完全支持直行直列的曲面。如果整个曲面不完全符合可见的 x 轴或 z 轴范围,则包含 Z 值不完全相同的项的任何行或包含 X 值不完全相同的项的任何列都可能被错误剪切。
注: 少于两行或两列的曲面不会被视为有效曲面,也不会被渲染。
注: 在某些环境下,具有大量可见顶点的曲面可能无法渲染,因为它们超出了图形驱动程序支持的每次绘制顶点数。这主要是 32 位和 OpenGL ES2 平台上的问题。
另请参阅 Qt Data Visualization 数据处理。
属性文档
[read-only]
columnCount : const int
该属性用于保存数据数组中的列数。
访问功能:
int | columnCount() const |
通知信号
void | columnCountChanged(int count) |
[read-only]
rowCount : const int
该属性保存数据数组中的行数。
访问功能:
int | rowCount() const |
通知信号
void | rowCountChanged(int count) |
[read-only]
series : QSurface3DSeries* const
此属性表示此代理所连接的系列。
访问功能:
QSurface3DSeries * | series() const |
Notifier 信号:
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)
当count 指定的行数从startIndex 位置开始发生变化时,将发出该信号。如果数组中的行数在未调用setRow() 或setRows() 的情况下发生变化,则需要发出此信号以更新图形。
[signal]
void QSurfaceDataProxy::rowsInserted(int startIndex, int count)
当count 指定的行数被插入startIndex 的位置时,就会发出该信号。
如果在未调用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)
用row 指定的新行替换rowIndex 位置的行,从而更改现有行。新行可以与已存储在rowIndex 的现有行相同。新行的列数必须与被替换行相同。
void QSurfaceDataProxy::setRows(int rowIndex, const QSurfaceDataArray &rows)
用rows 指定的新行替换从rowIndex 位置开始的行,从而更改现有行。rows 数组中的行可以与已存储在rowIndex 的现有行相同。新行的列数必须与被替换行的列数相同。
© 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.