Skip to content

Commit

Permalink
QString fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 6, 2021
1 parent b832f0f commit 3b68d64
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/core/providers/ogr/qgsogrprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3432,7 +3432,7 @@ void QgsOgrProvider::open( OpenMode mode )
// Try to open using VSIFileHandler
// see http://trac.osgeo.org/gdal/wiki/UserDocs/ReadInZip
QString vsiPrefix = QgsZipItem::vsiPrefix( dataSourceUri( true ) );
if ( !vsiPrefix.isEmpty() || mFilePath.startsWith( QStringLiteral( "/vsicurl/" ) ) )
if ( !vsiPrefix.isEmpty() || mFilePath.startsWith( QLatin1String( "/vsicurl/" ) ) )
{
// GDAL>=1.8.0 has write support for zip, but read and write operations
// cannot be interleaved, so for now just use read-only.
Expand Down
4 changes: 2 additions & 2 deletions src/core/providers/ogr/qgsogrproviderutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ OGRLayerH QgsOgrProviderUtils::setSubsetString( OGRLayerH layer, GDALDatasetH ds
QStringList lines {subsetString.split( QChar( '\n' ) )};
lines.erase( std::remove_if( lines.begin(), lines.end(), []( const QString & line )
{
return line.startsWith( QStringLiteral( "--" ) );
return line.startsWith( QLatin1String( "--" ) );
} ), lines.end() );
for ( auto &line : lines )
{
Expand All @@ -1317,7 +1317,7 @@ OGRLayerH QgsOgrProviderUtils::setSubsetString( OGRLayerH layer, GDALDatasetH ds
inLiteral = !inLiteral;
literalChar = inLiteral ? line[i] : QChar( ' ' );
}
if ( !inLiteral && line.mid( i ).startsWith( QStringLiteral( "--" ) ) )
if ( !inLiteral && line.mid( i ).startsWith( QLatin1String( "--" ) ) )
{
line = line.left( i );
break;
Expand Down
6 changes: 3 additions & 3 deletions src/core/symbology/qgscategorizedsymbolrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ QgsFeatureRenderer *QgsCategorizedSymbolRenderer::create( QDomElement &element,
// Value from string (long, ulong, double and string)
const auto valueFromString = []( const QString & value, const QString & valueType ) -> QVariant
{
if ( valueType == QStringLiteral( "double" ) )
if ( valueType == QLatin1String( "double" ) )
{
bool ok;
const auto val { value.toDouble( &ok ) };
Expand All @@ -681,7 +681,7 @@ QgsFeatureRenderer *QgsCategorizedSymbolRenderer::create( QDomElement &element,
return val;
}
}
else if ( valueType == QStringLiteral( "ulong" ) )
else if ( valueType == QLatin1String( "ulong" ) )
{
bool ok;
const auto val { value.toULongLong( &ok ) };
Expand All @@ -690,7 +690,7 @@ QgsFeatureRenderer *QgsCategorizedSymbolRenderer::create( QDomElement &element,
return val;
}
}
else if ( valueType == QStringLiteral( "long" ) )
else if ( valueType == QLatin1String( "long" ) )
{
bool ok;
const auto val { value.toLongLong( &ok ) };
Expand Down
8 changes: 4 additions & 4 deletions src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,19 +809,19 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes, bool forceFullScan,
{
typeName = csvtTypes[fieldIdx];
// Map CSVT types to provider types
if ( typeName.startsWith( QStringLiteral( "coord" ) ) || typeName.startsWith( QStringLiteral( "point(" ) ) )
if ( typeName.startsWith( QLatin1String( "coord" ) ) || typeName.startsWith( QLatin1String( "point(" ) ) )
{
typeName = QStringLiteral( "double" );
}
else if ( typeName == QStringLiteral( "long" ) || typeName == QStringLiteral( "integer64" ) )
else if ( typeName == QLatin1String( "long" ) || typeName == QLatin1String( "integer64" ) )
{
typeName = QStringLiteral( "longlong" );
}
else if ( typeName == QStringLiteral( "int8" ) )
else if ( typeName == QLatin1String( "int8" ) )
{
typeName = QStringLiteral( "integer" );
}
else if ( typeName == QStringLiteral( "real" ) )
else if ( typeName == QLatin1String( "real" ) )
{
typeName = QStringLiteral( "double" );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ QString QgsDelimitedTextSourceSelect::url( bool skipOverriddenTypes )
{
QgsDebugMsgLevel( QStringLiteral( "Overriding field %1 from %2 to %3" ).arg( fieldName, fieldTypeName, typeCombo->currentData().toString() ), 2 );
query.addQueryItem( QStringLiteral( "field" ),
QString( fieldName ).replace( ':', QStringLiteral( "%3A" ) ) + ':' + typeCombo->currentData().toString() );
QString( fieldName ).replace( ':', QLatin1String( "%3A" ) ) + ':' + typeCombo->currentData().toString() );
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions tests/src/gui/testqgsrelationeditorwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ void TestQgsRelationEditorWidget::testMultiEdit1N()
QCOMPARE( childItem->data( 0, static_cast<int>( QgsRelationEditorWidget::MultiEditTreeWidgetRole::FeatureType ) ).toInt(),
static_cast<int>( QgsRelationEditorWidget::MultiEditFeatureType::Child ) );

if ( childItem->text( 0 ) == QStringLiteral( "Layer1-0" ) )
if ( childItem->text( 0 ) == QLatin1String( "Layer1-0" ) )
QCOMPARE( parentItem->text( 0 ), QStringLiteral( "Layer2-10" ) );

if ( childItem->text( 0 ) == QStringLiteral( "Layer1-1" ) )
if ( childItem->text( 0 ) == QLatin1String( "Layer1-1" ) )
QCOMPARE( parentItem->text( 0 ), QStringLiteral( "Layer2-11" ) );
}
}
Expand Down Expand Up @@ -260,10 +260,10 @@ void TestQgsRelationEditorWidget::testMultiEditNM()
QCOMPARE( childItem->data( 0, static_cast<int>( QgsRelationEditorWidget::MultiEditTreeWidgetRole::FeatureType ) ).toInt(),
static_cast<int>( QgsRelationEditorWidget::MultiEditFeatureType::Child ) );

if ( childItem->text( 0 ) == QStringLiteral( "Layer2-10" ) )
if ( childItem->text( 0 ) == QLatin1String( "Layer2-10" ) )
QCOMPARE( parentItem->text( 0 ), QStringLiteral( "Layer1-0" ) );

if ( childItem->text( 0 ) == QStringLiteral( "Layer2-11" ) )
if ( childItem->text( 0 ) == QLatin1String( "Layer2-11" ) )
{
QStringList possibleParents;
possibleParents << QStringLiteral( "Layer1-0" )
Expand Down

0 comments on commit 3b68d64

Please sign in to comment.