diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-09-21 12:21:34 -0700 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-11-03 09:13:37 +0000 |
commit | 567b5bc67e54f496027da2e6d99aa7b39d64a606 (patch) | |
tree | 9bdb47dfba0e69e4d31c27e40bd4b25eefb624b2 /examples/charts | |
parent | dad8cdbac13eaf3ed33fdf4157ebc242d5c13db5 (diff) |
Update to new QRandomGenerator API
Change-Id: I69f37f9304f24709a823fffd14e676c097712329
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'examples/charts')
-rw-r--r-- | examples/charts/barmodelmapper/customtablemodel.cpp | 4 | ||||
-rw-r--r-- | examples/charts/chartthemes/themewidget.cpp | 4 | ||||
-rw-r--r-- | examples/charts/dynamicspline/chart.cpp | 2 | ||||
-rw-r--r-- | examples/charts/modeldata/customtablemodel.cpp | 4 | ||||
-rw-r--r-- | examples/charts/nesteddonuts/widget.cpp | 6 | ||||
-rw-r--r-- | examples/charts/openglseries/datasource.cpp | 2 | ||||
-rw-r--r-- | examples/charts/piechartdrilldown/main.cpp | 2 | ||||
-rw-r--r-- | examples/charts/qmloscilloscope/datasource.cpp | 2 | ||||
-rw-r--r-- | examples/charts/stackedbarchartdrilldown/main.cpp | 2 | ||||
-rw-r--r-- | examples/charts/zoomlinechart/main.cpp | 2 |
10 files changed, 15 insertions, 15 deletions
diff --git a/examples/charts/barmodelmapper/customtablemodel.cpp b/examples/charts/barmodelmapper/customtablemodel.cpp index 71165dff..4bbf4191 100644 --- a/examples/charts/barmodelmapper/customtablemodel.cpp +++ b/examples/charts/barmodelmapper/customtablemodel.cpp @@ -45,9 +45,9 @@ CustomTableModel::CustomTableModel(QObject *parent) : QVector<qreal>* dataVec = new QVector<qreal>(m_columnCount); for (int k = 0; k < dataVec->size(); k++) { if (k % 2 == 0) - dataVec->replace(k, i * 50 + QRandomGenerator::bounded(20)); + dataVec->replace(k, i * 50 + QRandomGenerator::global()->bounded(20)); else - dataVec->replace(k, QRandomGenerator::bounded(100)); + dataVec->replace(k, QRandomGenerator::global()->bounded(100)); } m_data.append(dataVec); } diff --git a/examples/charts/chartthemes/themewidget.cpp b/examples/charts/chartthemes/themewidget.cpp index ed49ce9b..84ea8231 100644 --- a/examples/charts/chartthemes/themewidget.cpp +++ b/examples/charts/chartthemes/themewidget.cpp @@ -126,8 +126,8 @@ DataTable ThemeWidget::generateRandomData(int listCount, int valueMax, int value DataList dataList; qreal yValue(0); for (int j(0); j < valueCount; j++) { - yValue = yValue + QRandomGenerator::bounded(valueMax / (qreal) valueCount); - QPointF value((j + QRandomGenerator::getReal()) * ((qreal) m_valueMax / (qreal) valueCount), + yValue = yValue + QRandomGenerator::global()->bounded(valueMax / (qreal) valueCount); + QPointF value((j + QRandomGenerator::global()->generateDouble()) * ((qreal) m_valueMax / (qreal) valueCount), yValue); QString label = "Slice " + QString::number(i) + ":" + QString::number(j); dataList << Data(value, label); diff --git a/examples/charts/dynamicspline/chart.cpp b/examples/charts/dynamicspline/chart.cpp index ee7061d2..beba2513 100644 --- a/examples/charts/dynamicspline/chart.cpp +++ b/examples/charts/dynamicspline/chart.cpp @@ -71,7 +71,7 @@ void Chart::handleTimeout() qreal x = plotArea().width() / m_axis->tickCount(); qreal y = (m_axis->max() - m_axis->min()) / m_axis->tickCount(); m_x += y; - m_y = QRandomGenerator::bounded(5) - 2.5; + m_y = QRandomGenerator::global()->bounded(5) - 2.5; m_series->append(m_x, m_y); scroll(x, 0); if (m_x == 100) diff --git a/examples/charts/modeldata/customtablemodel.cpp b/examples/charts/modeldata/customtablemodel.cpp index e36a5d3d..8ef3c2a9 100644 --- a/examples/charts/modeldata/customtablemodel.cpp +++ b/examples/charts/modeldata/customtablemodel.cpp @@ -44,9 +44,9 @@ CustomTableModel::CustomTableModel(QObject *parent) : QVector<qreal>* dataVec = new QVector<qreal>(m_columnCount); for (int k = 0; k < dataVec->size(); k++) { if (k % 2 == 0) - dataVec->replace(k, i * 50 + QRandomGenerator::bounded(20)); + dataVec->replace(k, i * 50 + QRandomGenerator::global()->bounded(20)); else - dataVec->replace(k, QRandomGenerator::bounded(100)); + dataVec->replace(k, QRandomGenerator::global()->bounded(100)); } m_data.append(dataVec); } diff --git a/examples/charts/nesteddonuts/widget.cpp b/examples/charts/nesteddonuts/widget.cpp index f8090455..92c6415c 100644 --- a/examples/charts/nesteddonuts/widget.cpp +++ b/examples/charts/nesteddonuts/widget.cpp @@ -61,9 +61,9 @@ Widget::Widget(QWidget *parent) //! [3] for (int i = 0; i < donutCount; i++) { QPieSeries *donut = new QPieSeries; - int sliceCount = 3 + QRandomGenerator::bounded(3); + int sliceCount = 3 + QRandomGenerator::global()->bounded(3); for (int j = 0; j < sliceCount; j++) { - qreal value = 100 + QRandomGenerator::bounded(100); + qreal value = 100 + QRandomGenerator::global()->bounded(100); QPieSlice *slice = new QPieSlice(QString("%1").arg(value), value); slice->setLabelVisible(true); slice->setLabelColor(Qt::white); @@ -102,7 +102,7 @@ void Widget::updateRotation() { for (int i = 0; i < m_donuts.count(); i++) { QPieSeries *donut = m_donuts.at(i); - qreal phaseShift = -50 + QRandomGenerator::bounded(100); + qreal phaseShift = -50 + QRandomGenerator::global()->bounded(100); donut->setPieStartAngle(donut->pieStartAngle() + phaseShift); donut->setPieEndAngle(donut->pieEndAngle() + phaseShift); } diff --git a/examples/charts/openglseries/datasource.cpp b/examples/charts/openglseries/datasource.cpp index b5992214..af2dc10e 100644 --- a/examples/charts/openglseries/datasource.cpp +++ b/examples/charts/openglseries/datasource.cpp @@ -113,7 +113,7 @@ void DataSource::generateData(int seriesCount, int rowCount, int colCount) qreal y(0); // data with sin + random component y = height + (yMultiplier * qSin(M_PI / 50 * j) - + (yMultiplier * QRandomGenerator::getReal())); + + (yMultiplier * QRandomGenerator::global()->generateDouble())); // 0.000001 added to make values logaxis compatible x = 0.000001 + 20.0 * (qreal(j) / qreal(colCount)) + (xAdjustment * qreal(i)); points.append(QPointF(x, y)); diff --git a/examples/charts/piechartdrilldown/main.cpp b/examples/charts/piechartdrilldown/main.cpp index 1fed557a..e18f07f3 100644 --- a/examples/charts/piechartdrilldown/main.cpp +++ b/examples/charts/piechartdrilldown/main.cpp @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) series->setName("Sales by month - " + name); for (const QString &month : months) - *series << new DrilldownSlice(QRandomGenerator::bounded(1000), month, yearSeries); + *series << new DrilldownSlice(QRandomGenerator::global()->bounded(1000), month, yearSeries); QObject::connect(series, &QPieSeries::clicked, chart, &DrilldownChart::handleSliceClicked); diff --git a/examples/charts/qmloscilloscope/datasource.cpp b/examples/charts/qmloscilloscope/datasource.cpp index dddee543..b773217b 100644 --- a/examples/charts/qmloscilloscope/datasource.cpp +++ b/examples/charts/qmloscilloscope/datasource.cpp @@ -81,7 +81,7 @@ void DataSource::generateData(int type, int rowCount, int colCount) switch (type) { case 0: // data with sin + random component - y = qSin(M_PI / 50 * j) + 0.5 + QRandomGenerator::getReal(); + y = qSin(M_PI / 50 * j) + 0.5 + QRandomGenerator::global()->generateDouble(); x = j; break; case 1: diff --git a/examples/charts/stackedbarchartdrilldown/main.cpp b/examples/charts/stackedbarchartdrilldown/main.cpp index 46d00190..87035aea 100644 --- a/examples/charts/stackedbarchartdrilldown/main.cpp +++ b/examples/charts/stackedbarchartdrilldown/main.cpp @@ -96,7 +96,7 @@ int main(int argc, char *argv[]) for (int month = 0; month < months.count(); month++) { QBarSet *weeklyCrop = new QBarSet(plant); for (int week = 0; week < weeks.count(); week++) - *weeklyCrop << QRandomGenerator::bounded(20); + *weeklyCrop << QRandomGenerator::global()->bounded(20); // Get the drilldown series from season series and add crop to it. seasonSeries->drilldownSeries(month)->append(weeklyCrop); *monthlyCrop << weeklyCrop->sum(); diff --git a/examples/charts/zoomlinechart/main.cpp b/examples/charts/zoomlinechart/main.cpp index b3c6a33f..28a3d913 100644 --- a/examples/charts/zoomlinechart/main.cpp +++ b/examples/charts/zoomlinechart/main.cpp @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) QLineSeries *series = new QLineSeries(); for (int i = 0; i < 500; i++) { QPointF p((qreal) i, qSin(M_PI / 50 * i) * 100); - p.ry() += QRandomGenerator::bounded(20); + p.ry() += QRandomGenerator::global()->bounded(20); *series << p; } //![1] |