From b2537351adcc79aea0ca0999f7c7f6ce9cd95dd3 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Thu, 12 Mar 2020 09:53:55 +0100 Subject: [PATCH] getting rid of deprecated calls --- examples/automotive/SpeedometerDisplay.cpp | 6 ++++-- examples/thumbnails/main.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/automotive/SpeedometerDisplay.cpp b/examples/automotive/SpeedometerDisplay.cpp index b696b239..a6080c95 100644 --- a/examples/automotive/SpeedometerDisplay.cpp +++ b/examples/automotive/SpeedometerDisplay.cpp @@ -15,6 +15,8 @@ #include #include +#include + SpeedometerDisplay::SpeedometerDisplay( QQuickItem* parent ) : QskControl( parent ) , m_box( new QskLinearBox( Qt::Horizontal, this ) ) @@ -25,7 +27,7 @@ SpeedometerDisplay::SpeedometerDisplay( QQuickItem* parent ) , m_fuelGauge( new Speedometer( m_box ) ) , m_fuelGaugeText( new QskTextLabel( QStringLiteral( "fuel" ), m_fuelGauge ) ) { - qsrand( static_cast< uint >( QTime::currentTime().msec() ) ); + std::srand( static_cast< uint >( QTime::currentTime().msec() ) ); setPolishOnResize( true ); @@ -67,7 +69,7 @@ SpeedometerDisplay::SpeedometerDisplay( QQuickItem* parent ) connect( timer, &QTimer::timeout, this, [ this ]() { - auto speedometerValue = m_speedometer->value() + qrand() % 3 - 0.95; + auto speedometerValue = m_speedometer->value() + std::rand() % 3 - 0.95; m_speedometer->setValue( speedometerValue ); auto fuelGaugeValue = 0.99997 * m_fuelGauge->value(); diff --git a/examples/thumbnails/main.cpp b/examples/thumbnails/main.cpp index 61ae84dd..d451ced4 100644 --- a/examples/thumbnails/main.cpp +++ b/examples/thumbnails/main.cpp @@ -22,6 +22,8 @@ #include #include +#include + #define HIDE_NODES 1 const int gridSize = 20; @@ -53,13 +55,13 @@ static QColor randomColor() "DarkSlateGray" }; - const int index = qrand() % int( ( sizeof( colors ) / sizeof( colors[ 0 ] ) ) ); + const int index = std::rand() % int( ( sizeof( colors ) / sizeof( colors[ 0 ] ) ) ); return QColor( colors[ index ] ); } static int randomShape() { - return qrand() % SkinnyShapeFactory::ShapeCount; + return std::rand() % SkinnyShapeFactory::ShapeCount; } class Thumbnail : public QskPushButton