mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-23 10:30:53 +01:00
fix deprecated warning qsrand
This function is obsolete. Use QRandomGenerator instead. This class was introduced in Qt 5.10.
This commit is contained in:
committed by
Laurent Trinques
parent
5d2d4a48a5
commit
2570108caf
@@ -25,6 +25,7 @@
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QSharedMemory>
|
||||
#include <QRandomGenerator>
|
||||
|
||||
#include "singleapplication.h"
|
||||
#include "singleapplication_p.h"
|
||||
@@ -99,8 +100,13 @@ SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSeconda
|
||||
d->memory->unlock();
|
||||
|
||||
// Random sleep here limits the probability of a collision between two racing apps
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) // ### Qt 6: remove
|
||||
qsrand( QDateTime::currentMSecsSinceEpoch() % std::numeric_limits<uint>::max() );
|
||||
QThread::sleep( 8 + static_cast <unsigned long>( static_cast <float>( qrand() ) / RAND_MAX * 10 ) );
|
||||
#else
|
||||
quint32 value = QRandomGenerator::global()->generate();
|
||||
QThread::sleep( 8 + static_cast <unsigned long>( static_cast <float>( value ) / RAND_MAX * 10 ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
if( inst->primary == false) {
|
||||
|
||||
Reference in New Issue
Block a user