Skip to content

Commit ef7e7c5

Browse files
committed
Fix clazy QString multi-arg warnings
1 parent a08c05b commit ef7e7c5

11 files changed

+42
-61
lines changed

src/analysis/processing/qgsalgorithmfiledownloader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void QgsFileDownloaderAlgorithm::sendProgressFeedback()
110110
if ( mTotal.isEmpty() )
111111
mFeedback->pushInfo( tr( "%1 downloaded." ).arg( mReceived ) );
112112
else
113-
mFeedback->pushInfo( tr( "%1 of %2 downloaded." ).arg( mReceived ).arg( mTotal ) );
113+
mFeedback->pushInfo( tr( "%1 of %2 downloaded." ).arg( mReceived, mTotal ) );
114114
}
115115
}
116116

src/analysis/processing/qgsalgorithmmergevector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ QVariantMap QgsMergeVectorAlgorithm::processAlgorithm( const QVariantMap &parame
152152
if ( destField.type() != sourceField.type() )
153153
{
154154
throw QgsProcessingException( QObject::tr( "%1 field in layer %2 has different data type than in other layers (%3 instead of %4)" )
155-
.arg( sourceField.name(), vl->name() ).arg( sourceField.typeName() ).arg( destField.typeName() ) );
155+
.arg( sourceField.name(), vl->name(), sourceField.typeName(), destField.typeName() ) );
156156
}
157157
break;
158158
}

src/analysis/processing/qgsalgorithmrasterlayeruniquevalues.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ QVariantMap QgsRasterLayerUniqueValuesReportAlgorithm::processAlgorithm( const Q
166166

167167
QTextStream out( &file );
168168
out << QString( "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/></head><body>\n" );
169-
out << QString( "<p>%1: %2 (%3 %4)</p>\n" ).arg( QObject::tr( "Analyzed file" ) ).arg( mSource ).arg( QObject::tr( "band" ) ).arg( band );
170-
out << QObject::tr( "<p>%1: %2</p>\n" ).arg( QObject::tr( "Extent" ) ).arg( mExtent.toString() );
171-
out << QObject::tr( "<p>%1: %2 (%3)</p>\n" ).arg( QObject::tr( "Projection" ) ).arg( mCrs.description() ).arg( mCrs.authid() );
169+
out << QString( "<p>%1: %2 (%3 %4)</p>\n" ).arg( QObject::tr( "Analyzed file" ), mSource, QObject::tr( "band" ) ).arg( band );
170+
out << QObject::tr( "<p>%1: %2</p>\n" ).arg( QObject::tr( "Extent" ), mExtent.toString() );
171+
out << QObject::tr( "<p>%1: %2 (%3)</p>\n" ).arg( QObject::tr( "Projection" ), mCrs.description(), mCrs.authid() );
172172
out << QObject::tr( "<p>%1: %2 (%3 %4)</p>\n" ).arg( QObject::tr( "Width in pixels" ) ).arg( mLayerWidth ).arg( QObject::tr( "units per pixel" ) ).arg( mRasterUnitsPerPixelX );
173173
out << QObject::tr( "<p>%1: %2 (%3 %4)</p>\n" ).arg( QObject::tr( "Height in pixels" ) ).arg( mLayerHeight ).arg( QObject::tr( "units per pixel" ) ).arg( mRasterUnitsPerPixelY );
174174
out << QObject::tr( "<p>%1: %2</p>\n" ).arg( QObject::tr( "Total pixel count" ) ).arg( layerSize );
175175
if ( mHasNoDataValue )
176176
out << QObject::tr( "<p>%1: %2</p>\n" ).arg( QObject::tr( "NODATA pixel count" ) ).arg( noDataCount );
177-
out << QString( "<table><tr><td>%1</td><td>%2</td><td>%3 (%4)</td></tr>\n" ).arg( QObject::tr( "Value" ) ).arg( QObject::tr( "Pixel count" ) ).arg( QObject::tr( "Area" ) ).arg( areaUnit );
177+
out << QString( "<table><tr><td>%1</td><td>%2</td><td>%3 (%4)</td></tr>\n" ).arg( QObject::tr( "Value" ), QObject::tr( "Pixel count" ), QObject::tr( "Area" ), areaUnit );
178178

179179
for ( double key : sortedUniqueValues.keys() )
180180
{

src/analysis/vector/geometry_checker/qgsgeometrycontainedcheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void QgsGeometryContainedCheck::collectErrors( QList<QgsGeometryCheckError *> &e
5252
}
5353
else if ( !errMsg.isEmpty() )
5454
{
55-
messages.append( tr( "Contained check failed for (%1, %2): %3" ).arg( layerFeatureB.id() ).arg( layerFeatureA.id() ).arg( errMsg ) );
55+
messages.append( tr( "Contained check failed for (%1, %2): %3" ).arg( layerFeatureB.id(), layerFeatureA.id(), errMsg ) );
5656
}
5757
}
5858
}

src/analysis/vector/geometry_checker/qgsgeometryduplicatecheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void QgsGeometryDuplicateCheck::collectErrors( QList<QgsGeometryCheckError *> &e
7272
}
7373
else if ( !errMsg.isEmpty() )
7474
{
75-
messages.append( tr( "Duplicate check failed for (%1, %2): %3" ).arg( layerFeatureA.id() ).arg( layerFeatureB.id() ).arg( errMsg ) );
75+
messages.append( tr( "Duplicate check failed for (%1, %2): %3" ).arg( layerFeatureA.id(), layerFeatureB.id(), errMsg ) );
7676
}
7777
delete diffGeom;
7878
}

src/analysis/vector/geometry_checker/qgsgeometryoverlapcheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void QgsGeometryOverlapCheck::collectErrors( QList<QgsGeometryCheckError *> &err
6464
}
6565
else if ( !errMsg.isEmpty() )
6666
{
67-
messages.append( tr( "Overlap check between features %1 and %2 %3" ).arg( layerFeatureA.id() ).arg( layerFeatureB.id() ).arg( errMsg ) );
67+
messages.append( tr( "Overlap check between features %1 and %2 %3" ).arg( layerFeatureA.id(), layerFeatureB.id(), errMsg ) );
6868
}
6969
delete interGeom;
7070
}

src/app/dwg/qgsdwgimporter.cpp

Lines changed: 20 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -903,9 +903,7 @@ void QgsDwgImporter::addLayer( const DRW_Layer &data )
903903
if ( OGR_L_CreateFeature( layer, f.get() ) != OGRERR_NONE )
904904
{
905905
LOG( QObject::tr( "Could not add %3 %1 [%2]" )
906-
.arg( data.name.c_str() )
907-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
908-
.arg( QObject::tr( "layer" ) )
906+
.arg( data.name.c_str(), QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "layer" ) )
909907
);
910908
}
911909
}
@@ -1105,9 +1103,7 @@ void QgsDwgImporter::addDimStyle( const DRW_Dimstyle &data )
11051103
if ( OGR_L_CreateFeature( layer, f.get() ) != OGRERR_NONE )
11061104
{
11071105
LOG( QObject::tr( "Could not add %3 %1 [%2]" )
1108-
.arg( data.name.c_str() )
1109-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
1110-
.arg( QObject::tr( "dimension style" ) )
1106+
.arg( data.name.c_str(), QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "dimension style" ) )
11111107
);
11121108
}
11131109
}
@@ -1139,9 +1135,7 @@ void QgsDwgImporter::addTextStyle( const DRW_Textstyle &data )
11391135
if ( OGR_L_CreateFeature( layer, f.get() ) != OGRERR_NONE )
11401136
{
11411137
LOG( QObject::tr( "Could not add %3 %1 [%2]" )
1142-
.arg( data.name.c_str() )
1143-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
1144-
.arg( QObject::tr( "text style" ) )
1138+
.arg( data.name.c_str(), QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "text style" ) )
11451139
);
11461140
}
11471141
}
@@ -1202,8 +1196,7 @@ void QgsDwgImporter::addBlock( const DRW_Block &data )
12021196
if ( !createFeature( layer, f.get(), p ) )
12031197
{
12041198
LOG( QObject::tr( "Could not add %2 [%1]" )
1205-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
1206-
.arg( QObject::tr( "block" ) )
1199+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "block" ) )
12071200
);
12081201
}
12091202
}
@@ -1263,8 +1256,7 @@ void QgsDwgImporter::addPoint( const DRW_Point &data )
12631256
if ( !createFeature( layer, f, p ) )
12641257
{
12651258
LOG( QObject::tr( "Could not add %2 [%1]" )
1266-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
1267-
.arg( QObject::tr( "point" ) )
1259+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "point" ) )
12681260
);
12691261
}
12701262
}
@@ -1317,8 +1309,7 @@ void QgsDwgImporter::addArc( const DRW_Arc &data )
13171309
if ( !createFeature( layer, f, c ) )
13181310
{
13191311
LOG( QObject::tr( "Could not add %2 [%1]" )
1320-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
1321-
.arg( QObject::tr( "arc" ) )
1312+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "arc" ) )
13221313
);
13231314
}
13241315
}
@@ -1348,8 +1339,7 @@ void QgsDwgImporter::addCircle( const DRW_Circle &data )
13481339
if ( !createFeature( layer, f, c ) )
13491340
{
13501341
LOG( QObject::tr( "Could not add %2 [%1]" )
1351-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
1352-
.arg( QObject::tr( "circle" ) )
1342+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "circle" ) )
13531343
);
13541344
}
13551345
}
@@ -1500,8 +1490,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
15001490
if ( !createFeature( layer, f, cc ) )
15011491
{
15021492
LOG( QObject::tr( "Could not add %2 [%1]" )
1503-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
1504-
.arg( QObject::tr( "line string" ) )
1493+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "line string" ) )
15051494
);
15061495
}
15071496

@@ -1572,8 +1561,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
15721561
if ( !createFeature( layer, f, poly ) )
15731562
{
15741563
LOG( QObject::tr( "Could not add %2 [%1]" )
1575-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
1576-
.arg( QObject::tr( "polygon" ) )
1564+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "polygon" ) )
15771565
);
15781566
}
15791567
}
@@ -1619,8 +1607,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
16191607
if ( !createFeature( layer, f, cc ) )
16201608
{
16211609
LOG( QObject::tr( "Could not add %2 [%1]" )
1622-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
1623-
.arg( QObject::tr( "line string" ) )
1610+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "line string" ) )
16241611
);
16251612
}
16261613
}
@@ -1701,8 +1688,7 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
17011688
if ( !createFeature( layer, f, cc ) )
17021689
{
17031690
LOG( QObject::tr( "Could not add %2 [%1]" )
1704-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
1705-
.arg( QObject::tr( "line string" ) )
1691+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "line string" ) )
17061692
);
17071693
}
17081694

@@ -1778,8 +1764,7 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
17781764
if ( !createFeature( layer, f, poly ) )
17791765
{
17801766
LOG( QObject::tr( "Could not add %2 [%1]" )
1781-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
1782-
.arg( QObject::tr( "polygon" ) )
1767+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "polygon" ) )
17831768
);
17841769
}
17851770
}
@@ -1825,8 +1810,7 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
18251810
if ( !createFeature( layer, f, cc ) )
18261811
{
18271812
LOG( QObject::tr( "Could not add %2 [%1]" )
1828-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
1829-
.arg( QObject::tr( "line string" ) )
1813+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "line string" ) )
18301814
);
18311815
}
18321816
}
@@ -2067,8 +2051,7 @@ void QgsDwgImporter::addSpline( const DRW_Spline *data )
20672051
if ( !createFeature( layer, f, l ) )
20682052
{
20692053
LOG( QObject::tr( "Could not add %2 [%1]" )
2070-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
2071-
.arg( QObject::tr( "spline" ) )
2054+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "spline" ) )
20722055
);
20732056
}
20742057
}
@@ -2109,8 +2092,7 @@ void QgsDwgImporter::addInsert( const DRW_Insert &data )
21092092
if ( !createFeature( layer, f, p ) )
21102093
{
21112094
LOG( QObject::tr( "Could not add %2 [%1]" )
2112-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
2113-
.arg( QObject::tr( "point" ) )
2095+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "point" ) )
21142096
);
21152097
}
21162098
}
@@ -2161,8 +2143,7 @@ void QgsDwgImporter::addSolid( const DRW_Solid &data )
21612143
if ( !createFeature( layer, f, poly ) )
21622144
{
21632145
LOG( QObject::tr( "Could not add %2 [%1]" )
2164-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
2165-
.arg( QObject::tr( "polygon" ) )
2146+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "polygon" ) )
21662147
);
21672148
}
21682149
}
@@ -2197,8 +2178,7 @@ void QgsDwgImporter::addMText( const DRW_MText &data )
21972178
if ( !createFeature( layer, f, p ) )
21982179
{
21992180
LOG( QObject::tr( "Could not add %2 [%1]" )
2200-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
2201-
.arg( QObject::tr( "point" ) )
2181+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "point" ) )
22022182
);
22032183
}
22042184
}
@@ -2236,8 +2216,7 @@ void QgsDwgImporter::addText( const DRW_Text &data )
22362216
if ( !createFeature( layer, f, p ) )
22372217
{
22382218
LOG( QObject::tr( "Could not add %2 [%1]" )
2239-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
2240-
.arg( QObject::tr( "point" ) )
2219+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "point" ) )
22412220
);
22422221
}
22432222
}
@@ -2369,8 +2348,7 @@ void QgsDwgImporter::addHatch( const DRW_Hatch *pdata )
23692348
if ( !createFeature( layer, f, p ) )
23702349
{
23712350
LOG( QObject::tr( "Could not add %2 [%1]" )
2372-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
2373-
.arg( QObject::tr( "polygon" ) )
2351+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "polygon" ) )
23742352
);
23752353
}
23762354
}
@@ -2399,8 +2377,7 @@ void QgsDwgImporter::addLine( const DRW_Line &data )
23992377
if ( !createFeature( layer, f, l ) )
24002378
{
24012379
LOG( QObject::tr( "Could not add %2 [%1]" )
2402-
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
2403-
.arg( QObject::tr( "line string" ) )
2380+
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "line string" ) )
24042381
);
24052382
}
24062383
}

src/app/qgisapp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6842,7 +6842,7 @@ void QgisApp::saveAsRasterFile( QgsRasterLayer *rasterLayer )
68426842
emit layerSavedAs( rlWeakPointer, fileName );
68436843

68446844
messageBar()->pushMessage( tr( "Saving Done" ),
6845-
tr( "Successfully saved raster layer to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( QFileInfo( newFilename ).path() ).toString() ).arg( QDir::toNativeSeparators( newFilename ) ),
6845+
tr( "Successfully saved raster layer to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( QFileInfo( newFilename ).path() ).toString(), QDir::toNativeSeparators( newFilename ) ),
68466846
QgsMessageBar::SUCCESS, messageTimeout() );
68476847
} );
68486848

@@ -7045,7 +7045,7 @@ void QgisApp::saveAsVectorFileGeneral( QgsVectorLayer *vlayer, bool symbologyOpt
70457045
}
70467046
this->emit layerSavedAs( vlayer, vectorFilename );
70477047
this->messageBar()->pushMessage( tr( "Saving Done" ),
7048-
tr( "Successfully saved vector layer to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( QFileInfo( newFilename ).path() ).toString() ).arg( QDir::toNativeSeparators( newFilename ) ),
7048+
tr( "Successfully saved vector layer to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( QFileInfo( newFilename ).path() ).toString(), QDir::toNativeSeparators( newFilename ) ),
70497049
QgsMessageBar::SUCCESS, messageTimeout() );
70507050
}
70517051
);
@@ -10081,7 +10081,7 @@ QgsVectorLayer *QgisApp::addVectorLayer( const QString &vectorLayerPath, const Q
1008110081
else
1008210082
{
1008310083
QString message = layer->dataProvider()->error().message( QgsErrorMessage::Text );
10084-
QString msg = tr( "The layer %1 is not a valid layer and can not be added to the map. Reason: %2" ).arg( vectorLayerPath ).arg( message );
10084+
QString msg = tr( "The layer %1 is not a valid layer and can not be added to the map. Reason: %2" ).arg( vectorLayerPath, message );
1008510085
messageBar()->pushMessage( tr( "Layer is not valid" ), msg, QgsMessageBar::CRITICAL, messageTimeout() );
1008610086

1008710087
delete layer;

src/app/qgsversionmigration.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ bool Qgs2To3Migration::requiresMigration()
9595
}
9696
else
9797
{
98-
QString msg = QString( "Can not open %1" ).arg( migrationFile.fileName() );
99-
QgsDebugMsg( msg );
98+
QgsDebugMsg( QString( "Can not open %1" ).arg( migrationFile.fileName() ) );
10099
mMigrationFileVersion = settingsMigrationVersion;
101100
}
102101

src/core/qgsauxiliarystorage.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ QString QgsAuxiliaryLayer::nameFromProperty( const QgsPropertyDefinition &def, b
368368
fieldName = QString( "%1_%2" ).arg( fieldName, def.name().toLower() );
369369

370370
if ( !def.comment().isEmpty() )
371-
fieldName = QString( "%1_%2" ).arg( fieldName ).arg( def.comment() );
371+
fieldName = QString( "%1_%2" ).arg( fieldName, def.comment() );
372372

373373
if ( joined )
374374
fieldName = QString( "%1%2" ).arg( AS_JOINPREFIX, fieldName );
@@ -665,15 +665,20 @@ bool QgsAuxiliaryStorage::exec( const QString &sql, sqlite3 *handler )
665665

666666
void QgsAuxiliaryStorage::debugMsg( const QString &sql, sqlite3 *handler )
667667
{
668+
#ifdef QGISDEBUG
668669
const QString err = QString::fromUtf8( sqlite3_errmsg( handler ) );
669670
const QString msg = QObject::tr( "Unable to execute" );
670-
const QString errMsg = QObject::tr( "%1 '%2': %3" ).arg( msg ).arg( sql ).arg( err );
671+
const QString errMsg = QObject::tr( "%1 '%2': %3" ).arg( msg, sql, err );
671672
QgsDebugMsg( errMsg );
673+
#else
674+
Q_UNUSED( sql );
675+
Q_UNUSED( handler );
676+
#endif
672677
}
673678

674679
bool QgsAuxiliaryStorage::createTable( const QString &type, const QString &table, sqlite3 *handler )
675680
{
676-
const QString sql = QStringLiteral( "CREATE TABLE IF NOT EXISTS '%1' ( '%2' %3 )" ).arg( table ).arg( AS_JOINFIELD ).arg( type );
681+
const QString sql = QStringLiteral( "CREATE TABLE IF NOT EXISTS '%1' ( '%2' %3 )" ).arg( table, AS_JOINFIELD, type );
677682

678683
if ( !exec( sql, handler ) )
679684
return false;

src/gui/qgsattributeform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ void QgsAttributeForm::init()
12611261
}
12621262
else
12631263
{
1264-
w = new QLabel( QStringLiteral( "<p style=\"color: red; font-style: italic;\">%1</p>" ).arg( tr( "Failed to create widget with type '%1'" ) ).arg( widgetSetup.type() ) );
1264+
w = new QLabel( QStringLiteral( "<p style=\"color: red; font-style: italic;\">%1</p>" ).arg( tr( "Failed to create widget with type '%1'" ), widgetSetup.type() ) );
12651265
}
12661266

12671267

0 commit comments

Comments
 (0)