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 <QTimer>
#include <QtGlobal> #include <QtGlobal>
#include <cstdlib>
SpeedometerDisplay::SpeedometerDisplay( QQuickItem* parent ) SpeedometerDisplay::SpeedometerDisplay( QQuickItem* parent )
: QskControl( parent ) : QskControl( parent )
, m_box( new QskLinearBox( Qt::Horizontal, this ) ) , m_box( new QskLinearBox( Qt::Horizontal, this ) )
@ -25,7 +27,7 @@ SpeedometerDisplay::SpeedometerDisplay( QQuickItem* parent )
, m_fuelGauge( new Speedometer( m_box ) ) , m_fuelGauge( new Speedometer( m_box ) )
, m_fuelGaugeText( new QskTextLabel( QStringLiteral( "fuel" ), m_fuelGauge ) ) , 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 ); setPolishOnResize( true );
@ -67,7 +69,7 @@ SpeedometerDisplay::SpeedometerDisplay( QQuickItem* parent )
connect( timer, &QTimer::timeout, this, [ this ]() 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 ); m_speedometer->setValue( speedometerValue );
auto fuelGaugeValue = 0.99997 * m_fuelGauge->value(); auto fuelGaugeValue = 0.99997 * m_fuelGauge->value();

View File

@ -22,6 +22,8 @@
#include <QGuiApplication> #include <QGuiApplication>
#include <QPainter> #include <QPainter>
#include <cstdlib>
#define HIDE_NODES 1 #define HIDE_NODES 1
const int gridSize = 20; const int gridSize = 20;
@ -53,13 +55,13 @@ static QColor randomColor()
"DarkSlateGray" "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 ] ); return QColor( colors[ index ] );
} }
static int randomShape() static int randomShape()
{ {
return qrand() % SkinnyShapeFactory::ShapeCount; return std::rand() % SkinnyShapeFactory::ShapeCount;
} }
class Thumbnail : public QskPushButton class Thumbnail : public QskPushButton