Skip to content
Permalink
Browse files
Tiny optimizations
  • Loading branch information
nirvn authored and nyalldawson committed Jul 16, 2021
1 parent 2006c97 commit 15d4f5b46bff5a5cbef21a6d911046536371e7aa
Showing with 7 additions and 7 deletions.
  1. +5 −6 src/core/browser/qgsbrowserproxymodel.cpp
  2. +2 −1 src/core/browser/qgsdataitem.cpp
@@ -88,8 +88,8 @@ void QgsBrowserProxyModel::updateFilter()
const QStringList filterParts = mFilter.split( '|' );
for ( const QString &f : filterParts )
{
QRegularExpression rx( QRegularExpression::wildcardToRegularExpression( QStringLiteral( "*%1*" ).arg( f.trimmed() ) ) );
rx.setPatternOptions( mCaseSensitivity == Qt::CaseInsensitive ? QRegularExpression::CaseInsensitiveOption : QRegularExpression::NoPatternOption );
const QRegularExpression rx( QRegularExpression::wildcardToRegularExpression( QStringLiteral( "*%1*" ).arg( f.trimmed() ) ),
mCaseSensitivity == Qt::CaseInsensitive ? QRegularExpression::CaseInsensitiveOption : QRegularExpression::NoPatternOption );
mREList.append( rx );
}
break;
@@ -99,16 +99,15 @@ void QgsBrowserProxyModel::updateFilter()
const QStringList filterParts = mFilter.split( '|' );
for ( const QString &f : filterParts )
{
QRegularExpression rx( QRegularExpression::wildcardToRegularExpression( f.trimmed() ) );
rx.setPatternOptions( mCaseSensitivity == Qt::CaseInsensitive ? QRegularExpression::CaseInsensitiveOption : QRegularExpression::NoPatternOption );
const QRegularExpression rx( QRegularExpression::wildcardToRegularExpression( f.trimmed() ),
mCaseSensitivity == Qt::CaseInsensitive ? QRegularExpression::CaseInsensitiveOption : QRegularExpression::NoPatternOption );
mREList.append( rx );
}
break;
}
case RegularExpression:
{
QRegularExpression rx( mFilter.trimmed() );
rx.setPatternOptions( mCaseSensitivity == Qt::CaseInsensitive ? QRegularExpression::CaseInsensitiveOption : QRegularExpression::NoPatternOption );
const QRegularExpression rx( mFilter.trimmed(), mCaseSensitivity == Qt::CaseInsensitive ? QRegularExpression::CaseInsensitiveOption : QRegularExpression::NoPatternOption );
mREList.append( rx );
break;
}
@@ -89,7 +89,8 @@ QgsDataItem::~QgsDataItem()

QString QgsDataItem::pathComponent( const QString &string )
{
return QString( string ).replace( QRegularExpression( "[\\\\/]" ), QStringLiteral( "|" ) );
const thread_local QRegularExpression rx( "[\\\\/]" );
return QString( string ).replace( rx, QStringLiteral( "|" ) );
}

QVariant QgsDataItem::sortKey() const

0 comments on commit 15d4f5b

Please sign in to comment.