|
60 | 60 | #include <QToolButton>
|
61 | 61 | #include <QToolBar>
|
62 | 62 | #include <QPointer>
|
63 |
| -#include <QRandomGenerator> |
| 63 | +#include <QMap> |
| 64 | +#include <QElapsedTimer> |
64 | 65 |
|
65 | 66 |
|
| 67 | +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) |
| 68 | +#include <QRandomGenerator> |
| 69 | +#endif |
| 70 | + |
66 | 71 | #ifdef Q_OS_WIN
|
67 | 72 | #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
68 | 73 | #include <QAxWidget>
|
69 | 74 | #endif
|
70 | 75 | #endif
|
71 | 76 |
|
72 |
| -#include <QMap> |
73 |
| -#include <QElapsedTimer> |
74 |
| - |
75 | 77 | #include "DockManager.h"
|
76 | 78 | #include "DockWidget.h"
|
77 | 79 | #include "DockAreaWidget.h"
|
|
84 | 86 | #include "ImageViewer.h"
|
85 | 87 |
|
86 | 88 |
|
| 89 | + |
| 90 | +/** |
| 91 | + * Returns a random number from 0 to highest - 1 |
| 92 | + */ |
| 93 | +int randomNumberBounded(int highest) |
| 94 | +{ |
| 95 | +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) |
| 96 | + return QRandomGenerator::global()->bounded(highest); |
| 97 | +#else |
| 98 | + qsrand(QTime::currentTime().msec()); |
| 99 | + return qrand() % highest; |
| 100 | +#endif |
| 101 | +} |
| 102 | + |
| 103 | + |
87 | 104 | /**
|
88 | 105 | * Function returns a features string with closable (c), movable (m) and floatable (f)
|
89 | 106 | * features. i.e. The following string is for a not closable but movable and floatable
|
@@ -328,7 +345,7 @@ struct MainWindowPrivate
|
328 | 345 | {
|
329 | 346 | static int ImageViewerCount = 0;
|
330 | 347 | auto w = new CImageViewer();
|
331 |
| - auto ImageIndex = QRandomGenerator::global()->bounded(4); |
| 348 | + auto ImageIndex = randomNumberBounded(4); |
332 | 349 | auto FileName = ":adsdemo/images/ads_logo.svg";
|
333 | 350 |
|
334 | 351 | // Pick a random image from a number of images
|
|
0 commit comments