From 24cf679d45a9a5894a0665c7bd7fa80288f786b3 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 30 Jan 2024 20:11:17 -0500 Subject: [PATCH] Fix warning related to use of qrand() when building against Qt 5.15 Starting with Qt 5.15, the `qrand` function has been deprecated in favor of `QRandomGenerator`. This change updates `PythonQtStdDecorators.h` to use `QRandomGenerator` when building against Qt 5.15 or later. See qt/qtbase@b3c0e9afa ("Deprecate qrand/qsrand", 2001-09-17) (cherry picked from commit commontk/PythonQt@c1579e21da7cc9137fd49d1c9bee64530768e27c) --- src/PythonQtStdDecorators.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PythonQtStdDecorators.h b/src/PythonQtStdDecorators.h index f3f6948b4..3b1179d1b 100644 --- a/src/PythonQtStdDecorators.h +++ b/src/PythonQtStdDecorators.h @@ -58,7 +58,7 @@ #include #include #include -#if QT_VERSION >= 0x060000 +#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) #include #endif @@ -109,7 +109,7 @@ public Q_SLOTS: int static_Qt_qrand() { -#if QT_VERSION < 0x060000 +#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) return qrand(); #else return QRandomGenerator::global()->generate(); @@ -118,7 +118,7 @@ public Q_SLOTS: void static_Qt_qsrand(uint a) { -#if QT_VERSION < 0x060000 +#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) qsrand(a); #else QRandomGenerator::global()->seed(a);