From 79f3a4d7aa2fcbdc5df133ede88a367aa5870bd3 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 4 Feb 2014 14:48:34 +0200 Subject: Add qmloscilloscope example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +Fix itemAt() in surface proxy +Add itemAt(QPoint) in bar and surface proxies +Misc fixes to other examples Task-number: QTRD-2816 Change-Id: I5e06cfce98f74719a20885e3ca5a1e6fefb23a9c Reviewed-by: Tomi Korpipää --- src/datavisualization/data/qsurfacedataproxy.cpp | 32 +++++++++++++++++------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'src/datavisualization/data/qsurfacedataproxy.cpp') 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 @@ -258,6 +258,29 @@ const QSurfaceDataArray *QSurfaceDataProxy::array() const return dptrc()->m_dataArray; } +/*! + * \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 * @@ -281,15 +304,6 @@ int QSurfaceDataProxy::columnCount() const return 0; } -/*! - * \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 */ -- cgit v1.2.3