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:
Magne Sjaastad authored and GitHub committed 2024-10-28 13:09:18 +01:00
1 parent bb047e82d3
commit 2814b92055
59 files changed
+196 -393

No files matched your search

@@ -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 );
}
//--------------------------------------------------------------------------------------------------
-2
View File
@@ -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;
Whitespace-only changes.
@@ -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 );
}