Add missing QStringLiterals

This commit is contained in:
Nyall Dawson 2017-09-25 13:20:30 +10:00
parent 60b8ec5488
commit 31c1ae1c6a
254 changed files with 1431 additions and 1312 deletions

View File

@ -60,4 +60,6 @@ class ANALYSIS_EXPORT QgsGraphBuilder : public QgsGraphBuilderInterface
QgsGraph *mGraph = nullptr;
};
// clazy:excludeall=qstring-allocations
#endif // QGSGRAPHBUILDER_H

View File

@ -134,4 +134,6 @@ class ANALYSIS_EXPORT QgsGraphBuilderInterface
};
// clazy:excludeall=qstring-allocations
#endif // QGSGRAPHBUILDERINTERFACE_H

View File

@ -26,7 +26,7 @@
QString QgsOSMDownload::defaultServiceUrl()
{
QgsSettings settings;
return settings.value( "overpass_url", "http://overpass-api.de/api/interpreter" ).toString();
return settings.value( QStringLiteral( "overpass_url" ), "http://overpass-api.de/api/interpreter" ).toString();
}

View File

@ -64,7 +64,7 @@ class ANALYSIS_EXPORT QgsZonalStatistics
*/
QgsZonalStatistics( QgsVectorLayer *polygonLayer,
QgsRasterLayer *rasterLayer,
const QString &attributePrefix = "",
const QString &attributePrefix = QString(),
int rasterBand = 1,
QgsZonalStatistics::Statistics stats = QgsZonalStatistics::Statistics( QgsZonalStatistics::Count | QgsZonalStatistics::Sum | QgsZonalStatistics::Mean ) );
@ -147,4 +147,6 @@ class ANALYSIS_EXPORT QgsZonalStatistics
Q_DECLARE_OPERATORS_FOR_FLAGS( QgsZonalStatistics::Statistics )
// clazy:excludeall=qstring-allocations
#endif // QGSZONALSTATISTICS_H

View File

@ -2315,7 +2315,7 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )
bool QgsComposer::saveImage( const QImage &img, const QString &imageFilename, const QString &imageFormat )
{
QImageWriter w( imageFilename, imageFormat.toLocal8Bit().constData() );
if ( imageFormat.compare( "tiff", Qt::CaseInsensitive ) == 0 || imageFormat.compare( "tif", Qt::CaseInsensitive ) == 0 )
if ( imageFormat.compare( QLatin1String( "tiff" ), Qt::CaseInsensitive ) == 0 || imageFormat.compare( QLatin1String( "tif" ), Qt::CaseInsensitive ) == 0 )
{
w.setCompression( 1 ); //use LZW compression
}

View File

@ -299,7 +299,7 @@ bool DRW_Entity::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *strB
for ( int i = 0; i < strLength + 1; i++ ) //string length + null terminating char
{
duint8 dxfChar = tmpExtDataBuf.getRawChar8();
l << QString( "0x%1" ).arg( dxfChar, 0, 16 );
l << QStringLiteral( "0x%1" ).arg( dxfChar, 0, 16 );
}
QgsDebugMsg( QString( "strLength:%1; str codepage:%2; %3" ).arg( strLength ).arg( cp ).arg( l.join( " " ) ) );

View File

@ -2708,7 +2708,7 @@ bool DRW_Header::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *hBbu
for ( int i = 0; i < 16; i++ )
{
t = buf->getRawChar8();
l << QString( "0x%1" ).arg( t, 0, 16 );
l << QStringLiteral( "0x%1" ).arg( t, 0, 16 );
}
QgsDebugMsg( QString( "dwg header end sentinel=%1" ).arg( l.join( " " ) ) );
@ -2753,7 +2753,7 @@ bool DRW_Header::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *hBbu
for ( int i = 0; i < 16; i++ )
{
t = buf->getRawChar8();
l << QString( "0x%1" ).arg( t, 0, 16 );
l << QStringLiteral( "0x%1" ).arg( t, 0, 16 );
}
QgsDebugMsg( QString( "dwg header end sentinel=%1" ).arg( l.join( " " ) ) );

View File

@ -571,7 +571,7 @@ bool DRW_LType::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs )
QStringList l;
for ( unsigned i = 0; i < path.size() ; i++ )
{
l << QString( "%1" ).arg( path[i] );
l << QStringLiteral( "%1" ).arg( path[i] );
}
QgsDebugMsg( QString( "path=%1 rem:%2" ).arg( l.join( " " ) ).arg( buf->numRemainingBytes() ) );

View File

@ -178,30 +178,30 @@ void print_debug::printUI( long long unsigned int i )
void print_debug::printD( double d )
{
mTS << QString( "%1 " ).arg( d, 0, 'g' );
mTS << QStringLiteral( "%1 " ).arg( d, 0, 'g' );
flush();
}
void print_debug::printH( long long i )
{
mTS << QString( "0x%1" ).arg( i, 0, 16 );
mTS << QStringLiteral( "0x%1" ).arg( i, 0, 16 );
flush();
}
void print_debug::printB( int i )
{
mTS << QString( "0%1" ).arg( i, 0, 8 );
mTS << QStringLiteral( "0%1" ).arg( i, 0, 8 );
flush();
}
void print_debug::printHL( int c, int s, int h )
{
mTS << QString( "%1.%2 0x%3" ).arg( c ).arg( s ).arg( h, 0, 16 );
mTS << QStringLiteral( "%1.%2 0x%3" ).arg( c ).arg( s ).arg( h, 0, 16 );
flush();
}
void print_debug::printPT( double x, double y, double z )
{
mTS << QString( "x:%1 y:%2 z:%3" ).arg( x, 0, 'g' ).arg( y, 0, 'g' ).arg( z, 0, 'g' );
mTS << QStringLiteral( "x:%1 y:%2 z:%3" ).arg( x, 0, 'g' ).arg( y, 0, 'g' ).arg( z, 0, 'g' );
flush();
}

View File

@ -141,7 +141,7 @@ bool dwgReader::checkSentinel( dwgBuffer *buf, enum secEnum::DWGSection, bool st
for ( int i = 0; i < 16; i++ )
{
int t = buf->getRawChar8();
l << QString( "0x%1" ).arg( t, 0, 16 );
l << QStringLiteral( "0x%1" ).arg( t, 0, 16 );
}
QgsDebugMsg( l.join( " " ) );
return true;

View File

@ -67,16 +67,16 @@ QgsDwgImportDialog::QgsDwgImportDialog( QWidget *parent, Qt::WindowFlags f )
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsDwgImportDialog::showHelp );
QgsSettings s;
leDatabase->setText( s.value( "/DwgImport/lastDatabase", "" ).toString() );
cbExpandInserts->setChecked( s.value( "/DwgImport/lastExpandInserts", true ).toBool() );
cbMergeLayers->setChecked( s.value( "/DwgImport/lastMergeLayers", false ).toBool() );
cbUseCurves->setChecked( s.value( "/DwgImport/lastUseCurves", true ).toBool() );
leDatabase->setText( s.value( QStringLiteral( "/DwgImport/lastDatabase" ), "" ).toString() );
cbExpandInserts->setChecked( s.value( QStringLiteral( "/DwgImport/lastExpandInserts" ), true ).toBool() );
cbMergeLayers->setChecked( s.value( QStringLiteral( "/DwgImport/lastMergeLayers" ), false ).toBool() );
cbUseCurves->setChecked( s.value( QStringLiteral( "/DwgImport/lastUseCurves" ), true ).toBool() );
leDrawing->setReadOnly( true );
pbImportDrawing->setHidden( true );
lblMessage->setHidden( true );
int crsid = s.value( "/DwgImport/lastCrs", QString::number( QgsProject::instance()->crs().srsid() ) ).toInt();
int crsid = s.value( QStringLiteral( "/DwgImport/lastCrs" ), QString::number( QgsProject::instance()->crs().srsid() ) ).toInt();
QgsCoordinateReferenceSystem crs( crsid, QgsCoordinateReferenceSystem::InternalCrsId );
mCrsSelector->setCrs( crs );
@ -87,17 +87,17 @@ QgsDwgImportDialog::QgsDwgImportDialog( QWidget *parent, Qt::WindowFlags f )
on_pbLoadDatabase_clicked();
updateUI();
restoreGeometry( s.value( "/Windows/DwgImport/geometry" ).toByteArray() );
restoreGeometry( s.value( QStringLiteral( "/Windows/DwgImport/geometry" ) ).toByteArray() );
}
QgsDwgImportDialog::~QgsDwgImportDialog()
{
QgsSettings s;
s.setValue( "/DwgImport/lastDatabase", leDatabase->text() );
s.setValue( "/DwgImport/lastExpandInserts", cbExpandInserts->isChecked() );
s.setValue( "/DwgImport/lastMergeLayers", cbMergeLayers->isChecked() );
s.setValue( "/DwgImport/lastUseCurves", cbUseCurves->isChecked() );
s.setValue( "/Windows/DwgImport/geometry", saveGeometry() );
s.setValue( QStringLiteral( "/DwgImport/lastDatabase" ), leDatabase->text() );
s.setValue( QStringLiteral( "/DwgImport/lastExpandInserts" ), cbExpandInserts->isChecked() );
s.setValue( QStringLiteral( "/DwgImport/lastMergeLayers" ), cbMergeLayers->isChecked() );
s.setValue( QStringLiteral( "/DwgImport/lastUseCurves" ), cbUseCurves->isChecked() );
s.setValue( QStringLiteral( "/Windows/DwgImport/geometry" ), saveGeometry() );
}
void QgsDwgImportDialog::updateUI()
@ -158,12 +158,12 @@ void QgsDwgImportDialog::on_pbLoadDatabase_clicked()
bool lblVisible = false;
std::unique_ptr<QgsVectorLayer> d( new QgsVectorLayer( QString( "%1|layername=drawing" ).arg( leDatabase->text() ), "layers", "ogr", false ) );
std::unique_ptr<QgsVectorLayer> d( new QgsVectorLayer( QStringLiteral( "%1|layername=drawing" ).arg( leDatabase->text() ), QStringLiteral( "layers" ), QStringLiteral( "ogr" ), false ) );
if ( d && d->isValid() )
{
int idxPath = d->fields().lookupField( "path" );
int idxLastModified = d->fields().lookupField( "lastmodified" );
int idxCrs = d->fields().lookupField( "crs" );
int idxPath = d->fields().lookupField( QStringLiteral( "path" ) );
int idxLastModified = d->fields().lookupField( QStringLiteral( "lastmodified" ) );
int idxCrs = d->fields().lookupField( QStringLiteral( "crs" ) );
QgsFeature f;
if ( d->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( QgsAttributeList() << idxPath << idxLastModified << idxCrs ) ).nextFeature( f ) )
@ -193,12 +193,12 @@ void QgsDwgImportDialog::on_pbLoadDatabase_clicked()
lblMessage->setVisible( lblVisible );
std::unique_ptr<QgsVectorLayer> l( new QgsVectorLayer( QString( "%1|layername=layers" ).arg( leDatabase->text() ), "layers", "ogr", false ) );
std::unique_ptr<QgsVectorLayer> l( new QgsVectorLayer( QStringLiteral( "%1|layername=layers" ).arg( leDatabase->text() ), QStringLiteral( "layers" ), QStringLiteral( "ogr" ), false ) );
if ( l && l->isValid() )
{
int idxName = l->fields().lookupField( "name" );
int idxColor = l->fields().lookupField( "ocolor" );
int idxFlags = l->fields().lookupField( "flags" );
int idxName = l->fields().lookupField( QStringLiteral( "name" ) );
int idxColor = l->fields().lookupField( QStringLiteral( "ocolor" ) );
int idxFlags = l->fields().lookupField( QStringLiteral( "flags" ) );
QgsDebugMsg( QString( "idxName:%1 idxColor:%2 idxFlags:%3" ).arg( idxName ).arg( idxColor ).arg( idxFlags ) );
@ -269,8 +269,8 @@ void QgsDwgImportDialog::on_pbImportDrawing_clicked()
QgsVectorLayer *QgsDwgImportDialog::layer( QgsLayerTreeGroup *layerGroup, const QString &layerFilter, const QString &table )
{
QgsVectorLayer *l = new QgsVectorLayer( QString( "%1|layername=%2" ).arg( leDatabase->text(), table ), table, "ogr", false );
l->setSubsetString( QString( "%1space=0 AND block=-1" ).arg( layerFilter ) );
QgsVectorLayer *l = new QgsVectorLayer( QStringLiteral( "%1|layername=%2" ).arg( leDatabase->text(), table ), table, QStringLiteral( "ogr" ), false );
l->setSubsetString( QStringLiteral( "%1space=0 AND block=-1" ).arg( layerFilter ) );
if ( l->featureCount() == 0 )
{
@ -295,32 +295,32 @@ void QgsDwgImportDialog::createGroup( QgsLayerTreeGroup *group, const QString &n
QStringList exprlist;
Q_FOREACH ( QString layer, layers )
{
exprlist.append( QString( "'%1'" ).arg( layer.replace( "'", "''" ) ) );
exprlist.append( QStringLiteral( "'%1'" ).arg( layer.replace( QLatin1String( "'" ), QLatin1String( "''" ) ) ) );
}
layerFilter = QString( "layer IN (%1) AND " ).arg( exprlist.join( "," ) );
layerFilter = QStringLiteral( "layer IN (%1) AND " ).arg( exprlist.join( QStringLiteral( "," ) ) );
}
QgsVectorLayer *l = nullptr;
QgsSymbol *sym = nullptr;
l = layer( layerGroup, layerFilter, "hatches" );
l = layer( layerGroup, layerFilter, QStringLiteral( "hatches" ) );
if ( l )
{
QgsSimpleFillSymbolLayer *sfl = new QgsSimpleFillSymbolLayer();
sfl->setDataDefinedProperty( QgsSymbolLayer::PropertyFillColor, QgsProperty::fromField( "color" ) );
sfl->setDataDefinedProperty( QgsSymbolLayer::PropertyFillColor, QgsProperty::fromField( QStringLiteral( "color" ) ) );
sfl->setStrokeStyle( Qt::NoPen );
sym = new QgsFillSymbol();
sym->changeSymbolLayer( 0, sfl );
l->setRenderer( new QgsSingleSymbolRenderer( sym ) );
}
l = layer( layerGroup, layerFilter, "lines" );
l = layer( layerGroup, layerFilter, QStringLiteral( "lines" ) );
if ( l )
{
QgsSimpleLineSymbolLayer *sll = new QgsSimpleLineSymbolLayer();
sll->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeColor, QgsProperty::fromField( "color" ) );
sll->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeColor, QgsProperty::fromField( QStringLiteral( "color" ) ) );
sll->setPenJoinStyle( Qt::MiterJoin );
sll->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeWidth, QgsProperty::fromField( "linewidth" ) );
sll->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeWidth, QgsProperty::fromField( QStringLiteral( "linewidth" ) ) );
// sll->setUseCustomDashPattern( true );
// sll->setCustomDashPatternUnit( QgsSymbolV2::MapUnit );
// sll->setDataDefinedProperty( QgsSymbolLayer::PropertyCustomDash, QgsProperty::fromField( "linetype" ) );
@ -330,13 +330,13 @@ void QgsDwgImportDialog::createGroup( QgsLayerTreeGroup *group, const QString &n
l->setRenderer( new QgsSingleSymbolRenderer( sym ) );
}
l = layer( layerGroup, layerFilter, "polylines" );
l = layer( layerGroup, layerFilter, QStringLiteral( "polylines" ) );
if ( l )
{
QgsSimpleLineSymbolLayer *sll = new QgsSimpleLineSymbolLayer();
sll->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeColor, QgsProperty::fromField( "color" ) );
sll->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeColor, QgsProperty::fromField( QStringLiteral( "color" ) ) );
sll->setPenJoinStyle( Qt::MiterJoin );
sll->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeWidth, QgsProperty::fromField( "width" ) );
sll->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeWidth, QgsProperty::fromField( QStringLiteral( "width" ) ) );
// sll->setUseCustomDashPattern( true );
// sll->setCustomDashPatternUnit( QgsSymbolV2::MapUnit );
// sll->setDataDefinedProperty( QgsSymbolLayer::PropertyCustomDash, QgsProperty::fromField( "linetype" ) );
@ -346,7 +346,7 @@ void QgsDwgImportDialog::createGroup( QgsLayerTreeGroup *group, const QString &n
l->setRenderer( new QgsSingleSymbolRenderer( sym ) );
}
l = layer( layerGroup, layerFilter, "texts" );
l = layer( layerGroup, layerFilter, QStringLiteral( "texts" ) );
if ( l )
{
l->setRenderer( new QgsNullSymbolRenderer() );
@ -358,8 +358,8 @@ void QgsDwgImportDialog::createGroup( QgsLayerTreeGroup *group, const QString &n
pls.setFormat( tf );
pls.drawLabels = true;
pls.fieldName = "text";
pls.wrapChar = "\\P";
pls.fieldName = QStringLiteral( "text" );
pls.wrapChar = QStringLiteral( "\\P" );
pls.dataDefinedProperties().setProperty( QgsPalLayerSettings::Size, QgsProperty::fromField( QStringLiteral( "height" ) ) );
pls.dataDefinedProperties().setProperty( QgsPalLayerSettings::Color, QgsProperty::fromField( QStringLiteral( "color" ) ) );
@ -403,7 +403,7 @@ void QgsDwgImportDialog::createGroup( QgsLayerTreeGroup *group, const QString &n
l->setLabeling( new QgsVectorLayerSimpleLabeling( pls ) );
}
l = layer( layerGroup, layerFilter, "points" );
l = layer( layerGroup, layerFilter, QStringLiteral( "points" ) );
if ( l )
{
// FIXME: use PDMODE?
@ -411,7 +411,7 @@ void QgsDwgImportDialog::createGroup( QgsLayerTreeGroup *group, const QString &n
}
if ( !cbExpandInserts->isChecked() )
layer( layerGroup, layerFilter, "inserts" );
layer( layerGroup, layerFilter, QStringLiteral( "inserts" ) );
if ( !layerGroup->children().isEmpty() )
{

View File

@ -300,186 +300,186 @@ bool QgsDwgImporter::import( const QString &drawing, QString &error, bool doExpa
QList<table> tables = QList<table>()
<< table( "drawing", QObject::tr( "Imported drawings" ), wkbNone, QList<field>()
<< field( "path", OFTString )
<< field( "comments", OFTString )
<< field( "importdat", OFTDateTime )
<< field( "lastmodified", OFTDateTime )
<< field( "crs", OFTInteger )
<< table( QStringLiteral( "drawing" ), QObject::tr( "Imported drawings" ), wkbNone, QList<field>()
<< field( QStringLiteral( "path" ), OFTString )
<< field( QStringLiteral( "comments" ), OFTString )
<< field( QStringLiteral( "importdat" ), OFTDateTime )
<< field( QStringLiteral( "lastmodified" ), OFTDateTime )
<< field( QStringLiteral( "crs" ), OFTInteger )
)
<< table( "headers", QObject::tr( "Headers" ), wkbNone, QList<field>()
<< field( "k", OFTString )
<< field( "v", OFTString )
<< table( QStringLiteral( "headers" ), QObject::tr( "Headers" ), wkbNone, QList<field>()
<< field( QStringLiteral( "k" ), OFTString )
<< field( QStringLiteral( "v" ), OFTString )
)
<< table( "linetypes", QObject::tr( "Line types" ), wkbNone, QList<field>()
<< field( "name", OFTString )
<< field( "desc", OFTString )
<< field( "path", OFTRealList )
<< table( QStringLiteral( "linetypes" ), QObject::tr( "Line types" ), wkbNone, QList<field>()
<< field( QStringLiteral( "name" ), OFTString )
<< field( QStringLiteral( "desc" ), OFTString )
<< field( QStringLiteral( "path" ), OFTRealList )
)
<< table( "layers", QObject::tr( "Layer list" ), wkbNone, QList<field>()
<< field( "name", OFTString )
<< field( "linetype", OFTString )
<< field( "color", OFTString )
<< field( "ocolor", OFTInteger )
<< field( "color24", OFTInteger )
<< field( "transparency", OFTInteger )
<< field( "lweight", OFTInteger )
<< field( "linewidth", OFTReal )
<< field( "flags", OFTInteger )
<< table( QStringLiteral( "layers" ), QObject::tr( "Layer list" ), wkbNone, QList<field>()
<< field( QStringLiteral( "name" ), OFTString )
<< field( QStringLiteral( "linetype" ), OFTString )
<< field( QStringLiteral( "color" ), OFTString )
<< field( QStringLiteral( "ocolor" ), OFTInteger )
<< field( QStringLiteral( "color24" ), OFTInteger )
<< field( QStringLiteral( "transparency" ), OFTInteger )
<< field( QStringLiteral( "lweight" ), OFTInteger )
<< field( QStringLiteral( "linewidth" ), OFTReal )
<< field( QStringLiteral( "flags" ), OFTInteger )
)
<< table( "dimstyles", QObject::tr( "Dimension styles" ), wkbNone, QList<field>()
<< field( "name", OFTString )
<< field( "dimpost", OFTString )
<< field( "dimapost", OFTString )
<< field( "dimblk", OFTString )
<< field( "dimblk1", OFTString )
<< field( "dimblk2", OFTString )
<< field( "dimscale", OFTReal )
<< field( "dimasz", OFTReal )
<< field( "dimexo", OFTReal )
<< field( "dimdli", OFTReal )
<< field( "dimexe", OFTReal )
<< field( "dimrnd", OFTReal )
<< field( "dimdle", OFTReal )
<< field( "dimtp", OFTReal )
<< field( "dimtm", OFTReal )
<< field( "dimfxl", OFTReal )
<< field( "dimtxt", OFTReal )
<< field( "dimcen", OFTReal )
<< field( "dimtsz", OFTReal )
<< field( "dimaltf", OFTReal )
<< field( "dimlfac", OFTReal )
<< field( "dimtvp", OFTReal )
<< field( "dimtfac", OFTReal )
<< field( "dimgap", OFTReal )
<< field( "dimaltrnd", OFTReal )
<< field( "dimtol", OFTInteger )
<< field( "dimlim", OFTInteger )
<< field( "dimtih", OFTInteger )
<< field( "dimtoh", OFTInteger )
<< field( "dimse1", OFTInteger )
<< field( "dimse2", OFTInteger )
<< field( "dimtad", OFTInteger )
<< field( "dimzin", OFTInteger )
<< field( "dimazin", OFTInteger )
<< field( "dimalt", OFTInteger )
<< field( "dimaltd", OFTInteger )
<< field( "dimtofl", OFTInteger )
<< field( "dimsah", OFTInteger )
<< field( "dimtix", OFTInteger )
<< field( "dimsoxd", OFTInteger )
<< field( "dimclrd", OFTInteger )
<< field( "dimclre", OFTInteger )
<< field( "dimclrt", OFTInteger )
<< field( "dimadec", OFTInteger )
<< field( "dimunit", OFTInteger )
<< field( "dimdec", OFTInteger )
<< field( "dimtdec", OFTInteger )
<< field( "dimaltu", OFTInteger )
<< field( "dimalttd", OFTInteger )
<< field( "dimaunit", OFTInteger )
<< field( "dimfrac", OFTInteger )
<< field( "dimlunit", OFTInteger )
<< field( "dimdsep", OFTInteger )
<< field( "dimtmove", OFTInteger )
<< field( "dimjust", OFTInteger )
<< field( "dimsd1", OFTInteger )
<< field( "dimsd2", OFTInteger )
<< field( "dimtolj", OFTInteger )
<< field( "dimtzin", OFTInteger )
<< field( "dimaltz", OFTInteger )
<< field( "dimaltttz", OFTInteger )
<< field( "dimfit", OFTInteger )
<< field( "dimupt", OFTInteger )
<< field( "dimatfit", OFTInteger )
<< field( "dimfxlon", OFTInteger )
<< field( "dimtxsty", OFTString )
<< field( "dimldrblk", OFTString )
<< field( "dimlwd", OFTInteger )
<< field( "dimlwe", OFTInteger )
<< table( QStringLiteral( "dimstyles" ), QObject::tr( "Dimension styles" ), wkbNone, QList<field>()
<< field( QStringLiteral( "name" ), OFTString )
<< field( QStringLiteral( "dimpost" ), OFTString )
<< field( QStringLiteral( "dimapost" ), OFTString )
<< field( QStringLiteral( "dimblk" ), OFTString )
<< field( QStringLiteral( "dimblk1" ), OFTString )
<< field( QStringLiteral( "dimblk2" ), OFTString )
<< field( QStringLiteral( "dimscale" ), OFTReal )
<< field( QStringLiteral( "dimasz" ), OFTReal )
<< field( QStringLiteral( "dimexo" ), OFTReal )
<< field( QStringLiteral( "dimdli" ), OFTReal )
<< field( QStringLiteral( "dimexe" ), OFTReal )
<< field( QStringLiteral( "dimrnd" ), OFTReal )
<< field( QStringLiteral( "dimdle" ), OFTReal )
<< field( QStringLiteral( "dimtp" ), OFTReal )
<< field( QStringLiteral( "dimtm" ), OFTReal )
<< field( QStringLiteral( "dimfxl" ), OFTReal )
<< field( QStringLiteral( "dimtxt" ), OFTReal )
<< field( QStringLiteral( "dimcen" ), OFTReal )
<< field( QStringLiteral( "dimtsz" ), OFTReal )
<< field( QStringLiteral( "dimaltf" ), OFTReal )
<< field( QStringLiteral( "dimlfac" ), OFTReal )
<< field( QStringLiteral( "dimtvp" ), OFTReal )
<< field( QStringLiteral( "dimtfac" ), OFTReal )
<< field( QStringLiteral( "dimgap" ), OFTReal )
<< field( QStringLiteral( "dimaltrnd" ), OFTReal )
<< field( QStringLiteral( "dimtol" ), OFTInteger )
<< field( QStringLiteral( "dimlim" ), OFTInteger )
<< field( QStringLiteral( "dimtih" ), OFTInteger )
<< field( QStringLiteral( "dimtoh" ), OFTInteger )
<< field( QStringLiteral( "dimse1" ), OFTInteger )
<< field( QStringLiteral( "dimse2" ), OFTInteger )
<< field( QStringLiteral( "dimtad" ), OFTInteger )
<< field( QStringLiteral( "dimzin" ), OFTInteger )
<< field( QStringLiteral( "dimazin" ), OFTInteger )
<< field( QStringLiteral( "dimalt" ), OFTInteger )
<< field( QStringLiteral( "dimaltd" ), OFTInteger )
<< field( QStringLiteral( "dimtofl" ), OFTInteger )
<< field( QStringLiteral( "dimsah" ), OFTInteger )
<< field( QStringLiteral( "dimtix" ), OFTInteger )
<< field( QStringLiteral( "dimsoxd" ), OFTInteger )
<< field( QStringLiteral( "dimclrd" ), OFTInteger )
<< field( QStringLiteral( "dimclre" ), OFTInteger )
<< field( QStringLiteral( "dimclrt" ), OFTInteger )
<< field( QStringLiteral( "dimadec" ), OFTInteger )
<< field( QStringLiteral( "dimunit" ), OFTInteger )
<< field( QStringLiteral( "dimdec" ), OFTInteger )
<< field( QStringLiteral( "dimtdec" ), OFTInteger )
<< field( QStringLiteral( "dimaltu" ), OFTInteger )
<< field( QStringLiteral( "dimalttd" ), OFTInteger )
<< field( QStringLiteral( "dimaunit" ), OFTInteger )
<< field( QStringLiteral( "dimfrac" ), OFTInteger )
<< field( QStringLiteral( "dimlunit" ), OFTInteger )
<< field( QStringLiteral( "dimdsep" ), OFTInteger )
<< field( QStringLiteral( "dimtmove" ), OFTInteger )
<< field( QStringLiteral( "dimjust" ), OFTInteger )
<< field( QStringLiteral( "dimsd1" ), OFTInteger )
<< field( QStringLiteral( "dimsd2" ), OFTInteger )
<< field( QStringLiteral( "dimtolj" ), OFTInteger )
<< field( QStringLiteral( "dimtzin" ), OFTInteger )
<< field( QStringLiteral( "dimaltz" ), OFTInteger )
<< field( QStringLiteral( "dimaltttz" ), OFTInteger )
<< field( QStringLiteral( "dimfit" ), OFTInteger )
<< field( QStringLiteral( "dimupt" ), OFTInteger )
<< field( QStringLiteral( "dimatfit" ), OFTInteger )
<< field( QStringLiteral( "dimfxlon" ), OFTInteger )
<< field( QStringLiteral( "dimtxsty" ), OFTString )
<< field( QStringLiteral( "dimldrblk" ), OFTString )
<< field( QStringLiteral( "dimlwd" ), OFTInteger )
<< field( QStringLiteral( "dimlwe" ), OFTInteger )
)
<< table( "textstyles", QObject::tr( "Text styles" ), wkbNone, QList<field>()
<< field( "name", OFTString )
<< field( "height", OFTReal )
<< field( "width", OFTReal )
<< field( "oblique", OFTReal )
<< field( "genFlag", OFTInteger )
<< field( "lastHeight", OFTReal )
<< field( "font", OFTString )
<< field( "bigFont", OFTString )
<< field( "fontFamily", OFTInteger )
<< table( QStringLiteral( "textstyles" ), QObject::tr( "Text styles" ), wkbNone, QList<field>()
<< field( QStringLiteral( "name" ), OFTString )
<< field( QStringLiteral( "height" ), OFTReal )
<< field( QStringLiteral( "width" ), OFTReal )
<< field( QStringLiteral( "oblique" ), OFTReal )
<< field( QStringLiteral( "genFlag" ), OFTInteger )
<< field( QStringLiteral( "lastHeight" ), OFTReal )
<< field( QStringLiteral( "font" ), OFTString )
<< field( QStringLiteral( "bigFont" ), OFTString )
<< field( QStringLiteral( "fontFamily" ), OFTInteger )
)
<< table( "appdata", QObject::tr( "Application data" ), wkbNone, QList<field>()
<< field( "handle", OFTInteger )
<< field( "i", OFTInteger )
<< field( "value", OFTString )
<< table( QStringLiteral( "appdata" ), QObject::tr( "Application data" ), wkbNone, QList<field>()
<< field( QStringLiteral( "handle" ), OFTInteger )
<< field( QStringLiteral( "i" ), OFTInteger )
<< field( QStringLiteral( "value" ), OFTString )
)
<< table( "blocks", QObject::tr( "BLOCK entities" ), wkbPoint25D, QList<field>()
<< table( QStringLiteral( "blocks" ), QObject::tr( "BLOCK entities" ), wkbPoint25D, QList<field>()
ENTITY_ATTRIBUTES
<< field( "thickness", OFTReal )
<< field( "ext", OFTRealList )
<< field( "name", OFTString )
<< field( "flags", OFTInteger )
<< field( QStringLiteral( "thickness" ), OFTReal )
<< field( QStringLiteral( "ext" ), OFTRealList )
<< field( QStringLiteral( "name" ), OFTString )
<< field( QStringLiteral( "flags" ), OFTInteger )
)
<< table( "points", QObject::tr( "POINT entities" ), wkbPoint25D, QList<field>()
<< table( QStringLiteral( "points" ), QObject::tr( "POINT entities" ), wkbPoint25D, QList<field>()
ENTITY_ATTRIBUTES
<< field( "thickness", OFTReal )
<< field( "ext", OFTRealList )
<< field( QStringLiteral( "thickness" ), OFTReal )
<< field( QStringLiteral( "ext" ), OFTRealList )
)
<< table( "lines", QObject::tr( "LINE entities" ), lineGeomType, QList<field>()
<< table( QStringLiteral( "lines" ), QObject::tr( "LINE entities" ), lineGeomType, QList<field>()
ENTITY_ATTRIBUTES
<< field( "thickness", OFTReal )
<< field( "ext", OFTRealList )
<< field( "width", OFTReal )
<< field( QStringLiteral( "thickness" ), OFTReal )
<< field( QStringLiteral( "ext" ), OFTRealList )
<< field( QStringLiteral( "width" ), OFTReal )
)
<< table( "polylines", QObject::tr( "POLYLINE entities" ), lineGeomType, QList<field>()
<< table( QStringLiteral( "polylines" ), QObject::tr( "POLYLINE entities" ), lineGeomType, QList<field>()
ENTITY_ATTRIBUTES
<< field( "width", OFTReal )
<< field( "thickness", OFTReal )
<< field( "ext", OFTRealList )
<< field( QStringLiteral( "width" ), OFTReal )
<< field( QStringLiteral( "thickness" ), OFTReal )
<< field( QStringLiteral( "ext" ), OFTRealList )
)
<< table( "texts", QObject::tr( "TEXT entities" ), wkbPoint25D, QList<field>()
<< table( QStringLiteral( "texts" ), QObject::tr( "TEXT entities" ), wkbPoint25D, QList<field>()
ENTITY_ATTRIBUTES
<< field( "thickness", OFTReal )
<< field( "ext", OFTRealList )
<< field( "height", OFTReal )
<< field( "text", OFTString )
<< field( "angle", OFTReal )
<< field( "widthscale", OFTReal )
<< field( "oblique", OFTReal )
<< field( "style", OFTString )
<< field( "textgen", OFTInteger )
<< field( "alignh", OFTInteger )
<< field( "alignv", OFTInteger )
<< field( "interlin", OFTReal )
<< field( QStringLiteral( "thickness" ), OFTReal )
<< field( QStringLiteral( "ext" ), OFTRealList )
<< field( QStringLiteral( "height" ), OFTReal )
<< field( QStringLiteral( "text" ), OFTString )
<< field( QStringLiteral( "angle" ), OFTReal )
<< field( QStringLiteral( "widthscale" ), OFTReal )
<< field( QStringLiteral( "oblique" ), OFTReal )
<< field( QStringLiteral( "style" ), OFTString )
<< field( QStringLiteral( "textgen" ), OFTInteger )
<< field( QStringLiteral( "alignh" ), OFTInteger )
<< field( QStringLiteral( "alignv" ), OFTInteger )
<< field( QStringLiteral( "interlin" ), OFTReal )
)
<< table( "hatches", QObject::tr( "HATCH entities" ), hatchGeomType, QList<field>()
<< table( QStringLiteral( "hatches" ), QObject::tr( "HATCH entities" ), hatchGeomType, QList<field>()
ENTITY_ATTRIBUTES
<< field( "thickness", OFTReal )
<< field( "ext", OFTRealList )
<< field( "name", OFTString )
<< field( "solid", OFTInteger )
<< field( "associative", OFTInteger )
<< field( "hstyle", OFTInteger )
<< field( "hpattern", OFTInteger )
<< field( "doubleflag", OFTInteger )
<< field( "angle", OFTReal )
<< field( "scale", OFTReal )
<< field( "deflines", OFTInteger )
<< field( QStringLiteral( "thickness" ), OFTReal )
<< field( QStringLiteral( "ext" ), OFTRealList )
<< field( QStringLiteral( "name" ), OFTString )
<< field( QStringLiteral( "solid" ), OFTInteger )
<< field( QStringLiteral( "associative" ), OFTInteger )
<< field( QStringLiteral( "hstyle" ), OFTInteger )
<< field( QStringLiteral( "hpattern" ), OFTInteger )
<< field( QStringLiteral( "doubleflag" ), OFTInteger )
<< field( QStringLiteral( "angle" ), OFTReal )
<< field( QStringLiteral( "scale" ), OFTReal )
<< field( QStringLiteral( "deflines" ), OFTInteger )
)
<< table( "inserts", QObject::tr( "INSERT entities" ), wkbPoint25D, QList<field>()
<< table( QStringLiteral( "inserts" ), QObject::tr( "INSERT entities" ), wkbPoint25D, QList<field>()
ENTITY_ATTRIBUTES
<< field( "thickness", OFTReal )
<< field( "ext", OFTRealList )
<< field( "name", OFTString )
<< field( "xscale", OFTReal )
<< field( "yscale", OFTReal )
<< field( "zscale", OFTReal )
<< field( "angle", OFTReal )
<< field( "colcount", OFTReal )
<< field( "rowcount", OFTReal )
<< field( "colspace", OFTReal )
<< field( "rowspace", OFTReal )
<< field( QStringLiteral( "thickness" ), OFTReal )
<< field( QStringLiteral( "ext" ), OFTRealList )
<< field( QStringLiteral( "name" ), OFTString )
<< field( QStringLiteral( "xscale" ), OFTReal )
<< field( QStringLiteral( "yscale" ), OFTReal )
<< field( QStringLiteral( "zscale" ), OFTReal )
<< field( QStringLiteral( "angle" ), OFTReal )
<< field( QStringLiteral( "colcount" ), OFTReal )
<< field( QStringLiteral( "rowcount" ), OFTReal )
<< field( QStringLiteral( "colspace" ), OFTReal )
<< field( QStringLiteral( "rowspace" ), OFTReal )
)
;
@ -605,7 +605,7 @@ bool QgsDwgImporter::import( const QString &drawing, QString &error, bool doExpa
DRW::error result( DRW::BAD_NONE );
if ( fi.suffix().toLower() == "dxf" )
if ( fi.suffix().toLower() == QLatin1String( "dxf" ) )
{
//loads dxf
std::unique_ptr<dxfRW> dxf( new dxfRW( drawing.toUtf8() ) );
@ -614,7 +614,7 @@ bool QgsDwgImporter::import( const QString &drawing, QString &error, bool doExpa
result = DRW::BAD_UNKNOWN;
}
}
else if ( fi.suffix().toLower() == "dwg" )
else if ( fi.suffix().toLower() == QLatin1String( "dwg" ) )
{
//loads dwg
std::unique_ptr<dwgR> dwg( new dwgR( drawing.toUtf8() ) );
@ -734,7 +734,7 @@ void QgsDwgImporter::addHeader( const DRW_Header *data )
case DRW_Variant::INTEGER:
v = QString::number( it->second->content.i );
if ( k == "SPLINESEGS" )
if ( k == QLatin1String( "SPLINESEGS" ) )
mSplineSegs = it->second->content.i;
break;
@ -744,7 +744,7 @@ void QgsDwgImporter::addHeader( const DRW_Header *data )
break;
case DRW_Variant::COORD:
v = QString( "%1,%2,%3" )
v = QStringLiteral( "%1,%2,%3" )
.arg( qgsDoubleToString( it->second->content.v->x ),
qgsDoubleToString( it->second->content.v->y ),
qgsDoubleToString( it->second->content.v->z ) );
@ -810,12 +810,12 @@ void QgsDwgImporter::addLType( const DRW_LType &data )
}
}
QString typeName( data.name.c_str() ), dash( "" );
QString typeName( data.name.c_str() ), dash( QLatin1String( "" ) );
if ( !upath.empty() )
{
QStringList l;
if ( upath[0] < 0 )
l << "0";
l << QStringLiteral( "0" );
Q_FOREACH ( double p, upath )
{
@ -823,9 +823,9 @@ void QgsDwgImporter::addLType( const DRW_LType &data )
}
if ( upath.size() % 2 == 1 )
l << "0";
l << QStringLiteral( "0" );
dash = l.join( ";" ).toUtf8().constData();
dash = l.join( QStringLiteral( ";" ) ).toUtf8().constData();
}
mLinetype.insert( typeName.toLower(), dash );
@ -852,18 +852,18 @@ QString QgsDwgImporter::colorString( int color, int color24, int transparency, c
{
if ( color == 0 )
{
return "byblock";
return QStringLiteral( "byblock" );
}
else if ( color == 256 )
{
return mLayerColor.value( layer.c_str(), "0,0,0,255" );
return mLayerColor.value( layer.c_str(), QStringLiteral( "0,0,0,255" ) );
}
else
{
if ( color < 0 )
color = -color;
return QString( "%1,%2,%3,%4" )
return QStringLiteral( "%1,%2,%3,%4" )
.arg( DRW::dxfColors[ color ][0] )
.arg( DRW::dxfColors[ color ][1] )
.arg( DRW::dxfColors[ color ][2] )
@ -872,7 +872,7 @@ QString QgsDwgImporter::colorString( int color, int color24, int transparency, c
}
else
{
return QString( "%1,%2,%3,%4" )
return QStringLiteral( "%1,%2,%3,%4" )
.arg( ( color24 & 0xff0000 ) >> 16 )
.arg( ( color24 & 0x00ff00 ) >> 8 )
.arg( ( color24 & 0x0000ff ) )
@ -884,10 +884,10 @@ QString QgsDwgImporter::linetypeString( const std::string &olinetype, const std:
{
QString linetype( olinetype.c_str() );
if ( linetype == "bylayer" )
return mLayerLinetype.value( layer.c_str(), "" );
if ( linetype == QLatin1String( "bylayer" ) )
return mLayerLinetype.value( layer.c_str(), QLatin1String( "" ) );
else
return mLinetype.value( linetype, "" );
return mLinetype.value( linetype, QLatin1String( "" ) );
}
void QgsDwgImporter::addLayer( const DRW_Layer &data )
@ -912,12 +912,12 @@ void QgsDwgImporter::addLayer( const DRW_Layer &data )
mLayerLinewidth.insert( data.name.c_str(), linewidth );
mLayerLinetype.insert( data.name.c_str(), linetypeString( data.lineType, "" ) );
setInteger( dfn, f, "ocolor", data.color );
setInteger( dfn, f, QStringLiteral( "ocolor" ), data.color );
SETINTEGER( color24 );
SETINTEGER( transparency );
setString( dfn, f, "color", color.toUtf8().constData() );
setInteger( dfn, f, "lweight", DRW_LW_Conv::lineWidth2dxfInt( data.lWeight ) );
setInteger( dfn, f, "linewidth", linewidth );
setString( dfn, f, QStringLiteral( "color" ), color.toUtf8().constData() );
setInteger( dfn, f, QStringLiteral( "lweight" ), DRW_LW_Conv::lineWidth2dxfInt( data.lWeight ) );
setInteger( dfn, f, QStringLiteral( "linewidth" ), linewidth );
if ( OGR_L_CreateFeature( layer, f ) != OGRERR_NONE )
{
@ -1248,24 +1248,24 @@ void QgsDwgImporter::addEntity( OGRFeatureDefnH dfn, OGRFeatureH f, const DRW_En
{
QgsDebugMsgLevel( QString( "handle:0x%1 block:0x%2" ).arg( data.handle, 0, 16 ).arg( mBlockHandle, 0, 16 ), 5 );
SETINTEGER( handle );
setInteger( dfn, f, "block", mBlockHandle );
setInteger( dfn, f, QStringLiteral( "block" ), mBlockHandle );
SETINTEGER( eType );
SETINTEGER( space );
SETSTRING( layer );
setString( dfn, f, "olinetype", data.lineType );
setString( dfn, f, QStringLiteral( "olinetype" ), data.lineType );
QString linetype = linetypeString( data.lineType, data.layer );
if ( linetype == "1" )
if ( linetype == QLatin1String( "1" ) )
{
QgsDebugMsg( "Linetype == 1" );
}
setString( dfn, f, "linetype", linetype.toUtf8().constData() );
setInteger( dfn, f, "ocolor", data.color );
setString( dfn, f, QStringLiteral( "linetype" ), linetype.toUtf8().constData() );
setInteger( dfn, f, QStringLiteral( "ocolor" ), data.color );
SETINTEGER( color24 );
SETINTEGER( transparency );
setString( dfn, f, "color", colorString( data.color, data.color24, data.transparency, data.layer ).toUtf8().constData() );
setInteger( dfn, f, "lweight", DRW_LW_Conv::lineWidth2dxfInt( data.lWeight ) );
setDouble( dfn, f, "linewidth", lineWidth( data.lWeight, data.layer ) );
setInteger( dfn, f, "ltscale", data.ltypeScale );
setString( dfn, f, QStringLiteral( "color" ), colorString( data.color, data.color24, data.transparency, data.layer ).toUtf8().constData() );
setInteger( dfn, f, QStringLiteral( "lweight" ), DRW_LW_Conv::lineWidth2dxfInt( data.lWeight ) );
setDouble( dfn, f, QStringLiteral( "linewidth" ), lineWidth( data.lWeight, data.layer ) );
setInteger( dfn, f, QStringLiteral( "ltscale" ), data.ltypeScale );
SETINTEGER( visible );
}
@ -1282,7 +1282,7 @@ void QgsDwgImporter::addPoint( const DRW_Point &data )
SETDOUBLE( thickness );
setPoint( dfn, f, "ext", data.extPoint );
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
QgsPoint p( QgsWkbTypes::PointZ, data.basePoint.x, data.basePoint.y, data.basePoint.z );
if ( !createFeature( layer, f, p ) )
@ -1319,7 +1319,7 @@ void QgsDwgImporter::addArc( const DRW_Arc &data )
SETDOUBLE( thickness );
setPoint( dfn, f, "ext", data.extPoint );
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
double half = ( data.staangle + data.endangle ) / 2.0;
if ( data.staangle > data.endangle )
@ -1361,7 +1361,7 @@ void QgsDwgImporter::addCircle( const DRW_Circle &data )
SETDOUBLE( thickness );
setPoint( dfn, f, "ext", data.extPoint );
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
QgsCircularString c;
c.setPoints( QgsPointSequence()
@ -1520,7 +1520,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
SETDOUBLE( thickness );
SETDOUBLE( width );
setPoint( dfn, f, "ext", data.extPoint );
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
if ( !createFeature( layer, f, cc ) )
{
@ -1573,7 +1573,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
SETDOUBLE( thickness );
setPoint( dfn, f, "ext", data.extPoint );
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
QgsPointXY ps( p0.x(), p0.y() );
QgsPointXY pe( p1.x(), p1.y() );
@ -1637,7 +1637,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
SETDOUBLE( thickness );
SETDOUBLE( width );
setPoint( dfn, f, "ext", data.extPoint );
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
// QgsDebugMsg( QString( "write curve:%1" ).arg( cc.asWkt() ) );
@ -1717,9 +1717,9 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
addEntity( dfn, f, data );
SETDOUBLE( thickness );
setDouble( dfn, f, "width", width );
setDouble( dfn, f, QStringLiteral( "width" ), width );
setPoint( dfn, f, "ext", data.extPoint );
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
// QgsDebugMsg( QString( "write curve:%1" ).arg( cc.asWkt() ) );
@ -1775,7 +1775,7 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
SETDOUBLE( thickness );
setPoint( dfn, f, "ext", data.extPoint );
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
QgsPointXY ps( p0.x(), p0.y() );
QgsPointXY pe( p1.x(), p1.y() );
@ -1841,9 +1841,9 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
addEntity( dfn, f, data );
SETDOUBLE( thickness );
setDouble( dfn, f, "width", width );
setDouble( dfn, f, QStringLiteral( "width" ), width );
setPoint( dfn, f, "ext", data.extPoint );
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
// QgsDebugMsg( QString( "write curve:%1" ).arg( cc.asWkt() ) );
@ -2117,7 +2117,7 @@ void QgsDwgImporter::addInsert( const DRW_Insert &data )
SETDOUBLE( thickness );
setPoint( dfn, f, "ext", data.extPoint );
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
SETSTRING( name );
SETDOUBLE( xscale );
@ -2165,8 +2165,8 @@ void QgsDwgImporter::addSolid( const DRW_Solid &data )
SETDOUBLE( thickness );
setPoint( dfn, f, "ext", data.extPoint );
setString( dfn, f, "hpattern", "SOLID" );
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
setString( dfn, f, QStringLiteral( "hpattern" ), "SOLID" );
QgsPolygonV2 poly;
@ -2215,7 +2215,7 @@ void QgsDwgImporter::addMText( const DRW_MText &data )
SETDOUBLE( thickness );
SETDOUBLE( interlin );
setPoint( dfn, f, "ext", data.extPoint );
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
QgsPoint p( QgsWkbTypes::PointZ, data.basePoint.x, data.basePoint.y, data.basePoint.z );
@ -2249,9 +2249,9 @@ void QgsDwgImporter::addText( const DRW_Text &data )
SETINTEGER( alignH );
SETINTEGER( alignV );
SETDOUBLE( thickness );
setDouble( dfn, f, "interlin", -1.0 );
setDouble( dfn, f, QStringLiteral( "interlin" ), -1.0 );
setPoint( dfn, f, "ext", data.extPoint );
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
QgsPoint p( QgsWkbTypes::PointZ,
( data.alignH > 0 || data.alignV > 0 ) ? data.secPoint.x : data.basePoint.x,
@ -2331,7 +2331,7 @@ void QgsDwgImporter::addHatch( const DRW_Hatch *pdata )
SETDOUBLE( thickness );
setPoint( dfn, f, "ext", data.extPoint );
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
SETSTRING( name );
SETINTEGER( solid );
@ -2413,7 +2413,7 @@ void QgsDwgImporter::addLine( const DRW_Line &data )
SETDOUBLE( thickness );
setPoint( dfn, f, "ext", data.extPoint );
setPoint( dfn, f, QStringLiteral( "ext" ), data.extPoint );
QgsLineString l;
@ -2584,7 +2584,7 @@ bool QgsDwgImporter::expandInserts( QString &error )
QString blockLayer = QString::fromUtf8( OGR_F_GetFieldAsString( insert, layerIdx ) );
QString blockColor = QString::fromUtf8( OGR_F_GetFieldAsString( insert, colorIdx ) );
QString blockLinetype = QString::fromUtf8( OGR_F_GetFieldAsString( insert, linetypeIdx ) );
if ( blockLinetype == "1" )
if ( blockLinetype == QLatin1String( "1" ) )
{
QgsDebugMsg( "blockLinetype == 1" );
}
@ -2607,7 +2607,7 @@ bool QgsDwgImporter::expandInserts( QString &error )
Q_FOREACH ( const QString &name, QStringList() << "hatches" << "lines" << "polylines" << "texts" << "points" )
{
OGRLayerH src = OGR_DS_ExecuteSQL( mDs, QString( "SELECT * FROM %1 WHERE block=%2" ).arg( name ).arg( handle ).toUtf8().constData(), nullptr, nullptr );
OGRLayerH src = OGR_DS_ExecuteSQL( mDs, QStringLiteral( "SELECT * FROM %1 WHERE block=%2" ).arg( name ).arg( handle ).toUtf8().constData(), nullptr, nullptr );
if ( !src )
{
QgsDebugMsg( QString( "%1: could not execute query for block %2" ).arg( name ).arg( handle ) );

View File

@ -208,7 +208,7 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla
mStatusZoomCombo->setCompleter( nullptr );
mStatusZoomCombo->setMinimumWidth( 100 );
//zoom combo box accepts decimals in the range 1-9999, with an optional decimal point and "%" sign
QRegularExpression zoomRx( "\\s*\\d{1,4}(\\.\\d?)?\\s*%?" );
QRegularExpression zoomRx( QStringLiteral( "\\s*\\d{1,4}(\\.\\d?)?\\s*%?" ) );
QValidator *zoomValidator = new QRegularExpressionValidator( zoomRx, mStatusZoomCombo );
mStatusZoomCombo->lineEdit()->setValidator( zoomValidator );

View File

@ -492,8 +492,8 @@ int main( int argc, char *argv[] )
// This behavior is used to load the app, snapshot the map,
// save the image to disk and then exit
QString mySnapshotFileName = "";
QString configLocalStorageLocation = "";
QString mySnapshotFileName = QLatin1String( "" );
QString configLocalStorageLocation = QLatin1String( "" );
QString profileName;
int mySnapshotWidth = 800;
int mySnapshotHeight = 600;
@ -792,9 +792,9 @@ int main( int argc, char *argv[] )
{
configLocalStorageLocation = getenv( "QGIS_CUSTOM_CONFIG_PATH" );
}
else if ( settings.contains( "profilesPath", QgsSettings::Core ) )
else if ( settings.contains( QStringLiteral( "profilesPath" ), QgsSettings::Core ) )
{
configLocalStorageLocation = settings.value( "profilesPath", "", QgsSettings::Core ).toString();
configLocalStorageLocation = settings.value( QStringLiteral( "profilesPath" ), "", QgsSettings::Core ).toString();
QgsDebugMsg( QString( "Loading profiles path from global config at %1" ).arg( configLocalStorageLocation ) );
}
@ -839,11 +839,11 @@ int main( int argc, char *argv[] )
{
if ( ! QgsSettings::setGlobalSettingsPath( globalsettingsfile ) )
{
QgsMessageLog::logMessage( QString( "Invalid globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" ) );
QgsMessageLog::logMessage( QStringLiteral( "Invalid globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" ) );
}
else
{
QgsMessageLog::logMessage( QString( "Successfully loaded globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" ) );
QgsMessageLog::logMessage( QStringLiteral( "Successfully loaded globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" ) );
}
}

View File

@ -391,7 +391,7 @@ void QgsNodeTool::cadCanvasPressEvent( QgsMapMouseEvent *e )
if ( mLastMouseMoveMatch.isValid() && mLastMouseMoveMatch.layer() )
{
QMenu menu;
QAction *actionNodeEditor = menu.addAction( "Node editor" );
QAction *actionNodeEditor = menu.addAction( QStringLiteral( "Node editor" ) );
connect( actionNodeEditor, &QAction::triggered, this, &QgsNodeTool::showNodeEditor );
menu.exec( mCanvas->mapToGlobal( e->pos() ) );
}

View File

@ -49,7 +49,7 @@ class QgsPluginSortFilterProxyModel : public QSortFilterProxyModel
void setAcceptedStatuses( const QStringList &statuses );
//! (Re)configire the spacer filter
void setAcceptedSpacers( const QString &spacers = "" );
void setAcceptedSpacers( const QString &spacers = QString() );
//! Return number of item with status filter matching (no other filters are considered)
int countWithCurrentStatus();
@ -75,4 +75,6 @@ class QgsPluginSortFilterProxyModel : public QSortFilterProxyModel
QString mAcceptedSpacers;
};
// clazy:excludeall=qstring-allocations
#endif

View File

@ -968,7 +968,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
new QgsCredentialDialog( this );
mLocatorWidget->setMapCanvas( mMapCanvas );
connect( mLocatorWidget, &QgsLocatorWidget::configTriggered, this, [ = ] { showOptionsDialog( this, QString( "mOptionsLocatorSettings" ) ); } );
connect( mLocatorWidget, &QgsLocatorWidget::configTriggered, this, [ = ] { showOptionsDialog( this, QStringLiteral( "mOptionsLocatorSettings" ) ); } );
qApp->processEvents();
@ -1146,9 +1146,9 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
zoomInToolShortCut->setProperty( "Icon", QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomIn.svg" ) ) );
QShortcut *toggleSnapping = new QShortcut( QKeySequence( tr( "S" ) ), this );
toggleSnapping->setObjectName( "toggleSnapping" );
toggleSnapping->setObjectName( QStringLiteral( "toggleSnapping" ) );
toggleSnapping->setWhatsThis( tr( "Toggle snapping" ) );
toggleSnapping->setProperty( "Icon", QgsApplication::getThemeIcon( "/mIconSnapping.svg" ) );
toggleSnapping->setProperty( "Icon", QgsApplication::getThemeIcon( QStringLiteral( "/mIconSnapping.svg" ) ) );
connect( toggleSnapping, &QShortcut::activated, mSnappingUtils, &QgsSnappingUtils::toggleEnabled );
if ( ! QTouchDevice::devices().isEmpty() )
@ -1563,7 +1563,7 @@ void QgisApp::dataSourceManager( const QString &pageName )
{
mDataSourceManagerDialog->openPage( pageName );
}
if ( QgsSettings().value( "/qgis/dataSourceManagerNonModal", true ).toBool() )
if ( QgsSettings().value( QStringLiteral( "/qgis/dataSourceManagerNonModal" ), true ).toBool() )
{
mDataSourceManagerDialog->show();
}
@ -4683,7 +4683,7 @@ void QgisApp::fileExit()
// active tasks
if ( QMessageBox::question( this, tr( "Active tasks" ),
tr( "The following tasks are currently running in the background:\n\n%1\n\nDo you want to try canceling these active tasks?" ).arg( tasks.join( "\n" ) ),
tr( "The following tasks are currently running in the background:\n\n%1\n\nDo you want to try canceling these active tasks?" ).arg( tasks.join( QStringLiteral( "\n" ) ) ),
QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
{
QgsApplication::taskManager()->cancelAll();
@ -5879,8 +5879,8 @@ void QgisApp::togglePanelsVisibility()
{
QgsSettings settings;
QStringList docksTitle = settings.value( "UI/hiddenDocksTitle", QString() ).toStringList();
QStringList docksActive = settings.value( "UI/hiddenDocksActive", QString() ).toStringList();
QStringList docksTitle = settings.value( QStringLiteral( "UI/hiddenDocksTitle" ), QString() ).toStringList();
QStringList docksActive = settings.value( QStringLiteral( "UI/hiddenDocksActive" ), QString() ).toStringList();
QList<QDockWidget *> docks = findChildren<QDockWidget *>();
QList<QTabBar *> tabBars = findChildren<QTabBar *>();
@ -8780,7 +8780,7 @@ void QgisApp::removeLayer()
if ( !activeTaskDescriptions.isEmpty() )
{
QMessageBox::warning( this, tr( "Active tasks" ),
tr( "The following tasks are currently running which depend on this layer:\n\n%1\n\nPlease cancel these tasks and retry." ).arg( activeTaskDescriptions.join( "\n" ) ) );
tr( "The following tasks are currently running which depend on this layer:\n\n%1\n\nPlease cancel these tasks and retry." ).arg( activeTaskDescriptions.join( QStringLiteral( "\n" ) ) ) );
return;
}
@ -10010,7 +10010,7 @@ bool QgisApp::checkTasksDependOnProject()
if ( !activeTaskDescriptions.isEmpty() )
{
QMessageBox::warning( this, tr( "Active tasks" ),
tr( "The following tasks are currently running which depend on layers in this project:\n\n%1\n\nPlease cancel these tasks and retry." ).arg( activeTaskDescriptions.toList().join( "\n" ) ) );
tr( "The following tasks are currently running which depend on layers in this project:\n\n%1\n\nPlease cancel these tasks and retry." ).arg( activeTaskDescriptions.toList().join( QStringLiteral( "\n" ) ) ) );
return true;
}
return false;

View File

@ -2090,4 +2090,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
#define QGIS_ICON_SIZE 24
#endif
// clazy:excludeall=qstring-allocations
#endif

View File

@ -195,11 +195,11 @@ void QgsAttributeActionPropertiesDialog::init( const QSet<QString> &actionScopes
QString tooltip = scope.description();
if ( !variables.empty() )
{
tooltip += "<br><br>";
tooltip += QLatin1String( "<br><br>" );
tooltip += tr( "Additional variables" );
tooltip += "<ul><li>";
tooltip += variables.join( "</li><li>" );
tooltip += "</ul></li>";
tooltip += QLatin1String( "<ul><li>" );
tooltip += variables.join( QStringLiteral( "</li><li>" ) );
tooltip += QLatin1String( "</ul></li>" );
}
actionScopeCheckBox->setToolTip( tooltip );
actionScopeCheckBox->setProperty( "ActionScopeName", scope.id() );

View File

@ -63,10 +63,10 @@ void QgsCrashDialog::createBugReport()
QString QgsCrashDialog::htmlToMarkdown( const QString &html )
{
QString markdown = html;
markdown.replace( "<br>", "\n" );
markdown.replace( "<b>", "*" );
markdown.replace( "</b>", "*" );
markdown.replace( "QGIS code revision: ", "QGIS code revision: commit:" );
markdown.replace( QLatin1String( "<br>" ), QLatin1String( "\n" ) );
markdown.replace( QLatin1String( "<b>" ), QLatin1String( "*" ) );
markdown.replace( QLatin1String( "</b>" ), QLatin1String( "*" ) );
markdown.replace( QLatin1String( "QGIS code revision: " ), QLatin1String( "QGIS code revision: commit:" ) );
return markdown;
}

View File

@ -40,22 +40,22 @@ const QString QgsCrashReport::toHtml() const
if ( flags().testFlag( QgsCrashReport::Stack ) )
{
reportData.append( "<br>" );
reportData.append( "<b>Stack Trace</b>" );
reportData.append( QStringLiteral( "<br>" ) );
reportData.append( QStringLiteral( "<b>Stack Trace</b>" ) );
if ( mStackTrace.isEmpty() )
{
reportData.append( "Stack trace unable to be generated." );
reportData.append( QStringLiteral( "Stack trace unable to be generated." ) );
}
else
{
reportData.append( "<pre>" );
reportData.append( QStringLiteral( "<pre>" ) );
Q_FOREACH ( const QgsStackTrace::StackLine &line, mStackTrace )
{
QFileInfo fileInfo( line.fileName );
QString filename( fileInfo.fileName() );
reportData.append( QString( "(%1) %2 %3:%4" ).arg( line.moduleName, line.symbolName, filename, line.lineNumber ) );
reportData.append( QStringLiteral( "(%1) %2 %3:%4" ).arg( line.moduleName, line.symbolName, filename, line.lineNumber ) );
}
reportData.append( "</pre>" );
reportData.append( QStringLiteral( "</pre>" ) );
}
}
@ -77,34 +77,34 @@ const QString QgsCrashReport::toHtml() const
if ( flags().testFlag( QgsCrashReport::QgisInfo ) )
{
reportData.append( "<br>" );
reportData.append( "<b>QGIS Info</b>" );
reportData.append( QString( "QGIS Version: %1" ).arg( Qgis::QGIS_VERSION ) );
reportData.append( QStringLiteral( "<br>" ) );
reportData.append( QStringLiteral( "<b>QGIS Info</b>" ) );
reportData.append( QStringLiteral( "QGIS Version: %1" ).arg( Qgis::QGIS_VERSION ) );
if ( QString( Qgis::QGIS_DEV_VERSION ) == QLatin1String( "exported" ) )
{
reportData.append( QString( "QGIS code branch: Release %1.%2" )
reportData.append( QStringLiteral( "QGIS code branch: Release %1.%2" )
.arg( Qgis::QGIS_VERSION_INT / 10000 ).arg( Qgis::QGIS_VERSION_INT / 100 % 100 ) );
}
else
{
reportData.append( QString( "QGIS code revision: %1" ).arg( Qgis::QGIS_DEV_VERSION ) );
reportData.append( QStringLiteral( "QGIS code revision: %1" ).arg( Qgis::QGIS_DEV_VERSION ) );
}
reportData.append( QString( "Compiled against Qt: %1" ).arg( QT_VERSION_STR ) );
reportData.append( QString( "Running against Qt: %1" ).arg( qVersion() ) );
reportData.append( QStringLiteral( "Compiled against Qt: %1" ).arg( QT_VERSION_STR ) );
reportData.append( QStringLiteral( "Running against Qt: %1" ).arg( qVersion() ) );
reportData.append( QString( "Compiled against GDAL: %1" ).arg( GDAL_RELEASE_NAME ) );
reportData.append( QString( "Running against GDAL: %1" ).arg( GDALVersionInfo( "RELEASE_NAME" ) ) );
reportData.append( QStringLiteral( "Compiled against GDAL: %1" ).arg( GDAL_RELEASE_NAME ) );
reportData.append( QStringLiteral( "Running against GDAL: %1" ).arg( GDALVersionInfo( "RELEASE_NAME" ) ) );
}
if ( flags().testFlag( QgsCrashReport::SystemInfo ) )
{
reportData.append( "<br>" );
reportData.append( "<b>System Info</b>" );
reportData.append( QString( "CPU Type: %1" ).arg( QSysInfo::currentCpuArchitecture() ) );
reportData.append( QString( "Kernel Type: %1" ).arg( QSysInfo::kernelType() ) );
reportData.append( QString( "Kernel Version: %1" ).arg( QSysInfo::kernelVersion() ) );
reportData.append( QStringLiteral( "<br>" ) );
reportData.append( QStringLiteral( "<b>System Info</b>" ) );
reportData.append( QStringLiteral( "CPU Type: %1" ).arg( QSysInfo::currentCpuArchitecture() ) );
reportData.append( QStringLiteral( "Kernel Type: %1" ).arg( QSysInfo::kernelType() ) );
reportData.append( QStringLiteral( "Kernel Version: %1" ).arg( QSysInfo::kernelVersion() ) );
}
QString report;
@ -118,7 +118,7 @@ const QString QgsCrashReport::toHtml() const
const QString QgsCrashReport::crashID() const
{
if ( mStackTrace.isEmpty() )
return "ID not generated due to missing information\n\n Your version of QGIS install might not have debug information included.";
return QStringLiteral( "ID not generated due to missing information\n\n Your version of QGIS install might not have debug information included." );
QString data = QString();
@ -133,7 +133,7 @@ const QString QgsCrashReport::crashID() const
}
if ( data.isNull() )
return "ID not generated due to missing information";
return QStringLiteral( "ID not generated due to missing information" );
QString hash = QString( QCryptographicHash::hash( data.toAscii(), QCryptographicHash::Sha1 ).toHex() );
return hash;

View File

@ -106,7 +106,7 @@ void QgsDecorationCopyright::render( const QgsMapSettings &mapSettings, QgsRende
// To set the text color in a QTextDocument we use a CSS style
QString style = "<style type=\"text/css\"> p {color: " +
QString( "rgba( %1, %2, %3, %4 )" ).arg( mColor.red() ).arg( mColor.green() ).arg( mColor.blue() ).arg( QString::number( mColor.alphaF(), 'f', 2 ) ) + "}</style>";
QStringLiteral( "rgba( %1, %2, %3, %4 )" ).arg( mColor.red() ).arg( mColor.green() ).arg( mColor.blue() ).arg( QString::number( mColor.alphaF(), 'f', 2 ) ) + "}</style>";
text.setHtml( style + "<p>" + mLabelQString + "</p>" );
QSizeF size = text.size();

View File

@ -38,7 +38,7 @@ QgsDecorationLayoutExtentDialog::QgsDecorationLayoutExtentDialog( QgsDecorationL
mSymbolButton->setSymbolType( QgsSymbol::Fill );
QgsSettings settings;
restoreGeometry( settings.value( "/Windows/DecorationLayoutExtent/geometry" ).toByteArray() );
restoreGeometry( settings.value( QStringLiteral( "/Windows/DecorationLayoutExtent/geometry" ) ).toByteArray() );
updateGuiElements();
connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsDecorationLayoutExtentDialog::apply );

View File

@ -66,7 +66,7 @@ QgsAttributeDialog *QgsFeatureAction::newDialog( bool cloneFeature )
QgsAttributeDialog *dialog = new QgsAttributeDialog( mLayer, f, cloneFeature, parentWidget(), true, context );
dialog->setWindowFlags( dialog->windowFlags() | Qt::Tool );
dialog->setObjectName( QString( "featureactiondlg:%1:%2" ).arg( mLayer->id() ).arg( f->id() ) );
dialog->setObjectName( QStringLiteral( "featureactiondlg:%1:%2" ).arg( mLayer->id() ).arg( f->id() ) );
QList<QgsAction> actions = mLayer->actions()->actions( QStringLiteral( "Feature" ) );
if ( !actions.isEmpty() )
@ -101,7 +101,7 @@ bool QgsFeatureAction::viewFeatureForm( QgsHighlight *h )
if ( !mLayer || !mFeature )
return false;
QString name( QString( "featureactiondlg:%1:%2" ).arg( mLayer->id() ).arg( mFeature->id() ) );
QString name( QStringLiteral( "featureactiondlg:%1:%2" ).arg( mLayer->id() ).arg( mFeature->id() ) );
QgsAttributeDialog *dialog = QgisApp::instance()->findChild<QgsAttributeDialog *>( name );
if ( dialog )
@ -139,7 +139,7 @@ bool QgsFeatureAction::editFeature( bool showModal )
}
else
{
QString name( QString( "featureactiondlg:%1:%2" ).arg( mLayer->id() ).arg( mFeature->id() ) );
QString name( QStringLiteral( "featureactiondlg:%1:%2" ).arg( mLayer->id() ).arg( mFeature->id() ) );
QgsAttributeDialog *dialog = QgisApp::instance()->findChild<QgsAttributeDialog *>( name );
if ( dialog )

View File

@ -113,12 +113,12 @@ void QgsIdentifyResultsWebView::handleDownload( QUrl url )
}
else
{
const QString DOWNLOADER_LAST_DIR_KEY( "Qgis/fileDownloaderLastDir" );
const QString DOWNLOADER_LAST_DIR_KEY( QStringLiteral( "Qgis/fileDownloaderLastDir" ) );
QgsSettings settings;
// Try to get some information from the URL
QFileInfo info( url.toString() );
QString savePath = settings.value( DOWNLOADER_LAST_DIR_KEY ).toString();
QString fileName = info.fileName().replace( QRegExp( "[^A-z0-9\\-_\\.]" ), "_" );
QString fileName = info.fileName().replace( QRegExp( "[^A-z0-9\\-_\\.]" ), QStringLiteral( "_" ) );
if ( ! savePath.isEmpty() && ! fileName.isEmpty() )
{
savePath = QDir::cleanPath( savePath + QDir::separator() + fileName );

View File

@ -73,7 +73,7 @@ QgsMapSaveDialog::QgsMapSaveDialog( QWidget *parent, QgsMapCanvas *mapCanvas, co
if ( activeDecorations.isEmpty() )
activeDecorations = decoration->name().toLower();
else
activeDecorations += QString( ", %1" ).arg( decoration->name().toLower() );
activeDecorations += QStringLiteral( ", %1" ).arg( decoration->name().toLower() );
}
mDrawDecorations->setText( tr( "Draw active decorations: %1" ).arg( !activeDecorations.isEmpty() ? activeDecorations : tr( "none" ) ) );
@ -100,7 +100,7 @@ QgsMapSaveDialog::QgsMapSaveDialog( QWidget *parent, QgsMapCanvas *mapCanvas, co
layers << QChar( 0x2026 );
}
mInfo->setText( tr( "The following layer(s) use advanced effects:\n%1\nRasterizing map is recommended for proper rendering." ).arg(
QChar( 0x2022 ) + QString( " " ) + layers.join( QString( "\n" ) + QChar( 0x2022 ) + QString( " " ) ) ) );
QChar( 0x2022 ) + QStringLiteral( " " ) + layers.join( QStringLiteral( "\n" ) + QChar( 0x2022 ) + QStringLiteral( " " ) ) ) );
mSaveAsRaster->setChecked( true );
}
else

View File

@ -628,7 +628,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
mLegendLayersBoldChkBx->setChecked( mSettings->value( QStringLiteral( "/qgis/legendLayersBold" ), true ).toBool() );
mLegendGroupsBoldChkBx->setChecked( mSettings->value( QStringLiteral( "/qgis/legendGroupsBold" ), false ).toBool() );
cbxHideSplash->setChecked( mSettings->value( QStringLiteral( "/qgis/hideSplash" ), false ).toBool() );
mDataSourceManagerNonModal->setChecked( mSettings->value( "/qgis/dataSourceManagerNonModal", false ).toBool() );
mDataSourceManagerNonModal->setChecked( mSettings->value( QStringLiteral( "/qgis/dataSourceManagerNonModal" ), false ).toBool() );
cbxCheckVersion->setChecked( mSettings->value( QStringLiteral( "/qgis/checkVersion" ), true ).toBool() );
cbxAttributeTableDocked->setChecked( mSettings->value( QStringLiteral( "/qgis/dockAttributeTable" ), false ).toBool() );
cbxAddPostgisDC->setChecked( mSettings->value( QStringLiteral( "/qgis/addPostgisDC" ), false ).toBool() );
@ -1964,7 +1964,7 @@ void QgsOptions::loadGdalDriverList()
// in GDAL 2.0 vector and mixed drivers are returned by GDALGetDriver, so filter out non-raster drivers
// TODO add same UI for vector drivers
if ( QString( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_RASTER, nullptr ) ) != "YES" )
if ( QString( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_RASTER, nullptr ) ) != QLatin1String( "YES" ) )
continue;
myGdalDriverDescription = GDALGetDescription( myGdalDriver );

View File

@ -105,7 +105,7 @@ class APP_EXPORT QgsPluginRegistry
//! Check current QGIS version against requested minimal and optionally maximal QGIS version
//! if maxVersion not specified, the default value is assumed: std::floor(minVersion) + 0.99.99
bool checkQgisVersion( const QString &minVersion, const QString &maxVersion = "" ) const;
bool checkQgisVersion( const QString &minVersion, const QString &maxVersion = QString() ) const;
private:
static QgsPluginRegistry *sInstance;
@ -113,4 +113,7 @@ class APP_EXPORT QgsPluginRegistry
QgsPythonUtils *mPythonUtils = nullptr;
QgisInterface *mQgisInterface = nullptr;
};
// clazy:excludeall=qstring-allocations
#endif //QgsPluginRegistry_H

View File

@ -523,7 +523,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
bool addWktGeometry = QgsProject::instance()->readBoolEntry( QStringLiteral( "WMSAddWktGeometry" ), QStringLiteral( "/" ) );
mAddWktGeometryCheckBox->setChecked( addWktGeometry );
bool requestDefinedSources = QgsProject::instance()->readBoolEntry( "WMSRequestDefinedDataSources", "/", false );
bool requestDefinedSources = QgsProject::instance()->readBoolEntry( QStringLiteral( "WMSRequestDefinedDataSources" ), QStringLiteral( "/" ), false );
mAllowRequestDefinedDataSourcesBox->setChecked( requestDefinedSources );
bool segmentizeFeatureInfoGeometry = QgsProject::instance()->readBoolEntry( QStringLiteral( "WMSSegmentizeFeatureInfoGeometry" ), QStringLiteral( "/" ) );
@ -1042,7 +1042,7 @@ void QgsProjectProperties::apply()
}
QgsProject::instance()->writeEntry( QStringLiteral( "WMSAddWktGeometry" ), QStringLiteral( "/" ), mAddWktGeometryCheckBox->isChecked() );
QgsProject::instance()->writeEntry( "WMSRequestDefinedDataSources", "/", mAllowRequestDefinedDataSourcesBox->isChecked() );
QgsProject::instance()->writeEntry( QStringLiteral( "WMSRequestDefinedDataSources" ), QStringLiteral( "/" ), mAllowRequestDefinedDataSourcesBox->isChecked() );
QgsProject::instance()->writeEntry( QStringLiteral( "WMSSegmentizeFeatureInfoGeometry" ), QStringLiteral( "/" ), mSegmentizeFeatureInfoGeometryCheckBox->isChecked() );
QgsProject::instance()->writeEntry( QStringLiteral( "WMSUseLayerIDs" ), QStringLiteral( "/" ), mWmsUseLayerIDs->isChecked() );

View File

@ -550,12 +550,12 @@ void QgsRasterLayerProperties::setRendererWidget( const QString &rendererName )
QgsRectangle myExtent = mMapCanvas->mapSettings().outputExtentToLayerExtent( mRasterLayer, mMapCanvas->extent() );
if ( oldWidget && ( !oldRenderer || rendererName != oldRenderer->type() ) )
{
if ( rendererName == "singlebandgray" )
if ( rendererName == QLatin1String( "singlebandgray" ) )
{
whileBlocking( mRasterLayer )->setRenderer( QgsApplication::rasterRendererRegistry()->defaultRendererForDrawingStyle( QgsRaster::SingleBandGray, mRasterLayer->dataProvider() ) );
whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
}
else if ( rendererName == "multibandcolor" )
else if ( rendererName == QLatin1String( "multibandcolor" ) )
{
whileBlocking( mRasterLayer )->setRenderer( QgsApplication::rasterRendererRegistry()->defaultRendererForDrawingStyle( QgsRaster::MultiBandColor, mRasterLayer->dataProvider() ) );
whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();

View File

@ -238,7 +238,7 @@ QgsSnappingWidget::QgsSnappingWidget( QgsProject *project, QgsMapCanvas *canvas,
bool defaultSnapEnabled = QgsSettings().value( QStringLiteral( "/qgis/digitizing/default_snap_enabled" ), false ).toBool();
enableSnapping( defaultSnapEnabled );
restoreGeometry( QgsSettings().value( "/Windows/SnappingWidget/geometry" ).toByteArray() );
restoreGeometry( QgsSettings().value( QStringLiteral( "/Windows/SnappingWidget/geometry" ) ).toByteArray() );
}
QgsSnappingWidget::~QgsSnappingWidget()

View File

@ -172,11 +172,11 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
//for saving
QString providerName = mLayer->providerType();
if ( providerName == "ogr" )
if ( providerName == QLatin1String( "ogr" ) )
{
providerName = mLayer->dataProvider()->storageType();
if ( providerName == "GPKG" )
providerName = "GeoPackage";
if ( providerName == QLatin1String( "GPKG" ) )
providerName = QStringLiteral( "GeoPackage" );
}
mSaveAsMenu->addAction( tr( "Save in database (%1)" ).arg( providerName ) );
}
@ -1236,7 +1236,7 @@ void QgsVectorLayerProperties::addJoinToTreeWidget( const QgsVectorLayerJoinInfo
return;
}
joinItem->setText( 0, "Join layer" );
joinItem->setText( 0, QStringLiteral( "Join layer" ) );
joinItem->setText( 1, joinLayer->name() );
QFont f = joinItem->font( 0 );
@ -1247,53 +1247,53 @@ void QgsVectorLayerProperties::addJoinToTreeWidget( const QgsVectorLayerJoinInfo
joinItem->setData( 0, Qt::UserRole, join.joinLayerId() );
QTreeWidgetItem *childJoinField = new QTreeWidgetItem();
childJoinField->setText( 0, "Join field" );
childJoinField->setText( 0, QStringLiteral( "Join field" ) );
childJoinField->setText( 1, join.joinFieldName() );
childJoinField->setFlags( Qt::ItemIsEnabled );
joinItem->addChild( childJoinField );
QTreeWidgetItem *childTargetField = new QTreeWidgetItem();
childTargetField->setText( 0, "Target field" );
childTargetField->setText( 0, QStringLiteral( "Target field" ) );
childTargetField->setText( 1, join.targetFieldName() );
joinItem->addChild( childTargetField );
QTreeWidgetItem *childMemCache = new QTreeWidgetItem();
childMemCache->setText( 0, "Cache join layer in virtual memory" );
childMemCache->setText( 0, QStringLiteral( "Cache join layer in virtual memory" ) );
if ( join.isUsingMemoryCache() )
childMemCache->setText( 1, QChar( 0x2714 ) );
joinItem->addChild( childMemCache );
QTreeWidgetItem *childDynForm = new QTreeWidgetItem();
childDynForm->setText( 0, "Dynamic form" );
childDynForm->setText( 0, QStringLiteral( "Dynamic form" ) );
if ( join.isDynamicFormEnabled() )
childDynForm->setText( 1, QChar( 0x2714 ) );
joinItem->addChild( childDynForm );
QTreeWidgetItem *childEditable = new QTreeWidgetItem();
childEditable->setText( 0, "Editable join layer" );
childEditable->setText( 0, QStringLiteral( "Editable join layer" ) );
if ( join.isEditable() )
childEditable->setText( 1, QChar( 0x2714 ) );
joinItem->addChild( childEditable );
QTreeWidgetItem *childUpsert = new QTreeWidgetItem();
childUpsert->setText( 0, "Upsert on edit" );
childUpsert->setText( 0, QStringLiteral( "Upsert on edit" ) );
if ( join.hasUpsertOnEdit() )
childUpsert->setText( 1, QChar( 0x2714 ) );
joinItem->addChild( childUpsert );
QTreeWidgetItem *childCascade = new QTreeWidgetItem();
childCascade->setText( 0, "Delete cascade" );
childCascade->setText( 0, QStringLiteral( "Delete cascade" ) );
if ( join.hasCascadedDelete() )
childCascade->setText( 1, QChar( 0x2714 ) );
joinItem->addChild( childCascade );
QTreeWidgetItem *childPrefix = new QTreeWidgetItem();
childPrefix->setText( 0, "Custom field name prefix" );
childPrefix->setText( 0, QStringLiteral( "Custom field name prefix" ) );
childPrefix->setText( 1, join.prefix() );
joinItem->addChild( childPrefix );
QTreeWidgetItem *childFields = new QTreeWidgetItem();
childFields->setText( 0, "Joined fields" );
childFields->setText( 0, QStringLiteral( "Joined fields" ) );
const QStringList *list = join.joinFieldNamesSubset();
if ( list )
childFields->setText( 1, QStringLiteral( "%1" ).arg( list->count() ) );

View File

@ -75,7 +75,7 @@ static const QString sDescription = QObject::tr( "Master Password <-> KeyChain s
const QString QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME( "Password Manager" );
static const QString sDescription = QObject::tr( "Master Password <-> Password Manager storage plugin. Store and retrieve your master password in your Password Manager" );
#elif defined(Q_OS_LINUX)
const QString QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME( "Wallet/KeyRing" );
const QString QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME( QStringLiteral( "Wallet/KeyRing" ) );
static const QString sDescription = QObject::tr( "Master Password <-> Wallet/KeyRing storage plugin. Store and retrieve your master password in your Wallet/KeyRing" );
#else
const QString QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME( "Password Manager" );
@ -2854,7 +2854,7 @@ QgsAuthManager::QgsAuthManager()
, mScheduledDbEraseRequestCount( 0 )
, mIgnoredSslErrorsCache( QHash<QString, QSet<QSslError::SslError> >() )
, mPasswordHelperVerificationError( false )
, mPasswordHelperErrorMessage( "" )
, mPasswordHelperErrorMessage( QLatin1String( "" ) )
, mPasswordHelperErrorCode( QKeychain::NoError )
, mPasswordHelperLoggingEnabled( false )
, mPasswordHelperFailedInit( false )
@ -2933,7 +2933,7 @@ bool QgsAuthManager::passwordHelperDelete()
QString QgsAuthManager::passwordHelperRead()
{
// Retrieve it!
QString password( "" );
QString password( QLatin1String( "" ) );
passwordHelperLog( tr( "Opening %1 for READ ..." ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ) );
QKeychain::ReadPasswordJob job( AUTH_PASSWORD_HELPER_FOLDER_NAME );
QgsSettings settings;
@ -3039,7 +3039,7 @@ void QgsAuthManager::setPasswordHelperLoggingEnabled( const bool enabled )
void QgsAuthManager::passwordHelperClearErrors()
{
mPasswordHelperErrorCode = QKeychain::NoError;
mPasswordHelperErrorMessage = "";
mPasswordHelperErrorMessage = QLatin1String( "" );
}
void QgsAuthManager::passwordHelperProcessError()

View File

@ -78,7 +78,7 @@ QgsAuthMethodRegistry::QgsAuthMethodRegistry( const QString &pluginPath )
}
// auth method file regex pattern, only files matching the pattern are loaded if the variable is defined
QString filePattern = getenv( "QGIS_AUTHMETHOD_FILE" );
QString filePattern = getenv( QStringLiteral( "QGIS_AUTHMETHOD_FILE" ) );
QRegExp fileRegexp;
if ( !filePattern.isEmpty() )
{
@ -228,7 +228,7 @@ QString QgsAuthMethodRegistry::pluginList( bool asHtml ) const
if ( asHtml )
{
list += "<br></li>";
list += QLatin1String( "<br></li>" );
}
else
{
@ -316,7 +316,7 @@ typedef QWidget *editFactoryFunction_t( QWidget *parent );
QWidget *QgsAuthMethodRegistry::editWidget( const QString &authMethodKey, QWidget *parent )
{
editFactoryFunction_t *editFactory =
reinterpret_cast< editFactoryFunction_t * >( cast_to_fptr( function( authMethodKey, "editWidget" ) ) );
reinterpret_cast< editFactoryFunction_t * >( cast_to_fptr( function( authMethodKey, QStringLiteral( "editWidget" ) ) ) );
if ( !editFactory )
return nullptr;

View File

@ -641,7 +641,7 @@ bool QgsComposerAttributeTableV2::writeXml( QDomElement &elem, QDomDocument &doc
composerTableElem.setAttribute( QStringLiteral( "showOnlyVisibleFeatures" ), mShowOnlyVisibleFeatures );
composerTableElem.setAttribute( QStringLiteral( "filterToAtlasIntersection" ), mFilterToAtlasIntersection );
composerTableElem.setAttribute( QStringLiteral( "maxFeatures" ), mMaximumNumberOfFeatures );
composerTableElem.setAttribute( QStringLiteral( "filterFeatures" ), mFilterFeatures ? "true" : "false" );
composerTableElem.setAttribute( QStringLiteral( "filterFeatures" ), mFilterFeatures ? QStringLiteral( "true" ) : QStringLiteral( "false" ) );
composerTableElem.setAttribute( QStringLiteral( "featureFilter" ), mFeatureFilter );
composerTableElem.setAttribute( QStringLiteral( "wrapString" ), mWrapString );

View File

@ -462,7 +462,7 @@ bool QgsComposerLegend::readXml( const QDomElement &itemElem, const QDomDocument
mSettings.setSymbolSize( QSizeF( itemElem.attribute( QStringLiteral( "symbolWidth" ), QStringLiteral( "7.0" ) ).toDouble(), itemElem.attribute( QStringLiteral( "symbolHeight" ), QStringLiteral( "14.0" ) ).toDouble() ) );
mSettings.setWmsLegendSize( QSizeF( itemElem.attribute( QStringLiteral( "wmsLegendWidth" ), QStringLiteral( "50" ) ).toDouble(), itemElem.attribute( QStringLiteral( "wmsLegendHeight" ), QStringLiteral( "25" ) ).toDouble() ) );
mSettings.setLineSpacing( itemElem.attribute( QStringLiteral( "lineSpacing" ), "1.0" ).toDouble() );
mSettings.setLineSpacing( itemElem.attribute( QStringLiteral( "lineSpacing" ), QStringLiteral( "1.0" ) ).toDouble() );
mSettings.setDrawRasterStroke( itemElem.attribute( QStringLiteral( "rasterBorder" ), QStringLiteral( "1" ) ) != QLatin1String( "0" ) );
mSettings.setRasterStrokeColor( QgsSymbolLayerUtils::decodeColor( itemElem.attribute( QStringLiteral( "rasterBorderColor" ), QStringLiteral( "0,0,0" ) ) ) );

View File

@ -745,7 +745,7 @@ bool QgsComposerPicture::writeXml( QDomElement &elem, QDomDocument &doc ) const
{
// convert from absolute path to relative. For SVG we also need to consider system SVG paths
QgsPathResolver pathResolver = mComposition->project()->pathResolver();
if ( imagePath.endsWith( ".svg", Qt::CaseInsensitive ) )
if ( imagePath.endsWith( QLatin1String( ".svg" ), Qt::CaseInsensitive ) )
imagePath = QgsSymbolLayerUtils::svgSymbolPathToName( imagePath, pathResolver );
else
imagePath = pathResolver.writePath( imagePath );
@ -826,7 +826,7 @@ bool QgsComposerPicture::readXml( const QDomElement &itemElem, const QDomDocumen
{
// convert from relative path to absolute. For SVG we also need to consider system SVG paths
QgsPathResolver pathResolver = mComposition->project()->pathResolver();
if ( imagePath.endsWith( ".svg", Qt::CaseInsensitive ) )
if ( imagePath.endsWith( QLatin1String( ".svg" ), Qt::CaseInsensitive ) )
imagePath = QgsSymbolLayerUtils::svgSymbolNameToPath( imagePath, pathResolver );
else
imagePath = pathResolver.readPath( imagePath );

View File

@ -94,6 +94,11 @@ double QgsHistogramDiagram::legendSize( double value, const QgsDiagramSettings &
return value * scaleFactor;
}
QString QgsHistogramDiagram::diagramName() const
{
return DIAGRAM_NAME_HISTOGRAM;
}
QSizeF QgsHistogramDiagram::diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s )
{
Q_UNUSED( c );

View File

@ -47,7 +47,7 @@ class CORE_EXPORT QgsHistogramDiagram: public QgsDiagram
QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s ) override;
QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) override;
double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const override;
QString diagramName() const override { return DIAGRAM_NAME_HISTOGRAM; }
QString diagramName() const override;
private:
QBrush mCategoryBrush;

View File

@ -67,6 +67,11 @@ double QgsPieDiagram::legendSize( double value, const QgsDiagramSettings &s, con
return std::max( size.width(), size.height() );
}
QString QgsPieDiagram::diagramName() const
{
return DIAGRAM_NAME_PIE;
}
QSizeF QgsPieDiagram::diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s )
{
Q_UNUSED( c );

View File

@ -45,7 +45,7 @@ class CORE_EXPORT QgsPieDiagram: public QgsDiagram
QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s ) override;
QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) override;
double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const override;
QString diagramName() const override { return DIAGRAM_NAME_PIE; }
QString diagramName() const override;
private:
QBrush mCategoryBrush;

View File

@ -66,6 +66,11 @@ double QgsTextDiagram::legendSize( double value, const QgsDiagramSettings &s, co
return std::max( size.width(), size.height() );
}
QString QgsTextDiagram::diagramName() const
{
return DIAGRAM_NAME_TEXT;
}
QSizeF QgsTextDiagram::diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s )
{
Q_UNUSED( c );

View File

@ -58,7 +58,7 @@ class CORE_EXPORT QgsTextDiagram: public QgsDiagram
QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) override;
double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const override;
QString diagramName() const override { return DIAGRAM_NAME_TEXT; }
QString diagramName() const override;
private:
Orientation mOrientation;

View File

@ -656,7 +656,7 @@ void QgsDxfExport::writeTables()
writeGroup( 100, QStringLiteral( "AcDbSymbolTable" ) );
writeGroup( 70, 0 );
const QStringList blockStrings = QStringList() << "*Model_Space" << "*Paper_Space" << "*Paper_Space0";
const QStringList blockStrings = QStringList() << QStringLiteral( "*Model_Space" ) << QStringLiteral( "*Paper_Space" ) << QStringLiteral( "*Paper_Space0" );
for ( const QString &block : blockStrings )
{
writeGroup( 0, QStringLiteral( "BLOCK_RECORD" ) );
@ -862,7 +862,7 @@ void QgsDxfExport::writeBlocks()
startSection();
writeGroup( 2, QStringLiteral( "BLOCKS" ) );
const QStringList blockStrings = QStringList() << "*Model_Space" << "*Paper_Space" << "*Paper_Space0";
const QStringList blockStrings = QStringList() << QStringLiteral( "*Model_Space" ) << QStringLiteral( "*Paper_Space" ) << QStringLiteral( "*Paper_Space0" );
for ( const QString &block : blockStrings )
{
writeGroup( 0, QStringLiteral( "BLOCK" ) );
@ -4022,7 +4022,7 @@ QList< QPair< QgsSymbolLayer *, QgsSymbol * > > QgsDxfExport::symbolLayers( QgsR
void QgsDxfExport::writeDefaultLinetypes()
{
// continuous (Qt solid line)
const QStringList blockStrings = QStringList() << "ByLayer" << "ByBlock" << "CONTINUOUS";
const QStringList blockStrings = QStringList() << QStringLiteral( "ByLayer" ) << QStringLiteral( "ByBlock" ) << QStringLiteral( "CONTINUOUS" );
for ( const QString &ltype : blockStrings )
{
writeGroup( 0, QStringLiteral( "LTYPE" ) );

View File

@ -80,7 +80,7 @@ void QgsBlurEffect::drawBlurredImage( QgsRenderContext &context, QImage &image )
QgsStringMap QgsBlurEffect::properties() const
{
QgsStringMap props;
props.insert( QStringLiteral( "enabled" ), mEnabled ? "1" : "0" );
props.insert( QStringLiteral( "enabled" ), mEnabled ? QStringLiteral( "1" ) : QStringLiteral( "0" ) );
props.insert( QStringLiteral( "draw_mode" ), QString::number( static_cast< int >( mDrawMode ) ) );
props.insert( QStringLiteral( "blend_mode" ), QString::number( static_cast< int >( mBlendMode ) ) );
props.insert( QStringLiteral( "opacity" ), QString::number( mOpacity ) );

View File

@ -68,7 +68,7 @@ void QgsColorEffect::draw( QgsRenderContext &context )
QgsStringMap QgsColorEffect::properties() const
{
QgsStringMap props;
props.insert( QStringLiteral( "enabled" ), mEnabled ? "1" : "0" );
props.insert( QStringLiteral( "enabled" ), mEnabled ? QStringLiteral( "1" ) : QStringLiteral( "0" ) );
props.insert( QStringLiteral( "draw_mode" ), QString::number( int( mDrawMode ) ) );
props.insert( QStringLiteral( "blend_mode" ), QString::number( int( mBlendMode ) ) );
props.insert( QStringLiteral( "opacity" ), QString::number( mOpacity ) );
@ -76,7 +76,7 @@ QgsStringMap QgsColorEffect::properties() const
props.insert( QStringLiteral( "contrast" ), QString::number( mContrast ) );
props.insert( QStringLiteral( "saturation" ), QString::number( mSaturation ) );
props.insert( QStringLiteral( "grayscale_mode" ), QString::number( int( mGrayscaleMode ) ) );
props.insert( QStringLiteral( "colorize" ), mColorizeOn ? "1" : "0" );
props.insert( QStringLiteral( "colorize" ), mColorizeOn ? QStringLiteral( "1" ) : QStringLiteral( "0" ) );
props.insert( QStringLiteral( "colorize_color" ), QgsSymbolLayerUtils::encodeColor( mColorizeColor ) );
props.insert( QStringLiteral( "colorize_strength" ), QString::number( mColorizeStrength ) );

View File

@ -144,7 +144,7 @@ QString QgsExpression::quotedValue( const QVariant &value, QVariant::Type type )
return value.toString();
case QVariant::Bool:
return value.toBool() ? "TRUE" : "FALSE";
return value.toBool() ? QStringLiteral( "TRUE" ) : QStringLiteral( "FALSE" );
case QVariant::List:
{
@ -154,7 +154,7 @@ QString QgsExpression::quotedValue( const QVariant &value, QVariant::Type type )
{
quotedValues += quotedValue( v );
}
return QStringLiteral( "array( %1 )" ).arg( quotedValues.join( ", " ) );
return QStringLiteral( "array( %1 )" ).arg( quotedValues.join( QStringLiteral( ", " ) ) );
}
default:
@ -546,7 +546,7 @@ QString QgsExpression::helpText( QString name )
delim = QStringLiteral( ", " );
if ( !a.mDescOnly )
{
helpContents += QStringLiteral( "<span class=\"argument %1\">%2%3</span>" ).arg( a.mOptional ? "optional" : "", a.mArg,
helpContents += QStringLiteral( "<span class=\"argument %1\">%2%3</span>" ).arg( a.mOptional ? QStringLiteral( "optional" ) : QStringLiteral( "" ), a.mArg,
a.mDefaultVal.isEmpty() ? QLatin1String( "" ) : '=' + a.mDefaultVal );
}
}

View File

@ -507,9 +507,9 @@ static QVariant fcnAggregate( const QVariantList &values, const QgsExpressionCon
QString cacheKey;
QgsExpression subExp( subExpression );
QgsExpression filterExp( parameters.filter );
if ( filterExp.referencedVariables().contains( "parent" )
if ( filterExp.referencedVariables().contains( QStringLiteral( "parent" ) )
|| filterExp.referencedVariables().contains( QString() )
|| subExp.referencedVariables().contains( "parent" )
|| subExp.referencedVariables().contains( QStringLiteral( "parent" ) )
|| subExp.referencedVariables().contains( QString() ) )
{
cacheKey = QStringLiteral( "aggfcn:%1:%2:%3:%4:%5%6" ).arg( vl->id(), QString::number( aggregate ), subExpression, parameters.filter,
@ -525,7 +525,7 @@ static QVariant fcnAggregate( const QVariantList &values, const QgsExpressionCon
QgsExpressionContext subContext( *context );
QgsExpressionContextScope *subScope = new QgsExpressionContextScope();
subScope->setVariable( "parent", context->feature() );
subScope->setVariable( QStringLiteral( "parent" ), context->feature() );
subContext.appendScope( subScope );
result = vl->aggregate( aggregate, subExpression, parameters, &subContext, &ok );
@ -553,7 +553,7 @@ static QVariant fcnAggregateRelation( const QVariantList &values, const QgsExpre
}
// first step - find current layer
QgsVectorLayer *vl = QgsExpressionUtils::getVectorLayer( context->variable( "layer" ), parent );
QgsVectorLayer *vl = QgsExpressionUtils::getVectorLayer( context->variable( QStringLiteral( "layer" ) ), parent );
if ( !vl )
{
parent->setEvalErrorString( QObject::tr( "Cannot use relation aggregate function in this context" ) );
@ -655,7 +655,7 @@ static QVariant fcnAggregateGeneric( QgsAggregateCalculator::Aggregate aggregate
}
// first step - find current layer
QgsVectorLayer *vl = QgsExpressionUtils::getVectorLayer( context->variable( "layer" ), parent );
QgsVectorLayer *vl = QgsExpressionUtils::getVectorLayer( context->variable( QStringLiteral( "layer" ) ), parent );
if ( !vl )
{
parent->setEvalErrorString( QObject::tr( "Cannot use aggregate function in this context" ) );
@ -698,7 +698,7 @@ static QVariant fcnAggregateGeneric( QgsAggregateCalculator::Aggregate aggregate
QgsExpression groupByExp( groupBy );
QVariant groupByValue = groupByExp.evaluate( context );
QString groupByClause = QStringLiteral( "%1 %2 %3" ).arg( groupBy,
groupByValue.isNull() ? "is" : "=",
groupByValue.isNull() ? QStringLiteral( "is" ) : QStringLiteral( "=" ),
QgsExpression::quotedValue( groupByValue ) );
if ( !parameters.filter.isEmpty() )
parameters.filter = QStringLiteral( "(%1) AND (%2)" ).arg( parameters.filter, groupByClause );
@ -1284,11 +1284,11 @@ static QVariant fcnIsSelected( const QVariantList &values, const QgsExpressionCo
if ( values.isEmpty() )
{
feature = context->feature();
layer = QgsExpressionUtils::getVectorLayer( context->variable( "layer" ), parent );
layer = QgsExpressionUtils::getVectorLayer( context->variable( QStringLiteral( "layer" ) ), parent );
}
else if ( values.size() == 1 )
{
layer = QgsExpressionUtils::getVectorLayer( context->variable( "layer" ), parent );
layer = QgsExpressionUtils::getVectorLayer( context->variable( QStringLiteral( "layer" ) ), parent );
feature = QgsExpressionUtils::getFeature( values.at( 0 ), parent );
}
else if ( values.size() == 2 )
@ -1315,7 +1315,7 @@ static QVariant fcnNumSelected( const QVariantList &values, const QgsExpressionC
QgsVectorLayer *layer = nullptr;
if ( values.isEmpty() )
layer = QgsExpressionUtils::getVectorLayer( context->variable( "layer" ), parent );
layer = QgsExpressionUtils::getVectorLayer( context->variable( QStringLiteral( "layer" ) ), parent );
else if ( values.count() == 1 )
layer = QgsExpressionUtils::getVectorLayer( values.at( 0 ), parent );
else
@ -3918,7 +3918,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
QgsExpressionNode *filterNode = node->args()->at( 3 );
referencedVars.unite( filterNode->referencedVariables() );
}
return referencedVars.contains( "parent" ) || referencedVars.contains( QString() );
return referencedVars.contains( QStringLiteral( "parent" ) ) || referencedVars.contains( QString() );
},
[]( const QgsExpressionNodeFunction * node )
{
@ -3946,7 +3946,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
referencedCols.unite( filterNode->referencedColumns() );
}
if ( referencedVars.contains( "parent" ) || referencedVars.contains( QString() ) )
if ( referencedVars.contains( QStringLiteral( "parent" ) ) || referencedVars.contains( QString() ) )
return QSet<QString>() << QgsFeatureRequest::ALL_ATTRIBUTES;
else
return referencedCols;

View File

@ -696,15 +696,15 @@ QString QgsExpressionNodeBinaryOperator::dump() const
QString fmt;
if ( leftAssociative() )
{
fmt += lOp && ( lOp->precedence() < precedence() ) ? "(%1)" : "%1";
fmt += lOp && ( lOp->precedence() < precedence() ) ? QStringLiteral( "(%1)" ) : QStringLiteral( "%1" );
fmt += QLatin1String( " %2 " );
fmt += rOp && ( rOp->precedence() <= precedence() ) ? "(%3)" : "%3";
fmt += rOp && ( rOp->precedence() <= precedence() ) ? QStringLiteral( "(%3)" ) : QStringLiteral( "%3" );
}
else
{
fmt += lOp && ( lOp->precedence() <= precedence() ) ? "(%1)" : "%1";
fmt += lOp && ( lOp->precedence() <= precedence() ) ? QStringLiteral( "(%1)" ) : QStringLiteral( "%1" );
fmt += QLatin1String( " %2 " );
fmt += rOp && ( rOp->precedence() < precedence() ) ? "(%3)" : "%3";
fmt += rOp && ( rOp->precedence() < precedence() ) ? QStringLiteral( "(%3)" ) : QStringLiteral( "%3" );
}
return fmt.arg( mOpLeft->dump(), BINARY_OPERATOR_TEXT[mOp], rdump );
@ -951,7 +951,7 @@ QSet<QString> QgsExpressionNodeFunction::referencedColumns() const
QSet<QString> QgsExpressionNodeFunction::referencedVariables() const
{
QgsExpressionFunction *fd = QgsExpression::QgsExpression::Functions()[mFnIndex];
if ( fd->name() == "var" )
if ( fd->name() == QLatin1String( "var" ) )
{
if ( !mArgs->list().isEmpty() )
{

View File

@ -34,31 +34,31 @@ QString QgsRelationReferenceFieldFormatter::representValue( QgsVectorLayer *laye
// Some sanity checks
if ( !config.contains( QStringLiteral( "Relation" ) ) )
{
QgsMessageLog::logMessage( "Missing Relation in configuration" );
QgsMessageLog::logMessage( QStringLiteral( "Missing Relation in configuration" ) );
return value.toString();
}
QgsRelation relation = QgsProject::instance()->relationManager()->relation( config[QStringLiteral( "Relation" )].toString() );
if ( !relation.isValid() )
{
QgsMessageLog::logMessage( "Invalid relation" );
QgsMessageLog::logMessage( QStringLiteral( "Invalid relation" ) );
return value.toString();
}
QgsVectorLayer *referencingLayer = relation.referencingLayer();
if ( layer != referencingLayer )
{
QgsMessageLog::logMessage( "representValue() with inconsistent layer parameter w.r.t relation referencingLayer" );
QgsMessageLog::logMessage( QStringLiteral( "representValue() with inconsistent layer parameter w.r.t relation referencingLayer" ) );
return value.toString();
}
int referencingFieldIdx = referencingLayer->fields().lookupField( relation.fieldPairs().at( 0 ).first );
if ( referencingFieldIdx != fieldIndex )
{
QgsMessageLog::logMessage( "representValue() with inconsistent fieldIndex parameter w.r.t relation referencingFieldIdx" );
QgsMessageLog::logMessage( QStringLiteral( "representValue() with inconsistent fieldIndex parameter w.r.t relation referencingFieldIdx" ) );
return value.toString();
}
QgsVectorLayer *referencedLayer = relation.referencedLayer();
if ( !referencedLayer )
{
QgsMessageLog::logMessage( "Cannot find referenced layer" );
QgsMessageLog::logMessage( QStringLiteral( "Cannot find referenced layer" ) );
return value.toString();
}

View File

@ -52,7 +52,7 @@ QString QgsValueRelationFieldFormatter::representValue( QgsVectorLayer *layer, i
vrCache = QgsValueRelationFieldFormatter::createCache( config );
}
if ( config.value( "AllowMulti" ).toBool() )
if ( config.value( QStringLiteral( "AllowMulti" ) ).toBool() )
{
QStringList keyList = value.toString().remove( QChar( '{' ) ).remove( QChar( '}' ) ).split( ',' );
QStringList valueList;
@ -65,7 +65,7 @@ QString QgsValueRelationFieldFormatter::representValue( QgsVectorLayer *layer, i
}
}
return valueList.join( ", " ).prepend( '{' ).append( '}' );
return valueList.join( QStringLiteral( ", " ) ).prepend( '{' ).append( '}' );
}
else
{
@ -83,7 +83,7 @@ QString QgsValueRelationFieldFormatter::representValue( QgsVectorLayer *layer, i
}
}
return QString( "(%1)" ).arg( value.toString() );
return QStringLiteral( "(%1)" ).arg( value.toString() );
}
QVariant QgsValueRelationFieldFormatter::sortValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const
@ -103,22 +103,22 @@ QgsValueRelationFieldFormatter::ValueRelationCache QgsValueRelationFieldFormatte
{
ValueRelationCache cache;
QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( QgsProject::instance()->mapLayer( config.value( "Layer" ).toString() ) );
QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( QgsProject::instance()->mapLayer( config.value( QStringLiteral( "Layer" ) ).toString() ) );
if ( !layer )
return cache;
QgsFields fields = layer->fields();
int ki = fields.indexOf( config.value( "Key" ).toString() );
int vi = fields.indexOf( config.value( "Value" ).toString() );
int ki = fields.indexOf( config.value( QStringLiteral( "Key" ) ).toString() );
int vi = fields.indexOf( config.value( QStringLiteral( "Value" ) ).toString() );
QgsFeatureRequest request;
request.setFlags( QgsFeatureRequest::NoGeometry );
request.setSubsetOfAttributes( QgsAttributeList() << ki << vi );
if ( !config.value( "FilterExpression" ).toString().isEmpty() )
if ( !config.value( QStringLiteral( "FilterExpression" ) ).toString().isEmpty() )
{
request.setFilterExpression( config.value( "FilterExpression" ).toString() );
request.setFilterExpression( config.value( QStringLiteral( "FilterExpression" ) ).toString() );
}
QgsFeatureIterator fit = layer->getFeatures( request );
@ -129,7 +129,7 @@ QgsValueRelationFieldFormatter::ValueRelationCache QgsValueRelationFieldFormatte
cache.append( ValueRelationItem( f.attribute( ki ), f.attribute( vi ).toString() ) );
}
if ( config.value( "OrderByValue" ).toBool() )
if ( config.value( QStringLiteral( "OrderByValue" ) ).toBool() )
{
std::sort( cache.begin(), cache.end(), orderByValueLessThan );
}

View File

@ -19,8 +19,8 @@
#include "qgsdatasourceuri.h"
#include "qgsowsconnection.h"
const QString QgsGeoNodeConnectionUtils::sPathGeoNodeConnection = "qgis/connections-geonode";
const QString QgsGeoNodeConnectionUtils::sPathGeoNodeConnectionDetails = "qgis/GeoNode";
const QString QgsGeoNodeConnectionUtils::sPathGeoNodeConnection = QStringLiteral( "qgis/connections-geonode" );
const QString QgsGeoNodeConnectionUtils::sPathGeoNodeConnectionDetails = QStringLiteral( "qgis/GeoNode" );
QgsGeoNodeConnection::QgsGeoNodeConnection( const QString &name )
: mConnName( name )

View File

@ -500,4 +500,6 @@ inline T qgsgeometry_cast( const QgsAbstractGeometry *geom )
}
#endif
// clazy:excludeall=qstring-allocations
#endif //QGSABSTRACTGEOMETRYV2

View File

@ -154,4 +154,6 @@ class CORE_EXPORT QgsCircularString: public QgsCurve
};
// clazy:excludeall=qstring-allocations
#endif // QGSCIRCULARSTRING_H

View File

@ -173,7 +173,7 @@ bool QgsCompoundCurve::fromWkt( const QString &wkt )
return false;
mWkbType = parts.first;
QString defaultChildWkbType = QStringLiteral( "LineString%1%2" ).arg( is3D() ? "Z" : QString(), isMeasure() ? "M" : QString() );
QString defaultChildWkbType = QStringLiteral( "LineString%1%2" ).arg( is3D() ? QStringLiteral( "Z" ) : QString(), isMeasure() ? QStringLiteral( "M" ) : QString() );
const QStringList blocks = QgsGeometryUtils::wktGetChildBlocks( parts.second, defaultChildWkbType );
for ( const QString &childWkt : blocks )

View File

@ -156,4 +156,6 @@ class CORE_EXPORT QgsCompoundCurve: public QgsCurve
};
// clazy:excludeall=qstring-allocations
#endif // QGSCOMPOUNDCURVEV2_H

View File

@ -200,7 +200,7 @@ bool QgsCurvePolygon::fromWkt( const QString &wkt )
mWkbType = parts.first;
QString defaultChildWkbType = QStringLiteral( "LineString%1%2" ).arg( is3D() ? "Z" : QString(), isMeasure() ? "M" : QString() );
QString defaultChildWkbType = QStringLiteral( "LineString%1%2" ).arg( is3D() ? QStringLiteral( "Z" ) : QString(), isMeasure() ? QStringLiteral( "M" ) : QString() );
const QStringList blocks = QgsGeometryUtils::wktGetChildBlocks( parts.second, defaultChildWkbType );
for ( const QString &childWkt : blocks )
@ -357,7 +357,7 @@ QDomElement QgsCurvePolygon::asGML3( QDomDocument &doc, int precision, const QSt
QDomElement elemCurvePolygon = doc.createElementNS( ns, QStringLiteral( "Polygon" ) );
QDomElement elemExterior = doc.createElementNS( ns, QStringLiteral( "exterior" ) );
QDomElement curveElem = exteriorRing()->asGML3( doc, precision, ns );
if ( curveElem.tagName() == "LineString" )
if ( curveElem.tagName() == QLatin1String( "LineString" ) )
{
curveElem.setTagName( QStringLiteral( "LinearRing" ) );
}
@ -368,7 +368,7 @@ QDomElement QgsCurvePolygon::asGML3( QDomDocument &doc, int precision, const QSt
{
QDomElement elemInterior = doc.createElementNS( ns, QStringLiteral( "interior" ) );
QDomElement innerRing = interiorRing( i )->asGML3( doc, precision, ns );
if ( innerRing.tagName() == "LineString" )
if ( innerRing.tagName() == QLatin1String( "LineString" ) )
{
innerRing.setTagName( QStringLiteral( "LinearRing" ) );
}

View File

@ -174,4 +174,6 @@ class CORE_EXPORT QgsCurvePolygon: public QgsSurface
QgsRectangle calculateBoundingBox() const override;
};
// clazy:excludeall=qstring-allocations
#endif // QGSCURVEPOLYGONV2_H

View File

@ -170,4 +170,6 @@ class CORE_EXPORT QgsGeometryCollection: public QgsAbstractGeometry
mutable QgsCoordinateSequence mCoordinateSequence;
};
// clazy:excludeall=qstring-allocations
#endif // QGSGEOMETRYCOLLECTIONV2_H

View File

@ -162,7 +162,7 @@ static GEOSGeometry *LWGEOM_GEOS_buildArea( const GEOSGeometry *geom_in, QString
}
catch ( GEOSException &e )
{
errorMessage = QString( "GEOSPolygonize(): %1" ).arg( e.what() );
errorMessage = QStringLiteral( "GEOSPolygonize(): %1" ).arg( e.what() );
return nullptr;
}
@ -492,7 +492,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
if ( !geos_cut_edges )
{
GEOSGeom_destroy_r( handle, geos_bound );
errorMessage = "LWGEOM_GEOS_nodeLines() failed";
errorMessage = QStringLiteral( "LWGEOM_GEOS_nodeLines() failed" );
return nullptr;
}
@ -509,7 +509,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
catch ( GEOSException &e )
{
GEOSGeom_destroy_r( handle, geos_bound );
errorMessage = QString( "GEOSGeom_extractUniquePoints(): %1" ).arg( e.what() );
errorMessage = QStringLiteral( "GEOSGeom_extractUniquePoints(): %1" ).arg( e.what() );
return nullptr;
}
@ -521,7 +521,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
{
GEOSGeom_destroy_r( handle, geos_bound );
GEOSGeom_destroy_r( handle, pi );
errorMessage = QString( "GEOSGeom_extractUniquePoints(): %1" ).arg( e.what() );
errorMessage = QStringLiteral( "GEOSGeom_extractUniquePoints(): %1" ).arg( e.what() );
return nullptr;
}
@ -534,7 +534,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
GEOSGeom_destroy_r( handle, geos_bound );
GEOSGeom_destroy_r( handle, pi );
GEOSGeom_destroy_r( handle, po );
errorMessage = QString( "GEOSDifference(): %1" ).arg( e.what() );
errorMessage = QStringLiteral( "GEOSDifference(): %1" ).arg( e.what() );
return nullptr;
}
@ -550,7 +550,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
}
catch ( GEOSException &e )
{
errorMessage = QString( "GEOSGeom_createEmptyPolygon(): %1" ).arg( e.what() );
errorMessage = QStringLiteral( "GEOSGeom_createEmptyPolygon(): %1" ).arg( e.what() );
GEOSGeom_destroy_r( handle, geos_cut_edges );
return nullptr;
}
@ -576,7 +576,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
{
GEOSGeom_destroy_r( handle, geos_cut_edges );
GEOSGeom_destroy_r( handle, geos_area );
errorMessage = QString( "LWGEOM_GEOS_buildArea() threw an error: %1" ).arg( e.what() );
errorMessage = QStringLiteral( "LWGEOM_GEOS_buildArea() threw an error: %1" ).arg( e.what() );
return nullptr;
}
@ -599,7 +599,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
{
// We did check for empty area already so
// this must be some other error
errorMessage = QString( "GEOSBoundary() threw an error: %1" ).arg( e.what() );
errorMessage = QStringLiteral( "GEOSBoundary() threw an error: %1" ).arg( e.what() );
GEOSGeom_destroy_r( handle, new_area );
GEOSGeom_destroy_r( handle, geos_area );
return nullptr;
@ -616,7 +616,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
GEOSGeom_destroy_r( handle, new_area );
GEOSGeom_destroy_r( handle, new_area_bound );
GEOSGeom_destroy_r( handle, geos_area );
errorMessage = QString( "GEOSSymDifference() threw an error: %1" ).arg( e.what() );
errorMessage = QStringLiteral( "GEOSSymDifference() threw an error: %1" ).arg( e.what() );
return nullptr;
}
@ -642,7 +642,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
GEOSGeom_destroy_r( handle, geos_cut_edges );
GEOSGeom_destroy_r( handle, new_area_bound );
GEOSGeom_destroy_r( handle, geos_area );
errorMessage = QString( "GEOSDifference() threw an error: %1" ).arg( e.what() );
errorMessage = QStringLiteral( "GEOSDifference() threw an error: %1" ).arg( e.what() );
return nullptr;
}
GEOSGeom_destroy_r( handle, geos_cut_edges );
@ -691,7 +691,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidPolygon( const GEOSGeometry *gin, QStr
}
catch ( GEOSException &e )
{
errorMessage = QString( "GEOSGeom_createCollection() threw an error: %1" ).arg( e.what() );
errorMessage = QStringLiteral( "GEOSGeom_createCollection() threw an error: %1" ).arg( e.what() );
// TODO: cleanup!
return nullptr;
}
@ -750,7 +750,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidMultiLine( const GEOSGeometry *gin, QS
else
{
// NOTE: return from GEOSGeomType will leak but we really don't expect this to happen
errorMessage = QString( "unexpected geom type returned by LWGEOM_GEOS_makeValid: %1" ).arg( GEOSGeomTypeId_r( handle, vg ) );
errorMessage = QStringLiteral( "unexpected geom type returned by LWGEOM_GEOS_makeValid: %1" ).arg( GEOSGeomTypeId_r( handle, vg ) );
}
}
@ -812,7 +812,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidCollection( const GEOSGeometry *gin, Q
int nvgeoms = GEOSGetNumGeometries_r( handle, gin );
if ( nvgeoms == -1 )
{
errorMessage = QString( "GEOSGetNumGeometries: %1" ).arg( "?" );
errorMessage = QStringLiteral( "GEOSGetNumGeometries: %1" ).arg( QStringLiteral( "?" ) );
return nullptr;
}
@ -839,7 +839,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidCollection( const GEOSGeometry *gin, Q
// cleanup and throw
for ( int i = 0; i < nvgeoms; ++i )
GEOSGeom_destroy_r( handle, vgeoms[i] );
errorMessage = QString( "GEOSGeom_createCollection() threw an error: %1" ).arg( e.what() );
errorMessage = QStringLiteral( "GEOSGeom_createCollection() threw an error: %1" ).arg( e.what() );
return nullptr;
}
}
@ -862,7 +862,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValid( const GEOSGeometry *gin, QString &er
catch ( GEOSException &e )
{
// I don't think should ever happen
errorMessage = QString( "GEOSisValid(): %1" ).arg( e.what() );
errorMessage = QStringLiteral( "GEOSisValid(): %1" ).arg( e.what() );
return nullptr;
}
Q_NOWARN_UNREACHABLE_POP
@ -891,7 +891,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValid( const GEOSGeometry *gin, QString &er
return LWGEOM_GEOS_makeValidCollection( gin, errorMessage );
default:
errorMessage = QString( "ST_MakeValid: doesn't support geometry type: %1" ).arg( GEOSGeomTypeId_r( handle, gin ) );
errorMessage = QStringLiteral( "ST_MakeValid: doesn't support geometry type: %1" ).arg( GEOSGeomTypeId_r( handle, gin ) );
return nullptr;
}
}
@ -922,7 +922,7 @@ QgsAbstractGeometry *_qgis_lwgeom_make_valid( const QgsAbstractGeometry *lwgeom_
if ( ! geosgeom )
{
errorMessage = "Could not convert QGIS geom to GEOS";
errorMessage = QStringLiteral( "Could not convert QGIS geom to GEOS" );
return nullptr;
}
}

View File

@ -798,7 +798,7 @@ QgsPointSequence QgsGeometryUtils::pointsFromWKT( const QString &wktCoordinateLi
//first scan through for extra unexpected dimensions
bool foundZ = false;
bool foundM = false;
QRegularExpression rx( "\\s" );
QRegularExpression rx( QStringLiteral( "\\s" ) );
for ( const QString &pointCoordinates : coordList )
{
QStringList coordinates = pointCoordinates.split( rx, QString::SkipEmptyParts );
@ -898,12 +898,12 @@ QDomElement QgsGeometryUtils::pointsToGML2( const QgsPointSequence &points, QDom
QDomElement elemCoordinates = doc.createElementNS( ns, QStringLiteral( "coordinates" ) );
// coordinate separator
QString cs = ",";
QString cs = QStringLiteral( "," );
// tupel separator
QString ts = " ";
QString ts = QStringLiteral( " " );
elemCoordinates.setAttribute( "cs", cs );
elemCoordinates.setAttribute( "ts", ts );
elemCoordinates.setAttribute( QStringLiteral( "cs" ), cs );
elemCoordinates.setAttribute( QStringLiteral( "ts" ), ts );
QString strCoordinates;
@ -969,7 +969,7 @@ QPair<QgsWkbTypes::Type, QString> QgsGeometryUtils::wktReadBlock( const QString
{
QgsWkbTypes::Type wkbType = QgsWkbTypes::parseType( wkt );
QRegularExpression cooRegEx( "^[^\\(]*\\((.*)\\)[^\\)]*$" );
QRegularExpression cooRegEx( QStringLiteral( "^[^\\(]*\\((.*)\\)[^\\)]*$" ) );
cooRegEx.setPatternOptions( QRegularExpression::DotMatchesEverythingOption );
QRegularExpressionMatch match = cooRegEx.match( wkt );
QString contents = match.hasMatch() ? match.captured( 1 ) : QString();

View File

@ -296,7 +296,7 @@ class CORE_EXPORT QgsGeometryUtils
* \returns list of WKT child block strings, e.g., List("TYPE1 (contents1)", "TYPE2 (TYPE3 (contents3), TYPE4 (contents4))")
* \note not available in Python bindings
*/
static QStringList wktGetChildBlocks( const QString &wkt, const QString &defaultType = "" ) SIP_SKIP;
static QStringList wktGetChildBlocks( const QString &wkt, const QString &defaultType = QString() ) SIP_SKIP;
/** Returns a middle point between points pt1 and pt2.
* Z value is computed if one of this point have Z.

View File

@ -262,4 +262,6 @@ class CORE_EXPORT QgsLineString: public QgsCurve
};
// clazy:excludeall=qstring-allocations
#endif // QGSLINESTRINGV2_H

View File

@ -76,4 +76,6 @@ class CORE_EXPORT QgsMultiCurve: public QgsGeometryCollection
};
// clazy:excludeall=qstring-allocations
#endif // QGSMULTICURVEV2_H

View File

@ -69,4 +69,6 @@ class CORE_EXPORT QgsMultiLineString: public QgsMultiCurve
bool wktOmitChildType() const override;
};
// clazy:excludeall=qstring-allocations
#endif // QGSMULTILINESTRINGV2_H

View File

@ -71,4 +71,6 @@ class CORE_EXPORT QgsMultiPointV2: public QgsGeometryCollection
};
// clazy:excludeall=qstring-allocations
#endif // QGSMULTIPOINTV2_H

View File

@ -71,4 +71,6 @@ class CORE_EXPORT QgsMultiPolygonV2: public QgsMultiSurface
bool wktOmitChildType() const override;
};
// clazy:excludeall=qstring-allocations
#endif // QGSMULTIPOLYGONV2_H

View File

@ -73,4 +73,6 @@ class CORE_EXPORT QgsMultiSurface: public QgsGeometryCollection
};
// clazy:excludeall=qstring-allocations
#endif // QGSMULTISURFACEV2_H

View File

@ -156,7 +156,7 @@ bool QgsPoint::fromWkt( const QString &wkt )
return false;
mWkbType = parts.first;
QRegularExpression rx( "\\s" );
QRegularExpression rx( QStringLiteral( "\\s" ) );
QStringList coordinates = parts.second.split( rx, QString::SkipEmptyParts );
if ( coordinates.size() < 2 )
{
@ -234,12 +234,12 @@ QDomElement QgsPoint::asGML2( QDomDocument &doc, int precision, const QString &n
QDomElement elemCoordinates = doc.createElementNS( ns, QStringLiteral( "coordinates" ) );
// coordinate separator
QString cs = ",";
QString cs = QStringLiteral( "," );
// tupel separator
QString ts = " ";
QString ts = QStringLiteral( " " );
elemCoordinates.setAttribute( "cs", cs );
elemCoordinates.setAttribute( "ts", ts );
elemCoordinates.setAttribute( QStringLiteral( "cs" ), cs );
elemCoordinates.setAttribute( QStringLiteral( "ts" ), ts );
QString strCoordinates = qgsDoubleToString( mX, precision ) + cs + qgsDoubleToString( mY, precision );
elemCoordinates.appendChild( doc.createTextNode( strCoordinates ) );

View File

@ -438,4 +438,6 @@ class CORE_EXPORT QgsPoint: public QgsAbstractGeometry
double mM;
};
// clazy:excludeall=qstring-allocations
#endif // QGSPOINTV2_H

View File

@ -184,7 +184,7 @@ bool QgsTriangle::fromWkt( const QString &wkt )
mWkbType = parts.first;
QString defaultChildWkbType = QStringLiteral( "LineString%1%2" ).arg( is3D() ? "Z" : QString(), isMeasure() ? "M" : QString() );
QString defaultChildWkbType = QStringLiteral( "LineString%1%2" ).arg( is3D() ? QStringLiteral( "Z" ) : QString(), isMeasure() ? QStringLiteral( "M" ) : QString() );
const QStringList blocks = QgsGeometryUtils::wktGetChildBlocks( parts.second, defaultChildWkbType );
for ( const QString &childWkt : blocks )

View File

@ -105,8 +105,8 @@ QgsLayerTreeLayer *QgsLayerTreeLayer::readXml( QDomElement &element )
QString layerID = element.attribute( QStringLiteral( "id" ) );
QString layerName = element.attribute( QStringLiteral( "name" ) );
QString providerKey = element.attribute( "providerKey" );
QString source = element.attribute( "source" );
QString providerKey = element.attribute( QStringLiteral( "providerKey" ) );
QString source = element.attribute( QStringLiteral( "source" ) );
Qt::CheckState checked = QgsLayerTreeUtils::checkStateFromXml( element.attribute( QStringLiteral( "checked" ) ) );
bool isExpanded = ( element.attribute( QStringLiteral( "expanded" ), QStringLiteral( "1" ) ) == QLatin1String( "1" ) );
@ -138,8 +138,8 @@ void QgsLayerTreeLayer::writeXml( QDomElement &parentElement )
if ( mRef )
{
elem.setAttribute( "source", mRef->publicSource() );
elem.setAttribute( "providerKey", mRef->dataProvider() ? mRef->dataProvider()->name() : QString() );
elem.setAttribute( QStringLiteral( "source" ), mRef->publicSource() );
elem.setAttribute( QStringLiteral( "providerKey" ), mRef->dataProvider() ? mRef->dataProvider()->name() : QString() );
}
elem.setAttribute( QStringLiteral( "checked" ), mChecked ? QStringLiteral( "Qt::Checked" ) : QStringLiteral( "Qt::Unchecked" ) );

View File

@ -304,7 +304,7 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const
if ( !layer->abstract().isEmpty() )
parts << "<br/>" + layer->abstract().replace( QLatin1String( "\n" ), QLatin1String( "<br/>" ) );
parts << "<i>" + layer->publicSource() + "</i>";
return parts.join( "<br/>" );
return parts.join( QStringLiteral( "<br/>" ) );
}
}
}

View File

@ -111,7 +111,7 @@ static QDomElement _writeOldLegendLayer( QDomDocument &doc, QgsLayerTreeLayer *n
QDomElement layerElem = doc.createElement( QStringLiteral( "legendlayer" ) );
layerElem.setAttribute( QStringLiteral( "drawingOrder" ), drawingOrder );
layerElem.setAttribute( QStringLiteral( "open" ), nodeLayer->isExpanded() ? "true" : "false" );
layerElem.setAttribute( QStringLiteral( "open" ), nodeLayer->isExpanded() ? QStringLiteral( "true" ) : QStringLiteral( "false" ) );
layerElem.setAttribute( QStringLiteral( "checked" ), QgsLayerTreeUtils::checkStateToXml( nodeLayer->itemVisibilityChecked() ? Qt::Checked : Qt::Unchecked ) );
layerElem.setAttribute( QStringLiteral( "name" ), nodeLayer->name() );
layerElem.setAttribute( QStringLiteral( "showFeatureCount" ), nodeLayer->customProperty( QStringLiteral( "showFeatureCount" ) ).toInt() );
@ -170,7 +170,7 @@ static void _writeOldLegendGroupChildren( QDomDocument &doc, QDomElement &groupE
QDomElement QgsLayerTreeUtils::writeOldLegend( QDomDocument &doc, QgsLayerTreeGroup *root, bool hasCustomOrder, const QList<QgsMapLayer *> &order )
{
QDomElement legendElem = doc.createElement( QStringLiteral( "legend" ) );
legendElem.setAttribute( QStringLiteral( "updateDrawingOrder" ), hasCustomOrder ? "false" : "true" );
legendElem.setAttribute( QStringLiteral( "updateDrawingOrder" ), hasCustomOrder ? QStringLiteral( "false" ) : QStringLiteral( "true" ) );
_writeOldLegendGroupChildren( doc, legendElem, root, hasCustomOrder, order );

View File

@ -293,7 +293,7 @@ bool QgsLayout::readXmlLayoutSettings( const QDomElement &layoutElement, const Q
bool QgsLayout::readXml( const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context )
{
if ( layoutElement.nodeName() != QString( "Layout" ) )
if ( layoutElement.nodeName() != QStringLiteral( "Layout" ) )
{
return false;
}

View File

@ -197,7 +197,7 @@ QgsLayoutGuideCollection::QgsLayoutGuideCollection( QgsLayout *layout, QgsLayout
, mPageCollection( pageCollection )
{
QFont f;
mHeaderSize = QFontMetrics( f ).width( "XX" );
mHeaderSize = QFontMetrics( f ).width( QStringLiteral( "XX" ) );
connect( mPageCollection, &QgsLayoutPageCollection::pageAboutToBeRemoved, this, &QgsLayoutGuideCollection::pageAboutToBeRemoved );
}

View File

@ -242,8 +242,8 @@ double QgsLayoutItem::itemRotation() const
bool QgsLayoutItem::writeXml( QDomElement &parentElement, QDomDocument &doc, const QgsReadWriteContext &context ) const
{
QDomElement element = doc.createElement( "LayoutItem" );
element.setAttribute( "type", stringType() );
QDomElement element = doc.createElement( QStringLiteral( "LayoutItem" ) );
element.setAttribute( QStringLiteral( "type" ), stringType() );
writePropertiesToElement( element, doc, context );
parentElement.appendChild( element );
@ -253,7 +253,7 @@ bool QgsLayoutItem::writeXml( QDomElement &parentElement, QDomDocument &doc, con
bool QgsLayoutItem::readXml( const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context )
{
if ( itemElem.nodeName() != QString( "LayoutItem" ) || itemElem.attribute( "type" ) != stringType() )
if ( itemElem.nodeName() != QStringLiteral( "LayoutItem" ) || itemElem.attribute( QStringLiteral( "type" ) ) != stringType() )
{
return false;
}

View File

@ -37,7 +37,7 @@ QgsLayoutItemPage::QgsLayoutItemPage( QgsLayout *layout )
QFont font;
QFontMetrics fm( font );
mMaximumShadowWidth = fm.width( "X" );
mMaximumShadowWidth = fm.width( QStringLiteral( "X" ) );
mGrid.reset( new QgsLayoutItemPageGrid( pos().x(), pos().y(), rect().width(), rect().height(), mLayout ) );
mGrid->setParentItem( this );

View File

@ -96,7 +96,7 @@ QVariant QgsLocatorModel::data( const QModelIndex &index, int role ) const
QIcon icon = mResults.at( index.row() ).result.icon;
if ( !icon.isNull() )
return icon;
return QgsApplication::getThemeIcon( "/search.svg" );
return QgsApplication::getThemeIcon( QStringLiteral( "/search.svg" ) );
}
else
return QVariant();

View File

@ -180,9 +180,9 @@ QStringList QgsLayerMetadata::keywords( const QString &vocabulary ) const
QStringList QgsLayerMetadata::categories() const
{
if ( mKeywords.contains( "gmd:topicCategory" ) )
if ( mKeywords.contains( QStringLiteral( "gmd:topicCategory" ) ) )
{
return mKeywords.value( "gmd:topicCategory" );
return mKeywords.value( QStringLiteral( "gmd:topicCategory" ) );
}
else
{
@ -192,7 +192,7 @@ QStringList QgsLayerMetadata::categories() const
void QgsLayerMetadata::setCategories( const QStringList &category )
{
mKeywords.insert( "gmd:topicCategory", category );
mKeywords.insert( QStringLiteral( "gmd:topicCategory" ), category );
}
QList<QgsLayerMetadata::Contact> QgsLayerMetadata::contacts() const
@ -410,8 +410,8 @@ bool QgsLayerMetadata::readMetadataXml( const QDomElement &metadataElement )
QDomNodeList periodList = mnl.toElement().elementsByTagName( QStringLiteral( "period" ) );
for ( int i = 0; i < periodList.size(); i++ )
{
QDomNode begin = periodList.at( i ).namedItem( "start" );
QDomNode end = periodList.at( i ).namedItem( "end" );
QDomNode begin = periodList.at( i ).namedItem( QStringLiteral( "start" ) );
QDomNode end = periodList.at( i ).namedItem( QStringLiteral( "end" ) );
QDateTime beginDate = QDateTime().fromString( begin.toElement().text(), Qt::ISODate );
QDateTime endDate = QDateTime().fromString( end.toElement().text(), Qt::ISODate );
QgsDateTimeRange date = QgsDateTimeRange( beginDate, endDate );

View File

@ -12,10 +12,10 @@ QgsLayerMetadataFormatter::QgsLayerMetadataFormatter( const QgsLayerMetadata &me
QString QgsLayerMetadataFormatter::accessSectionHtml() const
{
QString myMetadata = QStringLiteral( "<table class=\"list-view\">\n" );
myMetadata += QLatin1String( "<tr><td class=\"highlight\">" ) + QObject::tr( "Fees" ) + QLatin1String( "</td><td>" ) + mMetadata.fees() + QLatin1String( "</td></tr>\n" );
myMetadata += QLatin1String( "<tr><td class=\"highlight\">" ) + QObject::tr( "Licenses" ) + QLatin1String( "</td><td>" ) + mMetadata.licenses().join( QStringLiteral( "<br />" ) ) + QLatin1String( "</td></tr>\n" );
myMetadata += QLatin1String( "<tr><td class=\"highlight\">" ) + QObject::tr( "Rights" ) + QLatin1String( "</td><td>" ) + mMetadata.rights().join( QStringLiteral( "<br />" ) ) + QLatin1String( "</td></tr>\n" );
myMetadata += QLatin1String( "<tr><td class=\"highlight\">" ) + QObject::tr( "Constraints" ) + QLatin1String( "</td><td>" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Fees" ) + QStringLiteral( "</td><td>" ) + mMetadata.fees() + QStringLiteral( "</td></tr>\n" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Licenses" ) + QStringLiteral( "</td><td>" ) + mMetadata.licenses().join( QStringLiteral( "<br />" ) ) + QStringLiteral( "</td></tr>\n" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Rights" ) + QStringLiteral( "</td><td>" ) + mMetadata.rights().join( QStringLiteral( "<br />" ) ) + QStringLiteral( "</td></tr>\n" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Constraints" ) + QStringLiteral( "</td><td>" );
const QList<QgsLayerMetadata::Constraint> &constraints = mMetadata.constraints();
bool notFirstRow = false;
for ( const QgsLayerMetadata::Constraint &constraint : constraints )
@ -24,11 +24,11 @@ QString QgsLayerMetadataFormatter::accessSectionHtml() const
{
myMetadata += QLatin1String( "<br />" );
}
myMetadata += QLatin1String( "<strong>" ) + constraint.type + QLatin1String( ": </strong>" ) + constraint.constraint;
myMetadata += QStringLiteral( "<strong>" ) + constraint.type + QStringLiteral( ": </strong>" ) + constraint.constraint;
notFirstRow = true;
}
myMetadata += QLatin1String( "</td></tr>\n" );
mMetadata.rights().join( QStringLiteral( "<br />" ) ) + QLatin1String( "</td></tr>\n" );
mMetadata.rights().join( QStringLiteral( "<br />" ) ) + QStringLiteral( "</td></tr>\n" );
myMetadata += QLatin1String( "</table>\n" );
return myMetadata;
}
@ -39,7 +39,7 @@ QString QgsLayerMetadataFormatter::contactsSectionHtml() const
QString myMetadata;
if ( contacts.isEmpty() )
{
myMetadata += QLatin1String( "<p>" ) + QObject::tr( "No contact yet." ) + QLatin1String( "</p>" );
myMetadata += QStringLiteral( "<p>" ) + QObject::tr( "No contact yet." ) + QStringLiteral( "</p>" );
}
else
{
@ -50,7 +50,7 @@ QString QgsLayerMetadataFormatter::contactsSectionHtml() const
{
QString rowClass;
if ( i % 2 )
rowClass = QString( "class=\"odd-row\"" );
rowClass = QStringLiteral( "class=\"odd-row\"" );
myMetadata += "<tr " + rowClass + "><td>" + QString::number( i ) + "</td><td>" + contact.name + "</td><td>" + contact.position + "</td><td>" + contact.organization + "</td><td>" + contact.role + "</td><td>" + contact.email + "</td><td>" + contact.voice + "</td><td>" + contact.fax + "</td><td>";
bool notFirstRow = false;
for ( const QgsLayerMetadata::Address &oneAddress : contact.addresses )
@ -61,23 +61,23 @@ QString QgsLayerMetadataFormatter::contactsSectionHtml() const
}
if ( ! oneAddress.type.isEmpty() )
{
myMetadata += oneAddress.type + QLatin1String( "<br />" );
myMetadata += oneAddress.type + QStringLiteral( "<br />" );
}
if ( ! oneAddress.address.isEmpty() )
{
myMetadata += oneAddress.address + QLatin1String( "<br />" );
myMetadata += oneAddress.address + QStringLiteral( "<br />" );
}
if ( ! oneAddress.postalCode.isEmpty() )
{
myMetadata += oneAddress.postalCode + QLatin1String( "<br />" );
myMetadata += oneAddress.postalCode + QStringLiteral( "<br />" );
}
if ( ! oneAddress.city.isEmpty() )
{
myMetadata += oneAddress.city + QLatin1String( "<br />" );
myMetadata += oneAddress.city + QStringLiteral( "<br />" );
}
if ( ! oneAddress.administrativeArea.isEmpty() )
{
myMetadata += oneAddress.administrativeArea + QLatin1String( "<br />" );
myMetadata += oneAddress.administrativeArea + QStringLiteral( "<br />" );
}
if ( ! oneAddress.country.isEmpty() )
{
@ -85,7 +85,7 @@ QString QgsLayerMetadataFormatter::contactsSectionHtml() const
}
notFirstRow = true;
}
myMetadata += "</td></tr>\n";
myMetadata += QLatin1String( "</td></tr>\n" );
i++;
}
myMetadata += QLatin1String( "</table>\n" );
@ -96,8 +96,8 @@ QString QgsLayerMetadataFormatter::contactsSectionHtml() const
QString QgsLayerMetadataFormatter::extentSectionHtml() const
{
QString myMetadata = QStringLiteral( "<table class=\"list-view\">\n" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "CRS" ) + QLatin1String( "</td><td>" ) + mMetadata.crs().authid() + QLatin1String( " - " );
myMetadata += mMetadata.crs().description() + QLatin1String( " - " );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "CRS" ) + QStringLiteral( "</td><td>" ) + mMetadata.crs().authid() + QStringLiteral( " - " );
myMetadata += mMetadata.crs().description() + QStringLiteral( " - " );
if ( mMetadata.crs().isGeographic() )
myMetadata += QObject::tr( "Geographic" );
else
@ -105,7 +105,7 @@ QString QgsLayerMetadataFormatter::extentSectionHtml() const
myMetadata += QLatin1String( "</td></tr>\n" );
const QgsLayerMetadata::Extent extent = mMetadata.extent();
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Spatial Extent" ) + QLatin1String( "</td><td>" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Spatial Extent" ) + QStringLiteral( "</td><td>" );
const QList< QgsLayerMetadata::SpatialExtent > spatialExtents = extent.spatialExtents();
bool notFirstRow = false;
for ( const QgsLayerMetadata::SpatialExtent &spatialExtent : spatialExtents )
@ -114,8 +114,8 @@ QString QgsLayerMetadataFormatter::extentSectionHtml() const
{
myMetadata += QLatin1String( "<br />\n" );
}
myMetadata += QStringLiteral( "<strong>" ) + QObject::tr( "CRS" ) + QStringLiteral( ": </strong>" ) + spatialExtent.extentCrs.authid() + QLatin1String( " - " );
myMetadata += spatialExtent.extentCrs.description() + QLatin1String( " - " );
myMetadata += QStringLiteral( "<strong>" ) + QObject::tr( "CRS" ) + QStringLiteral( ": </strong>" ) + spatialExtent.extentCrs.authid() + QStringLiteral( " - " );
myMetadata += spatialExtent.extentCrs.description() + QStringLiteral( " - " );
if ( spatialExtent.extentCrs.isGeographic() )
myMetadata += QObject::tr( "Geographic" );
else
@ -133,7 +133,7 @@ QString QgsLayerMetadataFormatter::extentSectionHtml() const
notFirstRow = true;
}
myMetadata += QLatin1String( "</td></tr>\n" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Temporal Extent" ) + QLatin1String( "</td><td>" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Temporal Extent" ) + QStringLiteral( "</td><td>" );
const QList< QgsDateTimeRange > temporalExtents = extent.temporalExtents();
notFirstRow = false;
for ( const QgsDateTimeRange &temporalExtent : temporalExtents )
@ -163,28 +163,28 @@ QString QgsLayerMetadataFormatter::identificationSectionHtml() const
QString myMetadata = QStringLiteral( "<table class=\"list-view\">\n" );
// Identifier
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Identifier" ) + QLatin1String( "</td><td>" ) + mMetadata.identifier() + QLatin1String( "</td></tr>\n" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Identifier" ) + QStringLiteral( "</td><td>" ) + mMetadata.identifier() + QStringLiteral( "</td></tr>\n" );
// Parent Identifier
myMetadata += QLatin1String( "<tr><td class=\"highlight\">" ) + QObject::tr( "Parent Identifier" ) + QLatin1String( "</td><td>" ) + mMetadata.parentIdentifier() + QLatin1String( "</td></tr>\n" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Parent Identifier" ) + QStringLiteral( "</td><td>" ) + mMetadata.parentIdentifier() + QStringLiteral( "</td></tr>\n" );
// Title
myMetadata += QLatin1String( "<tr><td class=\"highlight\">" ) + QObject::tr( "Title" ) + QLatin1String( "</td><td>" ) + mMetadata.title() + QLatin1String( "</td></tr>\n" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Title" ) + QStringLiteral( "</td><td>" ) + mMetadata.title() + QStringLiteral( "</td></tr>\n" );
// Type
myMetadata += QLatin1String( "<tr><td class=\"highlight\">" ) + QObject::tr( "Type" ) + QLatin1String( "</td><td>" ) + mMetadata.type() + QLatin1String( "</td></tr>\n" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Type" ) + QStringLiteral( "</td><td>" ) + mMetadata.type() + QStringLiteral( "</td></tr>\n" );
// Language
myMetadata += QLatin1String( "<tr><td class=\"highlight\">" ) + QObject::tr( "Language" ) + QLatin1String( "</td><td>" ) + mMetadata.language() + QLatin1String( "</td></tr>\n" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Language" ) + QStringLiteral( "</td><td>" ) + mMetadata.language() + QStringLiteral( "</td></tr>\n" );
// Abstract
myMetadata += QLatin1String( "<tr><td class=\"highlight\">" ) + QObject::tr( "Abstract" ) + QLatin1String( "</td><td>" ) + mMetadata.abstract() + QLatin1String( "</td></tr>\n" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Abstract" ) + QStringLiteral( "</td><td>" ) + mMetadata.abstract() + QStringLiteral( "</td></tr>\n" );
// Categories
myMetadata += QLatin1String( "<tr><td class=\"highlight\">" ) + QObject::tr( "Categories" ) + QLatin1String( "</td><td>" ) + mMetadata.categories().join( QStringLiteral( ", " ) ) + QLatin1String( "</td></tr>\n" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Categories" ) + QStringLiteral( "</td><td>" ) + mMetadata.categories().join( QStringLiteral( ", " ) ) + QStringLiteral( "</td></tr>\n" );
// Keywords
myMetadata += QLatin1String( "<tr><td class=\"highlight\">" ) + QObject::tr( "Keywords" ) + QLatin1String( "</td><td>\n" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + QObject::tr( "Keywords" ) + QStringLiteral( "</td><td>\n" );
QMapIterator<QString, QStringList> i( mMetadata.keywords() );
if ( i.hasNext() )
{
@ -196,7 +196,7 @@ QString QgsLayerMetadataFormatter::identificationSectionHtml() const
i.next();
QString rowClass;
if ( j % 2 )
rowClass = QString( "class=\"odd-row\"" );
rowClass = QStringLiteral( "class=\"odd-row\"" );
myMetadata += "<tr " + rowClass + "><td>" + i.key() + "</td><td>" + i.value().join( QStringLiteral( ", " ) ) + "</td></tr>\n";
j++;
}
@ -213,7 +213,7 @@ QString QgsLayerMetadataFormatter::historySectionHtml() const
const QStringList historyItems = mMetadata.history();
if ( historyItems.isEmpty() )
{
myMetadata += QLatin1String( "<p>" ) + QObject::tr( "No history yet." ) + QLatin1String( "</p>\n" );
myMetadata += QStringLiteral( "<p>" ) + QObject::tr( "No history yet." ) + QStringLiteral( "</p>\n" );
}
else
{
@ -224,7 +224,7 @@ QString QgsLayerMetadataFormatter::historySectionHtml() const
{
QString rowClass;
if ( i % 2 )
rowClass = QString( "class=\"odd-row\"" );
rowClass = QStringLiteral( "class=\"odd-row\"" );
myMetadata += "<tr " + rowClass + "><td width=\"5%\">" + QString::number( i ) + "</td><td>" + history + "</td></tr>\n";
i++;
}
@ -239,7 +239,7 @@ QString QgsLayerMetadataFormatter::linksSectionHtml() const
const QList<QgsLayerMetadata::Link> &links = mMetadata.links();
if ( links.isEmpty() )
{
myMetadata += QLatin1String( "<p>" ) + QObject::tr( "No links yet." ) + QLatin1String( "</p>\n" );
myMetadata += QStringLiteral( "<p>" ) + QObject::tr( "No links yet." ) + QStringLiteral( "</p>\n" );
}
else
{
@ -250,7 +250,7 @@ QString QgsLayerMetadataFormatter::linksSectionHtml() const
{
QString rowClass;
if ( i % 2 )
rowClass = QString( "class=\"odd-row\"" );
rowClass = QStringLiteral( "class=\"odd-row\"" );
myMetadata += "<tr " + rowClass + "><td>" + QString::number( i ) + "</td><td>" + link.name + "</td><td>" + link.type + "</td><td>" + link.url + "</td><td>" + link.description + "</td><td>" + link.format + "</td><td>" + link.mimeType + "</td><td>" + link.size + "</td></tr>\n";
i++;
}

View File

@ -341,7 +341,7 @@ QString QgsProcessingModelAlgorithm::asPythonCode() const
auto safeName = []( const QString & name )->QString
{
QString n = name.toLower().trimmed();
QRegularExpression rx( "[^a-z_]" );
QRegularExpression rx( QStringLiteral( "[^a-z_]" ) );
n.replace( rx, QString() );
return n;
};
@ -416,7 +416,7 @@ QMap<QString, QgsProcessingModelAlgorithm::VariableDefinition> QgsProcessingMode
auto safeName = []( const QString & name )->QString
{
QString s = name;
return s.replace( QRegularExpression( "[\\s'\"\\(\\):]" ), QStringLiteral( "_" ) );
return s.replace( QRegularExpression( QStringLiteral( "[\\s'\"\\(\\):]" ) ), QStringLiteral( "_" ) );
};
// "static"/single value sources
@ -789,7 +789,7 @@ QVariant QgsProcessingModelAlgorithm::toVariant() const
{
childMap.insert( childIt.key(), childIt.value().toVariant() );
}
map.insert( "children", childMap );
map.insert( QStringLiteral( "children" ), childMap );
QVariantMap paramMap;
QMap< QString, QgsProcessingModelParameter >::const_iterator paramIt = mParameterComponents.constBegin();
@ -797,14 +797,14 @@ QVariant QgsProcessingModelAlgorithm::toVariant() const
{
paramMap.insert( paramIt.key(), paramIt.value().toVariant() );
}
map.insert( "parameters", paramMap );
map.insert( QStringLiteral( "parameters" ), paramMap );
QVariantMap paramDefMap;
Q_FOREACH ( const QgsProcessingParameterDefinition *def, mParameters )
{
paramDefMap.insert( def->name(), def->toVariantMap() );
}
map.insert( "parameterDefinitions", paramDefMap );
map.insert( QStringLiteral( "parameterDefinitions" ), paramDefMap );
return map;
}
@ -865,7 +865,7 @@ bool QgsProcessingModelAlgorithm::loadVariant( const QVariant &model )
bool QgsProcessingModelAlgorithm::toFile( const QString &path ) const
{
QDomDocument doc = QDomDocument( "model" );
QDomDocument doc = QDomDocument( QStringLiteral( "model" ) );
QDomElement elem = QgsXmlUtils::writeVariant( toVariant(), doc );
doc.appendChild( elem );

View File

@ -97,7 +97,7 @@ QVariant QgsProcessingModelChildAlgorithm::toVariant() const
}
paramMap.insert( paramIt.key(), sources );
}
map.insert( "params", paramMap );
map.insert( QStringLiteral( "params" ), paramMap );
QVariantMap outputMap;
QMap< QString, QgsProcessingModelOutput >::const_iterator outputIt = mModelOutputs.constBegin();
@ -105,7 +105,7 @@ QVariant QgsProcessingModelChildAlgorithm::toVariant() const
{
outputMap.insert( outputIt.key(), outputIt.value().toVariant() );
}
map.insert( "outputs", outputMap );
map.insert( QStringLiteral( "outputs" ), outputMap );
return map;
}

View File

@ -44,7 +44,7 @@ QgsProcessingAlgorithm *QgsProcessingAlgorithm::create( const QVariantMap &confi
QString QgsProcessingAlgorithm::id() const
{
if ( mProvider )
return QString( "%1:%2" ).arg( mProvider->id(), name() );
return QStringLiteral( "%1:%2" ).arg( mProvider->id(), name() );
else
return name();
}
@ -71,7 +71,7 @@ QIcon QgsProcessingAlgorithm::icon() const
QString QgsProcessingAlgorithm::svgIconPath() const
{
return QgsApplication::iconPath( "processingAlgorithm.svg" );
return QgsApplication::iconPath( QStringLiteral( "processingAlgorithm.svg" ) );
}
QgsProcessingAlgorithm::Flags QgsProcessingAlgorithm::flags() const

View File

@ -876,6 +876,8 @@ class CORE_EXPORT QgsProcessingFeatureBasedAlgorithm : public QgsProcessingAlgor
};
// clazy:excludeall=qstring-allocations
#endif // QGSPROCESSINGALGORITHM_H

View File

@ -1141,7 +1141,7 @@ QgsProcessingParameterDefinition *QgsProcessingParameters::parameterFromScriptCo
bool QgsProcessingParameters::parseScriptCodeParameterOptions( const QString &code, bool &isOptional, QString &name, QString &type, QString &definition )
{
QRegularExpression re( "(?:#*)(.*?)=\\s*(.*)" );
QRegularExpression re( QStringLiteral( "(?:#*)(.*?)=\\s*(.*)" ) );
QRegularExpressionMatch m = re.match( code );
if ( !m.hasMatch() )
return false;
@ -1160,7 +1160,7 @@ bool QgsProcessingParameters::parseScriptCodeParameterOptions( const QString &co
tokens = tokens.trimmed();
QRegularExpression re2( "(.*?)\\s+(.*)" );
QRegularExpression re2( QStringLiteral( "(.*?)\\s+(.*)" ) );
m = re2.match( tokens );
if ( !m.hasMatch() )
{
@ -1922,7 +1922,7 @@ QgsProcessingParameterMultipleLayers *QgsProcessingParameterMultipleLayers::from
{
QString type = definition;
QString defaultVal;
QRegularExpression re( "(.*?)\\s+(.*)" );
QRegularExpression re( QStringLiteral( "(.*?)\\s+(.*)" ) );
QRegularExpressionMatch m = re.match( definition );
if ( m.hasMatch() )
{
@ -2349,7 +2349,7 @@ QgsProcessingParameterEnum *QgsProcessingParameterEnum::fromScriptCode( const QS
def = def.mid( 9 );
}
QRegularExpression re( "(.*)\\s+(.*?)$" );
QRegularExpression re( QStringLiteral( "(.*)\\s+(.*?)$" ) );
QRegularExpressionMatch m = re.match( def );
QString values = def;
if ( m.hasMatch() )
@ -2788,7 +2788,7 @@ QgsProcessingParameterField *QgsProcessingParameterField::fromScriptCode( const
def = def.mid( 8 ).trimmed();
}
QRegularExpression re( "(.*?)\\s+(.*)$" );
QRegularExpression re( QStringLiteral( "(.*?)\\s+(.*)$" ) );
QRegularExpressionMatch m = re.match( def );
if ( m.hasMatch() )
{
@ -3320,7 +3320,7 @@ QString QgsProcessingParameterFileDestination::defaultFileExtension() const
return QStringLiteral( "file" );
// get first extension from filter
QRegularExpression rx( ".*?\\(\\*\\.([a-zA-Z0-9._]+).*" );
QRegularExpression rx( QStringLiteral( ".*?\\(\\*\\.([a-zA-Z0-9._]+).*" ) );
QRegularExpressionMatch match = rx.match( mFileFilter );
if ( !match.hasMatch() )
return QStringLiteral( "file" );
@ -3700,7 +3700,7 @@ QgsProcessingParameterBand *QgsProcessingParameterBand::fromScriptCode( const QS
QString parent;
QString def = definition;
QRegularExpression re( "(.*?)\\s+(.*)$" );
QRegularExpression re( QStringLiteral( "(.*?)\\s+(.*)$" ) );
QRegularExpressionMatch m = re.match( def );
if ( m.hasMatch() )
{

View File

@ -1976,6 +1976,8 @@ class CORE_EXPORT QgsProcessingParameterBand : public QgsProcessingParameterDefi
QString mParentLayerParameterName;
};
// clazy:excludeall=qstring-allocations
#endif // QGSPROCESSINGPARAMETERS_H

View File

@ -36,7 +36,7 @@ QIcon QgsProcessingProvider::icon() const
QString QgsProcessingProvider::svgIconPath() const
{
return QgsApplication::iconPath( "processingAlgorithm.svg" );
return QgsApplication::iconPath( QStringLiteral( "processingAlgorithm.svg" ) );
}
void QgsProcessingProvider::refreshAlgorithms()

View File

@ -282,13 +282,13 @@ QString QgsProcessingUtils::normalizeLayerSource( const QString &source )
{
QString normalized = source;
normalized.replace( '\\', '/' );
normalized.replace( '"', "'" );
normalized.replace( '"', QLatin1String( "'" ) );
return normalized.trimmed();
}
void parseDestinationString( QString &destination, QString &providerKey, QString &uri, QString &format, QMap<QString, QVariant> &options )
{
QRegularExpression splitRx( "^(.{3,}):(.*)$" );
QRegularExpression splitRx( QStringLiteral( "^(.{3,}):(.*)$" ) );
QRegularExpressionMatch match = splitRx.match( destination );
if ( match.hasMatch() )
{
@ -302,7 +302,7 @@ void parseDestinationString( QString &destination, QString &providerKey, QString
else
{
providerKey = QStringLiteral( "ogr" );
QRegularExpression splitRx( "^(.*)\\.(.*?)$" );
QRegularExpression splitRx( QStringLiteral( "^(.*)\\.(.*?)$" ) );
QRegularExpressionMatch match = splitRx.match( destination );
QString extension;
if ( match.hasMatch() )
@ -359,7 +359,7 @@ QgsFeatureSink *QgsProcessingUtils::createFeatureSink( QString &destination, Qgs
QString format;
parseDestinationString( destination, providerKey, uri, format, options );
if ( providerKey == "ogr" )
if ( providerKey == QLatin1String( "ogr" ) )
{
// use QgsVectorFileWriter for OGR destinations instead of QgsVectorLayerImport, as that allows
// us to use any OGR format which supports feature addition
@ -511,7 +511,7 @@ QString QgsProcessingUtils::formatHelpMapAsHtml( const QVariantMap &map, const Q
s += QStringLiteral( "<h3>" ) + def->description() + QStringLiteral( "</h3>\n" );
s += QStringLiteral( "<p>" ) + getText( def->name() ) + QStringLiteral( "</p>\n" );
}
s += "<br>";
s += QLatin1String( "<br>" );
s += QObject::tr( "<p align=\"right\">Algorithm author: %1</p>" ).arg( getText( QStringLiteral( "ALG_CREATOR" ) ) );
s += QObject::tr( "<p align=\"right\">Help author: %1</p>" ).arg( getText( QStringLiteral( "ALG_HELP_CREATOR" ) ) );
s += QObject::tr( "<p align=\"right\">Algorithm version: %1</p>" ).arg( getText( QStringLiteral( "ALG_VERSION" ) ) );

View File

@ -95,7 +95,7 @@ void QgsAction::setActionScopes( const QSet<QString> &actionScopes )
void QgsAction::readXml( const QDomNode &actionNode )
{
QDomElement actionElement = actionNode.toElement();
QDomNodeList actionScopeNodes = actionElement.elementsByTagName( "actionScope" );
QDomNodeList actionScopeNodes = actionElement.elementsByTagName( QStringLiteral( "actionScope" ) );
if ( actionScopeNodes.isEmpty() )
{
@ -109,7 +109,7 @@ void QgsAction::readXml( const QDomNode &actionNode )
for ( int j = 0; j < actionScopeNodes.length(); ++j )
{
QDomElement actionScopeElem = actionScopeNodes.item( j ).toElement();
mActionScopes << actionScopeElem.attribute( "id" );
mActionScopes << actionScopeElem.attribute( QStringLiteral( "id" ) );
}
}
@ -139,8 +139,8 @@ void QgsAction::writeXml( QDomNode &actionsNode ) const
Q_FOREACH ( const QString &scope, mActionScopes )
{
QDomElement actionScopeElem = actionsNode.ownerDocument().createElement( "actionScope" );
actionScopeElem.setAttribute( "id", scope );
QDomElement actionScopeElem = actionsNode.ownerDocument().createElement( QStringLiteral( "actionScope" ) );
actionScopeElem.setAttribute( QStringLiteral( "id" ), scope );
actionSetting.appendChild( actionScopeElem );
}

View File

@ -256,12 +256,12 @@ bool QgsActionManager::readXml( const QDomNode &layer_node )
addAction( action );
}
QDomNodeList defaultActionNodes = aaNode.toElement().elementsByTagName( "defaultAction" );
QDomNodeList defaultActionNodes = aaNode.toElement().elementsByTagName( QStringLiteral( "defaultAction" ) );
for ( int i = 0; i < defaultActionNodes.size(); ++i )
{
QDomElement defaultValueElem = defaultActionNodes.at( i ).toElement();
mDefaultActions.insert( defaultValueElem.attribute( "key" ), defaultValueElem.attribute( "value" ) );
mDefaultActions.insert( defaultValueElem.attribute( QStringLiteral( "key" ) ), defaultValueElem.attribute( QStringLiteral( "value" ) ) );
}
}
return true;

View File

@ -735,4 +735,6 @@ class CORE_EXPORT QgsApplication : public QApplication
static ApplicationMembers *members();
};
// clazy:excludeall=qstring-allocations
#endif

View File

@ -630,5 +630,6 @@ class CORE_EXPORT QgsCptCityColorRamp : public QgsGradientColorRamp
};
// clazy:excludeall=qstring-allocations
#endif

View File

@ -120,7 +120,7 @@ QList<long> QgsCoordinateReferenceSystem::validSrsIds()
continue;
}
QString sql = "select srs_id from tbl_srs";
QString sql = QStringLiteral( "select srs_id from tbl_srs" );
( void )sqlite3_prepare( database, sql.toUtf8(),
sql.toUtf8().length(),
&statement, &tail );

View File

@ -317,18 +317,18 @@ QgsDataDefinedSizeLegend *QgsDataDefinedSizeLegend::readXml( const QDomElement &
if ( elem.isNull() )
return nullptr;
QgsDataDefinedSizeLegend *ddsLegend = new QgsDataDefinedSizeLegend;
ddsLegend->setLegendType( elem.attribute( "type" ) == "collapsed" ? LegendCollapsed : LegendSeparated );
ddsLegend->setVerticalAlignment( elem.attribute( "valign" ) == "center" ? AlignCenter : AlignBottom );
ddsLegend->setTitle( elem.attribute( "title" ) );
ddsLegend->setLegendType( elem.attribute( QStringLiteral( "type" ) ) == QLatin1String( "collapsed" ) ? LegendCollapsed : LegendSeparated );
ddsLegend->setVerticalAlignment( elem.attribute( QStringLiteral( "valign" ) ) == QLatin1String( "center" ) ? AlignCenter : AlignBottom );
ddsLegend->setTitle( elem.attribute( QStringLiteral( "title" ) ) );
QDomElement elemSymbol = elem.firstChildElement( "symbol" );
QDomElement elemSymbol = elem.firstChildElement( QStringLiteral( "symbol" ) );
if ( !elemSymbol.isNull() )
{
ddsLegend->setSymbol( QgsSymbolLayerUtils::loadSymbol<QgsMarkerSymbol>( elemSymbol, context ) );
}
QgsSizeScaleTransformer *transformer = nullptr;
QDomElement elemTransformer = elem.firstChildElement( "transformer" );
QDomElement elemTransformer = elem.firstChildElement( QStringLiteral( "transformer" ) );
if ( !elemTransformer.isNull() )
{
transformer = new QgsSizeScaleTransformer;
@ -336,27 +336,27 @@ QgsDataDefinedSizeLegend *QgsDataDefinedSizeLegend::readXml( const QDomElement &
}
ddsLegend->setSizeScaleTransformer( transformer );
QDomElement elemTextStyle = elem.firstChildElement( "text-style" );
QDomElement elemTextStyle = elem.firstChildElement( QStringLiteral( "text-style" ) );
if ( !elemTextStyle.isNull() )
{
QDomElement elemFont = elemTextStyle.firstChildElement( "font" );
QDomElement elemFont = elemTextStyle.firstChildElement( QStringLiteral( "font" ) );
if ( !elemFont.isNull() )
{
ddsLegend->setFont( QFont( elemFont.attribute( "family" ), elemFont.attribute( "size" ).toInt(),
elemFont.attribute( "weight" ).toInt(), elemFont.attribute( "italic" ).toInt() ) );
ddsLegend->setFont( QFont( elemFont.attribute( QStringLiteral( "family" ) ), elemFont.attribute( QStringLiteral( "size" ) ).toInt(),
elemFont.attribute( QStringLiteral( "weight" ) ).toInt(), elemFont.attribute( QStringLiteral( "italic" ) ).toInt() ) );
}
ddsLegend->setTextColor( QgsSymbolLayerUtils::decodeColor( elemTextStyle.attribute( "color" ) ) );
ddsLegend->setTextAlignment( static_cast<Qt::AlignmentFlag>( elemTextStyle.attribute( "align" ).toInt() ) );
ddsLegend->setTextColor( QgsSymbolLayerUtils::decodeColor( elemTextStyle.attribute( QStringLiteral( "color" ) ) ) );
ddsLegend->setTextAlignment( static_cast<Qt::AlignmentFlag>( elemTextStyle.attribute( QStringLiteral( "align" ) ).toInt() ) );
}
QDomElement elemClasses = elem.firstChildElement( "classes" );
QDomElement elemClasses = elem.firstChildElement( QStringLiteral( "classes" ) );
if ( !elemClasses.isNull() )
{
QList<SizeClass> classes;
QDomElement elemClass = elemClasses.firstChildElement( "class" );
QDomElement elemClass = elemClasses.firstChildElement( QStringLiteral( "class" ) );
while ( !elemClass.isNull() )
{
classes << SizeClass( elemClass.attribute( "size" ).toDouble(), elemClass.attribute( "label" ) );
classes << SizeClass( elemClass.attribute( QStringLiteral( "size" ) ).toDouble(), elemClass.attribute( QStringLiteral( "label" ) ) );
elemClass = elemClass.nextSiblingElement();
}
ddsLegend->setClasses( classes );
@ -369,43 +369,43 @@ void QgsDataDefinedSizeLegend::writeXml( QDomElement &elem, const QgsReadWriteCo
{
QDomDocument doc = elem.ownerDocument();
elem.setAttribute( "type", mType == LegendCollapsed ? "collapsed" : "separated" );
elem.setAttribute( "valign", mVAlign == AlignCenter ? "center" : "bottom" );
elem.setAttribute( "title", mTitleLabel );
elem.setAttribute( QStringLiteral( "type" ), mType == LegendCollapsed ? "collapsed" : "separated" );
elem.setAttribute( QStringLiteral( "valign" ), mVAlign == AlignCenter ? "center" : "bottom" );
elem.setAttribute( QStringLiteral( "title" ), mTitleLabel );
if ( mSymbol )
{
QDomElement elemSymbol = QgsSymbolLayerUtils::saveSymbol( "source", mSymbol.get(), doc, context );
QDomElement elemSymbol = QgsSymbolLayerUtils::saveSymbol( QStringLiteral( "source" ), mSymbol.get(), doc, context );
elem.appendChild( elemSymbol );
}
if ( mSizeScaleTransformer )
{
QDomElement elemTransformer = QgsXmlUtils::writeVariant( mSizeScaleTransformer->toVariant(), doc );
elemTransformer.setTagName( "transformer" );
elemTransformer.setTagName( QStringLiteral( "transformer" ) );
elem.appendChild( elemTransformer );
}
QDomElement elemFont = doc.createElement( "font" );
elemFont.setAttribute( "family", mFont.family() );
elemFont.setAttribute( "size", mFont.pointSize() );
elemFont.setAttribute( "weight", mFont.weight() );
elemFont.setAttribute( "italic", mFont.italic() );
QDomElement elemFont = doc.createElement( QStringLiteral( "font" ) );
elemFont.setAttribute( QStringLiteral( "family" ), mFont.family() );
elemFont.setAttribute( QStringLiteral( "size" ), mFont.pointSize() );
elemFont.setAttribute( QStringLiteral( "weight" ), mFont.weight() );
elemFont.setAttribute( QStringLiteral( "italic" ), mFont.italic() );
QDomElement elemTextStyle = doc.createElement( "text-style" );
elemTextStyle.setAttribute( "color", QgsSymbolLayerUtils::encodeColor( mTextColor ) );
elemTextStyle.setAttribute( "align", static_cast<int>( mTextAlignment ) );
QDomElement elemTextStyle = doc.createElement( QStringLiteral( "text-style" ) );
elemTextStyle.setAttribute( QStringLiteral( "color" ), QgsSymbolLayerUtils::encodeColor( mTextColor ) );
elemTextStyle.setAttribute( QStringLiteral( "align" ), static_cast<int>( mTextAlignment ) );
elemTextStyle.appendChild( elemFont );
elem.appendChild( elemTextStyle );
if ( !mSizeClasses.isEmpty() )
{
QDomElement elemClasses = doc.createElement( "classes" );
QDomElement elemClasses = doc.createElement( QStringLiteral( "classes" ) );
Q_FOREACH ( const SizeClass &sc, mSizeClasses )
{
QDomElement elemClass = doc.createElement( "class" );
elemClass.setAttribute( "size", sc.size );
elemClass.setAttribute( "label", sc.label );
QDomElement elemClass = doc.createElement( QStringLiteral( "class" ) );
elemClass.setAttribute( QStringLiteral( "size" ), sc.size );
elemClass.setAttribute( QStringLiteral( "label" ), sc.label );
elemClasses.appendChild( elemClass );
}
elem.appendChild( elemClasses );

View File

@ -113,7 +113,7 @@ void QgsDiagramLayerSettings::setCoordinateTransform( const QgsCoordinateTransfo
void QgsDiagramLayerSettings::readXml( const QDomElement &elem )
{
QDomNodeList propertyElems = elem.elementsByTagName( "properties" );
QDomNodeList propertyElems = elem.elementsByTagName( QStringLiteral( "properties" ) );
if ( !propertyElems.isEmpty() )
{
( void )mDataDefinedProperties.readXml( propertyElems.at( 0 ).toElement(), sPropertyDefinitions );
@ -135,7 +135,7 @@ void QgsDiagramLayerSettings::readXml( const QDomElement &elem )
void QgsDiagramLayerSettings::writeXml( QDomElement &layerElem, QDomDocument &doc ) const
{
QDomElement diagramLayerElem = doc.createElement( QStringLiteral( "DiagramLayerSettings" ) );
QDomElement propertiesElem = doc.createElement( "properties" );
QDomElement propertiesElem = doc.createElement( QStringLiteral( "properties" ) );
( void )mDataDefinedProperties.writeXml( propertiesElem, sPropertyDefinitions );
diagramLayerElem.appendChild( propertiesElem );
diagramLayerElem.setAttribute( QStringLiteral( "placement" ), mPlacement );
@ -689,7 +689,7 @@ void QgsLinearlyInterpolatedDiagramRenderer::readXml( const QDomElement &elem, c
delete mDataDefinedSizeLegend;
QDomElement ddsLegendSizeElem = elem.firstChildElement( "data-defined-size-legend" );
QDomElement ddsLegendSizeElem = elem.firstChildElement( QStringLiteral( "data-defined-size-legend" ) );
if ( !ddsLegendSizeElem.isNull() )
{
mDataDefinedSizeLegend = QgsDataDefinedSizeLegend::readXml( ddsLegendSizeElem, context );

View File

@ -343,7 +343,7 @@ void QgsEditFormConfig::readXml( const QDomNode &node, const QgsReadWriteContext
for ( int i = 0; i < widgetsNodeList.size(); ++i )
{
QDomElement widgetElement = widgetsNodeList.at( i ).toElement();
QVariant config = QgsXmlUtils::readVariant( widgetElement.firstChildElement( "config" ) );
QVariant config = QgsXmlUtils::readVariant( widgetElement.firstChildElement( QStringLiteral( "config" ) ) );
d->mWidgetConfigs[widgetElement.attribute( QStringLiteral( "name" ) )] = config.toMap();
}

View File

@ -181,4 +181,6 @@ class CORE_EXPORT QgsFontUtils
static QStringList recentFontFamilies();
};
// clazy:excludeall=qstring-allocations
#endif // QGSFONTUTILS_H

View File

@ -298,7 +298,7 @@ QVariant QgsMapLayerModel::data( const QModelIndex &index, int role ) const
if ( !layer->abstract().isEmpty() )
parts << "<br/>" + layer->abstract().replace( QLatin1String( "\n" ), QLatin1String( "<br/>" ) );
parts << "<i>" + layer->publicSource() + "</i>";
return parts.join( "<br/>" );
return parts.join( QStringLiteral( "<br/>" ) );
}
return QVariant();
}

View File

@ -118,4 +118,6 @@ class CORE_EXPORT QgsMapRendererTask : public QgsTask
int mError = 0;
};
// clazy:excludeall=qstring-allocations
#endif

Some files were not shown because too many files have changed in this diff Show More