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