summaryrefslogtreecommitdiffstats
path: root/examples/datavisualization/qmloscilloscope
diff options
context:
space:
mode:
authorMika Salmela <mika.salmela@qt.io>2017-12-02 22:30:30 +0200
committerMika Salmela <mika.salmela@qt.io>2017-12-04 08:39:36 +0000
commitc3a973273e3c7ac61b8dd9aec282847d30fd4ac1 (patch)
treef127849914d599b193bb0bbf3a7a6680b4790a18 /examples/datavisualization/qmloscilloscope
parentcedc62610efb1add2a68a179a38db8e668560016 (diff)
If not m_resetArray then create it
Fix m_resetArray so that if it not yet created, then create it. Currently it is created every time. Change-Id: I850bd9d2f719cd76bfd3292a439f9585a4e99fc3 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'examples/datavisualization/qmloscilloscope')
-rw-r--r--examples/datavisualization/qmloscilloscope/datasource.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/datavisualization/qmloscilloscope/datasource.cpp b/examples/datavisualization/qmloscilloscope/datasource.cpp
index 4a9aaddb..58e72d99 100644
--- a/examples/datavisualization/qmloscilloscope/datasource.cpp
+++ b/examples/datavisualization/qmloscilloscope/datasource.cpp
@@ -39,7 +39,7 @@ Q_DECLARE_METATYPE(QSurface3DSeries *)
DataSource::DataSource(QObject *parent) :
QObject(parent),
m_index(-1),
- m_resetArray(0)
+ m_resetArray(nullptr)
{
//! [4]
qRegisterMetaType<QSurface3DSeries *>();
@@ -125,7 +125,7 @@ void DataSource::update(QSurface3DSeries *series)
// If the first time or the dimensions of the cache array have changed,
// reconstruct the reset array
- if (m_resetArray || series->dataProxy()->rowCount() != newRowCount
+ if (!m_resetArray || series->dataProxy()->rowCount() != newRowCount
|| series->dataProxy()->columnCount() != newColumnCount) {
m_resetArray = new QSurfaceDataArray();
m_resetArray->reserve(newRowCount);