Skip to content

Commit feea121

Browse files
committed
Fix some warnings
1 parent 635f8ad commit feea121

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/core/qgsproject.cpp

+15-14
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ void QgsProject::clear()
612612
// basically a debugging tool to dump property list values
613613
void dump_( const QgsProjectPropertyKey &topQgsPropertyKey )
614614
{
615-
QgsDebugMsg( "current properties:" );
615+
QgsDebugMsg( QStringLiteral( "current properties:" ) );
616616
topQgsPropertyKey.dump();
617617
}
618618

@@ -660,13 +660,13 @@ void _getProperties( const QDomDocument &doc, QgsProjectPropertyKey &project_pro
660660

661661
if ( scopes.count() < 1 )
662662
{
663-
QgsDebugMsg( "empty ``properties'' XML tag ... bailing" );
663+
QgsDebugMsg( QStringLiteral( "empty ``properties'' XML tag ... bailing" ) );
664664
return;
665665
}
666666

667667
if ( ! project_properties.readXml( propertiesElem ) )
668668
{
669-
QgsDebugMsg( "Project_properties.readXml() failed" );
669+
QgsDebugMsg( QStringLiteral( "Project_properties.readXml() failed" ) );
670670
}
671671
}
672672

@@ -683,23 +683,23 @@ static void _getTitle( const QDomDocument &doc, QString &title )
683683

684684
if ( !nl.count() )
685685
{
686-
QgsDebugMsg( "unable to find title element" );
686+
QgsDebugMsg( QStringLiteral( "unable to find title element" ) );
687687
return;
688688
}
689689

690690
QDomNode titleNode = nl.item( 0 ); // there should only be one, so zeroth element OK
691691

692692
if ( !titleNode.hasChildNodes() ) // if not, then there's no actual text
693693
{
694-
QgsDebugMsg( "unable to find title element" );
694+
QgsDebugMsg( QStringLiteral( "unable to find title element" ) );
695695
return;
696696
}
697697

698698
QDomNode titleTextNode = titleNode.firstChild(); // should only have one child
699699

700700
if ( !titleTextNode.isText() )
701701
{
702-
QgsDebugMsg( "unable to find title element" );
702+
QgsDebugMsg( QStringLiteral( "unable to find title element" ) );
703703
return;
704704
}
705705

@@ -715,7 +715,7 @@ QgsProjectVersion getVersion( const QDomDocument &doc )
715715

716716
if ( !nl.count() )
717717
{
718-
QgsDebugMsg( " unable to find qgis element in project file" );
718+
QgsDebugMsg( QStringLiteral( " unable to find qgis element in project file" ) );
719719
return QgsProjectVersion( 0, 0, 0, QString() );
720720
}
721721

@@ -839,7 +839,7 @@ bool QgsProject::addLayer( const QDomElement &layerElem, QList<QDomNode> &broken
839839

840840
if ( !mapLayer )
841841
{
842-
QgsDebugMsg( "Unable to create layer" );
842+
QgsDebugMsg( QStringLiteral( "Unable to create layer" ) );
843843

844844
return false;
845845
}
@@ -976,7 +976,7 @@ bool QgsProject::readProjectFile( const QString &filename )
976976

977977
// Shows a warning when an old project file is read.
978978
emit oldProjectVersionWarning( fileVersion.text() );
979-
QgsDebugMsg( "Emitting oldProjectVersionWarning(oldVersion)." );
979+
QgsDebugMsg( QStringLiteral( "Emitting oldProjectVersionWarning(oldVersion)." ) );
980980

981981
projectFile.updateRevision( thisVersion );
982982
}
@@ -1124,7 +1124,7 @@ bool QgsProject::readProjectFile( const QString &filename )
11241124
// review the integrity of the retrieved map layers
11251125
if ( !clean )
11261126
{
1127-
QgsDebugMsg( "Unable to get map layers from project file." );
1127+
QgsDebugMsg( QStringLiteral( "Unable to get map layers from project file." ) );
11281128

11291129
if ( !brokenNodes.isEmpty() )
11301130
{
@@ -1551,15 +1551,15 @@ bool QgsProject::writeProjectFile( const QString &filename )
15511551
qgisNode.appendChild( titleNode );
15521552

15531553
QDomElement transactionNode = doc->createElement( QStringLiteral( "autotransaction" ) );
1554-
transactionNode.setAttribute( QStringLiteral( "active" ), mAutoTransaction ? "1" : "0" );
1554+
transactionNode.setAttribute( QStringLiteral( "active" ), mAutoTransaction ? '1' : '0' );
15551555
qgisNode.appendChild( transactionNode );
15561556

15571557
QDomElement evaluateDefaultValuesNode = doc->createElement( QStringLiteral( "evaluateDefaultValues" ) );
1558-
evaluateDefaultValuesNode.setAttribute( QStringLiteral( "active" ), mEvaluateDefaultValues ? "1" : "0" );
1558+
evaluateDefaultValuesNode.setAttribute( QStringLiteral( "active" ), mEvaluateDefaultValues ? '1' : '0' );
15591559
qgisNode.appendChild( evaluateDefaultValuesNode );
15601560

15611561
QDomElement trustNode = doc->createElement( QStringLiteral( "trust" ) );
1562-
trustNode.setAttribute( QStringLiteral( "active" ), mTrustLayerMetadata ? "1" : "0" );
1562+
trustNode.setAttribute( QStringLiteral( "active" ), mTrustLayerMetadata ? '1' : '0' );
15631563
qgisNode.appendChild( trustNode );
15641564

15651565
QDomText titleText = doc->createTextNode( title() ); // XXX why have title TWICE?
@@ -1643,7 +1643,7 @@ bool QgsProject::writeProjectFile( const QString &filename )
16431643

16441644
dump_( mProperties );
16451645

1646-
QgsDebugMsg( QString( "there are %1 property scopes" ).arg( static_cast<int>( mProperties.count() ) ) );
1646+
QgsDebugMsg( QStringLiteral( "there are %1 property scopes" ).arg( static_cast<int>( mProperties.count() ) ) );
16471647

16481648
if ( !mProperties.isEmpty() ) // only worry about properties if we
16491649
// actually have any properties
@@ -2691,6 +2691,7 @@ QSet<QgsMapLayer *> QgsProject::requiredLayers() const
26912691
void QgsProject::setRequiredLayers( const QSet<QgsMapLayer *> &layers )
26922692
{
26932693
QStringList layerIds;
2694+
layerIds.reserve( layers.count() );
26942695
for ( QgsMapLayer *layer : layers )
26952696
{
26962697
layerIds << layer->id();

0 commit comments

Comments
 (0)