QSurfaceDataProxy Class

The QSurfaceDataProxy class is the data proxy for a 3D surface graph. More...

Header: #include <QSurfaceDataProxy>
CMake: find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs)
qmake: QT += graphs
In QML: SurfaceDataProxy
Inherits: QAbstractDataProxy
Inherited By:

QHeightMapSurfaceDataProxy and QItemModelSurfaceDataProxy

Properties

Public Functions

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

Signals

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

Detailed Description

A surface data proxy handles surface related data in rows. For this it provides two auxiliary type aliases: QtGraphs::QSurfaceDataArray and QtGraphs::QSurfaceDataRow. QSurfaceDataArray is a QList that controls the rows. QSurfaceDataRow is a QList that contains QSurfaceDataItem objects. For more information about how to feed the data to the proxy, see the sample code in the Q3DSurfaceWidgetItem documentation. Since data is stored in series, it is necessary to create a series associated with the proxy before using these functions for the dataset.

All rows must have the same number of items.

QSurfaceDataProxy takes ownership of all QSurfaceDataRow objects passed to it, whether directly or in a QSurfaceDataArray container. To use surface data row pointers to directly modify data after adding the array to the proxy, the appropriate signal must be emitted to update the graph.

To make a sensible surface, the x-value of each successive item in all rows must be either ascending or descending throughout the row. Similarly, the z-value of each successive item in all columns must be either ascending or descending throughout the column.

Note: Currently only surfaces with straight rows and columns are fully supported. Any row with items that do not have the exact same z-value or any column with items that do not have the exact same x-value may get clipped incorrectly if the whole surface does not completely fit within the visible x-axis or z-axis ranges.

Note: Surfaces with less than two rows or columns are not considered valid surfaces and will not be rendered.

Note: On some environments, surfaces with a lot of visible vertices may not render, because they exceed the per-draw vertex count supported by the graphics driver. This is mostly an issue on 32-bit and OpenGL ES2 platforms.

See also Qt Graphs Data Handling with 3D.

Property Documentation

[read-only] columnCount : const qsizetype

This property holds the number of columns in the data array.

Access functions:

qsizetype columnCount() const

Notifier signal:

void columnCountChanged(qsizetype count)

[read-only] rowCount : const qsizetype

This property holds the number of rows in the data array.

Access functions:

qsizetype rowCount() const

Notifier signal:

void rowCountChanged(qsizetype count)

[read-only] series : QSurface3DSeries* const

This property holds the series this proxy is attached to.

Access functions:

QSurface3DSeries *series() const

Notifier signal:

void seriesChanged(QSurface3DSeries *series)

Member Function Documentation

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

Constructs QSurfaceDataProxy with the given parent.

[override virtual noexcept] QSurfaceDataProxy::~QSurfaceDataProxy()

Deletes the surface data proxy.

qsizetype QSurfaceDataProxy::addRow(QSurfaceDataRow row)

Adds the new row row to the end of an array. The new row must have the same number of columns as the rows in the initial array.

Returns the index of the added row.

qsizetype QSurfaceDataProxy::addRows(QSurfaceDataArray rows)

Adds new rows to the end of an array. The new rows must have the same number of columns as the rows in the initial array.

Returns the index of the first added row.

[signal] void QSurfaceDataProxy::arrayReset()

This signal is emitted when the data array is reset. If the contents of the whole array are changed without calling resetArray(), this signal needs to be emitted to update the graph.

void QSurfaceDataProxy::insertRow(qsizetype rowIndex, QSurfaceDataRow row)

Inserts the new row row into rowIndex. If rowIndex is equal to the array size, the rows are added to the end of the array. The new row must have the same number of columns as the rows in the initial array.

void QSurfaceDataProxy::insertRows(qsizetype rowIndex, QSurfaceDataArray rows)

Inserts new rows into rowIndex. If rowIndex is equal to the array size, the rows are added to the end of the array. The new rows must have the same number of columns as the rows in the initial array.

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

Returns the pointer to the item at the position position. The x-value of position indicates the row and the y-value indicates the column. The item is guaranteed to be valid only until the next call that modifies data.

const QSurfaceDataItem &QSurfaceDataProxy::itemAt(qsizetype rowIndex, qsizetype columnIndex) const

Returns the pointer to the item at the position specified by rowIndex and columnIndex. It is guaranteed to be valid only until the next call that modifies data.

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

This signal is emitted when the item at the position specified by rowIndex and columnIndex changes. If the item is changed in the array without calling setItem(), this signal needs to be emitted to update the graph.

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

Removes the number of rows specified by removeCount starting at the position rowIndex. Attempting to remove rows past the end of the array does nothing.

void QSurfaceDataProxy::resetArray()

Clears the existing array and triggers the arrayReset() signal.

void QSurfaceDataProxy::resetArray(QSurfaceDataArray newArray)

* Sets the array from newArray. If the new array is equal to the * existing one, this function simply triggers the arrayReset() signal.

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

This signal is emitted when the number of rows specified by count is added, starting at the position startIndex. If rows are added to the array without calling addRow() or addRows(), this signal needs to be emitted to update the graph.

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

This signal is emitted when the number of rows specified by count is changed, starting at the position startIndex. If rows are changed in the array without calling setRow() or setRows(), this signal needs to be emitted to update the graph.

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

This signal is emitted when the number of rows specified by count is inserted at the position startIndex.

If rows are inserted into the array without calling insertRow() or insertRows(), this signal needs to be emitted to update the graph.

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

This signal is emitted when the number of rows specified by count is removed, starting at the position startIndex.

The index is the current array size if the rows were removed from the end of the array. If rows are removed from the array without calling removeRows(), this signal needs to be emitted to update the graph.

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

Changes a single item at the position position to the item item. The x-value of position indicates the row and the y-value indicates the column.

void QSurfaceDataProxy::setItem(qsizetype rowIndex, qsizetype columnIndex, QSurfaceDataItem item)

Changes a single item at the position specified by rowIndex and columnIndex to the item item.

void QSurfaceDataProxy::setRow(qsizetype rowIndex, QSurfaceDataRow row)

Changes an existing row by replacing the row at the position rowIndex with the new row specified by row. The new row can be the same as the existing row already stored at the rowIndex. The new row must have the same number of columns as the row it is replacing.

void QSurfaceDataProxy::setRows(qsizetype rowIndex, QSurfaceDataArray rows)

Changes existing rows by replacing the rows starting at the position rowIndex with the new rows specifies by rows. The rows in the rows array can be the same as the existing rows already stored at the rowIndex. The new rows must have the same number of columns as the rows they are replacing.

Related Non-Members

[alias] QSurfaceDataArray

A list of pointers to QSurfaceDataRow objects.

[alias] QSurfaceDataRow

A list of QSurfaceDataItem objects.