mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix several deprecation warnings (#8657)
* Use constructor instead of nullptr for WindowFlags * Use constructor instead of nullptr for Alignment * Disable deprecation warning for QProcess * Add string split method to RaTextStringTools * Add caf.cpp used to manage Qt function deprecations * Use position()
This commit is contained in:
@@ -23,6 +23,10 @@
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
|
||||
// Disable deprecation warning for QProcess::start()
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4996 )
|
||||
#endif
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
#include "RiaImageFileCompare.h"
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
// Disable deprecation warning for QProcess::start()
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4996 )
|
||||
#endif
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
|
||||
@@ -210,6 +210,18 @@ QDateTime RiaQDateTimeTools::subtractPeriod( const QDateTime& dt, RiaQDateTimeTo
|
||||
return subtractSpan( dt, timeSpan( period ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RiaQDateTimeTools::createDateTime( const QDate& date )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 )
|
||||
return date.startOfDay();
|
||||
#else
|
||||
return QDateTime( date, QTime( 0, 0 ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -239,7 +251,7 @@ QDateTime RiaQDateTimeTools::createUtcDateTime()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RiaQDateTimeTools::createUtcDateTime( const QDate& date )
|
||||
{
|
||||
auto qdt = QDateTime( date );
|
||||
auto qdt = createDateTime( date );
|
||||
qdt.setTimeSpec( currentTimeSpec() );
|
||||
return qdt;
|
||||
}
|
||||
|
||||
@@ -97,6 +97,8 @@ public:
|
||||
static QDateTime addPeriod( const QDateTime& dt, RiaQDateTimeTools::DateTimePeriod period );
|
||||
static QDateTime subtractPeriod( const QDateTime& dt, RiaQDateTimeTools::DateTimePeriod period );
|
||||
|
||||
static QDateTime createDateTime( const QDate& date );
|
||||
|
||||
static QDateTime epoch();
|
||||
|
||||
static QDateTime createUtcDateTime();
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "RiaProjectModifier.h"
|
||||
#include "RiaRegressionTest.h"
|
||||
#include "RiaTextFileCompare.h"
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
@@ -538,7 +539,7 @@ QString RiaRegressionTestRunner::diff2htmlHeaderText( const QString& testRootPat
|
||||
QString html;
|
||||
|
||||
QString oldProjPath = QDir::fromNativeSeparators( testRootPath );
|
||||
QStringList pathFolders = oldProjPath.split( "/", QString::KeepEmptyParts );
|
||||
QStringList pathFolders = oldProjPath.split( "/" );
|
||||
|
||||
QString path;
|
||||
for ( const auto& f : pathFolders )
|
||||
@@ -611,7 +612,7 @@ void RiaRegressionTestRunner::executeRegressionTests()
|
||||
testConfig.readSettingsFromApplicationStore();
|
||||
|
||||
QString testPath = testConfig.regressionTestFolder();
|
||||
QStringList testFilter = testConfig.testFilter().split( ";", QString::SkipEmptyParts );
|
||||
QStringList testFilter = RiaTextStringTools::splitSkipEmptyParts( testConfig.testFilter(), ";" );
|
||||
|
||||
if ( testConfig.appendTestsAfterTestFilter )
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaStdStringTools.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
#include "RifReaderEclipseSummary.h"
|
||||
@@ -217,9 +218,7 @@ std::pair<std::vector<RimSummaryCase*>, std::vector<RimSummaryCaseCollection*>>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RiaSummaryStringTools::splitIntoWords( const QString& text )
|
||||
{
|
||||
QStringList words = text.split( QRegExp( "\\s+" ), QString::SkipEmptyParts );
|
||||
|
||||
return words;
|
||||
return RiaTextStringTools::splitSkipEmptyParts( text, QRegExp( "\\s+" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -22,6 +22,11 @@
|
||||
|
||||
#include <QProcess>
|
||||
|
||||
// Disable deprecation warning for QProcess::start()
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4996 )
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -127,3 +127,27 @@ QString RiaTextStringTools::trimNonAlphaNumericCharacters( const QString& s )
|
||||
trimmedString.replace( trimRe, "" );
|
||||
return trimmedString;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RiaTextStringTools::splitSkipEmptyParts( const QString& text, const QString& sep /*= " " */ )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 )
|
||||
return text.split( sep, Qt::SkipEmptyParts, Qt::CaseInsensitive );
|
||||
#else
|
||||
return text.split( sep, QString::SkipEmptyParts, Qt::CaseInsensitive );
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RiaTextStringTools::splitSkipEmptyParts( const QString& text, const QRegExp& regExp )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 )
|
||||
return text.split( regExp, Qt::SkipEmptyParts );
|
||||
#else
|
||||
return text.split( regExp, QString::SkipEmptyParts );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
class QString;
|
||||
#include <QString>
|
||||
|
||||
class QStringList;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -31,4 +32,8 @@ QString trimAndRemoveDoubleSpaces( const QString& s );
|
||||
QString commonRoot( const QStringList& stringList );
|
||||
QString commonSuffix( const QStringList& stringList );
|
||||
QString trimNonAlphaNumericCharacters( const QString& s );
|
||||
|
||||
QStringList splitSkipEmptyParts( const QString& text, const QString& sep = " " );
|
||||
QStringList splitSkipEmptyParts( const QString& text, const QRegExp& regExp );
|
||||
|
||||
} // namespace RiaTextStringTools
|
||||
|
||||
Reference in New Issue
Block a user