Skip to content

Commit ce4ac07

Browse files
committed
Don't use .lower() to perform case-insensitive string operations
Use the faster versions with Qt::CaseInsensitive instead. These don't require a string copy and conversion to lowercase. Thanks to Clazy
1 parent 5197b5f commit ce4ac07

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/core/processing/qgsprocessingparameters.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ bool QgsProcessingParameters::parseScriptCodeParameterOptions( const QString &co
888888

889889
name = m.captured( 1 );
890890
QString tokens = m.captured( 2 );
891-
if ( tokens.toLower().startsWith( QStringLiteral( "optional" ) ) )
891+
if ( tokens.startsWith( QStringLiteral( "optional" ), Qt::CaseInsensitive ) )
892892
{
893893
isOptional = true;
894894
tokens.remove( 0, 8 ); // length "optional" = 8

src/core/qgsstacktrace.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,14 @@ QgsStackTrace::QgsStackTrace()
168168

169169
bool QgsStackTrace::StackLine::isQgisModule() const
170170
{
171-
return moduleName.toLower().contains( "qgis" );
171+
return moduleName.contains( "qgis", Qt::CaseInsensitive );
172172
}
173173

174174
bool QgsStackTrace::StackLine::isValid() const
175175
{
176-
return !( fileName.toLower().contains( "exe_common" ) ||
177-
fileName.toLower().contains( "unknown" ) ||
178-
lineNumber.toLower().contains( "unknown" ) );
176+
return !( fileName.contains( "exe_common", Qt::CaseInsensitive ) ||
177+
fileName.contains( "unknown", Qt::CaseInsensitive ) ||
178+
lineNumber.contains( "unknown", Qt::CaseInsensitive ) );
179179

180180
}
181181
///@endcond

0 commit comments

Comments
 (0)