Skip to content

Commit dbded4d

Browse files
committedSep 9, 2015
Avoid some unnecessary QString construction
1 parent 910cb01 commit dbded4d

File tree

10 files changed

+209
-178
lines changed

10 files changed

+209
-178
lines changed
 

‎src/app/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -810,9 +810,9 @@ APP_EXPORT int main( int argc, char *argv[] )
810810
if ( mySettings.contains( "/Themes" ) )
811811
{
812812
QString theme = mySettings.value( "/Themes", "default" ).toString();
813-
if ( theme == QString( "gis" )
814-
|| theme == QString( "classic" )
815-
|| theme == QString( "nkids" ) )
813+
if ( theme == "gis"
814+
|| theme == "classic"
815+
|| theme == "nkids" )
816816
{
817817
mySettings.setValue( "/Themes", QString( "default" ) );
818818
}

‎src/app/pluginmanager/qgspluginitemdelegate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ void QgsPluginItemDelegate::paint( QPainter *painter, const QStyleOptionViewItem
8888
}
8989

9090
if ( ! index.data( PLUGIN_ERROR_ROLE ).toString().isEmpty()
91-
|| index.data( PLUGIN_STATUS_ROLE ).toString() == QString( "upgradeable" )
92-
|| index.data( PLUGIN_STATUS_ROLE ).toString() == QString( "new" ) )
91+
|| index.data( PLUGIN_STATUS_ROLE ).toString() == "upgradeable"
92+
|| index.data( PLUGIN_STATUS_ROLE ).toString() == "new" )
9393
{
9494
QFont font = painter->font();
9595
font.setBold( true );

‎src/app/qgsoptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1680,7 +1680,7 @@ void QgsOptions::on_mOptionsStackedWidget_currentChanged( int theIndx )
16801680
{
16811681
Q_UNUSED( theIndx );
16821682
// load gdal driver list when gdal tab is first opened
1683-
if ( mOptionsStackedWidget->currentWidget()->objectName() == QString( "mOptionsPageGDAL" )
1683+
if ( mOptionsStackedWidget->currentWidget()->objectName() == "mOptionsPageGDAL"
16841684
&& ! mLoadedGdalDriverList )
16851685
{
16861686
loadGdalDriverList();

‎src/browser/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ int main( int argc, char ** argv )
3737
QgsApplication a( argc, argv, true );
3838
// update any saved setting for older themes to new default 'gis' theme (2013-04-15)
3939
QString theme = settings.value( "/Themes", "default" ).toString();
40-
if ( theme == QString( "gis" )
41-
|| theme == QString( "classic" )
42-
|| theme == QString( "nkids" ) )
40+
if ( theme == "gis"
41+
|| theme == "classic"
42+
|| theme == "nkids" )
4343
{
4444
theme = QString( "default" );
4545
}

‎src/core/qgspallabeling.cpp

Lines changed: 178 additions & 164 deletions
Large diffs are not rendered by default.

‎src/core/qgspallabeling.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,25 @@ class CORE_EXPORT QgsPalLayerSettings
582582
QMap < QgsPalLayerSettings::DataDefinedProperties,
583583
QgsDataDefined* > & propertyMap );
584584

585+
enum DataDefinedValueType
586+
{
587+
DDBool,
588+
DDInt,
589+
DDIntPos,
590+
DDDouble,
591+
DDDoublePos,
592+
DDRotation180,
593+
DDTransparency,
594+
DDString,
595+
DDUnits,
596+
DDColor,
597+
DDJoinStyle,
598+
DDBlendMode,
599+
DDPointF
600+
};
601+
585602
// convenience data defined evaluation function
586-
bool dataDefinedValEval( const QString& valType,
603+
bool dataDefinedValEval( DataDefinedValueType valType,
587604
QgsPalLayerSettings::DataDefinedProperties p,
588605
QVariant& exprVal, const QgsExpressionContext& context );
589606

‎src/plugins/roadgraph/exportdlg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ QgsVectorLayer* RgExportDlg::mapLayer() const
7474
QgsVectorLayer* myLayer = NULL;
7575
QString layerId = mcbLayers->itemData( mcbLayers->currentIndex() ).toString();
7676

77-
if ( layerId == QString( "-1" ) )
77+
if ( layerId == "-1" )
7878
{
7979
// create a temporary layer
8080
myLayer = new QgsVectorLayer( QString( "LineString?crs=epsg:4326&memoryid=%1" ).arg( QUuid::createUuid().toString() ), "shortest path", "memory" );

‎tests/src/core/testqgscolorscheme.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class DummyColorScheme : public QgsColorScheme
3535
const QColor &baseColor = QColor() ) override
3636
{
3737
QList< QPair< QColor, QString> > colors;
38-
if ( context == QString( "testscheme" ) )
38+
if ( context == "testscheme" )
3939
{
4040
colors << qMakePair( QColor( 255, 255, 0 ), QString( "schemetest" ) );
4141
}

‎tests/src/core/testqgscolorschemeregistry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class DummyColorScheme : public QgsColorScheme
3636
const QColor &baseColor = QColor() ) override
3737
{
3838
QList< QPair< QColor, QString> > colors;
39-
if ( context == QString( "testscheme" ) )
39+
if ( context == "testscheme" )
4040
{
4141
colors << qMakePair( QColor( 255, 255, 0 ), QString( "schemetest" ) );
4242
}

‎tests/src/core/testqgscoordinatereferencesystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ void TestQgsCoordinateReferenceSystem::setValidationHint()
418418
{
419419
QgsCoordinateReferenceSystem myCrs;
420420
myCrs.setValidationHint( "<head>" );
421-
QVERIFY( myCrs.validationHint() == QString( "<head>" ) );
421+
QVERIFY( myCrs.validationHint() == "<head>" );
422422
debugPrint( myCrs );
423423
}
424424

0 commit comments

Comments
 (0)
Please sign in to comment.