From 383eb97e14501d05dab859da7e7372078b0b15e0 2013-05-23 06:18:52 From: Heikkinen Miikka Date: 2013-05-23 06:18:52 Subject: [PATCH] Fix oscilloscope demos on android qobject_cast doesn't seem to work properly on android, but there is no need to use it in oscilloscope demos, static cast works just as well there. Change-Id: Ia32c914dcec05dca48103fe8d4edec7c054c8bd8 Reviewed-by: Tomi Korpipää --- diff --git a/demos/qmloscilloscope/datasource.cpp b/demos/qmloscilloscope/datasource.cpp index e2dcbb1..d8e21c8 100644 --- a/demos/qmloscilloscope/datasource.cpp +++ b/demos/qmloscilloscope/datasource.cpp @@ -41,16 +41,16 @@ DataSource::DataSource(QDeclarativeView *appViewer, QObject *parent) : void DataSource::update(QAbstractSeries *series) { - QXYSeries *xySeries = qobject_cast(series); - Q_ASSERT(xySeries); + if (series) { + QXYSeries *xySeries = static_cast(series); + m_index++; + if (m_index > m_data.count() - 1) + m_index = 0; - m_index++; - if (m_index > m_data.count() - 1) - m_index = 0; - - QList points = m_data.at(m_index); - // Use replace instead of clear + append, it's optimized for performance - xySeries->replace(points); + QList points = m_data.at(m_index); + // Use replace instead of clear + append, it's optimized for performance + xySeries->replace(points); + } } void DataSource::generateData(int type, int rowCount, int colCount) diff --git a/demos/quick2oscilloscope/datasource.cpp b/demos/quick2oscilloscope/datasource.cpp index 62daf82..162dd15 100644 --- a/demos/quick2oscilloscope/datasource.cpp +++ b/demos/quick2oscilloscope/datasource.cpp @@ -42,16 +42,16 @@ DataSource::DataSource(QQuickView *appViewer, QObject *parent) : void DataSource::update(QAbstractSeries *series) { - QXYSeries *xySeries = qobject_cast(series); - Q_ASSERT(xySeries); + if (series) { + QXYSeries *xySeries = static_cast(series); + m_index++; + if (m_index > m_data.count() - 1) + m_index = 0; - m_index++; - if (m_index > m_data.count() - 1) - m_index = 0; - - QList points = m_data.at(m_index); - // Use replace instead of clear + append, it's optimized for performance - xySeries->replace(points); + QList points = m_data.at(m_index); + // Use replace instead of clear + append, it's optimized for performance + xySeries->replace(points); + } } void DataSource::generateData(int type, int rowCount, int colCount)