mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add support for Qt6 and disable Qt5
Required changes to use Qt6 and disable support for Qt5. There are still some adjustments related to Qt6 to be done, but these changes are not required to make Qt6 compile on relevant systems. * Build system changes Qt6 * Override enterEvent * Update QKeySequence * QtChart changes * Use QScreen to instepct dotsPerInch * Add app->quit() * Required updates for code related to QString * Use RiaQDateTimeTools * Required changes related to regular expressions * Support compile on Qt < 6.5 When version < 6.5 is found, qt_generate_deploy_app_script() is disabled. Compilation of ResInsight will work, but the install target will be incomplete. * Octave: add missing header. * Qt Advanced Docking: force Qt6 where both Qt5 and Qt6 is available. --------- Co-authored-by: magnesj <1793152+magnesj@users.noreply.github.com> Co-authored-by: Kristian Bendiksen <kristian.bendiksen@gmail.com>
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaStdStringTools.h"
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QString>
|
||||
@@ -132,7 +133,7 @@ void RifCaseRealizationParametersReader::parse()
|
||||
QString& name = cols[0];
|
||||
QString& strValue = cols[1];
|
||||
|
||||
if ( RiaStdStringTools::isNumber( strValue.toStdString(), QLocale::c().decimalPoint().toLatin1() ) )
|
||||
if ( RiaTextStringTools::isNumber( strValue, QLocale::c().decimalPoint() ) )
|
||||
{
|
||||
bool parseOk = true;
|
||||
double value = QLocale::c().toDouble( strValue, &parseOk );
|
||||
@@ -192,23 +193,23 @@ void RifCaseRealizationRunspecificationReader::parse()
|
||||
|
||||
if ( xml.isStartElement() )
|
||||
{
|
||||
if ( xml.name() == "modifier" )
|
||||
if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "modifier" ) ) )
|
||||
{
|
||||
paramName = "";
|
||||
}
|
||||
|
||||
if ( xml.name() == "id" )
|
||||
if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "id" ) ) )
|
||||
{
|
||||
paramName = xml.readElementText();
|
||||
}
|
||||
|
||||
if ( xml.name() == "value" )
|
||||
if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "value" ) ) )
|
||||
{
|
||||
QString paramStrValue = xml.readElementText();
|
||||
|
||||
if ( paramName.isEmpty() ) continue;
|
||||
|
||||
if ( RiaStdStringTools::isNumber( paramStrValue.toStdString(), QLocale::c().decimalPoint().toLatin1() ) )
|
||||
if ( RiaTextStringTools::isNumber( paramStrValue, QLocale::c().decimalPoint() ) )
|
||||
{
|
||||
bool parseOk = true;
|
||||
double value = QLocale::c().toDouble( paramStrValue, &parseOk );
|
||||
@@ -230,7 +231,7 @@ void RifCaseRealizationRunspecificationReader::parse()
|
||||
}
|
||||
else if ( xml.isEndElement() )
|
||||
{
|
||||
if ( xml.name() == "modifier" )
|
||||
if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "modifier" ) ) )
|
||||
{
|
||||
paramName = "";
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ bool RifCsvUserDataParser::parseColumnInfo( QTextStream*
|
||||
QStringList candidateColumnHeaders = RifFileParseTools::splitLineAndTrim( candidateLine, parseOptions.cellSeparator );
|
||||
for ( const auto& text : candidateColumnHeaders )
|
||||
{
|
||||
if ( RiaStdStringTools::isNumber( text.toStdString(), parseOptions.locale.decimalPoint().toLatin1() ) )
|
||||
if ( RiaTextStringTools::isNumber( text, parseOptions.locale.decimalPoint() ) )
|
||||
{
|
||||
hasDataValues = true;
|
||||
}
|
||||
@@ -504,8 +504,8 @@ bool RifCsvUserDataParser::parseColumnBasedData( const RifAsciiDataParseOptions&
|
||||
{
|
||||
for ( int iCol = 0; iCol < colCount; iCol++ )
|
||||
{
|
||||
std::string colData = lineColumns[iCol].toStdString();
|
||||
Column& col = columnInfoList[iCol];
|
||||
auto colData = lineColumns[iCol];
|
||||
Column& col = columnInfoList[iCol];
|
||||
|
||||
// Determine column data type
|
||||
if ( col.dataType == Column::NONE )
|
||||
@@ -517,7 +517,7 @@ bool RifCsvUserDataParser::parseColumnBasedData( const RifAsciiDataParseOptions&
|
||||
else
|
||||
{
|
||||
if ( parseOptions.assumeNumericDataColumns ||
|
||||
RiaStdStringTools::isNumber( colData, parseOptions.locale.decimalPoint().toLatin1() ) )
|
||||
RiaTextStringTools::isNumber( colData, parseOptions.locale.decimalPoint() ) )
|
||||
{
|
||||
col.dataType = Column::NUMERIC;
|
||||
}
|
||||
|
||||
@@ -19,10 +19,12 @@
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RiaStdStringTools.h"
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
#include "RifEclEclipseSummary.h"
|
||||
#include "RiuSummaryQuantityNameInfoProvider.h"
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QStringList>
|
||||
#include <QTextStream>
|
||||
|
||||
@@ -1213,7 +1215,7 @@ std::string RifEclipseSummaryAddress::blockAsString() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::tuple<int, int, int> RifEclipseSummaryAddress::ijkTupleFromUiText( const std::string& s )
|
||||
{
|
||||
QStringList ijk = QString().fromStdString( s ).trimmed().split( QRegExp( "[,]" ) );
|
||||
auto ijk = RiaTextStringTools::splitSkipEmptyParts( QString::fromStdString( s ).trimmed(), QRegExp( "[,]" ) );
|
||||
|
||||
if ( ijk.size() != 3 ) return std::make_tuple( -1, -1, -1 );
|
||||
|
||||
@@ -1235,7 +1237,7 @@ std::string RifEclipseSummaryAddress::formatUiTextRegionToRegion() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<int, int> RifEclipseSummaryAddress::regionToRegionPairFromUiText( const std::string& s )
|
||||
{
|
||||
QStringList r2r = QString().fromStdString( s ).trimmed().split( QRegExp( "[-]" ) );
|
||||
auto r2r = RiaTextStringTools::splitSkipEmptyParts( QString::fromStdString( s ).trimmed(), QRegExp( "[-]" ) );
|
||||
|
||||
if ( r2r.size() != 2 ) return std::make_pair( -1, -1 );
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RifFileParseTools.h"
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
// Disable deprecation warning for QString::SkipEmptyParts
|
||||
#ifdef _MSC_VER
|
||||
@@ -31,7 +32,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RifFileParseTools::splitLineAndTrim( const QString& line, const QString& separator, bool skipEmptyParts )
|
||||
{
|
||||
QStringList cols = line.trimmed().split( separator, skipEmptyParts ? QString::SkipEmptyParts : QString::KeepEmptyParts );
|
||||
auto cols = RiaTextStringTools::splitString( line.trimmed(), separator, skipEmptyParts );
|
||||
for ( QString& col : cols )
|
||||
{
|
||||
col = col.trimmed();
|
||||
@@ -44,7 +45,7 @@ QStringList RifFileParseTools::splitLineAndTrim( const QString& line, const QStr
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RifFileParseTools::splitLineAndTrim( const QString& line, const QRegExp& regexp, bool skipEmptyParts )
|
||||
{
|
||||
QStringList cols = line.trimmed().split( regexp, skipEmptyParts ? QString::SkipEmptyParts : QString::KeepEmptyParts );
|
||||
auto cols = RiaTextStringTools::splitString( line.trimmed(), regexp, skipEmptyParts );
|
||||
for ( QString& col : cols )
|
||||
{
|
||||
col = col.trimmed();
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "RifParameterXmlReader.h"
|
||||
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
#include "RimDoubleParameter.h"
|
||||
#include "RimGenericParameter.h"
|
||||
#include "RimIntegerParameter.h"
|
||||
@@ -103,7 +105,7 @@ bool RifParameterXmlReader::parseFile( QString& outErrorText )
|
||||
{
|
||||
if ( xml.isStartElement() )
|
||||
{
|
||||
if ( xml.name() == "group" )
|
||||
if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "group" ) ) )
|
||||
{
|
||||
// check that we have the required attributes
|
||||
for ( auto& reqattr : reqGroupAttrs )
|
||||
@@ -136,7 +138,7 @@ bool RifParameterXmlReader::parseFile( QString& outErrorText )
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if ( xml.name() == "parameter" )
|
||||
else if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "parameter" ) ) )
|
||||
{
|
||||
if ( group == nullptr ) continue;
|
||||
|
||||
@@ -192,7 +194,7 @@ bool RifParameterXmlReader::parseFile( QString& outErrorText )
|
||||
currentList->addParameter( parameter->name() );
|
||||
}
|
||||
}
|
||||
else if ( xml.name() == "list" )
|
||||
else if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "list" ) ) )
|
||||
{
|
||||
// check that we have the required attributes
|
||||
for ( auto& reqattr : reqListAttrs )
|
||||
@@ -213,7 +215,7 @@ bool RifParameterXmlReader::parseFile( QString& outErrorText )
|
||||
}
|
||||
else if ( xml.isEndElement() )
|
||||
{
|
||||
if ( xml.name() == "group" )
|
||||
if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "group" ) ) )
|
||||
{
|
||||
if ( group != nullptr )
|
||||
{
|
||||
@@ -221,7 +223,7 @@ bool RifParameterXmlReader::parseFile( QString& outErrorText )
|
||||
group = nullptr;
|
||||
}
|
||||
}
|
||||
else if ( xml.name() == "list" )
|
||||
else if ( RiaTextStringTools::isTextEqual( xml.name(), QString( "list" ) ) )
|
||||
{
|
||||
if ( group )
|
||||
{
|
||||
|
||||
@@ -86,8 +86,7 @@ void RifReaderEclipseRft::open()
|
||||
|
||||
time_t timeStepTime_t = ecl_rft_node_get_date( node );
|
||||
|
||||
QDateTime timeStep = RiaQDateTimeTools::createUtcDateTime();
|
||||
timeStep.setTime_t( timeStepTime_t );
|
||||
QDateTime timeStep = RiaQDateTimeTools::fromTime_t( timeStepTime_t );
|
||||
|
||||
RifEclipseRftAddress addressPressure =
|
||||
RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE );
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "RigStimPlanFractureDefinition.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QStringView>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
@@ -107,20 +108,20 @@ cvf::ref<RigStimPlanFractureDefinition> RifStimPlanXmlReader::readStimPlanXMLFil
|
||||
|
||||
if ( xmlStream2.isStartElement() )
|
||||
{
|
||||
if ( isTextEqual( xmlStream2.name(), "properties" ) )
|
||||
if ( RiaTextStringTools::isTextEqual( xmlStream2.name(), QString( "properties" ) ) )
|
||||
{
|
||||
propertiesElementCount++;
|
||||
}
|
||||
else if ( isTextEqual( xmlStream2.name(), "property" ) )
|
||||
else if ( RiaTextStringTools::isTextEqual( xmlStream2.name(), QString( "property" ) ) )
|
||||
{
|
||||
unit = getAttributeValueString( xmlStream2, "uom" );
|
||||
parameter = getAttributeValueString( xmlStream2, "name" );
|
||||
unit = getAttributeValueString( xmlStream2, QString( "uom" ) );
|
||||
parameter = getAttributeValueString( xmlStream2, QString( "name" ) );
|
||||
|
||||
RiaLogging::info( QString( "%1 [%2]" ).arg( parameter, unit ) );
|
||||
}
|
||||
else if ( isTextEqual( xmlStream2.name(), "time" ) )
|
||||
else if ( RiaTextStringTools::isTextEqual( xmlStream2.name(), QString( "time" ) ) )
|
||||
{
|
||||
double timeStepValue = getAttributeValueDouble( xmlStream2, "value" );
|
||||
double timeStepValue = getAttributeValueDouble( xmlStream2, QString( "value" ) );
|
||||
|
||||
std::vector<std::vector<double>> propertyValuesAtTimestep =
|
||||
stimPlanFileData->generateDataLayoutFromFileDataLayout( getAllDepthDataAtTimeStep( xmlStream2 ) );
|
||||
@@ -201,12 +202,12 @@ void RifStimPlanXmlReader::readStimplanGridAndTimesteps( QXmlStreamReader&
|
||||
{
|
||||
RiaDefines::EclipseUnitSystem destinationUnit = requiredUnit;
|
||||
|
||||
if ( isTextEqual( xmlStream.name(), "grid" ) )
|
||||
if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "grid" ) ) )
|
||||
{
|
||||
// Support for one grid per file
|
||||
if ( gridSectionCount < 1 )
|
||||
{
|
||||
QString gridunit = getAttributeValueString( xmlStream, "uom" );
|
||||
QString gridunit = getAttributeValueString( xmlStream, QString( "uom" ) );
|
||||
|
||||
if ( gridunit.compare( "m", Qt::CaseInsensitive ) == 0 )
|
||||
stimPlanFileData->m_unitSet = RiaDefines::EclipseUnitSystem::UNITS_METRIC;
|
||||
@@ -234,42 +235,42 @@ void RifStimPlanXmlReader::readStimplanGridAndTimesteps( QXmlStreamReader&
|
||||
|
||||
gridSectionCount++;
|
||||
}
|
||||
else if ( isTextEqual( xmlStream.name(), "perf" ) )
|
||||
else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "perf" ) ) )
|
||||
{
|
||||
QString perfUnit = getAttributeValueString( xmlStream, "uom" );
|
||||
QString fracName = getAttributeValueString( xmlStream, "frac" );
|
||||
QString perfUnit = getAttributeValueString( xmlStream, QString( "uom" ) );
|
||||
QString fracName = getAttributeValueString( xmlStream, QString( "frac" ) );
|
||||
}
|
||||
else if ( isTextEqual( xmlStream.name(), "topTVD" ) )
|
||||
else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "topTVD" ) ) )
|
||||
{
|
||||
auto valText = xmlStream.readElementText();
|
||||
tvdToTopPerf = valText.toDouble();
|
||||
}
|
||||
else if ( isTextEqual( xmlStream.name(), "bottomTVD" ) )
|
||||
else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "bottomTVD" ) ) )
|
||||
{
|
||||
auto valText = xmlStream.readElementText();
|
||||
tvdToBotPerf = valText.toDouble();
|
||||
}
|
||||
else if ( isTextEqual( xmlStream.name(), "topMD" ) )
|
||||
else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "topMD" ) ) )
|
||||
{
|
||||
auto valText = xmlStream.readElementText();
|
||||
mdToTopPerf = valText.toDouble();
|
||||
}
|
||||
else if ( isTextEqual( xmlStream.name(), "bottomMD" ) )
|
||||
else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "bottomMD" ) ) )
|
||||
{
|
||||
auto valText = xmlStream.readElementText();
|
||||
mdToBotPerf = valText.toDouble();
|
||||
}
|
||||
else if ( isTextEqual( xmlStream.name(), "FmDip" ) )
|
||||
else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "FmDip" ) ) )
|
||||
{
|
||||
auto valText = xmlStream.readElementText();
|
||||
formationDip = valText.toDouble();
|
||||
}
|
||||
else if ( isTextEqual( xmlStream.name(), "orientation" ) )
|
||||
else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "orientation" ) ) )
|
||||
{
|
||||
auto valText = xmlStream.readElementText();
|
||||
orientation = mapTextToOrientation( valText.trimmed() );
|
||||
}
|
||||
else if ( isTextEqual( xmlStream.name(), "xs" ) )
|
||||
else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "xs" ) ) )
|
||||
{
|
||||
std::vector<double> gridValuesXs;
|
||||
{
|
||||
@@ -285,7 +286,7 @@ void RifStimPlanXmlReader::readStimplanGridAndTimesteps( QXmlStreamReader&
|
||||
stimPlanFileData->generateXsFromFileXs( mirrorMode == MirrorMode::MIRROR_AUTO ? !hasNegativeValues( gridValuesXs )
|
||||
: (bool)mirrorMode );
|
||||
}
|
||||
else if ( xmlStream.name() == "ys" )
|
||||
else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "ys" ) ) )
|
||||
{
|
||||
std::vector<double> gridValuesYs;
|
||||
{
|
||||
@@ -304,7 +305,7 @@ void RifStimPlanXmlReader::readStimplanGridAndTimesteps( QXmlStreamReader&
|
||||
stimPlanFileData->m_Ys = ys;
|
||||
}
|
||||
|
||||
else if ( xmlStream.name() == "time" )
|
||||
else if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "time" ) ) )
|
||||
{
|
||||
double timeStepValue = getAttributeValueDouble( xmlStream, "value" );
|
||||
stimPlanFileData->addTimeStep( timeStepValue );
|
||||
@@ -355,11 +356,11 @@ std::vector<std::vector<double>> RifStimPlanXmlReader::getAllDepthDataAtTimeStep
|
||||
{
|
||||
std::vector<std::vector<double>> propertyValuesAtTimestep;
|
||||
|
||||
while ( !( xmlStream.isEndElement() && isTextEqual( xmlStream.name(), "time" ) ) )
|
||||
while ( !( xmlStream.isEndElement() && RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "time" ) ) ) )
|
||||
{
|
||||
xmlStream.readNext();
|
||||
|
||||
if ( isTextEqual( xmlStream.name(), "depth" ) )
|
||||
if ( RiaTextStringTools::isTextEqual( xmlStream.name(), QString( "depth" ) ) )
|
||||
{
|
||||
xmlStream.readElementText().toDouble();
|
||||
std::vector<double> propertyValuesAtDepth;
|
||||
@@ -446,14 +447,6 @@ double RifStimPlanXmlReader::valueInRequiredUnitSystem( RiaDefines::EclipseUnitS
|
||||
return value;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifStimPlanXmlReader::isTextEqual( const QStringRef& text, const QString& compareText )
|
||||
{
|
||||
return text.compare( compareText, Qt::CaseInsensitive ) == 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -481,7 +474,7 @@ double RifStimPlanXmlReader::getAttributeValueDouble( QXmlStreamReader& xmlStrea
|
||||
double value = HUGE_VAL;
|
||||
for ( const QXmlStreamAttribute& attr : xmlStream.attributes() )
|
||||
{
|
||||
if ( isTextEqual( attr.name(), parameterName ) )
|
||||
if ( RiaTextStringTools::isTextEqual( attr.name(), parameterName ) )
|
||||
{
|
||||
value = attr.value().toString().toDouble();
|
||||
}
|
||||
@@ -497,7 +490,7 @@ QString RifStimPlanXmlReader::getAttributeValueString( QXmlStreamReader& xmlStre
|
||||
QString parameterValue;
|
||||
for ( const QXmlStreamAttribute& attr : xmlStream.attributes() )
|
||||
{
|
||||
if ( isTextEqual( attr.name(), parameterName ) )
|
||||
if ( RiaTextStringTools::isTextEqual( attr.name(), parameterName ) )
|
||||
{
|
||||
parameterValue = attr.value().toString();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "RifWellPathImporter.h"
|
||||
|
||||
#include "RiaQDateTimeTools.h"
|
||||
|
||||
#include "RifJsonEncodeDecode.h"
|
||||
|
||||
#include "cafUtils.h"
|
||||
@@ -140,7 +142,7 @@ RifWellPathImporter::WellMetaData RifWellPathImporter::readJsonWellMetaData( con
|
||||
QString updateDateStr = jsonMap["updateDate"].toString().trimmed();
|
||||
uint updateDateUint = updateDateStr.toULongLong() / 1000; // Should be within 32 bit, maximum number is 4294967295
|
||||
// which corresponds to year 2106
|
||||
metadata.m_updateDate.setTime_t( updateDateUint );
|
||||
metadata.m_updateDate = RiaQDateTimeTools::fromTime_t( updateDateUint );
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user