diff options
Diffstat (limited to 'tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp')
-rw-r--r-- | tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 2abb6e3515..da15583d5d 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -32,6 +32,7 @@ #include <private/qgraphicsitem_p.h> #include <private/qgraphicsview_p.h> #include <private/qgraphicsscene_p.h> +#include <QRandomGenerator> #include <QStyleOptionGraphicsItem> #include <QAbstractTextDocumentLayout> #include <QBitmap> @@ -3595,12 +3596,12 @@ void tst_QGraphicsItem::group() QList<QGraphicsItem *> newItems; for (int i = 0; i < 100; ++i) { QGraphicsItem *item = scene.addRect(QRectF(-25, -25, 50, 50), QPen(Qt::black, 0), - QBrush(QColor(rand() % 255, rand() % 255, - rand() % 255, rand() % 255))); + QBrush(QColor(QRandomGenerator::global()->bounded(255), QRandomGenerator::global()->bounded(255), + QRandomGenerator::global()->bounded(255), QRandomGenerator::global()->bounded(255)))); newItems << item; - item->setPos(-1000 + rand() % 2000, - -1000 + rand() % 2000); - item->setTransform(QTransform().rotate(rand() % 90), true); + item->setPos(-1000 + QRandomGenerator::global()->bounded(2000), + -1000 + QRandomGenerator::global()->bounded(2000)); + item->setTransform(QTransform().rotate(QRandomGenerator::global()->bounded(90)), true); } view.fitInView(scene.itemsBoundingRect()); @@ -4143,8 +4144,8 @@ void tst_QGraphicsItem::ensureVisible() for (int x = -100; x < 100; x += 25) { for (int y = -100; y < 100; y += 25) { - int xmargin = rand() % 75; - int ymargin = rand() % 75; + int xmargin = QRandomGenerator::global()->bounded(75); + int ymargin = QRandomGenerator::global()->bounded(75); item->ensureVisible(x, y, 25, 25, xmargin, ymargin); QApplication::processEvents(); @@ -7137,7 +7138,7 @@ public: : QGraphicsRectItem(QRectF(-10, -10, 20, 20)) { setPen(QPen(Qt::black, 0)); - setBrush(QColor(qrand() % 256, qrand() % 256, qrand() % 256)); + setBrush(QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256))); } QTransform x; |