mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-01 03:37:15 -06:00
Use QRegularExpression instead of QRegExp
This commit is contained in:
parent
e23560d9a0
commit
2c02d61846
@ -40,6 +40,7 @@
|
||||
#include <QtCore/QFileInfo>
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <QtOpenGL/QGLContext>
|
||||
|
||||
@ -153,7 +154,7 @@ QString Utils::makeValidFileBasename( const QString& fileBasenameCandidate )
|
||||
cleanBasename.replace( "\n", "_" );
|
||||
cleanBasename.replace( "#", "_" );
|
||||
|
||||
cleanBasename.replace( QRegExp( "_+" ), "_" );
|
||||
cleanBasename.replace( QRegularExpression( "_+" ), "_" );
|
||||
|
||||
return cleanBasename;
|
||||
}
|
||||
@ -283,8 +284,12 @@ bool Utils::isStringMatch( const QString& filterString, const QString& value )
|
||||
return false;
|
||||
}
|
||||
|
||||
QRegExp searcher( filterString, Qt::CaseInsensitive, QRegExp::WildcardUnix );
|
||||
return searcher.exactMatch( value );
|
||||
auto regExpString = QRegularExpression::wildcardToRegularExpression( filterString );
|
||||
QRegularExpression regExp( regExpString );
|
||||
regExp.setPatternOptions( QRegularExpression::CaseInsensitiveOption );
|
||||
auto match = regExp.match( value );
|
||||
|
||||
return match.hasMatch();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "cafAssert.h"
|
||||
#include "cafPdmFieldHandle.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -328,7 +328,13 @@ PdmObjectHandle* PdmReferenceHelper::objectFromFieldReference( PdmFieldHandle* f
|
||||
if ( reference.isEmpty() ) return nullptr;
|
||||
if ( reference.trimmed().isEmpty() ) return nullptr;
|
||||
|
||||
QStringList decodedReference = reference.split( QRegExp( "\\s+" ), QString::SkipEmptyParts );
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) )
|
||||
auto SkipEmptyParts = QString::SkipEmptyParts;
|
||||
#else
|
||||
auto SkipEmptyParts = Qt::SkipEmptyParts;
|
||||
#endif
|
||||
|
||||
QStringList decodedReference = reference.split( QRegularExpression( "\\s+" ), SkipEmptyParts );
|
||||
PdmObjectHandle* lastCommonAnchestor = fromField->ownerObject();
|
||||
CAF_ASSERT( lastCommonAnchestor );
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "cafPdmObjectHandle.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class QStringList;
|
||||
#include <QStringList>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
@ -3,9 +3,9 @@
|
||||
#include "cafMemoryInspector.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QRegExp>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#ifdef _WIN32
|
||||
// Define this one to tell windows.h to not define min() and max() as macros
|
||||
@ -24,6 +24,13 @@
|
||||
#define MIB_DIV 1048576
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 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
|
||||
/// See: http://man7.org/linux/man-pages/man5/proc.5.html
|
||||
@ -40,7 +47,7 @@ std::map<QString, uint64_t> readProcessBytesLinux()
|
||||
if (procSelfStatus.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
QString line(procSelfStatus.readLine(256));
|
||||
QStringList lineWords = line.split(QRegExp("\\s+"), QString::SkipEmptyParts);
|
||||
QStringList lineWords = line.split(QRegularExpression("\\s+"), 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);
|
||||
@ -68,7 +75,7 @@ std::map<QString, uint64_t> readMemInfoLinuxMiB()
|
||||
if (lineLength > 0)
|
||||
{
|
||||
QString line = QString::fromLatin1(buf, lineLength);
|
||||
QStringList words = line.split(QRegExp(":*\\s+"), QString::SkipEmptyParts);
|
||||
QStringList words = line.split(QRegularExpression(":*\\s+"), SkipEmptyParts);
|
||||
if (words.size() > 1)
|
||||
{
|
||||
bool ok = true;
|
||||
|
@ -598,7 +598,7 @@ void PdmUiTreeSelectionEditor::slotInvertCheckedStateOfAll()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTreeSelectionEditor::setCheckedStateForIntegerItemsMatchingFilter()
|
||||
{
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 ) )
|
||||
#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) )
|
||||
auto SkipEmptyParts = QString::SkipEmptyParts;
|
||||
#else
|
||||
auto SkipEmptyParts = Qt::SkipEmptyParts;
|
||||
@ -692,8 +692,10 @@ void PdmUiTreeSelectionEditor::slotTextFilterChanged()
|
||||
searchString.replace( "[", "\\[" );
|
||||
searchString.replace( "]", "\\]" );
|
||||
|
||||
QRegExp searcher( searchString, Qt::CaseInsensitive, QRegExp::WildcardUnix );
|
||||
m_proxyModel->setFilterRegExp( searcher );
|
||||
auto regExpString = QRegularExpression::wildcardToRegularExpression( searchString );
|
||||
QRegularExpression regExp( regExpString );
|
||||
regExp.setPatternOptions( QRegularExpression::CaseInsensitiveOption );
|
||||
m_proxyModel->setFilterRegularExpression( regExp );
|
||||
|
||||
updateUi();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user