aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-09-21 12:23:48 -0700
committerLars Knoll <lars.knoll@qt.io>2017-11-03 09:12:14 +0000
commitee00fa01dc41deaaedfa0d1d5cc6cd750bfe75f4 (patch)
treee764c6bab1bd0883fcbfe20c7703f997fb22d510 /examples
parent62e23e1ae6542b5ab837a2481d9257c81e484013 (diff)
Update to new QRandomGenerator API
Change-Id: I69f37f9304f24709a823fffd14e676c097712329 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/scenegraph/graph/noisynode.cpp2
-rw-r--r--examples/quick/scenegraph/sgengine/window.cpp10
2 files changed, 6 insertions, 6 deletions
diff --git a/examples/quick/scenegraph/graph/noisynode.cpp b/examples/quick/scenegraph/graph/noisynode.cpp
index dd06bdfdc2..6e79bb247f 100644
--- a/examples/quick/scenegraph/graph/noisynode.cpp
+++ b/examples/quick/scenegraph/graph/noisynode.cpp
@@ -114,7 +114,7 @@ NoisyNode::NoisyNode(QQuickWindow *window)
QImage image(NOISE_SIZE, NOISE_SIZE, QImage::Format_RGB32);
uint *data = (uint *) image.bits();
for (int i=0; i<NOISE_SIZE * NOISE_SIZE; ++i) {
- uint g = QRandomGenerator::bounded(0xff);
+ uint g = QRandomGenerator::global()->bounded(0xff);
data[i] = 0xff000000 | (g << 16) | (g << 8) | g;
}
diff --git a/examples/quick/scenegraph/sgengine/window.cpp b/examples/quick/scenegraph/sgengine/window.cpp
index 7db91e3266..6f22510a81 100644
--- a/examples/quick/scenegraph/sgengine/window.cpp
+++ b/examples/quick/scenegraph/sgengine/window.cpp
@@ -72,9 +72,9 @@ public:
transformNode->appendChildNode(textureNode);
parentNode->appendChildNode(transformNode);
- int duration = QRandomGenerator::getReal() * 400 + 800;
- rotAnimation.setStartValue(QRandomGenerator::getReal() * 720 - 180);
- rotAnimation.setEndValue(QRandomGenerator::getReal() * 720 - 180);
+ int duration = QRandomGenerator::global()->generateDouble() * 400 + 800;
+ rotAnimation.setStartValue(QRandomGenerator::global()->generateDouble() * 720 - 180);
+ rotAnimation.setEndValue(QRandomGenerator::global()->generateDouble() * 720 - 180);
rotAnimation.setDuration(duration);
rotAnimation.start();
@@ -182,8 +182,8 @@ void Window::addItems()
QSGTexture *textures[] = { m_smileTexture.data(), m_qtTexture.data() };
for (int i = 0; i < 50; ++i) {
QSGTexture *tex = textures[i%2];
- QPointF fromPos(-tex->textureSize().width(), QRandomGenerator::getReal() * (height() - tex->textureSize().height()));
- QPointF toPos(width(), QRandomGenerator::getReal() * height() * 1.5 - height() * 0.25);
+ QPointF fromPos(-tex->textureSize().width(), QRandomGenerator::global()->generateDouble() * (height() - tex->textureSize().height()));
+ QPointF toPos(width(), QRandomGenerator::global()->generateDouble() * height() * 1.5 - height() * 0.25);
m_items.append(QSharedPointer<Item>::create(m_sgRootNode.data(), tex, fromPos, toPos));
}
update();