Commit 6ec3fe8f authored by Stefan Gerlach's avatar Stefan Gerlach

Avoid compiler warnings using newer Qt

parent c5014a92
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
if (!m_inputs.value(0)) return 0; if (!m_inputs.value(0)) return 0;
QDateTime inputDate = m_inputs.value(0)->dateTimeAt(row); QDateTime inputDate = m_inputs.value(0)->dateTimeAt(row);
if (!inputDate.isValid()) return 0; if (!inputDate.isValid()) return 0;
#if QT_VERSION >= 0x051400 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QDateTime start(QDate(1900, 1, 1).startOfDay()); QDateTime start(QDate(1900, 1, 1).startOfDay());
#else #else
QDateTime start(QDate(1900, 1, 1)); QDateTime start(QDate(1900, 1, 1));
......
...@@ -42,7 +42,7 @@ public: ...@@ -42,7 +42,7 @@ public:
if (!m_inputs.value(0)) return NAN; if (!m_inputs.value(0)) return NAN;
QDateTime inputDate = m_inputs.value(0)->dateTimeAt(row); QDateTime inputDate = m_inputs.value(0)->dateTimeAt(row);
if (!inputDate.isValid()) return NAN; if (!inputDate.isValid()) return NAN;
#if QT_VERSION >= 0x051400 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QDateTime start(QDate(1900, 1, 1).startOfDay()); QDateTime start(QDate(1900, 1, 1).startOfDay());
#else #else
QDateTime start(QDate(1900, 1, 1)); QDateTime start(QDate(1900, 1, 1));
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
if (!m_inputs.value(0)) return 0; if (!m_inputs.value(0)) return 0;
QDateTime inputDate = m_inputs.value(0)->dateTimeAt(row); QDateTime inputDate = m_inputs.value(0)->dateTimeAt(row);
if (!inputDate.isValid()) return 0; if (!inputDate.isValid()) return 0;
#if QT_VERSION >= 0x051400 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QDateTime start(QDate(1900, 1, 1).startOfDay()); QDateTime start(QDate(1900, 1, 1).startOfDay());
#else #else
QDateTime start(QDate(1900, 1, 1)); QDateTime start(QDate(1900, 1, 1));
......
...@@ -1310,7 +1310,7 @@ QStringList ExpressionParser::getParameter(const QString& expr, const QStringLis ...@@ -1310,7 +1310,7 @@ QStringList ExpressionParser::getParameter(const QString& expr, const QStringLis
QStringList strings = expr.split(QRegularExpression(QStringLiteral("\\W+")), QString::SkipEmptyParts); QStringList strings = expr.split(QRegularExpression(QStringLiteral("\\W+")), QString::SkipEmptyParts);
QDEBUG("found strings:" << strings); QDEBUG("found strings:" << strings);
// RE for any number // RE for any number
#if QT_VERSION >= 0x051200 #if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
const QRegularExpression re(QRegularExpression::anchoredPattern(QStringLiteral("[0-9]*"))); const QRegularExpression re(QRegularExpression::anchoredPattern(QStringLiteral("[0-9]*")));
#else #else
const QRegularExpression re("\\A(?:" + QStringLiteral("[0-9]*") + ")\\z"); const QRegularExpression re("\\A(?:" + QStringLiteral("[0-9]*") + ")\\z");
......
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
#include <QTextStream> #include <QTextStream>
#include <QProcess> #include <QProcess>
#include <QRegularExpression> #include <QRegularExpression>
#if QT_VERSION >= 0x051000 #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
#include <QRandomGenerator> #include <QRandomGenerator>
#endif #endif
...@@ -1854,7 +1854,7 @@ void SpreadsheetView::fillSelectedCellsWithRandomNumbers() { ...@@ -1854,7 +1854,7 @@ void SpreadsheetView::fillSelectedCellsWithRandomNumbers() {
QVector<double> results(last-first+1); QVector<double> results(last-first+1);
for (int row = first; row <= last; row++) for (int row = first; row <= last; row++)
if (isCellSelected(row, col)) if (isCellSelected(row, col))
#if QT_VERSION >= 0x051000 #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
results[row-first] = QRandomGenerator::global()->generateDouble(); results[row-first] = QRandomGenerator::global()->generateDouble();
#else #else
results[row-first] = double(qrand())/double(RAND_MAX); results[row-first] = double(qrand())/double(RAND_MAX);
...@@ -1868,7 +1868,7 @@ void SpreadsheetView::fillSelectedCellsWithRandomNumbers() { ...@@ -1868,7 +1868,7 @@ void SpreadsheetView::fillSelectedCellsWithRandomNumbers() {
QVector<int> results(last-first+1); QVector<int> results(last-first+1);
for (int row = first; row <= last; row++) for (int row = first; row <= last; row++)
if (isCellSelected(row, col)) if (isCellSelected(row, col))
#if QT_VERSION >= 0x051000 #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
results[row-first] = QRandomGenerator::global()->generate(); results[row-first] = QRandomGenerator::global()->generate();
#else #else
results[row-first] = qrand(); results[row-first] = qrand();
...@@ -1882,7 +1882,7 @@ void SpreadsheetView::fillSelectedCellsWithRandomNumbers() { ...@@ -1882,7 +1882,7 @@ void SpreadsheetView::fillSelectedCellsWithRandomNumbers() {
QVector<qint64> results(last-first+1); QVector<qint64> results(last-first+1);
for (int row = first; row <= last; row++) for (int row = first; row <= last; row++)
if (isCellSelected(row, col)) if (isCellSelected(row, col))
#if QT_VERSION >= 0x051000 #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
results[row-first] = QRandomGenerator::global()->generate64(); results[row-first] = QRandomGenerator::global()->generate64();
#else #else
results[row-first] = qrand(); results[row-first] = qrand();
...@@ -1896,7 +1896,7 @@ void SpreadsheetView::fillSelectedCellsWithRandomNumbers() { ...@@ -1896,7 +1896,7 @@ void SpreadsheetView::fillSelectedCellsWithRandomNumbers() {
QVector<QString> results; QVector<QString> results;
for (int row = first; row <= last; row++) for (int row = first; row <= last; row++)
if (isCellSelected(row, col)) if (isCellSelected(row, col))
#if QT_VERSION >= 0x051000 #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
results[row-first] = QString::number(QRandomGenerator::global()->generateDouble()); results[row-first] = QString::number(QRandomGenerator::global()->generateDouble());
#else #else
results << QString::number(double(qrand())/double(RAND_MAX)); results << QString::number(double(qrand())/double(RAND_MAX));
...@@ -1915,7 +1915,7 @@ void SpreadsheetView::fillSelectedCellsWithRandomNumbers() { ...@@ -1915,7 +1915,7 @@ void SpreadsheetView::fillSelectedCellsWithRandomNumbers() {
QTime midnight(0, 0, 0, 0); QTime midnight(0, 0, 0, 0);
for (int row = first; row <= last; row++) for (int row = first; row <= last; row++)
if (isCellSelected(row, col)) if (isCellSelected(row, col))
#if QT_VERSION >= 0x051000 #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
results << QDateTime( earliestDate.addDays((QRandomGenerator::global()->generateDouble())*((double)earliestDate.daysTo(latestDate)), midnight.addMSecs((QRandomGenerator::global()->generateDouble())*1000*60*60*24)); results << QDateTime( earliestDate.addDays((QRandomGenerator::global()->generateDouble())*((double)earliestDate.daysTo(latestDate)), midnight.addMSecs((QRandomGenerator::global()->generateDouble())*1000*60*60*24));
#else #else
results << QDateTime( earliestDate.addDays(((double)qrand())*((double)earliestDate.daysTo(latestDate))/((double)RAND_MAX)), midnight.addMSecs(((qint64)qrand())*1000*60*60*24/RAND_MAX)); results << QDateTime( earliestDate.addDays(((double)qrand())*((double)earliestDate.daysTo(latestDate))/((double)RAND_MAX)), midnight.addMSecs(((qint64)qrand())*1000*60*60*24/RAND_MAX));
......
...@@ -163,7 +163,7 @@ QString FileInfoDialog::fileInfoString(const QString& name) const { ...@@ -163,7 +163,7 @@ QString FileInfoDialog::fileInfoString(const QString& name) const {
infoStrings << i18n("Writable: %1", fileInfo.isWritable() ? i18n("yes") : i18n("no")); infoStrings << i18n("Writable: %1", fileInfo.isWritable() ? i18n("yes") : i18n("no"));
infoStrings << i18n("Executable: %1", fileInfo.isExecutable() ? i18n("yes") : i18n("no")); infoStrings << i18n("Executable: %1", fileInfo.isExecutable() ? i18n("yes") : i18n("no"));
#if QT_VERSION >= 0x051000 #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
infoStrings << i18n("Birth time: %1", fileInfo.birthTime().toString()); infoStrings << i18n("Birth time: %1", fileInfo.birthTime().toString());
infoStrings << i18n("Last metadata changed: %1", fileInfo.metadataChangeTime().toString()); infoStrings << i18n("Last metadata changed: %1", fileInfo.metadataChangeTime().toString());
#else #else
......
...@@ -66,7 +66,7 @@ void MQTTUnitTest::testContainFalse() { ...@@ -66,7 +66,7 @@ void MQTTUnitTest::testContainFalse() {
while(!in.atEnd()) { while(!in.atEnd()) {
QString line = in.readLine(); QString line = in.readLine();
#if QT_VERSION >= 0x051400 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList topics = line.split(QLatin1Char(' '), Qt::SkipEmptyParts); QStringList topics = line.split(QLatin1Char(' '), Qt::SkipEmptyParts);
#else #else
QStringList topics = line.split(QLatin1Char(' '), QString::SkipEmptyParts); QStringList topics = line.split(QLatin1Char(' '), QString::SkipEmptyParts);
...@@ -89,7 +89,7 @@ void MQTTUnitTest::testContainTrue() { ...@@ -89,7 +89,7 @@ void MQTTUnitTest::testContainTrue() {
while(!in.atEnd()) { while(!in.atEnd()) {
QString line = in.readLine(); QString line = in.readLine();
#if QT_VERSION >= 0x051400 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList topics = line.split(QLatin1Char(' '), Qt::SkipEmptyParts); QStringList topics = line.split(QLatin1Char(' '), Qt::SkipEmptyParts);
#else #else
QStringList topics = line.split(QLatin1Char(' '), QString::SkipEmptyParts); QStringList topics = line.split(QLatin1Char(' '), QString::SkipEmptyParts);
...@@ -115,7 +115,7 @@ void MQTTUnitTest::testCommonTrue(){ ...@@ -115,7 +115,7 @@ void MQTTUnitTest::testCommonTrue(){
while(!in.atEnd()) { while(!in.atEnd()) {
QString line = in.readLine(); QString line = in.readLine();
#if QT_VERSION >= 0x051400 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList topics = line.split(QLatin1Char(' '), Qt::SkipEmptyParts); QStringList topics = line.split(QLatin1Char(' '), Qt::SkipEmptyParts);
#else #else
QStringList topics = line.split(QLatin1Char(' '), QString::SkipEmptyParts); QStringList topics = line.split(QLatin1Char(' '), QString::SkipEmptyParts);
...@@ -138,7 +138,7 @@ void MQTTUnitTest::testCommonFalse(){ ...@@ -138,7 +138,7 @@ void MQTTUnitTest::testCommonFalse(){
while(!in.atEnd()) { while(!in.atEnd()) {
QString line = in.readLine(); QString line = in.readLine();
#if QT_VERSION >= 0x051400 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList topics = line.split(QLatin1Char(' '), Qt::SkipEmptyParts); QStringList topics = line.split(QLatin1Char(' '), Qt::SkipEmptyParts);
#else #else
QStringList topics = line.split(QLatin1Char(' '), QString::SkipEmptyParts); QStringList topics = line.split(QLatin1Char(' '), QString::SkipEmptyParts);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
#include <QUndoStack> #include <QUndoStack>
#if QT_VERSION >= 0x051000 #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
#include <QRandomGenerator> #include <QRandomGenerator>
#endif #endif
...@@ -1017,7 +1017,7 @@ void SpreadsheetTest::testSortPerformanceNumeric1() { ...@@ -1017,7 +1017,7 @@ void SpreadsheetTest::testSortPerformanceNumeric1() {
QVector<double> xData; QVector<double> xData;
for (int i = 0; i < sheet.rowCount(); i++) for (int i = 0; i < sheet.rowCount(); i++)
#if QT_VERSION >= 0x051000 #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
xData << QRandomGenerator::global()->generateDouble(); xData << QRandomGenerator::global()->generateDouble();
#else #else
xData << (double)(qrand())/RAND_MAX; xData << (double)(qrand())/RAND_MAX;
...@@ -1043,7 +1043,7 @@ void SpreadsheetTest::testSortPerformanceNumeric2() { ...@@ -1043,7 +1043,7 @@ void SpreadsheetTest::testSortPerformanceNumeric2() {
QVector<double> xData; QVector<double> xData;
QVector<int> yData; QVector<int> yData;
for (int i = 0; i < sheet.rowCount(); i++) { for (int i = 0; i < sheet.rowCount(); i++) {
#if QT_VERSION >= 0x051000 #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
xData << QRandomGenerator::global()->generateDouble(); xData << QRandomGenerator::global()->generateDouble();
#else #else
xData << (double)(qrand())/RAND_MAX; xData << (double)(qrand())/RAND_MAX;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment