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

Avoid compiler warnings using newer Qt

parent c5014a92
......@@ -41,7 +41,7 @@ public:
if (!m_inputs.value(0)) return 0;
QDateTime inputDate = m_inputs.value(0)->dateTimeAt(row);
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());
#else
QDateTime start(QDate(1900, 1, 1));
......
......@@ -42,7 +42,7 @@ public:
if (!m_inputs.value(0)) return NAN;
QDateTime inputDate = m_inputs.value(0)->dateTimeAt(row);
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());
#else
QDateTime start(QDate(1900, 1, 1));
......
......@@ -41,7 +41,7 @@ public:
if (!m_inputs.value(0)) return 0;
QDateTime inputDate = m_inputs.value(0)->dateTimeAt(row);
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());
#else
QDateTime start(QDate(1900, 1, 1));
......
......@@ -1310,7 +1310,7 @@ QStringList ExpressionParser::getParameter(const QString& expr, const QStringLis
QStringList strings = expr.split(QRegularExpression(QStringLiteral("\\W+")), QString::SkipEmptyParts);
QDEBUG("found strings:" << strings);
// 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]*")));
#else
const QRegularExpression re("\\A(?:" + QStringLiteral("[0-9]*") + ")\\z");
......
......@@ -88,7 +88,7 @@
#include <QTextStream>
#include <QProcess>
#include <QRegularExpression>
#if QT_VERSION >= 0x051000
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
#include <QRandomGenerator>
#endif
......@@ -1854,7 +1854,7 @@ void SpreadsheetView::fillSelectedCellsWithRandomNumbers() {
QVector<double> results(last-first+1);
for (int row = first; row <= last; row++)
if (isCellSelected(row, col))
#if QT_VERSION >= 0x051000
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
results[row-first] = QRandomGenerator::global()->generateDouble();
#else
results[row-first] = double(qrand())/double(RAND_MAX);
......@@ -1868,7 +1868,7 @@ void SpreadsheetView::fillSelectedCellsWithRandomNumbers() {
QVector<int> results(last-first+1);
for (int row = first; row <= last; row++)
if (isCellSelected(row, col))
#if QT_VERSION >= 0x051000
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
results[row-first] = QRandomGenerator::global()->generate();
#else
results[row-first] = qrand();
......@@ -1882,7 +1882,7 @@ void SpreadsheetView::fillSelectedCellsWithRandomNumbers() {
QVector<qint64> results(last-first+1);
for (int row = first; row <= last; row++)
if (isCellSelected(row, col))
#if QT_VERSION >= 0x051000
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
results[row-first] = QRandomGenerator::global()->generate64();
#else
results[row-first] = qrand();
......@@ -1896,7 +1896,7 @@ void SpreadsheetView::fillSelectedCellsWithRandomNumbers() {
QVector<QString> results;
for (int row = first; row <= last; row++)
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());
#else
results << QString::number(double(qrand())/double(RAND_MAX));
......@@ -1915,7 +1915,7 @@ void SpreadsheetView::fillSelectedCellsWithRandomNumbers() {
QTime midnight(0, 0, 0, 0);
for (int row = first; row <= last; row++)
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));
#else
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 {
infoStrings << i18n("Writable: %1", fileInfo.isWritable() ? 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("Last metadata changed: %1", fileInfo.metadataChangeTime().toString());
#else
......
......@@ -66,7 +66,7 @@ void MQTTUnitTest::testContainFalse() {
while(!in.atEnd()) {
QString line = in.readLine();
#if QT_VERSION >= 0x051400
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList topics = line.split(QLatin1Char(' '), Qt::SkipEmptyParts);
#else
QStringList topics = line.split(QLatin1Char(' '), QString::SkipEmptyParts);
......@@ -89,7 +89,7 @@ void MQTTUnitTest::testContainTrue() {
while(!in.atEnd()) {
QString line = in.readLine();
#if QT_VERSION >= 0x051400
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList topics = line.split(QLatin1Char(' '), Qt::SkipEmptyParts);
#else
QStringList topics = line.split(QLatin1Char(' '), QString::SkipEmptyParts);
......@@ -115,7 +115,7 @@ void MQTTUnitTest::testCommonTrue(){
while(!in.atEnd()) {
QString line = in.readLine();
#if QT_VERSION >= 0x051400
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList topics = line.split(QLatin1Char(' '), Qt::SkipEmptyParts);
#else
QStringList topics = line.split(QLatin1Char(' '), QString::SkipEmptyParts);
......@@ -138,7 +138,7 @@ void MQTTUnitTest::testCommonFalse(){
while(!in.atEnd()) {
QString line = in.readLine();
#if QT_VERSION >= 0x051400
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList topics = line.split(QLatin1Char(' '), Qt::SkipEmptyParts);
#else
QStringList topics = line.split(QLatin1Char(' '), QString::SkipEmptyParts);
......
......@@ -33,7 +33,7 @@
#include <QApplication>
#include <QClipboard>
#include <QUndoStack>
#if QT_VERSION >= 0x051000
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
#include <QRandomGenerator>
#endif
......@@ -1017,7 +1017,7 @@ void SpreadsheetTest::testSortPerformanceNumeric1() {
QVector<double> xData;
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();
#else
xData << (double)(qrand())/RAND_MAX;
......@@ -1043,7 +1043,7 @@ void SpreadsheetTest::testSortPerformanceNumeric2() {
QVector<double> xData;
QVector<int> yData;
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();
#else
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