aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick')
-rw-r--r--examples/quick/customitems/slideswitch/doc/src/example-slideswitch.qdoc2
-rw-r--r--examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc2
-rw-r--r--examples/quick/scenegraph/graph/noisynode.cpp3
-rw-r--r--examples/quick/scenegraph/sgengine/window.cpp11
4 files changed, 10 insertions, 8 deletions
diff --git a/examples/quick/customitems/slideswitch/doc/src/example-slideswitch.qdoc b/examples/quick/customitems/slideswitch/doc/src/example-slideswitch.qdoc
index 67a36eb8d8..d9703f6187 100644
--- a/examples/quick/customitems/slideswitch/doc/src/example-slideswitch.qdoc
+++ b/examples/quick/customitems/slideswitch/doc/src/example-slideswitch.qdoc
@@ -75,7 +75,7 @@ Item {
the text will only be visible when the switch is on.
-\section2 Images and user interaction
+\section2 Images and User Interaction
\snippet customitems/slideswitch/content/Switch.qml 4
First, we create the background image of the switch.
diff --git a/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc b/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc
index 9c0f8b337e..a107b19948 100644
--- a/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc
+++ b/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc
@@ -222,7 +222,7 @@
\printuntil onClicked
\printuntil }
- \section1 Laying out Photos on a Path
+ \section1 Laying Out Photos on a Path
In AlbumDelegate.qml, we use a PathView type to lay out the photos provided
by the \c visualModel.parts.stack model on a path that has the form of a
diff --git a/examples/quick/scenegraph/graph/noisynode.cpp b/examples/quick/scenegraph/graph/noisynode.cpp
index 834151599b..5658702f3a 100644
--- a/examples/quick/scenegraph/graph/noisynode.cpp
+++ b/examples/quick/scenegraph/graph/noisynode.cpp
@@ -40,6 +40,7 @@
#include "noisynode.h"
+#include <QtCore/QRandomGenerator>
#include <QtQuick/QSGSimpleMaterialShader>
#include <QtQuick/QSGTexture>
#include <QtQuick/QQuickWindow>
@@ -103,7 +104,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 = rand() & 0xff;
+ uint g = QRandomGenerator::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 a73d9bf755..0e5c738ce5 100644
--- a/examples/quick/scenegraph/sgengine/window.cpp
+++ b/examples/quick/scenegraph/sgengine/window.cpp
@@ -48,6 +48,7 @@
#include <QScreen>
#include <QVariantAnimation>
#include <QOpenGLFunctions>
+#include <QRandomGenerator>
class Item {
public:
@@ -61,9 +62,9 @@ public:
transformNode->appendChildNode(textureNode);
parentNode->appendChildNode(transformNode);
- int duration = qrand() / float(RAND_MAX) * 400 + 800;
- rotAnimation.setStartValue(qrand() / float(RAND_MAX) * 720 - 180);
- rotAnimation.setEndValue(qrand() / float(RAND_MAX) * 720 - 180);
+ int duration = QRandomGenerator::getReal() * 400 + 800;
+ rotAnimation.setStartValue(QRandomGenerator::getReal() * 720 - 180);
+ rotAnimation.setEndValue(QRandomGenerator::getReal() * 720 - 180);
rotAnimation.setDuration(duration);
rotAnimation.start();
@@ -171,8 +172,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(), qrand() / float(RAND_MAX) * (height() - tex->textureSize().height()));
- QPointF toPos(width(), qrand() / float(RAND_MAX) * height() * 1.5 - height() * 0.25);
+ QPointF fromPos(-tex->textureSize().width(), QRandomGenerator::getReal() * (height() - tex->textureSize().height()));
+ QPointF toPos(width(), QRandomGenerator::getReal() * height() * 1.5 - height() * 0.25);
m_items.append(QSharedPointer<Item>::create(m_sgRootNode.data(), tex, fromPos, toPos));
}
update();