mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Qt6: Adjustments (#11804)
* Qt6: Avoid insertWidget, use addWidget In Qt6, the insertWidget function checks if the index parameter is valid based on current widgets present in the layout. This is error prone, and use addWidget to avoid manual counting of index. * Disable use of Qt keyword foreach * Replace use of QRegExp with QRegularExpression Replace use of QRegExp with QRegularExpression Remove dependency on qt5compat module Simplify an expression based on review * Remove Qt5 ifdefs * Guard access out of bounds seen in debug build * Avoid reuse of string variable * Disconnect all signals from the QOpenGLContext The call stack when this assert happens indicates that there are more signals to be disconnected from the object. Crash is fixed by disconnecting all signals. Assert seen in debug build: ASSERT failure in caf::Viewer: "Called object is not of the correct type (class destructor may have already run)", file C:\Qt\6.6.3\msvc2019_64\include\QtCore/qobjectdefs_impl.h, line 130 * Fix issue related to delete of a linked view Guard null pointer use in view linker. Remove complicated cleanup in destructor in Rim3dVew.
This commit is contained in:
@@ -47,7 +47,6 @@
|
||||
#include <QDate>
|
||||
#include <QDir>
|
||||
#include <QLocale>
|
||||
#include <QRegExp>
|
||||
#include <QStandardPaths>
|
||||
#include <QValidator>
|
||||
|
||||
|
@@ -276,7 +276,7 @@ void RiaSumoConnector::parseEnsembleNames( QNetworkReply* reply, const SumoCaseI
|
||||
QJsonObject aggregationColumnsObject = aggregationsObject["iteration_names"].toObject();
|
||||
|
||||
QJsonArray bucketsArray = aggregationColumnsObject["buckets"].toArray();
|
||||
foreach ( const QJsonValue& bucket, bucketsArray )
|
||||
for ( const QJsonValue& bucket : bucketsArray )
|
||||
{
|
||||
QJsonObject bucketObj = bucket.toObject();
|
||||
auto ensembleName = bucketObj["key"].toString();
|
||||
@@ -825,7 +825,7 @@ void RiaSumoConnector::parseCases( QNetworkReply* reply )
|
||||
|
||||
m_cases.clear();
|
||||
|
||||
foreach ( const QJsonValue& value, hitsObjects )
|
||||
for ( const QJsonValue& value : hitsObjects )
|
||||
{
|
||||
QJsonObject resultObj = value.toObject();
|
||||
QJsonObject sourceObj = resultObj["_source"].toObject();
|
||||
@@ -931,7 +931,7 @@ void RiaSumoConnector::parseBlobIds( QNetworkReply* reply,
|
||||
QJsonObject rootHits = jsonObj["hits"].toObject();
|
||||
QJsonArray hitsObjects = rootHits["hits"].toArray();
|
||||
|
||||
foreach ( const QJsonValue& value, hitsObjects )
|
||||
for ( const QJsonValue& value : hitsObjects )
|
||||
{
|
||||
QJsonObject resultObj = value.toObject();
|
||||
QJsonObject sourceObj = resultObj["_source"].toObject();
|
||||
|
@@ -203,11 +203,7 @@ QDateTime RiaQDateTimeTools::subtractPeriod( const QDateTime& dt, RiaDefines::Da
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RiaQDateTimeTools::createDateTime( const QDate& date, Qt::TimeSpec timeSpec /*= Qt::LocalTime*/ )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 )
|
||||
return date.startOfDay( timeSpec );
|
||||
#else
|
||||
return QDateTime( date, QTime( 0, 0 ), timeSpec );
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -133,6 +133,15 @@ QStringList RiaTextStringTools::splitSkipEmptyParts( const QString& text, const
|
||||
return splitString( text, sep, skipEmptyParts );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RiaTextStringTools::splitSkipEmptyParts( const QString& text, const QRegularExpression& regularExpression )
|
||||
{
|
||||
bool skipEmptyParts = true;
|
||||
return splitString( text, regularExpression, skipEmptyParts );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -144,9 +153,9 @@ QStringList RiaTextStringTools::splitString( const QString& text, const QString&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RiaTextStringTools::splitString( const QString& text, const QRegExp& regExp, bool skipEmptyParts )
|
||||
QStringList RiaTextStringTools::splitString( const QString& text, const QRegularExpression& regularExpression, bool skipEmptyParts )
|
||||
{
|
||||
return regExp.splitString( text, skipEmptyParts ? Qt::SkipEmptyParts : Qt::KeepEmptyParts );
|
||||
return text.split( regularExpression, skipEmptyParts ? Qt::SkipEmptyParts : Qt::KeepEmptyParts );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -197,16 +206,6 @@ bool RiaTextStringTools::isNumber( const QString& text, const QString& decimalPo
|
||||
return RiaStdStringTools::isNumber( stdString, decimalChar );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RiaTextStringTools::splitSkipEmptyParts( const QString& text, const QRegExp& regExp )
|
||||
{
|
||||
bool skipEmptyParts = true;
|
||||
|
||||
return splitString( text, regExp, skipEmptyParts );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
@@ -36,10 +36,10 @@ 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 );
|
||||
QStringList splitSkipEmptyParts( const QString& text, const QRegularExpression& regularExpression );
|
||||
|
||||
QStringList splitString( const QString& text, const QString& sep, bool skipEmptyParts );
|
||||
QStringList splitString( const QString& text, const QRegExp& regExp, bool skipEmptyParts );
|
||||
QStringList splitString( const QString& text, const QRegularExpression& regularExpression, bool skipEmptyParts );
|
||||
|
||||
QString replaceTemplateTextWithValues( const QString& templateText, const std::map<QString, QString>& valueMap );
|
||||
bool isTextEqual( QStringView text, QStringView compareText );
|
||||
|
@@ -41,8 +41,10 @@ bool RiaValidRegExpValidator::isValidCharacter( const QChar& character )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QValidator::State RiaValidRegExpValidator::validate( QString& inputString, int& position ) const
|
||||
{
|
||||
QRegExp inputRe( inputString, Qt::CaseInsensitive, QRegExp::Wildcard );
|
||||
if ( inputRe.isValid() ) // A valid wildcard pattern is always acceptable
|
||||
QString regexPattern = QRegularExpression::wildcardToRegularExpression( inputString );
|
||||
QRegularExpression regex( regexPattern, QRegularExpression::CaseInsensitiveOption );
|
||||
|
||||
if ( regex.isValid() )
|
||||
{
|
||||
return QValidator::Acceptable;
|
||||
}
|
||||
@@ -70,4 +72,4 @@ QValidator::State RiaValidRegExpValidator::validate( QString& inputString, int&
|
||||
void RiaValidRegExpValidator::fixup( QString& inputString ) const
|
||||
{
|
||||
inputString = m_defaultPattern;
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QString>
|
||||
#include <QValidator>
|
||||
|
||||
@@ -36,4 +35,4 @@ public:
|
||||
|
||||
private:
|
||||
QString m_defaultPattern;
|
||||
};
|
||||
};
|
||||
|
@@ -121,11 +121,12 @@ void RiaSummaryStringTools::splitUsingDataSourceNames( const QStringList& filter
|
||||
|
||||
bool foundDataSource = false;
|
||||
|
||||
QRegExp searcher( pureDataSourceCandidate, Qt::CaseInsensitive, QRegExp::WildcardUnix );
|
||||
QString regexPattern = QRegularExpression::wildcardToRegularExpression( pureDataSourceCandidate );
|
||||
QRegularExpression searcher( regexPattern, QRegularExpression::CaseInsensitiveOption );
|
||||
|
||||
for ( const auto& ds : dataSourceNames )
|
||||
{
|
||||
if ( !foundDataSource && searcher.exactMatch( ds ) )
|
||||
if ( !foundDataSource && searcher.match( ds ).hasMatch() )
|
||||
{
|
||||
dataSourceFilters.push_back( s );
|
||||
foundDataSource = true;
|
||||
@@ -166,13 +167,14 @@ std::pair<std::vector<RimSummaryCase*>, std::vector<RimSummaryEnsemble*>>
|
||||
|
||||
for ( const auto& dsFilter : dataSourceFilters )
|
||||
{
|
||||
QString searchString = dsFilter.left( dsFilter.indexOf( ':' ) );
|
||||
QRegExp searcher( searchString, Qt::CaseInsensitive, QRegExp::WildcardUnix );
|
||||
QString searchString = dsFilter.left( dsFilter.indexOf( ':' ) );
|
||||
QString regexPattern = QRegularExpression::wildcardToRegularExpression( searchString );
|
||||
QRegularExpression searcher( regexPattern, QRegularExpression::CaseInsensitiveOption );
|
||||
|
||||
for ( const auto& ensemble : allEnsembles )
|
||||
{
|
||||
auto ensembleName = ensemble->name();
|
||||
if ( searcher.exactMatch( ensembleName ) )
|
||||
if ( searcher.match( ensembleName ).hasMatch() )
|
||||
{
|
||||
if ( searchString == dsFilter )
|
||||
{
|
||||
@@ -184,13 +186,14 @@ std::pair<std::vector<RimSummaryCase*>, std::vector<RimSummaryEnsemble*>>
|
||||
{
|
||||
// Match on subset of realisations in ensemble
|
||||
|
||||
QString realizationSearchString = dsFilter.right( dsFilter.size() - dsFilter.indexOf( ':' ) - 1 );
|
||||
QRegExp realizationSearcher( realizationSearchString, Qt::CaseInsensitive, QRegExp::WildcardUnix );
|
||||
QString realizationSearchString = dsFilter.right( dsFilter.size() - dsFilter.indexOf( ':' ) - 1 );
|
||||
QString regexPattern = QRegularExpression::wildcardToRegularExpression( realizationSearchString );
|
||||
QRegularExpression realizationSearcher( regexPattern, QRegularExpression::CaseInsensitiveOption );
|
||||
|
||||
for ( const auto& summaryCase : ensemble->allSummaryCases() )
|
||||
{
|
||||
auto realizationName = summaryCase->displayCaseName();
|
||||
if ( realizationSearcher.exactMatch( realizationName ) )
|
||||
if ( realizationSearcher.match( realizationName ).hasMatch() )
|
||||
{
|
||||
matchingSummaryCases.push_back( summaryCase );
|
||||
}
|
||||
@@ -202,7 +205,7 @@ std::pair<std::vector<RimSummaryCase*>, std::vector<RimSummaryEnsemble*>>
|
||||
for ( const auto& summaryCase : allSummaryCases )
|
||||
{
|
||||
auto summaryCaseName = summaryCase->displayCaseName();
|
||||
if ( searcher.exactMatch( summaryCaseName ) )
|
||||
if ( searcher.match( summaryCaseName ).hasMatch() )
|
||||
{
|
||||
matchingSummaryCases.push_back( summaryCase );
|
||||
}
|
||||
@@ -217,7 +220,7 @@ std::pair<std::vector<RimSummaryCase*>, std::vector<RimSummaryEnsemble*>>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RiaSummaryStringTools::splitIntoWords( const QString& text )
|
||||
{
|
||||
return RiaTextStringTools::splitSkipEmptyParts( text, QRegExp( "\\s+" ) );
|
||||
return RiaTextStringTools::splitSkipEmptyParts( text );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -36,7 +36,6 @@ find_package(
|
||||
PrintSupport
|
||||
Svg
|
||||
Sql
|
||||
Core5Compat
|
||||
OPTIONAL_COMPONENTS Charts
|
||||
)
|
||||
set(QT_LIBRARIES
|
||||
@@ -51,7 +50,6 @@ set(QT_LIBRARIES
|
||||
Qt6::PrintSupport
|
||||
Qt6::Svg
|
||||
Qt6::Sql
|
||||
Qt6::Core5Compat
|
||||
Qt6::Charts
|
||||
)
|
||||
qt_standard_project_setup()
|
||||
|
@@ -152,8 +152,8 @@ QWidget* RicCalculatorWidgetCreator::createWidget( QWidget* parent )
|
||||
rowSplitter->setContentsMargins( 0, 0, 0, 0 );
|
||||
rowSplitter->setHandleWidth( 6 );
|
||||
rowSplitter->setStyleSheet( "QSplitter::handle { image: url(:/SplitterV.png); }" );
|
||||
rowSplitter->insertWidget( 0, firstRowLeftFrame );
|
||||
rowSplitter->insertWidget( 1, firstRowRightFrame );
|
||||
rowSplitter->addWidget( firstRowLeftFrame );
|
||||
rowSplitter->addWidget( firstRowRightFrame );
|
||||
rowSplitter->setSizes( QList<int>() << 1 << 1 );
|
||||
firstRowLayout->addWidget( rowSplitter );
|
||||
|
||||
|
@@ -105,16 +105,16 @@ void RicSummaryPlotEditorWidgetCreator::recursivelyConfigureAndUpdateTopLevelUiO
|
||||
|
||||
caf::PdmUiGroup* appearanceGroup = findGroupByKeyword( topLevelUiItems, RiuSummaryCurveDefinitionKeywords::appearance(), uiConfigName );
|
||||
auto appearanceGroupBox = createGroupBoxWithContent( appearanceGroup, uiConfigName );
|
||||
m_lowerLeftLayout->insertWidget( 0, appearanceGroupBox );
|
||||
m_lowerLeftLayout->addWidget( appearanceGroupBox );
|
||||
|
||||
caf::PdmUiGroup* nameConfigGroup = findGroupByKeyword( topLevelUiItems, RiuSummaryCurveDefinitionKeywords::nameConfig(), uiConfigName );
|
||||
auto nameConfigGroupBox = createGroupBoxWithContent( nameConfigGroup, uiConfigName );
|
||||
m_lowerLeftLayout->insertWidget( 1, nameConfigGroupBox );
|
||||
m_lowerLeftLayout->addWidget( nameConfigGroupBox );
|
||||
|
||||
QMinimizePanel* curveGroup = getOrCreateCurveTreeGroup();
|
||||
m_lowerLeftLayout->insertWidget( 2, curveGroup, 1 );
|
||||
m_lowerLeftLayout->addWidget( curveGroup, 1 );
|
||||
m_lowerLeftLayout->addStretch( 0 );
|
||||
m_lowerRightLayout->insertWidget( 0, getOrCreatePlotWidget() );
|
||||
m_lowerRightLayout->addWidget( getOrCreatePlotWidget() );
|
||||
|
||||
// Fields at bottom of dialog
|
||||
configureAndUpdateFields( 1, m_bottomFieldLayout, topLevelUiItems, uiConfigName );
|
||||
@@ -155,8 +155,8 @@ QWidget* RicSummaryPlotEditorWidgetCreator::createWidget( QWidget* parent )
|
||||
m_firstColumnSplitter->setHandleWidth( 6 );
|
||||
m_firstColumnSplitter->setStyleSheet( "QSplitter::handle { image: url(:/SplitterH.png); }" );
|
||||
|
||||
m_firstColumnSplitter->insertWidget( 0, firstRowFrame );
|
||||
m_firstColumnSplitter->insertWidget( 1, secondRowFrame );
|
||||
m_firstColumnSplitter->addWidget( firstRowFrame );
|
||||
m_firstColumnSplitter->addWidget( secondRowFrame );
|
||||
|
||||
const int firstRowPixelHeight = 500;
|
||||
const int secondRowPixelHeight = 300;
|
||||
|
@@ -121,7 +121,7 @@ void RifCaseRealizationParametersReader::parse()
|
||||
QString line = dataStream.readLine();
|
||||
|
||||
lineNo++;
|
||||
QStringList cols = RifFileParseTools::splitLineAndTrim( line, QRegExp( "[ \t]" ), true );
|
||||
QStringList cols = RifFileParseTools::splitLineAndTrim( line, QRegularExpression( "[ \t]" ), true );
|
||||
|
||||
if ( cols.size() != 2 )
|
||||
{
|
||||
@@ -287,22 +287,22 @@ int RifCaseRealizationParametersFileLocator::realizationNumber( const QString& m
|
||||
QDir dir( modelPath );
|
||||
QString absolutePath = dir.absolutePath();
|
||||
|
||||
return realizationNumberFromFullPath( absolutePath );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RifCaseRealizationParametersFileLocator::realizationNumberFromFullPath( const QString& path )
|
||||
{
|
||||
int resultIndex = -1;
|
||||
|
||||
// Use parenthesis to indicate capture of sub string
|
||||
QString pattern = "(realization-\\d+)";
|
||||
QRegularExpression pattern( "realization-(\\d+)", QRegularExpression::CaseInsensitiveOption );
|
||||
QRegularExpressionMatch match = pattern.match( path );
|
||||
|
||||
QRegExp regexp( pattern, Qt::CaseInsensitive );
|
||||
if ( regexp.indexIn( absolutePath ) )
|
||||
if ( match.hasMatch() )
|
||||
{
|
||||
QString tempText = regexp.cap( 1 );
|
||||
|
||||
QRegExp rx( "(\\d+)" ); // Find number
|
||||
int digitPos = rx.indexIn( tempText );
|
||||
if ( digitPos > -1 )
|
||||
{
|
||||
resultIndex = rx.cap( 0 ).toInt();
|
||||
}
|
||||
resultIndex = match.captured( 1 ).toInt();
|
||||
}
|
||||
|
||||
return resultIndex;
|
||||
|
@@ -94,4 +94,5 @@ class RifCaseRealizationParametersFileLocator
|
||||
public:
|
||||
static QString locate( const QString& modelPath );
|
||||
static int realizationNumber( const QString& modelPath );
|
||||
static int realizationNumberFromFullPath( const QString& path );
|
||||
};
|
||||
|
@@ -91,7 +91,7 @@ cvf::ref<RigFormationNames> RifColorLegendData::readLyrFormationNameFile( const
|
||||
if ( QColor::isValidColorName( colorWord ) ) numberString.remove( colorWord ); // remove color if present as last word on line
|
||||
|
||||
// extract words containing formation number(s)
|
||||
QStringList numberWords = RiaTextStringTools::splitSkipEmptyParts( numberString, QRegExp( "-" ) );
|
||||
QStringList numberWords = RiaTextStringTools::splitSkipEmptyParts( numberString, QRegularExpression( "-" ) );
|
||||
|
||||
if ( numberWords.size() == 2 ) // formation range with or without color at end of line
|
||||
{
|
||||
|
@@ -392,11 +392,12 @@ bool RifCsvUserDataParser::parseColumnInfo( QTextStream*
|
||||
// "VECTOR_NAME [unit]"
|
||||
{
|
||||
// "VECTORNAME (unit)" ==> "(unit)"
|
||||
QRegExp exp( "[[]([^]]+)[]]" );
|
||||
if ( exp.indexIn( colName ) >= 0 )
|
||||
QRegularExpression exp( R"(\[([^\]]+)\])" );
|
||||
QRegularExpressionMatch match = exp.match( colName );
|
||||
if ( match.hasMatch() )
|
||||
{
|
||||
QString fullCapture = exp.cap( 0 );
|
||||
QString unitCapture = exp.cap( 1 );
|
||||
QString fullCapture = match.captured( 0 );
|
||||
QString unitCapture = match.captured( 1 );
|
||||
|
||||
unit = unitCapture;
|
||||
colName = RiaTextStringTools::trimAndRemoveDoubleSpaces( colName.remove( fullCapture ) );
|
||||
@@ -405,11 +406,12 @@ bool RifCsvUserDataParser::parseColumnInfo( QTextStream*
|
||||
|
||||
{
|
||||
// "VECTOR_NAME [unit]" ==> "[unit]"
|
||||
QRegExp exp( "[(]([^)]+)[)]" );
|
||||
if ( exp.indexIn( colName ) >= 0 )
|
||||
QRegularExpression exp( R"(\(([^)]+)\))" );
|
||||
QRegularExpressionMatch match = exp.match( colName );
|
||||
if ( match.hasMatch() )
|
||||
{
|
||||
QString fullCapture = exp.cap( 0 );
|
||||
QString unitCapture = exp.cap( 1 );
|
||||
QString fullCapture = match.captured( 0 );
|
||||
QString unitCapture = match.captured( 1 );
|
||||
|
||||
unit = unitCapture;
|
||||
colName = RiaTextStringTools::trimAndRemoveDoubleSpaces( colName.remove( fullCapture ) );
|
||||
|
@@ -1419,31 +1419,31 @@ void RifEclipseInputFileTools::readKeywordDataContent( QFile& data, qint64 fileP
|
||||
QString line = data.readLine();
|
||||
line = line.trimmed();
|
||||
|
||||
if ( line.startsWith( "--", Qt::CaseInsensitive ) )
|
||||
{
|
||||
// Skip comment lines
|
||||
continue;
|
||||
}
|
||||
else if ( line.startsWith( "/", Qt::CaseInsensitive ) )
|
||||
{
|
||||
// Detected end of keyword data section
|
||||
return;
|
||||
}
|
||||
else if ( line.startsWith( editKeyword, Qt::CaseInsensitive ) )
|
||||
{
|
||||
// End parsing when edit keyword is detected
|
||||
isStopParsingKeywordDetected = true;
|
||||
|
||||
return;
|
||||
}
|
||||
else if ( line[0].isLetter() )
|
||||
{
|
||||
// If a letter is starting the line, this is a new keyword
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !line.isEmpty() )
|
||||
{
|
||||
if ( line.startsWith( "--", Qt::CaseInsensitive ) )
|
||||
{
|
||||
// Skip comment lines
|
||||
continue;
|
||||
}
|
||||
else if ( line.startsWith( "/", Qt::CaseInsensitive ) )
|
||||
{
|
||||
// Detected end of keyword data section
|
||||
return;
|
||||
}
|
||||
else if ( line.startsWith( editKeyword, Qt::CaseInsensitive ) )
|
||||
{
|
||||
// End parsing when edit keyword is detected
|
||||
isStopParsingKeywordDetected = true;
|
||||
|
||||
return;
|
||||
}
|
||||
else if ( line[0].isLetter() )
|
||||
{
|
||||
// If a letter is starting the line, this is a new keyword
|
||||
return;
|
||||
}
|
||||
|
||||
textContent.push_back( line );
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,6 @@
|
||||
#include "RifEclEclipseSummary.h"
|
||||
#include "RiuSummaryQuantityNameInfoProvider.h"
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QStringList>
|
||||
#include <QTextStream>
|
||||
|
||||
@@ -190,8 +189,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromEclipseTextAddressParseEr
|
||||
|
||||
if ( tokens.size() > 1 )
|
||||
{
|
||||
auto firstToken = RiaStdStringTools::trimString( tokens[0] );
|
||||
firstToken = RiaStdStringTools::toUpper( firstToken );
|
||||
auto firstToken = RiaStdStringTools::toUpper( RiaStdStringTools::trimString( tokens[0] ) );
|
||||
|
||||
if ( ( firstToken == "ER" ) || ( firstToken == "ERR" ) || ( firstToken == "ERROR" ) )
|
||||
{
|
||||
@@ -783,9 +781,10 @@ bool RifEclipseSummaryAddress::isUiTextMatchingFilterText( const QString& filter
|
||||
if ( filterString.isEmpty() ) return true;
|
||||
if ( filterString.trimmed() == "*" ) return !value.empty();
|
||||
|
||||
QRegExp searcher( filterString, Qt::CaseInsensitive, QRegExp::WildcardUnix );
|
||||
QString qstrValue = QString::fromStdString( value );
|
||||
return searcher.exactMatch( qstrValue );
|
||||
QString pattern = QRegularExpression::wildcardToRegularExpression( filterString );
|
||||
QRegularExpression searcher( pattern, QRegularExpression::CaseInsensitiveOption );
|
||||
QString qstrValue = QString::fromStdString( value );
|
||||
return searcher.match( qstrValue ).hasMatch();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1226,7 +1225,7 @@ std::string RifEclipseSummaryAddress::blockAsString() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::tuple<int, int, int> RifEclipseSummaryAddress::ijkTupleFromUiText( const std::string& s )
|
||||
{
|
||||
auto ijk = RiaTextStringTools::splitSkipEmptyParts( QString::fromStdString( s ).trimmed(), QRegExp( "[,]" ) );
|
||||
auto ijk = RiaTextStringTools::splitSkipEmptyParts( QString::fromStdString( s ).trimmed(), QRegularExpression( "[,]" ) );
|
||||
|
||||
if ( ijk.size() != 3 ) return std::make_tuple( -1, -1, -1 );
|
||||
|
||||
@@ -1248,7 +1247,7 @@ std::string RifEclipseSummaryAddress::formatUiTextRegionToRegion() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<int, int> RifEclipseSummaryAddress::regionToRegionPairFromUiText( const std::string& s )
|
||||
{
|
||||
auto r2r = RiaTextStringTools::splitSkipEmptyParts( QString::fromStdString( s ).trimmed(), QRegExp( "[-]" ) );
|
||||
auto r2r = RiaTextStringTools::splitSkipEmptyParts( QString::fromStdString( s ).trimmed(), QRegularExpression( "[-]" ) );
|
||||
|
||||
if ( r2r.size() != 2 ) return std::make_pair( -1, -1 );
|
||||
|
||||
|
@@ -19,14 +19,6 @@
|
||||
#include "RifFileParseTools.h"
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
// Disable deprecation warning for QString::SkipEmptyParts
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4996 )
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -43,7 +35,7 @@ QStringList RifFileParseTools::splitLineAndTrim( const QString& line, const QStr
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RifFileParseTools::splitLineAndTrim( const QString& line, const QRegExp& regexp, bool skipEmptyParts )
|
||||
QStringList RifFileParseTools::splitLineAndTrim( const QString& line, const QRegularExpression& regexp, bool skipEmptyParts )
|
||||
{
|
||||
auto cols = RiaTextStringTools::splitString( line.trimmed(), regexp, skipEmptyParts );
|
||||
for ( QString& col : cols )
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
@@ -29,7 +29,7 @@ class RifFileParseTools
|
||||
{
|
||||
public:
|
||||
static QStringList splitLineAndTrim( const QString& line, const QString& separator, bool skipEmptyParts = false );
|
||||
static QStringList splitLineAndTrim( const QString& line, const QRegExp& regexp, bool skipEmptyParts = false );
|
||||
static QStringList splitLineAndTrim( const QString& line, const QRegularExpression& regexp, bool skipEmptyParts = false );
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
|
@@ -32,7 +32,7 @@ std::map<QString, std::vector<RifPerforationInterval>> RifPerforationIntervalRea
|
||||
{
|
||||
std::map<QString, std::vector<RifPerforationInterval>> perforationIntervals;
|
||||
|
||||
foreach ( QString filePath, filePaths )
|
||||
for ( const QString& filePath : filePaths )
|
||||
{
|
||||
readFileIntoMap( filePath, &perforationIntervals );
|
||||
}
|
||||
|
@@ -79,7 +79,7 @@ std::vector<std::vector<cvf::Vec3d>> RifPolygonReader::parseText( const QString&
|
||||
QStringList commentLineSegs = line.split( "#" );
|
||||
if ( commentLineSegs.empty() ) continue; // Empty line
|
||||
|
||||
QStringList lineSegs = RiaTextStringTools::splitSkipEmptyParts( commentLineSegs[0], QRegExp( "\\s+" ) );
|
||||
QStringList lineSegs = RiaTextStringTools::splitSkipEmptyParts( commentLineSegs[0], QRegularExpression( "\\s+" ) );
|
||||
|
||||
if ( lineSegs.empty() ) continue; // No data
|
||||
|
||||
|
@@ -161,7 +161,7 @@ RifWellPathImporter::WellData RifWellPathImporter::readJsonWellData( const QStri
|
||||
wellData.m_wellPathGeometry->setDatumElevation( datumElevation );
|
||||
wellData.m_name = jsonMap["name"].toString();
|
||||
|
||||
foreach ( QVariant point, pathList )
|
||||
for ( const QVariant& point : pathList )
|
||||
{
|
||||
QMap<QString, QVariant> coordinateMap = point.toMap();
|
||||
cvf::Vec3d vec3d( coordinateMap["east"].toDouble(),
|
||||
|
@@ -91,7 +91,7 @@ void RimPolylinesFromFileAnnotation::readPolyLinesFile( QString* errorMessage )
|
||||
QStringList commentLineSegs = line.split( "#" );
|
||||
if ( commentLineSegs.empty() ) continue; // Empty line
|
||||
|
||||
QStringList lineSegs = RiaTextStringTools::splitSkipEmptyParts( commentLineSegs[0], QRegExp( "\\s+" ) );
|
||||
QStringList lineSegs = RiaTextStringTools::splitSkipEmptyParts( commentLineSegs[0], QRegularExpression( "\\s+" ) );
|
||||
|
||||
if ( lineSegs.empty() ) continue; // No data
|
||||
|
||||
|
@@ -264,10 +264,9 @@ QString RimWellPathCompletionSettings::fluidInPlaceRegionForExport() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QRegExp RimWellPathCompletionSettings::wellNameForExportRegExp()
|
||||
QRegularExpression RimWellPathCompletionSettings::wellNameForExportRegExp()
|
||||
{
|
||||
QRegExp rx( "[\\w\\-\\_]{1,8}" );
|
||||
return rx;
|
||||
return QRegularExpression( "[\\w\\-\\_]{1,8}" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
|
||||
class RimMswCompletionParameters;
|
||||
class RimWellPathCompletionsLegacy;
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
QString hydrostaticDensityForExport() const;
|
||||
QString fluidInPlaceRegionForExport() const;
|
||||
|
||||
static QRegExp wellNameForExportRegExp();
|
||||
static QRegularExpression wellNameForExportRegExp();
|
||||
|
||||
RimMswCompletionParameters* mswCompletionParameters() const;
|
||||
|
||||
|
@@ -21,20 +21,16 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaFieldHandleTools.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaOptionItemFactory.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaPreferencesSystem.h"
|
||||
#include "RiaViewRedrawScheduler.h"
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "Rim2dIntersectionView.h"
|
||||
#include "Rim3dWellLogCurve.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
@@ -45,7 +41,6 @@
|
||||
#include "RimTools.h"
|
||||
#include "RimViewController.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
#include "RimViewManipulator.h"
|
||||
#include "RimViewNameConfig.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
@@ -63,7 +58,6 @@
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmFieldScriptingCapabilityCvfColor3.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
|
||||
#include "cvfCamera.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
@@ -190,44 +184,6 @@ Rim3dView::Rim3dView()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dView::~Rim3dView()
|
||||
{
|
||||
// When a 3d view is destructed, make sure that all other views using this as a comparison view is reset and
|
||||
// redrawn. A crash was seen for test case
|
||||
// "\ResInsight-regression-test\ProjectFiles\ProjectFilesSmallTests\TestCase_CoViz-Simple" when a view used as
|
||||
// comparison view was deleted.
|
||||
|
||||
if ( auto proj = RimProject::current() )
|
||||
{
|
||||
for ( auto v : proj->allViews() )
|
||||
{
|
||||
if ( v->activeComparisonView() == this )
|
||||
{
|
||||
v->setComparisonView( nullptr );
|
||||
v->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
if ( this->isMasterView() )
|
||||
{
|
||||
RimViewLinker* viewLinker = this->assosiatedViewLinker();
|
||||
viewLinker->setMasterView( nullptr );
|
||||
|
||||
delete proj->viewLinkerCollection->viewLinker();
|
||||
proj->viewLinkerCollection->viewLinker = nullptr;
|
||||
|
||||
proj->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
RimViewController* vController = this->viewController();
|
||||
if ( vController )
|
||||
{
|
||||
vController->setManagedView( nullptr );
|
||||
vController->ownerViewLinker()->removeViewController( vController );
|
||||
delete vController;
|
||||
|
||||
proj->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
if ( RiaApplication::instance()->activeReservoirView() == this )
|
||||
{
|
||||
RiaApplication::instance()->setActiveReservoirView( nullptr );
|
||||
|
@@ -518,6 +518,8 @@ void RimViewLinker::updateCursorPosition( const Rim3dView* sourceView, const cvf
|
||||
|
||||
for ( Rim3dView* destinationView : viewsToUpdate )
|
||||
{
|
||||
if ( !destinationView ) continue;
|
||||
|
||||
if ( destinationView == sourceView ) continue;
|
||||
|
||||
if ( destinationView != m_masterView )
|
||||
|
@@ -500,7 +500,7 @@ std::set<RifEclipseSummaryAddress> RimSummaryPlotManager::filteredAddresses()
|
||||
|
||||
if ( nativeAddresses.empty() ) return {};
|
||||
|
||||
QStringList allCurveAddressFilters = RiaTextStringTools::splitSkipEmptyParts( m_filterText(), QRegExp( "\\s+" ) );
|
||||
QStringList allCurveAddressFilters = RiaTextStringTools::splitSkipEmptyParts( m_filterText(), QRegularExpression( "\\s+" ) );
|
||||
|
||||
return RiaSummaryStringTools::computeFilteredAddresses( allCurveAddressFilters, nativeAddresses, m_includeDiffCurves );
|
||||
}
|
||||
|
@@ -397,7 +397,7 @@ std::vector<RimWellLogLasFile*> RimWellPathCollection::addWellLogs( const QStrin
|
||||
|
||||
std::vector<RimWellLogLasFile*> logFileInfos;
|
||||
|
||||
foreach ( QString filePath, filePaths )
|
||||
for ( const QString& filePath : filePaths )
|
||||
{
|
||||
QString errorMessage;
|
||||
RimWellLogLasFile* logFileInfo = RimWellLogLasFile::readWellLogFile( filePath, &errorMessage );
|
||||
@@ -943,13 +943,14 @@ std::map<QString, std::vector<RimWellPath*>>
|
||||
{
|
||||
std::map<QString, std::vector<RimWellPath*>> rootWells;
|
||||
|
||||
QString multiLateralWellPathPattern = RiaPreferences::current()->multiLateralWellNamePattern();
|
||||
QRegExp re( multiLateralWellPathPattern, Qt::CaseInsensitive, QRegExp::Wildcard );
|
||||
QString multiLateralWellPathPattern = RiaPreferences::current()->multiLateralWellNamePattern();
|
||||
QString regexPattern = QRegularExpression::wildcardToRegularExpression( multiLateralWellPathPattern );
|
||||
QRegularExpression re( regexPattern, QRegularExpression::CaseInsensitiveOption );
|
||||
|
||||
for ( auto wellPath : sourceWellPaths )
|
||||
{
|
||||
QString name = wellPath->name();
|
||||
if ( re.exactMatch( name ) )
|
||||
if ( re.match( name ).hasMatch() )
|
||||
{
|
||||
int indexOfLateralStart = name.indexOf( 'Y' );
|
||||
if ( indexOfLateralStart > 0 )
|
||||
|
@@ -29,7 +29,7 @@
|
||||
#include "RigWellResultFrame.h"
|
||||
#include "RigWellResultPoint.h"
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
|
||||
/* rand example: guess the number */
|
||||
#include <cstdio>
|
||||
@@ -147,11 +147,11 @@ bool RigReservoirBuilderMock::dynamicResult( RigEclipseCaseData* eclipseCase, co
|
||||
{
|
||||
int resultIndex = 1;
|
||||
|
||||
QRegExp rx( "[0-9]{1,2}" ); // Find number 0-99
|
||||
int digitPos = rx.indexIn( result );
|
||||
if ( digitPos > -1 )
|
||||
QRegularExpression rx( "[0-9]{1,2}" ); // Find number 0-99
|
||||
QRegularExpressionMatch match = rx.match( result );
|
||||
if ( match.hasMatch() )
|
||||
{
|
||||
resultIndex = rx.cap( 0 ).toInt() + 1;
|
||||
resultIndex = match.captured( 0 ).toInt() + 1;
|
||||
}
|
||||
|
||||
double scaleValue = 1.0 + resultIndex * 0.1;
|
||||
|
@@ -70,7 +70,7 @@ TEST( RifCaseRealizationParametersReaderTest, FindRealizationNumber )
|
||||
QString filePath = "d:/gitroot-ceesol/ResInsight-regression-test/ModelData/ensemble_reek_with_params/realization-"
|
||||
"7/iter-0/eclipse/model/3_R001_REEK-7.SMSPEC";
|
||||
|
||||
int realisationNumber = RifCaseRealizationParametersFileLocator::realizationNumber( filePath );
|
||||
int realisationNumber = RifCaseRealizationParametersFileLocator::realizationNumberFromFullPath( filePath );
|
||||
|
||||
EXPECT_EQ( 7, realisationNumber );
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces )
|
||||
<< "i+";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach ( QString text, faceTexts )
|
||||
for ( const QString& text : faceTexts )
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText( text );
|
||||
EXPECT_EQ( cvf::StructGridInterface::POS_I, faceType );
|
||||
@@ -40,7 +40,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces )
|
||||
<< "i-";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach ( QString text, faceTexts )
|
||||
for ( const QString& text : faceTexts )
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText( text );
|
||||
EXPECT_EQ( cvf::StructGridInterface::NEG_I, faceType );
|
||||
@@ -59,7 +59,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces )
|
||||
<< "j+";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach ( QString text, faceTexts )
|
||||
for ( const QString& text : faceTexts )
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText( text );
|
||||
EXPECT_EQ( cvf::StructGridInterface::POS_J, faceType );
|
||||
@@ -74,7 +74,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces )
|
||||
<< "j-";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach ( QString text, faceTexts )
|
||||
for ( const QString& text : faceTexts )
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText( text );
|
||||
EXPECT_EQ( cvf::StructGridInterface::NEG_J, faceType );
|
||||
@@ -93,7 +93,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces )
|
||||
<< "k+";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach ( QString text, faceTexts )
|
||||
for ( const QString& text : faceTexts )
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText( text );
|
||||
EXPECT_EQ( cvf::StructGridInterface::POS_K, faceType );
|
||||
@@ -108,7 +108,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces )
|
||||
<< "k-";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach ( QString text, faceTexts )
|
||||
for ( const QString& text : faceTexts )
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText( text );
|
||||
EXPECT_EQ( cvf::StructGridInterface::NEG_K, faceType );
|
||||
@@ -124,7 +124,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces )
|
||||
<< " y /";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach ( QString text, faceTexts )
|
||||
for ( const QString& text : faceTexts )
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText( text );
|
||||
EXPECT_NE( cvf::StructGridInterface::NO_FACE, faceType );
|
||||
@@ -139,7 +139,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces )
|
||||
<< " +k- ";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach ( QString text, faceTexts )
|
||||
for ( const QString& text : faceTexts )
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText( text );
|
||||
EXPECT_EQ( cvf::StructGridInterface::NO_FACE, faceType );
|
||||
@@ -155,7 +155,7 @@ TEST( RifEclipseInputFileToolsTest, FaultFaces )
|
||||
<< " i+ ";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach ( QString text, faceTexts )
|
||||
for ( const QString& text : faceTexts )
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText( text );
|
||||
EXPECT_EQ( cvf::StructGridInterface::POS_I, faceType );
|
||||
|
@@ -108,7 +108,7 @@ TEST( RifTextDataTableFormatter, LongLine )
|
||||
formatter.rowCompleted();
|
||||
formatter.tableCompleted();
|
||||
|
||||
QStringList tableLines = RiaTextStringTools::splitSkipEmptyParts( tableText, QRegExp( "[\r\n]" ) );
|
||||
QStringList tableLines = RiaTextStringTools::splitSkipEmptyParts( tableText, QRegularExpression( "[\r\n]" ) );
|
||||
for ( QString line : tableLines )
|
||||
{
|
||||
std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl;
|
||||
@@ -155,7 +155,7 @@ TEST( RifTextDataTableFormatter, LongLine132 )
|
||||
formatter.rowCompleted();
|
||||
formatter.tableCompleted();
|
||||
|
||||
QStringList tableLines = RiaTextStringTools::splitSkipEmptyParts( tableText, QRegExp( "[\r\n]" ) );
|
||||
QStringList tableLines = RiaTextStringTools::splitSkipEmptyParts( tableText, QRegularExpression( "[\r\n]" ) );
|
||||
for ( QString line : tableLines )
|
||||
{
|
||||
std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl;
|
||||
@@ -202,7 +202,7 @@ TEST( RifTextDataTableFormatter, LongLine133 )
|
||||
formatter.rowCompleted();
|
||||
formatter.tableCompleted();
|
||||
|
||||
QStringList tableLines = RiaTextStringTools::splitSkipEmptyParts( tableText, QRegExp( "[\r\n]" ) );
|
||||
QStringList tableLines = RiaTextStringTools::splitSkipEmptyParts( tableText, QRegularExpression( "[\r\n]" ) );
|
||||
for ( QString line : tableLines )
|
||||
{
|
||||
std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl;
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QIODevice>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QString>
|
||||
#include <QStringListModel>
|
||||
@@ -57,8 +56,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
|
||||
[]( QRegularExpressionMatch& match )
|
||||
{
|
||||
QRegExp plotNameRegExp( match.captured( "plotName" ) );
|
||||
QRegExp itemNameRegExp( match.captured( "itemName" ) );
|
||||
QRegularExpression plotNameRegExp = QRegularExpression::fromWildcard( match.captured( "plotName" ) );
|
||||
QRegularExpression itemNameRegExp = QRegularExpression::fromWildcard( match.captured( "itemName" ) );
|
||||
|
||||
QRegularExpression lineColorRegExp( "line-color:\\s*([#0-9a-zA-Z]+)" );
|
||||
QString lineColor = lineColorRegExp.match( match.captured( "properties" ) ).captured( 1 );
|
||||
@@ -84,13 +83,13 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
{
|
||||
for ( QwtPlot* plotWidget : widget->findChildren<QwtPlot*>() )
|
||||
{
|
||||
if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) )
|
||||
if ( plotNameRegExp.match( plotWidget->property( "qss-class" ).toString() ).hasMatch() )
|
||||
{
|
||||
for ( QwtPlotItem* item : plotWidget->itemList() )
|
||||
{
|
||||
if ( QwtPlotCurve* curve = dynamic_cast<QwtPlotCurve*>( item ) )
|
||||
{
|
||||
if ( itemNameRegExp.exactMatch( item->title().text() ) || match.captured( "itemName" ) == "*" )
|
||||
if ( itemNameRegExp.match( item->title().text() ).hasMatch() || match.captured( "itemName" ) == "*" )
|
||||
{
|
||||
QPen pen = curve->pen();
|
||||
pen.setColor( QColor( lineColor ) );
|
||||
@@ -117,8 +116,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
|
||||
[]( QRegularExpressionMatch& match )
|
||||
{
|
||||
QRegExp plotNameRegExp( match.captured( "plotName" ) );
|
||||
QRegExp itemNameRegExp( match.captured( "itemName" ) );
|
||||
QRegularExpression plotNameRegExp = QRegularExpression::fromWildcard( match.captured( "plotName" ) );
|
||||
QRegularExpression itemNameRegExp = QRegularExpression::fromWildcard( match.captured( "itemName" ) );
|
||||
QRegularExpression colorRegExp( "color:\\s*([#0-9a-zA-Z]+)" );
|
||||
QString color = colorRegExp.match( match.captured( "properties" ) ).captured( 1 );
|
||||
const QWidgetList topLevelWidgets = QApplication::topLevelWidgets();
|
||||
@@ -131,13 +130,14 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
{
|
||||
for ( QwtPlot* plotWidget : widget->findChildren<QwtPlot*>() )
|
||||
{
|
||||
if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) || match.captured( "plotName" ) == "*" )
|
||||
if ( plotNameRegExp.match( plotWidget->property( "qss-class" ).toString() ).hasMatch() ||
|
||||
match.captured( "plotName" ) == "*" )
|
||||
{
|
||||
for ( QwtPlotItem* item : plotWidget->itemList() )
|
||||
{
|
||||
if ( QwtPlotGrid* grid = dynamic_cast<QwtPlotGrid*>( item ) )
|
||||
{
|
||||
if ( itemNameRegExp.exactMatch( item->title().text() ) || match.captured( "itemName" ) == "*" )
|
||||
if ( itemNameRegExp.match( item->title().text() ).hasMatch() || match.captured( "itemName" ) == "*" )
|
||||
{
|
||||
QPen pen = grid->majorPen();
|
||||
pen.setColor( QColor( color ) );
|
||||
@@ -155,8 +155,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
|
||||
[]( QRegularExpressionMatch& match )
|
||||
{
|
||||
QRegExp plotNameRegExp( match.captured( "plotName" ) );
|
||||
QRegExp itemNameRegExp( match.captured( "itemName" ) );
|
||||
QRegularExpression plotNameRegExp = QRegularExpression::fromWildcard( match.captured( "plotName" ) );
|
||||
QRegularExpression itemNameRegExp = QRegularExpression::fromWildcard( match.captured( "itemName" ) );
|
||||
QRegularExpression colorRegExp( "text-color:\\s*([#0-9a-zA-Z]+)" );
|
||||
QString color = colorRegExp.match( match.captured( "properties" ) ).captured( 1 );
|
||||
const QWidgetList topLevelWidgets = QApplication::topLevelWidgets();
|
||||
@@ -169,7 +169,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
{
|
||||
for ( QwtPlot* plotWidget : widget->findChildren<QwtPlot*>() )
|
||||
{
|
||||
if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) || match.captured( "plotName" ) == "*" )
|
||||
if ( plotNameRegExp.match( plotWidget->property( "qss-class" ).toString() ).hasMatch() ||
|
||||
match.captured( "plotName" ) == "*" )
|
||||
{
|
||||
for ( QwtLegendLabel* label : plotWidget->findChildren<QwtLegendLabel*>() )
|
||||
{
|
||||
@@ -189,8 +190,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
|
||||
[]( QRegularExpressionMatch& match )
|
||||
{
|
||||
QRegExp plotNameRegExp( match.captured( "plotName" ) );
|
||||
QRegExp itemNameRegExp( match.captured( "itemName" ) );
|
||||
QRegularExpression plotNameRegExp = QRegularExpression::fromWildcard( match.captured( "plotName" ) );
|
||||
QRegularExpression itemNameRegExp = QRegularExpression::fromWildcard( match.captured( "itemName" ) );
|
||||
QRegularExpression colorRegExp( "color:\\s*([#0-9a-zA-Z]+)" );
|
||||
QString color = colorRegExp.match( match.captured( "properties" ) ).captured( 1 );
|
||||
QRegularExpression textColorRegExp( "text-color:\\s*([#0-9a-zA-Z]+)" );
|
||||
@@ -214,7 +215,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
{
|
||||
for ( QwtPlot* plotWidget : widget->findChildren<QwtPlot*>() )
|
||||
{
|
||||
if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) || match.captured( "plotName" ) == "*" )
|
||||
if ( plotNameRegExp.match( plotWidget->property( "qss-class" ).toString() ).hasMatch() ||
|
||||
match.captured( "plotName" ) == "*" )
|
||||
{
|
||||
for ( QwtPlotItem* item : plotWidget->itemList() )
|
||||
{
|
||||
@@ -222,7 +224,7 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
{
|
||||
if ( marker->symbol() == nullptr || marker->symbol()->style() == QwtSymbol::NoSymbol )
|
||||
{
|
||||
if ( itemNameRegExp.exactMatch( item->title().text() ) || match.captured( "itemName" ) == "*" )
|
||||
if ( itemNameRegExp.match( item->title().text() ).hasMatch() || match.captured( "itemName" ) == "*" )
|
||||
{
|
||||
QPen pen = marker->linePen();
|
||||
pen.setColor( QColor( color ) );
|
||||
@@ -243,8 +245,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
|
||||
[]( QRegularExpressionMatch& match )
|
||||
{
|
||||
QRegExp plotNameRegExp( match.captured( "plotName" ) );
|
||||
QRegExp itemNameRegExp( match.captured( "itemName" ) );
|
||||
QRegularExpression plotNameRegExp = QRegularExpression::fromWildcard( match.captured( "plotName" ) );
|
||||
QRegularExpression itemNameRegExp = QRegularExpression::fromWildcard( match.captured( "itemName" ) );
|
||||
QRegularExpression colorRegExp( "color:\\s*([#0-9a-zA-Z]+)" );
|
||||
QString color = colorRegExp.match( match.captured( "properties" ) ).captured( 1 );
|
||||
QRegularExpression textColorRegExp( "text-color:\\s*([#0-9a-zA-Z]+)" );
|
||||
@@ -268,7 +270,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
{
|
||||
for ( QwtPlot* plotWidget : widget->findChildren<QwtPlot*>() )
|
||||
{
|
||||
if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) || match.captured( "plotName" ) == "*" )
|
||||
if ( plotNameRegExp.match( plotWidget->property( "qss-class" ).toString() ).hasMatch() ||
|
||||
match.captured( "plotName" ) == "*" )
|
||||
{
|
||||
for ( QwtPlotItem* item : plotWidget->itemList() )
|
||||
{
|
||||
@@ -276,7 +279,7 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
{
|
||||
if ( marker->symbol() && marker->symbol()->style() != QwtSymbol::NoSymbol )
|
||||
{
|
||||
if ( itemNameRegExp.exactMatch( item->title().text() ) || match.captured( "itemName" ) == "*" )
|
||||
if ( itemNameRegExp.match( item->title().text() ).hasMatch() || match.captured( "itemName" ) == "*" )
|
||||
{
|
||||
QPen pen = marker->symbol()->pen();
|
||||
pen.setColor( QColor( color ) );
|
||||
@@ -299,8 +302,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
|
||||
[]( QRegularExpressionMatch& match )
|
||||
{
|
||||
QRegExp plotNameRegExp( match.captured( "plotName" ) );
|
||||
QRegExp itemNameRegExp( match.captured( "itemName" ) );
|
||||
QRegularExpression plotNameRegExp = QRegularExpression::fromWildcard( match.captured( "plotName" ) );
|
||||
QRegularExpression itemNameRegExp = QRegularExpression::fromWildcard( match.captured( "itemName" ) );
|
||||
QRegularExpression textColorRegExp( "text-color:\\s*([#a-zA-Z0-9]+)" );
|
||||
QString textColor = textColorRegExp.match( match.captured( "properties" ) ).captured( 1 );
|
||||
|
||||
@@ -314,7 +317,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
{
|
||||
for ( QwtPlot* plotWidget : widget->findChildren<QwtPlot*>() )
|
||||
{
|
||||
if ( plotNameRegExp.exactMatch( plotWidget->property( "qss-class" ).toString() ) || match.captured( "plotName" ) == "*" )
|
||||
if ( plotNameRegExp.match( plotWidget->property( "qss-class" ).toString() ).hasMatch() ||
|
||||
match.captured( "plotName" ) == "*" )
|
||||
{
|
||||
QWidget* canvas = plotWidget->canvas();
|
||||
if ( canvas )
|
||||
|
@@ -433,12 +433,11 @@ void RiuQtChartsPlotWidget::setAutoTickIntervalCounts( RiuPlotAxis axis, int max
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiuQtChartsPlotWidget::majorTickInterval( RiuPlotAxis axis ) const
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 12, 0 )
|
||||
// QValueAxis::tickInterval was introduced in 5.12
|
||||
QAbstractAxis* ax = plotAxis( axis );
|
||||
QValueAxis* valueAxis = dynamic_cast<QValueAxis*>( ax );
|
||||
if ( valueAxis ) return valueAxis->tickInterval();
|
||||
#endif
|
||||
if ( QValueAxis* valueAxis = dynamic_cast<QValueAxis*>( plotAxis( axis ) ) )
|
||||
{
|
||||
return valueAxis->tickInterval();
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
@@ -129,8 +129,8 @@ QWidget* RiuSummaryVectorSelectionWidgetCreator::createWidget( QWidget* parent )
|
||||
rowSplitter->setContentsMargins( 0, 0, 0, 0 );
|
||||
rowSplitter->setHandleWidth( 6 );
|
||||
rowSplitter->setStyleSheet( "QSplitter::handle { image: url(:/SplitterV.png); }" );
|
||||
rowSplitter->insertWidget( 0, firstRowLeftFrame );
|
||||
rowSplitter->insertWidget( 1, firstRowRightFrame );
|
||||
rowSplitter->addWidget( firstRowLeftFrame );
|
||||
rowSplitter->addWidget( firstRowRightFrame );
|
||||
rowSplitter->setSizes( QList<int>() << 1 << 1 );
|
||||
firstRowLayout->addWidget( rowSplitter );
|
||||
|
||||
|
@@ -211,11 +211,7 @@ RiuTabbedTextDialog::RiuTabbedTextDialog( RiuTabbedTextProvider* textProvider, Q
|
||||
textEdit->setContextMenuPolicy( Qt::NoContextMenu );
|
||||
|
||||
auto fontWidth = QFontMetrics( font ).boundingRect( "m" ).width();
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 )
|
||||
textEdit->setTabStopDistance( fontWidth * 4 );
|
||||
#else
|
||||
textEdit->setTabStopWidth( fontWidth * 4 );
|
||||
#endif
|
||||
|
||||
m_tabWidget->addTab( textEdit, tabTitle );
|
||||
}
|
||||
|
@@ -550,19 +550,15 @@ find_package(
|
||||
Network
|
||||
Widgets
|
||||
Charts
|
||||
Core5Compat
|
||||
)
|
||||
set(QT_LIBRARIES
|
||||
Qt6::Core
|
||||
Qt6::Gui
|
||||
Qt6::OpenGL
|
||||
Qt6::Network
|
||||
Qt6::Widgets
|
||||
Qt6::Charts
|
||||
Qt6::Core5Compat
|
||||
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::OpenGL Qt6::Network Qt6::Widgets
|
||||
Qt6::Charts
|
||||
)
|
||||
qt_standard_project_setup()
|
||||
|
||||
# Disable use of foreach
|
||||
add_definitions(-DQT_NO_FOREACH)
|
||||
|
||||
# Open GL
|
||||
find_package(OpenGL)
|
||||
|
||||
|
@@ -72,7 +72,7 @@ void NotificationCenter::notifyObserversOfDataChange( caf::PdmObjectHandle* item
|
||||
{
|
||||
CAF_ASSERT( itemThatChanged );
|
||||
|
||||
foreach ( DataModelObserver* o, m_observers )
|
||||
for ( DataModelObserver* o : m_observers )
|
||||
{
|
||||
o->handleModelNotification( itemThatChanged );
|
||||
}
|
||||
@@ -83,7 +83,7 @@ void NotificationCenter::notifyObserversOfDataChange( caf::PdmObjectHandle* item
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void NotificationCenter::notifyObservers()
|
||||
{
|
||||
foreach ( DataModelObserver* o, m_observers )
|
||||
for ( DataModelObserver* o : m_observers )
|
||||
{
|
||||
o->handleModelNotification( nullptr );
|
||||
}
|
||||
@@ -94,7 +94,7 @@ void NotificationCenter::notifyObservers()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void NotificationCenter::notifyObserversOfSelectionChange()
|
||||
{
|
||||
foreach ( DataModelObserver* o, m_observers )
|
||||
for ( DataModelObserver* o : m_observers )
|
||||
{
|
||||
o->handleModelSelectionChange();
|
||||
}
|
||||
|
@@ -311,13 +311,7 @@ PdmObjectHandle* PdmReferenceHelper::objectFromFieldReference( PdmFieldHandle* f
|
||||
if ( reference.isEmpty() ) return nullptr;
|
||||
if ( reference.trimmed().isEmpty() ) return nullptr;
|
||||
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 ) )
|
||||
auto SkipEmptyParts = QString::SkipEmptyParts;
|
||||
#else
|
||||
auto SkipEmptyParts = Qt::SkipEmptyParts;
|
||||
#endif
|
||||
|
||||
QStringList decodedReference = reference.split( QRegularExpression( "\\s+" ), SkipEmptyParts );
|
||||
QStringList decodedReference = reference.split( QRegularExpression( "\\s+" ), Qt::SkipEmptyParts );
|
||||
PdmObjectHandle* lastCommonAnchestor = fromField->ownerObject();
|
||||
CAF_ASSERT( lastCommonAnchestor );
|
||||
|
||||
|
@@ -46,12 +46,8 @@ namespace caf
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QLocale norwegianLocale()
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 15, 0 )
|
||||
return QLocale::NorwegianBokmal;
|
||||
#else
|
||||
return QLocale::Norwegian;
|
||||
#endif
|
||||
} // namespace caf::norwegianLocale()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -59,11 +55,7 @@ QLocale norwegianLocale()
|
||||
QTextStream& endl( QTextStream& s )
|
||||
{
|
||||
// https: // github.com/qt/qtbase/blob/dev/src/corelib/serialization/qtextstream.cpp#L2845
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 15, 0 )
|
||||
return s << QLatin1Char( '\n' ) << Qt::flush;
|
||||
#else
|
||||
return s << QLatin1Char( '\n' ) << flush;
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -71,11 +63,7 @@ QTextStream& endl( QTextStream& s )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QPointF position( QWheelEvent* wheelEvent )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 15, 0 )
|
||||
return wheelEvent->position();
|
||||
#else
|
||||
return wheelEvent->pos();
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
|
@@ -41,10 +41,6 @@
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) )
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace caf
|
||||
@@ -95,15 +91,6 @@ int FontTools::absolutePointSize( FontSize normalPointSize, RelativeSize relativ
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int FontTools::pointSizeToPixelSize( int pointSize )
|
||||
{
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) )
|
||||
auto app = dynamic_cast<const QApplication*>( QCoreApplication::instance() );
|
||||
if ( app )
|
||||
{
|
||||
int dpi = app->desktop()->logicalDpiX();
|
||||
double inches = pointSize / 72.0;
|
||||
return static_cast<int>( std::ceil( inches * dpi ) );
|
||||
}
|
||||
#endif
|
||||
return pointSize;
|
||||
}
|
||||
|
||||
@@ -120,15 +107,6 @@ int FontTools::pointSizeToPixelSize( FontSize pointSize )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int FontTools::pixelSizeToPointSize( int pixelSize )
|
||||
{
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) )
|
||||
auto app = dynamic_cast<const QApplication*>( QCoreApplication::instance() );
|
||||
if ( app )
|
||||
{
|
||||
int dpi = app->desktop()->logicalDpiX();
|
||||
double inches = pixelSize / dpi;
|
||||
return static_cast<int>( std::ceil( inches * 72.0 ) );
|
||||
}
|
||||
#endif
|
||||
return pixelSize;
|
||||
}
|
||||
|
||||
|
@@ -42,10 +42,6 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QVariant>
|
||||
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) )
|
||||
#include <QtOpenGL/QGLFormat>
|
||||
#endif
|
||||
|
||||
namespace caf
|
||||
{
|
||||
//==================================================================================================
|
||||
@@ -302,48 +298,6 @@ QString AboutDialog::versionStringForcurrentOpenGLContext()
|
||||
{
|
||||
QString versionString( "OpenGL " );
|
||||
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) )
|
||||
QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
|
||||
|
||||
if ( flags & QGLFormat::OpenGL_Version_4_0 )
|
||||
versionString += "4.0";
|
||||
else if ( flags & QGLFormat::OpenGL_Version_3_3 )
|
||||
versionString += "3.3";
|
||||
else if ( flags & QGLFormat::OpenGL_Version_3_2 )
|
||||
versionString += "3.2";
|
||||
else if ( flags & QGLFormat::OpenGL_Version_3_1 )
|
||||
versionString += "3.1";
|
||||
else if ( flags & QGLFormat::OpenGL_Version_3_0 )
|
||||
versionString += "3.0";
|
||||
else if ( flags & QGLFormat::OpenGL_ES_Version_2_0 )
|
||||
versionString += "ES_Version 2.0";
|
||||
else if ( flags & QGLFormat::OpenGL_ES_CommonLite_Version_1_1 )
|
||||
versionString += "ES_CommonLite_Version 1.1";
|
||||
else if ( flags & QGLFormat::OpenGL_ES_Common_Version_1_1 )
|
||||
versionString += "ES_Common_Version 1.1";
|
||||
else if ( flags & QGLFormat::OpenGL_ES_CommonLite_Version_1_0 )
|
||||
versionString += "ES_CommonLite_Version 1.0";
|
||||
else if ( flags & QGLFormat::OpenGL_ES_Common_Version_1_0 )
|
||||
versionString += "ES_Common_Version 1.0";
|
||||
else if ( flags & QGLFormat::OpenGL_Version_2_1 )
|
||||
versionString += "2.1";
|
||||
else if ( flags & QGLFormat::OpenGL_Version_2_0 )
|
||||
versionString += "2.0";
|
||||
else if ( flags & QGLFormat::OpenGL_Version_1_5 )
|
||||
versionString += "1.5";
|
||||
else if ( flags & QGLFormat::OpenGL_Version_1_4 )
|
||||
versionString += "1.4";
|
||||
else if ( flags & QGLFormat::OpenGL_Version_1_3 )
|
||||
versionString += "1.3";
|
||||
else if ( flags & QGLFormat::OpenGL_Version_1_2 )
|
||||
versionString += "1.2";
|
||||
else if ( flags & QGLFormat::OpenGL_Version_1_1 )
|
||||
versionString += "1.1";
|
||||
else if ( flags & QGLFormat::OpenGL_Version_None )
|
||||
versionString += "None";
|
||||
else
|
||||
versionString += "Unknown";
|
||||
#endif
|
||||
return versionString;
|
||||
}
|
||||
|
||||
|
@@ -25,11 +25,6 @@
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 ) )
|
||||
auto SkipEmptyParts = QString::SkipEmptyParts;
|
||||
#else
|
||||
auto SkipEmptyParts = Qt::SkipEmptyParts;
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Read bytes of memory of different types for current process from /proc/self/statm
|
||||
@@ -47,7 +42,7 @@ std::map<QString, uint64_t> readProcessBytesLinux()
|
||||
if (procSelfStatus.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
QString line(procSelfStatus.readLine(256));
|
||||
QStringList lineWords = line.split(QRegularExpression("\\s+"), SkipEmptyParts);
|
||||
QStringList lineWords = line.split(QRegularExpression("\\s+"), Qt::SkipEmptyParts);
|
||||
quantities["VmSize"] = static_cast<uint64_t>(lineWords[0].toLongLong() * pageSize);
|
||||
quantities["RSS"] = static_cast<uint64_t>(lineWords[1].toLongLong() * pageSize);
|
||||
quantities["Shared"] = static_cast<uint64_t>(lineWords[2].toLongLong() * pageSize);
|
||||
@@ -75,7 +70,7 @@ std::map<QString, uint64_t> readMemInfoLinuxMiB()
|
||||
if (lineLength > 0)
|
||||
{
|
||||
QString line = QString::fromLatin1(buf, lineLength);
|
||||
QStringList words = line.split(QRegularExpression(":*\\s+"), SkipEmptyParts);
|
||||
QStringList words = line.split(QRegularExpression(":*\\s+"), Qt::SkipEmptyParts);
|
||||
if (words.size() > 1)
|
||||
{
|
||||
bool ok = true;
|
||||
|
@@ -191,8 +191,8 @@ void PdmUiComboBoxEditor::configureAndUpdateUi( const QString& uiConfigName )
|
||||
m_nextItemButton->setToolTip( "Next" );
|
||||
}
|
||||
|
||||
m_layout->insertWidget( 1, m_previousItemButton );
|
||||
m_layout->insertWidget( 2, m_nextItemButton );
|
||||
m_layout->addWidget( m_previousItemButton );
|
||||
m_layout->addWidget( m_nextItemButton );
|
||||
|
||||
{
|
||||
QIcon toolButtonIcon;
|
||||
@@ -283,7 +283,7 @@ void PdmUiComboBoxEditor::configureAndUpdateUi( const QString& uiConfigName )
|
||||
QString tooltipText = uiField()->isAutoValueEnabled() ? UiAppearanceSettings::globaleValueButtonText()
|
||||
: UiAppearanceSettings::localValueButtonText();
|
||||
m_autoValueToolButton->setToolTip( tooltipText );
|
||||
m_layout->insertWidget( 3, m_autoValueToolButton );
|
||||
m_layout->addWidget( m_autoValueToolButton );
|
||||
m_autoValueToolButton->show();
|
||||
}
|
||||
else
|
||||
|
@@ -172,7 +172,7 @@ void PdmUiLineEditor::configureAndUpdateUi( const QString& uiConfigName )
|
||||
: UiAppearanceSettings::localValueButtonText();
|
||||
m_autoValueToolButton->setToolTip( tooltipText );
|
||||
|
||||
m_layout->insertWidget( 1, m_autoValueToolButton );
|
||||
m_layout->addWidget( m_autoValueToolButton );
|
||||
m_autoValueToolButton->show();
|
||||
}
|
||||
else
|
||||
|
@@ -194,7 +194,7 @@ void PdmUiPropertyView::showProperties( PdmObjectHandle* object )
|
||||
|
||||
CAF_ASSERT( propertyWidget );
|
||||
|
||||
this->m_placeHolderLayout->insertWidget( 0, propertyWidget );
|
||||
this->m_placeHolderLayout->addWidget( propertyWidget );
|
||||
|
||||
// Add stretch to make sure the property widget is not stretched
|
||||
this->m_placeHolderLayout->insertStretch( -1, 1 );
|
||||
|
@@ -620,11 +620,7 @@ void PdmUiTreeSelectionEditor::slotInvertCheckedStateOfAll()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTreeSelectionEditor::setCheckedStateForIntegerItemsMatchingFilter()
|
||||
{
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 ) )
|
||||
auto SkipEmptyParts = QString::SkipEmptyParts;
|
||||
#else
|
||||
auto SkipEmptyParts = Qt::SkipEmptyParts;
|
||||
#endif
|
||||
|
||||
std::set<int> filterValues;
|
||||
|
||||
|
@@ -88,7 +88,7 @@ QValidator::State PdmUniqueIdValidator::validate( QString& currentString, int& )
|
||||
|
||||
if ( m_usedIds.find( currentValue ) != m_usedIds.end() )
|
||||
{
|
||||
foreach ( QWidget* widget, QApplication::topLevelWidgets() )
|
||||
for ( QWidget* widget : QApplication::topLevelWidgets() )
|
||||
{
|
||||
if ( widget->inherits( "QMainWindow" ) )
|
||||
{
|
||||
|
@@ -107,7 +107,7 @@ QModelIndex caf::QTreeViewStateSerializer::getModelIndexFromString( QAbstractIte
|
||||
|
||||
QModelIndex mi;
|
||||
|
||||
foreach ( QString modelIndexString, modelIndexStringList )
|
||||
for ( const QString& modelIndexString : modelIndexStringList )
|
||||
{
|
||||
QStringList items = modelIndexString.split( " " );
|
||||
|
||||
|
@@ -144,12 +144,7 @@ bool caf::CadNavigation::handleInputEvent( QInputEvent* inputEvent )
|
||||
{
|
||||
QWheelEvent* we = static_cast<QWheelEvent*>( inputEvent );
|
||||
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 ) )
|
||||
QPoint cursorPosition = we->pos();
|
||||
#else
|
||||
QPoint cursorPosition = we->position().toPoint();
|
||||
#endif
|
||||
|
||||
updatePointOfInterestDuringZoomIfNecessary( cursorPosition.x(), cursorPosition.y() );
|
||||
|
||||
if ( m_isRotCenterInitialized )
|
||||
|
@@ -202,12 +202,8 @@ void caf::CeetronNavigation::wheelEvent( QWheelEvent* event )
|
||||
int navDelta = vpHeight / 5;
|
||||
if ( event->angleDelta().y() < 0 ) navDelta *= -1;
|
||||
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 ) )
|
||||
QPoint cursorPosition = event->pos();
|
||||
#else
|
||||
QPoint cursorPosition = event->position().toPoint();
|
||||
#endif
|
||||
int posY = m_viewer->height() - cursorPosition.y();
|
||||
int posY = m_viewer->height() - cursorPosition.y();
|
||||
|
||||
m_trackball->startNavigation( ManipulatorTrackball::WALK, cursorPosition.x(), posY );
|
||||
|
||||
|
@@ -185,12 +185,7 @@ bool caf::CeetronPlusNavigation::handleInputEvent( QInputEvent* inputEvent )
|
||||
{
|
||||
QWheelEvent* we = static_cast<QWheelEvent*>( inputEvent );
|
||||
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 ) )
|
||||
QPoint cursorPosition = we->pos();
|
||||
#else
|
||||
QPoint cursorPosition = we->position().toPoint();
|
||||
#endif
|
||||
|
||||
updatePointOfInterestDuringZoomIfNecessary( cursorPosition.x(), cursorPosition.y() );
|
||||
|
||||
if ( m_isRotCenterInitialized )
|
||||
|
@@ -146,12 +146,11 @@ OpenGLWidget::~OpenGLWidget()
|
||||
|
||||
if (m_initializationState == IS_INITIALIZED)
|
||||
{
|
||||
// Make sure we disconnect from the aboutToBeDestroyed signal since after this destructor has been
|
||||
// called, our object is dangling and the call to the slot will cause a crash
|
||||
QOpenGLContext* myQtOpenGLContext = context();
|
||||
if (myQtOpenGLContext)
|
||||
if (QOpenGLContext* myQtOpenGLContext = context())
|
||||
{
|
||||
disconnect(myQtOpenGLContext, &QOpenGLContext::aboutToBeDestroyed, this, &OpenGLWidget::qtOpenGLContextAboutToBeDestroyed);
|
||||
// Make sure we disconnect from the all signals since after this destructor has been
|
||||
// called, our object is dangling and the call to any of the slots will cause a crash
|
||||
myQtOpenGLContext->disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -119,7 +119,7 @@ std::vector<cvf::String> Utils::toStringVector(const QStringList& stringList)
|
||||
{
|
||||
std::vector<cvf::String> strVec;
|
||||
|
||||
foreach (QString s, stringList)
|
||||
for (const QString& s : stringList)
|
||||
{
|
||||
strVec.push_back(toString(s));
|
||||
}
|
||||
@@ -136,7 +136,7 @@ QStringList Utils::toQStringList(const std::vector<cvf::String>& stringVector)
|
||||
{
|
||||
QStringList strList;
|
||||
|
||||
foreach (cvf::String s, stringVector)
|
||||
for (const cvf::String& s : stringVector)
|
||||
{
|
||||
strList.push_back(toQString(s));
|
||||
}
|
||||
|
@@ -145,13 +145,8 @@ void QMWidget::mouseMoveEvent(QMouseEvent* event)
|
||||
if (m_renderSequence.isNull()) return;
|
||||
|
||||
Qt::MouseButtons mouseBn = event->buttons();
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
||||
const int posX = event->position().toPoint().x();
|
||||
const int posY = height() - event->position().toPoint().y();
|
||||
#else
|
||||
const int posX = event->x();
|
||||
const int posY = height() - event->y();
|
||||
#endif
|
||||
|
||||
cvf::ManipulatorTrackball::NavigationType navType = cvf::ManipulatorTrackball::NONE;
|
||||
if (mouseBn == Qt::LeftButton)
|
||||
@@ -186,13 +181,8 @@ void QMWidget::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (m_renderSequence.isNull()) return;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
||||
const int posX = event->position().toPoint().x();
|
||||
const int posY = height() - event->position().toPoint().y();
|
||||
#else
|
||||
const int posX = event->x();
|
||||
const int posY = height() - event->y();
|
||||
#endif
|
||||
|
||||
if (event->buttons() == Qt::LeftButton &&
|
||||
event->modifiers() == Qt::ControlModifier)
|
||||
|
@@ -172,13 +172,8 @@ void QMVWidget::mouseMoveEvent(QMouseEvent* event)
|
||||
if (m_renderSequence.isNull()) return;
|
||||
|
||||
Qt::MouseButtons mouseBn = event->buttons();
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
||||
const int posX = event->position().toPoint().x();
|
||||
const int posY = height() - event->position().toPoint().y();
|
||||
#else
|
||||
const int posX = event->x();
|
||||
const int posY = height() - event->y();
|
||||
#endif
|
||||
|
||||
cvf::ManipulatorTrackball::NavigationType navType = cvf::ManipulatorTrackball::NONE;
|
||||
if (mouseBn == Qt::LeftButton)
|
||||
@@ -214,13 +209,8 @@ void QMVWidget::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (m_renderSequence.isNull()) return;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
||||
const int posX = event->position().toPoint().x();
|
||||
const int posY = height() - event->position().toPoint().y();
|
||||
#else
|
||||
const int posX = event->x();
|
||||
const int posY = height() - event->y();
|
||||
#endif
|
||||
|
||||
if (event->buttons() == Qt::LeftButton && event->modifiers() == Qt::ControlModifier)
|
||||
{
|
||||
|
@@ -245,13 +245,8 @@ void QTBVizWidget::mouseMoveEvent(QMouseEvent* event)
|
||||
if (m_renderSequence.isNull()) return;
|
||||
|
||||
Qt::MouseButtons mouseBn = event->buttons();
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
||||
const int posX = event->position().toPoint().x();
|
||||
const int posY = height() - event->position().toPoint().y();
|
||||
#else
|
||||
const int posX = event->x();
|
||||
const int posY = height() - event->y();
|
||||
#endif
|
||||
|
||||
cvf::ManipulatorTrackball::NavigationType navType = cvf::ManipulatorTrackball::NONE;
|
||||
if (mouseBn == Qt::LeftButton)
|
||||
@@ -286,13 +281,8 @@ void QTBVizWidget::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (m_renderSequence.isNull()) return;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
||||
const int posX = event->position().toPoint().x();
|
||||
const int posY = height() - event->position().toPoint().y();
|
||||
#else
|
||||
const int posX = event->x();
|
||||
const int posY = height() - event->y();
|
||||
#endif
|
||||
|
||||
if (event->buttons() == Qt::LeftButton && event->modifiers() == Qt::ControlModifier)
|
||||
{
|
||||
|
Reference in New Issue
Block a user