diff options
Diffstat (limited to 'src/datavisualization/data/qsurfacedataproxy.cpp')
-rw-r--r-- | src/datavisualization/data/qsurfacedataproxy.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/datavisualization/data/qsurfacedataproxy.cpp b/src/datavisualization/data/qsurfacedataproxy.cpp index 43ce40eb..b19f1f0a 100644 --- a/src/datavisualization/data/qsurfacedataproxy.cpp +++ b/src/datavisualization/data/qsurfacedataproxy.cpp @@ -259,6 +259,29 @@ const QSurfaceDataArray *QSurfaceDataProxy::array() const } /*! + * \return pointer to the item at \a rowIndex, \a columnIndex. It is guaranteed to be valid only + * until the next call that modifies data. + */ +const QSurfaceDataItem *QSurfaceDataProxy::itemAt(int rowIndex, int columnIndex) const +{ + const QSurfaceDataArray &dataArray = *dptrc()->m_dataArray; + Q_ASSERT(rowIndex >= 0 && rowIndex < dataArray.size()); + const QSurfaceDataRow &dataRow = *dataArray[rowIndex]; + Q_ASSERT(columnIndex >= 0 && columnIndex < dataRow.size()); + return &dataRow.at(columnIndex); +} + +/*! + * \return pointer to the item at \a position. The X-value of \a 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(const QPoint &position) const +{ + return itemAt(position.x(), position.y()); +} + +/*! * \property QSurfaceDataProxy::rowCount * * \return number of rows in the data. @@ -282,15 +305,6 @@ int QSurfaceDataProxy::columnCount() const } /*! - * \return pointer to the item at \a index. It is guaranteed to be valid only until the next call that - * modifies data. - */ -const QSurfaceDataItem *QSurfaceDataProxy::itemAt(int index) const -{ - return &dptrc()->m_dataArray->at(index)->at(2); -} - -/*! * \internal */ QSurfaceDataProxyPrivate *QSurfaceDataProxy::dptr() |