getting rid of deprecated calls

This commit is contained in:
Uwe Rathmann 2020-03-12 09:53:55 +01:00
parent 7044bced9e
commit b2537351ad
2 changed files with 8 additions and 4 deletions

View File

@ -15,6 +15,8 @@
#include <QTimer>
#include <QtGlobal>
#include <cstdlib>
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();

View File

@ -22,6 +22,8 @@
#include <QGuiApplication>
#include <QPainter>
#include <cstdlib>
#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