summaryrefslogtreecommitdiffstats
path: root/examples/charts
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2020-06-23 17:14:06 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2020-06-23 20:01:55 +0200
commit2b1698862d93c4256ea4deae720d00269c448d5e (patch)
treec2bf3a2e5f75f334573d397abd9cc5a7ef382271 /examples/charts
parentcd4593b108f7b308fb21f8b6451ba0a8da1cb169 (diff)
Use QList instead of QVector in qtcharts examples
Task-number: QTBUG-84469 Change-Id: I724c4d793294d890e26ff7d39021bbdc9438e978 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'examples/charts')
-rw-r--r--examples/charts/audio/xyseriesiodevice.h4
-rw-r--r--examples/charts/barmodelmapper/customtablemodel.cpp12
-rw-r--r--examples/charts/barmodelmapper/customtablemodel.h2
-rw-r--r--examples/charts/chartthemes/themewidget.cpp2
-rw-r--r--examples/charts/modeldata/customtablemodel.cpp12
-rw-r--r--examples/charts/modeldata/customtablemodel.h2
-rw-r--r--examples/charts/openglseries/datasource.cpp8
-rw-r--r--examples/charts/openglseries/datasource.h2
-rw-r--r--examples/charts/qmloscilloscope/datasource.cpp4
-rw-r--r--examples/charts/qmloscilloscope/datasource.h2
10 files changed, 25 insertions, 25 deletions
diff --git a/examples/charts/audio/xyseriesiodevice.h b/examples/charts/audio/xyseriesiodevice.h
index cbbf2271..52f4bf05 100644
--- a/examples/charts/audio/xyseriesiodevice.h
+++ b/examples/charts/audio/xyseriesiodevice.h
@@ -32,7 +32,7 @@
#include <QtCore/QIODevice>
#include <QtCore/QPointF>
-#include <QtCore/QVector>
+#include <QtCore/QList>
#include <QtCharts/QChartGlobal>
QT_CHARTS_BEGIN_NAMESPACE
@@ -55,7 +55,7 @@ protected:
private:
QXYSeries *m_series;
- QVector<QPointF> m_buffer;
+ QList<QPointF> m_buffer;
};
#endif // XYSERIESIODEVICE_H
diff --git a/examples/charts/barmodelmapper/customtablemodel.cpp b/examples/charts/barmodelmapper/customtablemodel.cpp
index 4bbf4191..37730042 100644
--- a/examples/charts/barmodelmapper/customtablemodel.cpp
+++ b/examples/charts/barmodelmapper/customtablemodel.cpp
@@ -28,7 +28,7 @@
****************************************************************************/
#include "customtablemodel.h"
-#include <QtCore/QVector>
+#include <QtCore/QList>
#include <QtCore/QTime>
#include <QtCore/QRect>
#include <QtCore/QRandomGenerator>
@@ -42,14 +42,14 @@ CustomTableModel::CustomTableModel(QObject *parent) :
// m_data
for (int i = 0; i < m_rowCount; i++) {
- QVector<qreal>* dataVec = new QVector<qreal>(m_columnCount);
- for (int k = 0; k < dataVec->size(); k++) {
+ QList<qreal> *dataList = new QList<qreal>(m_columnCount);
+ for (int k = 0; k < dataList->size(); k++) {
if (k % 2 == 0)
- dataVec->replace(k, i * 50 + QRandomGenerator::global()->bounded(20));
+ dataList->replace(k, i * 50 + QRandomGenerator::global()->bounded(20));
else
- dataVec->replace(k, QRandomGenerator::global()->bounded(100));
+ dataList->replace(k, QRandomGenerator::global()->bounded(100));
}
- m_data.append(dataVec);
+ m_data.append(dataList);
}
}
diff --git a/examples/charts/barmodelmapper/customtablemodel.h b/examples/charts/barmodelmapper/customtablemodel.h
index ab4e10cb..d8de5d24 100644
--- a/examples/charts/barmodelmapper/customtablemodel.h
+++ b/examples/charts/barmodelmapper/customtablemodel.h
@@ -52,7 +52,7 @@ public:
void clearMapping() { m_mapping.clear(); }
private:
- QList<QVector<qreal> * > m_data;
+ QList<QList<qreal> *> m_data;
QHash<QString, QRect> m_mapping;
int m_columnCount;
int m_rowCount;
diff --git a/examples/charts/chartthemes/themewidget.cpp b/examples/charts/chartthemes/themewidget.cpp
index cbcdb5c9..93894972 100644
--- a/examples/charts/chartthemes/themewidget.cpp
+++ b/examples/charts/chartthemes/themewidget.cpp
@@ -184,7 +184,7 @@ QChart *ThemeWidget::createAreaChart() const
for (int j(0); j < m_dataTable[i].count(); j++) {
Data data = m_dataTable[i].at(j);
if (lowerSeries) {
- const QVector<QPointF>& points = lowerSeries->pointsVector();
+ const auto &points = lowerSeries->pointsVector();
upperSeries->append(QPointF(j, points[i].y() + data.first.y()));
} else {
upperSeries->append(QPointF(j, data.first.y()));
diff --git a/examples/charts/modeldata/customtablemodel.cpp b/examples/charts/modeldata/customtablemodel.cpp
index 8ef3c2a9..96256232 100644
--- a/examples/charts/modeldata/customtablemodel.cpp
+++ b/examples/charts/modeldata/customtablemodel.cpp
@@ -28,7 +28,7 @@
****************************************************************************/
#include "customtablemodel.h"
-#include <QtCore/QVector>
+#include <QtCore/QList>
#include <QtCore/QRandomGenerator>
#include <QtCore/QRect>
#include <QtGui/QColor>
@@ -41,14 +41,14 @@ CustomTableModel::CustomTableModel(QObject *parent) :
// m_data
for (int i = 0; i < m_rowCount; i++) {
- QVector<qreal>* dataVec = new QVector<qreal>(m_columnCount);
- for (int k = 0; k < dataVec->size(); k++) {
+ QList<qreal> *dataList = new QList<qreal>(m_columnCount);
+ for (int k = 0; k < dataList->size(); k++) {
if (k % 2 == 0)
- dataVec->replace(k, i * 50 + QRandomGenerator::global()->bounded(20));
+ dataList->replace(k, i * 50 + QRandomGenerator::global()->bounded(20));
else
- dataVec->replace(k, QRandomGenerator::global()->bounded(100));
+ dataList->replace(k, QRandomGenerator::global()->bounded(100));
}
- m_data.append(dataVec);
+ m_data.append(dataList);
}
}
diff --git a/examples/charts/modeldata/customtablemodel.h b/examples/charts/modeldata/customtablemodel.h
index 95e13d8b..66396204 100644
--- a/examples/charts/modeldata/customtablemodel.h
+++ b/examples/charts/modeldata/customtablemodel.h
@@ -51,7 +51,7 @@ public:
void clearMapping() { m_mapping.clear(); }
private:
- QList<QVector<qreal> * > m_data;
+ QList<QList<qreal> *> m_data;
QHash<QString, QRect> m_mapping;
int m_columnCount;
int m_rowCount;
diff --git a/examples/charts/openglseries/datasource.cpp b/examples/charts/openglseries/datasource.cpp
index af2dc10e..6969ba95 100644
--- a/examples/charts/openglseries/datasource.cpp
+++ b/examples/charts/openglseries/datasource.cpp
@@ -44,13 +44,13 @@ void DataSource::update(QAbstractSeries *series, int seriesIndex)
{
if (series) {
QXYSeries *xySeries = static_cast<QXYSeries *>(series);
- const QVector<QVector<QPointF> > &seriesData = m_data.at(seriesIndex);
+ const QList<QList<QPointF>> &seriesData = m_data.at(seriesIndex);
if (seriesIndex == 0)
m_index++;
if (m_index > seriesData.count() - 1)
m_index = 0;
- QVector<QPointF> points = seriesData.at(m_index);
+ const auto points = seriesData.at(m_index);
// Use replace instead of clear + append, it's optimized for performance
xySeries->replace(points);
}
@@ -103,10 +103,10 @@ void DataSource::generateData(int seriesCount, int rowCount, int colCount)
// Append the new data depending on the type
for (int k(0); k < seriesCount; k++) {
- QVector<QVector<QPointF> > seriesData;
+ QList<QList<QPointF>> seriesData;
qreal height = qreal(k) * (10.0 / qreal(seriesCount)) + 0.3;
for (int i(0); i < rowCount; i++) {
- QVector<QPointF> points;
+ QList<QPointF> points;
points.reserve(colCount);
for (int j(0); j < colCount; j++) {
qreal x(0);
diff --git a/examples/charts/openglseries/datasource.h b/examples/charts/openglseries/datasource.h
index d32f717a..652981ea 100644
--- a/examples/charts/openglseries/datasource.h
+++ b/examples/charts/openglseries/datasource.h
@@ -53,7 +53,7 @@ public slots:
void updateAllSeries();
private:
- QVector<QVector<QVector<QPointF> > > m_data;
+ QList<QList<QList<QPointF>>> m_data;
int m_index;
QList<QXYSeries *> m_seriesList;
QLabel *m_fpsLabel;
diff --git a/examples/charts/qmloscilloscope/datasource.cpp b/examples/charts/qmloscilloscope/datasource.cpp
index b773217b..d01fa421 100644
--- a/examples/charts/qmloscilloscope/datasource.cpp
+++ b/examples/charts/qmloscilloscope/datasource.cpp
@@ -60,7 +60,7 @@ void DataSource::update(QAbstractSeries *series)
if (m_index > m_data.count() - 1)
m_index = 0;
- QVector<QPointF> points = m_data.at(m_index);
+ QList<QPointF> points = m_data.at(m_index);
// Use replace instead of clear + append, it's optimized for performance
xySeries->replace(points);
}
@@ -73,7 +73,7 @@ void DataSource::generateData(int type, int rowCount, int colCount)
// Append the new data depending on the type
for (int i(0); i < rowCount; i++) {
- QVector<QPointF> points;
+ QList<QPointF> points;
points.reserve(colCount);
for (int j(0); j < colCount; j++) {
qreal x(0);
diff --git a/examples/charts/qmloscilloscope/datasource.h b/examples/charts/qmloscilloscope/datasource.h
index d1b9caee..3fd61614 100644
--- a/examples/charts/qmloscilloscope/datasource.h
+++ b/examples/charts/qmloscilloscope/datasource.h
@@ -53,7 +53,7 @@ public slots:
private:
QQuickView *m_appViewer;
- QList<QVector<QPointF> > m_data;
+ QList<QList<QPointF>> m_data;
int m_index;
};