Совместимость с Qt 5.5
This commit is contained in:
parent
44fedf80ee
commit
d2b89776f4
@ -7,7 +7,11 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#if QT_VERSION >= 0x051000
|
||||
#include <QRandomGenerator>
|
||||
#else
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
#include <QTimer>
|
||||
|
||||
/**
|
||||
@ -39,7 +43,11 @@ int slowFunction()
|
||||
double a[size];
|
||||
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
#if QT_VERSION >= 0x051000
|
||||
a[i] = QRandomGenerator::global()->bounded( 4 );
|
||||
#else
|
||||
a[i] = std::rand() / (RAND_MAX / 4);
|
||||
#endif
|
||||
for ( int j = 0; j < i; j++ ) a[i] += sin( a[j] );
|
||||
a[0] += a[i];
|
||||
}
|
||||
@ -56,7 +64,11 @@ int fastFunction()
|
||||
double a[size];
|
||||
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
#if QT_VERSION >= 0x051000
|
||||
a[i] = QRandomGenerator::global()->bounded( 4 );
|
||||
#else
|
||||
a[i] = std::rand() / (RAND_MAX / 4);
|
||||
#endif
|
||||
for ( int j = 0; j < i; j++ ) a[i] += sin( a[j] );
|
||||
a[0] += a[i];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user