From 878d2290091e881d2386678c571d91db8e77abda Mon Sep 17 00:00:00 2001 From: Ian Turton Date: Mon, 28 Sep 2020 17:26:34 +0100 Subject: [PATCH 01/48] 1st fix for broken GetFeatureInfo URLs in REST WMTS layers --- src/providers/wms/qgswmsprovider.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp index 38fe76d65588..6cd5d9bcd662 100644 --- a/src/providers/wms/qgswmsprovider.cpp +++ b/src/providers/wms/qgswmsprovider.cpp @@ -3018,8 +3018,31 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRa if ( mTileLayer->getFeatureInfoURLs.contains( formatStr ) ) { // REST + + QString url = mTileLayer->getFeatureInfoURLs[ formatStr ]; + if (mSettings.mIgnoreGetFeatureInfoUrl) + { + // rewrite the URL if the one in the capabilities document is incorrect + QString base = mSettings.mBaseUrl; + QgsDebugMsgLevel( QStringLiteral( "1 base=%1" ).arg( base ), 2 ); + // strip every thing after the ? from the base url + base = base.split(QRegExp("\\?"))[0]; + QgsDebugMsgLevel( QStringLiteral( "2 base=%1" ).arg( base ), 2 ); + // and strip everything before the `rest` element (at least for GeoServer) + QgsDebugMsgLevel( QStringLiteral( "url=%1" ).arg( url ), 2 ); + int index = url.length() - url.lastIndexOf("rest") + 1; // +1 for the / + QgsDebugMsgLevel( QStringLiteral( "url=%1" ).arg( url.right(index) ), 2 ); + + + url = base + url.right(index); + QgsDebugMsgLevel( QStringLiteral( "new url=%1" ).arg( url ), 2 ); + + } + + QgsDebugMsgLevel( QStringLiteral( "getfeatureinfo: %1" ).arg( url), 2 ); + url.replace( QLatin1String( "{layer}" ), mSettings.mActiveSubLayers[0], Qt::CaseInsensitive ); url.replace( QLatin1String( "{style}" ), mSettings.mActiveSubStyles[0], Qt::CaseInsensitive ); url.replace( QLatin1String( "{tilematrixset}" ), mTileMatrixSet->identifier, Qt::CaseInsensitive ); @@ -3040,6 +3063,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRa else if ( !getFeatureInfoUrl().isNull() ) { // KVP + QgsDebugMsg( QStringLiteral( "KVP ignore GetFeatureURL %1" ).arg( mSettings.mIgnoreGetFeatureInfoUrl ) ); QUrl url( mSettings.mIgnoreGetFeatureInfoUrl ? mSettings.mBaseUrl : getFeatureInfoUrl() ); QUrlQuery query( url ); From d97d11fb07f67d26d0f81bad2485d68d1f52c745 Mon Sep 17 00:00:00 2001 From: Ian Turton Date: Tue, 29 Sep 2020 08:39:54 +0100 Subject: [PATCH 02/48] formatted --- src/providers/wms/qgswmsprovider.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp index 6cd5d9bcd662..39b67249938c 100644 --- a/src/providers/wms/qgswmsprovider.cpp +++ b/src/providers/wms/qgswmsprovider.cpp @@ -3018,30 +3018,21 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRa if ( mTileLayer->getFeatureInfoURLs.contains( formatStr ) ) { // REST - + QString url = mTileLayer->getFeatureInfoURLs[ formatStr ]; - if (mSettings.mIgnoreGetFeatureInfoUrl) + if ( mSettings.mIgnoreGetFeatureInfoUrl ) { // rewrite the URL if the one in the capabilities document is incorrect - QString base = mSettings.mBaseUrl; - QgsDebugMsgLevel( QStringLiteral( "1 base=%1" ).arg( base ), 2 ); // strip every thing after the ? from the base url - base = base.split(QRegExp("\\?"))[0]; - QgsDebugMsgLevel( QStringLiteral( "2 base=%1" ).arg( base ), 2 ); + const QString base = mSettings.mBaseUrl.split( QRegularExpression( "\\?" ) )[0]; // and strip everything before the `rest` element (at least for GeoServer) - QgsDebugMsgLevel( QStringLiteral( "url=%1" ).arg( url ), 2 ); - int index = url.length() - url.lastIndexOf("rest") + 1; // +1 for the / - QgsDebugMsgLevel( QStringLiteral( "url=%1" ).arg( url.right(index) ), 2 ); - - - url = base + url.right(index); - QgsDebugMsgLevel( QStringLiteral( "new url=%1" ).arg( url ), 2 ); - + const int index = url.length() - url.lastIndexOf( QStringLiteral( "rest" ) ) + 1; // +1 for the / + url = base + url.right( index ); } - QgsDebugMsgLevel( QStringLiteral( "getfeatureinfo: %1" ).arg( url), 2 ); + QgsDebugMsgLevel( QStringLiteral( "getfeatureinfo: %1" ).arg( url ), 2 ); url.replace( QLatin1String( "{layer}" ), mSettings.mActiveSubLayers[0], Qt::CaseInsensitive ); url.replace( QLatin1String( "{style}" ), mSettings.mActiveSubStyles[0], Qt::CaseInsensitive ); From 5f74d6abebb47c36927bca3d3500aba172feff84 Mon Sep 17 00:00:00 2001 From: Harrissou Sant-anna Date: Sun, 4 Oct 2020 09:23:09 +0200 Subject: [PATCH 03/48] Rename geometry_overlay_* functions into overlay_* --- ...etry_overlay_contains => overlay_contains} | 10 +- ...ometry_overlay_crosses => overlay_crosses} | 10 +- ...etry_overlay_disjoint => overlay_disjoint} | 10 +- ...geometry_overlay_equals => overlay_equals} | 10 +- ..._overlay_intersects => overlay_intersects} | 10 +- ...ometry_overlay_nearest => overlay_nearest} | 10 +- ...ometry_overlay_touches => overlay_touches} | 10 +- ...geometry_overlay_within => overlay_within} | 10 +- src/core/expression/qgsexpressionfunction.cpp | 16 +-- tests/src/core/testqgsoverlayexpression.cpp | 106 +++++++++--------- 10 files changed, 101 insertions(+), 101 deletions(-) rename resources/function_help/json/{geometry_overlay_contains => overlay_contains} (83%) rename resources/function_help/json/{geometry_overlay_crosses => overlay_crosses} (83%) rename resources/function_help/json/{geometry_overlay_disjoint => overlay_disjoint} (83%) rename resources/function_help/json/{geometry_overlay_equals => overlay_equals} (83%) rename resources/function_help/json/{geometry_overlay_intersects => overlay_intersects} (82%) rename resources/function_help/json/{geometry_overlay_nearest => overlay_nearest} (85%) rename resources/function_help/json/{geometry_overlay_touches => overlay_touches} (83%) rename resources/function_help/json/{geometry_overlay_within => overlay_within} (83%) diff --git a/resources/function_help/json/geometry_overlay_contains b/resources/function_help/json/overlay_contains similarity index 83% rename from resources/function_help/json/geometry_overlay_contains rename to resources/function_help/json/overlay_contains index 551a18e5644c..161bd82b0880 100644 --- a/resources/function_help/json/geometry_overlay_contains +++ b/resources/function_help/json/overlay_contains @@ -1,5 +1,5 @@ { - "name": "geometry_overlay_contains", + "name": "overlay_contains", "type": "function", "groups": ["GeometryGroup"], "description": "Performs a spatial join of type CONTAINS. This returns an array of results of an expression evaluated on features from a different layer that CONTAINS the current feature, or, if no expression if provided, simply returns whether at least one feature from the other layer CONTAINS the current feature.", @@ -32,19 +32,19 @@ ], "examples": [ { - "expression": "geometry_overlay_contains('regions')", + "expression": "overlay_contains('regions')", "returns": "True" }, { - "expression": "geometry_overlay_contains('regions', name)", + "expression": "overlay_contains('regions', name)", "returns": "['South Africa', 'Africa', 'World']" }, { - "expression": "geometry_overlay_contains('regions', name, name != 'World')", + "expression": "overlay_contains('regions', name, name != 'World')", "returns": "['South Africa', 'Africa']" }, { - "expression": "geometry_overlay_contains('regions', name, limit:=1)", + "expression": "overlay_contains('regions', name, limit:=1)", "returns": "['South Africa']" } ] diff --git a/resources/function_help/json/geometry_overlay_crosses b/resources/function_help/json/overlay_crosses similarity index 83% rename from resources/function_help/json/geometry_overlay_crosses rename to resources/function_help/json/overlay_crosses index 581d70daeb49..d83f2cdbb75f 100644 --- a/resources/function_help/json/geometry_overlay_crosses +++ b/resources/function_help/json/overlay_crosses @@ -1,5 +1,5 @@ { - "name": "geometry_overlay_crosses", + "name": "overlay_crosses", "type": "function", "groups": ["GeometryGroup"], "description": "Performs a spatial join of type CROSSES. This returns an array of results of an expression evaluated on features from a different layer that CROSSES the current feature, or, if no expression if provided, simply returns whether at least one feature from the other layer CROSSES the current feature.", @@ -32,19 +32,19 @@ ], "examples": [ { - "expression": "geometry_overlay_crosses('regions')", + "expression": "overlay_crosses('regions')", "returns": "True" }, { - "expression": "geometry_overlay_crosses('regions', name)", + "expression": "overlay_crosses('regions', name)", "returns": "['South Africa', 'Africa', 'World']" }, { - "expression": "geometry_overlay_crosses('regions', name, name != 'World')", + "expression": "overlay_crosses('regions', name, name != 'World')", "returns": "['South Africa', 'Africa']" }, { - "expression": "geometry_overlay_crosses('regions', name, limit:=1)", + "expression": "overlay_crosses('regions', name, limit:=1)", "returns": "['South Africa']" } ] diff --git a/resources/function_help/json/geometry_overlay_disjoint b/resources/function_help/json/overlay_disjoint similarity index 83% rename from resources/function_help/json/geometry_overlay_disjoint rename to resources/function_help/json/overlay_disjoint index 53631cfdcbbb..005b4410c70f 100644 --- a/resources/function_help/json/geometry_overlay_disjoint +++ b/resources/function_help/json/overlay_disjoint @@ -1,5 +1,5 @@ { - "name": "geometry_overlay_disjoint", + "name": "overlay_disjoint", "type": "function", "groups": ["GeometryGroup"], "description": "Performs a spatial join of type DISJOINT. This returns an array of results of an expression evaluated on features from a different layer that DISJOINT the current feature, or, if no expression if provided, simply returns whether at least one feature from the other layer DISJOINT the current feature.", @@ -32,19 +32,19 @@ ], "examples": [ { - "expression": "geometry_overlay_disjoint('regions')", + "expression": "overlay_disjoint('regions')", "returns": "True" }, { - "expression": "geometry_overlay_disjoint('regions', name)", + "expression": "overlay_disjoint('regions', name)", "returns": "['South Africa', 'Africa', 'World']" }, { - "expression": "geometry_overlay_disjoint('regions', name, name != 'World')", + "expression": "overlay_disjoint('regions', name, name != 'World')", "returns": "['South Africa', 'Africa']" }, { - "expression": "geometry_overlay_disjoint('regions', name, limit:=1)", + "expression": "overlay_disjoint('regions', name, limit:=1)", "returns": "['South Africa']" } ] diff --git a/resources/function_help/json/geometry_overlay_equals b/resources/function_help/json/overlay_equals similarity index 83% rename from resources/function_help/json/geometry_overlay_equals rename to resources/function_help/json/overlay_equals index ecd5d10290ff..c56025a644bc 100644 --- a/resources/function_help/json/geometry_overlay_equals +++ b/resources/function_help/json/overlay_equals @@ -1,5 +1,5 @@ { - "name": "geometry_overlay_equals", + "name": "overlay_equals", "type": "function", "groups": ["GeometryGroup"], "description": "Performs a spatial join of type EQUALS. This returns an array of results of an expression evaluated on features from a different layer that EQUALS the current feature, or, if no expression if provided, simply returns whether at least one feature from the other layer EQUALS the current feature.", @@ -32,19 +32,19 @@ ], "examples": [ { - "expression": "geometry_overlay_equals('regions')", + "expression": "overlay_equals('regions')", "returns": "True" }, { - "expression": "geometry_overlay_equals('regions', name)", + "expression": "overlay_equals('regions', name)", "returns": "['South Africa', 'Africa', 'World']" }, { - "expression": "geometry_overlay_equals('regions', name, name != 'World')", + "expression": "overlay_equals('regions', name, name != 'World')", "returns": "['South Africa', 'Africa']" }, { - "expression": "geometry_overlay_equals('regions', name, limit:=1)", + "expression": "overlay_equals('regions', name, limit:=1)", "returns": "['South Africa']" } ] diff --git a/resources/function_help/json/geometry_overlay_intersects b/resources/function_help/json/overlay_intersects similarity index 82% rename from resources/function_help/json/geometry_overlay_intersects rename to resources/function_help/json/overlay_intersects index b067cf9197d8..90e08f408de9 100644 --- a/resources/function_help/json/geometry_overlay_intersects +++ b/resources/function_help/json/overlay_intersects @@ -1,5 +1,5 @@ { - "name": "geometry_overlay_intersects", + "name": "overlay_intersects", "type": "function", "groups": ["GeometryGroup"], "description": "Performs a spatial join of type INTERSECTS. This returns an array of results of an expression evaluated on features from a different layer that INTERSECTS the current feature, or, if no expression if provided, simply returns whether at least one feature from the other layer INTERSECTS the current feature.", @@ -32,19 +32,19 @@ ], "examples": [ { - "expression": "geometry_overlay_intersects('regions')", + "expression": "overlay_intersects('regions')", "returns": "True" }, { - "expression": "geometry_overlay_intersects('regions', name)", + "expression": "overlay_intersects('regions', name)", "returns": "['South Africa', 'Africa', 'World']" }, { - "expression": "geometry_overlay_intersects('regions', name, name != 'World')", + "expression": "overlay_intersects('regions', name, name != 'World')", "returns": "['South Africa', 'Africa']" }, { - "expression": "geometry_overlay_intersects('regions', name, limit:=1)", + "expression": "overlay_intersects('regions', name, limit:=1)", "returns": "['South Africa']" } ] diff --git a/resources/function_help/json/geometry_overlay_nearest b/resources/function_help/json/overlay_nearest similarity index 85% rename from resources/function_help/json/geometry_overlay_nearest rename to resources/function_help/json/overlay_nearest index 1622004cff26..914e79009a98 100644 --- a/resources/function_help/json/geometry_overlay_nearest +++ b/resources/function_help/json/overlay_nearest @@ -1,5 +1,5 @@ { - "name": "geometry_overlay_nearest", + "name": "overlay_nearest", "type": "function", "groups": ["GeometryGroup"], "description": "This returns an array of results of an expression evaluated on features from a different layer ordered BY DISTANCE to the current feature, or, if no expression if provided, simply returns whether at least one feature from the other layer was found. Note : this function can be slow and consume a lot of memory for large layers.", @@ -37,19 +37,19 @@ ], "examples": [ { - "expression": "geometry_overlay_nearest('regions')", + "expression": "overlay_nearest('regions')", "returns": "True" }, { - "expression": "geometry_overlay_nearest('regions', name)", + "expression": "overlay_nearest('regions', name)", "returns": "['South Africa', 'Africa', 'World']" }, { - "expression": "geometry_overlay_nearest('regions', name, name != 'World')", + "expression": "overlay_nearest('regions', name, name != 'World')", "returns": "['South Africa', 'Africa']" }, { - "expression": "geometry_overlay_nearest('regions', name, limit:=1)", + "expression": "overlay_nearest('regions', name, limit:=1)", "returns": "['South Africa']" } ] diff --git a/resources/function_help/json/geometry_overlay_touches b/resources/function_help/json/overlay_touches similarity index 83% rename from resources/function_help/json/geometry_overlay_touches rename to resources/function_help/json/overlay_touches index 4ce9f2dcccd6..05129ba8a5de 100644 --- a/resources/function_help/json/geometry_overlay_touches +++ b/resources/function_help/json/overlay_touches @@ -1,5 +1,5 @@ { - "name": "geometry_overlay_touches", + "name": "overlay_touches", "type": "function", "groups": ["GeometryGroup"], "description": "Performs a spatial join of type TOUCHES. This returns an array of results of an expression evaluated on features from a different layer that TOUCHES the current feature, or, if no expression if provided, simply returns whether at least one feature from the other layer TOUCHES the current feature.", @@ -32,19 +32,19 @@ ], "examples": [ { - "expression": "geometry_overlay_touches('regions')", + "expression": "overlay_touches('regions')", "returns": "True" }, { - "expression": "geometry_overlay_touches('regions', name)", + "expression": "overlay_touches('regions', name)", "returns": "['South Africa', 'Africa', 'World']" }, { - "expression": "geometry_overlay_touches('regions', name, name != 'World')", + "expression": "overlay_touches('regions', name, name != 'World')", "returns": "['South Africa', 'Africa']" }, { - "expression": "geometry_overlay_touches('regions', name, limit:=1)", + "expression": "overlay_touches('regions', name, limit:=1)", "returns": "['South Africa']" } ] diff --git a/resources/function_help/json/geometry_overlay_within b/resources/function_help/json/overlay_within similarity index 83% rename from resources/function_help/json/geometry_overlay_within rename to resources/function_help/json/overlay_within index 3a91cc33dc87..75ef889dd33a 100644 --- a/resources/function_help/json/geometry_overlay_within +++ b/resources/function_help/json/overlay_within @@ -1,5 +1,5 @@ { - "name": "geometry_overlay_within", + "name": "overlay_within", "type": "function", "groups": ["GeometryGroup"], "description": "Performs a spatial join of type WITHIN. This returns an array of results of an expression evaluated on features from a different layer that are WITHIN the current feature, or, if no expression if provided, simply returns whether at least one feature from the other layer is WITHIN the current feature.", @@ -32,19 +32,19 @@ ], "examples": [ { - "expression": "geometry_overlay_within('regions')", + "expression": "overlay_within('regions')", "returns": "True" }, { - "expression": "geometry_overlay_within('regions', name)", + "expression": "overlay_within('regions', name)", "returns": "['South Africa', 'Africa', 'World']" }, { - "expression": "geometry_overlay_within('regions', name, name != 'World')", + "expression": "overlay_within('regions', name, name != 'World')", "returns": "['South Africa', 'Africa']" }, { - "expression": "geometry_overlay_within('regions', name, limit:=1)", + "expression": "overlay_within('regions', name, limit:=1)", "returns": "['South Africa']" } ] diff --git a/src/core/expression/qgsexpressionfunction.cpp b/src/core/expression/qgsexpressionfunction.cpp index 283c9e7e975f..af37093bcd79 100644 --- a/src/core/expression/qgsexpressionfunction.cpp +++ b/src/core/expression/qgsexpressionfunction.cpp @@ -6333,13 +6333,13 @@ const QList &QgsExpression::Functions() QMap< QString, QgsExpressionFunction::FcnEval > geometry_overlay_definitions { - { QStringLiteral( "geometry_overlay_intersects" ), fcnGeomOverlayIntersects }, - { QStringLiteral( "geometry_overlay_contains" ), fcnGeomOverlayContains }, - { QStringLiteral( "geometry_overlay_crosses" ), fcnGeomOverlayCrosses }, - { QStringLiteral( "geometry_overlay_equals" ), fcnGeomOverlayEquals }, - { QStringLiteral( "geometry_overlay_touches" ), fcnGeomOverlayTouches }, - { QStringLiteral( "geometry_overlay_disjoint" ), fcnGeomOverlayDisjoint }, - { QStringLiteral( "geometry_overlay_within" ), fcnGeomOverlayWithin }, + { QStringLiteral( "overlay_intersects" ), fcnGeomOverlayIntersects }, + { QStringLiteral( "overlay_contains" ), fcnGeomOverlayContains }, + { QStringLiteral( "overlay_crosses" ), fcnGeomOverlayCrosses }, + { QStringLiteral( "overlay_equals" ), fcnGeomOverlayEquals }, + { QStringLiteral( "overlay_touches" ), fcnGeomOverlayTouches }, + { QStringLiteral( "overlay_disjoint" ), fcnGeomOverlayDisjoint }, + { QStringLiteral( "overlay_within" ), fcnGeomOverlayWithin }, }; QMapIterator< QString, QgsExpressionFunction::FcnEval > i( geometry_overlay_definitions ); while ( i.hasNext() ) @@ -6358,7 +6358,7 @@ const QList &QgsExpression::Functions() functions << fcnGeomOverlayFunc; } - QgsStaticExpressionFunction *fcnGeomOverlayNearestFunc = new QgsStaticExpressionFunction( QStringLiteral( "geometry_overlay_nearest" ), QgsExpressionFunction::ParameterList() + QgsStaticExpressionFunction *fcnGeomOverlayNearestFunc = new QgsStaticExpressionFunction( QStringLiteral( "overlay_nearest" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) ) << QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true ) << QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true ) diff --git a/tests/src/core/testqgsoverlayexpression.cpp b/tests/src/core/testqgsoverlayexpression.cpp index 1aa54a9e0667..1fdf118fc732 100644 --- a/tests/src/core/testqgsoverlayexpression.cpp +++ b/tests/src/core/testqgsoverlayexpression.cpp @@ -116,44 +116,44 @@ void TestQgsOverlayExpression::testOverlay_data() QTest::addColumn( "geometry" ); QTest::addColumn( "expectedResult" ); - QTest::newRow( "intersects" ) << "geometry_overlay_intersects('rectangles')" << "POLYGON((-120 30, -105 30, -105 20, -120 20, -120 30))" << true; - QTest::newRow( "intersects [cached]" ) << "geometry_overlay_intersects('rectangles',cache:=true)" << "POLYGON((-120 30, -105 30, -105 20, -120 20, -120 30))" << true; + QTest::newRow( "intersects" ) << "overlay_intersects('rectangles')" << "POLYGON((-120 30, -105 30, -105 20, -120 20, -120 30))" << true; + QTest::newRow( "intersects [cached]" ) << "overlay_intersects('rectangles',cache:=true)" << "POLYGON((-120 30, -105 30, -105 20, -120 20, -120 30))" << true; - QTest::newRow( "intersects no match" ) << "geometry_overlay_intersects('rectangles')" << "POLYGON((10 0, 5 0, 5 5, 10 5, 10 0))" << false; - QTest::newRow( "intersects no match [cached]" ) << "geometry_overlay_intersects('rectangles',cache:=true)" << "POLYGON((10 0, 5 0, 5 5, 10 5, 10 0))" << false; + QTest::newRow( "intersects no match" ) << "overlay_intersects('rectangles')" << "POLYGON((10 0, 5 0, 5 5, 10 5, 10 0))" << false; + QTest::newRow( "intersects no match [cached]" ) << "overlay_intersects('rectangles',cache:=true)" << "POLYGON((10 0, 5 0, 5 5, 10 5, 10 0))" << false; - QTest::newRow( "touches" ) << "geometry_overlay_touches('rectangles')" << "POLYGON((-86 54, -95 50, -81 50, -86 54))" << true; - QTest::newRow( "touches [cached]" ) << "geometry_overlay_touches('rectangles',cache:=true)" << "POLYGON((-86 54, -95 50, -81 50, -86 54))" << true; + QTest::newRow( "touches" ) << "overlay_touches('rectangles')" << "POLYGON((-86 54, -95 50, -81 50, -86 54))" << true; + QTest::newRow( "touches [cached]" ) << "overlay_touches('rectangles',cache:=true)" << "POLYGON((-86 54, -95 50, -81 50, -86 54))" << true; - QTest::newRow( "touches no intersects no match" ) << "geometry_overlay_touches('rectangles')" << "POLYGON((-86 54, -95 51, -81 51, -86 54))" << false; - QTest::newRow( "touches no intersects no match [cached]" ) << "geometry_overlay_touches('rectangles',cache:=true)" << "POLYGON((-86 54, -95 51, -81 51, -86 54))" << false; + QTest::newRow( "touches no intersects no match" ) << "overlay_touches('rectangles')" << "POLYGON((-86 54, -95 51, -81 51, -86 54))" << false; + QTest::newRow( "touches no intersects no match [cached]" ) << "overlay_touches('rectangles',cache:=true)" << "POLYGON((-86 54, -95 51, -81 51, -86 54))" << false; - QTest::newRow( "touches intersects no match" ) << "geometry_overlay_touches('rectangles')" << "POLYGON((-86 54, -95 49, -81 49, -86 54))" << false; - QTest::newRow( "touches intersects no match [cached]" ) << "geometry_overlay_touches('rectangles',cache:=true)" << "POLYGON((-86 54, -95 49, -81 49, -86 54))" << false; + QTest::newRow( "touches intersects no match" ) << "overlay_touches('rectangles')" << "POLYGON((-86 54, -95 49, -81 49, -86 54))" << false; + QTest::newRow( "touches intersects no match [cached]" ) << "overlay_touches('rectangles',cache:=true)" << "POLYGON((-86 54, -95 49, -81 49, -86 54))" << false; - QTest::newRow( "within" ) << "geometry_overlay_within('rectangles')" << "POINT(-83 47)" << true; - QTest::newRow( "within [cached]" ) << "geometry_overlay_within('rectangles',cache:=true)" << "POINT(-83 47)" << true; + QTest::newRow( "within" ) << "overlay_within('rectangles')" << "POINT(-83 47)" << true; + QTest::newRow( "within [cached]" ) << "overlay_within('rectangles',cache:=true)" << "POINT(-83 47)" << true; - QTest::newRow( "within no match" ) << "geometry_overlay_within('rectangles')" << "POINT(-122 43)" << false; - QTest::newRow( "within no match [cached]" ) << "geometry_overlay_within('rectangles',cache:=true)" << "POINT(-122 43)" << false; + QTest::newRow( "within no match" ) << "overlay_within('rectangles')" << "POINT(-122 43)" << false; + QTest::newRow( "within no match [cached]" ) << "overlay_within('rectangles',cache:=true)" << "POINT(-122 43)" << false; - QTest::newRow( "contains" ) << "geometry_overlay_contains('rectangles')" << "POLYGON((-166 15, -166 58, -107 58, -107 15, -166 15))" << true; - QTest::newRow( "contains [cached]" ) << "geometry_overlay_contains('rectangles',cache:=true)" << "POLYGON((-166 15, -166 58, -107 58, -107 15, -166 15))" << true; + QTest::newRow( "contains" ) << "overlay_contains('rectangles')" << "POLYGON((-166 15, -166 58, -107 58, -107 15, -166 15))" << true; + QTest::newRow( "contains [cached]" ) << "overlay_contains('rectangles',cache:=true)" << "POLYGON((-166 15, -166 58, -107 58, -107 15, -166 15))" << true; - QTest::newRow( "contains no match" ) << "geometry_overlay_contains('rectangles')" << "POLYGON((-156 46, -149 46, -148 37, -156 46))" << false; - QTest::newRow( "contains no match [cached]" ) << "geometry_overlay_contains('rectangles',cache:=true)" << "POLYGON((-156 46, -149 46, -148 37, -156 46))" << false; + QTest::newRow( "contains no match" ) << "overlay_contains('rectangles')" << "POLYGON((-156 46, -149 46, -148 37, -156 46))" << false; + QTest::newRow( "contains no match [cached]" ) << "overlay_contains('rectangles',cache:=true)" << "POLYGON((-156 46, -149 46, -148 37, -156 46))" << false; - QTest::newRow( "equals" ) << "geometry_overlay_equals('rectangles')" << "MULTIPOLYGON(((-160 50, -145 50, -145 35, -160 35, -160 50)))" << true; - QTest::newRow( "equals [cached]" ) << "geometry_overlay_equals('rectangles',cache:=true)" << "MULTIPOLYGON(((-160 50, -145 50, -145 35, -160 35, -160 50)))" << true; + QTest::newRow( "equals" ) << "overlay_equals('rectangles')" << "MULTIPOLYGON(((-160 50, -145 50, -145 35, -160 35, -160 50)))" << true; + QTest::newRow( "equals [cached]" ) << "overlay_equals('rectangles',cache:=true)" << "MULTIPOLYGON(((-160 50, -145 50, -145 35, -160 35, -160 50)))" << true; - QTest::newRow( "equals no match" ) << "geometry_overlay_equals('rectangles')" << "POLYGON((-156 46, -149 46, -148 37, -156 46))" << false; - QTest::newRow( "equals no match [cached]" ) << "geometry_overlay_equals('rectangles',cache:=true)" << "POLYGON((-156 46, -149 46, -148 37, -156 46))" << false; + QTest::newRow( "equals no match" ) << "overlay_equals('rectangles')" << "POLYGON((-156 46, -149 46, -148 37, -156 46))" << false; + QTest::newRow( "equals no match [cached]" ) << "overlay_equals('rectangles',cache:=true)" << "POLYGON((-156 46, -149 46, -148 37, -156 46))" << false; - QTest::newRow( "disjoint" ) << "geometry_overlay_disjoint('rectangles')" << "LINESTRING(-155 15, -122 55, -84 4)" << true; - QTest::newRow( "disjoint [cached]" ) << "geometry_overlay_disjoint('rectangles',cache:=true)" << "LINESTRING(-155 15, -122 55, -84 4)" << true; + QTest::newRow( "disjoint" ) << "overlay_disjoint('rectangles')" << "LINESTRING(-155 15, -122 55, -84 4)" << true; + QTest::newRow( "disjoint [cached]" ) << "overlay_disjoint('rectangles',cache:=true)" << "LINESTRING(-155 15, -122 55, -84 4)" << true; - QTest::newRow( "disjoint no match" ) << "geometry_overlay_disjoint('rectangles')" << "LINESTRING(-155 15, -122 32, -84 4)" << false; - QTest::newRow( "disjoint no match [cached]" ) << "geometry_overlay_disjoint('rectangles',cache:=true)" << "LINESTRING(-155 15, -122 32, -84 4)" << false; + QTest::newRow( "disjoint no match" ) << "overlay_disjoint('rectangles')" << "LINESTRING(-155 15, -122 32, -84 4)" << false; + QTest::newRow( "disjoint no match [cached]" ) << "overlay_disjoint('rectangles',cache:=true)" << "LINESTRING(-155 15, -122 32, -84 4)" << false; } void TestQgsOverlayExpression::testOverlayExpression() @@ -184,44 +184,44 @@ void TestQgsOverlayExpression::testOverlayExpression_data() QTest::addColumn( "geometry" ); QTest::addColumn( "expectedResult" ); - QTest::newRow( "intersects get geometry" ) << "geometry_overlay_intersects('rectangles', geom_to_wkt($geometry))" << "POLYGON((-120 30, -105 30, -105 20, -120 20, -120 30))" << QVariantList { QVariant( QStringLiteral( "MultiPolygon (((-130 40, -115 40, -115 25, -130 25, -130 40)))" ) ) }; - QTest::newRow( "intersects get geometry [cached]" ) << "geometry_overlay_intersects('rectangles', geom_to_wkt($geometry),cache:=true)" << "POLYGON((-120 30, -105 30, -105 20, -120 20, -120 30))" << QVariantList { QVariant( QStringLiteral( "MultiPolygon (((-130 40, -115 40, -115 25, -130 25, -130 40)))" ) ) }; + QTest::newRow( "intersects get geometry" ) << "overlay_intersects('rectangles', geom_to_wkt($geometry))" << "POLYGON((-120 30, -105 30, -105 20, -120 20, -120 30))" << QVariantList { QVariant( QStringLiteral( "MultiPolygon (((-130 40, -115 40, -115 25, -130 25, -130 40)))" ) ) }; + QTest::newRow( "intersects get geometry [cached]" ) << "overlay_intersects('rectangles', geom_to_wkt($geometry),cache:=true)" << "POLYGON((-120 30, -105 30, -105 20, -120 20, -120 30))" << QVariantList { QVariant( QStringLiteral( "MultiPolygon (((-130 40, -115 40, -115 25, -130 25, -130 40)))" ) ) }; - QTest::newRow( "intersects get ids" ) << "geometry_overlay_intersects('rectangles', id)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 1, 2, 3 }; - QTest::newRow( "intersects get ids [cached]" ) << "geometry_overlay_intersects('rectangles', id,cache:=true)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 1, 2, 3 }; + QTest::newRow( "intersects get ids" ) << "overlay_intersects('rectangles', id)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 1, 2, 3 }; + QTest::newRow( "intersects get ids [cached]" ) << "overlay_intersects('rectangles', id,cache:=true)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 1, 2, 3 }; - QTest::newRow( "intersects get ids limit 2" ) << "geometry_overlay_intersects('rectangles', id, limit:=2)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 1, 2 }; - QTest::newRow( "intersects get ids limit 2 [cached]" ) << "geometry_overlay_intersects('rectangles', id, limit:=2,cache:=true)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 1, 2 }; + QTest::newRow( "intersects get ids limit 2" ) << "overlay_intersects('rectangles', id, limit:=2)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 1, 2 }; + QTest::newRow( "intersects get ids limit 2 [cached]" ) << "overlay_intersects('rectangles', id, limit:=2,cache:=true)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 1, 2 }; - QTest::newRow( "intersects filtered get ids" ) << "geometry_overlay_intersects('rectangles', id, id!=2)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 1, 3 }; - QTest::newRow( "intersects filtered get ids [cached]" ) << "geometry_overlay_intersects('rectangles', id, id!=2,cache:=true)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 1, 3 }; + QTest::newRow( "intersects filtered get ids" ) << "overlay_intersects('rectangles', id, id!=2)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 1, 3 }; + QTest::newRow( "intersects filtered get ids [cached]" ) << "overlay_intersects('rectangles', id, id!=2,cache:=true)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 1, 3 }; - QTest::newRow( "intersects filtered get ids limit 1" ) << "geometry_overlay_intersects('rectangles', id, id!=1, 1)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 2 }; - QTest::newRow( "intersects filtered get ids limit 1 [cached]" ) << "geometry_overlay_intersects('rectangles', id, id!=1, 1,cache:=true)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 2 }; + QTest::newRow( "intersects filtered get ids limit 1" ) << "overlay_intersects('rectangles', id, id!=1, 1)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 2 }; + QTest::newRow( "intersects filtered get ids limit 1 [cached]" ) << "overlay_intersects('rectangles', id, id!=1, 1,cache:=true)" << "LINESTRING(-178 52, -133 33, -64 46)" << QVariantList { 2 }; - QTest::newRow( "touches get ids" ) << "geometry_overlay_touches('rectangles',id)" << "POLYGON((-86 54, -95 50, -81 50, -86 54))" << QVariantList { 3 }; - QTest::newRow( "touches get ids [cached]" ) << "geometry_overlay_touches('rectangles',id,cache:=true)" << "POLYGON((-86 54, -95 50, -81 50, -86 54))" << QVariantList { 3 }; + QTest::newRow( "touches get ids" ) << "overlay_touches('rectangles',id)" << "POLYGON((-86 54, -95 50, -81 50, -86 54))" << QVariantList { 3 }; + QTest::newRow( "touches get ids [cached]" ) << "overlay_touches('rectangles',id,cache:=true)" << "POLYGON((-86 54, -95 50, -81 50, -86 54))" << QVariantList { 3 }; - QTest::newRow( "equals get ids" ) << "geometry_overlay_equals('rectangles',id)" << "MULTIPOLYGON(((-160 50, -145 50, -145 35, -160 35, -160 50)))" << QVariantList { 1 }; - QTest::newRow( "equals get ids [cached]" ) << "geometry_overlay_equals('rectangles',id,cache:=true)" << "MULTIPOLYGON(((-160 50, -145 50, -145 35, -160 35, -160 50)))" << QVariantList { 1 }; + QTest::newRow( "equals get ids" ) << "overlay_equals('rectangles',id)" << "MULTIPOLYGON(((-160 50, -145 50, -145 35, -160 35, -160 50)))" << QVariantList { 1 }; + QTest::newRow( "equals get ids [cached]" ) << "overlay_equals('rectangles',id,cache:=true)" << "MULTIPOLYGON(((-160 50, -145 50, -145 35, -160 35, -160 50)))" << QVariantList { 1 }; - QTest::newRow( "disjoint get ids" ) << "geometry_overlay_disjoint('rectangles',id)" << "LINESTRING(-155 15, -122 55, -84 4)" << QVariantList { 1, 2, 3 }; - QTest::newRow( "disjoint get ids [cached]" ) << "geometry_overlay_disjoint('rectangles',id,cache:=true)" << "LINESTRING(-155 15, -122 55, -84 4)" << QVariantList { 1, 2, 3 }; + QTest::newRow( "disjoint get ids" ) << "overlay_disjoint('rectangles',id)" << "LINESTRING(-155 15, -122 55, -84 4)" << QVariantList { 1, 2, 3 }; + QTest::newRow( "disjoint get ids [cached]" ) << "overlay_disjoint('rectangles',id,cache:=true)" << "LINESTRING(-155 15, -122 55, -84 4)" << QVariantList { 1, 2, 3 }; - QTest::newRow( "disjoint get ids limit 2" ) << "geometry_overlay_disjoint('rectangles',id, limit:=2)" << "LINESTRING(-155 15, -122 55, -84 4)" << QVariantList { 1, 2 }; - QTest::newRow( "disjoint get ids limit 2 [cached]" ) << "geometry_overlay_disjoint('rectangles',id, limit:=2,cache:=true)" << "LINESTRING(-155 15, -122 55, -84 4)" << QVariantList { 1, 2 }; + QTest::newRow( "disjoint get ids limit 2" ) << "overlay_disjoint('rectangles',id, limit:=2)" << "LINESTRING(-155 15, -122 55, -84 4)" << QVariantList { 1, 2 }; + QTest::newRow( "disjoint get ids limit 2 [cached]" ) << "overlay_disjoint('rectangles',id, limit:=2,cache:=true)" << "LINESTRING(-155 15, -122 55, -84 4)" << QVariantList { 1, 2 }; - QTest::newRow( "nearest" ) << "geometry_overlay_nearest('rectangles',id)" << "POINT(-135 38)" << QVariantList { 2 }; - QTest::newRow( "nearest [cached]" ) << "geometry_overlay_nearest('rectangles',id,cache:=true)" << "POINT(-135 38)" << QVariantList { 2 }; + QTest::newRow( "nearest" ) << "overlay_nearest('rectangles',id)" << "POINT(-135 38)" << QVariantList { 2 }; + QTest::newRow( "nearest [cached]" ) << "overlay_nearest('rectangles',id,cache:=true)" << "POINT(-135 38)" << QVariantList { 2 }; - QTest::newRow( "nearest filtered" ) << "geometry_overlay_nearest('rectangles',id,id!=2)" << "POINT(-135 38)" << QVariantList { 1 }; - QTest::newRow( "nearest filtered [cached]" ) << "geometry_overlay_nearest('rectangles',id,id!=2,cache:=true)" << "POINT(-135 38)" << QVariantList { 1 }; + QTest::newRow( "nearest filtered" ) << "overlay_nearest('rectangles',id,id!=2)" << "POINT(-135 38)" << QVariantList { 1 }; + QTest::newRow( "nearest filtered [cached]" ) << "overlay_nearest('rectangles',id,id!=2,cache:=true)" << "POINT(-135 38)" << QVariantList { 1 }; - QTest::newRow( "nearest limited" ) << "geometry_overlay_nearest('rectangles',id,limit:=2)" << "POINT(-135 38)" << QVariantList { 2, 1 }; - QTest::newRow( "nearest limited [cached]" ) << "geometry_overlay_nearest('rectangles',id,limit:=2,cache:=true)" << "POINT(-135 38)" << QVariantList { 2, 1 }; + QTest::newRow( "nearest limited" ) << "overlay_nearest('rectangles',id,limit:=2)" << "POINT(-135 38)" << QVariantList { 2, 1 }; + QTest::newRow( "nearest limited [cached]" ) << "overlay_nearest('rectangles',id,limit:=2,cache:=true)" << "POINT(-135 38)" << QVariantList { 2, 1 }; - QTest::newRow( "nearest limited filtered" ) << "geometry_overlay_nearest('rectangles',id,id!=2,limit:=2)" << "POINT(-135 38)" << QVariantList { 1, 3 }; - QTest::newRow( "nearest limited filtered [cached]" ) << "geometry_overlay_nearest('rectangles',id,id!=2,limit:=2,cache:=true)" << "POINT(-135 38)" << QVariantList { 1, 3 }; + QTest::newRow( "nearest limited filtered" ) << "overlay_nearest('rectangles',id,id!=2,limit:=2)" << "POINT(-135 38)" << QVariantList { 1, 3 }; + QTest::newRow( "nearest limited filtered [cached]" ) << "overlay_nearest('rectangles',id,id!=2,limit:=2,cache:=true)" << "POINT(-135 38)" << QVariantList { 1, 3 }; } @@ -231,7 +231,7 @@ void TestQgsOverlayExpression::testOverlaySelf() context.appendScope( QgsExpressionContextUtils::projectScope( QgsProject::instance() ) ); context.appendScope( QgsExpressionContextUtils::layerScope( mPolyLayer ) ); - QgsExpression exp( "geometry_overlay_intersects('polys')" ); + QgsExpression exp( "overlay_intersects('polys')" ); QVERIFY2( exp.prepare( &context ), exp.parserErrorString().toUtf8().constData() ); QgsFeature feat; From a775957e86cd9aea3aaaeeaaa7f3bd8004cdadbf Mon Sep 17 00:00:00 2001 From: Ian Turton Date: Wed, 7 Oct 2020 10:53:14 +0100 Subject: [PATCH 04/48] add robustness --- src/providers/wms/qgswmsprovider.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp index 39b67249938c..dd3f7ceadeba 100644 --- a/src/providers/wms/qgswmsprovider.cpp +++ b/src/providers/wms/qgswmsprovider.cpp @@ -3026,7 +3026,8 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRa { // rewrite the URL if the one in the capabilities document is incorrect // strip every thing after the ? from the base url - const QString base = mSettings.mBaseUrl.split( QRegularExpression( "\\?" ) )[0]; + const QList parts = mSettings.mBaseUrl.split( QRegularExpression( "\\?" ) ); + const QString base = parts.isEmpty() ? mSettings.mBaseUrl : parts.first(); // and strip everything before the `rest` element (at least for GeoServer) const int index = url.length() - url.lastIndexOf( QStringLiteral( "rest" ) ) + 1; // +1 for the / url = base + url.right( index ); @@ -3054,7 +3055,6 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRa else if ( !getFeatureInfoUrl().isNull() ) { // KVP - QgsDebugMsg( QStringLiteral( "KVP ignore GetFeatureURL %1" ).arg( mSettings.mIgnoreGetFeatureInfoUrl ) ); QUrl url( mSettings.mIgnoreGetFeatureInfoUrl ? mSettings.mBaseUrl : getFeatureInfoUrl() ); QUrlQuery query( url ); From 1bce97188e8db3833eae92ad1b4f73aad586ed89 Mon Sep 17 00:00:00 2001 From: Ian Turton Date: Wed, 7 Oct 2020 11:18:39 +0100 Subject: [PATCH 05/48] swtich to QStringList --- src/providers/wms/qgswmsprovider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp index dd3f7ceadeba..244886af6984 100644 --- a/src/providers/wms/qgswmsprovider.cpp +++ b/src/providers/wms/qgswmsprovider.cpp @@ -3026,7 +3026,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRa { // rewrite the URL if the one in the capabilities document is incorrect // strip every thing after the ? from the base url - const QList parts = mSettings.mBaseUrl.split( QRegularExpression( "\\?" ) ); + const QStringList parts = mSettings.mBaseUrl.split( QRegularExpression( "\\?" ) ); const QString base = parts.isEmpty() ? mSettings.mBaseUrl : parts.first(); // and strip everything before the `rest` element (at least for GeoServer) const int index = url.length() - url.lastIndexOf( QStringLiteral( "rest" ) ) + 1; // +1 for the / From d3d88e2df8ea77e6ed8b3e70c84aaf64ee769ba4 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 7 Oct 2020 21:12:57 +0200 Subject: [PATCH 06/48] [OGR provider] Remove calls to ResetReading() in changeGeometryValues() and changeGeometryValues() in situations where this is safe to do Such calls will cause issues in the context of transaction groups where feature iterators will share the same connection handle. --- src/core/providers/ogr/qgsogrprovider.cpp | 44 +++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/src/core/providers/ogr/qgsogrprovider.cpp b/src/core/providers/ogr/qgsogrprovider.cpp index a7a3ad09b801..6451a5326608 100644 --- a/src/core/providers/ogr/qgsogrprovider.cpp +++ b/src/core/providers/ogr/qgsogrprovider.cpp @@ -2306,6 +2306,22 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap &attr_ const bool inTransaction = startTransaction(); + // Some drivers may need to call ResetReading() after GetFeature(), such + // as GPKG in GDAL < 2.3.0 to avoid letting the database in a locked state. + // But this is undesirable in general, so don't do this when we know that + // we don't need to. + bool mayNeedResetReadingAfterGetFeature = true; + if ( mGDALDriverName == QLatin1String( "ESRI Shapefile" ) ) + { + mayNeedResetReadingAfterGetFeature = false; + } +#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,3,0) + else if ( mGDALDriverName == QLatin1String( "GPKG" ) ) + { + mayNeedResetReadingAfterGetFeature = false; + } +#endif + for ( QgsChangedAttributesMap::const_iterator it = attr_map.begin(); it != attr_map.end(); ++it ) { QgsFeatureId fid = it.key(); @@ -2320,7 +2336,11 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap &attr_ pushError( tr( "Feature %1 for attribute update not found." ).arg( fid ) ); continue; } - mOgrLayer->ResetReading(); // needed for SQLite-based to clear iterator + + if ( mayNeedResetReadingAfterGetFeature ) + { + mOgrLayer->ResetReading(); + } QgsLocaleNumC l; @@ -2489,6 +2509,22 @@ bool QgsOgrProvider::changeGeometryValues( const QgsGeometryMap &geometry_map ) const bool inTransaction = startTransaction(); + // Some drivers may need to call ResetReading() after GetFeature(), such + // as GPKG in GDAL < 2.3.0 to avoid letting the database in a locked state. + // But this is undesirable in general, so don't do this when we know that + // we don't need to. + bool mayNeedResetReadingAfterGetFeature = true; + if ( mGDALDriverName == QLatin1String( "ESRI Shapefile" ) ) + { + mayNeedResetReadingAfterGetFeature = false; + } +#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,3,0) + else if ( mGDALDriverName == QLatin1String( "GPKG" ) ) + { + mayNeedResetReadingAfterGetFeature = false; + } +#endif + for ( QgsGeometryMap::const_iterator it = geometry_map.constBegin(); it != geometry_map.constEnd(); ++it ) { gdal::ogr_feature_unique_ptr theOGRFeature( mOgrLayer->GetFeature( FID_TO_NUMBER( it.key() ) ) ); @@ -2497,7 +2533,11 @@ bool QgsOgrProvider::changeGeometryValues( const QgsGeometryMap &geometry_map ) pushError( tr( "OGR error changing geometry: feature %1 not found" ).arg( it.key() ) ); continue; } - mOgrLayer->ResetReading(); // needed for SQLite-based to clear iterator + + if ( mayNeedResetReadingAfterGetFeature ) + { + mOgrLayer->ResetReading(); // needed for SQLite-based to clear iterator, which could let the database in a locked state otherwise + } OGRGeometryH newGeometry = nullptr; QByteArray wkb = it->asWkb(); From 505ef99328f8d1ba63919aeb89d815a6c4ce679b Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Thu, 8 Oct 2020 12:15:17 +0200 Subject: [PATCH 07/48] Skip potential reset reading calls --- .../providers/ogr/qgsogrfeatureiterator.cpp | 75 ++++++++++++------- .../providers/ogr/qgsogrfeatureiterator.h | 8 +- src/core/providers/ogr/qgsogrprovider.cpp | 2 +- tests/src/python/test_provider_ogr_gpkg.py | 31 ++++++++ 4 files changed, 88 insertions(+), 28 deletions(-) diff --git a/src/core/providers/ogr/qgsogrfeatureiterator.cpp b/src/core/providers/ogr/qgsogrfeatureiterator.cpp index 2d69538fc10f..391c387e360c 100644 --- a/src/core/providers/ogr/qgsogrfeatureiterator.cpp +++ b/src/core/providers/ogr/qgsogrfeatureiterator.cpp @@ -41,12 +41,22 @@ ///@cond PRIVATE -QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool ownSource, const QgsFeatureRequest &request ) +QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool ownSource, const QgsFeatureRequest &request, QgsTransaction *transaction ) : QgsAbstractFeatureIteratorFromSource( source, ownSource, request ) , mSharedDS( source->mSharedDS ) , mFirstFieldIsFid( source->mFirstFieldIsFid ) , mFieldsWithoutFid( source->mFieldsWithoutFid ) { + + /* When inside a transaction for GPKG/SQLite and fetching fid(s) we might be nested inside an outer fetching loop, + * (see GH #39178) so we need to skip all calls that might reset the reading (rewind) to avoid an endless loop in the + * outer fetching iterator that uses the same connection. + */ + mDoNotResetReading = transaction && + ( source->mDriverName == QLatin1String( "GPKG" ) || source->mDriverName == QLatin1String( "SQLite" ) ) && + ( mRequest.filterType() == QgsFeatureRequest::FilterType::FilterFid + || mRequest.filterType() == QgsFeatureRequest::FilterType::FilterFids ); + for ( const auto &id : mRequest.filterFids() ) { mFilterFids.insert( id ); @@ -85,7 +95,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool return; } - if ( !mSource->mSubsetString.isEmpty() ) + if ( ! mDoNotResetReading && !mSource->mSubsetString.isEmpty() ) { mOgrLayerOri = mOgrLayer; mOgrLayer = QgsOgrProviderUtils::setSubsetString( mOgrLayer, mConn->ds, mSource->mEncoding, mSource->mSubsetString ); @@ -165,17 +175,20 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool } // spatial query to select features - if ( !mFilterRect.isNull() ) + if ( ! mDoNotResetReading ) { - OGR_L_SetSpatialFilterRect( mOgrLayer, mFilterRect.xMinimum(), mFilterRect.yMinimum(), mFilterRect.xMaximum(), mFilterRect.yMaximum() ); - if ( mOgrLayerOri && mOgrLayerOri != mOgrLayer ) - OGR_L_SetSpatialFilterRect( mOgrLayerOri, mFilterRect.xMinimum(), mFilterRect.yMinimum(), mFilterRect.xMaximum(), mFilterRect.yMaximum() ); - } - else - { - OGR_L_SetSpatialFilter( mOgrLayer, nullptr ); - if ( mOgrLayerOri && mOgrLayerOri != mOgrLayer ) - OGR_L_SetSpatialFilter( mOgrLayerOri, nullptr ); + if ( !mFilterRect.isNull() ) + { + OGR_L_SetSpatialFilterRect( mOgrLayer, mFilterRect.xMinimum(), mFilterRect.yMinimum(), mFilterRect.xMaximum(), mFilterRect.yMaximum() ); + if ( mOgrLayerOri && mOgrLayerOri != mOgrLayer ) + OGR_L_SetSpatialFilterRect( mOgrLayerOri, mFilterRect.xMinimum(), mFilterRect.yMinimum(), mFilterRect.xMaximum(), mFilterRect.yMaximum() ); + } + else + { + OGR_L_SetSpatialFilter( mOgrLayer, nullptr ); + if ( mOgrLayerOri && mOgrLayerOri != mOgrLayer ) + OGR_L_SetSpatialFilter( mOgrLayerOri, nullptr ); + } } if ( request.filterType() == QgsFeatureRequest::FilterExpression @@ -201,33 +214,38 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool QStringLiteral( ") AND (" ) + whereClause + QStringLiteral( ")" ); } - if ( OGR_L_SetAttributeFilter( mOgrLayer, mSource->mEncoding->fromUnicode( whereClause ).constData() ) == OGRERR_NONE ) - { - //if only partial success when compiling expression, we need to double-check results using QGIS' expressions - mExpressionCompiled = ( result == QgsSqlExpressionCompiler::Complete ); - mCompileStatus = ( mExpressionCompiled ? Compiled : PartiallyCompiled ); - } - else if ( !mSource->mSubsetString.isEmpty() ) + + if ( ! mDoNotResetReading ) { - // OGR rejected the compiled expression. Make sure we restore the original subset string if set (and do the filtering on QGIS' side) - OGR_L_SetAttributeFilter( mOgrLayer, mSource->mEncoding->fromUnicode( mSource->mSubsetString ).constData() ); + if ( OGR_L_SetAttributeFilter( mOgrLayer, mSource->mEncoding->fromUnicode( whereClause ).constData() ) == OGRERR_NONE ) + { + //if only partial success when compiling expression, we need to double-check results using QGIS' expressions + mExpressionCompiled = ( result == QgsSqlExpressionCompiler::Complete ); + mCompileStatus = ( mExpressionCompiled ? Compiled : PartiallyCompiled ); + } + else if ( !mSource->mSubsetString.isEmpty() ) + { + // OGR rejected the compiled expression. Make sure we restore the original subset string if set (and do the filtering on QGIS' side) + OGR_L_SetAttributeFilter( mOgrLayer, mSource->mEncoding->fromUnicode( mSource->mSubsetString ).constData() ); + } } + } - else if ( mSource->mSubsetString.isEmpty() ) + else if ( mSource->mSubsetString.isEmpty() && ! mDoNotResetReading ) { OGR_L_SetAttributeFilter( mOgrLayer, nullptr ); } delete compiler; } - else if ( mSource->mSubsetString.isEmpty() ) + else if ( mSource->mSubsetString.isEmpty() && ! mDoNotResetReading ) { OGR_L_SetAttributeFilter( mOgrLayer, nullptr ); } - //start with first feature rewind(); + } QgsOgrFeatureIterator::~QgsOgrFeatureIterator() @@ -249,7 +267,7 @@ bool QgsOgrFeatureIterator::fetchFeatureWithId( QgsFeatureId id, QgsFeature &fea gdal::ogr_feature_unique_ptr fet; #if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,2,0) - if ( !QgsOgrProviderUtils::canDriverShareSameDatasetAmongLayers( mSource->mDriverName ) ) + if ( ! mDoNotResetReading && !QgsOgrProviderUtils::canDriverShareSameDatasetAmongLayers( mSource->mDriverName ) ) { OGRLayerH nextFeatureBelongingLayer; bool found = false; @@ -381,6 +399,10 @@ bool QgsOgrFeatureIterator::fetchFeature( QgsFeature &feature ) void QgsOgrFeatureIterator::resetReading() { + if ( mDoNotResetReading ) + { + return; + } #if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,2,0) if ( !QgsOgrProviderUtils::canDriverShareSameDatasetAmongLayers( mSource->mDriverName ) ) { @@ -561,6 +583,7 @@ QgsOgrFeatureSource::QgsOgrFeatureSource( const QgsOgrProvider *p ) { if ( p->mTransaction ) { + mTransaction = p->mTransaction; mSharedDS = p->mTransaction->sharedDS(); } for ( int i = ( p->mFirstFieldIsFid ) ? 1 : 0; i < mFields.size(); i++ ) @@ -575,7 +598,7 @@ QgsOgrFeatureSource::~QgsOgrFeatureSource() QgsFeatureIterator QgsOgrFeatureSource::getFeatures( const QgsFeatureRequest &request ) { - return QgsFeatureIterator( new QgsOgrFeatureIterator( this, false, request ) ); + return QgsFeatureIterator( new QgsOgrFeatureIterator( this, false, request, mTransaction ) ); } ///@endcond diff --git a/src/core/providers/ogr/qgsogrfeatureiterator.h b/src/core/providers/ogr/qgsogrfeatureiterator.h index 8e58e48e1094..029dbff611d0 100644 --- a/src/core/providers/ogr/qgsogrfeatureiterator.h +++ b/src/core/providers/ogr/qgsogrfeatureiterator.h @@ -56,6 +56,7 @@ class QgsOgrFeatureSource final: public QgsAbstractFeatureSource QgsCoordinateReferenceSystem mCrs; QgsWkbTypes::Type mWkbType = QgsWkbTypes::Unknown; QgsOgrDatasetSharedPtr mSharedDS = nullptr; + QgsTransaction *mTransaction = nullptr; friend class QgsOgrFeatureIterator; friend class QgsOgrExpressionCompiler; @@ -64,7 +65,7 @@ class QgsOgrFeatureSource final: public QgsAbstractFeatureSource class QgsOgrFeatureIterator final: public QgsAbstractFeatureIteratorFromSource { public: - QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool ownSource, const QgsFeatureRequest &request ); + QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool ownSource, const QgsFeatureRequest &request, QgsTransaction *transaction ); ~QgsOgrFeatureIterator() override; @@ -102,6 +103,11 @@ class QgsOgrFeatureIterator final: public QgsAbstractFeatureIteratorFromSource( featureSource() ), true, request ) ); + return QgsFeatureIterator( new QgsOgrFeatureIterator( static_cast( featureSource() ), true, request, mTransaction ) ); } diff --git a/tests/src/python/test_provider_ogr_gpkg.py b/tests/src/python/test_provider_ogr_gpkg.py index fed9365dfa82..dd867837aef4 100644 --- a/tests/src/python/test_provider_ogr_gpkg.py +++ b/tests/src/python/test_provider_ogr_gpkg.py @@ -1768,6 +1768,37 @@ def testTransactionGroup(self): self.assertFalse(vl1_1.isEditable()) self.assertFalse(vl1_2.isEditable()) + def testTransactionGroupIterator(self): + """Test issue GH #39178: the bug is that this test hangs + forever in an endless loop""" + + project = QgsProject() + project.setAutoTransaction(True) + tmpfile = os.path.join( + self.basetestpath, 'tempGeoPackageTransactionGroupIterator.gpkg') + ds = ogr.GetDriverByName('GPKG').CreateDataSource(tmpfile) + lyr = ds.CreateLayer('test', geom_type=ogr.wkbPoint) + lyr.CreateField(ogr.FieldDefn('str_field', ogr.OFTString)) + + f = ogr.Feature(lyr.GetLayerDefn()) + f.SetGeometry(ogr.CreateGeometryFromWkt('POINT (1 1)')) + f.SetField('str_field', 'one') + lyr.CreateFeature(f) + + del lyr + del ds + + vl = QgsVectorLayer(tmpfile + '|layername=test', 'test', 'ogr') + project.addMapLayers([vl]) + + self.assertTrue(vl.startEditing()) + + for f in vl.getFeatures(): + self.assertTrue(vl.changeAttributeValue(1, 1, 'new value')) + + # Test that QGIS sees the new changes + self.assertEqual(next(vl.getFeatures()).attribute(1), 'new value') + if __name__ == '__main__': unittest.main() From 02c168a29d30a2cc6d29756978177797822bd484 Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Thu, 8 Oct 2020 13:29:41 +0200 Subject: [PATCH 08/48] mDoNotResetReading -> mAllowResetReading --- .../providers/ogr/qgsogrfeatureiterator.cpp | 22 +++++++++---------- .../providers/ogr/qgsogrfeatureiterator.h | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/core/providers/ogr/qgsogrfeatureiterator.cpp b/src/core/providers/ogr/qgsogrfeatureiterator.cpp index 391c387e360c..ae5886ee0ced 100644 --- a/src/core/providers/ogr/qgsogrfeatureiterator.cpp +++ b/src/core/providers/ogr/qgsogrfeatureiterator.cpp @@ -52,10 +52,10 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool * (see GH #39178) so we need to skip all calls that might reset the reading (rewind) to avoid an endless loop in the * outer fetching iterator that uses the same connection. */ - mDoNotResetReading = transaction && - ( source->mDriverName == QLatin1String( "GPKG" ) || source->mDriverName == QLatin1String( "SQLite" ) ) && - ( mRequest.filterType() == QgsFeatureRequest::FilterType::FilterFid - || mRequest.filterType() == QgsFeatureRequest::FilterType::FilterFids ); + mAllowResetReading = ! transaction || + ( source->mDriverName != QLatin1String( "GPKG" ) & source->mDriverName != QLatin1String( "SQLite" ) ) || + ( mRequest.filterType() != QgsFeatureRequest::FilterType::FilterFid + && mRequest.filterType() != QgsFeatureRequest::FilterType::FilterFids ); for ( const auto &id : mRequest.filterFids() ) { @@ -95,7 +95,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool return; } - if ( ! mDoNotResetReading && !mSource->mSubsetString.isEmpty() ) + if ( mAllowResetReading && !mSource->mSubsetString.isEmpty() ) { mOgrLayerOri = mOgrLayer; mOgrLayer = QgsOgrProviderUtils::setSubsetString( mOgrLayer, mConn->ds, mSource->mEncoding, mSource->mSubsetString ); @@ -175,7 +175,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool } // spatial query to select features - if ( ! mDoNotResetReading ) + if ( mAllowResetReading ) { if ( !mFilterRect.isNull() ) { @@ -215,7 +215,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool QStringLiteral( ")" ); } - if ( ! mDoNotResetReading ) + if ( mAllowResetReading ) { if ( OGR_L_SetAttributeFilter( mOgrLayer, mSource->mEncoding->fromUnicode( whereClause ).constData() ) == OGRERR_NONE ) { @@ -231,14 +231,14 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool } } - else if ( mSource->mSubsetString.isEmpty() && ! mDoNotResetReading ) + else if ( mSource->mSubsetString.isEmpty() && mAllowResetReading ) { OGR_L_SetAttributeFilter( mOgrLayer, nullptr ); } delete compiler; } - else if ( mSource->mSubsetString.isEmpty() && ! mDoNotResetReading ) + else if ( mSource->mSubsetString.isEmpty() && mAllowResetReading ) { OGR_L_SetAttributeFilter( mOgrLayer, nullptr ); } @@ -267,7 +267,7 @@ bool QgsOgrFeatureIterator::fetchFeatureWithId( QgsFeatureId id, QgsFeature &fea gdal::ogr_feature_unique_ptr fet; #if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,2,0) - if ( ! mDoNotResetReading && !QgsOgrProviderUtils::canDriverShareSameDatasetAmongLayers( mSource->mDriverName ) ) + if ( mAllowResetReading && !QgsOgrProviderUtils::canDriverShareSameDatasetAmongLayers( mSource->mDriverName ) ) { OGRLayerH nextFeatureBelongingLayer; bool found = false; @@ -399,7 +399,7 @@ bool QgsOgrFeatureIterator::fetchFeature( QgsFeature &feature ) void QgsOgrFeatureIterator::resetReading() { - if ( mDoNotResetReading ) + if ( ! mAllowResetReading ) { return; } diff --git a/src/core/providers/ogr/qgsogrfeatureiterator.h b/src/core/providers/ogr/qgsogrfeatureiterator.h index 029dbff611d0..51ca9d304e57 100644 --- a/src/core/providers/ogr/qgsogrfeatureiterator.h +++ b/src/core/providers/ogr/qgsogrfeatureiterator.h @@ -103,10 +103,10 @@ class QgsOgrFeatureIterator final: public QgsAbstractFeatureIteratorFromSource Date: Thu, 8 Oct 2020 13:41:34 +0200 Subject: [PATCH 09/48] Update src/core/providers/ogr/qgsogrfeatureiterator.cpp Co-authored-by: Even Rouault --- src/core/providers/ogr/qgsogrfeatureiterator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/providers/ogr/qgsogrfeatureiterator.cpp b/src/core/providers/ogr/qgsogrfeatureiterator.cpp index ae5886ee0ced..d773fccb1052 100644 --- a/src/core/providers/ogr/qgsogrfeatureiterator.cpp +++ b/src/core/providers/ogr/qgsogrfeatureiterator.cpp @@ -53,7 +53,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool * outer fetching iterator that uses the same connection. */ mAllowResetReading = ! transaction || - ( source->mDriverName != QLatin1String( "GPKG" ) & source->mDriverName != QLatin1String( "SQLite" ) ) || + ( source->mDriverName != QLatin1String( "GPKG" ) && source->mDriverName != QLatin1String( "SQLite" ) ) || ( mRequest.filterType() != QgsFeatureRequest::FilterType::FilterFid && mRequest.filterType() != QgsFeatureRequest::FilterType::FilterFids ); From fd495d06db8c310eb164413dcd6c59b61519d32d Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Thu, 8 Oct 2020 15:52:16 +0200 Subject: [PATCH 10/48] Skip test on GDAL < 2.3 --- tests/src/python/test_provider_ogr_gpkg.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/src/python/test_provider_ogr_gpkg.py b/tests/src/python/test_provider_ogr_gpkg.py index dd867837aef4..ba88f611738e 100644 --- a/tests/src/python/test_provider_ogr_gpkg.py +++ b/tests/src/python/test_provider_ogr_gpkg.py @@ -1768,6 +1768,7 @@ def testTransactionGroup(self): self.assertFalse(vl1_1.isEditable()) self.assertFalse(vl1_2.isEditable()) + @unittest.skipIf(int(gdal.VersionInfo('VERSION_NUM')) < GDAL_COMPUTE_VERSION(2, 3, 0), "GDAL 2.3 required") def testTransactionGroupIterator(self): """Test issue GH #39178: the bug is that this test hangs forever in an endless loop""" From 7216045a7e354c9cd31f5f6e1c54569ef8344a1b Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Fri, 9 Oct 2020 13:26:37 +1000 Subject: [PATCH 11/48] [layouts] Allow negative values for grid annotation distance This works, it was just blocked by the spin box minimum value --- src/gui/layout/qgslayoutmapgridwidget.cpp | 3 +++ src/ui/layout/qgslayoutmapgridwidgetbase.ui | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/gui/layout/qgslayoutmapgridwidget.cpp b/src/gui/layout/qgslayoutmapgridwidget.cpp index aceacec30c22..88aeb01db735 100644 --- a/src/gui/layout/qgslayoutmapgridwidget.cpp +++ b/src/gui/layout/qgslayoutmapgridwidget.cpp @@ -55,6 +55,9 @@ QgsLayoutMapGridWidget::QgsLayoutMapGridWidget( QgsLayoutItemMapGrid *mapGrid, Q mGridFrameMarginSpinBox->setShowClearButton( true ); mGridFrameMarginSpinBox->setClearValue( 0 ); + mDistanceToMapFrameSpinBox->setShowClearButton( true ); + mDistanceToMapFrameSpinBox->setClearValue( 0 ); + connect( mIntervalXSpinBox, &QgsDoubleSpinBox::editingFinished, this, &QgsLayoutMapGridWidget::mIntervalXSpinBox_editingFinished ); connect( mIntervalYSpinBox, &QgsDoubleSpinBox::editingFinished, this, &QgsLayoutMapGridWidget::mIntervalYSpinBox_editingFinished ); connect( mOffsetXSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutMapGridWidget::mOffsetXSpinBox_valueChanged ); diff --git a/src/ui/layout/qgslayoutmapgridwidgetbase.ui b/src/ui/layout/qgslayoutmapgridwidgetbase.ui index 9466005aa1a6..4815fafc2649 100644 --- a/src/ui/layout/qgslayoutmapgridwidgetbase.ui +++ b/src/ui/layout/qgslayoutmapgridwidgetbase.ui @@ -884,6 +884,9 @@ mm + + -99.000000000000000 + From 72c867365df4e1b49726e7fbf599f5e60f715d23 Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Fri, 9 Oct 2020 17:05:33 +0200 Subject: [PATCH 12/48] Transaction group: keep editing status after save Fixes #39282 --- src/core/qgstransactiongroup.cpp | 8 +++---- src/core/qgstransactiongroup.h | 2 +- .../src/python/test_qgspostgrestransaction.py | 21 +++++++++++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/core/qgstransactiongroup.cpp b/src/core/qgstransactiongroup.cpp index fb99c150701c..1ba97b1f3518 100644 --- a/src/core/qgstransactiongroup.cpp +++ b/src/core/qgstransactiongroup.cpp @@ -85,7 +85,7 @@ void QgsTransactionGroup::onEditingStarted() { mTransaction->addLayer( layer ); layer->startEditing(); - connect( layer, &QgsVectorLayer::beforeCommitChanges, this, &QgsTransactionGroup::onCommitChanges ); + connect( layer, &QgsVectorLayer::beforeCommitChanges, this, &QgsTransactionGroup::onBeforeCommitChanges ); connect( layer, &QgsVectorLayer::beforeRollBack, this, &QgsTransactionGroup::onRollback ); } } @@ -95,7 +95,7 @@ void QgsTransactionGroup::onLayerDeleted() mLayers.remove( static_cast( sender() ) ); } -void QgsTransactionGroup::onCommitChanges() +void QgsTransactionGroup::onBeforeCommitChanges( bool stopEditing ) { if ( mEditingStopping ) return; @@ -111,7 +111,7 @@ void QgsTransactionGroup::onCommitChanges() for ( QgsVectorLayer *layer : constMLayers ) { if ( layer != sender() ) - layer->commitChanges(); + layer->commitChanges( stopEditing ); } disableTransaction(); @@ -160,7 +160,7 @@ void QgsTransactionGroup::disableTransaction() const auto constMLayers = mLayers; for ( QgsVectorLayer *layer : constMLayers ) { - disconnect( layer, &QgsVectorLayer::beforeCommitChanges, this, &QgsTransactionGroup::onCommitChanges ); + disconnect( layer, &QgsVectorLayer::beforeCommitChanges, this, &QgsTransactionGroup::onBeforeCommitChanges ); disconnect( layer, &QgsVectorLayer::beforeRollBack, this, &QgsTransactionGroup::onRollback ); } } diff --git a/src/core/qgstransactiongroup.h b/src/core/qgstransactiongroup.h index 6800534093d2..158b3183be3b 100644 --- a/src/core/qgstransactiongroup.h +++ b/src/core/qgstransactiongroup.h @@ -82,7 +82,7 @@ class CORE_EXPORT QgsTransactionGroup : public QObject private slots: void onEditingStarted(); void onLayerDeleted(); - void onCommitChanges(); + void onBeforeCommitChanges( bool stopEditing ); void onRollback(); private: diff --git a/tests/src/python/test_qgspostgrestransaction.py b/tests/src/python/test_qgspostgrestransaction.py index 898e9ccf22ec..9c7a35a73a75 100644 --- a/tests/src/python/test_qgspostgrestransaction.py +++ b/tests/src/python/test_qgspostgrestransaction.py @@ -104,6 +104,27 @@ def test_transactionsGroup(self): self.assertIsNone(noTg) self.rollbackTransaction() + def test_transactionGroupEditingStatus(self): + """Not particularly related to PG but it fits here nicely: test GH #39282""" + + project = QgsProject() + project.setAutoTransaction(True) + + vl_b = QgsVectorLayer(self.dbconn + ' sslmode=disable key=\'pk\' table="qgis_test"."books" sql=', 'books', + 'postgres') + vl_a = QgsVectorLayer(self.dbconn + ' sslmode=disable key=\'pk\' table="qgis_test"."authors" sql=', + 'authors', 'postgres') + + project.addMapLayers([vl_a, vl_b]) + + vl_a.startEditing() + self.assertTrue(vl_a.isEditable()) + self.assertTrue(vl_b.isEditable()) + + self.assertTrue(vl_a.commitChanges(False)) + self.assertTrue(vl_a.isEditable()) + self.assertTrue(vl_b.isEditable()) + if __name__ == '__main__': unittest.main() From 9d0618631597b506b23486a91bba4f56203b8a9e Mon Sep 17 00:00:00 2001 From: Peter Petrik Date: Fri, 9 Oct 2020 17:34:11 +0200 Subject: [PATCH 13/48] fix crashes in QGIS 3D, mostly directly at project load --- src/3d/terrain/qgsdemterraintileloader_p.cpp | 21 +++++++++++++------- src/3d/terrain/qgsdemterraintileloader_p.h | 3 +++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/3d/terrain/qgsdemterraintileloader_p.cpp b/src/3d/terrain/qgsdemterraintileloader_p.cpp index fd3129c1fad3..7ce7f95f564a 100644 --- a/src/3d/terrain/qgsdemterraintileloader_p.cpp +++ b/src/3d/terrain/qgsdemterraintileloader_p.cpp @@ -27,6 +27,7 @@ #include "qgsterraingenerator.h" #include +#include ///@cond PRIVATE @@ -268,14 +269,9 @@ void QgsDemHeightMapGenerator::waitForFinished() } } -float QgsDemHeightMapGenerator::heightAt( double x, double y ) +void QgsDemHeightMapGenerator::lazyLoadDtmCoarseData( int res, const QgsRectangle &rect ) { - if ( !mDtm ) - return 0; // TODO: calculate heights for online DTM - - // TODO: this is quite a primitive implementation: better to use heightmaps currently in use - int res = 1024; - QgsRectangle rect = mDtm->extent(); + QMutexLocker locker( &mLazyLoadDtmCoarseDataMutex ); if ( mDtmCoarseData.isEmpty() ) { std::unique_ptr< QgsRasterBlock > block( mDtm->dataProvider()->block( 1, rect, res, res ) ); @@ -283,6 +279,17 @@ float QgsDemHeightMapGenerator::heightAt( double x, double y ) mDtmCoarseData = block->data(); mDtmCoarseData.detach(); // make a deep copy } +} + +float QgsDemHeightMapGenerator::heightAt( double x, double y ) +{ + if ( !mDtm ) + return 0; // TODO: calculate heights for online DTM + + // TODO: this is quite a primitive implementation: better to use heightmaps currently in use + int res = 1024; + QgsRectangle rect = mDtm->extent(); + lazyLoadDtmCoarseData( res, rect ); int cellX = ( int )( ( x - rect.xMinimum() ) / rect.width() * res + .5f ); int cellY = ( int )( ( rect.yMaximum() - y ) / rect.height() * res + .5f ); diff --git a/src/3d/terrain/qgsdemterraintileloader_p.h b/src/3d/terrain/qgsdemterraintileloader_p.h index 6a80338f544f..11706b394f13 100644 --- a/src/3d/terrain/qgsdemterraintileloader_p.h +++ b/src/3d/terrain/qgsdemterraintileloader_p.h @@ -32,6 +32,7 @@ #include #include #include +#include #include "qgschunknode_p.h" #include "qgsrectangle.h" @@ -133,6 +134,8 @@ class QgsDemHeightMapGenerator : public QObject QHash*, JobData> mJobs; + void lazyLoadDtmCoarseData( int res, const QgsRectangle &rect ); + mutable QMutex mLazyLoadDtmCoarseDataMutex; //! used for height queries QByteArray mDtmCoarseData; }; From f940ffc6d0db4aaa818e0debc93269f1f889cdf5 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Fri, 9 Oct 2020 21:26:06 +0200 Subject: [PATCH 14/48] GUI: renaming GPKG layer: allow any character but | (fixes #39288) --- src/gui/providers/ogr/qgsgeopackageitemguiprovider.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/providers/ogr/qgsgeopackageitemguiprovider.cpp b/src/gui/providers/ogr/qgsgeopackageitemguiprovider.cpp index 514a18b6285f..4d16e6585aab 100644 --- a/src/gui/providers/ogr/qgsgeopackageitemguiprovider.cpp +++ b/src/gui/providers/ogr/qgsgeopackageitemguiprovider.cpp @@ -262,6 +262,7 @@ void QgsGeoPackageItemGuiProvider::renameVectorLayer() QVariantMap data = s->data().toMap(); const QString uri = data[QStringLiteral( "uri" )].toString(); const QString key = data[QStringLiteral( "key" )].toString(); + // Collect existing table names const QStringList tableNames = data[QStringLiteral( "tableNames" )].toStringList(); QPointer< QgsDataItem > item = data[QStringLiteral( "item" )].value>(); QgsDataItemGuiContext context = data[QStringLiteral( "context" )].value< QgsDataItemGuiContext >(); @@ -270,8 +271,10 @@ void QgsGeoPackageItemGuiProvider::renameVectorLayer() QVariantMap pieces( QgsProviderRegistry::instance()->decodeUri( key, uri ) ); QString layerName = pieces[QStringLiteral( "layerName" )].toString(); - // Collect existing table names - const QRegExp checkRe( QStringLiteral( R"re([A-Za-z_][A-Za-z0-9_\s]+)re" ) ); + // Allow any character, except |, which could create confusion, due to it being + // the URI componenent separator. And ideally we should remove that restriction + // by using proper escaping of | + const QRegExp checkRe( QStringLiteral( R"re([^|]+)re" ) ); QgsNewNameDialog dlg( uri, layerName, QStringList(), tableNames, checkRe ); dlg.setOverwriteEnabled( false ); From 6829e6351e1dab18f1fa0c0443107eb7617794c7 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Fri, 9 Oct 2020 13:47:31 +1000 Subject: [PATCH 15/48] [layouts] Fix resizing multiline label items to adjust to the size of their text --- src/core/layout/qgslayoututils.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/layout/qgslayoututils.cpp b/src/core/layout/qgslayoututils.cpp index 4174495d5069..a4211e85532d 100644 --- a/src/core/layout/qgslayoututils.cpp +++ b/src/core/layout/qgslayoututils.cpp @@ -220,13 +220,21 @@ double QgsLayoutUtils::textWidthMM( const QFont &font, const QString &text ) { //upscale using FONT_WORKAROUND_SCALE //ref: http://osgeo-org.1560.x6.nabble.com/Multi-line-labels-and-font-bug-td4157152.html + + const QStringList multiLineSplit = text.split( '\n' ); QFont metricsFont = scaledFontPixelSize( font ); QFontMetricsF fontMetrics( metricsFont ); + + double maxWidth = 0; + for ( const QString &line : multiLineSplit ) + { #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) - return ( fontMetrics.width( text ) / FONT_WORKAROUND_SCALE ); + maxWidth = std::max( maxWidth, ( fontMetrics.width( line ) / FONT_WORKAROUND_SCALE ) ); #else - return ( fontMetrics.horizontalAdvance( text ) / FONT_WORKAROUND_SCALE ); + maxWidth = std::max( maxWidth, ( fontMetrics.horizontalAdvance( line ) / FONT_WORKAROUND_SCALE ) ); #endif + } + return maxWidth; } double QgsLayoutUtils::textHeightMM( const QFont &font, const QString &text, double multiLineHeight ) From b788aa2559181705a68ff1ad9c48174a94be85fc Mon Sep 17 00:00:00 2001 From: Salvatore Larosa Date: Sat, 10 Oct 2020 08:56:38 +0200 Subject: [PATCH 16/48] [ui] use a lower size for border in metadata information --- src/core/qgsapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/qgsapplication.cpp b/src/core/qgsapplication.cpp index 627732f591b5..2a913e6dd32d 100644 --- a/src/core/qgsapplication.cpp +++ b/src/core/qgsapplication.cpp @@ -1460,7 +1460,7 @@ QString QgsApplication::reportStyleSheet( QgsApplication::StyleSheetType styleSh " width: 95%;" "}" ".tabular-view th, .tabular-view td { " - " border:10px solid black;" + " border:1px solid black;" "}" ); break; From 1c06551be884af86b3c7b62cb02840abd5e2a64e Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 11 Oct 2020 01:22:04 +0200 Subject: [PATCH 17/48] Add scripts/qstringfixup.py and .sh The .py script is the lower level one that acts on a single file. The .sh one is the one aimed at being used by the user: - qstringfixup.sh without argument fixes up files modified in git - qstringfixup.sh --all runs on all .h/.cpp files under src/ and tests/ --- scripts/qstringfixup.py | 214 ++++++++++++++++++++++++++++++++++++++++ scripts/qstringfixup.sh | 71 +++++++++++++ 2 files changed, 285 insertions(+) create mode 100644 scripts/qstringfixup.py create mode 100755 scripts/qstringfixup.sh diff --git a/scripts/qstringfixup.py b/scripts/qstringfixup.py new file mode 100644 index 000000000000..185423091858 --- /dev/null +++ b/scripts/qstringfixup.py @@ -0,0 +1,214 @@ +#!/usr/bin/env python +########################################################################### +# qstringfixup.py +# --------------- +# Date : October 2020 +# Copyright : (C) 2020 by Even Rouault +# Email : even.rouault@spatialys.com +########################################################################### +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +########################################################################### + +# This script fixes several suboptimal uses of QStringLiteral where QLatin1String would be better +# It is not automatically run yet. + +# Run it on whole code base with: +# ../scripts/qstringfixup.sh --all + +# or on modified files only with: +# ../scripts/qstringfixup.sh + +import re +import sys + +lines = [l[0:-1] if l[-1] == '\n' else l for l in open(sys.argv[1], "rt").readlines()] + +# Double quoted strings that only include ASCII characters +string_literal = r"""(R?"(?:(?:\\['"\\nrt])|[\x00-\x21\x23-\x5B\x5D-\x7F])+?")""" + +# Single quoted ASCII character +char_literal = r"""('(?:\\['"\\nrt]|[\x00-\x26\x28-\x5B\x5D-\x7F])')""" + +# Simple expression like foo or foo.bar() or foo.bar(baz, baw) +simple_expr = r"""([a-zA-Z0-9_:<>]+(?:\.(?:[a-zA-Z0-9_]+\([^\(\)]*\)|[a-zA-Z0-9_]+))?)""" + +qsl = r"""QStringLiteral\( {string_literal} \)""".format(string_literal=string_literal) + +# Find lines like " foo += QStringLiteral( "bla" ); // optional comment" +pattern_plus_equal = re.compile(r'^([ ]*)([^ ]+) \+= {qsl};([ ]*//.*)?$'.format(qsl=qsl)) + +# Find patterns like "...QString( tr( "foo" ) )..." +pattern_qstring_tr = re.compile(r"""(.*)QString\( tr\( {string_literal} \) \)(.*)""".format(string_literal=string_literal)) + +# Find patterns like "...== QStringLiteral( "foo" ) something that is not like .arg()" +pattern_equalequal_qsl = re.compile(r'(.*)(==|!=) ' + qsl + r'( \)| \|\|| &&| }|;| \?| ,)(.*)') + +# Find patterns like "...startsWith( QStringLiteral( "foo" ) )..." +pattern_startswith_qsl = re.compile(r'(.*)\.(startsWith|endsWith|indexOf|lastIndexOf|compare)\( {qsl} \)(.*)'.format(qsl=qsl)) + +# .replace( 'a' or simple_expr or qsl, QStringLiteral( "foo" ) ) +replace_char_qsl = re.compile(r"""(.*)\.replace\( {char_literal}, {qsl} \)(.*)""".format(char_literal=char_literal, qsl=qsl)) +replace_str_qsl = re.compile(r"""(.*)\.replace\( {string_literal}, {qsl} \)(.*)""".format(string_literal=string_literal, qsl=qsl)) +# Do not use that: if simple_expr is a QRegExp, there is no QString::replace(QRegExp, QLatin1String) +# replace_simple_expr_qsl = re.compile(r"""(.*)\.replace\( {simple_expr}, {qsl} \)(.*)""".format(simple_expr=simple_expr, qsl=qsl)) + +# .replace( QStringLiteral( "foo" ), QStringLiteral( "foo" ) ) +replace_qsl_qsl = re.compile(r"""(.*)\.replace\( {qsl}, {qsl} \)(.*)""".format(qsl=qsl)) + +# .replace( QStringLiteral( "foo" ), something +replace_qsl_something = re.compile(r"""(.*)\.replace\( {qsl}, (.+)""".format(qsl=qsl)) + +# .arg( QStringLiteral( "foo" ) ) +# note: QString QString::arg(QLatin1String a) added in QT 5.10, but using QLatin1String() will work with older too +arg_qsl = re.compile(r"""(.*)\.arg\( {qsl} \)(.*)""".format(qsl=qsl)) + +# .join( QStringLiteral( "foo" ) ) +join = re.compile(r"""(.*)\.join\( {qsl} \)(.*)""".format(qsl=qsl)) + +# if QT >= 5.14 .compare would be ok +qlatin1str_single_char = re.compile(r"""(.*)(.startsWith\(|.endsWith\(|.indexOf\(|.lastIndexOf\(|\+=) QLatin1String\( ("[^"]") \)(.*)""") + + +def qlatin1char_or_string(x): + """ x is a double quoted string """ + if len(x) == 3 and x[1] == "'": + return "QLatin1Char( '\\'' )" + elif len(x) == 3: + return "QLatin1Char( '" + x[1] + "' )" + elif len(x) == 4 and x[1] == "\\": + return "QLatin1Char( '" + x[1:3] + "' )" + else: + return "QLatin1String( " + x + " )" + + +i = 0 +while i < len(lines): + line = lines[i] + modified = False + + m = pattern_plus_equal.match(line) + if m: + g = m.groups() + newline = g[0] + g[1] + ' += ' + newline += 'QLatin1String( ' + g[2] + ' );' + if g[3]: + newline += g[3] + line = newline + + m = pattern_qstring_tr.match(line) + if m: + g = m.groups() + newline = g[0] + 'tr( ' + g[1] + ' )' + if g[2]: + newline += g[2] + line = newline + + while True: + m = pattern_equalequal_qsl.match(line) + if m and 'qgetenv' not in line and 'h.first' not in line: + g = m.groups() + newline = g[0] + g[1] + ' QLatin1String( ' + g[2] + ' )' + g[3] + if g[4]: + newline += g[4] + line = newline + else: + break + + while True: + m = pattern_startswith_qsl.match(line) + if m: + g = m.groups() + newline = g[0] + '.' + g[1] + '( QLatin1String( ' + g[2] + ' ) )' + if g[3]: + newline += g[3] + line = newline + else: + break + + while True: + m = replace_char_qsl.match(line) + if not m: + m = replace_str_qsl.match(line) + # if not m: + # m = replace_simple_expr_qsl.match(line) + if m: + g = m.groups() + newline = g[0] + '.replace( ' + g[1] + ', QLatin1String( ' + g[2] + ' ) )' + if g[3]: + newline += g[3] + line = newline + else: + break + + while True: + m = replace_qsl_qsl.match(line) + if m: + g = m.groups() + newline = g[0] + '.replace( QLatin1String( ' + g[1] + ' ), QLatin1String( ' + g[2] + ' ) )' + if g[3]: + newline += g[3] + line = newline + else: + break + + while True: + m = replace_qsl_something.match(line) + if m: + g = m.groups() + newline = g[0] + '.replace( QLatin1String( ' + g[1] + ' ), ' + g[2] + line = newline + else: + break + + while True: + m = arg_qsl.match(line) + if m: + g = m.groups() + newline = g[0] + '.arg( QLatin1String( ' + g[1] + ') )' + if g[2]: + newline += g[2] + line = newline + else: + break + + while True: + m = join.match(line) + if m: + g = m.groups() + newline = g[0] + '.join( ' + qlatin1char_or_string(g[1]) + ' )' + if g[2]: + newline += g[2] + line = newline + else: + break + + while True: + m = qlatin1str_single_char.match(line) + if m: + g = m.groups() + newline = g[0] + g[1] + ' ' + qlatin1char_or_string(g[2]) + if g[3]: + newline += g[3] + line = newline + else: + break + + print(line) + i += 1 diff --git a/scripts/qstringfixup.sh b/scripts/qstringfixup.sh new file mode 100755 index 000000000000..8fd168996500 --- /dev/null +++ b/scripts/qstringfixup.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +########################################################################### +# qstringfixup.sh +# --------------- +# Date : October 2020 +# Copyright : (C) 2020 by Even Rouault +# Email : even.rouault@spatialys.com +########################################################################### +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +########################################################################### + +TOPLEVEL=$(git rev-parse --show-toplevel) + +cd "$TOPLEVEL" || exit + +# GNU prefix command for mac os support (gsed, gsplit) +GP= +if [[ "$OSTYPE" =~ darwin* ]]; then + GP=g +fi + +if test "$1" == "--all"; then + MODIFIED=$(find src tests -name "*.h" -o -name "*.cpp") +else + # determine changed files + MODIFIED=$(git status --porcelain| ${GP}sed -ne "s/^ *[MA] *//p" | sort -u) +fi + +if [ -z "$MODIFIED" ]; then + echo nothing was modified + exit 0 +fi + +for f in $MODIFIED; do + + case "$f" in + *.cpp|*.h) + ;; + + *) + continue + ;; + esac + + m=$f.qstringfixup + python "${TOPLEVEL}/scripts/qstringfixup.py" "$f" > "$m" + if diff -u "$m" "$f" >/dev/null; then + # no difference found + rm "$m" + else + echo "Patching $f" + mv "$m" "$f" + fi +done From a76670e521923f6773c78cb4b3f4220649867503 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 11 Oct 2020 01:27:04 +0200 Subject: [PATCH 18/48] QStringLiteral -> QLatin1String changes generated by scripts/qstringfixup.sh --all --- .../auto_generated/diagram/qgsdiagram.sip.in | 8 +- .../auto_generated/qgsdiagramrenderer.sip.in | 4 +- .../symbology/qgsrenderer.sip.in | 20 +- .../vectortile/qgsvectortilelabeling.sip.in | 2 +- .../vectortile/qgsvectortilerenderer.sip.in | 2 +- src/3d/qgs3dutils.cpp | 6 +- src/3d/qgsskyboxsettings.cpp | 4 +- src/3d/symbols/qgspoint3dsymbol.cpp | 14 +- .../processing/qgsalgorithmattributeindex.cpp | 2 +- .../processing/qgsalgorithmbuffer.cpp | 2 +- .../processing/qgsalgorithmconstantraster.cpp | 18 +- .../qgsalgorithmexecutespatialitequery.cpp | 4 +- .../qgsalgorithmlayoutatlastoimage.cpp | 2 +- .../processing/qgsalgorithmlayouttoimage.cpp | 2 +- .../processing/qgsalgorithmrandomraster.cpp | 10 +- .../qgsalgorithmrepairshapefile.cpp | 2 +- .../qgsalgorithmsetlayerencoding.cpp | 2 +- .../qgsalgorithmshpencodinginfo.cpp | 2 +- .../processing/qgsalgorithmspatialindex.cpp | 2 +- src/analysis/raster/qgsrastercalculator.cpp | 8 +- .../qgsgeometryduplicatecheck.cpp | 2 +- src/app/3d/qgsrulebased3drendererwidget.cpp | 2 +- src/app/3d/qgsvectorlayer3drendererwidget.cpp | 2 +- .../browser/qgsinbuiltdataitemproviders.cpp | 8 +- src/app/dwg/qgsdwgimportdialog.cpp | 2 +- src/app/dwg/qgsdwgimporter.cpp | 2 +- src/app/georeferencer/qgsgeorefmainwindow.cpp | 6 +- src/app/gps/qgsgpsinformationwidget.cpp | 4 +- src/app/layout/qgslayoutdesignerdialog.cpp | 4 +- src/app/locator/qgsinbuiltlocatorfilters.cpp | 8 +- src/app/options/qgscodeeditoroptions.cpp | 4 +- src/app/pluginmanager/qgspluginmanager.cpp | 6 +- .../qgspluginsortfilterproxymodel.cpp | 4 +- src/app/qgisapp.cpp | 44 +-- src/app/qgisappstylesheet.cpp | 6 +- src/app/qgsabout.cpp | 4 +- src/app/qgsattributetabledialog.cpp | 2 +- src/app/qgsclipboard.cpp | 14 +- src/app/qgscustomization.cpp | 4 +- src/app/qgscustomprojectiondialog.cpp | 6 +- src/app/qgsguivectorlayertools.cpp | 2 +- src/app/qgshandlebadlayers.cpp | 10 +- src/app/qgslayertreeviewbadlayerindicator.cpp | 2 +- src/app/qgsmergeattributesdialog.cpp | 8 +- src/app/qgsprojectproperties.cpp | 12 +- src/app/qgsrecentprojectsitemsmodel.cpp | 4 +- src/app/qgssnappinglayertreemodel.cpp | 4 +- src/app/qgsstatisticalsummarydockwidget.cpp | 6 +- src/app/qgsstatusbarcoordinateswidget.cpp | 2 +- src/app/qgsvariantdelegate.cpp | 2 +- .../qgsvectorlayerdigitizingproperties.cpp | 2 +- src/app/qgsversionmigration.cpp | 2 +- src/app/qgswelcomepage.cpp | 2 +- .../qgsvectortilelayerproperties.cpp | 4 +- src/auth/basic/qgsauthbasicmethod.cpp | 8 +- src/auth/oauth2/qgsauthoauth2config.cpp | 4 +- src/auth/oauth2/qgsauthoauth2edit.cpp | 4 +- src/auth/oauth2/qgsauthoauth2method.cpp | 2 +- src/auth/oauth2/qgso2.cpp | 4 +- src/auth/pkipaths/qgsauthpkipathsedit.cpp | 4 +- src/auth/pkipkcs12/qgsauthpkcs12edit.cpp | 4 +- src/core/auth/qgsauthcertutils.cpp | 6 +- src/core/auth/qgsauthconfig.cpp | 2 +- src/core/diagram/qgsdiagram.h | 8 +- src/core/effects/qgsgloweffect.cpp | 2 +- src/core/expression/qgsexpression.cpp | 14 +- src/core/expression/qgsexpressionfunction.cpp | 2 +- src/core/expression/qgsexpressionnodeimpl.cpp | 2 +- .../qgsvaluerelationfieldformatter.cpp | 2 +- src/core/geocms/geonode/qgsgeonoderequest.cpp | 8 +- src/core/geometry/qgscircularstring.cpp | 2 +- src/core/geometry/qgscompoundcurve.cpp | 2 +- src/core/geometry/qgscurvepolygon.cpp | 2 +- src/core/geometry/qgsgeometrycollection.cpp | 2 +- src/core/geometry/qgsgeometrymakevalid.cpp | 2 +- src/core/geometry/qgslinestring.cpp | 2 +- src/core/geometry/qgspoint.cpp | 2 +- src/core/gps/qgsnmeaconnection.cpp | 2 +- src/core/labeling/qgspallabeling.cpp | 2 +- src/core/layertree/qgslayertreegroup.cpp | 2 +- src/core/layertree/qgslayertreemodel.cpp | 2 +- src/core/layout/qgsabstractreportsection.cpp | 4 +- src/core/layout/qgscompositionconverter.cpp | 10 +- src/core/layout/qgslayout.cpp | 4 +- src/core/layout/qgslayoutatlas.cpp | 2 +- src/core/layout/qgslayoutexporter.cpp | 2 +- src/core/layout/qgslayoutgridsettings.cpp | 4 +- src/core/layout/qgslayoutguidecollection.cpp | 4 +- src/core/layout/qgslayoutitem.cpp | 2 +- src/core/layout/qgslayoutmanager.cpp | 4 +- src/core/layout/qgslayoutmultiframe.cpp | 2 +- src/core/layout/qgslayoutpagecollection.cpp | 4 +- src/core/layout/qgslayoutsnapper.cpp | 4 +- .../layout/qgsreportsectionfieldgroup.cpp | 2 +- src/core/mesh/qgsmeshdatasetgroupstore.cpp | 4 +- src/core/mesh/qgsmeshlayer.cpp | 2 +- src/core/mesh/qgsmeshlayerutils.cpp | 12 +- .../metadata/qgslayermetadataformatter.cpp | 26 +- .../models/qgsprocessingmodelalgorithm.cpp | 4 +- .../models/qgsprocessingmodeloutput.cpp | 2 +- .../processing/qgsprocessingalgorithm.cpp | 4 +- src/core/processing/qgsprocessingfeedback.cpp | 10 +- .../qgsprocessingparameteraggregate.cpp | 2 +- .../qgsprocessingparameterfieldmap.cpp | 2 +- .../processing/qgsprocessingparameters.cpp | 328 +++++++++--------- src/core/processing/qgsprocessingutils.cpp | 16 +- src/core/providers/gdal/qgsgdaldataitems.cpp | 4 +- src/core/providers/gdal/qgsgdalprovider.cpp | 20 +- .../ogr/qgsgeopackageprojectstorage.cpp | 4 +- .../ogr/qgsgeopackageproviderconnection.cpp | 4 +- src/core/providers/ogr/qgsogrdataitems.cpp | 8 +- src/core/providers/ogr/qgsogrdbconnection.cpp | 2 +- src/core/providers/ogr/qgsogrprovider.cpp | 30 +- src/core/qgsabstractcontentcache.h | 2 +- src/core/qgsapplication.cpp | 12 +- src/core/qgsauxiliarystorage.cpp | 2 +- src/core/qgsbookmarkmanager.cpp | 2 +- src/core/qgscolorramp.cpp | 2 +- src/core/qgscoordinatereferencesystem.cpp | 6 +- src/core/qgsdataitem.cpp | 4 +- src/core/qgsdatasourceuri.cpp | 6 +- src/core/qgsdiagramrenderer.h | 4 +- src/core/qgseventtracing.cpp | 2 +- src/core/qgsfeaturefiltermodel.cpp | 4 +- src/core/qgsfeaturerequest.cpp | 2 +- src/core/qgsfileutils.cpp | 4 +- src/core/qgsfontutils.cpp | 6 +- src/core/qgsgmlschema.cpp | 4 +- src/core/qgsimagecache.cpp | 4 +- src/core/qgsmaplayer.cpp | 2 +- src/core/qgsmaplayerlegend.cpp | 2 +- src/core/qgsmaplayermodel.cpp | 2 +- src/core/qgsmaprendererjob.cpp | 2 +- src/core/qgsmaprenderertask.cpp | 12 +- src/core/qgsmimedatautils.cpp | 2 +- src/core/qgsnewsfeedparser.cpp | 2 +- src/core/qgsofflineediting.cpp | 4 +- src/core/qgspathresolver.cpp | 6 +- src/core/qgspointxy.cpp | 2 +- src/core/qgspostgresstringutils.cpp | 4 +- src/core/qgsproject.cpp | 2 +- src/core/qgsprojectfiletransform.cpp | 18 +- src/core/qgsprojectservervalidator.cpp | 6 +- src/core/qgsrelation.cpp | 4 +- src/core/qgssnappingutils.cpp | 2 +- src/core/qgssourcecache.cpp | 2 +- src/core/qgssqlstatement.cpp | 8 +- src/core/qgsstringutils.cpp | 8 +- src/core/qgsvectordataprovider.cpp | 2 +- src/core/qgsvectorfilewriter.cpp | 4 +- src/core/qgsvectorlayer.cpp | 22 +- src/core/qgsvectorlayerexporter.cpp | 2 +- src/core/qgsvectorlayerrenderer.cpp | 2 +- src/core/qgsvectorlayertools.cpp | 2 +- src/core/qgsvirtuallayerdefinitionutils.cpp | 4 +- src/core/raster/qgshillshaderenderer.cpp | 2 +- src/core/raster/qgsrasterinterface.cpp | 4 +- src/core/raster/qgsrasterlayer.cpp | 10 +- src/core/raster/qgssinglebandgrayrenderer.cpp | 2 +- src/core/scalebar/qgsscalebarrenderer.cpp | 2 +- src/core/symbology/qgscptcityarchive.cpp | 2 +- src/core/symbology/qgsfillsymbollayer.cpp | 6 +- src/core/symbology/qgsrenderer.h | 20 +- src/core/symbology/qgsrulebasedrenderer.cpp | 6 +- src/core/symbology/qgsstyle.cpp | 242 ++++++------- src/core/symbology/qgsstylemodel.cpp | 4 +- src/core/symbology/qgssymbollayerutils.cpp | 4 +- src/core/textrenderer/qgstextformat.cpp | 2 +- .../vectortile/qgsmapboxglstyleconverter.cpp | 16 +- src/core/vectortile/qgsvectortilelabeling.h | 2 +- src/core/vectortile/qgsvectortilelayer.cpp | 30 +- .../vectortile/qgsvectortilelayerrenderer.cpp | 2 +- src/core/vectortile/qgsvectortileloader.cpp | 2 +- src/core/vectortile/qgsvectortilerenderer.h | 2 +- src/core/vectortile/qgsvectortilewriter.cpp | 6 +- src/crashhandler/qgscrashreport.cpp | 2 +- src/gui/auth/qgsauthcertificateinfo.cpp | 16 +- src/gui/auth/qgsautheditorwidgets.cpp | 2 +- src/gui/auth/qgsauthsslerrorsdialog.cpp | 2 +- src/gui/codeeditors/qgscodeeditor.cpp | 2 +- src/gui/codeeditors/qgscodeeditorpython.cpp | 2 +- .../core/qgseditorwidgetwrapper.cpp | 6 +- .../qgsrelationreferencewidget.cpp | 12 +- .../qgssearchwidgettoolbutton.cpp | 2 +- src/gui/editorwidgets/qgstexteditwrapper.cpp | 2 +- .../layertree/qgscustomlayerorderwidget.cpp | 2 +- src/gui/layertree/qgslayertreeview.cpp | 2 +- .../qgslayoutattributeselectiondialog.cpp | 2 +- src/gui/layout/qgslayoutmapwidget.cpp | 4 +- src/gui/mesh/qgsmeshlayerproperties.cpp | 4 +- .../qgsmeshrendereractivedatasetwidget.cpp | 8 +- src/gui/ogr/qgsogrhelperfunctions.cpp | 2 +- .../models/qgsmodeldesignerdialog.cpp | 2 +- .../qgsprocessingalgorithmdialogbase.cpp | 2 +- .../qgsprocessingconfigurationwidgets.cpp | 8 +- .../qgsprocessingoutputdestinationwidget.cpp | 4 +- .../qgsprocessingwidgetwrapperimpl.cpp | 4 +- src/gui/providers/gdal/qgsgdalguiprovider.cpp | 4 +- .../providers/gdal/qgsgdalsourceselect.cpp | 12 +- .../ogr/qgsgeopackageitemguiprovider.cpp | 6 +- .../providers/ogr/qgsogrdbsourceselect.cpp | 4 +- src/gui/providers/ogr/qgsogrsourceselect.cpp | 12 +- src/gui/qgsattributeform.cpp | 8 +- src/gui/qgscolorwidgets.cpp | 4 +- src/gui/qgscompoundcolorwidget.cpp | 2 +- src/gui/qgscoordinateoperationwidget.cpp | 10 +- src/gui/qgsexpressiontreeview.cpp | 4 +- src/gui/qgsfeaturelistcombobox.cpp | 2 +- src/gui/qgsfeatureselectiondlg.cpp | 2 +- src/gui/qgsfieldmappingmodel.cpp | 2 +- src/gui/qgsfiledownloaderdialog.cpp | 2 +- src/gui/qgsfilewidget.cpp | 6 +- src/gui/qgsguiutils.cpp | 2 +- src/gui/qgshelp.cpp | 8 +- src/gui/qgsmapcanvas.cpp | 2 +- src/gui/qgsmaptoolidentify.cpp | 2 +- src/gui/qgsmessagebar.cpp | 8 +- src/gui/qgsmessagebaritem.cpp | 2 +- src/gui/qgsmetadatawidget.cpp | 24 +- src/gui/qgsnewnamedialog.cpp | 4 +- src/gui/qgsnewvectortabledialog.cpp | 2 +- src/gui/qgsprojectionselectiontreewidget.cpp | 4 +- src/gui/qgspropertyoverridebutton.cpp | 2 +- src/gui/qgsquerybuilder.cpp | 4 +- src/gui/qgsrasterformatsaveoptionswidget.cpp | 2 +- src/gui/qgsrasterlayersaveasdialog.cpp | 22 +- src/gui/qgsrelationeditorwidget.cpp | 4 +- src/gui/qgssqlcomposerdialog.cpp | 10 +- src/gui/raster/qgsrasterlayerproperties.cpp | 4 +- .../symbology/qgslayerpropertieswidget.cpp | 2 +- .../symbology/qgsrulebasedrendererwidget.cpp | 2 +- src/gui/vector/qgsattributeactiondialog.cpp | 4 +- .../qgsattributeactionpropertiesdialog.cpp | 4 +- src/gui/vector/qgsvectorlayerproperties.cpp | 2 +- .../qgsvectortilebasiclabelingwidget.cpp | 2 +- .../qgsvectortilebasicrendererwidget.cpp | 2 +- .../qgsgeometrycheckerfixsummarydialog.cpp | 2 +- .../qgsgeometrycheckerresulttab.cpp | 4 +- .../gps_importer/qgsgpsdevicedialog.cpp | 24 +- src/plugins/grass/qgsgrassmodule.cpp | 6 +- src/plugins/grass/qgsgrassmoduleinput.cpp | 4 +- src/plugins/grass/qgsgrassmoduleoptions.cpp | 2 +- src/plugins/grass/qgsgrassmoduleparam.cpp | 8 +- src/plugins/grass/qgsgrasstools.cpp | 4 +- .../offline_editing_plugin_gui.cpp | 2 +- src/providers/arcgisrest/qgsafsprovider.cpp | 2 +- src/providers/arcgisrest/qgsamsprovider.cpp | 2 +- .../arcgisrest/qgsarcgisrestutils.cpp | 12 +- src/providers/db2/qgsdb2dataitems.cpp | 6 +- src/providers/db2/qgsdb2featureiterator.cpp | 2 +- src/providers/db2/qgsdb2geometrycolumns.cpp | 2 +- src/providers/db2/qgsdb2provider.cpp | 6 +- .../qgsdelimitedtextprovider.cpp | 12 +- src/providers/geonode/qgsgeonodedataitems.cpp | 6 +- .../geonode/qgsgeonodesourceselect.cpp | 6 +- src/providers/grass/qgsgrass.cpp | 10 +- .../grass/qgsgrassfeatureiterator.cpp | 2 +- .../grass/qgsgrassprovidermodule.cpp | 2 +- .../grass/qgsgrassvectormaplayer.cpp | 12 +- src/providers/mdal/qgsmdalprovider.cpp | 10 +- src/providers/mssql/qgsmssqldataitems.cpp | 2 +- .../mssql/qgsmssqlexpressioncompiler.cpp | 4 +- .../mssql/qgsmssqlfeatureiterator.cpp | 6 +- .../mssql/qgsmssqlgeomcolumntypethread.cpp | 4 +- src/providers/mssql/qgsmssqlprovider.cpp | 20 +- src/providers/oracle/qgsoracleconn.cpp | 12 +- .../oracle/qgsoraclefeatureiterator.cpp | 12 +- src/providers/postgres/qgspgsourceselect.cpp | 4 +- src/providers/postgres/qgspgtablemodel.cpp | 2 +- src/providers/postgres/qgspostgresconn.cpp | 18 +- src/providers/postgres/qgspostgresconn.h | 2 +- .../qgspostgresdataitemguiprovider.cpp | 2 +- .../postgres/qgspostgresdataitems.cpp | 2 +- .../postgres/qgspostgresfeatureiterator.cpp | 4 +- .../postgres/qgspostgresprovider.cpp | 34 +- .../qgspostgresproviderconnection.cpp | 10 +- .../raster/qgspostgresrasterprovider.cpp | 20 +- .../spatialite/qgsspatialiteconnection.cpp | 4 +- .../qgsspatialitedataitemguiprovider.cpp | 2 +- .../qgsspatialitefeatureiterator.cpp | 8 +- .../spatialite/qgsspatialiteprovider.cpp | 12 +- .../qgsvirtuallayerfeatureiterator.cpp | 8 +- .../virtual/qgsvirtuallayersqlitemodule.cpp | 4 +- src/providers/wcs/qgswcscapabilities.cpp | 4 +- src/providers/wcs/qgswcsprovider.cpp | 2 +- .../wfs/qgsbackgroundcachedshareddata.cpp | 10 +- src/providers/wfs/qgsoapifprovider.cpp | 4 +- src/providers/wfs/qgswfscapabilities.cpp | 2 +- src/providers/wfs/qgswfsdataitems.cpp | 2 +- src/providers/wfs/qgswfsdatasourceuri.cpp | 4 +- src/providers/wfs/qgswfsfeatureiterator.cpp | 2 +- src/providers/wfs/qgswfsprovider.cpp | 6 +- src/providers/wfs/qgswfsshareddata.cpp | 2 +- src/providers/wms/qgswmscapabilities.cpp | 6 +- src/providers/wms/qgswmsprovider.cpp | 34 +- src/providers/wms/qgswmssourceselect.cpp | 6 +- src/python/qgspythonutilsimpl.cpp | 2 +- .../qgsquickattributeformmodelbase.cpp | 4 +- src/quickgui/qgsquickfeatureslistmodel.cpp | 2 +- src/quickgui/qgsquickutils.cpp | 2 +- src/server/qgis_mapserver.cpp | 2 +- src/server/qgsaccesscontrol.cpp | 4 +- src/server/qgsconfigcache.cpp | 4 +- src/server/qgsrequesthandler.cpp | 2 +- src/server/qgsserverapiutils.cpp | 18 +- src/server/qgsserverexception.h | 4 +- src/server/qgsserverogcapihandler.cpp | 4 +- src/server/qgsserverparameters.cpp | 2 +- .../services/landingpage/qgslandingpage.cpp | 12 +- .../landingpage/qgslandingpagehandlers.cpp | 2 +- .../wfs/qgswfsdescribefeaturetype.cpp | 4 +- .../services/wfs/qgswfsgetcapabilities.cpp | 2 +- .../wfs/qgswfsgetcapabilities_1_0_0.cpp | 4 +- src/server/services/wfs/qgswfsgetfeature.cpp | 14 +- src/server/services/wfs/qgswfstransaction.cpp | 8 +- .../services/wfs/qgswfstransaction_1_0_0.cpp | 12 +- src/server/services/wfs3/qgswfs3handlers.cpp | 6 +- .../services/wms/qgswmsgetcapabilities.cpp | 2 +- src/server/services/wms/qgswmsparameters.cpp | 6 +- src/server/services/wms/qgswmsrenderer.cpp | 8 +- .../services/wms/qgswmsserviceexception.h | 4 +- tests/bench/qgsbench.cpp | 2 +- tests/src/analysis/testqgsprocessing.cpp | 16 +- tests/src/analysis/testqgsprocessingalgs.cpp | 16 +- tests/src/app/testqgsgpsinformationwidget.cpp | 8 +- tests/src/core/testqgsbrowsermodel.cpp | 2 +- tests/src/core/testqgscolorschemeregistry.cpp | 2 +- tests/src/core/testqgsgeometry.cpp | 8 +- tests/src/core/testqgsgeopdfexport.cpp | 38 +- tests/src/core/testqgsjsonutils.cpp | 2 +- tests/src/core/testqgslayoutgeopdfexport.cpp | 8 +- tests/src/core/testqgsmapsettings.cpp | 2 +- tests/src/core/testqgsmeshlayer.cpp | 24 +- tests/src/core/testqgsnewsfeedparser.cpp | 12 +- tests/src/core/testqgsofflineediting.cpp | 6 +- tests/src/core/testqgsogrutils.cpp | 2 +- tests/src/core/testqgsrastersublayer.cpp | 6 +- .../core/testqgssqliteexpressioncompiler.cpp | 2 +- tests/src/core/testqgsvectorfilewriter.cpp | 4 +- tests/src/gui/testqgsdatumtransformdialog.cpp | 2 +- tests/src/gui/testqgsfiledownloader.cpp | 2 +- tests/src/gui/testqgsogrprovidergui.cpp | 6 +- tests/src/gui/testqgstexteditwrapper.cpp | 4 +- .../gui/testqgsvaluerelationwidgetwrapper.cpp | 38 +- .../providers/grass/testqgsgrassprovider.cpp | 26 +- .../src/providers/testqgswcspublicservers.cpp | 8 +- tests/src/quickgui/testqgsquickutils.cpp | 4 +- 347 files changed, 1305 insertions(+), 1305 deletions(-) diff --git a/python/core/auto_generated/diagram/qgsdiagram.sip.in b/python/core/auto_generated/diagram/qgsdiagram.sip.in index 98147f089920..c04f176f4f26 100644 --- a/python/core/auto_generated/diagram/qgsdiagram.sip.in +++ b/python/core/auto_generated/diagram/qgsdiagram.sip.in @@ -21,13 +21,13 @@ Base class for all diagram types. public: %ConvertToSubClassCode - if ( sipCpp->diagramName() == QStringLiteral( "Pie" ) ) + if ( sipCpp->diagramName() == QLatin1String( "Pie" ) ) sipType = sipType_QgsPieDiagram; - else if ( sipCpp->diagramName() == QStringLiteral( "Histogram" ) ) + else if ( sipCpp->diagramName() == QLatin1String( "Histogram" ) ) sipType = sipType_QgsHistogramDiagram; - else if ( sipCpp->diagramName() == QStringLiteral( "Text" ) ) + else if ( sipCpp->diagramName() == QLatin1String( "Text" ) ) sipType = sipType_QgsTextDiagram; - else if ( sipCpp->diagramName() == QStringLiteral( "Stacked" ) ) + else if ( sipCpp->diagramName() == QLatin1String( "Stacked" ) ) sipType = sipType_QgsStackedBarDiagram; else sipType = NULL; diff --git a/python/core/auto_generated/qgsdiagramrenderer.sip.in b/python/core/auto_generated/qgsdiagramrenderer.sip.in index 5363fe52346e..f162f223d886 100644 --- a/python/core/auto_generated/qgsdiagramrenderer.sip.in +++ b/python/core/auto_generated/qgsdiagramrenderer.sip.in @@ -641,9 +641,9 @@ Evaluates and returns the diagram settings relating to a diagram for a specific #include "qgsdiagramrenderer.h" %End %ConvertToSubClassCode - if ( sipCpp->rendererName() == QStringLiteral( "SingleCategory" ) ) + if ( sipCpp->rendererName() == QLatin1String( "SingleCategory" ) ) sipType = sipType_QgsSingleCategoryDiagramRenderer; - else if ( sipCpp->rendererName() == QStringLiteral( "LinearlyInterpolated" ) ) + else if ( sipCpp->rendererName() == QLatin1String( "LinearlyInterpolated" ) ) sipType = sipType_QgsLinearlyInterpolatedDiagramRenderer; else sipType = NULL; diff --git a/python/core/auto_generated/symbology/qgsrenderer.sip.in b/python/core/auto_generated/symbology/qgsrenderer.sip.in index 8bd24ca26578..fa7725b5cabe 100644 --- a/python/core/auto_generated/symbology/qgsrenderer.sip.in +++ b/python/core/auto_generated/symbology/qgsrenderer.sip.in @@ -55,25 +55,25 @@ class QgsFeatureRenderer const QString type = sipCpp->type(); - if ( type == QStringLiteral( "singleSymbol" ) ) + if ( type == QLatin1String( "singleSymbol" ) ) sipType = sipType_QgsSingleSymbolRenderer; - else if ( type == QStringLiteral( "categorizedSymbol" ) ) + else if ( type == QLatin1String( "categorizedSymbol" ) ) sipType = sipType_QgsCategorizedSymbolRenderer; - else if ( type == QStringLiteral( "graduatedSymbol" ) ) + else if ( type == QLatin1String( "graduatedSymbol" ) ) sipType = sipType_QgsGraduatedSymbolRenderer; - else if ( type == QStringLiteral( "RuleRenderer" ) ) + else if ( type == QLatin1String( "RuleRenderer" ) ) sipType = sipType_QgsRuleBasedRenderer; - else if ( type == QStringLiteral( "heatmapRenderer" ) ) + else if ( type == QLatin1String( "heatmapRenderer" ) ) sipType = sipType_QgsHeatmapRenderer; - else if ( type == QStringLiteral( "invertedPolygonRenderer" ) ) + else if ( type == QLatin1String( "invertedPolygonRenderer" ) ) sipType = sipType_QgsInvertedPolygonRenderer; - else if ( type == QStringLiteral( "pointCluster" ) ) + else if ( type == QLatin1String( "pointCluster" ) ) sipType = sipType_QgsPointClusterRenderer; - else if ( type == QStringLiteral( "pointDisplacement" ) ) + else if ( type == QLatin1String( "pointDisplacement" ) ) sipType = sipType_QgsPointDisplacementRenderer; - else if ( type == QStringLiteral( "25dRenderer" ) ) + else if ( type == QLatin1String( "25dRenderer" ) ) sipType = sipType_Qgs25DRenderer; - else if ( type == QStringLiteral( "nullSymbol" ) ) + else if ( type == QLatin1String( "nullSymbol" ) ) sipType = sipType_QgsNullSymbolRenderer; else sipType = 0; diff --git a/python/core/auto_generated/vectortile/qgsvectortilelabeling.sip.in b/python/core/auto_generated/vectortile/qgsvectortilelabeling.sip.in index 4485c5af7872..7049f9ffb23e 100644 --- a/python/core/auto_generated/vectortile/qgsvectortilelabeling.sip.in +++ b/python/core/auto_generated/vectortile/qgsvectortilelabeling.sip.in @@ -26,7 +26,7 @@ Base class for labeling configuration classes for vector tile layers. const QString type = sipCpp->type(); - if ( type == QStringLiteral( "basic" ) ) + if ( type == QLatin1String( "basic" ) ) sipType = sipType_QgsVectorTileBasicLabeling; else sipType = 0; diff --git a/python/core/auto_generated/vectortile/qgsvectortilerenderer.sip.in b/python/core/auto_generated/vectortile/qgsvectortilerenderer.sip.in index 4bcf93e7e482..b16d1e85a10b 100644 --- a/python/core/auto_generated/vectortile/qgsvectortilerenderer.sip.in +++ b/python/core/auto_generated/vectortile/qgsvectortilerenderer.sip.in @@ -85,7 +85,7 @@ For rendering it is expected that client code calls: const QString type = sipCpp->type(); - if ( type == QStringLiteral( "basic" ) ) + if ( type == QLatin1String( "basic" ) ) sipType = sipType_QgsVectorTileBasicRenderer; else sipType = 0; diff --git a/src/3d/qgs3dutils.cpp b/src/3d/qgs3dutils.cpp index 1a0b128be12e..96b41b2b9e3a 100644 --- a/src/3d/qgs3dutils.cpp +++ b/src/3d/qgs3dutils.cpp @@ -237,11 +237,11 @@ QString Qgs3DUtils::cullingModeToString( Qgs3DTypes::CullingMode mode ) Qgs3DTypes::CullingMode Qgs3DUtils::cullingModeFromString( const QString &str ) { - if ( str == QStringLiteral( "front" ) ) + if ( str == QLatin1String( "front" ) ) return Qgs3DTypes::Front; - else if ( str == QStringLiteral( "back" ) ) + else if ( str == QLatin1String( "back" ) ) return Qgs3DTypes::Back; - else if ( str == QStringLiteral( "front-and-back" ) ) + else if ( str == QLatin1String( "front-and-back" ) ) return Qgs3DTypes::FrontAndBack; else return Qgs3DTypes::NoCulling; diff --git a/src/3d/qgsskyboxsettings.cpp b/src/3d/qgsskyboxsettings.cpp index d742c1d490b6..32e69f5ab26d 100644 --- a/src/3d/qgsskyboxsettings.cpp +++ b/src/3d/qgsskyboxsettings.cpp @@ -24,9 +24,9 @@ void QgsSkyboxSettings::readXml( const QDomElement &element, const QgsReadWriteC { const QgsPathResolver &pathResolver = context.pathResolver(); QString skyboxTypeStr = element.attribute( QStringLiteral( "skybox-type" ) ); - if ( skyboxTypeStr == QStringLiteral( "Distinct Faces" ) ) + if ( skyboxTypeStr == QLatin1String( "Distinct Faces" ) ) mSkyboxType = QgsSkyboxEntity::DistinctTexturesSkybox; - else if ( skyboxTypeStr == QStringLiteral( "Panoramic Texture" ) ) + else if ( skyboxTypeStr == QLatin1String( "Panoramic Texture" ) ) mSkyboxType = QgsSkyboxEntity::PanoramicSkybox; mPanoramicTexturePath = pathResolver.readPath( element.attribute( QStringLiteral( "panoramic-texture-path" ) ) ); mCubeMapFacesPaths.clear(); diff --git a/src/3d/symbols/qgspoint3dsymbol.cpp b/src/3d/symbols/qgspoint3dsymbol.cpp index 6772590892c4..7facf8789bb6 100644 --- a/src/3d/symbols/qgspoint3dsymbol.cpp +++ b/src/3d/symbols/qgspoint3dsymbol.cpp @@ -120,19 +120,19 @@ QgsPoint3DSymbol::Shape QgsPoint3DSymbol::shapeFromString( const QString &shape { if ( shape == QStringLiteral( "sphere" ) ) return Sphere; - else if ( shape == QStringLiteral( "cone" ) ) + else if ( shape == QLatin1String( "cone" ) ) return Cone; - else if ( shape == QStringLiteral( "cube" ) ) + else if ( shape == QLatin1String( "cube" ) ) return Cube; - else if ( shape == QStringLiteral( "torus" ) ) + else if ( shape == QLatin1String( "torus" ) ) return Torus; - else if ( shape == QStringLiteral( "plane" ) ) + else if ( shape == QLatin1String( "plane" ) ) return Plane; - else if ( shape == QStringLiteral( "extruded-text" ) ) + else if ( shape == QLatin1String( "extruded-text" ) ) return ExtrudedText; - else if ( shape == QStringLiteral( "model" ) ) + else if ( shape == QLatin1String( "model" ) ) return Model; - else if ( shape == QStringLiteral( "billboard" ) ) + else if ( shape == QLatin1String( "billboard" ) ) return Billboard; else // "cylinder" (default) return Cylinder; diff --git a/src/analysis/processing/qgsalgorithmattributeindex.cpp b/src/analysis/processing/qgsalgorithmattributeindex.cpp index 728d6580c5ee..7b548b727004 100644 --- a/src/analysis/processing/qgsalgorithmattributeindex.cpp +++ b/src/analysis/processing/qgsalgorithmattributeindex.cpp @@ -77,7 +77,7 @@ QVariantMap QgsAttributeIndexAlgorithm::processAlgorithm( const QVariantMap &par QgsVectorLayer *layer = parameterAsVectorLayer( parameters, QStringLiteral( "INPUT" ), context ); if ( !layer ) - throw QgsProcessingException( QObject::tr( "Could not load source layer for %1." ).arg( QStringLiteral( "INPUT" ) ) ); + throw QgsProcessingException( QObject::tr( "Could not load source layer for %1." ).arg( QLatin1String( "INPUT" ) ) ); QString field = parameterAsString( parameters, QStringLiteral( "FIELD" ), context ); diff --git a/src/analysis/processing/qgsalgorithmbuffer.cpp b/src/analysis/processing/qgsalgorithmbuffer.cpp index ef482a7768c7..989ea03e9d8d 100644 --- a/src/analysis/processing/qgsalgorithmbuffer.cpp +++ b/src/analysis/processing/qgsalgorithmbuffer.cpp @@ -183,7 +183,7 @@ QgsProcessingAlgorithm::Flags QgsBufferAlgorithm::flags() const QgsProcessingAlgorithm::VectorProperties QgsBufferAlgorithm::sinkProperties( const QString &sink, const QVariantMap ¶meters, QgsProcessingContext &context, const QMap &sourceProperties ) const { QgsProcessingAlgorithm::VectorProperties result; - if ( sink == QStringLiteral( "OUTPUT" ) ) + if ( sink == QLatin1String( "OUTPUT" ) ) { if ( sourceProperties.value( QStringLiteral( "INPUT" ) ).availability == QgsProcessingAlgorithm::Available ) { diff --git a/src/analysis/processing/qgsalgorithmconstantraster.cpp b/src/analysis/processing/qgsalgorithmconstantraster.cpp index cb61133d38c9..8339f1576185 100644 --- a/src/analysis/processing/qgsalgorithmconstantraster.cpp +++ b/src/analysis/processing/qgsalgorithmconstantraster.cpp @@ -106,37 +106,37 @@ QVariantMap QgsConstantRasterAlgorithm::processAlgorithm( const QVariantMap &par case 0: rasterDataType = Qgis::Byte; if ( value < std::numeric_limits::min() || value > std::numeric_limits::max() ) - throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2" ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QStringLiteral( "Byte" ) ) ); + throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2" ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QLatin1String( "Byte" ) ) ); if ( fractpart > 0 ) - feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type %1. The decimals of the constant value will be omitted." ).arg( QStringLiteral( "Byte" ) ) ); + feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type %1. The decimals of the constant value will be omitted." ).arg( QLatin1String( "Byte" ) ) ); break; case 1: rasterDataType = Qgis::Int16; if ( value < std::numeric_limits::min() || value > std::numeric_limits::max() ) - throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept values between %1 and %2" ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QStringLiteral( "Integer16" ) ) ); + throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept values between %1 and %2" ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QLatin1String( "Integer16" ) ) ); if ( fractpart > 0 ) - feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type %1. The decimals of the constant value will be omitted." ).arg( QStringLiteral( "Integer16" ) ) ); + feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type %1. The decimals of the constant value will be omitted." ).arg( QLatin1String( "Integer16" ) ) ); break; case 2: rasterDataType = Qgis::UInt16; if ( value < std::numeric_limits::min() || value > std::numeric_limits::max() ) throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2" ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( "Unsigned Integer16" ) ); if ( fractpart > 0 ) - feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type %1. The decimals of the constant value will be omitted." ).arg( QStringLiteral( "Unsigned Integer16" ) ) ); + feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type %1. The decimals of the constant value will be omitted." ).arg( QLatin1String( "Unsigned Integer16" ) ) ); break; case 3: rasterDataType = Qgis::Int32; if ( value < std::numeric_limits::min() || value > std::numeric_limits::max() ) - throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept values between %1 and %2" ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QStringLiteral( "Integer32" ) ) ); + throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept values between %1 and %2" ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QLatin1String( "Integer32" ) ) ); if ( fractpart > 0 ) - feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type %1. The decimals of the constant value will be omitted." ).arg( QStringLiteral( "Integer32" ) ) ); + feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type %1. The decimals of the constant value will be omitted." ).arg( QLatin1String( "Integer32" ) ) ); break; case 4: rasterDataType = Qgis::UInt32; if ( value < std::numeric_limits::min() || value > std::numeric_limits::max() ) - throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2" ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QStringLiteral( "Unsigned Integer32" ) ) ); + throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2" ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QLatin1String( "Unsigned Integer32" ) ) ); if ( fractpart > 0 ) - feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type %1. The decimals of the constant value will be omitted." ).arg( QStringLiteral( "Unsigned Integer32" ) ) ); + feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type %1. The decimals of the constant value will be omitted." ).arg( QLatin1String( "Unsigned Integer32" ) ) ); break; case 5: rasterDataType = Qgis::Float32; diff --git a/src/analysis/processing/qgsalgorithmexecutespatialitequery.cpp b/src/analysis/processing/qgsalgorithmexecutespatialitequery.cpp index 5ace1406f075..17549aa707d6 100644 --- a/src/analysis/processing/qgsalgorithmexecutespatialitequery.cpp +++ b/src/analysis/processing/qgsalgorithmexecutespatialitequery.cpp @@ -72,9 +72,9 @@ QVariantMap QgsExecuteSpatialiteQueryAlgorithm::processAlgorithm( const QVariant if ( uri.database().isEmpty() ) { if ( databaseUri.contains( QStringLiteral( "|layername" ), Qt::CaseInsensitive ) ) - databaseUri = databaseUri.left( databaseUri.indexOf( QStringLiteral( "|layername" ) ) ); + databaseUri = databaseUri.left( databaseUri.indexOf( QLatin1String( "|layername" ) ) ); else if ( databaseUri.contains( QStringLiteral( "|layerid" ), Qt::CaseInsensitive ) ) - databaseUri = databaseUri.left( databaseUri.indexOf( QStringLiteral( "|layerid" ) ) ); + databaseUri = databaseUri.left( databaseUri.indexOf( QLatin1String( "|layerid" ) ) ); uri = QgsDataSourceUri( QStringLiteral( "dbname='%1'" ).arg( databaseUri ) ); } diff --git a/src/analysis/processing/qgsalgorithmlayoutatlastoimage.cpp b/src/analysis/processing/qgsalgorithmlayoutatlastoimage.cpp index 642e6db1529c..d9e54ac3e65a 100644 --- a/src/analysis/processing/qgsalgorithmlayoutatlastoimage.cpp +++ b/src/analysis/processing/qgsalgorithmlayoutatlastoimage.cpp @@ -90,7 +90,7 @@ void QgsLayoutAtlasToImageAlgorithm::initAlgorithm( const QVariantMap & ) continue; imageFormats << QString( format ); } - std::unique_ptr< QgsProcessingParameterEnum > extensionParam = qgis::make_unique< QgsProcessingParameterEnum >( QStringLiteral( "EXTENSION" ), QObject::tr( "Image format" ), imageFormats, false, imageFormats.indexOf( QStringLiteral( "png" ) ) ); + std::unique_ptr< QgsProcessingParameterEnum > extensionParam = qgis::make_unique< QgsProcessingParameterEnum >( QStringLiteral( "EXTENSION" ), QObject::tr( "Image format" ), imageFormats, false, imageFormats.indexOf( QLatin1String( "png" ) ) ); extensionParam->setFlags( extensionParam->flags() | QgsProcessingParameterDefinition::FlagAdvanced ); addParameter( extensionParam.release() ); diff --git a/src/analysis/processing/qgsalgorithmlayouttoimage.cpp b/src/analysis/processing/qgsalgorithmlayouttoimage.cpp index 9872c8903c72..1f2dc530389c 100644 --- a/src/analysis/processing/qgsalgorithmlayouttoimage.cpp +++ b/src/analysis/processing/qgsalgorithmlayouttoimage.cpp @@ -100,7 +100,7 @@ void QgsLayoutToImageAlgorithm::initAlgorithm( const QVariantMap & ) imageFilters.append( QStringLiteral( "%1 (%2 %3)" ).arg( longName, glob.toLower(), glob.toUpper() ) ); } - addParameter( new QgsProcessingParameterFileDestination( QStringLiteral( "OUTPUT" ), QObject::tr( "Image file" ), imageFilters.join( QStringLiteral( ";;" ) ) ) ); + addParameter( new QgsProcessingParameterFileDestination( QStringLiteral( "OUTPUT" ), QObject::tr( "Image file" ), imageFilters.join( QLatin1String( ";;" ) ) ) ); } QgsProcessingAlgorithm::Flags QgsLayoutToImageAlgorithm::flags() const diff --git a/src/analysis/processing/qgsalgorithmrandomraster.cpp b/src/analysis/processing/qgsalgorithmrandomraster.cpp index 4198c3833840..bc2e0d217422 100644 --- a/src/analysis/processing/qgsalgorithmrandomraster.cpp +++ b/src/analysis/processing/qgsalgorithmrandomraster.cpp @@ -285,7 +285,7 @@ bool QgsRandomUniformRasterAlgorithm::prepareRandomParameters( const QVariantMap { case Qgis::Byte: if ( mRandomLowerBound < std::numeric_limits::min() || mRandomUpperBound > std::numeric_limits::max() ) - throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QStringLiteral( "Byte" ) ) ); + throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QLatin1String( "Byte" ) ) ); if ( ( qgsDoubleNear( mRandomLowerBound, 0.0 ) && qgsDoubleNear( mRandomUpperBound, 0.0 ) ) || qgsDoubleNear( mRandomUpperBound, mRandomLowerBound ) ) { //if parameters unset (=both are 0 or equal) --> use the whole value range @@ -295,7 +295,7 @@ bool QgsRandomUniformRasterAlgorithm::prepareRandomParameters( const QVariantMap break; case Qgis::Int16: if ( mRandomLowerBound < std::numeric_limits::min() || mRandomUpperBound > std::numeric_limits::max() ) - throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QStringLiteral( "Integer16" ) ) ); + throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QLatin1String( "Integer16" ) ) ); if ( ( qgsDoubleNear( mRandomLowerBound, 0.0 ) && qgsDoubleNear( mRandomUpperBound, 0.0 ) ) || qgsDoubleNear( mRandomUpperBound, mRandomLowerBound ) ) { mRandomUpperBound = std::numeric_limits::max(); @@ -304,7 +304,7 @@ bool QgsRandomUniformRasterAlgorithm::prepareRandomParameters( const QVariantMap break; case Qgis::UInt16: if ( mRandomLowerBound < std::numeric_limits::min() || mRandomUpperBound > std::numeric_limits::max() ) - throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QStringLiteral( "Unsigned Integer16" ) ) ); + throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QLatin1String( "Unsigned Integer16" ) ) ); if ( ( qgsDoubleNear( mRandomLowerBound, 0.0 ) && qgsDoubleNear( mRandomUpperBound, 0.0 ) ) || qgsDoubleNear( mRandomUpperBound, mRandomLowerBound ) ) { mRandomUpperBound = std::numeric_limits::max(); @@ -313,7 +313,7 @@ bool QgsRandomUniformRasterAlgorithm::prepareRandomParameters( const QVariantMap break; case Qgis::Int32: if ( mRandomLowerBound < std::numeric_limits::min() || mRandomUpperBound > std::numeric_limits::max() ) - throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QStringLiteral( "Integer32" ) ) ); + throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QLatin1String( "Integer32" ) ) ); if ( ( qgsDoubleNear( mRandomLowerBound, 0.0 ) && qgsDoubleNear( mRandomUpperBound, 0.0 ) ) || qgsDoubleNear( mRandomUpperBound, mRandomLowerBound ) ) { mRandomUpperBound = std::numeric_limits::max(); @@ -322,7 +322,7 @@ bool QgsRandomUniformRasterAlgorithm::prepareRandomParameters( const QVariantMap break; case Qgis::UInt32: if ( mRandomLowerBound < std::numeric_limits::min() || mRandomUpperBound > std::numeric_limits::max() ) - throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QStringLiteral( "Unsigned Integer32" ) ) ); + throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits::min() ).arg( std::numeric_limits::max() ).arg( QLatin1String( "Unsigned Integer32" ) ) ); if ( ( qgsDoubleNear( mRandomLowerBound, 0.0 ) && qgsDoubleNear( mRandomUpperBound, 0.0 ) ) || qgsDoubleNear( mRandomUpperBound, mRandomLowerBound ) ) { mRandomUpperBound = std::numeric_limits::max(); diff --git a/src/analysis/processing/qgsalgorithmrepairshapefile.cpp b/src/analysis/processing/qgsalgorithmrepairshapefile.cpp index 1f503b24099b..46dd3b83227d 100644 --- a/src/analysis/processing/qgsalgorithmrepairshapefile.cpp +++ b/src/analysis/processing/qgsalgorithmrepairshapefile.cpp @@ -76,7 +76,7 @@ QVariantMap QgsRepairShapefileAlgorithm::processAlgorithm( const QVariantMap &pa const QString path = parameterAsFile( parameters, QStringLiteral( "INPUT" ), context ); if ( !QFile::exists( path ) ) - throw QgsProcessingException( QObject::tr( "Could not load source layer for %1." ).arg( QStringLiteral( "INPUT" ) ) ); + throw QgsProcessingException( QObject::tr( "Could not load source layer for %1." ).arg( QLatin1String( "INPUT" ) ) ); CPLSetConfigOption( "SHAPE_RESTORE_SHX", "YES" ); diff --git a/src/analysis/processing/qgsalgorithmsetlayerencoding.cpp b/src/analysis/processing/qgsalgorithmsetlayerencoding.cpp index fbb53980b9e6..fe02140de267 100644 --- a/src/analysis/processing/qgsalgorithmsetlayerencoding.cpp +++ b/src/analysis/processing/qgsalgorithmsetlayerencoding.cpp @@ -76,7 +76,7 @@ bool QgsSetLayerEncodingAlgorithm::prepareAlgorithm( const QVariantMap ¶mete QgsVectorLayer *layer = parameterAsVectorLayer( parameters, QStringLiteral( "INPUT" ), context ); if ( !layer ) - throw QgsProcessingException( QObject::tr( "Could not load source layer for %1." ).arg( QStringLiteral( "INPUT" ) ) ); + throw QgsProcessingException( QObject::tr( "Could not load source layer for %1." ).arg( QLatin1String( "INPUT" ) ) ); const QString encoding = parameterAsString( parameters, QStringLiteral( "ENCODING" ), context ); diff --git a/src/analysis/processing/qgsalgorithmshpencodinginfo.cpp b/src/analysis/processing/qgsalgorithmshpencodinginfo.cpp index d40f00645ff2..badc9ee12cd3 100644 --- a/src/analysis/processing/qgsalgorithmshpencodinginfo.cpp +++ b/src/analysis/processing/qgsalgorithmshpencodinginfo.cpp @@ -65,7 +65,7 @@ QgsShapefileEncodingInfoAlgorithm *QgsShapefileEncodingInfoAlgorithm::createInst void QgsShapefileEncodingInfoAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterFile( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ), QgsProcessingParameterFile::File, - QString(), QVariant(), false, QObject::tr( "Shapefiles (%1)" ).arg( QStringLiteral( "*.shp *.SHP)" ) ) ) ); + QString(), QVariant(), false, QObject::tr( "Shapefiles (%1)" ).arg( QLatin1String( "*.shp *.SHP)" ) ) ) ); addOutput( new QgsProcessingOutputString( QStringLiteral( "ENCODING" ), QObject::tr( "Shapefile Encoding" ) ) ); addOutput( new QgsProcessingOutputString( QStringLiteral( "CPG_ENCODING" ), QObject::tr( "CPG Encoding" ) ) ); diff --git a/src/analysis/processing/qgsalgorithmspatialindex.cpp b/src/analysis/processing/qgsalgorithmspatialindex.cpp index 31fba5070b42..6a6c31d70bbd 100644 --- a/src/analysis/processing/qgsalgorithmspatialindex.cpp +++ b/src/analysis/processing/qgsalgorithmspatialindex.cpp @@ -77,7 +77,7 @@ QVariantMap QgsSpatialIndexAlgorithm::processAlgorithm( const QVariantMap ¶m QgsVectorLayer *layer = parameterAsVectorLayer( parameters, QStringLiteral( "INPUT" ), context ); if ( !layer ) - throw QgsProcessingException( QObject::tr( "Could not load source layer for %1." ).arg( QStringLiteral( "INPUT" ) ) ); + throw QgsProcessingException( QObject::tr( "Could not load source layer for %1." ).arg( QLatin1String( "INPUT" ) ) ); QgsVectorDataProvider *provider = layer->dataProvider(); diff --git a/src/analysis/raster/qgsrastercalculator.cpp b/src/analysis/raster/qgsrastercalculator.cpp index 09fee502b1ed..3c55b1a819e0 100644 --- a/src/analysis/raster/qgsrastercalculator.cpp +++ b/src/analysis/raster/qgsrastercalculator.cpp @@ -487,10 +487,10 @@ QgsRasterCalculator::Result QgsRasterCalculator::processCalculationGPU( std::uni { inputDesc.append( QStringLiteral( " // %1 = %2" ).arg( ref.varName ).arg( ref.name ) ); } - programTemplate = programTemplate.replace( QStringLiteral( "##INPUT_DESC##" ), inputDesc.join( '\n' ) ); - programTemplate = programTemplate.replace( QStringLiteral( "##INPUT##" ), !inputArgs.isEmpty() ? ( inputArgs.join( ',' ).append( ',' ) ) : QChar( ' ' ) ); - programTemplate = programTemplate.replace( QStringLiteral( "##EXPRESSION##" ), cExpression ); - programTemplate = programTemplate.replace( QStringLiteral( "##EXPRESSION_ORIGINAL##" ), calcNode->toString( ) ); + programTemplate = programTemplate.replace( QLatin1String( "##INPUT_DESC##" ), inputDesc.join( '\n' ) ); + programTemplate = programTemplate.replace( QLatin1String( "##INPUT##" ), !inputArgs.isEmpty() ? ( inputArgs.join( ',' ).append( ',' ) ) : QChar( ' ' ) ); + programTemplate = programTemplate.replace( QLatin1String( "##EXPRESSION##" ), cExpression ); + programTemplate = programTemplate.replace( QLatin1String( "##EXPRESSION_ORIGINAL##" ), calcNode->toString( ) ); // qDebug() << programTemplate; diff --git a/src/analysis/vector/geometry_checker/qgsgeometryduplicatecheck.cpp b/src/analysis/vector/geometry_checker/qgsgeometryduplicatecheck.cpp index d551bae18cce..7016299fec1b 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometryduplicatecheck.cpp +++ b/src/analysis/vector/geometry_checker/qgsgeometryduplicatecheck.cpp @@ -35,7 +35,7 @@ QString QgsGeometryDuplicateCheckError::duplicatesString( const QMaprenderer3D(); - if ( r && r->type() == QStringLiteral( "rulebased" ) ) + if ( r && r->type() == QLatin1String( "rulebased" ) ) { QgsRuleBased3DRenderer *ruleRenderer = static_cast( r ); mRootRule = ruleRenderer->rootRule()->clone(); diff --git a/src/app/3d/qgsvectorlayer3drendererwidget.cpp b/src/app/3d/qgsvectorlayer3drendererwidget.cpp index f5c6c48eaeab..0543ff47e768 100644 --- a/src/app/3d/qgsvectorlayer3drendererwidget.cpp +++ b/src/app/3d/qgsvectorlayer3drendererwidget.cpp @@ -51,7 +51,7 @@ QgsSingleSymbol3DRendererWidget::QgsSingleSymbol3DRendererWidget( QgsVectorLayer void QgsSingleSymbol3DRendererWidget::setLayer( QgsVectorLayer *layer ) { QgsAbstract3DRenderer *r = layer->renderer3D(); - if ( r && r->type() == QStringLiteral( "vector" ) ) + if ( r && r->type() == QLatin1String( "vector" ) ) { QgsVectorLayer3DRenderer *vectorRenderer = static_cast( r ); widgetSymbol->setSymbol( vectorRenderer->symbol(), layer ); diff --git a/src/app/browser/qgsinbuiltdataitemproviders.cpp b/src/app/browser/qgsinbuiltdataitemproviders.cpp index bef1433fab02..6dd6c32de5f4 100644 --- a/src/app/browser/qgsinbuiltdataitemproviders.cpp +++ b/src/app/browser/qgsinbuiltdataitemproviders.cpp @@ -189,7 +189,7 @@ void QgsAppDirectoryItemGuiProvider::populateContextMenu( QgsDataItem *item, QMe s.setValue( QStringLiteral( "/browser/hiddenPaths" ), pathsList ); // get parent path and refresh corresponding node - int idx = path.lastIndexOf( QStringLiteral( "/" ) ); + int idx = path.lastIndexOf( QLatin1Char( '/' ) ); if ( idx != -1 && path.count( QStringLiteral( "/" ) ) > 1 ) { QString parentPath = path.left( idx ); @@ -551,9 +551,9 @@ void QgsLayerItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu *men if ( layerItem ) { // Also check for postgres layers (rasters are handled by GDAL) - isFile = ( layerItem->providerKey() == QStringLiteral( "ogr" ) || - layerItem->providerKey() == QStringLiteral( "gdal" ) ) && - ! layerItem->uri().startsWith( QStringLiteral( "PG:" ) ); + isFile = ( layerItem->providerKey() == QLatin1String( "ogr" ) || + layerItem->providerKey() == QLatin1String( "gdal" ) ) && + ! layerItem->uri().startsWith( QLatin1String( "PG:" ) ); } else { diff --git a/src/app/dwg/qgsdwgimportdialog.cpp b/src/app/dwg/qgsdwgimportdialog.cpp index 5e75c9272b2a..32a3914e95d4 100644 --- a/src/app/dwg/qgsdwgimportdialog.cpp +++ b/src/app/dwg/qgsdwgimportdialog.cpp @@ -296,7 +296,7 @@ void QgsDwgImportDialog::createGroup( QgsLayerTreeGroup *group, const QString &n { exprlist.append( QStringLiteral( "'%1'" ).arg( layer.replace( QLatin1String( "'" ), QLatin1String( "''" ) ) ) ); } - layerFilter = QStringLiteral( "layer IN (%1) AND " ).arg( exprlist.join( QStringLiteral( "," ) ) ); + layerFilter = QStringLiteral( "layer IN (%1) AND " ).arg( exprlist.join( QLatin1Char( ',' ) ) ); } QgsVectorLayer *l = nullptr; diff --git a/src/app/dwg/qgsdwgimporter.cpp b/src/app/dwg/qgsdwgimporter.cpp index 1b8a1c35ad2c..105e35c3252c 100644 --- a/src/app/dwg/qgsdwgimporter.cpp +++ b/src/app/dwg/qgsdwgimporter.cpp @@ -882,7 +882,7 @@ void QgsDwgImporter::addLType( const DRW_LType &data ) if ( upath.size() % 2 == 1 ) l << QStringLiteral( "0" ); - dash = l.join( QStringLiteral( ";" ) ).toUtf8().constData(); + dash = l.join( QLatin1Char( ';' ) ).toUtf8().constData(); } mLinetype.insert( name.toLower(), dash ); diff --git a/src/app/georeferencer/qgsgeorefmainwindow.cpp b/src/app/georeferencer/qgsgeorefmainwindow.cpp index 532aa7fbb351..455b3e2372a0 100644 --- a/src/app/georeferencer/qgsgeorefmainwindow.cpp +++ b/src/app/georeferencer/qgsgeorefmainwindow.cpp @@ -1788,7 +1788,7 @@ void QgsGeoreferencerMainWindow::updateTransformParamLabel() // Gdal script void QgsGeoreferencerMainWindow::showGDALScript( const QStringList &commands ) { - QString script = commands.join( QStringLiteral( "\n" ) ) + '\n'; + QString script = commands.join( QLatin1Char( '\n' ) ) + '\n'; // create window to show gdal script QDialogButtonBox *bbxGdalScript = new QDialogButtonBox( QDialogButtonBox::Cancel, Qt::Horizontal, this ); @@ -1838,7 +1838,7 @@ QString QgsGeoreferencerMainWindow::generateGDALtranslateCommand( bool generateT mTranslatedRasterFileName = QDir::tempPath() + '/' + rasterFileInfo.fileName(); gdalCommand << QStringLiteral( "\"%1\"" ).arg( mRasterFileName ) << QStringLiteral( "\"%1\"" ).arg( mTranslatedRasterFileName ); - return gdalCommand.join( QStringLiteral( " " ) ); + return gdalCommand.join( QLatin1Char( ' ' ) ); } QString QgsGeoreferencerMainWindow::generateGDALwarpCommand( const QString &resampling, const QString &compress, @@ -1875,7 +1875,7 @@ QString QgsGeoreferencerMainWindow::generateGDALwarpCommand( const QString &resa gdalCommand << QStringLiteral( "\"%1\"" ).arg( mTranslatedRasterFileName ) << QStringLiteral( "\"%1\"" ).arg( mModifiedRasterFileName ); - return gdalCommand.join( QStringLiteral( " " ) ); + return gdalCommand.join( QLatin1Char( ' ' ) ); } // Log diff --git a/src/app/gps/qgsgpsinformationwidget.cpp b/src/app/gps/qgsgpsinformationwidget.cpp index 713d97b8c7e6..44549847d82b 100644 --- a/src/app/gps/qgsgpsinformationwidget.cpp +++ b/src/app/gps/qgsgpsinformationwidget.cpp @@ -1230,7 +1230,7 @@ void QgsGpsInformationWidget::mBtnCloseFeature_clicked() tr( "Save Layer Edits" ), tr( "Could not commit changes to layer %1\n\nErrors: %2\n" ) .arg( vlayer->name(), - vlayer->commitErrors().join( QStringLiteral( "\n " ) ) ) ); + vlayer->commitErrors().join( QLatin1String( "\n " ) ) ) ); } vlayer->startEditing(); @@ -1323,7 +1323,7 @@ void QgsGpsInformationWidget::mBtnCloseFeature_clicked() QgisApp::instance()->messageBar()->pushCritical( tr( "Save Layer Edits" ), tr( "Could not commit changes to layer %1\n\nErrors: %2\n" ) .arg( vlayer->name(), - vlayer->commitErrors().join( QStringLiteral( "\n " ) ) ) ); + vlayer->commitErrors().join( QLatin1String( "\n " ) ) ) ); } vlayer->startEditing(); diff --git a/src/app/layout/qgslayoutdesignerdialog.cpp b/src/app/layout/qgslayoutdesignerdialog.cpp index e840ea81a718..6e5a96d8f7f8 100644 --- a/src/app/layout/qgslayoutdesignerdialog.cpp +++ b/src/app/layout/qgslayoutdesignerdialog.cpp @@ -4431,8 +4431,8 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport mLayout->setCustomProperty( QStringLiteral( "pdfSimplify" ), simplify ? 1 : 0 ); mLayout->setCustomProperty( QStringLiteral( "pdfCreateGeoPdf" ), geoPdf ? 1 : 0 ); mLayout->setCustomProperty( QStringLiteral( "pdfOgcBestPracticeFormat" ), useOgcBestPracticeFormat ? 1 : 0 ); - mLayout->setCustomProperty( QStringLiteral( "pdfExportThemes" ), exportThemes.join( QStringLiteral( "~~~" ) ) ); - mLayout->setCustomProperty( QStringLiteral( "pdfLayerOrder" ), geoPdfLayerOrder.join( QStringLiteral( "~~~" ) ) ); + mLayout->setCustomProperty( QStringLiteral( "pdfExportThemes" ), exportThemes.join( QLatin1String( "~~~" ) ) ); + mLayout->setCustomProperty( QStringLiteral( "pdfLayerOrder" ), geoPdfLayerOrder.join( QLatin1String( "~~~" ) ) ); mLayout->setCustomProperty( QStringLiteral( "pdfLosslessImages" ), losslessImages ? 1 : 0 ); } diff --git a/src/app/locator/qgsinbuiltlocatorfilters.cpp b/src/app/locator/qgsinbuiltlocatorfilters.cpp index 87f26329a490..b23500b934f9 100644 --- a/src/app/locator/qgsinbuiltlocatorfilters.cpp +++ b/src/app/locator/qgsinbuiltlocatorfilters.cpp @@ -202,9 +202,9 @@ void QgsActionLocatorFilter::searchActions( const QString &string, QWidget *pare { tooltip = match.captured( 1 ); } - tooltip.replace( QStringLiteral( "..." ), QString() ); + tooltip.replace( QLatin1String( "..." ), QString() ); tooltip.replace( QString( QChar( 0x2026 ) ), QString() ); - searchText.replace( QStringLiteral( "..." ), QString() ); + searchText.replace( QLatin1String( "..." ), QString() ); searchText.replace( QString( QChar( 0x2026 ) ), QString() ); bool uniqueTooltip = searchText.trimmed().compare( tooltip.trimmed(), Qt::CaseInsensitive ) != 0; if ( action->isChecked() ) @@ -345,7 +345,7 @@ QStringList QgsActiveLayerFeaturesLocatorFilter::prepare( const QString &string, } } - QString expression = QStringLiteral( "(%1)" ).arg( expressionParts.join( QStringLiteral( " ) OR ( " ) ) ); + QString expression = QStringLiteral( "(%1)" ).arg( expressionParts.join( QLatin1String( " ) OR ( " ) ) ); QgsFeatureRequest req; if ( !mDispExpression.needsGeometry() ) @@ -1061,7 +1061,7 @@ void QgsGotoLocatorFilter::fetchResults( const QString &string, const QgsLocator QStringList fragments = url.fragment().split( '&' ); for ( const QString &fragment : fragments ) { - if ( fragment.startsWith( QStringLiteral( "map=" ) ) ) + if ( fragment.startsWith( QLatin1String( "map=" ) ) ) { QStringList params = fragment.mid( 4 ).split( '/' ); if ( params.size() >= 3 ) diff --git a/src/app/options/qgscodeeditoroptions.cpp b/src/app/options/qgscodeeditoroptions.cpp index ad6d05d17a08..9a175fda9e85 100644 --- a/src/app/options/qgscodeeditoroptions.cpp +++ b/src/app/options/qgscodeeditoroptions.cpp @@ -113,7 +113,7 @@ QgsCodeEditorOptionsWidget::QgsCodeEditorOptionsWidget( QWidget *parent ) connect( mColorSchemeComboBox, qgis::overload::of( &QComboBox::currentIndexChanged ), this, [ = ] { const QString theme = mColorSchemeComboBox->currentData().toString(); - if ( theme != QStringLiteral( "custom" ) ) + if ( theme != QLatin1String( "custom" ) ) { mBlockCustomColorChange = true; for ( auto it = mColorButtonMap.constBegin(); it != mColorButtonMap.constEnd(); ++it ) @@ -282,7 +282,7 @@ void QgsCodeEditorOptionsWidget::apply() const QString theme = mColorSchemeComboBox->currentData().toString(); QgsSettings settings; - const bool customTheme = theme == QStringLiteral( "custom" ); + const bool customTheme = theme == QLatin1String( "custom" ); settings.setValue( QStringLiteral( "codeEditor/overrideColors" ), customTheme, QgsSettings::Gui ); if ( !customTheme ) { diff --git a/src/app/pluginmanager/qgspluginmanager.cpp b/src/app/pluginmanager/qgspluginmanager.cpp index 147e4df649a9..1b4a01cef66c 100644 --- a/src/app/pluginmanager/qgspluginmanager.cpp +++ b/src/app/pluginmanager/qgspluginmanager.cpp @@ -966,7 +966,7 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item ) { *tag = QStringLiteral( "%1" ).arg( ( *tag ).trimmed() ); } - html += QStringLiteral( "%1 %2" ).arg( tr( "Tags" ), tags.join( QStringLiteral( ", " ) ) ); + html += QStringLiteral( "%1 %2" ).arg( tr( "Tags" ), tags.join( QLatin1String( ", " ) ) ); } if ( ! metadata->value( QStringLiteral( "homepage" ) ).isEmpty() || ! metadata->value( QStringLiteral( "tracker" ) ).isEmpty() || ! metadata->value( QStringLiteral( "code_repository" ) ).isEmpty() ) @@ -1026,7 +1026,7 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item ) if ( downloadUrl.contains( QStringLiteral( "plugins.qgis.org" ) ) ) { // For the main repo, open the plugin version page instead of the download link. For other repositories the download link is the only known endpoint. - downloadUrl = downloadUrl.replace( QStringLiteral( "download/" ), QString() ); + downloadUrl = downloadUrl.replace( QLatin1String( "download/" ), QString() ); } QString dateUpdatedStr; @@ -1050,7 +1050,7 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item ) if ( downloadUrl.contains( QStringLiteral( "plugins.qgis.org" ) ) ) { // For the main repo, open the plugin version page instead of the download link. For other repositories the download link is the only known endpoint. - downloadUrl = downloadUrl.replace( QStringLiteral( "download/" ), QString() ); + downloadUrl = downloadUrl.replace( QLatin1String( "download/" ), QString() ); } QString dateUpdatedStr; diff --git a/src/app/pluginmanager/qgspluginsortfilterproxymodel.cpp b/src/app/pluginmanager/qgspluginsortfilterproxymodel.cpp index 0a4f48bad2fe..88f10691576a 100644 --- a/src/app/pluginmanager/qgspluginsortfilterproxymodel.cpp +++ b/src/app/pluginmanager/qgspluginsortfilterproxymodel.cpp @@ -174,8 +174,8 @@ void QgsPluginSortFilterProxyModel::sortPluginsByDateUpdated() bool QgsPluginSortFilterProxyModel::lessThan( const QModelIndex &source_left, const QModelIndex &source_right ) const { // Always move deprecated plugins to bottom, regardless of the sort order. - const bool isLeftDepreciated = sourceModel()->data( source_left, PLUGIN_ISDEPRECATED_ROLE ).toString() == QStringLiteral( "true" ); - const bool isRightDepreciated = sourceModel()->data( source_right, PLUGIN_ISDEPRECATED_ROLE ).toString() == QStringLiteral( "true" ); + const bool isLeftDepreciated = sourceModel()->data( source_left, PLUGIN_ISDEPRECATED_ROLE ).toString() == QLatin1String( "true" ); + const bool isRightDepreciated = sourceModel()->data( source_right, PLUGIN_ISDEPRECATED_ROLE ).toString() == QLatin1String( "true" ); if ( isRightDepreciated && !isLeftDepreciated ) { return sortOrder() == Qt::AscendingOrder ? true : false; diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index e76f9177856f..9b9f9244e79c 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -2106,16 +2106,16 @@ void QgisApp::handleDropUriList( const QgsMimeDataUtils::UriList &lst ) if ( res && !warnings.empty() ) { QString message = QStringLiteral( "

%1

" ).arg( tr( "The following warnings were generated while converting the vector tile style:" ) ); - message += QStringLiteral( "
    " ); + message += QLatin1String( "
      " ); std::sort( warnings.begin(), warnings.end() ); warnings.erase( std::unique( warnings.begin(), warnings.end() ), warnings.end() ); for ( const QString &w : qgis::as_const( warnings ) ) { - message += QStringLiteral( "
    • %1
    • " ).arg( w.toHtmlEscaped().replace( '\n', QStringLiteral( "
      " ) ) ); + message += QStringLiteral( "
    • %1
    • " ).arg( w.toHtmlEscaped().replace( '\n', QLatin1String( "
      " ) ) ); } - message += QStringLiteral( "
    " ); + message += QLatin1String( "
" ); showLayerLoadWarnings( tr( "Vector tiles" ), tr( "Style could not be completely converted" ), message, Qgis::Warning ); } @@ -2137,7 +2137,7 @@ void QgisApp::handleDropUriList( const QgsMimeDataUtils::UriList &lst ) } } } - else if ( u.layerType == QStringLiteral( "project" ) ) + else if ( u.layerType == QLatin1String( "project" ) ) { openFile( u.uri, QStringLiteral( "project" ) ); } @@ -4173,7 +4173,7 @@ void QgisApp::setupConnections() connect( QgsProject::instance(), &QgsProject::missingDatumTransforms, this, [ = ]( const QStringList & transforms ) { - QString message = tr( "Transforms are not installed: %1 " ).arg( transforms.join( QStringLiteral( " ," ) ) ); + QString message = tr( "Transforms are not installed: %1 " ).arg( transforms.join( QLatin1String( " ," ) ) ); messageBar()->pushWarning( tr( "Missing datum transforms" ), message ); } ); @@ -5004,7 +5004,7 @@ void QgisApp::updateRecentProjectPaths() { QString path = storage->filePath( recentProject.path ); // for geopackage projects, the path will be empty, if not valid - if ( storage->type() == QStringLiteral( "geopackage" ) && path.isEmpty() ) + if ( storage->type() == QLatin1String( "geopackage" ) && path.isEmpty() ) { action->setEnabled( false ); action->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mIndicatorBadLayer.svg" ) ) ); @@ -5507,7 +5507,7 @@ bool QgisApp::addVectorLayersPrivate( const QStringList &layerQStringList, const QgsDebugMsgLevel( "completeBaseName: " + baseName, 2 ); const bool isVsiCurl { src.startsWith( QLatin1String( "/vsicurl" ), Qt::CaseInsensitive ) }; const auto scheme { QUrl( src ).scheme() }; - const bool isRemoteUrl { scheme.startsWith( QStringLiteral( "http" ) ) || scheme == QStringLiteral( "ftp" ) }; + const bool isRemoteUrl { scheme.startsWith( QLatin1String( "http" ) ) || scheme == QLatin1String( "ftp" ) }; // create the layer QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; @@ -6378,7 +6378,7 @@ void QgisApp::fileExit() else { 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( QStringLiteral( "\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( QLatin1Char( '\n' ) ) ), QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes ) { QgsApplication::taskManager()->cancelAll(); @@ -6923,7 +6923,7 @@ void QgisApp::fileOpen() QString fullPath = QFileDialog::getOpenFileName( this, tr( "Open Project" ), lastUsedDir, - fileFilters.join( QStringLiteral( ";;" ) ) ); + fileFilters.join( QLatin1String( ";;" ) ) ); if ( fullPath.isNull() ) { return; @@ -7498,7 +7498,7 @@ bool QgisApp::openLayer( const QString &fileName, bool allowInteractive ) QgsMbTiles reader( fileName ); if ( reader.open() ) { - if ( reader.metadataValue( "format" ) == QStringLiteral( "pbf" ) ) + if ( reader.metadataValue( "format" ) == QLatin1String( "pbf" ) ) { // these are vector tiles QUrlQuery uq; @@ -7575,7 +7575,7 @@ void QgisApp::openFile( const QString &fileName, const QString &fileTypeHint ) { // check to see if we are opening a project file QFileInfo fi( fileName ); - if ( fileTypeHint == QStringLiteral( "project" ) || fi.suffix().compare( QLatin1String( "qgs" ), Qt::CaseInsensitive ) == 0 || fi.suffix().compare( QLatin1String( "qgz" ), Qt::CaseInsensitive ) == 0 ) + if ( fileTypeHint == QLatin1String( "project" ) || fi.suffix().compare( QLatin1String( "qgs" ), Qt::CaseInsensitive ) == 0 || fi.suffix().compare( QLatin1String( "qgz" ), Qt::CaseInsensitive ) == 0 ) { QgsDebugMsgLevel( "Opening project " + fileName, 2 ); openProject( fileName ); @@ -8441,7 +8441,7 @@ void QgisApp::commitError( QgsVectorLayer *vlayer ) mv->setWindowTitle( tr( "Commit Errors" ) ); mv->setMessageAsPlainText( tr( "Could not commit changes to layer %1" ).arg( vlayer->name() ) + "\n\n" - + tr( "Errors: %1\n" ).arg( commitErrors.join( QStringLiteral( "\n " ) ) ) + + tr( "Errors: %1\n" ).arg( commitErrors.join( QLatin1String( "\n " ) ) ) ); QToolButton *showMore = new QToolButton(); @@ -8936,9 +8936,9 @@ void QgisApp::saveStyleFile( QgsMapLayer *layer ) if ( filename.isEmpty() ) return; - if ( ! filename.endsWith( QStringLiteral( ".qml" ) ) ) + if ( ! filename.endsWith( QLatin1String( ".qml" ) ) ) { - filename += QStringLiteral( ".qml" ); + filename += QLatin1String( ".qml" ); } bool defaultLoadedFlag; @@ -9573,7 +9573,7 @@ void QgisApp::setupLayoutManagerConnections() QgsMapLayerAction *action = mAtlasFeatureActions.value( pl ); if ( action ) { - action->setText( QString( tr( "Set as atlas feature for %1" ) ).arg( name ) ); + action->setText( tr( "Set as atlas feature for %1" ).arg( name ) ); } } ); @@ -9648,7 +9648,7 @@ void QgisApp::setupAtlasMapLayerAction( QgsPrintLayout *layout, bool enableActio if ( enableAction ) { - action = new QgsMapLayerAction( QString( tr( "Set as Atlas Feature for %1" ) ).arg( layout->name() ), + action = new QgsMapLayerAction( tr( "Set as Atlas Feature for %1" ).arg( layout->name() ), this, layout->atlas()->coverageLayer(), QgsMapLayerAction::SingleFeature, QgsApplication::getThemeIcon( QStringLiteral( "/mIconAtlas.svg" ) ) ); mAtlasFeatureActions.insert( layout, action ); @@ -11092,7 +11092,7 @@ void QgisApp::cancelEdits( QgsMapLayer *layer, bool leaveEditable, bool triggerR tr( "Could not %1 changes to layer %2\n\nErrors: %3\n" ) .arg( leaveEditable ? tr( "rollback" ) : tr( "cancel" ), vlayer->name(), - vlayer->commitErrors().join( QStringLiteral( "\n " ) ) ) ); + vlayer->commitErrors().join( QLatin1String( "\n " ) ) ) ); } if ( leaveEditable ) @@ -11301,7 +11301,7 @@ void QgisApp::layerSubsetString( QgsMapLayer *mapLayer ) provider->supportsSubsetString() ) { // PG raster is the only one for now - if ( provider->name() == QStringLiteral( "postgresraster" ) ) + if ( provider->name() == QLatin1String( "postgresraster" ) ) { // We need a vector for the sql editor QgsDataSourceUri vectorUri { provider->dataSourceUri() }; @@ -11460,7 +11460,7 @@ void QgisApp::projectTemporalRangeChanged() QVariantMap uri = metadata->decodeUri( currentLayer->dataProvider()->dataSourceUri() ); if ( uri.contains( QStringLiteral( "temporalSource" ) ) && - uri.value( QStringLiteral( "temporalSource" ) ).toString() == QStringLiteral( "project" ) ) + uri.value( QStringLiteral( "temporalSource" ) ).toString() == QLatin1String( "project" ) ) { QgsDateTimeRange range = QgsProject::instance()->timeSettings()->temporalRange(); if ( range.begin().isValid() && range.end().isValid() ) @@ -11516,7 +11516,7 @@ void QgisApp::removeLayer() if ( !nonRemovableLayerNames.isEmpty() ) { QMessageBox::warning( this, tr( "Required Layers" ), - tr( "The following layers are marked as required by the project:\n\n%1\n\nPlease deselect them (or unmark as required) and retry." ).arg( nonRemovableLayerNames.join( QStringLiteral( "\n" ) ) ) ); + tr( "The following layers are marked as required by the project:\n\n%1\n\nPlease deselect them (or unmark as required) and retry." ).arg( nonRemovableLayerNames.join( QLatin1Char( '\n' ) ) ) ); return; } @@ -11544,7 +11544,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( QStringLiteral( "\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( QLatin1Char( '\n' ) ) ) ); return; } @@ -13279,7 +13279,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( qgis::setToList( activeTaskDescriptions ).join( QStringLiteral( "\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( qgis::setToList( activeTaskDescriptions ).join( QLatin1Char( '\n' ) ) ) ); return true; } return false; diff --git a/src/app/qgisappstylesheet.cpp b/src/app/qgisappstylesheet.cpp index b822494087c6..414f9c5d2dcb 100644 --- a/src/app/qgisappstylesheet.cpp +++ b/src/app/qgisappstylesheet.cpp @@ -130,7 +130,7 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap &opts ) ss += QLatin1String( "QGroupBox{ font-weight: 600; }" ); QString themeName = settings.value( QStringLiteral( "UI/UITheme" ), "default" ).toString(); - if ( themeName == QStringLiteral( "default" ) || !QgsApplication::uiThemes().contains( themeName ) ) + if ( themeName == QLatin1String( "default" ) || !QgsApplication::uiThemes().contains( themeName ) ) { //sidebar style const int frameMargin = QgsGuiUtils::scaleIconSize( 3 ); @@ -174,9 +174,9 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap &opts ) .arg( palette.highlight().color().name(), palette.highlightedText().color().name() ); - ss += QStringLiteral( "QgsPropertyOverrideButton { background: none; border: 1px solid rgba(0, 0, 0, 0%); } QgsPropertyOverrideButton:focus { border: 1px solid palette(highlight); }" ); + ss += QLatin1String( "QgsPropertyOverrideButton { background: none; border: 1px solid rgba(0, 0, 0, 0%); } QgsPropertyOverrideButton:focus { border: 1px solid palette(highlight); }" ); #ifdef Q_OS_MACX - ss += QStringLiteral( "QgsPropertyOverrideButton::menu-indicator { width: 5px; }" ); + ss += QLatin1String( "QgsPropertyOverrideButton::menu-indicator { width: 5px; }" ); #endif } diff --git a/src/app/qgsabout.cpp b/src/app/qgsabout.cpp index ee65a23c6294..94c4693f236f 100644 --- a/src/app/qgsabout.cpp +++ b/src/app/qgsabout.cpp @@ -248,12 +248,12 @@ void QgsAbout::setPluginInfo() myString += "" + tr( "Available Qt Database Plugins" ) + "
"; myString += QLatin1String( "
    \n
  1. \n" ); QStringList myDbDriverList = QSqlDatabase::drivers(); - myString += myDbDriverList.join( QStringLiteral( "
  2. \n
  3. " ) ); + myString += myDbDriverList.join( QLatin1String( "
  4. \n
  5. " ) ); myString += QLatin1String( "
  6. \n
\n" ); //qt image plugins myString += "" + tr( "Available Qt Image Plugins" ) + "
"; myString += tr( "Qt Image Plugin Search Paths
" ); - myString += QApplication::libraryPaths().join( QStringLiteral( "
" ) ); + myString += QApplication::libraryPaths().join( QLatin1String( "
" ) ); myString += QLatin1String( "
    \n
  1. \n" ); QList myImageFormats = QImageReader::supportedImageFormats(); QList::const_iterator myIterator = myImageFormats.constBegin(); diff --git a/src/app/qgsattributetabledialog.cpp b/src/app/qgsattributetabledialog.cpp index fda4e261846a..01be8b3278fa 100644 --- a/src/app/qgsattributetabledialog.cpp +++ b/src/app/qgsattributetabledialog.cpp @@ -603,7 +603,7 @@ void QgsAttributeTableDialog::mActionAddFeature_triggered() { QgsSettings s; - if ( s.value( QStringLiteral( "/qgis/attributeTableLastAddFeatureMethod" ) ) == QStringLiteral( "attributeForm" ) ) + if ( s.value( QStringLiteral( "/qgis/attributeTableLastAddFeatureMethod" ) ) == QLatin1String( "attributeForm" ) ) mActionAddFeatureViaAttributeForm_triggered(); else mActionAddFeatureViaAttributeTable_triggered(); diff --git a/src/app/qgsclipboard.cpp b/src/app/qgsclipboard.cpp index 75520943eac3..0fd87f4eba55 100644 --- a/src/app/qgsclipboard.cpp +++ b/src/app/qgsclipboard.cpp @@ -93,8 +93,8 @@ void QgsClipboard::generateClipboardText( QString &textContent, QString &htmlCon // first do the field names if ( format == AttributesWithWKT ) { - textFields += QStringLiteral( "wkt_geom" ); - htmlFields += QStringLiteral( "wkt_geom" ); + textFields += QLatin1String( "wkt_geom" ); + htmlFields += QLatin1String( "wkt_geom" ); } const auto constMFeatureFields = mFeatureFields; @@ -103,7 +103,7 @@ void QgsClipboard::generateClipboardText( QString &textContent, QString &htmlCon textFields += field.name(); htmlFields += QStringLiteral( "%1" ).arg( field.name() ); } - textLines += textFields.join( QStringLiteral( "\t" ) ); + textLines += textFields.join( QLatin1Char( '\t' ) ); htmlLines += htmlFields.join( QString() ); textFields.clear(); htmlFields.clear(); @@ -133,24 +133,24 @@ void QgsClipboard::generateClipboardText( QString &textContent, QString &htmlCon { QString value = attributes.at( idx ).toString(); if ( value.contains( '\n' ) || value.contains( '\t' ) ) - textFields += '"' + value.replace( '"', QStringLiteral( "\"\"" ) ) + '\"'; + textFields += '"' + value.replace( '"', QLatin1String( "\"\"" ) ) + '\"'; else { textFields += value; } value = attributes.at( idx ).toString(); - value.replace( '\n', QStringLiteral( "
    " ) ).replace( '\t', QStringLiteral( " " ) ); + value.replace( '\n', QLatin1String( "
    " ) ).replace( '\t', QLatin1String( " " ) ); htmlFields += QStringLiteral( "%1" ).arg( value ); } - textLines += textFields.join( QStringLiteral( "\t" ) ); + textLines += textFields.join( QLatin1Char( '\t' ) ); htmlLines += htmlFields.join( QString() ); textFields.clear(); htmlFields.clear(); } textContent = textLines.join( '\n' ); - htmlContent = QStringLiteral( "" ) + htmlLines.join( QStringLiteral( "" ) ) + QStringLiteral( "
    " ); + htmlContent = QStringLiteral( "" ) + htmlLines.join( QLatin1String( "" ) ) + QStringLiteral( "
    " ); break; } case GeoJSON: diff --git a/src/app/qgscustomization.cpp b/src/app/qgscustomization.cpp index c1330b448c6a..b666dfec8a27 100644 --- a/src/app/qgscustomization.cpp +++ b/src/app/qgscustomization.cpp @@ -95,7 +95,7 @@ QTreeWidgetItem *QgsCustomizationDialog::item( const QString &path, QTreeWidgetI if ( pathCopy.startsWith( '/' ) ) pathCopy = pathCopy.mid( 1 ); // remove '/' QStringList names = pathCopy.split( '/' ); - pathCopy = QStringList( names.mid( 1 ) ).join( QStringLiteral( "/" ) ); + pathCopy = QStringList( names.mid( 1 ) ).join( QLatin1Char( '/' ) ); if ( ! widgetItem ) { @@ -843,7 +843,7 @@ void QgsCustomization::updateMainWindow( QMenu *toolBarMenu ) continue; } - if ( action->metaObject()->className() == QStringLiteral( "QWidgetAction" ) ) + if ( action->metaObject()->className() == QLatin1String( "QWidgetAction" ) ) { mSettings->beginGroup( action->objectName() ); QWidgetAction *widgetAction = qobject_cast( action ); diff --git a/src/app/qgscustomprojectiondialog.cpp b/src/app/qgscustomprojectiondialog.cpp index d7f8d31ab026..414d88a020d8 100644 --- a/src/app/qgscustomprojectiondialog.cpp +++ b/src/app/qgscustomprojectiondialog.cpp @@ -584,7 +584,7 @@ static void proj_collecting_logger( void *user_data, int /*level*/, const char * { QStringList *dest = reinterpret_cast< QStringList * >( user_data ); QString messageString( message ); - messageString.replace( QStringLiteral( "internal_proj_create: " ), QString() ); + messageString.replace( QLatin1String( "internal_proj_create: " ), QString() ); dest->append( messageString ); } @@ -720,8 +720,8 @@ void QgsCustomProjectionDialog::formatChanged() { PJ_CONTEXT *pjContext = QgsProjContext::get(); QString proj = teParameters->toPlainText(); - proj.replace( QStringLiteral( "+type=crs" ), QString() ); - proj += QStringLiteral( " +type=crs" ); + proj.replace( QLatin1String( "+type=crs" ), QString() ); + proj += QLatin1String( " +type=crs" ); QgsProjUtils::proj_pj_unique_ptr crs( proj_create( QgsProjContext::get(), proj.toLatin1().constData() ) ); if ( crs ) { diff --git a/src/app/qgsguivectorlayertools.cpp b/src/app/qgsguivectorlayertools.cpp index 27a8696d6930..8bed9db66187 100644 --- a/src/app/qgsguivectorlayertools.cpp +++ b/src/app/qgsguivectorlayertools.cpp @@ -161,7 +161,7 @@ void QgsGuiVectorLayerTools::commitError( QgsVectorLayer *vlayer ) const mv->setWindowTitle( tr( "Commit Errors" ) ); mv->setMessageAsPlainText( tr( "Could not commit changes to layer %1" ).arg( vlayer->name() ) + "\n\n" - + tr( "Errors: %1\n" ).arg( vlayer->commitErrors().join( QStringLiteral( "\n " ) ) ) + + tr( "Errors: %1\n" ).arg( vlayer->commitErrors().join( QLatin1String( "\n " ) ) ) ); QToolButton *showMore = new QToolButton(); diff --git a/src/app/qgshandlebadlayers.cpp b/src/app/qgshandlebadlayers.cpp index 7419a6f217d9..a14dff3749dc 100644 --- a/src/app/qgshandlebadlayers.cpp +++ b/src/app/qgshandlebadlayers.cpp @@ -127,7 +127,7 @@ QgsHandleBadLayers::QgsHandleBadLayers( const QList &layers ) QString datasource = node.namedItem( QStringLiteral( "datasource" ) ).toElement().text(); QString provider = node.namedItem( QStringLiteral( "provider" ) ).toElement().text(); QString vectorProvider = type == QLatin1String( "vector" ) ? provider : tr( "none" ); - bool providerFileBased = ( provider == QStringLiteral( "gdal" ) || provider == QStringLiteral( "ogr" ) || provider == QStringLiteral( "mdal" ) ); + bool providerFileBased = ( provider == QLatin1String( "gdal" ) || provider == QLatin1String( "ogr" ) || provider == QLatin1String( "mdal" ) ); const QString basepath = QFileInfo( datasource ).absolutePath(); mOriginalFileBase[name].append( basepath ); @@ -242,7 +242,7 @@ void QgsHandleBadLayers::setFilename( int row, const QString &filename ) { QStringList theURIParts = datasource.split( '|' ); theURIParts[0] = filename; - datasource = theURIParts.join( QStringLiteral( "|" ) ); + datasource = theURIParts.join( QLatin1Char( '|' ) ); } else if ( provider == QLatin1String( "delimitedtext" ) ) { @@ -578,11 +578,11 @@ void QgsHandleBadLayers::autoFind() QString::number( i + 1 ), QString::number( layersToFind.size() ) ) ); progressDialog.open(); - if ( provider.toLower() == QStringLiteral( "none" ) ) + if ( provider.toLower() == QLatin1String( "none" ) ) { - if ( fileType == QStringLiteral( "raster" ) ) + if ( fileType == QLatin1String( "raster" ) ) provider = QStringLiteral( "gdal" ); - else if ( fileType == QStringLiteral( "vector" ) ) + else if ( fileType == QLatin1String( "vector" ) ) provider = QStringLiteral( "ogr" ); else if ( fileType.contains( "mesh", Qt::CaseInsensitive ) ) provider = QStringLiteral( "mdal" ); diff --git a/src/app/qgslayertreeviewbadlayerindicator.cpp b/src/app/qgslayertreeviewbadlayerindicator.cpp index 8c560f4086c7..6ef146de9a8e 100644 --- a/src/app/qgslayertreeviewbadlayerindicator.cpp +++ b/src/app/qgslayertreeviewbadlayerindicator.cpp @@ -88,7 +88,7 @@ void QgsLayerTreeViewBadLayerIndicatorProvider::onIndicatorClicked( const QModel QString message = QStringLiteral( "
      " ); for ( const QString &e : thisLayerErrors ) message += QStringLiteral( "
    • %1
    • " ).arg( e ); - message += QStringLiteral( "
    " ); + message += QLatin1String( "" ); m->setMessageAsHtml( message ); } m->exec(); diff --git a/src/app/qgsmergeattributesdialog.cpp b/src/app/qgsmergeattributesdialog.cpp index 4af71052eeda..94f45d3e1eae 100644 --- a/src/app/qgsmergeattributesdialog.cpp +++ b/src/app/qgsmergeattributesdialog.cpp @@ -327,7 +327,7 @@ void QgsMergeAttributesDialog::refreshMergedValue( int col ) QTableWidgetItem *item = mTableWidget->item( mTableWidget->rowCount() - 1, col ); const QString mergeBehaviorString = comboBox->currentData().toString(); QVariant mergeResult; // result to show in the merge result field - if ( mergeBehaviorString == QStringLiteral( "concat" ) ) + if ( mergeBehaviorString == QLatin1String( "concat" ) ) { mergeResult = concatenationAttribute( col ); } @@ -426,7 +426,7 @@ QVariant QgsMergeAttributesDialog::concatenationAttribute( int col ) { concatString << mTableWidget->item( i + 1, col )->text(); } - return concatString.join( QStringLiteral( "," ) ); //todo: make separator user configurable + return concatString.join( QLatin1Char( ',' ) ); //todo: make separator user configurable } void QgsMergeAttributesDialog::mFromSelectedPushButton_clicked() @@ -603,7 +603,7 @@ QgsAttributes QgsMergeAttributesDialog::mergedAttributes() const if ( fieldIdx >= results.count() ) results.resize( fieldIdx + 1 ); // make sure the results vector is long enough (maybe not necessary) - if ( comboBox->currentData().toString() != QStringLiteral( "skip" ) ) + if ( comboBox->currentData().toString() != QLatin1String( "skip" ) ) { results[fieldIdx] = currentItem->data( Qt::UserRole ); } @@ -633,7 +633,7 @@ QSet QgsMergeAttributesDialog::skippedAttributeIndexes() const continue; } - if ( comboBox->currentData().toString() == QStringLiteral( "skip" ) ) + if ( comboBox->currentData().toString() == QLatin1String( "skip" ) ) { skipped << i; } diff --git a/src/app/qgsprojectproperties.cpp b/src/app/qgsprojectproperties.cpp index 7f5f44a0b654..0d92018e517d 100644 --- a/src/app/qgsprojectproperties.cpp +++ b/src/app/qgsprojectproperties.cpp @@ -445,7 +445,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa mWMSAbstract->setPlainText( QgsProject::instance()->readEntry( QStringLiteral( "WMSServiceAbstract" ), QStringLiteral( "/" ), QString() ) ); mWMSOnlineResourceLineEdit->setText( QgsProject::instance()->readEntry( QStringLiteral( "WMSOnlineResource" ), QStringLiteral( "/" ), QString() ) ); mWMSUrlLineEdit->setText( QgsProject::instance()->readEntry( QStringLiteral( "WMSUrl" ), QStringLiteral( "/" ), QString() ) ); - mWMSKeywordList->setText( QgsProject::instance()->readListEntry( QStringLiteral( "WMSKeywordList" ), QStringLiteral( "/" ) ).join( QStringLiteral( ", " ) ) ); + mWMSKeywordList->setText( QgsProject::instance()->readListEntry( QStringLiteral( "WMSKeywordList" ), QStringLiteral( "/" ) ).join( QLatin1String( ", " ) ) ); mWMSOnlineResourceExpressionButton->registerExpressionContextGenerator( this ); mWMSOnlineResourceExpressionButton->setToProperty( QgsProject::instance()->dataDefinedServerProperties().property( QgsProject::DataDefinedServerProperty::WMSOnlineResource ) ); @@ -961,7 +961,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa cbtsLocale->addItem( QIcon( QStringLiteral( ":/images/flags/%1.svg" ).arg( l ) ), displayName, l ); } - cbtsLocale->addItem( QIcon( QStringLiteral( ":/images/flags/%1.svg" ).arg( QStringLiteral( "en_US" ) ) ), QLocale( QStringLiteral( "en_US" ) ).nativeLanguageName(), QStringLiteral( "en_US" ) ); + cbtsLocale->addItem( QIcon( QStringLiteral( ":/images/flags/%1.svg" ).arg( QLatin1String( "en_US" ) ) ), QLocale( QStringLiteral( "en_US" ) ).nativeLanguageName(), QStringLiteral( "en_US" ) ); cbtsLocale->setCurrentIndex( cbtsLocale->findData( settings.value( QStringLiteral( "locale/userLocale" ), QString() ).toString() ) ); connect( generateTsFileButton, &QPushButton::clicked, this, &QgsProjectProperties::onGenerateTsFileButton ); @@ -1600,11 +1600,11 @@ void QgsProjectProperties::twWmtsGridItemDoubleClicked( QTreeWidgetItem *item, i else { QString crsStr = item->text( 0 ); - if ( crsStr == QStringLiteral( "EPSG:3857" ) && column != 5 ) + if ( crsStr == QLatin1String( "EPSG:3857" ) && column != 5 ) { item->setFlags( flags & ( ~Qt::ItemIsEditable ) ); } - else if ( crsStr == QStringLiteral( "EPSG:4326" ) && column != 5 ) + else if ( crsStr == QLatin1String( "EPSG:4326" ) && column != 5 ) { item->setFlags( flags & ( ~Qt::ItemIsEditable ) ); } @@ -2256,13 +2256,13 @@ void QgsProjectProperties::addWmtsGrid( const QString &crsStr ) // Define or calculate top, left, max. scale int lastLevel = 18; double scaleDenominator = 0.0; - if ( crsStr == QStringLiteral( "EPSG:3857" ) ) + if ( crsStr == QLatin1String( "EPSG:3857" ) ) { gridItem->setData( 2, Qt::DisplayRole, 20037508.3427892480 ); gridItem->setData( 3, Qt::DisplayRole, -20037508.3427892480 ); scaleDenominator = 559082264.0287179; } - else if ( crsStr == QStringLiteral( "EPSG:4326" ) ) + else if ( crsStr == QLatin1String( "EPSG:4326" ) ) { gridItem->setData( 2, Qt::DisplayRole, 90.0 ); gridItem->setData( 3, Qt::DisplayRole, -180.0 ); diff --git a/src/app/qgsrecentprojectsitemsmodel.cpp b/src/app/qgsrecentprojectsitemsmodel.cpp index 8763a87970c1..f829f9dda934 100644 --- a/src/app/qgsrecentprojectsitemsmodel.cpp +++ b/src/app/qgsrecentprojectsitemsmodel.cpp @@ -113,7 +113,7 @@ Qt::ItemFlags QgsRecentProjectItemsModel::flags( const QModelIndex &index ) cons if ( storage ) { path = storage->filePath( projectData.path ); - if ( storage->type() == QStringLiteral( "geopackage" ) && path.isEmpty() ) + if ( storage->type() == QLatin1String( "geopackage" ) && path.isEmpty() ) projectData.exists = false; else projectData.exists = true; @@ -155,7 +155,7 @@ void QgsRecentProjectItemsModel::recheckProject( const QModelIndex &index ) if ( storage ) { path = storage->filePath( projectData.path ); - if ( storage->type() == QStringLiteral( "geopackage" ) && path.isEmpty() ) + if ( storage->type() == QLatin1String( "geopackage" ) && path.isEmpty() ) projectData.exists = false; else projectData.exists = true; diff --git a/src/app/qgssnappinglayertreemodel.cpp b/src/app/qgssnappinglayertreemodel.cpp index 4343137a4ba3..1e28cc589f76 100644 --- a/src/app/qgssnappinglayertreemodel.cpp +++ b/src/app/qgssnappinglayertreemodel.cpp @@ -676,7 +676,7 @@ QVariant QgsSnappingLayerTreeModel::data( const QModelIndex &idx, int role ) con { if ( ls.minimumScale() <= 0.0 ) { - return QString( tr( "not set" ) ); + return tr( "not set" ); } else { @@ -696,7 +696,7 @@ QVariant QgsSnappingLayerTreeModel::data( const QModelIndex &idx, int role ) con { if ( ls.maximumScale() <= 0.0 ) { - return QString( tr( "not set" ) ); + return tr( "not set" ); } else { diff --git a/src/app/qgsstatisticalsummarydockwidget.cpp b/src/app/qgsstatisticalsummarydockwidget.cpp index d4244c6d0448..dd2c639cd3e5 100644 --- a/src/app/qgsstatisticalsummarydockwidget.cpp +++ b/src/app/qgsstatisticalsummarydockwidget.cpp @@ -112,7 +112,7 @@ void QgsStatisticalSummaryDockWidget::copyStatistics() QTableWidgetItem *item = mStatisticsTable->item( i, j ); columns += item->text(); } - rows += columns.join( QStringLiteral( "\t" ) ); + rows += columns.join( QLatin1Char( '\t' ) ); columns.clear(); } @@ -120,9 +120,9 @@ void QgsStatisticalSummaryDockWidget::copyStatistics() { QString text = QStringLiteral( "%1\t%2\n%3" ).arg( mStatisticsTable->horizontalHeaderItem( 0 )->text(), mStatisticsTable->horizontalHeaderItem( 1 )->text(), - rows.join( QStringLiteral( "\n" ) ) ); + rows.join( QLatin1Char( '\n' ) ) ); QString html = QStringLiteral( "
    %1
    " ).arg( text ); - html.replace( QStringLiteral( "\t" ), QStringLiteral( "" ) ).replace( QStringLiteral( "\n" ), QStringLiteral( "" ) ); + html.replace( QLatin1String( "\t" ), QLatin1String( "" ) ).replace( QLatin1String( "\n" ), QLatin1String( "" ) ); QgsClipboard clipboard; clipboard.setData( QStringLiteral( "text/html" ), html.toUtf8(), text ); diff --git a/src/app/qgsstatusbarcoordinateswidget.cpp b/src/app/qgsstatusbarcoordinateswidget.cpp index 6cdaaf5c5612..088e1674d240 100644 --- a/src/app/qgsstatusbarcoordinateswidget.cpp +++ b/src/app/qgsstatusbarcoordinateswidget.cpp @@ -153,7 +153,7 @@ void QgsStatusBarCoordinatesWidget::validateCoordinates() refreshMapCanvas(); return; } - else if ( mLineEdit->text() == QStringLiteral( "bored" ) ) + else if ( mLineEdit->text() == QLatin1String( "bored" ) ) { // it's friday afternoon and too late to start another piece of work... emit weAreBored(); diff --git a/src/app/qgsvariantdelegate.cpp b/src/app/qgsvariantdelegate.cpp index fc33c2699e83..c86e2bb9fd84 100644 --- a/src/app/qgsvariantdelegate.cpp +++ b/src/app/qgsvariantdelegate.cpp @@ -334,7 +334,7 @@ QString QgsVariantDelegate::displayText( const QVariant &value ) return QStringLiteral( "(%1,%2)" ).arg( size.width() ).arg( size.height() ); } case QVariant::StringList: - return value.toStringList().join( QStringLiteral( "," ) ); + return value.toStringList().join( QLatin1Char( ',' ) ); case QVariant::Time: return value.toTime().toString( Qt::ISODate ); default: diff --git a/src/app/qgsvectorlayerdigitizingproperties.cpp b/src/app/qgsvectorlayerdigitizingproperties.cpp index ead117513e96..02a382a5db8e 100644 --- a/src/app/qgsvectorlayerdigitizingproperties.cpp +++ b/src/app/qgsvectorlayerdigitizingproperties.cpp @@ -91,7 +91,7 @@ QgsVectorLayerDigitizingPropertiesPage::QgsVectorLayerDigitizingPropertiesPage( cb->setChecked( activeChecks.contains( factory->id() ) ); mGeometryCheckFactoriesGroupBoxes.insert( cb, factory->id() ); topologyCheckLayout->addWidget( cb ); - if ( factory->id() == QStringLiteral( "QgsGeometryGapCheck" ) ) + if ( factory->id() == QLatin1String( "QgsGeometryGapCheck" ) ) { const QVariantMap gapCheckConfig = vlayer->geometryOptions()->checkConfiguration( QStringLiteral( "QgsGeometryGapCheck" ) ); diff --git a/src/app/qgsversionmigration.cpp b/src/app/qgsversionmigration.cpp index f25b60c2c31a..ffbd6a1e68ff 100644 --- a/src/app/qgsversionmigration.cpp +++ b/src/app/qgsversionmigration.cpp @@ -321,7 +321,7 @@ QPair Qgs2To3Migration::transformKey( QString fullOldKey, QStr QString newKey = newKeyPart; QString oldKey = fullOldKey; - if ( newKeyPart == QStringLiteral( "*" ) ) + if ( newKeyPart == QLatin1String( "*" ) ) { newKey = fullOldKey; } diff --git a/src/app/qgswelcomepage.cpp b/src/app/qgswelcomepage.cpp index 56cbc8260f32..b69171b65af3 100644 --- a/src/app/qgswelcomepage.cpp +++ b/src/app/qgswelcomepage.cpp @@ -303,7 +303,7 @@ void QgsWelcomePage::showContextMenuForProjects( QPoint point ) menu->addAction( rescanAction ); bool showClosestPath = storage ? false : true; - if ( storage && ( storage->type() == QStringLiteral( "geopackage" ) ) ) + if ( storage && ( storage->type() == QLatin1String( "geopackage" ) ) ) { QRegularExpression reGpkg( "^(geopackage:)([^\?]+)\?(.+)$", QRegularExpression::CaseInsensitiveOption ); QRegularExpressionMatch matchGpkg = reGpkg.match( path ); diff --git a/src/app/vectortile/qgsvectortilelayerproperties.cpp b/src/app/vectortile/qgsvectortilelayerproperties.cpp index 6a0d483a61c3..093c5477cdcf 100644 --- a/src/app/vectortile/qgsvectortilelayerproperties.cpp +++ b/src/app/vectortile/qgsvectortilelayerproperties.cpp @@ -102,7 +102,7 @@ QgsVectorTileLayerProperties::QgsVectorTileLayerProperties( QgsVectorTileLayer * mOptStackedWidget->indexOf( mOptsPage_Style ) ); } - QString title = QString( tr( "Layer Properties - %1" ) ).arg( mLayer->name() ); + QString title = tr( "Layer Properties - %1" ).arg( mLayer->name() ); mBtnStyle = new QPushButton( tr( "Style" ) ); QMenu *menuStyle = new QMenu( this ); @@ -156,7 +156,7 @@ void QgsVectorTileLayerProperties::syncToLayer() */ const QString myStyle = QgsApplication::reportStyleSheet( QgsApplication::StyleSheetType::WebBrowser ); // Inject the stylesheet - const QString html { mLayer->htmlMetadata().replace( QStringLiteral( "" ), QStringLiteral( R"raw()raw" ) ).arg( myStyle ) }; + const QString html { mLayer->htmlMetadata().replace( QLatin1String( "" ), QStringLiteral( R"raw()raw" ) ).arg( myStyle ) }; mMetadataViewer->setHtml( html ); /* diff --git a/src/auth/basic/qgsauthbasicmethod.cpp b/src/auth/basic/qgsauthbasicmethod.cpp index a6775a662201..90b9b9be7768 100644 --- a/src/auth/basic/qgsauthbasicmethod.cpp +++ b/src/auth/basic/qgsauthbasicmethod.cpp @@ -116,7 +116,7 @@ bool QgsAuthBasicMethod::updateDataSourceUriItems( QStringList &connectionItems, // SSL Extra CAs QString caparam; QList cas; - if ( sslMode.startsWith( QStringLiteral( "verify-" ) ) ) + if ( sslMode.startsWith( QLatin1String( "verify-" ) ) ) { cas = QgsApplication::authManager()->trustedCaCerts(); // save CAs to temp file @@ -131,7 +131,7 @@ bool QgsAuthBasicMethod::updateDataSourceUriItems( QStringList &connectionItems, } // Branch for OGR - if ( dataprovider == QStringLiteral( "ogr" ) || dataprovider == QStringLiteral( "gdal" ) ) + if ( dataprovider == QLatin1String( "ogr" ) || dataprovider == QLatin1String( "gdal" ) ) { if ( ! password.isEmpty() ) { @@ -200,7 +200,7 @@ bool QgsAuthBasicMethod::updateDataSourceUriItems( QStringList &connectionItems, else if ( uri.startsWith( QLatin1String( "OCI:" ) ) ) { // OCI:userid/password@database_instance:table,table - uri = uri.replace( QStringLiteral( "OCI:/" ), QStringLiteral( "OCI:%1/%2" ).arg( username, password ) ); + uri = uri.replace( QLatin1String( "OCI:/" ), QStringLiteral( "OCI:%1/%2" ).arg( username, password ) ); } else if ( uri.startsWith( QLatin1String( "ODBC:" ) ) ) { @@ -216,7 +216,7 @@ bool QgsAuthBasicMethod::updateDataSourceUriItems( QStringList &connectionItems, || uri.startsWith( "/vsicurl/ftp://" ) ) { - uri = uri.replace( QStringLiteral( "://" ), QStringLiteral( "://%1:%2@" ).arg( username, password ) ); + uri = uri.replace( QLatin1String( "://" ), QStringLiteral( "://%1:%2@" ).arg( username, password ) ); } } // Handle sub-layers diff --git a/src/auth/oauth2/qgsauthoauth2config.cpp b/src/auth/oauth2/qgsauthoauth2config.cpp index 603e4ca462a8..5dc67f1017bd 100644 --- a/src/auth/oauth2/qgsauthoauth2config.cpp +++ b/src/auth/oauth2/qgsauthoauth2config.cpp @@ -567,7 +567,7 @@ QList QgsAuthOAuth2Config::loadOAuth2Configs( if ( configfiles.size() > 0 ) { QgsDebugMsg( QStringLiteral( "Config files found in: %1...\n%2" ) - .arg( configdir.path(), configfiles.join( QStringLiteral( ", " ) ) ) ); + .arg( configdir.path(), configfiles.join( QLatin1String( ", " ) ) ) ); } else { @@ -645,7 +645,7 @@ QgsStringMap QgsAuthOAuth2Config::mapOAuth2Configs( if ( configfiles.size() > 0 ) { QgsDebugMsg( QStringLiteral( "Config files found in: %1...\n%2" ) - .arg( configdir.path(), configfiles.join( QStringLiteral( ", " ) ) ) ); + .arg( configdir.path(), configfiles.join( QLatin1String( ", " ) ) ) ); } else { diff --git a/src/auth/oauth2/qgsauthoauth2edit.cpp b/src/auth/oauth2/qgsauthoauth2edit.cpp index d2a6eacedce5..6d4fcadd02d0 100644 --- a/src/auth/oauth2/qgsauthoauth2edit.cpp +++ b/src/auth/oauth2/qgsauthoauth2edit.cpp @@ -100,7 +100,7 @@ QWidget *QgsAuthOAuth2Edit::parentWidget() const const QMetaObject *metaObject = window()->metaObject(); QString parentclass = metaObject->className(); //QgsDebugMsg( QStringLiteral( "parent class: %1" ).arg( parentclass ) ); - if ( parentclass != QStringLiteral( "QgsAuthConfigEdit" ) ) + if ( parentclass != QLatin1String( "QgsAuthConfigEdit" ) ) { QgsDebugMsg( QStringLiteral( "Parent widget not QgsAuthConfigEdit instance" ) ); return nullptr; @@ -1166,7 +1166,7 @@ void QgsAuthOAuth2Edit::updatePredefinedLocationsTooltip() locationListHtml += QStringLiteral( "
  2. %2
  3. " ).arg( QUrl::fromLocalFile( dir ).toString(), dir ); } if ( !locationListHtml.isEmpty() ) - locationListHtml += QStringLiteral( "" ); + locationListHtml += QLatin1String( "" ); QString tip = QStringLiteral( "

    " ) + tr( "Defined configurations are JSON-formatted files, with a single configuration per file. " "This allows configurations to be swapped out via filesystem tools without affecting user " diff --git a/src/auth/oauth2/qgsauthoauth2method.cpp b/src/auth/oauth2/qgsauthoauth2method.cpp index 8c0ffadb65f4..97387b0a2886 100644 --- a/src/auth/oauth2/qgsauthoauth2method.cpp +++ b/src/auth/oauth2/qgsauthoauth2method.cpp @@ -408,7 +408,7 @@ void QgsAuthOAuth2Method::onCloseBrowser() const QList widgets = QgsApplication::topLevelWidgets(); for ( QWidget *topwdgt : widgets ) { - if ( topwdgt->objectName() == QStringLiteral( "MainWindow" ) ) + if ( topwdgt->objectName() == QLatin1String( "MainWindow" ) ) { topwdgt->raise(); topwdgt->activateWindow(); diff --git a/src/auth/oauth2/qgso2.cpp b/src/auth/oauth2/qgso2.cpp index c7a4cfd5c8b3..aea8651e65f5 100644 --- a/src/auth/oauth2/qgso2.cpp +++ b/src/auth/oauth2/qgso2.cpp @@ -64,7 +64,7 @@ void QgsO2::initOAuthConfig() } // common properties to all grant flows - QString localpolicy = QStringLiteral( "http://127.0.0.1:% 1/%1" ).arg( mOAuth2Config->redirectUrl() ).replace( QStringLiteral( "% 1" ), QStringLiteral( "%1" ) ); + QString localpolicy = QStringLiteral( "http://127.0.0.1:% 1/%1" ).arg( mOAuth2Config->redirectUrl() ).replace( QLatin1String( "% 1" ), QLatin1String( "%1" ) ); QgsDebugMsg( QStringLiteral( "localpolicy(w/port): %1" ).arg( localpolicy.arg( mOAuth2Config->redirectPort() ) ) ); setLocalhostPolicy( localpolicy ); setLocalPort( mOAuth2Config->redirectPort() ); @@ -133,7 +133,7 @@ void QgsO2::setVerificationResponseContent() bool QgsO2::isLocalHost( const QUrl redirectUrl ) const { QString hostName = redirectUrl.host(); - if ( hostName == QStringLiteral( "localhost" ) || hostName == QStringLiteral( "127.0.0.1" ) || hostName == QStringLiteral( "[::1]" ) ) + if ( hostName == QLatin1String( "localhost" ) || hostName == QLatin1String( "127.0.0.1" ) || hostName == QLatin1String( "[::1]" ) ) { return true; } diff --git a/src/auth/pkipaths/qgsauthpkipathsedit.cpp b/src/auth/pkipaths/qgsauthpkipathsedit.cpp index 84b5d31ee54e..31d4ccb434c8 100644 --- a/src/auth/pkipaths/qgsauthpkipathsedit.cpp +++ b/src/auth/pkipaths/qgsauthpkipathsedit.cpp @@ -108,8 +108,8 @@ void QgsAuthPkiPathsEdit::loadConfig( const QgsStringMap &configmap ) lePkiPathsCert->setText( configmap.value( QStringLiteral( "certpath" ) ) ); lePkiPathsKey->setText( configmap.value( QStringLiteral( "keypath" ) ) ); lePkiPathsKeyPass->setText( configmap.value( QStringLiteral( "keypass" ) ) ); - cbAddCas->setChecked( configmap.value( QStringLiteral( "addcas" ), QStringLiteral( "false " ) ) == QStringLiteral( "true" ) ); - cbAddRootCa->setChecked( configmap.value( QStringLiteral( "addrootca" ), QStringLiteral( "false " ) ) == QStringLiteral( "true" ) ); + cbAddCas->setChecked( configmap.value( QStringLiteral( "addcas" ), QStringLiteral( "false " ) ) == QLatin1String( "true" ) ); + cbAddRootCa->setChecked( configmap.value( QStringLiteral( "addrootca" ), QStringLiteral( "false " ) ) == QLatin1String( "true" ) ); validateConfig(); } diff --git a/src/auth/pkipkcs12/qgsauthpkcs12edit.cpp b/src/auth/pkipkcs12/qgsauthpkcs12edit.cpp index b8e4de397b0c..46c1b26a5c87 100644 --- a/src/auth/pkipkcs12/qgsauthpkcs12edit.cpp +++ b/src/auth/pkipkcs12/qgsauthpkcs12edit.cpp @@ -142,8 +142,8 @@ void QgsAuthPkcs12Edit::loadConfig( const QgsStringMap &configmap ) mConfigMap = configmap; lePkcs12Bundle->setText( configmap.value( QStringLiteral( "bundlepath" ) ) ); lePkcs12KeyPass->setText( configmap.value( QStringLiteral( "bundlepass" ) ) ); - cbAddCas->setChecked( configmap.value( QStringLiteral( "addcas" ), QStringLiteral( "false " ) ) == QStringLiteral( "true" ) ); - cbAddRootCa->setChecked( configmap.value( QStringLiteral( "addrootca" ), QStringLiteral( "false " ) ) == QStringLiteral( "true" ) ); + cbAddCas->setChecked( configmap.value( QStringLiteral( "addcas" ), QStringLiteral( "false " ) ) == QLatin1String( "true" ) ); + cbAddRootCa->setChecked( configmap.value( QStringLiteral( "addrootca" ), QStringLiteral( "false " ) ) == QLatin1String( "true" ) ); validateConfig(); } diff --git a/src/core/auth/qgsauthcertutils.cpp b/src/core/auth/qgsauthcertutils.cpp index d023e81bf126..cda8301e939c 100644 --- a/src/core/auth/qgsauthcertutils.cpp +++ b/src/core/auth/qgsauthcertutils.cpp @@ -571,7 +571,7 @@ QByteArray QgsAuthCertUtils::certsToPemText( const QList &certs { certslist << cert.toPem(); } - capem = certslist.join( QStringLiteral( "\n" ) ).toLatin1(); //+ "\n"; + capem = certslist.join( QLatin1Char( '\n' ) ).toLatin1(); //+ "\n"; } return capem; } @@ -714,7 +714,7 @@ QString QgsAuthCertUtils::getCertDistinguishedName( const QSslCertificate &qcert dirname, QStringLiteral( "C" ), issuer ? SSL_ISSUER_INFO( qcert, QSslCertificate::CountryName ) : SSL_SUBJECT_INFO( qcert, QSslCertificate::CountryName ) ); - return dirname.join( QStringLiteral( "," ) ); + return dirname.join( QLatin1Char( ',' ) ); } QString QgsAuthCertUtils::getCertTrustName( QgsAuthCertUtils::CertTrustPolicy trust ) @@ -742,7 +742,7 @@ QString QgsAuthCertUtils::getColonDelimited( const QString &txt ) { sl << txt.mid( i, ( i + 2 > txt.size() ) ? -1 : 2 ); } - return sl.join( QStringLiteral( ":" ) ); + return sl.join( QLatin1Char( ':' ) ); } QString QgsAuthCertUtils::shaHexForCert( const QSslCertificate &cert, bool formatted ) diff --git a/src/core/auth/qgsauthconfig.cpp b/src/core/auth/qgsauthconfig.cpp index bc18f70ee8c6..c105646816c5 100644 --- a/src/core/auth/qgsauthconfig.cpp +++ b/src/core/auth/qgsauthconfig.cpp @@ -349,7 +349,7 @@ const QString QgsAuthConfigSslServer::configString() const { errs << QString::number( static_cast< int >( err ) ); } - configlist << errs.join( QStringLiteral( "~~" ) ); + configlist << errs.join( QLatin1String( "~~" ) ); configlist << QStringLiteral( "%1~~%2" ).arg( static_cast< int >( mSslPeerVerifyMode ) ).arg( mSslPeerVerifyDepth ); diff --git a/src/core/diagram/qgsdiagram.h b/src/core/diagram/qgsdiagram.h index da4aef58441a..2d7510e4324c 100644 --- a/src/core/diagram/qgsdiagram.h +++ b/src/core/diagram/qgsdiagram.h @@ -42,13 +42,13 @@ class CORE_EXPORT QgsDiagram SIP_NODEFAULTCTORS #ifdef SIP_RUN SIP_CONVERT_TO_SUBCLASS_CODE - if ( sipCpp->diagramName() == QStringLiteral( "Pie" ) ) + if ( sipCpp->diagramName() == QLatin1String( "Pie" ) ) sipType = sipType_QgsPieDiagram; - else if ( sipCpp->diagramName() == QStringLiteral( "Histogram" ) ) + else if ( sipCpp->diagramName() == QLatin1String( "Histogram" ) ) sipType = sipType_QgsHistogramDiagram; - else if ( sipCpp->diagramName() == QStringLiteral( "Text" ) ) + else if ( sipCpp->diagramName() == QLatin1String( "Text" ) ) sipType = sipType_QgsTextDiagram; - else if ( sipCpp->diagramName() == QStringLiteral( "Stacked" ) ) + else if ( sipCpp->diagramName() == QLatin1String( "Stacked" ) ) sipType = sipType_QgsStackedBarDiagram; else sipType = NULL; diff --git a/src/core/effects/qgsgloweffect.cpp b/src/core/effects/qgsgloweffect.cpp index 0e409560a2a4..4e204a7f8e00 100644 --- a/src/core/effects/qgsgloweffect.cpp +++ b/src/core/effects/qgsgloweffect.cpp @@ -182,7 +182,7 @@ void QgsGlowEffect::readProperties( const QgsStringMap &props ) //attempt to create color ramp from props delete mRamp; - if ( props.contains( QStringLiteral( "rampType" ) ) && props[QStringLiteral( "rampType" )] == QStringLiteral( "cpt-city" ) ) + if ( props.contains( QStringLiteral( "rampType" ) ) && props[QStringLiteral( "rampType" )] == QLatin1String( "cpt-city" ) ) { mRamp = QgsCptCityColorRamp::create( props ); } diff --git a/src/core/expression/qgsexpression.cpp b/src/core/expression/qgsexpression.cpp index 6e0ebb8caeee..4cdfe574342b 100644 --- a/src/core/expression/qgsexpression.cpp +++ b/src/core/expression/qgsexpression.cpp @@ -105,7 +105,7 @@ QString QgsExpression::quotedValue( const QVariant &value, QVariant::Type type ) { quotedValues += quotedValue( v ); } - return QStringLiteral( "array( %1 )" ).arg( quotedValues.join( QStringLiteral( ", " ) ) ); + return QStringLiteral( "array( %1 )" ).arg( quotedValues.join( QLatin1String( ", " ) ) ); } default: @@ -591,7 +591,7 @@ QString QgsExpression::helpText( QString name ) if ( a.mOptional ) { hasOptionalArgs = true; - helpContents += QStringLiteral( "[" ); + helpContents += QLatin1Char( '[' ); } helpContents += delim; @@ -601,7 +601,7 @@ QString QgsExpression::helpText( QString name ) ); if ( a.mOptional ) - helpContents += QStringLiteral( "]" ); + helpContents += QLatin1Char( ']' ); } delim = QStringLiteral( "," ); } @@ -1042,8 +1042,8 @@ QString QgsExpression::formatPreviewString( const QVariant &value, const bool ht } } if ( !map.empty() ) - mapStr += QStringLiteral( " " ); - mapStr += QStringLiteral( "}" ); + mapStr += QLatin1Char( ' ' ); + mapStr += QLatin1Char( '}' ); return mapStr; } else if ( value.type() == QVariant::List || value.type() == QVariant::StringList ) @@ -1066,8 +1066,8 @@ QString QgsExpression::formatPreviewString( const QVariant &value, const bool ht } } if ( !list.empty() ) - listStr += QStringLiteral( " " ); - listStr += QStringLiteral( "]" ); + listStr += QLatin1Char( ' ' ); + listStr += QLatin1Char( ']' ); return listStr; } else diff --git a/src/core/expression/qgsexpressionfunction.cpp b/src/core/expression/qgsexpressionfunction.cpp index af37093bcd79..ca88d79e1c74 100644 --- a/src/core/expression/qgsexpressionfunction.cpp +++ b/src/core/expression/qgsexpressionfunction.cpp @@ -1221,7 +1221,7 @@ static QVariant fcnTitle( const QVariantList &values, const QgsExpressionContext if ( elems[i].size() > 1 ) elems[i] = elems[i].at( 0 ).toUpper() + elems[i].mid( 1 ).toLower(); } - return QVariant( elems.join( QStringLiteral( " " ) ) ); + return QVariant( elems.join( QLatin1Char( ' ' ) ) ); } static QVariant fcnTrim( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * ) diff --git a/src/core/expression/qgsexpressionnodeimpl.cpp b/src/core/expression/qgsexpressionnodeimpl.cpp index cf5d52053eaa..ac6fd9a606be 100644 --- a/src/core/expression/qgsexpressionnodeimpl.cpp +++ b/src/core/expression/qgsexpressionnodeimpl.cpp @@ -1479,7 +1479,7 @@ QString QgsExpressionNodeCondition::dump() const } if ( mElseExp ) msg += QStringLiteral( " ELSE %1" ).arg( mElseExp->dump() ); - msg += QStringLiteral( " END" ); + msg += QLatin1String( " END" ); return msg; } diff --git a/src/core/fieldformatter/qgsvaluerelationfieldformatter.cpp b/src/core/fieldformatter/qgsvaluerelationfieldformatter.cpp index 997edc0a1de1..8a024f2f66c7 100644 --- a/src/core/fieldformatter/qgsvaluerelationfieldformatter.cpp +++ b/src/core/fieldformatter/qgsvaluerelationfieldformatter.cpp @@ -87,7 +87,7 @@ QString QgsValueRelationFieldFormatter::representValue( QgsVectorLayer *layer, i } } - return valueList.join( QStringLiteral( ", " ) ).prepend( '{' ).append( '}' ); + return valueList.join( QLatin1String( ", " ) ).prepend( '{' ).append( '}' ); } else { diff --git a/src/core/geocms/geonode/qgsgeonoderequest.cpp b/src/core/geocms/geonode/qgsgeonoderequest.cpp index 5e193b3d5063..988074540773 100644 --- a/src/core/geocms/geonode/qgsgeonoderequest.cpp +++ b/src/core/geocms/geonode/qgsgeonoderequest.cpp @@ -356,17 +356,17 @@ QgsGeoNodeRequest::ServiceLayerDetail QgsGeoNodeRequest::parseOwsUrl( QgsGeoNode const QVariantMap linkMap = link.toMap(); if ( linkMap.contains( QStringLiteral( "link_type" ) ) ) { - if ( linkMap.value( QStringLiteral( "link_type" ) ) == QStringLiteral( "OGC:WMS" ) ) + if ( linkMap.value( QStringLiteral( "link_type" ) ) == QLatin1String( "OGC:WMS" ) ) { urlFound = layerStruct.wmsURL = linkMap.value( QStringLiteral( "url" ) ).toString(); } - else if ( linkMap.value( QStringLiteral( "link_type" ) ) == QStringLiteral( "OGC:WFS" ) ) + else if ( linkMap.value( QStringLiteral( "link_type" ) ) == QLatin1String( "OGC:WFS" ) ) { urlFound = layerStruct.wfsURL = linkMap.value( QStringLiteral( "url" ) ).toString(); } - else if ( linkMap.value( QStringLiteral( "link_type" ) ) == QStringLiteral( "image" ) ) + else if ( linkMap.value( QStringLiteral( "link_type" ) ) == QLatin1String( "image" ) ) { - if ( linkMap.contains( QStringLiteral( "name" ) ) && linkMap.value( QStringLiteral( "name" ) ) == QStringLiteral( "Tiles" ) ) + if ( linkMap.contains( QStringLiteral( "name" ) ) && linkMap.value( QStringLiteral( "name" ) ) == QLatin1String( "Tiles" ) ) { urlFound = layerStruct.xyzURL = linkMap.value( QStringLiteral( "url" ) ).toString(); } diff --git a/src/core/geometry/qgscircularstring.cpp b/src/core/geometry/qgscircularstring.cpp index 42d42fa8792b..b853ada020d7 100644 --- a/src/core/geometry/qgscircularstring.cpp +++ b/src/core/geometry/qgscircularstring.cpp @@ -350,7 +350,7 @@ QString QgsCircularString::asWkt( int precision ) const QString wkt = wktTypeStr() + ' '; if ( isEmpty() ) - wkt += QStringLiteral( "EMPTY" ); + wkt += QLatin1String( "EMPTY" ); else { QgsPointSequence pts; diff --git a/src/core/geometry/qgscompoundcurve.cpp b/src/core/geometry/qgscompoundcurve.cpp index 8f27f41cfd87..81bf736e54d5 100644 --- a/src/core/geometry/qgscompoundcurve.cpp +++ b/src/core/geometry/qgscompoundcurve.cpp @@ -256,7 +256,7 @@ QString QgsCompoundCurve::asWkt( int precision ) const { QString wkt = wktTypeStr(); if ( isEmpty() ) - wkt += QStringLiteral( " EMPTY" ); + wkt += QLatin1String( " EMPTY" ); else { wkt += QLatin1String( " (" ); diff --git a/src/core/geometry/qgscurvepolygon.cpp b/src/core/geometry/qgscurvepolygon.cpp index 9a03952f008a..503dd8fe8479 100644 --- a/src/core/geometry/qgscurvepolygon.cpp +++ b/src/core/geometry/qgscurvepolygon.cpp @@ -324,7 +324,7 @@ QString QgsCurvePolygon::asWkt( int precision ) const QString wkt = wktTypeStr(); if ( isEmpty() ) - wkt += QStringLiteral( " EMPTY" ); + wkt += QLatin1String( " EMPTY" ); else { wkt += QLatin1String( " (" ); diff --git a/src/core/geometry/qgsgeometrycollection.cpp b/src/core/geometry/qgsgeometrycollection.cpp index 086497c8d787..4cfa24a7a6a7 100644 --- a/src/core/geometry/qgsgeometrycollection.cpp +++ b/src/core/geometry/qgsgeometrycollection.cpp @@ -401,7 +401,7 @@ QString QgsGeometryCollection::asWkt( int precision ) const QString wkt = wktTypeStr(); if ( isEmpty() ) - wkt += QStringLiteral( " EMPTY" ); + wkt += QLatin1String( " EMPTY" ); else { wkt += QLatin1String( " (" ); diff --git a/src/core/geometry/qgsgeometrymakevalid.cpp b/src/core/geometry/qgsgeometrymakevalid.cpp index a01ce77a6591..01bb632c0992 100644 --- a/src/core/geometry/qgsgeometrymakevalid.cpp +++ b/src/core/geometry/qgsgeometrymakevalid.cpp @@ -815,7 +815,7 @@ static GEOSGeometry *LWGEOM_GEOS_makeValidCollection( const GEOSGeometry *gin, Q int nvgeoms = GEOSGetNumGeometries_r( handle, gin ); if ( nvgeoms == -1 ) { - errorMessage = QStringLiteral( "GEOSGetNumGeometries: %1" ).arg( QStringLiteral( "?" ) ); + errorMessage = QStringLiteral( "GEOSGetNumGeometries: %1" ).arg( QLatin1String( "?" ) ); return nullptr; } diff --git a/src/core/geometry/qgslinestring.cpp b/src/core/geometry/qgslinestring.cpp index d6083ea286f1..1b0f9099d66f 100644 --- a/src/core/geometry/qgslinestring.cpp +++ b/src/core/geometry/qgslinestring.cpp @@ -478,7 +478,7 @@ QString QgsLineString::asWkt( int precision ) const QString wkt = wktTypeStr() + ' '; if ( isEmpty() ) - wkt += QStringLiteral( "EMPTY" ); + wkt += QLatin1String( "EMPTY" ); else { QgsPointSequence pts; diff --git a/src/core/geometry/qgspoint.cpp b/src/core/geometry/qgspoint.cpp index f6d147a98b10..40af71b831d1 100644 --- a/src/core/geometry/qgspoint.cpp +++ b/src/core/geometry/qgspoint.cpp @@ -257,7 +257,7 @@ QString QgsPoint::asWkt( int precision ) const QString wkt = wktTypeStr(); if ( isEmpty() ) - wkt += QStringLiteral( " EMPTY" ); + wkt += QLatin1String( " EMPTY" ); else { wkt += QLatin1String( " (" ); diff --git a/src/core/gps/qgsnmeaconnection.cpp b/src/core/gps/qgsnmeaconnection.cpp index c2a8f7400ec5..a1314f71cd40 100644 --- a/src/core/gps/qgsnmeaconnection.cpp +++ b/src/core/gps/qgsnmeaconnection.cpp @@ -81,7 +81,7 @@ void QgsNmeaConnection::processStringBuffer() { endSentenceIndex = mStringBuffer.indexOf( QLatin1String( "\r\n" ) ); - dollarIndex = mStringBuffer.indexOf( QLatin1String( "$" ) ); + dollarIndex = mStringBuffer.indexOf( QLatin1Char( '$' ) ); if ( endSentenceIndex == -1 ) { break; diff --git a/src/core/labeling/qgspallabeling.cpp b/src/core/labeling/qgspallabeling.cpp index acb108efc2ae..15f2a4a9f978 100644 --- a/src/core/labeling/qgspallabeling.cpp +++ b/src/core/labeling/qgspallabeling.cpp @@ -596,7 +596,7 @@ QString updateDataDefinedString( const QString &value ) values << QStringLiteral( "0" ); values << QString(); values << value; // all old-style values are only field names - newValue = values.join( QStringLiteral( "~~" ) ); + newValue = values.join( QLatin1String( "~~" ) ); } return newValue; diff --git a/src/core/layertree/qgslayertreegroup.cpp b/src/core/layertree/qgslayertreegroup.cpp index 92f572a50ee7..dd6b2e51fde8 100644 --- a/src/core/layertree/qgslayertreegroup.cpp +++ b/src/core/layertree/qgslayertreegroup.cpp @@ -341,7 +341,7 @@ QString QgsLayerTreeGroup::dump() const childrenDump << node->dump().split( '\n' ); for ( int i = 0; i < childrenDump.count(); ++i ) childrenDump[i].prepend( " " ); - return header + childrenDump.join( QStringLiteral( "\n" ) ); + return header + childrenDump.join( QLatin1Char( '\n' ) ); } QgsLayerTreeGroup *QgsLayerTreeGroup::clone() const diff --git a/src/core/layertree/qgslayertreemodel.cpp b/src/core/layertree/qgslayertreemodel.cpp index 7d678862aa98..1fed216263ff 100644 --- a/src/core/layertree/qgslayertreemodel.cpp +++ b/src/core/layertree/qgslayertreemodel.cpp @@ -343,7 +343,7 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const parts << "" + source.toHtmlEscaped() + ""; - return parts.join( QStringLiteral( "
    " ) ); + return parts.join( QLatin1String( "
    " ) ); } } } diff --git a/src/core/layout/qgsabstractreportsection.cpp b/src/core/layout/qgsabstractreportsection.cpp index 74758c101d83..d06cff83dbad 100644 --- a/src/core/layout/qgsabstractreportsection.cpp +++ b/src/core/layout/qgsabstractreportsection.cpp @@ -107,7 +107,7 @@ bool QgsAbstractReportSection::writeXml( QDomElement &parentElement, QDomDocumen bool QgsAbstractReportSection::readXml( const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context ) { - if ( element.nodeName() != QStringLiteral( "Section" ) ) + if ( element.nodeName() != QLatin1String( "Section" ) ) { return false; } @@ -135,7 +135,7 @@ bool QgsAbstractReportSection::readXml( const QDomElement &element, const QDomDo for ( int i = 0; i < sectionItemList.size(); ++i ) { const QDomElement currentSectionElem = sectionItemList.at( i ).toElement(); - if ( currentSectionElem.nodeName() != QStringLiteral( "Section" ) ) + if ( currentSectionElem.nodeName() != QLatin1String( "Section" ) ) continue; const QString sectionType = currentSectionElem.attribute( QStringLiteral( "type" ) ); diff --git a/src/core/layout/qgscompositionconverter.cpp b/src/core/layout/qgscompositionconverter.cpp index 155ae7a11557..ab524350c3fa 100644 --- a/src/core/layout/qgscompositionconverter.cpp +++ b/src/core/layout/qgscompositionconverter.cpp @@ -694,7 +694,7 @@ bool QgsCompositionConverter::readPictureXml( QgsLayoutItemPicture *layoutItem, layoutItem->mNorthArrowHandler->setNorthOffset( itemElem.attribute( QStringLiteral( "northOffset" ), QStringLiteral( "0" ) ).toDouble() ); QString rotationMapId = itemElem.attribute( QStringLiteral( "mapId" ), QStringLiteral( "-1" ) ); - if ( rotationMapId != QStringLiteral( "-1" ) ) + if ( rotationMapId != QLatin1String( "-1" ) ) { // Find uuid for map with given id QgsLayoutItemMap *mapInstance = qobject_cast( layoutItem->layout()->itemByUuid( mapId2Uuid[ rotationMapId ] ) ); @@ -913,7 +913,7 @@ bool QgsCompositionConverter::readMapXml( QgsLayoutItemMap *layoutItem, const QD std::unique_ptr mapOverview( new QgsLayoutItemMapOverview( mapOverviewElem.attribute( QStringLiteral( "name" ) ), layoutItem ) ); mapOverview->readXml( mapOverviewElem, doc, context ); QString frameMapId = mapOverviewElem.attribute( QStringLiteral( "frameMap" ), QStringLiteral( "-1" ) ); - if ( frameMapId != QStringLiteral( "-1" ) && mapId2Uuid.contains( frameMapId ) ) + if ( frameMapId != QLatin1String( "-1" ) && mapId2Uuid.contains( frameMapId ) ) { QgsLayoutItemMap *mapInstance = qobject_cast( layoutItem->layout()->itemByUuid( mapId2Uuid[ frameMapId ] ) ); if ( mapInstance ) @@ -1196,7 +1196,7 @@ bool QgsCompositionConverter::readScaleBarXml( QgsLayoutItemScaleBar *layoutItem //composer map: use uuid QString mapId = itemElem.attribute( QStringLiteral( "mapId" ), QStringLiteral( "-1" ) ); - if ( mapId != QStringLiteral( "-1" ) && mapId2Uuid.contains( mapId ) ) + if ( mapId != QLatin1String( "-1" ) && mapId2Uuid.contains( mapId ) ) { QgsLayoutItemMap *mapInstance = qobject_cast( layoutItem->layout()->itemByUuid( mapId2Uuid[ mapId ] ) ); if ( mapInstance ) @@ -1221,7 +1221,7 @@ bool QgsCompositionConverter::readLegendXml( QgsLayoutItemLegend *layoutItem, co //composer map: use uuid QString mapId = itemElem.attribute( QStringLiteral( "map" ), QStringLiteral( "-1" ) ); - if ( mapId != QStringLiteral( "-1" ) && mapId2Uuid.contains( mapId ) ) + if ( mapId != QLatin1String( "-1" ) && mapId2Uuid.contains( mapId ) ) { QgsLayoutItemMap *mapInstance = qobject_cast( layoutItem->layout()->itemByUuid( mapId2Uuid[ mapId ] ) ); if ( mapInstance ) @@ -1617,7 +1617,7 @@ bool QgsCompositionConverter::readXml( QgsLayoutItem *layoutItem, const QDomElem layoutItem->setLocked( positionLock.compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0 ); //visibility - layoutItem->setVisibility( itemElem.attribute( QStringLiteral( "visibility" ), QStringLiteral( "1" ) ) != QStringLiteral( "0" ) ); + layoutItem->setVisibility( itemElem.attribute( QStringLiteral( "visibility" ), QStringLiteral( "1" ) ) != QLatin1String( "0" ) ); layoutItem->mParentGroupUuid = itemElem.attribute( QStringLiteral( "groupUuid" ) ); if ( !layoutItem->mParentGroupUuid.isEmpty() ) diff --git a/src/core/layout/qgslayout.cpp b/src/core/layout/qgslayout.cpp index 6833b110de4d..3e651aacb8a6 100644 --- a/src/core/layout/qgslayout.cpp +++ b/src/core/layout/qgslayout.cpp @@ -948,7 +948,7 @@ void QgsLayout::updateZValues( const bool addUndoCommands ) bool QgsLayout::readXml( const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context ) { - if ( layoutElement.nodeName() != QStringLiteral( "Layout" ) ) + if ( layoutElement.nodeName() != QLatin1String( "Layout" ) ) { return false; } @@ -1064,7 +1064,7 @@ QList< QgsLayoutItem * > QgsLayout::addItemsFromXml( const QDomElement &parentEl for ( int i = 0; i < layoutItemList.size(); ++i ) { const QDomElement currentItemElem = layoutItemList.at( i ).toElement(); - if ( currentItemElem.nodeName() != QStringLiteral( "LayoutItem" ) ) + if ( currentItemElem.nodeName() != QLatin1String( "LayoutItem" ) ) continue; const int itemType = currentItemElem.attribute( QStringLiteral( "type" ) ).toInt(); diff --git a/src/core/layout/qgslayoutatlas.cpp b/src/core/layout/qgslayoutatlas.cpp index 0e98cb35fd13..9c8cf13bd3a1 100644 --- a/src/core/layout/qgslayoutatlas.cpp +++ b/src/core/layout/qgslayoutatlas.cpp @@ -620,7 +620,7 @@ bool QgsLayoutAtlas::prepareForFeature( const int featureI ) } emit featureChanged( mCurrentFeature ); - emit messagePushed( QString( tr( "Atlas feature %1 of %2" ) ).arg( featureI + 1 ).arg( mFeatureIds.size() ) ); + emit messagePushed( tr( "Atlas feature %1 of %2" ).arg( featureI + 1 ).arg( mFeatureIds.size() ) ); return mCurrentFeature.isValid(); } diff --git a/src/core/layout/qgslayoutexporter.cpp b/src/core/layout/qgslayoutexporter.cpp index 741644143f85..d12684664d7a 100644 --- a/src/core/layout/qgslayoutexporter.cpp +++ b/src/core/layout/qgslayoutexporter.cpp @@ -1655,7 +1655,7 @@ QString nameForLayerWithItems( const QList< QGraphicsItem * > &items, unsigned i currentLayerItemTypes.append( QObject::tr( "Other" ) ); } } - return currentLayerItemTypes.join( QStringLiteral( ", " ) ); + return currentLayerItemTypes.join( QLatin1String( ", " ) ); } return QObject::tr( "Layer %1" ).arg( layerId ); } diff --git a/src/core/layout/qgslayoutgridsettings.cpp b/src/core/layout/qgslayoutgridsettings.cpp index 24f2cc6d1150..b251e2897754 100644 --- a/src/core/layout/qgslayoutgridsettings.cpp +++ b/src/core/layout/qgslayoutgridsettings.cpp @@ -106,12 +106,12 @@ bool QgsLayoutGridSettings::writeXml( QDomElement &parentElement, QDomDocument & bool QgsLayoutGridSettings::readXml( const QDomElement &e, const QDomDocument &, const QgsReadWriteContext & ) { QDomElement element = e; - if ( element.nodeName() != QStringLiteral( "Grid" ) ) + if ( element.nodeName() != QLatin1String( "Grid" ) ) { element = element.firstChildElement( QStringLiteral( "Grid" ) ); } - if ( element.nodeName() != QStringLiteral( "Grid" ) ) + if ( element.nodeName() != QLatin1String( "Grid" ) ) { return false; } diff --git a/src/core/layout/qgslayoutguidecollection.cpp b/src/core/layout/qgslayoutguidecollection.cpp index 753f11c5af3b..a2768e15cc5a 100644 --- a/src/core/layout/qgslayoutguidecollection.cpp +++ b/src/core/layout/qgslayoutguidecollection.cpp @@ -548,12 +548,12 @@ bool QgsLayoutGuideCollection::writeXml( QDomElement &parentElement, QDomDocumen bool QgsLayoutGuideCollection::readXml( const QDomElement &e, const QDomDocument &, const QgsReadWriteContext & ) { QDomElement element = e; - if ( element.nodeName() != QStringLiteral( "GuideCollection" ) ) + if ( element.nodeName() != QLatin1String( "GuideCollection" ) ) { element = element.firstChildElement( QStringLiteral( "GuideCollection" ) ); } - if ( element.nodeName() != QStringLiteral( "GuideCollection" ) ) + if ( element.nodeName() != QLatin1String( "GuideCollection" ) ) { return false; } diff --git a/src/core/layout/qgslayoutitem.cpp b/src/core/layout/qgslayoutitem.cpp index e37f15a89c27..54bd0fbc4507 100644 --- a/src/core/layout/qgslayoutitem.cpp +++ b/src/core/layout/qgslayoutitem.cpp @@ -690,7 +690,7 @@ bool QgsLayoutItem::writeXml( QDomElement &parentElement, QDomDocument &doc, con bool QgsLayoutItem::readXml( const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context ) { - if ( element.nodeName() != QStringLiteral( "LayoutItem" ) ) + if ( element.nodeName() != QLatin1String( "LayoutItem" ) ) { return false; } diff --git a/src/core/layout/qgslayoutmanager.cpp b/src/core/layout/qgslayoutmanager.cpp index 8aeac34ef2cd..183f6972f913 100644 --- a/src/core/layout/qgslayoutmanager.cpp +++ b/src/core/layout/qgslayoutmanager.cpp @@ -136,7 +136,7 @@ bool QgsLayoutManager::readXml( const QDomElement &element, const QDomDocument & clear(); QDomElement layoutsElem = element; - if ( element.tagName() != QStringLiteral( "Layouts" ) ) + if ( element.tagName() != QLatin1String( "Layouts" ) ) { layoutsElem = element.firstChildElement( QStringLiteral( "Layouts" ) ); } @@ -203,7 +203,7 @@ bool QgsLayoutManager::readXml( const QDomElement &element, const QDomDocument & const QDomNodeList layoutNodes = layoutsElem.childNodes(); for ( int i = 0; i < layoutNodes.size(); ++i ) { - if ( layoutNodes.at( i ).nodeName() != QStringLiteral( "Layout" ) ) + if ( layoutNodes.at( i ).nodeName() != QLatin1String( "Layout" ) ) continue; const QString layoutName = layoutNodes.at( i ).toElement().attribute( QStringLiteral( "name" ) ); diff --git a/src/core/layout/qgslayoutmultiframe.cpp b/src/core/layout/qgslayoutmultiframe.cpp index 0f9c56ca881e..f3d544e03e46 100644 --- a/src/core/layout/qgslayoutmultiframe.cpp +++ b/src/core/layout/qgslayoutmultiframe.cpp @@ -513,7 +513,7 @@ bool QgsLayoutMultiFrame::writeXml( QDomElement &parentElement, QDomDocument &do bool QgsLayoutMultiFrame::readXml( const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context, bool includeFrames ) { - if ( element.nodeName() != QStringLiteral( "LayoutMultiFrame" ) ) + if ( element.nodeName() != QLatin1String( "LayoutMultiFrame" ) ) { return false; } diff --git a/src/core/layout/qgslayoutpagecollection.cpp b/src/core/layout/qgslayoutpagecollection.cpp index eed55b6c760b..35e289fcb710 100644 --- a/src/core/layout/qgslayoutpagecollection.cpp +++ b/src/core/layout/qgslayoutpagecollection.cpp @@ -374,12 +374,12 @@ bool QgsLayoutPageCollection::writeXml( QDomElement &parentElement, QDomDocument bool QgsLayoutPageCollection::readXml( const QDomElement &e, const QDomDocument &document, const QgsReadWriteContext &context ) { QDomElement element = e; - if ( element.nodeName() != QStringLiteral( "PageCollection" ) ) + if ( element.nodeName() != QLatin1String( "PageCollection" ) ) { element = element.firstChildElement( QStringLiteral( "PageCollection" ) ); } - if ( element.nodeName() != QStringLiteral( "PageCollection" ) ) + if ( element.nodeName() != QLatin1String( "PageCollection" ) ) { return false; } diff --git a/src/core/layout/qgslayoutsnapper.cpp b/src/core/layout/qgslayoutsnapper.cpp index 68f52039b729..0845305520ab 100644 --- a/src/core/layout/qgslayoutsnapper.cpp +++ b/src/core/layout/qgslayoutsnapper.cpp @@ -434,12 +434,12 @@ bool QgsLayoutSnapper::writeXml( QDomElement &parentElement, QDomDocument &docum bool QgsLayoutSnapper::readXml( const QDomElement &e, const QDomDocument &, const QgsReadWriteContext & ) { QDomElement element = e; - if ( element.nodeName() != QStringLiteral( "Snapper" ) ) + if ( element.nodeName() != QLatin1String( "Snapper" ) ) { element = element.firstChildElement( QStringLiteral( "Snapper" ) ); } - if ( element.nodeName() != QStringLiteral( "Snapper" ) ) + if ( element.nodeName() != QLatin1String( "Snapper" ) ) { return false; } diff --git a/src/core/layout/qgsreportsectionfieldgroup.cpp b/src/core/layout/qgsreportsectionfieldgroup.cpp index adcfcf7d71c3..74f0248f2f6c 100644 --- a/src/core/layout/qgsreportsectionfieldgroup.cpp +++ b/src/core/layout/qgsreportsectionfieldgroup.cpp @@ -254,7 +254,7 @@ QgsFeatureRequest QgsReportSectionFieldGroup::buildFeatureRequest() const } if ( !filterParts.empty() ) { - QString filterString = QStringLiteral( "(%1)" ).arg( filterParts.join( QStringLiteral( ") AND (" ) ) ); + QString filterString = QStringLiteral( "(%1)" ).arg( filterParts.join( QLatin1String( ") AND (" ) ) ); request.setFilterExpression( filterString ); } diff --git a/src/core/mesh/qgsmeshdatasetgroupstore.cpp b/src/core/mesh/qgsmeshdatasetgroupstore.cpp index d41e327796a0..70ca03bc7a07 100644 --- a/src/core/mesh/qgsmeshdatasetgroupstore.cpp +++ b/src/core/mesh/qgsmeshdatasetgroupstore.cpp @@ -285,12 +285,12 @@ void QgsMeshDatasetGroupStore::readXml( const QDomElement &storeElem, const QgsR int globalIndex = datasetElem.attribute( QStringLiteral( "global-index" ) ).toInt(); int sourceIndex; QgsMeshDatasetSourceInterface *source = nullptr; - if ( datasetElem.attribute( QStringLiteral( "source-type" ) ) == QStringLiteral( "persitent-provider" ) ) + if ( datasetElem.attribute( QStringLiteral( "source-type" ) ) == QLatin1String( "persitent-provider" ) ) { source = mPersistentProvider; sourceIndex = datasetElem.attribute( QStringLiteral( "source-index" ) ).toInt(); } - else if ( datasetElem.attribute( QStringLiteral( "source-type" ) ) == QStringLiteral( "virtual" ) ) + else if ( datasetElem.attribute( QStringLiteral( "source-type" ) ) == QLatin1String( "virtual" ) ) { source = mExtraDatasets.get(); QString name = datasetElem.attribute( QStringLiteral( "name" ) ); diff --git a/src/core/mesh/qgsmeshlayer.cpp b/src/core/mesh/qgsmeshlayer.cpp index b6a207ea7927..962b3a79bdad 100644 --- a/src/core/mesh/qgsmeshlayer.cpp +++ b/src/core/mesh/qgsmeshlayer.cpp @@ -1278,7 +1278,7 @@ bool QgsMeshLayer::setDataProvider( QString const &provider, const QgsDataProvid setCrs( mDataProvider->crs() ); - if ( provider == QStringLiteral( "mesh_memory" ) ) + if ( provider == QLatin1String( "mesh_memory" ) ) { // required so that source differs between memory layers mDataSource = mDataSource + QStringLiteral( "&uid=%1" ).arg( QUuid::createUuid().toString() ); diff --git a/src/core/mesh/qgsmeshlayerutils.cpp b/src/core/mesh/qgsmeshlayerutils.cpp index f9a759bdfa99..46134c94be85 100644 --- a/src/core/mesh/qgsmeshlayerutils.cpp +++ b/src/core/mesh/qgsmeshlayerutils.cpp @@ -511,7 +511,7 @@ QString QgsMeshLayerUtils::formatTime( double hours, const QDateTime &referenceT format = format.trimmed(); int totalHours = static_cast( hours ); - if ( format == QStringLiteral( "hh:mm:ss.zzz" ) ) + if ( format == QLatin1String( "hh:mm:ss.zzz" ) ) { int ms = static_cast( hours * 3600.0 * 1000 ); int seconds = ms / 1000; @@ -526,7 +526,7 @@ QString QgsMeshLayerUtils::formatTime( double hours, const QDateTime &referenceT arg( s, 2, 10, QLatin1Char( '0' ) ). arg( z, 3, 10, QLatin1Char( '0' ) ); } - else if ( format == QStringLiteral( "hh:mm:ss" ) ) + else if ( format == QLatin1String( "hh:mm:ss" ) ) { int seconds = static_cast( hours * 3600.0 ); int m = seconds / 60; @@ -539,7 +539,7 @@ QString QgsMeshLayerUtils::formatTime( double hours, const QDateTime &referenceT arg( s, 2, 10, QLatin1Char( '0' ) ); } - else if ( format == QStringLiteral( "d hh:mm:ss" ) ) + else if ( format == QLatin1String( "d hh:mm:ss" ) ) { int seconds = static_cast( hours * 3600.0 ); int m = seconds / 60; @@ -554,7 +554,7 @@ QString QgsMeshLayerUtils::formatTime( double hours, const QDateTime &referenceT arg( m, 2, 10, QLatin1Char( '0' ) ). arg( s, 2, 10, QLatin1Char( '0' ) ); } - else if ( format == QStringLiteral( "d hh" ) ) + else if ( format == QLatin1String( "d hh" ) ) { int d = totalHours / 24; int h = totalHours % 24; @@ -562,12 +562,12 @@ QString QgsMeshLayerUtils::formatTime( double hours, const QDateTime &referenceT arg( d ). arg( h ); } - else if ( format == QStringLiteral( "d" ) ) + else if ( format == QLatin1String( "d" ) ) { int d = totalHours / 24; ret = QString::number( d ); } - else if ( format == QStringLiteral( "ss" ) ) + else if ( format == QLatin1String( "ss" ) ) { int seconds = static_cast( hours * 3600.0 ); ret = QString::number( seconds ); diff --git a/src/core/metadata/qgslayermetadataformatter.cpp b/src/core/metadata/qgslayermetadataformatter.cpp index 06021e40bb37..9982c7de6d62 100644 --- a/src/core/metadata/qgslayermetadataformatter.cpp +++ b/src/core/metadata/qgslayermetadataformatter.cpp @@ -28,8 +28,8 @@ QString QgsLayerMetadataFormatter::accessSectionHtml() const { QString myMetadata = QStringLiteral( "\n" ); myMetadata += QStringLiteral( "\n" ); - myMetadata += QStringLiteral( "\n" ); - myMetadata += QStringLiteral( "\n" ); + myMetadata += QStringLiteral( "\n" ); + myMetadata += QStringLiteral( "\n" ); myMetadata += QStringLiteral( "\n" ); - myMetadata += QStringLiteral( "
    " ) + tr( "Fees" ) + QStringLiteral( "" ) + mMetadata.fees() + QStringLiteral( "
    " ) + tr( "Licenses" ) + QStringLiteral( "" ) + mMetadata.licenses().join( QStringLiteral( "
    " ) ) + QStringLiteral( "
    " ) + tr( "Rights" ) + QStringLiteral( "" ) + mMetadata.rights().join( QStringLiteral( "
    " ) ) + QStringLiteral( "
    " ) + tr( "Licenses" ) + QStringLiteral( "" ) + mMetadata.licenses().join( QLatin1String( "
    " ) ) + QStringLiteral( "
    " ) + tr( "Rights" ) + QStringLiteral( "" ) + mMetadata.rights().join( QLatin1String( "
    " ) ) + QStringLiteral( "
    " ) + tr( "Constraints" ) + QStringLiteral( "" ); const QList &constraints = mMetadata.constraints(); bool notFirstRow = false; @@ -37,14 +37,14 @@ QString QgsLayerMetadataFormatter::accessSectionHtml() const { if ( notFirstRow ) { - myMetadata += QStringLiteral( "
    " ); + myMetadata += QLatin1String( "
    " ); } myMetadata += QStringLiteral( "" ) + constraint.type + QStringLiteral( ": " ) + constraint.constraint; notFirstRow = true; } - mMetadata.rights().join( QStringLiteral( "
    " ) ); - myMetadata += QStringLiteral( "
    \n" ); + mMetadata.rights().join( QLatin1String( "
    " ) ); + myMetadata += QLatin1String( "\n" ); + myMetadata += QLatin1String( "\n" ); return myMetadata; } @@ -58,7 +58,7 @@ QString QgsLayerMetadataFormatter::contactsSectionHtml() const } else { - myMetadata += QStringLiteral( "\n" ); + myMetadata += QLatin1String( "
    \n" ); myMetadata += QLatin1String( "\n" ); int i = 1; for ( const QgsAbstractMetadataBase::Contact &contact : contacts ) @@ -139,7 +139,7 @@ QString QgsLayerMetadataFormatter::extentSectionHtml( const bool showSpatialExte myMetadata += tr( "Geographic" ); else myMetadata += tr( "Projected" ); - myMetadata += QStringLiteral( "
    " ); + myMetadata += QLatin1String( "
    " ); myMetadata += QStringLiteral( "" ) + tr( "X Minimum:" ) + QStringLiteral( " " ) + qgsDoubleToString( spatialExtent.bounds.xMinimum() ) + QStringLiteral( "
    " ); myMetadata += QStringLiteral( "" ) + tr( "Y Minimum:" ) + QStringLiteral( " " ) + qgsDoubleToString( spatialExtent.bounds.yMinimum() ) + QStringLiteral( "
    " ); myMetadata += QStringLiteral( "" ) + tr( "X Maximum:" ) + QStringLiteral( " " ) + qgsDoubleToString( spatialExtent.bounds.xMaximum() ) + QStringLiteral( "
    " ); @@ -201,14 +201,14 @@ QString QgsLayerMetadataFormatter::identificationSectionHtml() const myMetadata += QStringLiteral( "\n" ); // Categories - myMetadata += QStringLiteral( "\n" ); + myMetadata += QStringLiteral( "\n" ); // Keywords myMetadata += QStringLiteral( "
    " ) + tr( "ID" ) + QLatin1String( "" ) + tr( "Name" ) + QLatin1String( "" ) + tr( "Position" ) + QLatin1String( "" ) + tr( "Organization" ) + QLatin1String( "" ) + tr( "Role" ) + QLatin1String( "" ) + tr( "Email" ) + QLatin1String( "" ) + tr( "Voice" ) + QLatin1String( "" ) + tr( "Fax" ) + QLatin1String( "" ) + tr( "Addresses" ) + QLatin1String( "
    " ) + tr( "Abstract" ) + QStringLiteral( "" ) + mMetadata.abstract() + QStringLiteral( "
    " ) + tr( "Categories" ) + QStringLiteral( "" ) + mMetadata.categories().join( QStringLiteral( ", " ) ) + QStringLiteral( "
    " ) + tr( "Categories" ) + QStringLiteral( "" ) + mMetadata.categories().join( QLatin1String( ", " ) ) + QStringLiteral( "
    " ) + tr( "Keywords" ) + QStringLiteral( "\n" ); QMapIterator i( mMetadata.keywords() ); if ( i.hasNext() ) { - myMetadata += QStringLiteral( "\n" ); + myMetadata += QLatin1String( "
    \n" ); myMetadata += QLatin1String( "\n" ); int j = 1; while ( i.hasNext() ) @@ -217,7 +217,7 @@ QString QgsLayerMetadataFormatter::identificationSectionHtml() const QString rowClass; if ( j % 2 ) rowClass = QStringLiteral( "class=\"odd-row\"" ); - myMetadata += QLatin1String( "\n" ); + myMetadata += QLatin1String( "\n" ); j++; } myMetadata += QLatin1String( "
    " ) + tr( "Vocabulary" ) + QLatin1String( "" ) + tr( "Items" ) + QLatin1String( "
    " ) + i.key() + QLatin1String( "" ) + i.value().join( QStringLiteral( ", " ) ) + QLatin1String( "
    " ) + i.key() + QLatin1String( "" ) + i.value().join( QLatin1String( ", " ) ) + QLatin1String( "
    \n" ); // End keywords table @@ -237,7 +237,7 @@ QString QgsLayerMetadataFormatter::historySectionHtml() const } else { - myMetadata += QStringLiteral( "\n" ); + myMetadata += QLatin1String( "
    \n" ); myMetadata += QLatin1String( "\n" ); int i = 1; for ( const QString &history : historyItems ) @@ -263,7 +263,7 @@ QString QgsLayerMetadataFormatter::linksSectionHtml() const } else { - myMetadata += QStringLiteral( "
    " ) + tr( "ID" ) + QLatin1String( "" ) + tr( "Action" ) + QLatin1String( "
    \n" ); + myMetadata += QLatin1String( "
    \n" ); myMetadata += QLatin1String( "\n" ); int i = 1; for ( const QgsAbstractMetadataBase::Link &link : links ) diff --git a/src/core/processing/models/qgsprocessingmodelalgorithm.cpp b/src/core/processing/models/qgsprocessingmodelalgorithm.cpp index a13ec12ec450..eb6a085ee5ba 100644 --- a/src/core/processing/models/qgsprocessingmodelalgorithm.cpp +++ b/src/core/processing/models/qgsprocessingmodelalgorithm.cpp @@ -277,7 +277,7 @@ QVariantMap QgsProcessingModelAlgorithm::processAlgorithm( const QVariantMap &pa } if ( !broken.empty() ) - throw QgsProcessingException( QCoreApplication::translate( "QgsProcessingModelAlgorithm", "Cannot run model, the following algorithms are not available on this system: %1" ).arg( broken.values().join( QStringLiteral( ", " ) ) ) ); + throw QgsProcessingException( QCoreApplication::translate( "QgsProcessingModelAlgorithm", "Cannot run model, the following algorithms are not available on this system: %1" ).arg( broken.values().join( QLatin1String( ", " ) ) ) ); QElapsedTimer totalTime; totalTime.start(); @@ -347,7 +347,7 @@ QVariantMap QgsProcessingModelAlgorithm::processAlgorithm( const QVariantMap &pa if ( feedback && !skipGenericLogging ) { feedback->pushInfo( QObject::tr( "Input Parameters:" ) ); - feedback->pushCommandInfo( QStringLiteral( "{ %1 }" ).arg( params.join( QStringLiteral( ", " ) ) ) ); + feedback->pushCommandInfo( QStringLiteral( "{ %1 }" ).arg( params.join( QLatin1String( ", " ) ) ) ); } QElapsedTimer childTime; diff --git a/src/core/processing/models/qgsprocessingmodeloutput.cpp b/src/core/processing/models/qgsprocessingmodeloutput.cpp index 18bddc85f357..419d6d5331c7 100644 --- a/src/core/processing/models/qgsprocessingmodeloutput.cpp +++ b/src/core/processing/models/qgsprocessingmodeloutput.cpp @@ -60,7 +60,7 @@ bool QgsProcessingModelOutput::loadVariant( const QVariantMap &map ) if ( defaultValue.type() == QVariant::Map ) { QVariantMap defaultMap = defaultValue.toMap(); - if ( defaultMap["class"] == QStringLiteral( "QgsProcessingOutputLayerDefinition" ) ) + if ( defaultMap["class"] == QLatin1String( "QgsProcessingOutputLayerDefinition" ) ) { QgsProcessingOutputLayerDefinition value; value.loadVariant( defaultMap ); diff --git a/src/core/processing/qgsprocessingalgorithm.cpp b/src/core/processing/qgsprocessingalgorithm.cpp index e3b56b7acd08..550b1bfa5cde 100644 --- a/src/core/processing/qgsprocessingalgorithm.cpp +++ b/src/core/processing/qgsprocessingalgorithm.cpp @@ -434,7 +434,7 @@ bool QgsProcessingAlgorithm::hasHtmlOutputs() const { for ( const QgsProcessingOutputDefinition *def : mOutputs ) { - if ( def->type() == QStringLiteral( "outputHtml" ) ) + if ( def->type() == QLatin1String( "outputHtml" ) ) return true; } return false; @@ -1071,7 +1071,7 @@ void QgsProcessingFeatureBasedAlgorithm::prepareSource( const QVariantMap ¶m QgsProcessingAlgorithm::VectorProperties QgsProcessingFeatureBasedAlgorithm::sinkProperties( const QString &sink, const QVariantMap ¶meters, QgsProcessingContext &context, const QMap &sourceProperties ) const { QgsProcessingAlgorithm::VectorProperties result; - if ( sink == QStringLiteral( "OUTPUT" ) ) + if ( sink == QLatin1String( "OUTPUT" ) ) { if ( sourceProperties.value( QStringLiteral( "INPUT" ) ).availability == QgsProcessingAlgorithm::Available ) { diff --git a/src/core/processing/qgsprocessingfeedback.cpp b/src/core/processing/qgsprocessingfeedback.cpp index de92034864ca..696182b4cdf2 100644 --- a/src/core/processing/qgsprocessingfeedback.cpp +++ b/src/core/processing/qgsprocessingfeedback.cpp @@ -41,7 +41,7 @@ void QgsProcessingFeedback::reportError( const QString &error, bool ) if ( mLogFeedback ) QgsMessageLog::logMessage( error, tr( "Processing" ), Qgis::Critical ); - mHtmlLog.append( QStringLiteral( "%1
    " ).arg( error.toHtmlEscaped() ).replace( '\n', QStringLiteral( "
    " ) ) ); + mHtmlLog.append( QStringLiteral( "%1
    " ).arg( error.toHtmlEscaped() ).replace( '\n', QLatin1String( "
    " ) ) ); mTextLog.append( error + '\n' ); } @@ -50,7 +50,7 @@ void QgsProcessingFeedback::pushInfo( const QString &info ) if ( mLogFeedback ) QgsMessageLog::logMessage( info, tr( "Processing" ), Qgis::Info ); - mHtmlLog.append( info.toHtmlEscaped().replace( '\n', QStringLiteral( "
    " ) ) + QStringLiteral( "
    " ) ); + mHtmlLog.append( info.toHtmlEscaped().replace( '\n', QLatin1String( "
    " ) ) + QStringLiteral( "
    " ) ); mTextLog.append( info + '\n' ); } @@ -59,7 +59,7 @@ void QgsProcessingFeedback::pushCommandInfo( const QString &info ) if ( mLogFeedback ) QgsMessageLog::logMessage( info, tr( "Processing" ), Qgis::Info ); - mHtmlLog.append( QStringLiteral( "%1
    " ).arg( info.toHtmlEscaped().replace( '\n', QStringLiteral( "
    " ) ) ) ); + mHtmlLog.append( QStringLiteral( "%1
    " ).arg( info.toHtmlEscaped().replace( '\n', QLatin1String( "
    " ) ) ) ); mTextLog.append( info + '\n' ); } @@ -68,7 +68,7 @@ void QgsProcessingFeedback::pushDebugInfo( const QString &info ) if ( mLogFeedback ) QgsMessageLog::logMessage( info, tr( "Processing" ), Qgis::Info ); - mHtmlLog.append( QStringLiteral( "%1
    " ).arg( info.toHtmlEscaped().replace( '\n', QStringLiteral( "
    " ) ) ) ); + mHtmlLog.append( QStringLiteral( "%1
    " ).arg( info.toHtmlEscaped().replace( '\n', QLatin1String( "
    " ) ) ) ); mTextLog.append( info + '\n' ); } @@ -77,7 +77,7 @@ void QgsProcessingFeedback::pushConsoleInfo( const QString &info ) if ( mLogFeedback ) QgsMessageLog::logMessage( info, tr( "Processing" ), Qgis::Info ); - mHtmlLog.append( QStringLiteral( "%1
    " ).arg( info.toHtmlEscaped().replace( '\n', QStringLiteral( "
    " ) ) ) ); + mHtmlLog.append( QStringLiteral( "%1
    " ).arg( info.toHtmlEscaped().replace( '\n', QLatin1String( "
    " ) ) ) ); mTextLog.append( info + '\n' ); } diff --git a/src/core/processing/qgsprocessingparameteraggregate.cpp b/src/core/processing/qgsprocessingparameteraggregate.cpp index 4b303d30e521..c24ab2e3a66d 100644 --- a/src/core/processing/qgsprocessingparameteraggregate.cpp +++ b/src/core/processing/qgsprocessingparameteraggregate.cpp @@ -79,7 +79,7 @@ QString QgsProcessingParameterAggregate::asPythonString( QgsProcessing::PythonOu code += QStringLiteral( ", parentLayerParameterName=%1" ).arg( QgsProcessingUtils::stringToPythonLiteral( mParentLayerParameterName ) ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += ')'; return code; } diff --git a/src/core/processing/qgsprocessingparameterfieldmap.cpp b/src/core/processing/qgsprocessingparameterfieldmap.cpp index 19e550391a73..891777bd1f8f 100644 --- a/src/core/processing/qgsprocessingparameterfieldmap.cpp +++ b/src/core/processing/qgsprocessingparameterfieldmap.cpp @@ -77,7 +77,7 @@ QString QgsProcessingParameterFieldMapping::asPythonString( QgsProcessing::Pytho code += QStringLiteral( ", parentLayerParameterName=%1" ).arg( QgsProcessingUtils::stringToPythonLiteral( mParentLayerParameterName ) ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += ')'; return code; } diff --git a/src/core/processing/qgsprocessingparameters.cpp b/src/core/processing/qgsprocessingparameters.cpp index 92916d968981..4a41171de55f 100644 --- a/src/core/processing/qgsprocessingparameters.cpp +++ b/src/core/processing/qgsprocessingparameters.cpp @@ -2169,81 +2169,81 @@ QgsProcessingParameterDefinition *QgsProcessingParameters::parameterFromScriptCo QString description = descriptionFromName( name ); - if ( type == QStringLiteral( "boolean" ) ) + if ( type == QLatin1String( "boolean" ) ) return QgsProcessingParameterBoolean::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "crs" ) ) + else if ( type == QLatin1String( "crs" ) ) return QgsProcessingParameterCrs::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "layer" ) ) + else if ( type == QLatin1String( "layer" ) ) return QgsProcessingParameterMapLayer::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "extent" ) ) + else if ( type == QLatin1String( "extent" ) ) return QgsProcessingParameterExtent::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "point" ) ) + else if ( type == QLatin1String( "point" ) ) return QgsProcessingParameterPoint::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "geometry" ) ) + else if ( type == QLatin1String( "geometry" ) ) return QgsProcessingParameterGeometry::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "file" ) ) + else if ( type == QLatin1String( "file" ) ) return QgsProcessingParameterFile::fromScriptCode( name, description, isOptional, definition, QgsProcessingParameterFile::File ); - else if ( type == QStringLiteral( "folder" ) ) + else if ( type == QLatin1String( "folder" ) ) return QgsProcessingParameterFile::fromScriptCode( name, description, isOptional, definition, QgsProcessingParameterFile::Folder ); - else if ( type == QStringLiteral( "matrix" ) ) + else if ( type == QLatin1String( "matrix" ) ) return QgsProcessingParameterMatrix::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "multiple" ) ) + else if ( type == QLatin1String( "multiple" ) ) return QgsProcessingParameterMultipleLayers::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "number" ) ) + else if ( type == QLatin1String( "number" ) ) return QgsProcessingParameterNumber::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "distance" ) ) + else if ( type == QLatin1String( "distance" ) ) return QgsProcessingParameterDistance::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "scale" ) ) + else if ( type == QLatin1String( "scale" ) ) return QgsProcessingParameterScale::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "range" ) ) + else if ( type == QLatin1String( "range" ) ) return QgsProcessingParameterRange::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "raster" ) ) + else if ( type == QLatin1String( "raster" ) ) return QgsProcessingParameterRasterLayer::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "enum" ) ) + else if ( type == QLatin1String( "enum" ) ) return QgsProcessingParameterEnum::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "string" ) ) + else if ( type == QLatin1String( "string" ) ) return QgsProcessingParameterString::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "authcfg" ) ) + else if ( type == QLatin1String( "authcfg" ) ) return QgsProcessingParameterAuthConfig::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "expression" ) ) + else if ( type == QLatin1String( "expression" ) ) return QgsProcessingParameterExpression::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "field" ) ) + else if ( type == QLatin1String( "field" ) ) return QgsProcessingParameterField::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "vector" ) ) + else if ( type == QLatin1String( "vector" ) ) return QgsProcessingParameterVectorLayer::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "source" ) ) + else if ( type == QLatin1String( "source" ) ) return QgsProcessingParameterFeatureSource::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "sink" ) ) + else if ( type == QLatin1String( "sink" ) ) return QgsProcessingParameterFeatureSink::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "vectordestination" ) ) + else if ( type == QLatin1String( "vectordestination" ) ) return QgsProcessingParameterVectorDestination::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "rasterdestination" ) ) + else if ( type == QLatin1String( "rasterdestination" ) ) return QgsProcessingParameterRasterDestination::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "filedestination" ) ) + else if ( type == QLatin1String( "filedestination" ) ) return QgsProcessingParameterFileDestination::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "folderdestination" ) ) + else if ( type == QLatin1String( "folderdestination" ) ) return QgsProcessingParameterFolderDestination::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "band" ) ) + else if ( type == QLatin1String( "band" ) ) return QgsProcessingParameterBand::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "mesh" ) ) + else if ( type == QLatin1String( "mesh" ) ) return QgsProcessingParameterMeshLayer::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "layout" ) ) + else if ( type == QLatin1String( "layout" ) ) return QgsProcessingParameterLayout::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "layoutitem" ) ) + else if ( type == QLatin1String( "layoutitem" ) ) return QgsProcessingParameterLayoutItem::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "color" ) ) + else if ( type == QLatin1String( "color" ) ) return QgsProcessingParameterColor::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "coordinateoperation" ) ) + else if ( type == QLatin1String( "coordinateoperation" ) ) return QgsProcessingParameterCoordinateOperation::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "maptheme" ) ) + else if ( type == QLatin1String( "maptheme" ) ) return QgsProcessingParameterMapTheme::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "datetime" ) ) + else if ( type == QLatin1String( "datetime" ) ) return QgsProcessingParameterDateTime::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "providerconnection" ) ) + else if ( type == QLatin1String( "providerconnection" ) ) return QgsProcessingParameterProviderConnection::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "databaseschema" ) ) + else if ( type == QLatin1String( "databaseschema" ) ) return QgsProcessingParameterDatabaseSchema::fromScriptCode( name, description, isOptional, definition ); - else if ( type == QStringLiteral( "databasetable" ) ) + else if ( type == QLatin1String( "databasetable" ) ) return QgsProcessingParameterDatabaseTable::fromScriptCode( name, description, isOptional, definition ); return nullptr; @@ -2324,7 +2324,7 @@ QString QgsProcessingParameterDefinition::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); + code += QLatin1String( "optional " ); code += type() + ' '; code += mDefault.toString(); return code.trimmed(); @@ -2341,7 +2341,7 @@ QString QgsProcessingParameterDefinition::asPythonString( const QgsProcessing::P { QString code = t->className() + QStringLiteral( "('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); QgsProcessingContext c; code += QStringLiteral( ", defaultValue=%1)" ).arg( valueAsPythonString( mDefault, c ) ); @@ -2422,7 +2422,7 @@ QString QgsProcessingParameterBoolean::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); + code += QLatin1String( "optional " ); code += type() + ' '; code += mDefault.toBool() ? QStringLiteral( "true" ) : QStringLiteral( "false" ); return code.trimmed(); @@ -2583,7 +2583,7 @@ QString createAllMapLayerFileFilter() vectors.removeAll( QObject::tr( "All files (*.*)" ) ); std::sort( vectors.begin(), vectors.end() ); - return QObject::tr( "All files (*.*)" ) + QStringLiteral( ";;" ) + vectors.join( QStringLiteral( ";;" ) ); + return QObject::tr( "All files (*.*)" ) + QStringLiteral( ";;" ) + vectors.join( QLatin1String( ";;" ) ); } QString QgsProcessingParameterMapLayer::createFileFilter() const @@ -2595,35 +2595,35 @@ QString QgsProcessingParameterMapLayer::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "layer " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "layer " ); for ( int type : mDataTypes ) { switch ( type ) { case QgsProcessing::TypeVectorAnyGeometry: - code += QStringLiteral( "hasgeometry " ); + code += QLatin1String( "hasgeometry " ); break; case QgsProcessing::TypeVectorPoint: - code += QStringLiteral( "point " ); + code += QLatin1String( "point " ); break; case QgsProcessing::TypeVectorLine: - code += QStringLiteral( "line " ); + code += QLatin1String( "line " ); break; case QgsProcessing::TypeVectorPolygon: - code += QStringLiteral( "polygon " ); + code += QLatin1String( "polygon " ); break; case QgsProcessing::TypeRaster: - code += QStringLiteral( "raster " ); + code += QLatin1String( "raster " ); break; case QgsProcessing::TypeMesh: - code += QStringLiteral( "mesh " ); + code += QLatin1String( "mesh " ); break; } } @@ -2688,7 +2688,7 @@ QString QgsProcessingParameterMapLayer::asPythonString( const QgsProcessing::Pyt { QString code = QStringLiteral( "QgsProcessingParameterMapLayer('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); QgsProcessingContext c; code += QStringLiteral( ", defaultValue=%1" ).arg( valueAsPythonString( mDefault, c ) ); @@ -2703,7 +2703,7 @@ QString QgsProcessingParameterMapLayer::asPythonString( const QgsProcessing::Pyt } else { - code += QStringLiteral( ")" ); + code += QLatin1Char( ')' ); } return code; @@ -3101,7 +3101,7 @@ QString QgsProcessingParameterGeometry::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); + code += QLatin1String( "optional " ); code += type() + ' '; for ( int type : mGeomTypes ) @@ -3109,19 +3109,19 @@ QString QgsProcessingParameterGeometry::asScriptCode() const switch ( static_cast( type ) ) { case QgsWkbTypes::PointGeometry: - code += QStringLiteral( "point " ); + code += QLatin1String( "point " ); break; case QgsWkbTypes::LineGeometry: - code += QStringLiteral( "line " ); + code += QLatin1String( "line " ); break; case QgsWkbTypes::PolygonGeometry: - code += QStringLiteral( "polygon " ); + code += QLatin1String( "polygon " ); break; default: - code += QStringLiteral( "unknown" ); + code += QLatin1String( "unknown" ); break; } } @@ -3138,7 +3138,7 @@ QString QgsProcessingParameterGeometry::asPythonString( const QgsProcessing::Pyt { QString code = QStringLiteral( "QgsProcessingParameterGeometry('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); if ( !mGeomTypes.empty() ) { @@ -3268,7 +3268,7 @@ QString QgsProcessingParameterFile::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); + code += QLatin1String( "optional " ); code += ( mBehavior == File ? QStringLiteral( "file" ) : QStringLiteral( "folder" ) ) + ' '; code += mDefault.toString(); return code.trimmed(); @@ -3283,7 +3283,7 @@ QString QgsProcessingParameterFile::asPythonString( const QgsProcessing::PythonO QString code = QStringLiteral( "QgsProcessingParameterFile('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += QStringLiteral( ", behavior=%1" ).arg( mBehavior == File ? QStringLiteral( "QgsProcessingParameterFile.File" ) : QStringLiteral( "QgsProcessingParameterFile.Folder" ) ); if ( !mExtension.isEmpty() ) code += QStringLiteral( ", extension='%1'" ).arg( mExtension ); @@ -3429,7 +3429,7 @@ QString QgsProcessingParameterMatrix::asPythonString( const QgsProcessing::Pytho { QString code = QStringLiteral( "QgsProcessingParameterMatrix('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += QStringLiteral( ", numberRows=" ).arg( mNumberRows ); code += QStringLiteral( ", hasFixedNumberRows=" ).arg( mFixedNumberRows ? QStringLiteral( "True" ) : QStringLiteral( "False" ) ); @@ -3643,19 +3643,19 @@ QString QgsProcessingParameterMultipleLayers::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); + code += QLatin1String( "optional " ); switch ( mLayerType ) { case QgsProcessing::TypeRaster: - code += QStringLiteral( "multiple raster" ); + code += QLatin1String( "multiple raster" ); break; case QgsProcessing::TypeFile: - code += QStringLiteral( "multiple file" ); + code += QLatin1String( "multiple file" ); break; default: - code += QStringLiteral( "multiple vector" ); + code += QLatin1String( "multiple vector" ); break; } code += ' '; @@ -3688,7 +3688,7 @@ QString QgsProcessingParameterMultipleLayers::asPythonString( const QgsProcessin { QString code = QStringLiteral( "QgsProcessingParameterMultipleLayers('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); QString layerType = QStringLiteral( "QgsProcessing.%1" ).arg( QgsProcessing::sourceTypeToString( mLayerType ) ); @@ -3777,11 +3777,11 @@ QgsProcessingParameterMultipleLayers *QgsProcessingParameterMultipleLayers::from defaultVal = m.captured( 2 ); } QgsProcessing::SourceType layerType = QgsProcessing::TypeVectorAnyGeometry; - if ( type == QStringLiteral( "vector" ) ) + if ( type == QLatin1String( "vector" ) ) layerType = QgsProcessing::TypeVectorAnyGeometry; - else if ( type == QStringLiteral( "raster" ) ) + else if ( type == QLatin1String( "raster" ) ) layerType = QgsProcessing::TypeRaster; - else if ( type == QStringLiteral( "file" ) ) + else if ( type == QLatin1String( "file" ) ) layerType = QgsProcessing::TypeFile; return new QgsProcessingParameterMultipleLayers( name, description, layerType, defaultVal.isEmpty() ? QVariant() : defaultVal, isOptional ); } @@ -3848,7 +3848,7 @@ QString QgsProcessingParameterNumber::toolTip() const parts << QObject::tr( "Maximum value: %1" ).arg( mMax ); if ( mDefault.isValid() ) parts << QObject::tr( "Default value: %1" ).arg( mDataType == Integer ? mDefault.toInt() : mDefault.toDouble() ); - QString extra = parts.join( QStringLiteral( "
    " ) ); + QString extra = parts.join( QLatin1String( "
    " ) ); if ( !extra.isEmpty() ) text += QStringLiteral( "

    %1

    " ).arg( extra ); return text; @@ -3862,7 +3862,7 @@ QString QgsProcessingParameterNumber::asPythonString( const QgsProcessing::Pytho { QString code = QStringLiteral( "QgsProcessingParameterNumber('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += QStringLiteral( ", type=%1" ).arg( mDataType == Integer ? QStringLiteral( "QgsProcessingParameterNumber.Integer" ) : QStringLiteral( "QgsProcessingParameterNumber.Double" ) ); @@ -3929,7 +3929,7 @@ bool QgsProcessingParameterNumber::fromVariantMap( const QVariantMap &map ) QgsProcessingParameterNumber *QgsProcessingParameterNumber::fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) { return new QgsProcessingParameterNumber( name, description, Double, definition.isEmpty() ? QVariant() - : ( definition.toLower().trimmed() == QStringLiteral( "none" ) ? QVariant() : definition ), isOptional ); + : ( definition.toLower().trimmed() == QLatin1String( "none" ) ? QVariant() : definition ), isOptional ); } QgsProcessingParameterRange::QgsProcessingParameterRange( const QString &name, const QString &description, QgsProcessingParameterNumber::Type type, const QVariant &defaultValue, bool optional ) @@ -4013,7 +4013,7 @@ QString QgsProcessingParameterRange::asPythonString( const QgsProcessing::Python { QString code = QStringLiteral( "QgsProcessingParameterRange('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += QStringLiteral( ", type=%1" ).arg( mDataType == QgsProcessingParameterNumber::Integer ? QStringLiteral( "QgsProcessingParameterNumber.Integer" ) : QStringLiteral( "QgsProcessingParameterNumber.Double" ) ); @@ -4052,7 +4052,7 @@ bool QgsProcessingParameterRange::fromVariantMap( const QVariantMap &map ) QgsProcessingParameterRange *QgsProcessingParameterRange::fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) { return new QgsProcessingParameterRange( name, description, QgsProcessingParameterNumber::Double, definition.isEmpty() ? QVariant() - : ( definition.toLower().trimmed() == QStringLiteral( "none" ) ? QVariant() : definition ), isOptional ); + : ( definition.toLower().trimmed() == QLatin1String( "none" ) ? QVariant() : definition ), isOptional ); } QgsProcessingParameterRasterLayer::QgsProcessingParameterRasterLayer( const QString &name, const QString &description, const QVariant &defaultValue, bool optional ) @@ -4234,11 +4234,11 @@ QString QgsProcessingParameterEnum::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "enum " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "enum " ); if ( mAllowMultiple ) - code += QStringLiteral( "multiple " ); + code += QLatin1String( "multiple " ); code += mOptions.join( ';' ) + ' '; @@ -4254,7 +4254,7 @@ QString QgsProcessingParameterEnum::asPythonString( const QgsProcessing::PythonO { QString code = QStringLiteral( "QgsProcessingParameterEnum('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); QStringList options; options.reserve( mOptions.size() ); @@ -4359,11 +4359,11 @@ QString QgsProcessingParameterString::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "string " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "string " ); if ( mMultiLine ) - code += QStringLiteral( "long " ); + code += QLatin1String( "long " ); code += mDefault.toString(); return code.trimmed(); @@ -4377,7 +4377,7 @@ QString QgsProcessingParameterString::asPythonString( const QgsProcessing::Pytho { QString code = QStringLiteral( "QgsProcessingParameterString('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += QStringLiteral( ", multiLine=%1" ).arg( mMultiLine ? QStringLiteral( "True" ) : QStringLiteral( "False" ) ); QgsProcessingContext c; @@ -4428,7 +4428,7 @@ QgsProcessingParameterString *QgsProcessingParameterString::fromScriptCode( cons def.chop( 1 ); QVariant defaultValue = def; - if ( def == QStringLiteral( "None" ) ) + if ( def == QLatin1String( "None" ) ) defaultValue = QVariant(); return new QgsProcessingParameterString( name, description, defaultValue, multiLine, isOptional ); @@ -4462,8 +4462,8 @@ QString QgsProcessingParameterAuthConfig::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "authcfg " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "authcfg " ); code += mDefault.toString(); return code.trimmed(); @@ -4479,7 +4479,7 @@ QgsProcessingParameterAuthConfig *QgsProcessingParameterAuthConfig::fromScriptCo def.chop( 1 ); QVariant defaultValue = def; - if ( def == QStringLiteral( "None" ) ) + if ( def == QLatin1String( "None" ) ) defaultValue = QVariant(); return new QgsProcessingParameterAuthConfig( name, description, defaultValue, isOptional ); @@ -4530,7 +4530,7 @@ QString QgsProcessingParameterExpression::asPythonString( const QgsProcessing::P { QString code = QStringLiteral( "QgsProcessingParameterExpression('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += QStringLiteral( ", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName ); @@ -4645,7 +4645,7 @@ QString QgsProcessingParameterVectorLayer::asPythonString( const QgsProcessing:: { QString code = QStringLiteral( "QgsProcessingParameterVectorLayer('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); if ( !mDataTypes.empty() ) { @@ -4872,21 +4872,21 @@ QString QgsProcessingParameterField::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "field " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "field " ); switch ( mDataType ) { case Numeric: - code += QStringLiteral( "numeric " ); + code += QLatin1String( "numeric " ); break; case String: - code += QStringLiteral( "string " ); + code += QLatin1String( "string " ); break; case DateTime: - code += QStringLiteral( "datetime " ); + code += QLatin1String( "datetime " ); break; case Any: @@ -4894,10 +4894,10 @@ QString QgsProcessingParameterField::asScriptCode() const } if ( mAllowMultiple ) - code += QStringLiteral( "multiple " ); + code += QLatin1String( "multiple " ); if ( mDefaultToAllFields ) - code += QStringLiteral( "default_to_all_fields " ); + code += QLatin1String( "default_to_all_fields " ); code += mParentLayerParameterName + ' '; @@ -4913,7 +4913,7 @@ QString QgsProcessingParameterField::asPythonString( const QgsProcessing::Python { QString code = QStringLiteral( "QgsProcessingParameterField('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); QString dataType; switch ( mDataType ) @@ -4942,7 +4942,7 @@ QString QgsProcessingParameterField::asPythonString( const QgsProcessing::Python code += QStringLiteral( ", defaultValue=%1" ).arg( valueAsPythonString( mDefault, c ) ); if ( mDefaultToAllFields ) - code += QStringLiteral( ", defaultToAllFields=True" ); + code += QLatin1String( ", defaultToAllFields=True" ); code += ')'; @@ -5169,7 +5169,7 @@ QString QgsProcessingParameterFeatureSource::valueAsPythonString( const QVariant if ( fromVar.flags & QgsProcessingFeatureSourceDefinition::Flag::FlagCreateIndividualOutputPerInputFeature ) flags << QStringLiteral( "QgsProcessingFeatureSourceDefinition.FlagCreateIndividualOutputPerInputFeature" ); if ( !flags.empty() ) - flagString = flags.join( QStringLiteral( " | " ) ); + flagString = flags.join( QLatin1String( " | " ) ); if ( fromVar.source.propertyType() == QgsProperty::StaticProperty ) { @@ -5226,23 +5226,23 @@ QString QgsProcessingParameterFeatureSource::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "source " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "source " ); for ( int type : mDataTypes ) { switch ( type ) { case QgsProcessing::TypeVectorPoint: - code += QStringLiteral( "point " ); + code += QLatin1String( "point " ); break; case QgsProcessing::TypeVectorLine: - code += QStringLiteral( "line " ); + code += QLatin1String( "line " ); break; case QgsProcessing::TypeVectorPolygon: - code += QStringLiteral( "polygon " ); + code += QLatin1String( "polygon " ); break; } @@ -5260,7 +5260,7 @@ QString QgsProcessingParameterFeatureSource::asPythonString( const QgsProcessing { QString code = QStringLiteral( "QgsProcessingParameterFeatureSource('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); if ( !mDataTypes.empty() ) { @@ -5418,25 +5418,25 @@ QString QgsProcessingParameterFeatureSink::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "sink " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "sink " ); switch ( mDataType ) { case QgsProcessing::TypeVectorPoint: - code += QStringLiteral( "point " ); + code += QLatin1String( "point " ); break; case QgsProcessing::TypeVectorLine: - code += QStringLiteral( "line " ); + code += QLatin1String( "line " ); break; case QgsProcessing::TypeVectorPolygon: - code += QStringLiteral( "polygon " ); + code += QLatin1String( "polygon " ); break; case QgsProcessing::TypeVector: - code += QStringLiteral( "table " ); + code += QLatin1String( "table " ); break; default: @@ -5483,13 +5483,13 @@ QString QgsProcessingParameterFeatureSink::asPythonString( const QgsProcessing:: { QString code = QStringLiteral( "QgsProcessingParameterFeatureSink('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += QStringLiteral( ", type=QgsProcessing.%1" ).arg( QgsProcessing::sourceTypeToString( mDataType ) ); code += QStringLiteral( ", createByDefault=%1" ).arg( createByDefault() ? QStringLiteral( "True" ) : QStringLiteral( "False" ) ); if ( mSupportsAppend ) - code += QStringLiteral( ", supportsAppend=True" ); + code += QLatin1String( ", supportsAppend=True" ); QgsProcessingContext c; code += QStringLiteral( ", defaultValue=%1)" ).arg( valueAsPythonString( mDefault, c ) ); @@ -5507,7 +5507,7 @@ QString QgsProcessingParameterFeatureSink::createFileFilter() const { filters << QObject::tr( "%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() ); } - return filters.join( QStringLiteral( ";;" ) ) + QStringLiteral( ";;" ) + QObject::tr( "All files (*.*)" ); + return filters.join( QLatin1String( ";;" ) ) + QStringLiteral( ";;" ) + QObject::tr( "All files (*.*)" ); } @@ -5722,7 +5722,7 @@ QString QgsProcessingParameterRasterDestination::createFileFilter() const { filters << QObject::tr( "%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() ); } - return filters.join( QStringLiteral( ";;" ) ) + QStringLiteral( ";;" ) + QObject::tr( "All files (*.*)" ); + return filters.join( QLatin1String( ";;" ) ) + QStringLiteral( ";;" ) + QObject::tr( "All files (*.*)" ); } QStringList QgsProcessingParameterRasterDestination::supportedOutputRasterLayerExtensions() const @@ -5853,7 +5853,7 @@ QString QgsProcessingParameterFileDestination::asPythonString( const QgsProcessi { QString code = QStringLiteral( "QgsProcessingParameterFileDestination('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += QStringLiteral( ", fileFilter=%1" ).arg( QgsProcessingUtils::stringToPythonLiteral( mFileFilter ) ); @@ -5988,7 +5988,7 @@ QString QgsProcessingDestinationParameter::asPythonString( const QgsProcessing:: { QString code = t->className() + QStringLiteral( "('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += QStringLiteral( ", createByDefault=%1" ).arg( mCreateByDefault ? QStringLiteral( "True" ) : QStringLiteral( "False" ) ); @@ -6120,21 +6120,21 @@ QString QgsProcessingParameterVectorDestination::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "vectorDestination " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "vectorDestination " ); switch ( mDataType ) { case QgsProcessing::TypeVectorPoint: - code += QStringLiteral( "point " ); + code += QLatin1String( "point " ); break; case QgsProcessing::TypeVectorLine: - code += QStringLiteral( "line " ); + code += QLatin1String( "line " ); break; case QgsProcessing::TypeVectorPolygon: - code += QStringLiteral( "polygon " ); + code += QLatin1String( "polygon " ); break; default: @@ -6181,7 +6181,7 @@ QString QgsProcessingParameterVectorDestination::asPythonString( const QgsProces { QString code = QStringLiteral( "QgsProcessingParameterVectorDestination('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += QStringLiteral( ", type=QgsProcessing.%1" ).arg( QgsProcessing::sourceTypeToString( mDataType ) ); @@ -6203,7 +6203,7 @@ QString QgsProcessingParameterVectorDestination::createFileFilter() const { filters << QObject::tr( "%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() ); } - return filters.join( QStringLiteral( ";;" ) ) + QStringLiteral( ";;" ) + QObject::tr( "All files (*.*)" ); + return filters.join( QLatin1String( ";;" ) ) + QStringLiteral( ";;" ) + QObject::tr( "All files (*.*)" ); } QStringList QgsProcessingParameterVectorDestination::supportedOutputVectorLayerExtensions() const @@ -6383,11 +6383,11 @@ QString QgsProcessingParameterBand::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "band " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "band " ); if ( mAllowMultiple ) - code += QStringLiteral( "multiple " ); + code += QLatin1String( "multiple " ); code += mParentLayerParameterName + ' '; @@ -6411,7 +6411,7 @@ QString QgsProcessingParameterBand::asPythonString( const QgsProcessing::PythonO { QString code = QStringLiteral( "QgsProcessingParameterBand('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += QStringLiteral( ", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName ); code += QStringLiteral( ", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral( "True" ) : QStringLiteral( "False" ) ); @@ -6515,7 +6515,7 @@ QString QgsProcessingParameterDistance::asPythonString( const QgsProcessing::Pyt { QString code = QStringLiteral( "QgsProcessingParameterDistance('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += QStringLiteral( ", parentParameterName='%1'" ).arg( mParentParameterName ); @@ -6586,7 +6586,7 @@ QString QgsProcessingParameterScale::asPythonString( const QgsProcessing::Python { QString code = QStringLiteral( "QgsProcessingParameterScale('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); QgsProcessingContext c; code += QStringLiteral( ", defaultValue=%1)" ).arg( valueAsPythonString( mDefault, c ) ); return code; @@ -6598,7 +6598,7 @@ QString QgsProcessingParameterScale::asPythonString( const QgsProcessing::Python QgsProcessingParameterScale *QgsProcessingParameterScale::fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) { return new QgsProcessingParameterScale( name, description, definition.isEmpty() ? QVariant() - : ( definition.toLower().trimmed() == QStringLiteral( "none" ) ? QVariant() : definition ), isOptional ); + : ( definition.toLower().trimmed() == QLatin1String( "none" ) ? QVariant() : definition ), isOptional ); } @@ -6631,8 +6631,8 @@ QString QgsProcessingParameterLayout::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "layout " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "layout " ); code += mDefault.toString(); return code.trimmed(); @@ -6646,7 +6646,7 @@ QString QgsProcessingParameterLayout::asPythonString( const QgsProcessing::Pytho { QString code = QStringLiteral( "QgsProcessingParameterLayout('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); QgsProcessingContext c; code += QStringLiteral( ", defaultValue=%1)" ).arg( valueAsPythonString( mDefault, c ) ); return code; @@ -6665,7 +6665,7 @@ QgsProcessingParameterLayout *QgsProcessingParameterLayout::fromScriptCode( cons def.chop( 1 ); QVariant defaultValue = def; - if ( def == QStringLiteral( "None" ) ) + if ( def == QLatin1String( "None" ) ) defaultValue = QVariant(); return new QgsProcessingParameterLayout( name, description, defaultValue, isOptional ); @@ -6705,8 +6705,8 @@ QString QgsProcessingParameterLayoutItem::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "layoutitem " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "layoutitem " ); if ( mItemType >= 0 ) code += QString::number( mItemType ) + ' '; @@ -6724,7 +6724,7 @@ QString QgsProcessingParameterLayoutItem::asPythonString( QgsProcessing::PythonO { QString code = QStringLiteral( "QgsProcessingParameterLayoutItem('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); if ( mItemType >= 0 ) code += QStringLiteral( ", itemType=%1" ).arg( mItemType ); @@ -6849,11 +6849,11 @@ QString QgsProcessingParameterColor::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "color " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "color " ); if ( mAllowOpacity ) - code += QStringLiteral( "withopacity " ); + code += QLatin1String( "withopacity " ); code += mDefault.toString(); return code.trimmed(); @@ -6867,7 +6867,7 @@ QString QgsProcessingParameterColor::asPythonString( const QgsProcessing::Python { QString code = QStringLiteral( "QgsProcessingParameterColor('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += QStringLiteral( ", opacityEnabled=%1" ).arg( mAllowOpacity ? QStringLiteral( "True" ) : QStringLiteral( "False" ) ); @@ -6944,7 +6944,7 @@ QgsProcessingParameterColor *QgsProcessingParameterColor::fromScriptCode( const def.chop( 1 ); QVariant defaultValue = def; - if ( def == QStringLiteral( "None" ) ) + if ( def == QLatin1String( "None" ) ) defaultValue = QVariant(); return new QgsProcessingParameterColor( name, description, defaultValue, allowOpacity, isOptional ); @@ -6998,8 +6998,8 @@ QString QgsProcessingParameterCoordinateOperation::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "coordinateoperation " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "coordinateoperation " ); code += mDefault.toString(); return code.trimmed(); @@ -7014,7 +7014,7 @@ QString QgsProcessingParameterCoordinateOperation::asPythonString( QgsProcessing QgsProcessingContext c; QString code = QStringLiteral( "QgsProcessingParameterCoordinateOperation('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); if ( !mSourceParameterName.isEmpty() ) code += QStringLiteral( ", sourceCrsParameterName=%1" ).arg( valueAsPythonString( mSourceParameterName, c ) ); if ( !mDestParameterName.isEmpty() ) @@ -7072,7 +7072,7 @@ QgsProcessingParameterCoordinateOperation *QgsProcessingParameterCoordinateOpera def.chop( 1 ); QVariant defaultValue = def; - if ( def == QStringLiteral( "None" ) ) + if ( def == QLatin1String( "None" ) ) defaultValue = QVariant(); return new QgsProcessingParameterCoordinateOperation( name, description, defaultValue, QString(), QString(), QVariant(), QVariant(), isOptional ); @@ -7122,8 +7122,8 @@ QString QgsProcessingParameterMapTheme::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "maptheme " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "maptheme " ); code += mDefault.toString(); return code.trimmed(); @@ -7137,7 +7137,7 @@ QString QgsProcessingParameterMapTheme::asPythonString( const QgsProcessing::Pyt { QString code = QStringLiteral( "QgsProcessingParameterMapTheme('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); QgsProcessingContext c; code += QStringLiteral( ", defaultValue=%1)" ).arg( valueAsPythonString( mDefault, c ) ); @@ -7172,7 +7172,7 @@ QgsProcessingParameterMapTheme *QgsProcessingParameterMapTheme::fromScriptCode( QVariant defaultValue = def; - if ( defaultValue == QStringLiteral( "None" ) || defaultValue.toString().isEmpty() ) + if ( defaultValue == QLatin1String( "None" ) || defaultValue.toString().isEmpty() ) defaultValue = QVariant(); return new QgsProcessingParameterMapTheme( name, description, defaultValue, isOptional ); @@ -7306,7 +7306,7 @@ QString QgsProcessingParameterDateTime::toolTip() const if ( mDefault.isValid() ) parts << QObject::tr( "Default value: %1" ).arg( mDataType == DateTime ? mDefault.toDateTime().toString( Qt::ISODate ) : ( mDataType == Date ? mDefault.toDate().toString( Qt::ISODate ) : mDefault.toTime( ).toString() ) ); - QString extra = parts.join( QStringLiteral( "
    " ) ); + QString extra = parts.join( QLatin1String( "
    " ) ); if ( !extra.isEmpty() ) text += QStringLiteral( "

    %1

    " ).arg( extra ); return text; @@ -7320,7 +7320,7 @@ QString QgsProcessingParameterDateTime::asPythonString( const QgsProcessing::Pyt { QString code = QStringLiteral( "QgsProcessingParameterDateTime('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += QStringLiteral( ", type=%1" ).arg( mDataType == DateTime ? QStringLiteral( "QgsProcessingParameterDateTime.DateTime" ) : mDataType == Date ? QStringLiteral( "QgsProcessingParameterDateTime.Date" ) @@ -7389,7 +7389,7 @@ bool QgsProcessingParameterDateTime::fromVariantMap( const QVariantMap &map ) QgsProcessingParameterDateTime *QgsProcessingParameterDateTime::fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) { return new QgsProcessingParameterDateTime( name, description, DateTime, definition.isEmpty() ? QVariant() - : ( definition.toLower().trimmed() == QStringLiteral( "none" ) ? QVariant() : definition ), isOptional ); + : ( definition.toLower().trimmed() == QLatin1String( "none" ) ? QVariant() : definition ), isOptional ); } @@ -7438,8 +7438,8 @@ QString QgsProcessingParameterProviderConnection::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "providerconnection " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "providerconnection " ); code += mProviderId + ' '; code += mDefault.toString(); @@ -7454,7 +7454,7 @@ QString QgsProcessingParameterProviderConnection::asPythonString( const QgsProce { QString code = QStringLiteral( "QgsProcessingParameterProviderConnection('%1', '%2', '%3'" ).arg( name(), description(), mProviderId ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); QgsProcessingContext c; code += QStringLiteral( ", defaultValue=%1)" ).arg( valueAsPythonString( mDefault, c ) ); @@ -7503,7 +7503,7 @@ QgsProcessingParameterProviderConnection *QgsProcessingParameterProviderConnecti QVariant defaultValue = def; - if ( defaultValue == QStringLiteral( "None" ) || defaultValue.toString().isEmpty() ) + if ( defaultValue == QLatin1String( "None" ) || defaultValue.toString().isEmpty() ) defaultValue = QVariant(); return new QgsProcessingParameterProviderConnection( name, description, provider, defaultValue, isOptional ); @@ -7554,8 +7554,8 @@ QString QgsProcessingParameterDatabaseSchema::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "databaseschema " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "databaseschema " ); code += mParentConnectionParameterName + ' '; @@ -7571,7 +7571,7 @@ QString QgsProcessingParameterDatabaseSchema::asPythonString( const QgsProcessin { QString code = QStringLiteral( "QgsProcessingParameterDatabaseSchema('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); code += QStringLiteral( ", connectionParameterName='%1'" ).arg( mParentConnectionParameterName ); QgsProcessingContext c; @@ -7687,8 +7687,8 @@ QString QgsProcessingParameterDatabaseTable::asScriptCode() const { QString code = QStringLiteral( "##%1=" ).arg( mName ); if ( mFlags & FlagOptional ) - code += QStringLiteral( "optional " ); - code += QStringLiteral( "databasetable " ); + code += QLatin1String( "optional " ); + code += QLatin1String( "databasetable " ); code += ( mParentConnectionParameterName.isEmpty() ? QStringLiteral( "none" ) : mParentConnectionParameterName ) + ' '; code += ( mParentSchemaParameterName.isEmpty() ? QStringLiteral( "none" ) : mParentSchemaParameterName ) + ' '; @@ -7705,10 +7705,10 @@ QString QgsProcessingParameterDatabaseTable::asPythonString( const QgsProcessing { QString code = QStringLiteral( "QgsProcessingParameterDatabaseTable('%1', '%2'" ).arg( name(), description() ); if ( mFlags & FlagOptional ) - code += QStringLiteral( ", optional=True" ); + code += QLatin1String( ", optional=True" ); if ( mAllowNewTableNames ) - code += QStringLiteral( ", allowNewTableNames=True" ); + code += QLatin1String( ", allowNewTableNames=True" ); code += QStringLiteral( ", connectionParameterName='%1'" ).arg( mParentConnectionParameterName ); code += QStringLiteral( ", schemaParameterName='%1'" ).arg( mParentSchemaParameterName ); diff --git a/src/core/processing/qgsprocessingutils.cpp b/src/core/processing/qgsprocessingutils.cpp index d24030649425..46fbcf97e926 100644 --- a/src/core/processing/qgsprocessingutils.cpp +++ b/src/core/processing/qgsprocessingutils.cpp @@ -611,12 +611,12 @@ QString QgsProcessingUtils::variantToPythonLiteral( const QVariant &value ) QString QgsProcessingUtils::stringToPythonLiteral( const QString &string ) { QString s = string; - s.replace( '\\', QStringLiteral( "\\\\" ) ); - s.replace( '\n', QStringLiteral( "\\n" ) ); - s.replace( '\r', QStringLiteral( "\\r" ) ); - s.replace( '\t', QStringLiteral( "\\t" ) ); - s.replace( '"', QStringLiteral( "\\\"" ) ); - s.replace( '\'', QStringLiteral( "\\\'" ) ); + s.replace( '\\', QLatin1String( "\\\\" ) ); + s.replace( '\n', QLatin1String( "\\n" ) ); + s.replace( '\r', QLatin1String( "\\r" ) ); + s.replace( '\t', QLatin1String( "\\t" ) ); + s.replace( '"', QLatin1String( "\\\"" ) ); + s.replace( '\'', QLatin1String( "\\\'" ) ); s = s.prepend( '\'' ).append( '\'' ); return s; } @@ -640,7 +640,7 @@ void QgsProcessingUtils::parseDestinationString( QString &destination, QString & if ( matched ) { - if ( providerKey == QStringLiteral( "postgis" ) ) // older processing used "postgis" instead of "postgres" + if ( providerKey == QLatin1String( "postgis" ) ) // older processing used "postgis" instead of "postgres" { providerKey = QStringLiteral( "postgres" ); } @@ -1008,7 +1008,7 @@ QString QgsProcessingUtils::formatHelpMapAsHtml( const QVariantMap &map, const Q if ( !map.value( QStringLiteral( "ALG_VERSION" ) ).toString().isEmpty() ) s += QObject::tr( "

    Algorithm version: %1

    " ).arg( getText( QStringLiteral( "ALG_VERSION" ) ) ); - s += QStringLiteral( "" ); + s += QLatin1String( "" ); return s; } diff --git a/src/core/providers/gdal/qgsgdaldataitems.cpp b/src/core/providers/gdal/qgsgdaldataitems.cpp index b73566c80275..f8b8f21dd135 100644 --- a/src/core/providers/gdal/qgsgdaldataitems.cpp +++ b/src/core/providers/gdal/qgsgdaldataitems.cpp @@ -263,12 +263,12 @@ QgsDataItem *QgsGdalDataItemProvider::createDataItem( const QString &pathIn, Qgs #endif } - if ( suffix == QStringLiteral( "mbtiles" ) ) + if ( suffix == QLatin1String( "mbtiles" ) ) { QgsMbTiles reader( path ); if ( reader.open() ) { - if ( reader.metadataValue( "format" ) == QStringLiteral( "pbf" ) ) + if ( reader.metadataValue( "format" ) == QLatin1String( "pbf" ) ) { // these are vector tiles QUrlQuery uq; diff --git a/src/core/providers/gdal/qgsgdalprovider.cpp b/src/core/providers/gdal/qgsgdalprovider.cpp index d76e1d5c1c2b..d436ddde057f 100644 --- a/src/core/providers/gdal/qgsgdalprovider.cpp +++ b/src/core/providers/gdal/qgsgdalprovider.cpp @@ -214,8 +214,8 @@ QgsGdalProvider::QgsGdalProvider( const QgsGdalProvider &other ) // so make sure to really use a single one. // The PostGISRaster driver internally uses a per-thread connection cache. // This can lead to crashes if two datasets created by the same thread are used at the same time. - bool forceUseSameDataset = ( mDriverName.toUpper() == QStringLiteral( "JP2OPENJPEG" ) || - mDriverName == QStringLiteral( "PostGISRaster" ) || + bool forceUseSameDataset = ( mDriverName.toUpper() == QLatin1String( "JP2OPENJPEG" ) || + mDriverName == QLatin1String( "PostGISRaster" ) || CSLTestBoolean( CPLGetConfigOption( "QGIS_GDAL_FORCE_USE_SAME_DATASET", "FALSE" ) ) ); if ( forceUseSameDataset ) @@ -588,7 +588,7 @@ QString QgsGdalProvider::htmlMetadata() QStringList categories = QgsOgrUtils::cStringListToQStringList( GDALcategories ); myMetadata += QgsHtmlUtils::buildBulletList( categories ); } - myMetadata += QStringLiteral( "" ); + myMetadata += QLatin1String( "" ); } // More information @@ -626,7 +626,7 @@ QString QgsGdalProvider::htmlMetadata() } // End more information - myMetadata += QStringLiteral( "\n" ); + myMetadata += QLatin1String( "\n" ); // Dimensions myMetadata += QStringLiteral( "
    \n" ); + myMetadata += QLatin1String( "\n" ); if ( GDALGetGeoTransform( mGdalDataset, mGeoTransform ) != CE_None ) { @@ -1302,7 +1302,7 @@ QString QgsGdalProvider::generateBandName( int bandNumber ) const } if ( !bandNameValues.isEmpty() ) { - return tr( "Band" ) + QStringLiteral( " %1: %2" ).arg( bandNumber, 1 + ( int ) std::log10( ( float ) bandCount() ), 10, QChar( '0' ) ).arg( bandNameValues.join( QStringLiteral( " / " ) ) ); + return tr( "Band" ) + QStringLiteral( " %1: %2" ).arg( bandNumber, 1 + ( int ) std::log10( ( float ) bandCount() ), 10, QChar( '0' ) ).arg( bandNameValues.join( QLatin1String( " / " ) ) ); } } } @@ -2325,7 +2325,7 @@ QVariantMap QgsGdalProviderMetadata::decodeUri( const QString &uri ) if ( path.indexOf( ':' ) != -1 ) { QStringList parts = path.split( ':' ); - if ( parts[0].toLower() == QStringLiteral( "gpkg" ) ) + if ( parts[0].toLower() == QLatin1String( "gpkg" ) ) { parts.removeFirst(); // Handle windows paths - which has an extra colon - and unix paths @@ -2460,7 +2460,7 @@ void buildSupportedRasterFileFilterAndExtensions( QString &fileFiltersString, QS // This hacking around that removes '/' is no longer necessary with GDAL 2.3 extensions << QString( ext ).remove( '/' ).remove( '*' ).remove( '.' ); if ( !glob.isEmpty() ) - glob += QLatin1String( " " ); + glob += QLatin1Char( ' ' ); glob += "*." + QString( ext ).replace( '/', QLatin1String( " *." ) ); } @@ -2534,7 +2534,7 @@ void buildSupportedRasterFileFilterAndExtensions( QString &fileFiltersString, QS QStringList filters = fileFiltersString.split( QStringLiteral( ";;" ), Qt::SkipEmptyParts ); #endif filters.sort(); - fileFiltersString = filters.join( QStringLiteral( ";;" ) ) + ";;"; + fileFiltersString = filters.join( QLatin1String( ";;" ) ) + ";;"; // VSIFileHandler (see qgsogrprovider.cpp) - second QgsSettings settings; @@ -2548,7 +2548,7 @@ void buildSupportedRasterFileFilterAndExtensions( QString &fileFiltersString, QS QStringList exts; for ( const QString &ext : qgis::as_const( extensions ) ) exts << QStringLiteral( "*.%1 *.%2" ).arg( ext, ext.toUpper() ); - fileFiltersString.prepend( QObject::tr( "All supported files" ) + QStringLiteral( " (%1);;" ).arg( exts.join( QStringLiteral( " " ) ) ) ); + fileFiltersString.prepend( QObject::tr( "All supported files" ) + QStringLiteral( " (%1);;" ).arg( exts.join( QLatin1Char( ' ' ) ) ) ); // can't forget the default case - first fileFiltersString.prepend( QObject::tr( "All files" ) + " (*);;" ); diff --git a/src/core/providers/ogr/qgsgeopackageprojectstorage.cpp b/src/core/providers/ogr/qgsgeopackageprojectstorage.cpp index a33ea6690cb5..7d21ce7319fe 100644 --- a/src/core/providers/ogr/qgsgeopackageprojectstorage.cpp +++ b/src/core/providers/ogr/qgsgeopackageprojectstorage.cpp @@ -273,7 +273,7 @@ QString QgsGeoPackageProjectStorage::encodeUri( const QgsGeoPackageProjectUri &g // Check for windows network shares: github issue #31310 QString database { gpkgUri.database }; - if ( database.startsWith( QStringLiteral( "//" ) ) ) + if ( database.startsWith( QLatin1String( "//" ) ) ) { u.setPath( database.replace( '/', '\\' ) ); } @@ -301,7 +301,7 @@ QgsGeoPackageProjectUri QgsGeoPackageProjectStorage::decodeUri( const QString &u const QRegularExpression winLocalPath { R"(^[A-Za-z]:)" }; // Check for windows network shares: github issue #31310 const QString path { ( winLocalPath.match( urlAsString ).hasMatch() || - urlAsString.startsWith( QStringLiteral( "//" ) ) ) ? + urlAsString.startsWith( QLatin1String( "//" ) ) ) ? urlAsString : url.path() }; diff --git a/src/core/providers/ogr/qgsgeopackageproviderconnection.cpp b/src/core/providers/ogr/qgsgeopackageproviderconnection.cpp index 263d93155f45..0cd435f599ad 100644 --- a/src/core/providers/ogr/qgsgeopackageproviderconnection.cpp +++ b/src/core/providers/ogr/qgsgeopackageproviderconnection.cpp @@ -268,11 +268,11 @@ QList QgsGeoPackageProviderConne static const QStringList aspatialTypes = { QStringLiteral( "attributes" ), QStringLiteral( "aspatial" ) }; const QString dataType = row.at( 1 ).toString(); // Table type - if ( dataType == QStringLiteral( "tiles" ) || dataType == QStringLiteral( "2d-gridded-coverage" ) ) + if ( dataType == QLatin1String( "tiles" ) || dataType == QLatin1String( "2d-gridded-coverage" ) ) { property.setFlag( QgsGeoPackageProviderConnection::Raster ); } - else if ( dataType == QStringLiteral( "features" ) ) + else if ( dataType == QLatin1String( "features" ) ) { property.setFlag( QgsGeoPackageProviderConnection::Vector ); property.setGeometryColumn( row.at( 5 ).toString() ); diff --git a/src/core/providers/ogr/qgsogrdataitems.cpp b/src/core/providers/ogr/qgsogrdataitems.cpp index 9b4ecf01d7b7..1d9d4a265d41 100644 --- a/src/core/providers/ogr/qgsogrdataitems.cpp +++ b/src/core/providers/ogr/qgsogrdataitems.cpp @@ -66,11 +66,11 @@ QVector QgsOgrLayerItem::createChildren() QVector children; // Geopackage is handled by QgsGeoPackageVectorLayerItem and QgsGeoPackageRasterLayerItem // Proxy to spatialite provider data items because it implements the connections API - if ( mDriverName == QStringLiteral( "SQLite" ) ) + if ( mDriverName == QLatin1String( "SQLite" ) ) { children.push_back( new QgsFieldsItem( this, path() + QStringLiteral( "/columns/ " ), - QStringLiteral( R"(dbname="%1")" ).arg( parent()->path().replace( '"', QStringLiteral( R"(\")" ) ) ), + QStringLiteral( R"(dbname="%1")" ).arg( parent()->path().replace( '"', QLatin1String( R"(\")" ) ) ), QStringLiteral( "spatialite" ), QString(), name() ) ); } return children; @@ -372,7 +372,7 @@ QVector QgsOgrDataCollectionItem::createChildren() GDALDriverH hDriver = GDALGetDatasetDriver( hDataSource.get() ); const QString driverName = QString::fromUtf8( GDALGetDriverShortName( hDriver ) ); - if ( driverName == QStringLiteral( "SQLite" ) ) + if ( driverName == QLatin1String( "SQLite" ) ) { skippedLayerNames = QgsSqliteUtils::systemTables(); } @@ -396,7 +396,7 @@ QVector QgsOgrDataCollectionItem::createChildren() uniqueNames = false; break; } - if ( ( driverName == QStringLiteral( "SQLite" ) && layerName.contains( QRegularExpression( QStringLiteral( "idx_.*_geometry($|_.*)" ) ) ) ) + if ( ( driverName == QLatin1String( "SQLite" ) && layerName.contains( QRegularExpression( QStringLiteral( "idx_.*_geometry($|_.*)" ) ) ) ) || skippedLayerNames.contains( layerName ) ) { skippedLayers << i; diff --git a/src/core/providers/ogr/qgsogrdbconnection.cpp b/src/core/providers/ogr/qgsogrdbconnection.cpp index ff9998854b57..7dd29068ea84 100644 --- a/src/core/providers/ogr/qgsogrdbconnection.cpp +++ b/src/core/providers/ogr/qgsogrdbconnection.cpp @@ -57,7 +57,7 @@ void QgsOgrDbConnection::save( ) bool QgsOgrDbConnection::allowProjectsInDatabase() { - return mSettingsKey == QStringLiteral( "GPKG" ); + return mSettingsKey == QLatin1String( "GPKG" ); } QString QgsOgrDbConnection::fullKey( const QString &settingsKey ) diff --git a/src/core/providers/ogr/qgsogrprovider.cpp b/src/core/providers/ogr/qgsogrprovider.cpp index 60625aabe08b..d64e5338b37d 100644 --- a/src/core/providers/ogr/qgsogrprovider.cpp +++ b/src/core/providers/ogr/qgsogrprovider.cpp @@ -687,9 +687,9 @@ QString QgsOgrProvider::ogrWkbGeometryTypeName( OGRwkbGeometryType type ) const { geom = ogrWkbGeometryTypeName( wkbFlatten( type ) ); if ( wkbHasZ( type ) ) - geom += QLatin1String( "Z" ); + geom += QLatin1Char( 'Z' ); if ( wkbHasM( type ) ) - geom += QLatin1String( "M" ); + geom += QLatin1Char( 'M' ); return geom; } @@ -1441,11 +1441,11 @@ QVariant QgsOgrProvider::defaultValue( int fieldId ) const return QVariant(); QVariant resultVar = defaultVal; - if ( defaultVal == QStringLiteral( "CURRENT_TIMESTAMP" ) ) + if ( defaultVal == QLatin1String( "CURRENT_TIMESTAMP" ) ) resultVar = QDateTime::currentDateTime(); - else if ( defaultVal == QStringLiteral( "CURRENT_DATE" ) ) + else if ( defaultVal == QLatin1String( "CURRENT_DATE" ) ) resultVar = QDate::currentDate(); - else if ( defaultVal == QStringLiteral( "CURRENT_TIME" ) ) + else if ( defaultVal == QLatin1String( "CURRENT_TIME" ) ) resultVar = QTime::currentTime(); // Get next sequence value for sqlite in case we are inside a transaction @@ -3363,7 +3363,7 @@ QString createFilters( const QString &type ) { sExtensions << ext; if ( !glob.isEmpty() ) - glob += QLatin1String( " " ); + glob += QLatin1Char( ' ' ); glob += "*." + ext; } @@ -3396,7 +3396,7 @@ QString createFilters( const QString &type ) QStringList filters = sFileFilters.split( QStringLiteral( ";;" ), Qt::SkipEmptyParts ); #endif filters.sort(); - sFileFilters = filters.join( QStringLiteral( ";;" ) ) + ";;"; + sFileFilters = filters.join( QLatin1String( ";;" ) ) + ";;"; QgsDebugMsgLevel( "myFileFilters: " + sFileFilters, 2 ); // VSIFileHandler (.zip and .gz files) - second @@ -3414,7 +3414,7 @@ QString createFilters( const QString &type ) QStringList exts; for ( const QString &ext : qgis::as_const( sExtensions ) ) exts << QStringLiteral( "*.%1 *.%2" ).arg( ext, ext.toUpper() ); - sFileFilters.prepend( QObject::tr( "All supported files" ) + QStringLiteral( " (%1);;" ).arg( exts.join( QStringLiteral( " " ) ) ) ); + sFileFilters.prepend( QObject::tr( "All supported files" ) + QStringLiteral( " (%1);;" ).arg( exts.join( QLatin1Char( ' ' ) ) ) ); // can't forget the default case - first sFileFilters.prepend( QObject::tr( "All files" ) + " (*);;" ); @@ -3444,15 +3444,15 @@ QString createFilters( const QString &type ) } if ( type == QLatin1String( "extensions" ) ) { - return sExtensions.join( QStringLiteral( "|" ) ); + return sExtensions.join( QLatin1Char( '|' ) ); } - if ( type == QStringLiteral( "directory_extensions" ) ) + if ( type == QLatin1String( "directory_extensions" ) ) { - return sDirectoryExtensions.join( QStringLiteral( "|" ) ); + return sDirectoryExtensions.join( QLatin1Char( '|' ) ); } if ( type == QLatin1String( "wildcards" ) ) { - return sWildcards.join( QStringLiteral( "|" ) ); + return sWildcards.join( QLatin1Char( '|' ) ); } else { @@ -3582,7 +3582,7 @@ QString QgsOgrProviderMetadata::encodeUri( const QVariantMap &parts ) + ( !geometryType.isEmpty() ? QStringLiteral( "|geometrytype=%1" ).arg( geometryType ) : QString() ); for ( const QString &openOption : openOptions ) { - uri += QStringLiteral( "|option:" ); + uri += QLatin1String( "|option:" ); uri += openOption; } if ( !subset.isEmpty() ) @@ -4169,7 +4169,7 @@ QString QgsOgrProviderUtils::connectionPoolId( const QString &dataSourceURI, boo // Otherwise use the datasourceURI // Not completely sure about this logic. But at least, for GeoPackage this // works fine with multi layer datasets. - QString filePath = dataSourceURI.left( dataSourceURI.indexOf( QLatin1String( "|" ) ) ); + QString filePath = dataSourceURI.left( dataSourceURI.indexOf( QLatin1Char( '|' ) ) ); QFileInfo fi( filePath ); if ( fi.isFile() ) return filePath; @@ -5817,7 +5817,7 @@ void QgsOgrProviderUtils::releaseDataset( QgsOgrDataset *&ds ) bool QgsOgrProviderUtils::canDriverShareSameDatasetAmongLayers( const QString &driverName ) { - return driverName != QStringLiteral( "OSM" ); + return driverName != QLatin1String( "OSM" ); } bool QgsOgrProviderUtils::canDriverShareSameDatasetAmongLayers( const QString &driverName, diff --git a/src/core/qgsabstractcontentcache.h b/src/core/qgsabstractcontentcache.h index fb2a895af160..726d54a5fbdc 100644 --- a/src/core/qgsabstractcontentcache.h +++ b/src/core/qgsabstractcontentcache.h @@ -564,7 +564,7 @@ class CORE_EXPORT QgsAbstractContentCache : public QgsAbstractContentCacheBase { entry->mFileModifiedCheckTimeout = mFileModifiedCheckTimeout; - if ( !entry->path.startsWith( QStringLiteral( "base64:" ) ) ) + if ( !entry->path.startsWith( QLatin1String( "base64:" ) ) ) { entry->fileModified = QFileInfo( entry->path ).lastModified(); entry->fileModifiedLastCheckTimer.start(); diff --git a/src/core/qgsapplication.cpp b/src/core/qgsapplication.cpp index 2a913e6dd32d..afc03b7638c5 100644 --- a/src/core/qgsapplication.cpp +++ b/src/core/qgsapplication.cpp @@ -826,7 +826,7 @@ void QgsApplication::setUITheme( const QString &themeName ) { // Loop all style sheets, find matching name, load it. QHash themes = QgsApplication::uiThemes(); - if ( themeName == QStringLiteral( "default" ) || !themes.contains( themeName ) ) + if ( themeName == QLatin1String( "default" ) || !themes.contains( themeName ) ) { setThemeName( QStringLiteral( "default" ) ); qApp->setStyleSheet( QString() ); @@ -847,7 +847,7 @@ void QgsApplication::setUITheme( const QString &themeName ) } QString styledata = file.readAll(); - styledata.replace( QStringLiteral( "@theme_path" ), path ); + styledata.replace( QLatin1String( "@theme_path" ), path ); if ( variableInfo.exists() ) { @@ -1585,7 +1585,7 @@ QString QgsApplication::absolutePathToRelativePath( const QString &aPath, const aPathElems.insert( 0, QStringLiteral( "." ) ); } - return aPathElems.join( QStringLiteral( "/" ) ); + return aPathElems.join( QLatin1Char( '/' ) ); } QString QgsApplication::relativePathToAbsolutePath( const QString &rpath, const QString &targetPath ) @@ -1628,7 +1628,7 @@ QString QgsApplication::relativePathToAbsolutePath( const QString &rpath, const // resolve .. int pos; - while ( ( pos = targetElems.indexOf( QStringLiteral( ".." ) ) ) > 0 ) + while ( ( pos = targetElems.indexOf( QLatin1String( ".." ) ) ) > 0 ) { // remove preceding element and .. targetElems.removeAt( pos - 1 ); @@ -1640,7 +1640,7 @@ QString QgsApplication::relativePathToAbsolutePath( const QString &rpath, const targetElems.prepend( QString() ); #endif - return targetElems.join( QStringLiteral( "/" ) ); + return targetElems.join( QLatin1Char( '/' ) ); } QString QgsApplication::buildSourcePath() @@ -1696,7 +1696,7 @@ void QgsApplication::setSkippedGdalDrivers( const QStringList &skippedGdalDriver *sDeferredSkippedGdalDrivers() = deferredSkippedGdalDrivers; QgsSettings settings; - settings.setValue( QStringLiteral( "gdal/skipDrivers" ), skippedGdalDrivers.join( QStringLiteral( "," ) ) ); + settings.setValue( QStringLiteral( "gdal/skipDrivers" ), skippedGdalDrivers.join( QLatin1Char( ',' ) ) ); applyGdalSkippedDrivers(); } diff --git a/src/core/qgsauxiliarystorage.cpp b/src/core/qgsauxiliarystorage.cpp index 52132b8aa086..3740473c1e39 100644 --- a/src/core/qgsauxiliarystorage.cpp +++ b/src/core/qgsauxiliarystorage.cpp @@ -847,7 +847,7 @@ QgsDataSourceUri QgsAuxiliaryStorage::parseOgrUri( const QgsDataSourceUri &uri ) if ( tableParts.count() < 1 ) return newUri; - const QString tableName = tableParts[0].replace( QStringLiteral( "layername=" ), QString() ); + const QString tableName = tableParts[0].replace( QLatin1String( "layername=" ), QString() ); newUri.setDataSource( QString(), tableName, QString() ); newUri.setDatabase( databasePath ); diff --git a/src/core/qgsbookmarkmanager.cpp b/src/core/qgsbookmarkmanager.cpp index ee190f5cf0f8..1f5301edc635 100644 --- a/src/core/qgsbookmarkmanager.cpp +++ b/src/core/qgsbookmarkmanager.cpp @@ -279,7 +279,7 @@ bool QgsBookmarkManager::readXml( const QDomElement &element, const QDomDocument clear(); QDomElement bookmarksElem = element; - if ( element.tagName() != QStringLiteral( "Bookmarks" ) ) + if ( element.tagName() != QLatin1String( "Bookmarks" ) ) { bookmarksElem = element.firstChildElement( QStringLiteral( "Bookmarks" ) ); } diff --git a/src/core/qgscolorramp.cpp b/src/core/qgscolorramp.cpp index a6ea688a8d3a..c2a2a5dad09f 100644 --- a/src/core/qgscolorramp.cpp +++ b/src/core/qgscolorramp.cpp @@ -207,7 +207,7 @@ QgsStringMap QgsGradientColorRamp::properties() const { lst.append( QStringLiteral( "%1;%2" ).arg( it->offset ).arg( QgsSymbolLayerUtils::encodeColor( it->color ) ) ); } - map[QStringLiteral( "stops" )] = lst.join( QStringLiteral( ":" ) ); + map[QStringLiteral( "stops" )] = lst.join( QLatin1Char( ':' ) ); } map[QStringLiteral( "discrete" )] = mDiscrete ? "1" : "0"; diff --git a/src/core/qgscoordinatereferencesystem.cpp b/src/core/qgscoordinatereferencesystem.cpp index abddd38e8223..0341cf159c2e 100644 --- a/src/core/qgscoordinatereferencesystem.cpp +++ b/src/core/qgscoordinatereferencesystem.cpp @@ -1520,7 +1520,7 @@ void QgsCoordinateReferenceSystem::setProjString( const QString &proj4String ) QString trimmed = proj4String.trimmed(); #if PROJ_VERSION_MAJOR>=6 - trimmed += QStringLiteral( " +type=crs" ); + trimmed += QLatin1String( " +type=crs" ); PJ_CONTEXT *ctx = QgsProjContext::get(); { @@ -2478,7 +2478,7 @@ bool QgsCoordinateReferenceSystem::loadFromAuthCode( const QString &auth, const crs = QgsProjUtils::crsToSingleCrs( crs.get() ); QString proj4 = getFullProjString( crs.get() ); - proj4.replace( QStringLiteral( "+type=crs" ), QString() ); + proj4.replace( QLatin1String( "+type=crs" ), QString() ); proj4 = proj4.trimmed(); d->mIsValid = true; @@ -2854,7 +2854,7 @@ int QgsCoordinateReferenceSystem::syncDatabase() crs = QgsProjUtils::crsToSingleCrs( crs.get() ); QString proj4 = getFullProjString( crs.get() ); - proj4.replace( QStringLiteral( "+type=crs" ), QString() ); + proj4.replace( QLatin1String( "+type=crs" ), QString() ); proj4 = proj4.trimmed(); if ( proj4.isEmpty() ) diff --git a/src/core/qgsdataitem.cpp b/src/core/qgsdataitem.cpp index 4c8e6295229c..0f3afa493302 100644 --- a/src/core/qgsdataitem.cpp +++ b/src/core/qgsdataitem.cpp @@ -251,7 +251,7 @@ QIcon QgsFieldItem::icon() parentFields->tableProperty()->geometryColumn() == mName && parentFields->tableProperty()->geometryColumnTypes().count() ) { - if ( mField.typeName() == QStringLiteral( "raster" ) ) + if ( mField.typeName() == QLatin1String( "raster" ) ) { return QgsLayerItem::iconRaster(); } @@ -1662,7 +1662,7 @@ QVector QgsZipItem::createChildren() continue; // ugly hack to remove .dbf file if there is a .shp file - if ( provider->name() == QStringLiteral( "OGR" ) ) + if ( provider->name() == QLatin1String( "OGR" ) ) { if ( info.suffix().compare( QLatin1String( "dbf" ), Qt::CaseInsensitive ) == 0 ) { diff --git a/src/core/qgsdatasourceuri.cpp b/src/core/qgsdatasourceuri.cpp index 7fbaa5115ff4..31bb1b3b8fe6 100644 --- a/src/core/qgsdatasourceuri.cpp +++ b/src/core/qgsdatasourceuri.cpp @@ -532,7 +532,7 @@ QString QgsDataSourceUri::connectionInfo( bool expandAuthConfig ) const } } - return connectionItems.join( QStringLiteral( " " ) ); + return connectionItems.join( QLatin1Char( ' ' ) ); } QString QgsDataSourceUri::uri( bool expandAuthConfig ) const @@ -546,7 +546,7 @@ QString QgsDataSourceUri::uri( bool expandAuthConfig ) const if ( mUseEstimatedMetadata ) { - uri += QStringLiteral( " estimatedmetadata=true" ); + uri += QLatin1String( " estimatedmetadata=true" ); } if ( !mSrid.isEmpty() ) @@ -562,7 +562,7 @@ QString QgsDataSourceUri::uri( bool expandAuthConfig ) const if ( mSelectAtIdDisabled ) { - uri += QStringLiteral( " selectatid=false" ); + uri += QLatin1String( " selectatid=false" ); } for ( QMap::const_iterator it = mParams.begin(); it != mParams.end(); ++it ) diff --git a/src/core/qgsdiagramrenderer.h b/src/core/qgsdiagramrenderer.h index c36fc5799880..e0b2c7886a89 100644 --- a/src/core/qgsdiagramrenderer.h +++ b/src/core/qgsdiagramrenderer.h @@ -685,9 +685,9 @@ class CORE_EXPORT QgsDiagramRenderer #ifdef SIP_RUN SIP_CONVERT_TO_SUBCLASS_CODE - if ( sipCpp->rendererName() == QStringLiteral( "SingleCategory" ) ) + if ( sipCpp->rendererName() == QLatin1String( "SingleCategory" ) ) sipType = sipType_QgsSingleCategoryDiagramRenderer; - else if ( sipCpp->rendererName() == QStringLiteral( "LinearlyInterpolated" ) ) + else if ( sipCpp->rendererName() == QLatin1String( "LinearlyInterpolated" ) ) sipType = sipType_QgsLinearlyInterpolatedDiagramRenderer; else sipType = NULL; diff --git a/src/core/qgseventtracing.cpp b/src/core/qgseventtracing.cpp index 47e905bac457..e0dd480cad2a 100644 --- a/src/core/qgseventtracing.cpp +++ b/src/core/qgseventtracing.cpp @@ -107,7 +107,7 @@ bool QgsEventTracing::writeTrace( const QString &fileName ) // for instant events we always set them as global (currently not supporting instant events at thread scope) if ( item.type == Instant ) - msg += QStringLiteral( ", \"s\": \"g\"" ); + msg += QLatin1String( ", \"s\": \"g\"" ); // async events also need to have ID associated if ( item.type == AsyncBegin || item.type == AsyncEnd ) diff --git a/src/core/qgsfeaturefiltermodel.cpp b/src/core/qgsfeaturefiltermodel.cpp index edd9e7970ec1..933bd22bd637 100644 --- a/src/core/qgsfeaturefiltermodel.cpp +++ b/src/core/qgsfeaturefiltermodel.cpp @@ -62,7 +62,7 @@ void QgsFeatureFilterModel::requestToReloadCurrentFeature( QgsFeatureRequest &re conditions << QgsExpression::createFieldEqualityExpression( mIdentifierFields.at( i ), mExtraIdentifierValue.toList().at( i ) ); } } - request.setFilterExpression( conditions.join( QStringLiteral( " AND " ) ) ); + request.setFilterExpression( conditions.join( QLatin1String( " AND " ) ) ); } QSet QgsFeatureFilterModel::requestedAttributes() const @@ -83,7 +83,7 @@ QgsFeatureExpressionValuesGatherer::Entry QgsFeatureFilterModel::createEntry( co for ( const QVariant &v : constValues ) values << QStringLiteral( "(%1)" ).arg( v.toString() ); - return QgsFeatureExpressionValuesGatherer::Entry( constValues, values.join( QStringLiteral( " " ) ), QgsFeature( sourceLayer()->fields() ) ); + return QgsFeatureExpressionValuesGatherer::Entry( constValues, values.join( QLatin1Char( ' ' ) ), QgsFeature( sourceLayer()->fields() ) ); } bool QgsFeatureFilterModel::compareEntries( const QgsFeatureExpressionValuesGatherer::Entry &a, const QgsFeatureExpressionValuesGatherer::Entry &b ) const diff --git a/src/core/qgsfeaturerequest.cpp b/src/core/qgsfeaturerequest.cpp index c3ed3d6294d1..7e73d70929de 100644 --- a/src/core/qgsfeaturerequest.cpp +++ b/src/core/qgsfeaturerequest.cpp @@ -523,5 +523,5 @@ QString QgsFeatureRequest::OrderBy::dump() const results << clause.dump(); } - return results.join( QStringLiteral( ", " ) ); + return results.join( QLatin1String( ", " ) ); } diff --git a/src/core/qgsfileutils.cpp b/src/core/qgsfileutils.cpp index 94605521a655..b78df98614b3 100644 --- a/src/core/qgsfileutils.cpp +++ b/src/core/qgsfileutils.cpp @@ -116,7 +116,7 @@ QString QgsFileUtils::findClosestExistingPath( const QString &path ) if ( visited.contains( parentPath ) ) return QString(); // break circular links - if ( parentPath.isEmpty() || parentPath == QStringLiteral( "." ) ) + if ( parentPath.isEmpty() || parentPath == QLatin1String( "." ) ) return QString(); currentPath = QDir( parentPath ); visited << parentPath; @@ -127,7 +127,7 @@ QString QgsFileUtils::findClosestExistingPath( const QString &path ) if ( res == QDir::currentPath() ) return QString(); // avoid default to binary folder if a filename alone is specified - return res == QStringLiteral( "." ) ? QString() : res; + return res == QLatin1String( "." ) ? QString() : res; } QStringList QgsFileUtils::findFile( const QString &file, const QString &basePath, int maxClimbs, int searchCeilling, const QString ¤tDir ) diff --git a/src/core/qgsfontutils.cpp b/src/core/qgsfontutils.cpp index 9c6ee768f404..a0c750dbe322 100644 --- a/src/core/qgsfontutils.cpp +++ b/src/core/qgsfontutils.cpp @@ -395,7 +395,7 @@ QFont QgsFontUtils::fromMimeData( const QMimeData *data, bool *ok ) { elem = doc.documentElement(); - if ( elem.nodeName() != QStringLiteral( "font" ) ) + if ( elem.nodeName() != QLatin1String( "font" ) ) elem = elem.firstChildElement( QStringLiteral( "font" ) ); if ( setFromXmlElement( font, elem ) ) @@ -440,7 +440,7 @@ QString QgsFontUtils::translateNamedStyle( const QString &namedStyle ) { words[i] = QCoreApplication::translate( "QFontDatabase", words[i].toLocal8Bit().constData() ); } - return words.join( QStringLiteral( " " ) ); + return words.join( QLatin1Char( ' ' ) ); } QString QgsFontUtils::untranslateNamedStyle( const QString &namedStyle ) @@ -463,7 +463,7 @@ QString QgsFontUtils::untranslateNamedStyle( const QString &namedStyle ) QgsDebugMsgLevel( QStringLiteral( "Warning: style map does not contain %1" ).arg( words[i] ), 2 ); } } - return words.join( QStringLiteral( " " ) ); + return words.join( QLatin1Char( ' ' ) ); } QString QgsFontUtils::asCSS( const QFont &font, double pointToPixelScale ) diff --git a/src/core/qgsgmlschema.cpp b/src/core/qgsgmlschema.cpp index 263af1d1c892..63c31c0ee125 100644 --- a/src/core/qgsgmlschema.cpp +++ b/src/core/qgsgmlschema.cpp @@ -285,7 +285,7 @@ QList QgsGmlSchema::domElements( const QDomElement &element, const } else { - list.append( domElements( el, names.join( QStringLiteral( "." ) ) ) ); + list.append( domElements( el, names.join( QLatin1Char( '.' ) ) ) ); } } } @@ -357,7 +357,7 @@ void QgsGmlSchema::startElement( const XML_Char *el, const XML_Char **attr ) } mParsePathStack.append( elementName ); - QString path = mParsePathStack.join( QStringLiteral( "." ) ); + QString path = mParsePathStack.join( QLatin1Char( '.' ) ); QStringList splitName = elementName.split( NS_SEPARATOR ); QString localName = splitName.last(); diff --git a/src/core/qgsimagecache.cpp b/src/core/qgsimagecache.cpp index 113e48a455f0..2a09341bd14d 100644 --- a/src/core/qgsimagecache.cpp +++ b/src/core/qgsimagecache.cpp @@ -160,7 +160,7 @@ QSize QgsImageCache::originalSize( const QString &path, bool blocking ) const return QSize(); // direct read if path is a file -- maybe more efficient than going the bytearray route? (untested!) - if ( !path.startsWith( QStringLiteral( "base64:" ) ) && QFile::exists( path ) ) + if ( !path.startsWith( QLatin1String( "base64:" ) ) && QFile::exists( path ) ) { QImageReader reader( path ); if ( reader.size().isValid() ) @@ -196,7 +196,7 @@ QImage QgsImageCache::renderImage( const QString &path, QSize size, const bool k isBroken = false; // direct read if path is a file -- maybe more efficient than going the bytearray route? (untested!) - if ( !path.startsWith( QStringLiteral( "base64:" ) ) && QFile::exists( path ) ) + if ( !path.startsWith( QLatin1String( "base64:" ) ) && QFile::exists( path ) ) { im = QImage( path ); } diff --git a/src/core/qgsmaplayer.cpp b/src/core/qgsmaplayer.cpp index a276b9d19d31..c6dddfdd026b 100644 --- a/src/core/qgsmaplayer.cpp +++ b/src/core/qgsmaplayer.cpp @@ -334,7 +334,7 @@ bool QgsMapLayer::readLayerXml( const QDomElement &layerElement, QgsReadWriteCon { kwdList << n.toElement().text(); } - mKeywordList = kwdList.join( QStringLiteral( ", " ) ); + mKeywordList = kwdList.join( QLatin1String( ", " ) ); } //metadataUrl diff --git a/src/core/qgsmaplayerlegend.cpp b/src/core/qgsmaplayerlegend.cpp index c50cd32e055e..91736e40a2dc 100644 --- a/src/core/qgsmaplayerlegend.cpp +++ b/src/core/qgsmaplayerlegend.cpp @@ -68,7 +68,7 @@ void QgsMapLayerLegendUtils::setLegendNodeOrder( QgsLayerTreeLayer *nodeLayer, c const auto constOrder = order; for ( int id : constOrder ) orderStr << QString::number( id ); - QString str = orderStr.isEmpty() ? QStringLiteral( "empty" ) : orderStr.join( QStringLiteral( "," ) ); + QString str = orderStr.isEmpty() ? QStringLiteral( "empty" ) : orderStr.join( QLatin1Char( ',' ) ); nodeLayer->setCustomProperty( QStringLiteral( "legend/node-order" ), str ); } diff --git a/src/core/qgsmaplayermodel.cpp b/src/core/qgsmaplayermodel.cpp index b257b16da359..729954b36161 100644 --- a/src/core/qgsmaplayermodel.cpp +++ b/src/core/qgsmaplayermodel.cpp @@ -330,7 +330,7 @@ QVariant QgsMapLayerModel::data( const QModelIndex &index, int role ) const if ( !layer->abstract().isEmpty() ) parts << "
    " + layer->abstract().replace( QLatin1String( "\n" ), QLatin1String( "
    " ) ); parts << "" + layer->publicSource() + ""; - return parts.join( QStringLiteral( "
    " ) ); + return parts.join( QLatin1String( "
    " ) ); } return QVariant(); } diff --git a/src/core/qgsmaprendererjob.cpp b/src/core/qgsmaprendererjob.cpp index 417f708d6f45..9efb891c2909 100644 --- a/src/core/qgsmaprendererjob.cpp +++ b/src/core/qgsmaprendererjob.cpp @@ -924,7 +924,7 @@ void QgsMapRendererJob::logRenderingTime( const LayerRenderJobs &jobs, const Lay const auto constTt = tt; for ( int t : constTt ) { - QgsMessageLog::logMessage( tr( "%1 ms: %2" ).arg( t ).arg( QStringList( elapsed.values( t ) ).join( QStringLiteral( ", " ) ) ), tr( "Rendering" ) ); + QgsMessageLog::logMessage( tr( "%1 ms: %2" ).arg( t ).arg( QStringList( elapsed.values( t ) ).join( QLatin1String( ", " ) ) ), tr( "Rendering" ) ); } QgsMessageLog::logMessage( QStringLiteral( "---" ), tr( "Rendering" ) ); } diff --git a/src/core/qgsmaprenderertask.cpp b/src/core/qgsmaprenderertask.cpp index 97de005177df..48a934cd51d3 100644 --- a/src/core/qgsmaprenderertask.cpp +++ b/src/core/qgsmaprenderertask.cpp @@ -118,12 +118,12 @@ class QgsMapRendererTaskRenderedFeatureHandler : public QgsRenderedFeatureHandle QgsMapRendererTask::QgsMapRendererTask( const QgsMapSettings &ms, const QString &fileName, const QString &fileFormat, const bool forceRaster, const bool geoPDF, const QgsAbstractGeoPdfExporter::ExportDetails &geoPdfExportDetails ) - : QgsTask( fileFormat == QStringLiteral( "PDF" ) ? tr( "Saving as PDF" ) : tr( "Saving as image" ) ) + : QgsTask( fileFormat == QLatin1String( "PDF" ) ? tr( "Saving as PDF" ) : tr( "Saving as image" ) ) , mMapSettings( ms ) , mFileName( fileName ) , mFileFormat( fileFormat ) , mForceRaster( forceRaster ) - , mGeoPDF( geoPDF && mFileFormat == QStringLiteral( "PDF" ) && QgsAbstractGeoPdfExporter::geoPDFCreationAvailable() ) + , mGeoPDF( geoPDF && mFileFormat == QLatin1String( "PDF" ) && QgsAbstractGeoPdfExporter::geoPDFCreationAvailable() ) , mGeoPdfExportDetails( geoPdfExportDetails ) { prepare(); @@ -297,7 +297,7 @@ bool QgsMapRendererTask::run() { mDestPainter->end(); - if ( mFileFormat == QStringLiteral( "PDF" ) ) + if ( mFileFormat == QLatin1String( "PDF" ) ) { #ifndef QT_NO_PRINTER if ( mForceRaster ) @@ -371,7 +371,7 @@ bool QgsMapRendererTask::run() return false; #endif // !QT_NO_PRINTER } - else if ( mFileFormat != QStringLiteral( "PDF" ) ) + else if ( mFileFormat != QLatin1String( "PDF" ) ) { bool success = mImage.save( mFileName, mFileFormat.toLocal8Bit().data() ); if ( !success ) @@ -387,7 +387,7 @@ bool QgsMapRendererTask::run() // build the world file name QString outputSuffix = info.suffix(); bool skipWorldFile = false; - if ( outputSuffix == QStringLiteral( "tif" ) || outputSuffix == QStringLiteral( "tiff" ) ) + if ( outputSuffix == QLatin1String( "tif" ) || outputSuffix == QLatin1String( "tiff" ) ) { gdal::dataset_unique_ptr outputDS( GDALOpen( mFileName.toLocal8Bit().constData(), GA_Update ) ); if ( outputDS ) @@ -465,7 +465,7 @@ void QgsMapRendererTask::prepare() mDestPainter = mPainter; - if ( mFileFormat == QStringLiteral( "PDF" ) ) + if ( mFileFormat == QLatin1String( "PDF" ) ) { #ifndef QT_NO_PRINTER mPrinter.reset( new QPrinter() ); diff --git a/src/core/qgsmimedatautils.cpp b/src/core/qgsmimedatautils.cpp index 5498addea790..c73dfec6036d 100644 --- a/src/core/qgsmimedatautils.cpp +++ b/src/core/qgsmimedatautils.cpp @@ -273,7 +273,7 @@ QString QgsMimeDataUtils::encode( const QStringList &items ) for ( const QString &item : constItems ) { QString str = item; - str.replace( '\\', QStringLiteral( "\\\\" ) ); + str.replace( '\\', QLatin1String( "\\\\" ) ); str.replace( re, QStringLiteral( "\\:" ) ); encoded += str + ':'; } diff --git a/src/core/qgsnewsfeedparser.cpp b/src/core/qgsnewsfeedparser.cpp index 0befccc8c862..b0fc6de1951e 100644 --- a/src/core/qgsnewsfeedparser.cpp +++ b/src/core/qgsnewsfeedparser.cpp @@ -46,7 +46,7 @@ QgsNewsFeedParser::QgsNewsFeedParser( const QUrl &feedUrl, const QString &authcf { feedLanguage = QgsSettings().value( QStringLiteral( "locale/userLocale" ), QStringLiteral( "en_US" ) ).toString().left( 2 ); } - if ( !feedLanguage.isEmpty() && feedLanguage != QStringLiteral( "C" ) ) + if ( !feedLanguage.isEmpty() && feedLanguage != QLatin1String( "C" ) ) query.addQueryItem( QStringLiteral( "lang" ), feedLanguage ); bool latOk = false; diff --git a/src/core/qgsofflineediting.cpp b/src/core/qgsofflineediting.cpp index c04b0587ba6b..8950db2847dc 100644 --- a/src/core/qgsofflineediting.cpp +++ b/src/core/qgsofflineediting.cpp @@ -327,7 +327,7 @@ void QgsOfflineEditing::synchronize() } else { - showWarning( remoteLayer->commitErrors().join( QStringLiteral( "\n" ) ) ); + showWarning( remoteLayer->commitErrors().join( QLatin1Char( '\n' ) ) ); } } else @@ -858,7 +858,7 @@ QgsVectorLayer *QgsOfflineEditing::copyVectorLayer( QgsVectorLayer *layer, sqlit } else { - showWarning( newLayer->commitErrors().join( QStringLiteral( "\n" ) ) ); + showWarning( newLayer->commitErrors().join( QLatin1Char( '\n' ) ) ); } // copy the custom properties from original layer diff --git a/src/core/qgspathresolver.cpp b/src/core/qgspathresolver.cpp index d35ec9471958..9043b79ad621 100644 --- a/src/core/qgspathresolver.cpp +++ b/src/core/qgspathresolver.cpp @@ -157,7 +157,7 @@ QString QgsPathResolver::readPath( const QString &f ) const // resolve .. int pos; - while ( ( pos = projElems.indexOf( QStringLiteral( ".." ) ) ) > 0 ) + while ( ( pos = projElems.indexOf( QLatin1String( ".." ) ) ) > 0 ) { // remove preceding element and .. projElems.removeAt( pos - 1 ); @@ -169,7 +169,7 @@ QString QgsPathResolver::readPath( const QString &f ) const projElems.prepend( QString() ); #endif - return vsiPrefix + projElems.join( QStringLiteral( "/" ) ); + return vsiPrefix + projElems.join( QLatin1Char( '/' ) ); } QString QgsPathResolver::setPathPreprocessor( const std::function &processor ) @@ -312,7 +312,7 @@ QString QgsPathResolver::writePath( const QString &src ) const } // Append url query if any - QString returnPath { vsiPrefix + srcElems.join( QStringLiteral( "/" ) ) }; + QString returnPath { vsiPrefix + srcElems.join( QLatin1Char( '/' ) ) }; if ( ! urlQuery.isEmpty() ) { returnPath.append( '?' ); diff --git a/src/core/qgspointxy.cpp b/src/core/qgspointxy.cpp index e7df4265e32e..9fde6c9698e0 100644 --- a/src/core/qgspointxy.cpp +++ b/src/core/qgspointxy.cpp @@ -70,7 +70,7 @@ QString QgsPointXY::asWkt() const { QString wkt = QStringLiteral( "POINT" ); if ( isEmpty() ) - wkt += QStringLiteral( " EMPTY" ); + wkt += QLatin1String( " EMPTY" ); else wkt += QStringLiteral( "(%1 %2)" ).arg( qgsDoubleToString( mX ), qgsDoubleToString( mY ) ); diff --git a/src/core/qgspostgresstringutils.cpp b/src/core/qgspostgresstringutils.cpp index 36eac63b4c0e..d1e03279ed6b 100644 --- a/src/core/qgspostgresstringutils.cpp +++ b/src/core/qgspostgresstringutils.cpp @@ -136,8 +136,8 @@ QString QgsPostgresStringUtils::buildArray( const QVariantList &list ) } else { - newS.replace( '\\', QStringLiteral( R"(\\)" ) ); - newS.replace( '\"', QStringLiteral( R"(\")" ) ); + newS.replace( '\\', QLatin1String( R"(\\)" ) ); + newS.replace( '\"', QLatin1String( R"(\")" ) ); sl.push_back( "\"" + newS + "\"" ); } break; diff --git a/src/core/qgsproject.cpp b/src/core/qgsproject.cpp index a250e2957b56..ec00db49deae 100644 --- a/src/core/qgsproject.cpp +++ b/src/core/qgsproject.cpp @@ -586,7 +586,7 @@ void QgsProject::registerTranslatableObjects( QgsTranslationContext *translation translationContext->registerTranslation( QStringLiteral( "project:layers:%1:fieldaliases" ).arg( vlayer->id() ), fieldName ); - if ( field.editorWidgetSetup().type() == QStringLiteral( "ValueRelation" ) ) + if ( field.editorWidgetSetup().type() == QLatin1String( "ValueRelation" ) ) { translationContext->registerTranslation( QStringLiteral( "project:layers:%1:fields:%2:valuerelationvalue" ).arg( vlayer->id(), field.name() ), field.editorWidgetSetup().config().value( QStringLiteral( "Value" ) ).toString() ); } diff --git a/src/core/qgsprojectfiletransform.cpp b/src/core/qgsprojectfiletransform.cpp index c725a02bfdc4..82466650eed7 100644 --- a/src/core/qgsprojectfiletransform.cpp +++ b/src/core/qgsprojectfiletransform.cpp @@ -817,23 +817,23 @@ void transform3000( QgsProjectFileTransform *pft ) for ( int configIndex = 0; configIndex < configAttrs.count(); ++configIndex ) { QDomAttr configAttr = configAttrs.item( configIndex ).toAttr(); - if ( configAttr.name() == QStringLiteral( "fieldEditable" ) ) + if ( configAttr.name() == QLatin1String( "fieldEditable" ) ) { editWidgetConfigElement.setAttribute( QStringLiteral( "fieldEditable" ), configAttr.value() ); } - else if ( configAttr.name() == QStringLiteral( "labelOnTop" ) ) + else if ( configAttr.name() == QLatin1String( "labelOnTop" ) ) { editWidgetConfigElement.setAttribute( QStringLiteral( "labelOnTop" ), configAttr.value() ); } - else if ( configAttr.name() == QStringLiteral( "notNull" ) ) + else if ( configAttr.name() == QLatin1String( "notNull" ) ) { editWidgetConfigElement.setAttribute( QStringLiteral( "notNull" ), configAttr.value() ); } - else if ( configAttr.name() == QStringLiteral( "constraint" ) ) + else if ( configAttr.name() == QLatin1String( "constraint" ) ) { constraintExpressionElem.setAttribute( QStringLiteral( "exp" ), configAttr.value() ); } - else if ( configAttr.name() == QStringLiteral( "constraintDescription" ) ) + else if ( configAttr.name() == QLatin1String( "constraintDescription" ) ) { constraintExpressionElem.setAttribute( QStringLiteral( "desc" ), configAttr.value() ); } @@ -843,7 +843,7 @@ void transform3000( QgsProjectFileTransform *pft ) } } - if ( ewv2Type == QStringLiteral( "ValueMap" ) ) + if ( ewv2Type == QLatin1String( "ValueMap" ) ) { QDomNodeList configElements = ewv2CfgElem.childNodes(); QVariantMap map; @@ -854,7 +854,7 @@ void transform3000( QgsProjectFileTransform *pft ) } editWidgetConfiguration.insert( QStringLiteral( "map" ), map ); } - else if ( ewv2Type == QStringLiteral( "Photo" ) ) + else if ( ewv2Type == QLatin1String( "Photo" ) ) { editWidgetElement.setAttribute( QStringLiteral( "type" ), QStringLiteral( "ExternalResource" ) ); @@ -863,13 +863,13 @@ void transform3000( QgsProjectFileTransform *pft ) editWidgetConfiguration.insert( QStringLiteral( "DocumentViewerWidth" ), editWidgetConfiguration.value( QStringLiteral( "Width" ) ) ); editWidgetConfiguration.insert( QStringLiteral( "RelativeStorage" ), 1 ); } - else if ( ewv2Type == QStringLiteral( "FileName" ) ) + else if ( ewv2Type == QLatin1String( "FileName" ) ) { editWidgetElement.setAttribute( QStringLiteral( "type" ), QStringLiteral( "ExternalResource" ) ); editWidgetConfiguration.insert( QStringLiteral( "RelativeStorage" ), 1 ); } - else if ( ewv2Type == QStringLiteral( "WebView" ) ) + else if ( ewv2Type == QLatin1String( "WebView" ) ) { editWidgetElement.setAttribute( QStringLiteral( "type" ), QStringLiteral( "ExternalResource" ) ); diff --git a/src/core/qgsprojectservervalidator.cpp b/src/core/qgsprojectservervalidator.cpp index b89d38d5e5d4..c0e02f5a663a 100644 --- a/src/core/qgsprojectservervalidator.cpp +++ b/src/core/qgsprojectservervalidator.cpp @@ -117,19 +117,19 @@ bool QgsProjectServerValidator::validate( QgsProject *project, QListdump(); @@ -704,7 +704,7 @@ QString QgsSQLStatement::NodeJoin::dump() const first = false; ret += quotedIdentifierIfNeeded( column ); } - ret += QLatin1String( ")" ); + ret += QLatin1Char( ')' ); } return ret; } diff --git a/src/core/qgsstringutils.cpp b/src/core/qgsstringutils.cpp index e25acd1b915f..6806bc8f7b6a 100644 --- a/src/core/qgsstringutils.cpp +++ b/src/core/qgsstringutils.cpp @@ -123,11 +123,11 @@ QString QgsStringUtils::ampersandEncode( const QString &string ) if ( ch.unicode() > 160 ) encoded += QStringLiteral( "&#%1;" ).arg( static_cast< int >( ch.unicode() ) ); else if ( ch.unicode() == 38 ) - encoded += QStringLiteral( "&" ); + encoded += QLatin1String( "&" ); else if ( ch.unicode() == 60 ) - encoded += QStringLiteral( "<" ); + encoded += QLatin1String( "<" ); else if ( ch.unicode() == 62 ) - encoded += QStringLiteral( ">" ); + encoded += QLatin1String( ">" ); else encoded += ch; } @@ -571,7 +571,7 @@ QString QgsStringUtils::htmlToMarkdown( const QString &html ) int offset = 0; while ( hrefRegEx.indexIn( converted, offset ) != -1 ) { - QString url = hrefRegEx.cap( 1 ).replace( QStringLiteral( "\"" ), QString() ); + QString url = hrefRegEx.cap( 1 ).replace( QLatin1String( "\"" ), QString() ); url.replace( '\'', QString() ); QString name = hrefRegEx.cap( 2 ); QString anchor = QStringLiteral( "[%1](%2)" ).arg( name, url ); diff --git a/src/core/qgsvectordataprovider.cpp b/src/core/qgsvectordataprovider.cpp index 21c192d5e00c..c28876b78414 100644 --- a/src/core/qgsvectordataprovider.cpp +++ b/src/core/qgsvectordataprovider.cpp @@ -309,7 +309,7 @@ QString QgsVectorDataProvider::capabilitiesString() const abilitiesList += tr( "Curved Geometries" ); } - return abilitiesList.join( QStringLiteral( ", " ) ); + return abilitiesList.join( QLatin1String( ", " ) ); } diff --git a/src/core/qgsvectorfilewriter.cpp b/src/core/qgsvectorfilewriter.cpp index 33ef2f9401a7..4bba0dfef1e5 100644 --- a/src/core/qgsvectorfilewriter.cpp +++ b/src/core/qgsvectorfilewriter.cpp @@ -427,7 +427,7 @@ void QgsVectorFileWriter::init( QString vectorFileName, // consider spatial reference system of the layer if ( driverName == QLatin1String( "KML" ) || driverName == QLatin1String( "LIBKML" ) || driverName == QLatin1String( "GPX" ) ) { - if ( srs.authid() != QStringLiteral( "EPSG:4326" ) ) + if ( srs.authid() != QLatin1String( "EPSG:4326" ) ) { // Those drivers outputs WGS84 geometries, let's align our output CRS to have QGIS take charge of geometry transformation QgsCoordinateReferenceSystem wgs84 = QgsCoordinateReferenceSystem::fromEpsgId( 4326 ); @@ -453,7 +453,7 @@ void QgsVectorFileWriter::init( QString vectorFileName, OGRwkbGeometryType wkbType = ogrTypeFromWkbType( geometryType ); // Remove FEATURE_DATASET layer option (used for ESRI File GDB driver) if its value is not set - int optIndex = layerOptions.indexOf( QStringLiteral( "FEATURE_DATASET=" ) ); + int optIndex = layerOptions.indexOf( QLatin1String( "FEATURE_DATASET=" ) ); if ( optIndex != -1 ) { layerOptions.removeAt( optIndex ); diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp index 9151c909ba25..a89af89b75c9 100644 --- a/src/core/qgsvectorlayer.cpp +++ b/src/core/qgsvectorlayer.cpp @@ -1835,7 +1835,7 @@ bool QgsVectorLayer::setDataProvider( QString const &provider, const QgsDataProv if ( mDataSource.right( 10 ) == QLatin1String( "|layerid=0" ) ) mDataSource.chop( 10 ); } - else if ( provider == QStringLiteral( "memory" ) ) + else if ( provider == QLatin1String( "memory" ) ) { // required so that source differs between memory layers mDataSource = mDataSource + QStringLiteral( "&uid=%1" ).arg( QUuid::createUuid().toString() ); @@ -1947,13 +1947,13 @@ QString QgsVectorLayer::encodedSource( const QString &source, const QgsReadWrite { QStringList theURIParts = src.split( '|' ); theURIParts[0] = context.pathResolver().writePath( theURIParts[0] ); - src = theURIParts.join( QStringLiteral( "|" ) ); + src = theURIParts.join( QLatin1Char( '|' ) ); } else if ( providerType() == QLatin1String( "gpx" ) ) { QStringList theURIParts = src.split( '?' ); theURIParts[0] = context.pathResolver().writePath( theURIParts[0] ); - src = theURIParts.join( QStringLiteral( "?" ) ); + src = theURIParts.join( QLatin1Char( '?' ) ); } else if ( providerType() == QLatin1String( "delimitedtext" ) ) { @@ -1998,7 +1998,7 @@ QString QgsVectorLayer::encodedSource( const QString &source, const QgsReadWrite theURIParts[1] = QUrl::toPercentEncoding( theURIParts[1] ); } - queryItems[i].second = theURIParts.join( QStringLiteral( ":" ) ) ; + queryItems[i].second = theURIParts.join( QLatin1Char( ':' ) ) ; } } @@ -2030,13 +2030,13 @@ QString QgsVectorLayer::decodedSource( const QString &source, const QString &pro { QStringList theURIParts = src.split( '|' ); theURIParts[0] = context.pathResolver().readPath( theURIParts[0] ); - src = theURIParts.join( QStringLiteral( "|" ) ); + src = theURIParts.join( QLatin1Char( '|' ) ); } else if ( provider == QLatin1String( "gpx" ) ) { QStringList theURIParts = src.split( '?' ); theURIParts[0] = context.pathResolver().readPath( theURIParts[0] ); - src = theURIParts.join( QStringLiteral( "?" ) ); + src = theURIParts.join( QLatin1Char( '?' ) ); } else if ( provider == QLatin1String( "delimitedtext" ) ) { @@ -2071,7 +2071,7 @@ QString QgsVectorLayer::decodedSource( const QString &source, const QString &pro theURIParts = value.split( ':' ); theURIParts[1] = QUrl::fromPercentEncoding( theURIParts[1].toUtf8() ); - if ( theURIParts[0] == QStringLiteral( "delimitedtext" ) ) + if ( theURIParts[0] == QLatin1String( "delimitedtext" ) ) { QUrl urlSource = QUrl( theURIParts[1] ); @@ -2093,7 +2093,7 @@ QString QgsVectorLayer::decodedSource( const QString &source, const QString &pro } theURIParts[1] = QUrl::toPercentEncoding( theURIParts[1] ); - queryItems[i].second = theURIParts.join( QStringLiteral( ":" ) ) ; + queryItems[i].second = theURIParts.join( QLatin1Char( ':' ) ) ; } } @@ -2335,7 +2335,7 @@ bool QgsVectorLayer::readSymbology( const QDomNode &layerNode, QString &errorMes const QDomElement cfgElem = fieldConfigElement.elementsByTagName( QStringLiteral( "config" ) ).at( 0 ).toElement(); const QDomElement optionsElem = cfgElem.childNodes().at( 0 ).toElement(); QVariantMap optionsMap = QgsXmlUtils::readVariant( optionsElem ).toMap(); - if ( widgetType == QStringLiteral( "ValueRelation" ) ) + if ( widgetType == QLatin1String( "ValueRelation" ) ) { optionsMap[ QStringLiteral( "Value" ) ] = context.projectTranslator()->translate( QStringLiteral( "project:layers:%1:fields:%2:valuerelationvalue" ).arg( layerNode.namedItem( QStringLiteral( "id" ) ).toElement().text(), fieldName ), optionsMap[ QStringLiteral( "Value" ) ].toString() ); } @@ -3364,7 +3364,7 @@ bool QgsVectorLayer::commitChanges( bool stopEditing ) } else { - QgsMessageLog::logMessage( tr( "Commit errors:\n %1" ).arg( mCommitErrors.join( QStringLiteral( "\n " ) ) ) ); + QgsMessageLog::logMessage( tr( "Commit errors:\n %1" ).arg( mCommitErrors.join( QLatin1String( "\n " ) ) ) ); } updateFields(); @@ -5120,7 +5120,7 @@ QString QgsVectorLayer::htmlMetadata() const myMetadata += htmlFormatter.historySectionHtml( ); myMetadata += QLatin1String( "

    \n" ); - myMetadata += QStringLiteral( "\n\n\n" ); + myMetadata += QLatin1String( "\n\n\n" ); return myMetadata; } diff --git a/src/core/qgsvectorlayerexporter.cpp b/src/core/qgsvectorlayerexporter.cpp index 8addbf01e604..2c9cd7990d5d 100644 --- a/src/core/qgsvectorlayerexporter.cpp +++ b/src/core/qgsvectorlayerexporter.cpp @@ -206,7 +206,7 @@ bool QgsVectorLayerExporter::flushBuffer() mErrorMessage = QObject::tr( "Creation error for features from #%1 to #%2. Provider errors was: \n%3" ) .arg( mFeatureBuffer.first().id() ) .arg( mFeatureBuffer.last().id() ) - .arg( errors.join( QStringLiteral( "\n" ) ) ); + .arg( errors.join( QLatin1Char( '\n' ) ) ); mError = ErrFeatureWriteFailed; mErrorCount += mFeatureBuffer.count(); diff --git a/src/core/qgsvectorlayerrenderer.cpp b/src/core/qgsvectorlayerrenderer.cpp index d44cc855d724..0ddda31f2e32 100644 --- a/src/core/qgsvectorlayerrenderer.cpp +++ b/src/core/qgsvectorlayerrenderer.cpp @@ -151,7 +151,7 @@ bool QgsVectorLayerRenderer::render() return false; } - if ( mRenderer->type() == QStringLiteral( "nullSymbol" ) ) + if ( mRenderer->type() == QLatin1String( "nullSymbol" ) ) { // a little shortcut for the null symbol renderer - most of the time it is not going to render anything // so we can even skip the whole loop to fetch features diff --git a/src/core/qgsvectorlayertools.cpp b/src/core/qgsvectorlayertools.cpp index 052842563690..048a66440b40 100644 --- a/src/core/qgsvectorlayertools.cpp +++ b/src/core/qgsvectorlayertools.cpp @@ -91,7 +91,7 @@ bool QgsVectorLayerTools::copyMoveFeatures( QgsVectorLayer *layer, QgsFeatureReq } else if ( errorMsg ) { - errorMsg = new QString( QString( tr( "Only %1 out of %2 features were copied." ) ) + errorMsg = new QString( tr( "Only %1 out of %2 features were copied." ) .arg( browsedFeatureCount - couldNotWriteCount - noGeometryCount, browsedFeatureCount ) ); if ( noGeometryCount ) { diff --git a/src/core/qgsvirtuallayerdefinitionutils.cpp b/src/core/qgsvirtuallayerdefinitionutils.cpp index 9dcf4ebe5bd8..0e17086f167e 100644 --- a/src/core/qgsvirtuallayerdefinitionutils.cpp +++ b/src/core/qgsvirtuallayerdefinitionutils.cpp @@ -45,7 +45,7 @@ QgsVirtualLayerDefinition QgsVirtualLayerDefinitionUtils::fromJoinedLayer( QgsVe // find an uid name QString uid = QStringLiteral( "uid" ); while ( fields.lookupField( uid ) != -1 ) - uid += QLatin1String( "_" ); // add "_" each time this name already exists + uid += QLatin1Char( '_' ); // add "_" each time this name already exists // add a column columns << "t.rowid AS " + uid; @@ -89,7 +89,7 @@ QgsVirtualLayerDefinition QgsVirtualLayerDefinitionUtils::fromJoinedLayer( QgsVe } } - QString query = "SELECT " + columns.join( QStringLiteral( ", " ) ) + " FROM \"" + layer->id() + "\" AS t " + leftJoins.join( QStringLiteral( " " ) ); + QString query = "SELECT " + columns.join( QLatin1String( ", " ) ) + " FROM \"" + layer->id() + "\" AS t " + leftJoins.join( QLatin1Char( ' ' ) ); def.setQuery( query ); return def; diff --git a/src/core/raster/qgshillshaderenderer.cpp b/src/core/raster/qgshillshaderenderer.cpp index e54523d2777d..7de8971482e8 100644 --- a/src/core/raster/qgshillshaderenderer.cpp +++ b/src/core/raster/qgshillshaderenderer.cpp @@ -218,7 +218,7 @@ QgsRasterBlock *QgsHillshadeRenderer::block( int bandNo, const QgsRectangle &ext if ( inputBlock->dataType() != Qgis::DataType::Float32 ) { - source.replace( QStringLiteral( "__global float *scanLine" ), QStringLiteral( "__global %1 *scanLine" ).arg( typeName ) ); + source.replace( QLatin1String( "__global float *scanLine" ), QStringLiteral( "__global %1 *scanLine" ).arg( typeName ) ); } // Data type for input is Float32 (4 bytes) diff --git a/src/core/raster/qgsrasterinterface.cpp b/src/core/raster/qgsrasterinterface.cpp index 5511ec9b4432..a65aadb78264 100644 --- a/src/core/raster/qgsrasterinterface.cpp +++ b/src/core/raster/qgsrasterinterface.cpp @@ -612,7 +612,7 @@ QString QgsRasterInterface::capabilitiesString() const abilitiesList += tr( "Build Pyramids" ); } - QgsDebugMsgLevel( "Capability: " + abilitiesList.join( QStringLiteral( ", " ) ), 4 ); + QgsDebugMsgLevel( "Capability: " + abilitiesList.join( QLatin1String( ", " ) ), 4 ); - return abilitiesList.join( QStringLiteral( ", " ) ); + return abilitiesList.join( QLatin1String( ", " ) ); } diff --git a/src/core/raster/qgsrasterlayer.cpp b/src/core/raster/qgsrasterlayer.cpp index 43e6bdf8fd19..d6d6ec3f0f47 100644 --- a/src/core/raster/qgsrasterlayer.cpp +++ b/src/core/raster/qgsrasterlayer.cpp @@ -466,7 +466,7 @@ QString QgsRasterLayer::htmlMetadata() const myMetadata += QString::number( dataProvider()->sourceNoDataValue( i ) ); else myMetadata += tr( "n/a" ); - myMetadata += QStringLiteral( "" ); + myMetadata += QLatin1String( "" ); if ( provider->hasStatistics( i ) ) { @@ -479,7 +479,7 @@ QString QgsRasterLayer::htmlMetadata() const myMetadata += QStringLiteral( "
    " ); } - myMetadata += QStringLiteral( "\n" ); + myMetadata += QLatin1String( "\n" ); } //close previous bands table @@ -783,18 +783,18 @@ void QgsRasterLayer::setDataProvider( QString const &provider, const QgsDataProv { QgsSettings settings; QString resampling = settings.value( QStringLiteral( "/Raster/defaultZoomedInResampling" ), QStringLiteral( "nearest neighbour" ) ).toString(); - if ( resampling == QStringLiteral( "bilinear" ) ) + if ( resampling == QLatin1String( "bilinear" ) ) { resampleFilter->setZoomedInResampler( new QgsBilinearRasterResampler() ); mDataProvider->setZoomedInResamplingMethod( QgsRasterDataProvider::ResamplingMethod::Bilinear ); } - else if ( resampling == QStringLiteral( "cubic" ) ) + else if ( resampling == QLatin1String( "cubic" ) ) { resampleFilter->setZoomedInResampler( new QgsCubicRasterResampler() ); mDataProvider->setZoomedInResamplingMethod( QgsRasterDataProvider::ResamplingMethod::Cubic ); } resampling = settings.value( QStringLiteral( "/Raster/defaultZoomedOutResampling" ), QStringLiteral( "nearest neighbour" ) ).toString(); - if ( resampling == QStringLiteral( "bilinear" ) ) + if ( resampling == QLatin1String( "bilinear" ) ) { resampleFilter->setZoomedOutResampler( new QgsBilinearRasterResampler() ); mDataProvider->setZoomedOutResamplingMethod( QgsRasterDataProvider::ResamplingMethod::Bilinear ); diff --git a/src/core/raster/qgssinglebandgrayrenderer.cpp b/src/core/raster/qgssinglebandgrayrenderer.cpp index 9f38775d2516..77ad27073d3e 100644 --- a/src/core/raster/qgssinglebandgrayrenderer.cpp +++ b/src/core/raster/qgssinglebandgrayrenderer.cpp @@ -289,7 +289,7 @@ void QgsSingleBandGrayRenderer::toSld( QDomDocument &doc, QDomElement &element, for ( int i = 0; i < vendorOptions.size(); ++i ) { QDomElement vendorOption = vendorOptions.at( i ).toElement(); - if ( vendorOption.attribute( QStringLiteral( "name" ) ) != QStringLiteral( "minValue" ) ) + if ( vendorOption.attribute( QStringLiteral( "name" ) ) != QLatin1String( "minValue" ) ) continue; // remove old value and add the new one diff --git a/src/core/scalebar/qgsscalebarrenderer.cpp b/src/core/scalebar/qgsscalebarrenderer.cpp index 58e8e0ad9b29..7b5fa36c6491 100644 --- a/src/core/scalebar/qgsscalebarrenderer.cpp +++ b/src/core/scalebar/qgsscalebarrenderer.cpp @@ -100,7 +100,7 @@ void QgsScaleBarRenderer::drawDefaultLabels( QgsRenderContext &context, const Qg } //don't draw label for intermediate left segments or the zero label when it needs to be skipped - if ( ( segmentCounter == 0 || segmentCounter >= nSegmentsLeft ) && ( currentNumericLabel != QStringLiteral( "0" ) || drawZero ) ) + if ( ( segmentCounter == 0 || segmentCounter >= nSegmentsLeft ) && ( currentNumericLabel != QLatin1String( "0" ) || drawZero ) ) { scaleScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "scale_value" ), currentNumericLabel, true, false ) ); QPointF pos; diff --git a/src/core/symbology/qgscptcityarchive.cpp b/src/core/symbology/qgscptcityarchive.cpp index 0baaa5563a6a..7c0abe344a79 100644 --- a/src/core/symbology/qgscptcityarchive.cpp +++ b/src/core/symbology/qgscptcityarchive.cpp @@ -240,7 +240,7 @@ QgsStringMap QgsCptCityArchive::copyingInfo( const QString &fileName ) } e = e.nextSiblingElement(); } - copyingMap[ QStringLiteral( "authors" )] = authors.join( QStringLiteral( ", " ) ); + copyingMap[ QStringLiteral( "authors" )] = authors.join( QLatin1String( ", " ) ); } // load license information diff --git a/src/core/symbology/qgsfillsymbollayer.cpp b/src/core/symbology/qgsfillsymbollayer.cpp index 1361161ba581..1dbdd70edae6 100644 --- a/src/core/symbology/qgsfillsymbollayer.cpp +++ b/src/core/symbology/qgsfillsymbollayer.cpp @@ -567,7 +567,7 @@ QgsSymbolLayer *QgsGradientFillSymbolLayer::create( const QgsStringMap &props ) //attempt to create color ramp from props QgsColorRamp *gradientRamp = nullptr; - if ( props.contains( QStringLiteral( "rampType" ) ) && props[QStringLiteral( "rampType" )] == QStringLiteral( "cpt-city" ) ) + if ( props.contains( QStringLiteral( "rampType" ) ) && props[QStringLiteral( "rampType" )] == QLatin1String( "cpt-city" ) ) { gradientRamp = QgsCptCityColorRamp::create( props ); } @@ -1057,7 +1057,7 @@ QgsSymbolLayer *QgsShapeburstFillSymbolLayer::create( const QgsStringMap &props //attempt to create color ramp from props QgsColorRamp *gradientRamp = nullptr; - if ( props.contains( QStringLiteral( "rampType" ) ) && props[QStringLiteral( "rampType" )] == QStringLiteral( "cpt-city" ) ) + if ( props.contains( QStringLiteral( "rampType" ) ) && props[QStringLiteral( "rampType" )] == QLatin1String( "cpt-city" ) ) { gradientRamp = QgsCptCityColorRamp::create( props ); } @@ -2972,7 +2972,7 @@ QString QgsLinePatternFillSymbolLayer::ogrFeatureStyleWidth( double widthScaleFa QString featureStyle; featureStyle.append( "Brush(" ); featureStyle.append( QStringLiteral( "fc:%1" ).arg( mColor.name() ) ); - featureStyle.append( QStringLiteral( ",bc:%1" ).arg( QStringLiteral( "#00000000" ) ) ); //transparent background + featureStyle.append( QStringLiteral( ",bc:%1" ).arg( QLatin1String( "#00000000" ) ) ); //transparent background featureStyle.append( ",id:\"ogr-brush-2\"" ); featureStyle.append( QStringLiteral( ",a:%1" ).arg( mLineAngle ) ); featureStyle.append( QStringLiteral( ",s:%1" ).arg( mLineWidth * widthScaleFactor ) ); diff --git a/src/core/symbology/qgsrenderer.h b/src/core/symbology/qgsrenderer.h index db7900d576b9..287493ec118e 100644 --- a/src/core/symbology/qgsrenderer.h +++ b/src/core/symbology/qgsrenderer.h @@ -107,25 +107,25 @@ class CORE_EXPORT QgsFeatureRenderer const QString type = sipCpp->type(); - if ( type == QStringLiteral( "singleSymbol" ) ) + if ( type == QLatin1String( "singleSymbol" ) ) sipType = sipType_QgsSingleSymbolRenderer; - else if ( type == QStringLiteral( "categorizedSymbol" ) ) + else if ( type == QLatin1String( "categorizedSymbol" ) ) sipType = sipType_QgsCategorizedSymbolRenderer; - else if ( type == QStringLiteral( "graduatedSymbol" ) ) + else if ( type == QLatin1String( "graduatedSymbol" ) ) sipType = sipType_QgsGraduatedSymbolRenderer; - else if ( type == QStringLiteral( "RuleRenderer" ) ) + else if ( type == QLatin1String( "RuleRenderer" ) ) sipType = sipType_QgsRuleBasedRenderer; - else if ( type == QStringLiteral( "heatmapRenderer" ) ) + else if ( type == QLatin1String( "heatmapRenderer" ) ) sipType = sipType_QgsHeatmapRenderer; - else if ( type == QStringLiteral( "invertedPolygonRenderer" ) ) + else if ( type == QLatin1String( "invertedPolygonRenderer" ) ) sipType = sipType_QgsInvertedPolygonRenderer; - else if ( type == QStringLiteral( "pointCluster" ) ) + else if ( type == QLatin1String( "pointCluster" ) ) sipType = sipType_QgsPointClusterRenderer; - else if ( type == QStringLiteral( "pointDisplacement" ) ) + else if ( type == QLatin1String( "pointDisplacement" ) ) sipType = sipType_QgsPointDisplacementRenderer; - else if ( type == QStringLiteral( "25dRenderer" ) ) + else if ( type == QLatin1String( "25dRenderer" ) ) sipType = sipType_Qgs25DRenderer; - else if ( type == QStringLiteral( "nullSymbol" ) ) + else if ( type == QLatin1String( "nullSymbol" ) ) sipType = sipType_QgsNullSymbolRenderer; else sipType = 0; diff --git a/src/core/symbology/qgsrulebasedrenderer.cpp b/src/core/symbology/qgsrulebasedrenderer.cpp index 96c3d8ab7dd9..ffef9d6bbe43 100644 --- a/src/core/symbology/qgsrulebasedrenderer.cpp +++ b/src/core/symbology/qgsrulebasedrenderer.cpp @@ -200,7 +200,7 @@ QString QgsRuleBasedRenderer::Rule::dump( int indent ) const { lst.append( rule->dump( indent + 2 ) ); } - msg += lst.join( QStringLiteral( "\n" ) ); + msg += lst.join( QLatin1Char( '\n' ) ); return msg; } @@ -463,7 +463,7 @@ bool QgsRuleBasedRenderer::Rule::startRender( QgsRenderContext &context, const Q } else if ( subf.count( ) == 2 ) { - return subf.join( QStringLiteral( ") OR (" ) ).prepend( '(' ).append( ')' ); + return subf.join( QLatin1String( ") OR (" ) ).prepend( '(' ).append( ')' ); } else { @@ -475,7 +475,7 @@ bool QgsRuleBasedRenderer::Rule::startRender( QgsRenderContext &context, const Q } else { - sf = subfilters.join( QStringLiteral( ") OR (" ) ).prepend( '(' ).append( ')' ); + sf = subfilters.join( QLatin1String( ") OR (" ) ).prepend( '(' ).append( ')' ); } } diff --git a/src/core/symbology/qgsstyle.cpp b/src/core/symbology/qgsstyle.cpp index 869ffcba0c63..d0919dcf486b 100644 --- a/src/core/symbology/qgsstyle.cpp +++ b/src/core/symbology/qgsstyle.cpp @@ -214,7 +214,7 @@ bool QgsStyle::saveSymbol( const QString &name, QgsSymbol *symbol, bool favorite stream.setCodec( "UTF-8" ); symEl.save( stream, 4 ); QString query = qgs_sqlite3_mprintf( "INSERT INTO symbol VALUES (NULL, '%q', '%q', %d);", - name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) ); + name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) ); if ( !runEmptyQuery( query ) ) { @@ -413,7 +413,7 @@ bool QgsStyle::saveColorRamp( const QString &name, QgsColorRamp *ramp, bool favo stream.setCodec( "UTF-8" ); rampEl.save( stream, 4 ); QString query = qgs_sqlite3_mprintf( "INSERT INTO colorramp VALUES (NULL, '%q', '%q', %d);", - name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) ); + name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) ); if ( !runEmptyQuery( query ) ) { QgsDebugMsg( QStringLiteral( "Couldn't insert colorramp into the database!" ) ); @@ -522,60 +522,60 @@ bool QgsStyle::createMemoryDatabase() void QgsStyle::createTables() { QString query = qgs_sqlite3_mprintf( "CREATE TABLE symbol("\ - "id INTEGER PRIMARY KEY,"\ - "name TEXT UNIQUE,"\ - "xml TEXT,"\ - "favorite INTEGER);"\ - "CREATE TABLE colorramp("\ - "id INTEGER PRIMARY KEY,"\ - "name TEXT UNIQUE,"\ - "xml TEXT,"\ - "favorite INTEGER);"\ - "CREATE TABLE textformat("\ - "id INTEGER PRIMARY KEY,"\ - "name TEXT UNIQUE,"\ - "xml TEXT,"\ - "favorite INTEGER);"\ - "CREATE TABLE labelsettings("\ - "id INTEGER PRIMARY KEY,"\ - "name TEXT UNIQUE,"\ - "xml TEXT,"\ - "favorite INTEGER);"\ - "CREATE TABLE legendpatchshapes("\ - "id INTEGER PRIMARY KEY,"\ - "name TEXT UNIQUE,"\ - "xml TEXT,"\ - "favorite INTEGER);"\ - "CREATE TABLE symbol3d("\ - "id INTEGER PRIMARY KEY,"\ - "name TEXT UNIQUE,"\ - "xml TEXT,"\ - "favorite INTEGER);"\ - "CREATE TABLE tag("\ - "id INTEGER PRIMARY KEY,"\ - "name TEXT);"\ - "CREATE TABLE tagmap("\ - "tag_id INTEGER NOT NULL,"\ - "symbol_id INTEGER);"\ - "CREATE TABLE ctagmap("\ - "tag_id INTEGER NOT NULL,"\ - "colorramp_id INTEGER);"\ - "CREATE TABLE tftagmap("\ - "tag_id INTEGER NOT NULL,"\ - "textformat_id INTEGER);"\ - "CREATE TABLE lstagmap("\ - "tag_id INTEGER NOT NULL,"\ - "labelsettings_id INTEGER);"\ - "CREATE TABLE lpstagmap("\ - "tag_id INTEGER NOT NULL,"\ - "legendpatchshape_id INTEGER);"\ - "CREATE TABLE symbol3dtagmap("\ - "tag_id INTEGER NOT NULL,"\ - "symbol3d_id INTEGER);"\ - "CREATE TABLE smartgroup("\ - "id INTEGER PRIMARY KEY,"\ - "name TEXT,"\ - "xml TEXT);" ); + "id INTEGER PRIMARY KEY,"\ + "name TEXT UNIQUE,"\ + "xml TEXT,"\ + "favorite INTEGER);"\ + "CREATE TABLE colorramp("\ + "id INTEGER PRIMARY KEY,"\ + "name TEXT UNIQUE,"\ + "xml TEXT,"\ + "favorite INTEGER);"\ + "CREATE TABLE textformat("\ + "id INTEGER PRIMARY KEY,"\ + "name TEXT UNIQUE,"\ + "xml TEXT,"\ + "favorite INTEGER);"\ + "CREATE TABLE labelsettings("\ + "id INTEGER PRIMARY KEY,"\ + "name TEXT UNIQUE,"\ + "xml TEXT,"\ + "favorite INTEGER);"\ + "CREATE TABLE legendpatchshapes("\ + "id INTEGER PRIMARY KEY,"\ + "name TEXT UNIQUE,"\ + "xml TEXT,"\ + "favorite INTEGER);"\ + "CREATE TABLE symbol3d("\ + "id INTEGER PRIMARY KEY,"\ + "name TEXT UNIQUE,"\ + "xml TEXT,"\ + "favorite INTEGER);"\ + "CREATE TABLE tag("\ + "id INTEGER PRIMARY KEY,"\ + "name TEXT);"\ + "CREATE TABLE tagmap("\ + "tag_id INTEGER NOT NULL,"\ + "symbol_id INTEGER);"\ + "CREATE TABLE ctagmap("\ + "tag_id INTEGER NOT NULL,"\ + "colorramp_id INTEGER);"\ + "CREATE TABLE tftagmap("\ + "tag_id INTEGER NOT NULL,"\ + "textformat_id INTEGER);"\ + "CREATE TABLE lstagmap("\ + "tag_id INTEGER NOT NULL,"\ + "labelsettings_id INTEGER);"\ + "CREATE TABLE lpstagmap("\ + "tag_id INTEGER NOT NULL,"\ + "legendpatchshape_id INTEGER);"\ + "CREATE TABLE symbol3dtagmap("\ + "tag_id INTEGER NOT NULL,"\ + "symbol3d_id INTEGER);"\ + "CREATE TABLE smartgroup("\ + "id INTEGER PRIMARY KEY,"\ + "name TEXT,"\ + "xml TEXT);" ); runEmptyQuery( query ); } @@ -599,13 +599,13 @@ bool QgsStyle::load( const QString &filename ) if ( rc != SQLITE_OK || sqlite3_step( statement.get() ) != SQLITE_ROW ) { query = qgs_sqlite3_mprintf( "CREATE TABLE textformat("\ - "id INTEGER PRIMARY KEY,"\ - "name TEXT UNIQUE,"\ - "xml TEXT,"\ - "favorite INTEGER);"\ - "CREATE TABLE tftagmap("\ - "tag_id INTEGER NOT NULL,"\ - "textformat_id INTEGER);" ); + "id INTEGER PRIMARY KEY,"\ + "name TEXT UNIQUE,"\ + "xml TEXT,"\ + "favorite INTEGER);"\ + "CREATE TABLE tftagmap("\ + "tag_id INTEGER NOT NULL,"\ + "textformat_id INTEGER);" ); runEmptyQuery( query ); } // make sure label settings table exists @@ -614,13 +614,13 @@ bool QgsStyle::load( const QString &filename ) if ( rc != SQLITE_OK || sqlite3_step( statement.get() ) != SQLITE_ROW ) { query = qgs_sqlite3_mprintf( "CREATE TABLE labelsettings("\ - "id INTEGER PRIMARY KEY,"\ - "name TEXT UNIQUE,"\ - "xml TEXT,"\ - "favorite INTEGER);"\ - "CREATE TABLE lstagmap("\ - "tag_id INTEGER NOT NULL,"\ - "labelsettings_id INTEGER);" ); + "id INTEGER PRIMARY KEY,"\ + "name TEXT UNIQUE,"\ + "xml TEXT,"\ + "favorite INTEGER);"\ + "CREATE TABLE lstagmap("\ + "tag_id INTEGER NOT NULL,"\ + "labelsettings_id INTEGER);" ); runEmptyQuery( query ); } // make sure legend patch shape table exists @@ -629,13 +629,13 @@ bool QgsStyle::load( const QString &filename ) if ( rc != SQLITE_OK || sqlite3_step( statement.get() ) != SQLITE_ROW ) { query = qgs_sqlite3_mprintf( "CREATE TABLE legendpatchshapes("\ - "id INTEGER PRIMARY KEY,"\ - "name TEXT UNIQUE,"\ - "xml TEXT,"\ - "favorite INTEGER);"\ - "CREATE TABLE lpstagmap("\ - "tag_id INTEGER NOT NULL,"\ - "legendpatchshape_id INTEGER);" ); + "id INTEGER PRIMARY KEY,"\ + "name TEXT UNIQUE,"\ + "xml TEXT,"\ + "favorite INTEGER);"\ + "CREATE TABLE lpstagmap("\ + "tag_id INTEGER NOT NULL,"\ + "legendpatchshape_id INTEGER);" ); runEmptyQuery( query ); } // make sure 3d symbol table exists @@ -644,24 +644,24 @@ bool QgsStyle::load( const QString &filename ) if ( rc != SQLITE_OK || sqlite3_step( statement.get() ) != SQLITE_ROW ) { query = qgs_sqlite3_mprintf( "CREATE TABLE symbol3d("\ - "id INTEGER PRIMARY KEY,"\ - "name TEXT UNIQUE,"\ - "xml TEXT,"\ - "favorite INTEGER);"\ - "CREATE TABLE symbol3dtagmap("\ - "tag_id INTEGER NOT NULL,"\ - "symbol3d_id INTEGER);" ); + "id INTEGER PRIMARY KEY,"\ + "name TEXT UNIQUE,"\ + "xml TEXT,"\ + "favorite INTEGER);"\ + "CREATE TABLE symbol3dtagmap("\ + "tag_id INTEGER NOT NULL,"\ + "symbol3d_id INTEGER);" ); runEmptyQuery( query ); } // Make sure there are no Null fields in parenting symbols and groups query = qgs_sqlite3_mprintf( "UPDATE symbol SET favorite=0 WHERE favorite IS NULL;" - "UPDATE colorramp SET favorite=0 WHERE favorite IS NULL;" - "UPDATE textformat SET favorite=0 WHERE favorite IS NULL;" - "UPDATE labelsettings SET favorite=0 WHERE favorite IS NULL;" - "UPDATE legendpatchshapes SET favorite=0 WHERE favorite IS NULL;" - "UPDATE symbol3d SET favorite=0 WHERE favorite IS NULL;" - ); + "UPDATE colorramp SET favorite=0 WHERE favorite IS NULL;" + "UPDATE textformat SET favorite=0 WHERE favorite IS NULL;" + "UPDATE labelsettings SET favorite=0 WHERE favorite IS NULL;" + "UPDATE legendpatchshapes SET favorite=0 WHERE favorite IS NULL;" + "UPDATE symbol3d SET favorite=0 WHERE favorite IS NULL;" + ); runEmptyQuery( query ); { @@ -963,7 +963,7 @@ bool QgsStyle::saveTextFormat( const QString &name, const QgsTextFormat &format, stream.setCodec( "UTF-8" ); formatElem.save( stream, 4 ); QString query = qgs_sqlite3_mprintf( "INSERT INTO textformat VALUES (NULL, '%q', '%q', %d);", - name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) ); + name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) ); if ( !runEmptyQuery( query ) ) { QgsDebugMsg( QStringLiteral( "Couldn't insert text format into the database!" ) ); @@ -1037,7 +1037,7 @@ bool QgsStyle::saveLabelSettings( const QString &name, const QgsPalLayerSettings stream.setCodec( "UTF-8" ); settingsElem.save( stream, 4 ); QString query = qgs_sqlite3_mprintf( "INSERT INTO labelsettings VALUES (NULL, '%q', '%q', %d);", - name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) ); + name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) ); if ( !runEmptyQuery( query ) ) { QgsDebugMsg( QStringLiteral( "Couldn't insert label settings into the database!" ) ); @@ -1106,7 +1106,7 @@ bool QgsStyle::saveLegendPatchShape( const QString &name, const QgsLegendPatchSh stream.setCodec( "UTF-8" ); shapeElem.save( stream, 4 ); QString query = qgs_sqlite3_mprintf( "INSERT INTO legendpatchshapes VALUES (NULL, '%q', '%q', %d);", - name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) ); + name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) ); if ( !runEmptyQuery( query ) ) { QgsDebugMsg( QStringLiteral( "Couldn't insert legend patch shape into the database!" ) ); @@ -1224,7 +1224,7 @@ bool QgsStyle::saveSymbol3D( const QString &name, QgsAbstract3DSymbol *symbol, b stream.setCodec( "UTF-8" ); elem.save( stream, 4 ); QString query = qgs_sqlite3_mprintf( "INSERT INTO symbol3d VALUES (NULL, '%q', '%q', %d);", - name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) ); + name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) ); if ( !runEmptyQuery( query ) ) { QgsDebugMsg( QStringLiteral( "Couldn't insert 3d symbol into the database!" ) ); @@ -1331,7 +1331,7 @@ QStringList QgsStyle::symbolsWithTag( StyleEntity type, int tagid ) const default: subquery = qgs_sqlite3_mprintf( QStringLiteral( "SELECT %1 FROM %2 WHERE tag_id=%d" ).arg( tagmapEntityIdFieldName( type ), - tagmapTableName( type ) ).toLocal8Bit().data(), tagid ); + tagmapTableName( type ) ).toLocal8Bit().data(), tagid ); break; } @@ -1451,10 +1451,10 @@ bool QgsStyle::remove( StyleEntity type, int id ) default: query = qgs_sqlite3_mprintf( QStringLiteral( "DELETE FROM %1 WHERE id=%d; DELETE FROM %2 WHERE %3=%d" ).arg( - entityTableName( type ), - tagmapTableName( type ), - tagmapEntityIdFieldName( type ) - ).toLocal8Bit().data(), id, id ); + entityTableName( type ), + tagmapTableName( type ), + tagmapEntityIdFieldName( type ) + ).toLocal8Bit().data(), id, id ); break; } @@ -1617,7 +1617,7 @@ bool QgsStyle::addFavorite( StyleEntity type, const QString &name ) default: query = qgs_sqlite3_mprintf( QStringLiteral( "UPDATE %1 SET favorite=1 WHERE name='%q'" ).arg( entityTableName( type ) ).toLocal8Bit().data(), - name.toUtf8().constData() ); + name.toUtf8().constData() ); break; } @@ -1688,7 +1688,7 @@ QStringList QgsStyle::findSymbols( StyleEntity type, const QString &qword ) } QString query = qgs_sqlite3_mprintf( "SELECT name FROM %q WHERE name LIKE '%%%q%%'", - item.toUtf8().constData(), qword.toUtf8().constData() ); + item.toUtf8().constData(), qword.toUtf8().constData() ); sqlite3_statement_unique_ptr statement; int nErr; statement = mCurrentDB.prepare( query, nErr ); @@ -1709,9 +1709,9 @@ QStringList QgsStyle::findSymbols( StyleEntity type, const QString &qword ) tagids << statement.columnAsText( 0 ); } - QString dummy = tagids.join( QStringLiteral( ", " ) ); + QString dummy = tagids.join( QLatin1String( ", " ) ); query = qgs_sqlite3_mprintf( QStringLiteral( "SELECT %1 FROM %2 WHERE tag_id IN (%q)" ).arg( tagmapEntityIdFieldName( type ), - tagmapTableName( type ) ).toLocal8Bit().data(), dummy.toUtf8().constData() ); + tagmapTableName( type ) ).toLocal8Bit().data(), dummy.toUtf8().constData() ); statement = mCurrentDB.prepare( query, nErr ); @@ -1721,9 +1721,9 @@ QStringList QgsStyle::findSymbols( StyleEntity type, const QString &qword ) symbolids << statement.columnAsText( 0 ); } - dummy = symbolids.join( QStringLiteral( ", " ) ); + dummy = symbolids.join( QLatin1String( ", " ) ); query = qgs_sqlite3_mprintf( "SELECT name FROM %q WHERE id IN (%q)", - item.toUtf8().constData(), dummy.toUtf8().constData() ); + item.toUtf8().constData(), dummy.toUtf8().constData() ); statement = mCurrentDB.prepare( query, nErr ); while ( nErr == SQLITE_OK && sqlite3_step( statement.get() ) == SQLITE_ROW ) { @@ -2282,7 +2282,7 @@ int QgsStyle::addSmartgroup( const QString &name, const QString &op, const QStri stream.setCodec( "UTF-8" ); smartEl.save( stream, 4 ); QString query = qgs_sqlite3_mprintf( "INSERT INTO smartgroup VALUES (NULL, '%q', '%q')", - name.toUtf8().constData(), xmlArray.constData() ); + name.toUtf8().constData(), xmlArray.constData() ); if ( runEmptyQuery( query ) ) { @@ -2742,7 +2742,7 @@ bool QgsStyle::importXml( const QString &filename, int sinceVersion ) tags = e.attribute( QStringLiteral( "tags" ) ).split( ',' ); } bool favorite = false; - if ( e.hasAttribute( QStringLiteral( "favorite" ) ) && e.attribute( QStringLiteral( "favorite" ) ) == QStringLiteral( "1" ) ) + if ( e.hasAttribute( QStringLiteral( "favorite" ) ) && e.attribute( QStringLiteral( "favorite" ) ) == QLatin1String( "1" ) ) { favorite = true; } @@ -2797,7 +2797,7 @@ bool QgsStyle::importXml( const QString &filename, int sinceVersion ) tags = e.attribute( QStringLiteral( "tags" ) ).split( ',' ); } bool favorite = false; - if ( e.hasAttribute( QStringLiteral( "favorite" ) ) && e.attribute( QStringLiteral( "favorite" ) ) == QStringLiteral( "1" ) ) + if ( e.hasAttribute( QStringLiteral( "favorite" ) ) && e.attribute( QStringLiteral( "favorite" ) ) == QLatin1String( "1" ) ) { favorite = true; } @@ -2842,7 +2842,7 @@ bool QgsStyle::importXml( const QString &filename, int sinceVersion ) tags = e.attribute( QStringLiteral( "tags" ) ).split( ',' ); } bool favorite = false; - if ( e.hasAttribute( QStringLiteral( "favorite" ) ) && e.attribute( QStringLiteral( "favorite" ) ) == QStringLiteral( "1" ) ) + if ( e.hasAttribute( QStringLiteral( "favorite" ) ) && e.attribute( QStringLiteral( "favorite" ) ) == QLatin1String( "1" ) ) { favorite = true; } @@ -2887,7 +2887,7 @@ bool QgsStyle::importXml( const QString &filename, int sinceVersion ) tags = e.attribute( QStringLiteral( "tags" ) ).split( ',' ); } bool favorite = false; - if ( e.hasAttribute( QStringLiteral( "favorite" ) ) && e.attribute( QStringLiteral( "favorite" ) ) == QStringLiteral( "1" ) ) + if ( e.hasAttribute( QStringLiteral( "favorite" ) ) && e.attribute( QStringLiteral( "favorite" ) ) == QLatin1String( "1" ) ) { favorite = true; } @@ -2932,7 +2932,7 @@ bool QgsStyle::importXml( const QString &filename, int sinceVersion ) tags = e.attribute( QStringLiteral( "tags" ) ).split( ',' ); } bool favorite = false; - if ( e.hasAttribute( QStringLiteral( "favorite" ) ) && e.attribute( QStringLiteral( "favorite" ) ) == QStringLiteral( "1" ) ) + if ( e.hasAttribute( QStringLiteral( "favorite" ) ) && e.attribute( QStringLiteral( "favorite" ) ) == QLatin1String( "1" ) ) { favorite = true; } @@ -2977,7 +2977,7 @@ bool QgsStyle::importXml( const QString &filename, int sinceVersion ) tags = e.attribute( QStringLiteral( "tags" ) ).split( ',' ); } bool favorite = false; - if ( e.hasAttribute( QStringLiteral( "favorite" ) ) && e.attribute( QStringLiteral( "favorite" ) ) == QStringLiteral( "1" ) ) + if ( e.hasAttribute( QStringLiteral( "favorite" ) ) && e.attribute( QStringLiteral( "favorite" ) ) == QLatin1String( "1" ) ) { favorite = true; } @@ -3060,7 +3060,7 @@ bool QgsStyle::updateSymbol( StyleEntity type, const QString &name ) } symEl.save( stream, 4 ); query = qgs_sqlite3_mprintf( "UPDATE symbol SET xml='%q' WHERE name='%q';", - xmlArray.constData(), name.toUtf8().constData() ); + xmlArray.constData(), name.toUtf8().constData() ); break; } @@ -3083,7 +3083,7 @@ bool QgsStyle::updateSymbol( StyleEntity type, const QString &name ) } symEl.save( stream, 4 ); query = qgs_sqlite3_mprintf( "UPDATE symbol3d SET xml='%q' WHERE name='%q';", - xmlArray.constData(), name.toUtf8().constData() ); + xmlArray.constData(), name.toUtf8().constData() ); break; } @@ -3104,7 +3104,7 @@ bool QgsStyle::updateSymbol( StyleEntity type, const QString &name ) } symEl.save( stream, 4 ); query = qgs_sqlite3_mprintf( "UPDATE colorramp SET xml='%q' WHERE name='%q';", - xmlArray.constData(), name.toUtf8().constData() ); + xmlArray.constData(), name.toUtf8().constData() ); break; } @@ -3125,7 +3125,7 @@ bool QgsStyle::updateSymbol( StyleEntity type, const QString &name ) } symEl.save( stream, 4 ); query = qgs_sqlite3_mprintf( "UPDATE textformat SET xml='%q' WHERE name='%q';", - xmlArray.constData(), name.toUtf8().constData() ); + xmlArray.constData(), name.toUtf8().constData() ); break; } @@ -3146,7 +3146,7 @@ bool QgsStyle::updateSymbol( StyleEntity type, const QString &name ) } symEl.save( stream, 4 ); query = qgs_sqlite3_mprintf( "UPDATE labelsettings SET xml='%q' WHERE name='%q';", - xmlArray.constData(), name.toUtf8().constData() ); + xmlArray.constData(), name.toUtf8().constData() ); break; } @@ -3163,7 +3163,7 @@ bool QgsStyle::updateSymbol( StyleEntity type, const QString &name ) shape.writeXml( symEl, doc, QgsReadWriteContext() ); symEl.save( stream, 4 ); query = qgs_sqlite3_mprintf( "UPDATE legendpatchshapes SET xml='%q' WHERE name='%q';", - xmlArray.constData(), name.toUtf8().constData() ); + xmlArray.constData(), name.toUtf8().constData() ); break; } @@ -3230,9 +3230,9 @@ void QgsStyle::upgradeIfRequired() { // no metadata table query = qgs_sqlite3_mprintf( "CREATE TABLE stylemetadata("\ - "id INTEGER PRIMARY KEY,"\ - "key TEXT UNIQUE,"\ - "value TEXT);" ); + "id INTEGER PRIMARY KEY,"\ + "key TEXT UNIQUE,"\ + "value TEXT);" ); runEmptyQuery( query ); query = qgs_sqlite3_mprintf( "INSERT INTO stylemetadata VALUES (NULL, '%q', '%q')", "version", "31200" ); runEmptyQuery( query ); diff --git a/src/core/symbology/qgsstylemodel.cpp b/src/core/symbology/qgsstylemodel.cpp index 80534d51c140..2af70598e963 100644 --- a/src/core/symbology/qgsstylemodel.cpp +++ b/src/core/symbology/qgsstylemodel.cpp @@ -122,7 +122,7 @@ QVariant QgsStyleModel::data( const QModelIndex &index, int role ) const if ( role == Qt::ToolTipRole ) { QString tooltip = QStringLiteral( "

    %1

    %2" ).arg( name, - tags.count() > 0 ? tags.join( QStringLiteral( ", " ) ) : tr( "Not tagged" ) ); + tags.count() > 0 ? tags.join( QLatin1String( ", " ) ) : tr( "Not tagged" ) ); switch ( entityType ) { @@ -216,7 +216,7 @@ QVariant QgsStyleModel::data( const QModelIndex &index, int role ) const } } case Tags: - return mStyle->tagsOfSymbol( entityType, name ).join( QStringLiteral( ", " ) ); + return mStyle->tagsOfSymbol( entityType, name ).join( QLatin1String( ", " ) ); } return QVariant(); } diff --git a/src/core/symbology/qgssymbollayerutils.cpp b/src/core/symbology/qgssymbollayerutils.cpp index 830afb941562..9898039b65e7 100644 --- a/src/core/symbology/qgssymbollayerutils.cpp +++ b/src/core/symbology/qgssymbollayerutils.cpp @@ -3074,7 +3074,7 @@ QgsSymbol *QgsSymbolLayerUtils::symbolFromMimeData( const QMimeData *data ) { elem = doc.documentElement(); - if ( elem.nodeName() != QStringLiteral( "symbol" ) ) + if ( elem.nodeName() != QLatin1String( "symbol" ) ) elem = elem.firstChildElement( QStringLiteral( "symbol" ) ); return loadSymbol( elem, QgsReadWriteContext() ); @@ -3427,7 +3427,7 @@ QMimeData *QgsSymbolLayerUtils::colorListToMimeData( const QgsNamedColorList &co { colorListString << ( *colorIt ).first.name(); } - mimeData->setText( colorListString.join( QStringLiteral( "\n" ) ) ); + mimeData->setText( colorListString.join( QLatin1Char( '\n' ) ) ); //set mime color data to first color if ( colorList.length() > 0 ) diff --git a/src/core/textrenderer/qgstextformat.cpp b/src/core/textrenderer/qgstextformat.cpp index dc526bf29200..e37527c886dc 100644 --- a/src/core/textrenderer/qgstextformat.cpp +++ b/src/core/textrenderer/qgstextformat.cpp @@ -407,7 +407,7 @@ void QgsTextFormat::readXml( const QDomElement &elem, const QgsReadWriteContext { d->isValid = true; QDomElement textStyleElem; - if ( elem.nodeName() == QStringLiteral( "text-style" ) ) + if ( elem.nodeName() == QLatin1String( "text-style" ) ) textStyleElem = elem; else textStyleElem = elem.firstChildElement( QStringLiteral( "text-style" ) ); diff --git a/src/core/vectortile/qgsmapboxglstyleconverter.cpp b/src/core/vectortile/qgsmapboxglstyleconverter.cpp index 085930c222d8..782f6c3d1213 100644 --- a/src/core/vectortile/qgsmapboxglstyleconverter.cpp +++ b/src/core/vectortile/qgsmapboxglstyleconverter.cpp @@ -1944,7 +1944,7 @@ QString QgsMapBoxGlStyleConverter::parsePointStops( double base, const QVariantL interpolateExpression( bz.toDouble(), tz.toDouble(), bv.toList().value( 0 ).toDouble(), tv.toList().value( 0 ).toDouble(), base, multiplier ), interpolateExpression( bz.toDouble(), tz.toDouble(), bv.toList().value( 1 ).toDouble(), tv.toList().value( 1 ).toDouble(), base, multiplier ) ); } - caseString += QStringLiteral( "END" ); + caseString += QLatin1String( "END" ); return caseString; } @@ -2289,7 +2289,7 @@ QString QgsMapBoxGlStyleConverter::parseExpression( const QVariantList &expressi } if ( op == QLatin1String( "none" ) ) - return QStringLiteral( "NOT (%1)" ).arg( parts.join( QStringLiteral( ") AND NOT (" ) ) ); + return QStringLiteral( "NOT (%1)" ).arg( parts.join( QLatin1String( ") AND NOT (" ) ) ); QString operatorString; if ( op == QLatin1String( "all" ) ) @@ -2345,9 +2345,9 @@ QString QgsMapBoxGlStyleConverter::parseExpression( const QVariantList &expressi parts << part; } if ( op == QLatin1String( "in" ) ) - return QStringLiteral( "%1 IN (%2)" ).arg( key, parts.join( QStringLiteral( ", " ) ) ); + return QStringLiteral( "%1 IN (%2)" ).arg( key, parts.join( QLatin1String( ", " ) ) ); else - return QStringLiteral( "(%1 IS NULL OR %1 NOT IN (%2))" ).arg( key, parts.join( QStringLiteral( ", " ) ) ); + return QStringLiteral( "(%1 IS NULL OR %1 NOT IN (%2))" ).arg( key, parts.join( QLatin1String( ", " ) ) ); } else if ( op == QLatin1String( "get" ) ) { @@ -2490,8 +2490,8 @@ QString QgsMapBoxGlStyleConverter::retrieveSpriteAsBase64( const QVariant &value spriteProperty = QStringLiteral( "CASE" ); spriteSizeProperty = QStringLiteral( "CASE" ); - spriteName.replace( "(", QStringLiteral( "\\(" ) ); - spriteName.replace( ")", QStringLiteral( "\\)" ) ); + spriteName.replace( "(", QLatin1String( "\\(" ) ); + spriteName.replace( ")", QLatin1String( "\\)" ) ); spriteName.replace( fieldNameMatch, QStringLiteral( "([^\\/\\\\]+)" ) ); QRegularExpression fieldValueMatch( spriteName ); const QStringList spriteNames = context.spriteDefinitions().keys(); @@ -2518,8 +2518,8 @@ QString QgsMapBoxGlStyleConverter::retrieveSpriteAsBase64( const QVariant &value } } - spriteProperty += QStringLiteral( " END" ); - spriteSizeProperty += QStringLiteral( " END" ); + spriteProperty += QLatin1String( " END" ); + spriteSizeProperty += QLatin1String( " END" ); } else { diff --git a/src/core/vectortile/qgsvectortilelabeling.h b/src/core/vectortile/qgsvectortilelabeling.h index 2fba7d95b3a7..bc1a8a32e462 100644 --- a/src/core/vectortile/qgsvectortilelabeling.h +++ b/src/core/vectortile/qgsvectortilelabeling.h @@ -75,7 +75,7 @@ class CORE_EXPORT QgsVectorTileLabeling const QString type = sipCpp->type(); - if ( type == QStringLiteral( "basic" ) ) + if ( type == QLatin1String( "basic" ) ) sipType = sipType_QgsVectorTileBasicLabeling; else sipType = 0; diff --git a/src/core/vectortile/qgsvectortilelayer.cpp b/src/core/vectortile/qgsvectortilelayer.cpp index 8c49a5e69489..d1eec0519ded 100644 --- a/src/core/vectortile/qgsvectortilelayer.cpp +++ b/src/core/vectortile/qgsvectortilelayer.cpp @@ -51,12 +51,12 @@ bool QgsVectorTileLayer::loadDataSource() mSourceType = dsUri.param( QStringLiteral( "type" ) ); mSourcePath = dsUri.param( QStringLiteral( "url" ) ); - if ( mSourceType == QStringLiteral( "xyz" ) && dsUri.param( QStringLiteral( "serviceType" ) ) == QLatin1String( "arcgis" ) ) + if ( mSourceType == QLatin1String( "xyz" ) && dsUri.param( QStringLiteral( "serviceType" ) ) == QLatin1String( "arcgis" ) ) { if ( !setupArcgisVectorTileServiceConnection( mSourcePath, dsUri ) ) return false; } - else if ( mSourceType == QStringLiteral( "xyz" ) ) + else if ( mSourceType == QLatin1String( "xyz" ) ) { if ( !QgsVectorTileUtils::checkXYZUrlTemplate( mSourcePath ) ) { @@ -75,7 +75,7 @@ bool QgsVectorTileLayer::loadDataSource() setExtent( QgsRectangle( -20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892 ) ); } - else if ( mSourceType == QStringLiteral( "mbtiles" ) ) + else if ( mSourceType == QLatin1String( "mbtiles" ) ) { QgsMbTiles reader( mSourcePath ); if ( !reader.open() ) @@ -85,7 +85,7 @@ bool QgsVectorTileLayer::loadDataSource() } QString format = reader.metadataValue( QStringLiteral( "format" ) ); - if ( format != QStringLiteral( "pbf" ) ) + if ( format != QLatin1String( "pbf" ) ) { QgsDebugMsg( QStringLiteral( "Cannot open MBTiles for vector tiles. Format = " ) + format ); return false; @@ -230,7 +230,7 @@ bool QgsVectorTileLayer::readSymbology( const QDomNode &node, QString &errorMess if ( categories.testFlag( Symbology ) ) { QgsVectorTileRenderer *r = nullptr; - if ( rendererType == QStringLiteral( "basic" ) ) + if ( rendererType == QLatin1String( "basic" ) ) r = new QgsVectorTileBasicRenderer; else { @@ -250,7 +250,7 @@ bool QgsVectorTileLayer::readSymbology( const QDomNode &node, QString &errorMess { const QString labelingType = elemLabeling.attribute( QStringLiteral( "type" ) ); QgsVectorTileLabeling *labeling = nullptr; - if ( labelingType == QStringLiteral( "basic" ) ) + if ( labelingType == QLatin1String( "basic" ) ) labeling = new QgsVectorTileBasicLabeling; else { @@ -320,7 +320,7 @@ bool QgsVectorTileLayer::loadDefaultStyle( QString &error, QStringList &warnings { styleUrl = dsUri.param( QStringLiteral( "styleUrl" ) ); } - else if ( mSourceType == QStringLiteral( "xyz" ) && dsUri.param( QStringLiteral( "serviceType" ) ) == QLatin1String( "arcgis" ) ) + else if ( mSourceType == QLatin1String( "xyz" ) && dsUri.param( QStringLiteral( "serviceType" ) ) == QLatin1String( "arcgis" ) ) { // for ArcMap VectorTileServices we default to the defaultStyles URL from the layer configuration styleUrl = mArcgisLayerConfiguration.value( QStringLiteral( "serviceUri" ) ).toString() @@ -360,7 +360,7 @@ bool QgsVectorTileLayer::loadDefaultStyle( QString &error, QStringList &warnings { // retrieve sprite definition QString spriteUriBase; - if ( styleDefinition.value( QStringLiteral( "sprite" ) ).toString().startsWith( QStringLiteral( "http" ) ) ) + if ( styleDefinition.value( QStringLiteral( "sprite" ) ).toString().startsWith( QLatin1String( "http" ) ) ) { spriteUriBase = styleDefinition.value( QStringLiteral( "sprite" ) ).toString(); } @@ -442,7 +442,7 @@ QString QgsVectorTileLayer::loadDefaultMetadata( bool &resultFlag ) { QgsDataSourceUri dsUri; dsUri.setEncodedUri( mDataSource ); - if ( mSourceType == QStringLiteral( "xyz" ) && dsUri.param( QStringLiteral( "serviceType" ) ) == QLatin1String( "arcgis" ) ) + if ( mSourceType == QLatin1String( "xyz" ) && dsUri.param( QStringLiteral( "serviceType" ) ) == QLatin1String( "arcgis" ) ) { // populate default metadata QgsLayerMetadata metadata; @@ -479,7 +479,7 @@ QString QgsVectorTileLayer::encodedSource( const QString &source, const QgsReadW QString sourceType = dsUri.param( QStringLiteral( "type" ) ); QString sourcePath = dsUri.param( QStringLiteral( "url" ) ); - if ( sourceType == QStringLiteral( "xyz" ) ) + if ( sourceType == QLatin1String( "xyz" ) ) { QUrl sourceUrl( sourcePath ); if ( sourceUrl.isLocalFile() ) @@ -491,7 +491,7 @@ QString QgsVectorTileLayer::encodedSource( const QString &source, const QgsReadW return dsUri.encodedUri(); } } - else if ( sourceType == QStringLiteral( "mbtiles" ) ) + else if ( sourceType == QLatin1String( "mbtiles" ) ) { sourcePath = context.pathResolver().writePath( sourcePath ); dsUri.removeParam( QStringLiteral( "url" ) ); // needed because setParam() would insert second "url" key @@ -511,7 +511,7 @@ QString QgsVectorTileLayer::decodedSource( const QString &source, const QString QString sourceType = dsUri.param( QStringLiteral( "type" ) ); QString sourcePath = dsUri.param( QStringLiteral( "url" ) ); - if ( sourceType == QStringLiteral( "xyz" ) ) + if ( sourceType == QLatin1String( "xyz" ) ) { QUrl sourceUrl( sourcePath ); if ( sourceUrl.isLocalFile() ) // file-based URL? convert to relative path @@ -522,7 +522,7 @@ QString QgsVectorTileLayer::decodedSource( const QString &source, const QString return dsUri.encodedUri(); } } - else if ( sourceType == QStringLiteral( "mbtiles" ) ) + else if ( sourceType == QLatin1String( "mbtiles" ) ) { sourcePath = context.pathResolver().readPath( sourcePath ); dsUri.removeParam( QStringLiteral( "url" ) ); // needed because setParam() would insert second "url" key @@ -552,10 +552,10 @@ QString QgsVectorTileLayer::htmlMetadata() const info += QStringLiteral( "

    \n" ); info += QStringLiteral( "\n" ); - info += QStringLiteral( "
    " ) + tr( "ID" ) + QLatin1String( "" ) + tr( "Name" ) + QLatin1String( "" ) + tr( "Type" ) + QLatin1String( "" ) + tr( "URL" ) + QLatin1String( "" ) + tr( "Description" ) + QLatin1String( "" ) + tr( "Format" ) + QLatin1String( "" ) + tr( "MIME Type" ) + QLatin1String( "" ) + tr( "Size" ) + QLatin1String( "
    " ) + tr( "Dimensions" ) + QStringLiteral( "" ); @@ -634,7 +634,7 @@ QString QgsGdalProvider::htmlMetadata() .arg( GDALGetRasterXSize( mGdalDataset ) ) .arg( GDALGetRasterYSize( mGdalDataset ) ) .arg( GDALGetRasterCount( mGdalDataset ) ); - myMetadata += QStringLiteral( "
    " ) % tr( "n/a" ) % QStringLiteral( "" ) % tr( "n/a" ) % QStringLiteral( "
    " ) % tr( "Source path" ) % QStringLiteral( "%1" ).arg( QStringLiteral( "%2" ).arg( QUrl( url ).toString(), sourcePath() ) ) + QStringLiteral( "
    " ) % tr( "Zoom levels" ) % QStringLiteral( "" ) % QStringLiteral( "%1 - %2" ).arg( sourceMinZoom() ).arg( sourceMaxZoom() ) % QStringLiteral( "
    " ); + info += QLatin1String( "
    " ); // End Provider section - info += QStringLiteral( "\n

    " ); + info += QLatin1String( "\n

    " ); // Identification section info += QStringLiteral( "

    " ) % tr( "Identification" ) % QStringLiteral( "

    \n
    \n" ) % diff --git a/src/core/vectortile/qgsvectortilelayerrenderer.cpp b/src/core/vectortile/qgsvectortilelayerrenderer.cpp index 98e94c574c94..f3bc64721d59 100644 --- a/src/core/vectortile/qgsvectortilelayerrenderer.cpp +++ b/src/core/vectortile/qgsvectortilelayerrenderer.cpp @@ -103,7 +103,7 @@ bool QgsVectorTileLayerRenderer::render() return true; // nothing to do } - bool isAsync = ( mSourceType == QStringLiteral( "xyz" ) ); + bool isAsync = ( mSourceType == QLatin1String( "xyz" ) ); std::unique_ptr asyncLoader; QList rawTiles; diff --git a/src/core/vectortile/qgsvectortileloader.cpp b/src/core/vectortile/qgsvectortileloader.cpp index 6136396c2303..8c2490850d46 100644 --- a/src/core/vectortile/qgsvectortileloader.cpp +++ b/src/core/vectortile/qgsvectortileloader.cpp @@ -161,7 +161,7 @@ QList QgsVectorTileLoader::blockingFetchTileRawData( const QList rawTiles; QgsMbTiles mbReader( sourcePath ); - bool isUrl = ( sourceType == QStringLiteral( "xyz" ) ); + bool isUrl = ( sourceType == QLatin1String( "xyz" ) ); if ( !isUrl ) { bool res = mbReader.open(); diff --git a/src/core/vectortile/qgsvectortilerenderer.h b/src/core/vectortile/qgsvectortilerenderer.h index 9baf7d60ac30..7b9830ae4403 100644 --- a/src/core/vectortile/qgsvectortilerenderer.h +++ b/src/core/vectortile/qgsvectortilerenderer.h @@ -93,7 +93,7 @@ class CORE_EXPORT QgsVectorTileRenderer const QString type = sipCpp->type(); - if ( type == QStringLiteral( "basic" ) ) + if ( type == QLatin1String( "basic" ) ) sipType = sipType_QgsVectorTileBasicRenderer; else sipType = 0; diff --git a/src/core/vectortile/qgsvectortilewriter.cpp b/src/core/vectortile/qgsvectortilewriter.cpp index 36e583526ca3..f1dde6a50e13 100644 --- a/src/core/vectortile/qgsvectortilewriter.cpp +++ b/src/core/vectortile/qgsvectortilewriter.cpp @@ -58,7 +58,7 @@ bool QgsVectorTileWriter::writeTiles( QgsFeedback *feedback ) QString sourceType = dsUri.param( QStringLiteral( "type" ) ); QString sourcePath = dsUri.param( QStringLiteral( "url" ) ); - if ( sourceType == QStringLiteral( "xyz" ) ) + if ( sourceType == QLatin1String( "xyz" ) ) { // remove the initial file:// scheme sourcePath = QUrl( sourcePath ).toLocalFile(); @@ -69,7 +69,7 @@ bool QgsVectorTileWriter::writeTiles( QgsFeedback *feedback ) return false; } } - else if ( sourceType == QStringLiteral( "mbtiles" ) ) + else if ( sourceType == QLatin1String( "mbtiles" ) ) { mbtiles.reset( new QgsMbTiles( sourcePath ) ); } @@ -194,7 +194,7 @@ bool QgsVectorTileWriter::writeTiles( QgsFeedback *feedback ) continue; } - if ( sourceType == QStringLiteral( "xyz" ) ) + if ( sourceType == QLatin1String( "xyz" ) ) { if ( !writeTileFileXYZ( sourcePath, tileID, tileMatrix, tileData ) ) return false; // error message already set diff --git a/src/crashhandler/qgscrashreport.cpp b/src/crashhandler/qgscrashreport.cpp index 5655efe5d613..bffa33b21d68 100644 --- a/src/crashhandler/qgscrashreport.cpp +++ b/src/crashhandler/qgscrashreport.cpp @@ -181,7 +181,7 @@ QString QgsCrashReport::htmlToMarkdown( const QString &html ) int offset = 0; while ( hrefRegEx.indexIn( converted, offset ) != -1 ) { - QString url = hrefRegEx.cap( 1 ).replace( QStringLiteral( "\"" ), QString() ); + QString url = hrefRegEx.cap( 1 ).replace( QLatin1String( "\"" ), QString() ); url.replace( '\'', QString() ); QString name = hrefRegEx.cap( 2 ); QString anchor = QStringLiteral( "[%1](%2)" ).arg( name, url ); diff --git a/src/gui/auth/qgsauthcertificateinfo.cpp b/src/gui/auth/qgsauthcertificateinfo.cpp index 16726d7ea9e2..e1ed0f8a67af 100644 --- a/src/gui/auth/qgsauthcertificateinfo.cpp +++ b/src/gui/auth/qgsauthcertificateinfo.cpp @@ -595,7 +595,7 @@ void QgsAuthCertInfo::populateInfoDetailsSection() altslist << dns + dnss.join( '\n' + dns ); } addFieldItem( mGrpSubj, tr( "Alternate names" ), - altslist.join( QStringLiteral( "\n" ) ), + altslist.join( QLatin1Char( '\n' ) ), TextEdit ); // Issuer Info @@ -677,21 +677,21 @@ void QgsAuthCertInfo::populateInfoDetailsSection() if ( !crllocs.isEmpty() ) { addFieldItem( mGrpCert, tr( "CRL locations" ), - crllocs.join( QStringLiteral( "\n" ) ), + crllocs.join( QLatin1Char( '\n' ) ), TextEdit ); } QStringList issulocs( mCurrentACert.issuerLocations() ); if ( !issulocs.isEmpty() ) { addFieldItem( mGrpCert, tr( "Issuer locations" ), - issulocs.join( QStringLiteral( "\n" ) ), + issulocs.join( QLatin1Char( '\n' ) ), TextEdit ); } QStringList ocsplocs( mCurrentACert.ocspLocations() ); if ( !ocsplocs.isEmpty() ) { addFieldItem( mGrpCert, tr( "OCSP locations" ), - ocsplocs.join( QStringLiteral( "\n" ) ), + ocsplocs.join( QLatin1Char( '\n' ) ), TextEdit ); } @@ -764,7 +764,7 @@ void QgsAuthCertInfo::populateInfoDetailsSection() if ( !usage.isEmpty() ) { addFieldItem( mGrpPkey, tr( "Key usage" ), - usage.join( QStringLiteral( ", " ) ), + usage.join( QLatin1String( ", " ) ), LineEdit ); } } @@ -774,7 +774,7 @@ void QgsAuthCertInfo::populateInfoDetailsSection() basicconst << tr( "Certificate Authority: %1" ).arg( mCurrentACert.isCA() ? tr( "Yes" ) : tr( "No" ) ) << tr( "Chain Path Limit: %1" ).arg( mCurrentACert.pathLimit() ); addFieldItem( mGrpExts, tr( "Basic constraints" ), - basicconst.join( QStringLiteral( "\n" ) ), + basicconst.join( QLatin1Char( '\n' ) ), TextEdit ); QStringList keyusage; @@ -795,13 +795,13 @@ void QgsAuthCertInfo::populateInfoDetailsSection() if ( !keyusage.isEmpty() ) { addFieldItem( mGrpExts, tr( "Key usage" ), - keyusage.join( QStringLiteral( "\n" ) ), + keyusage.join( QLatin1Char( '\n' ) ), TextEdit ); } if ( !extkeyusage.isEmpty() ) { addFieldItem( mGrpExts, tr( "Extended key usage" ), - extkeyusage.join( QStringLiteral( "\n" ) ), + extkeyusage.join( QLatin1Char( '\n' ) ), TextEdit ); } diff --git a/src/gui/auth/qgsautheditorwidgets.cpp b/src/gui/auth/qgsautheditorwidgets.cpp index f60d06946538..f5082e8d0d2c 100644 --- a/src/gui/auth/qgsautheditorwidgets.cpp +++ b/src/gui/auth/qgsautheditorwidgets.cpp @@ -90,7 +90,7 @@ void QgsAuthMethodPlugins::populateTable() twi->setFlags( twi->flags() & ~Qt::ItemIsEditable ); tblAuthPlugins->setItem( i, 1, twi ); - twi = new QTableWidgetItem( authmethod->supportedDataProviders().join( QStringLiteral( ", " ) ) ); + twi = new QTableWidgetItem( authmethod->supportedDataProviders().join( QLatin1String( ", " ) ) ); twi->setFlags( twi->flags() & ~Qt::ItemIsEditable ); tblAuthPlugins->setItem( i, 2, twi ); } diff --git a/src/gui/auth/qgsauthsslerrorsdialog.cpp b/src/gui/auth/qgsauthsslerrorsdialog.cpp index dbb103bdf343..04dc97c8adcd 100644 --- a/src/gui/auth/qgsauthsslerrorsdialog.cpp +++ b/src/gui/auth/qgsauthsslerrorsdialog.cpp @@ -213,7 +213,7 @@ void QgsAuthSslErrorsDialog::populateErrorsList() .arg( QgsAuthCertUtils::sslErrorEnumString( err.error() ), err.errorString() ); } - teSslErrors->setPlainText( errs.join( QStringLiteral( "\n" ) ) ); + teSslErrors->setPlainText( errs.join( QLatin1Char( '\n' ) ) ); } QPushButton *QgsAuthSslErrorsDialog::ignoreButton() diff --git a/src/gui/codeeditors/qgscodeeditor.cpp b/src/gui/codeeditors/qgscodeeditor.cpp index 2e3d0940ba23..3f59ddde0446 100644 --- a/src/gui/codeeditors/qgscodeeditor.cpp +++ b/src/gui/codeeditors/qgscodeeditor.cpp @@ -296,7 +296,7 @@ void QgsCodeEditor::insertText( const QString &text ) QColor QgsCodeEditor::defaultColor( QgsCodeEditorColorScheme::ColorRole role, const QString &theme ) { - if ( theme.isEmpty() && QgsApplication::instance()->themeName() == QStringLiteral( "default" ) ) + if ( theme.isEmpty() && QgsApplication::instance()->themeName() == QLatin1String( "default" ) ) { // if using default theme, take certain colors from the palette QPalette pal = qApp->palette(); diff --git a/src/gui/codeeditors/qgscodeeditorpython.cpp b/src/gui/codeeditors/qgscodeeditorpython.cpp index c628ff656fdb..046e0ad7d310 100644 --- a/src/gui/codeeditors/qgscodeeditorpython.cpp +++ b/src/gui/codeeditors/qgscodeeditorpython.cpp @@ -235,7 +235,7 @@ void QgsCodeEditorPython::searchSelectedTextInPyQGISDocs() return; QString text = selectedText(); - text = text.replace( QStringLiteral( ">>> " ), QString() ).replace( QStringLiteral( "... " ), QString() ).trimmed(); // removing prompts + text = text.replace( QLatin1String( ">>> " ), QString() ).replace( QLatin1String( "... " ), QString() ).trimmed(); // removing prompts const QString version = QString( Qgis::version() ).split( '.' ).mid( 0, 2 ).join( '.' ); QDesktopServices::openUrl( QUrl( QStringLiteral( "https://qgis.org/pyqgis/%1/search.html?q=%2" ).arg( version, text ) ) ); } diff --git a/src/gui/editorwidgets/core/qgseditorwidgetwrapper.cpp b/src/gui/editorwidgets/core/qgseditorwidgetwrapper.cpp index a2d3340b82d1..131cd2ddd84a 100644 --- a/src/gui/editorwidgets/core/qgseditorwidgetwrapper.cpp +++ b/src/gui/editorwidgets/core/qgseditorwidgetwrapper.cpp @@ -241,16 +241,16 @@ void QgsEditorWidgetWrapper::updateConstraint( const QgsVectorLayer *layer, int mValidConstraint = hardConstraintsOk && softConstraintsOk; mIsBlockingCommit = !hardConstraintsOk; - mConstraintFailureReason = errors.join( QStringLiteral( ", " ) ); + mConstraintFailureReason = errors.join( QLatin1String( ", " ) ); if ( toEmit ) { QString errStr = errors.isEmpty() ? tr( "Constraint checks passed" ) : mConstraintFailureReason; - QString description = descriptions.join( QStringLiteral( ", " ) ); + QString description = descriptions.join( QLatin1String( ", " ) ); QString expressionDesc; if ( expressions.size() > 1 ) - expressionDesc = "( " + expressions.join( QStringLiteral( " ) AND ( " ) ) + " )"; + expressionDesc = "( " + expressions.join( QLatin1String( " ) AND ( " ) ) + " )"; else if ( !expressions.isEmpty() ) expressionDesc = expressions.at( 0 ); diff --git a/src/gui/editorwidgets/qgsrelationreferencewidget.cpp b/src/gui/editorwidgets/qgsrelationreferencewidget.cpp index 1c0f72b9ba9e..08de839203f3 100644 --- a/src/gui/editorwidgets/qgsrelationreferencewidget.cpp +++ b/src/gui/editorwidgets/qgsrelationreferencewidget.cpp @@ -298,7 +298,7 @@ void QgsRelationReferenceWidget::setForeignKeys( const QVariantList &values ) QStringList titleFields; for ( const QString &fieldName : qgis::as_const( mReferencedFields ) ) titleFields << mFeature.attribute( fieldName ).toString(); - title = titleFields.join( QStringLiteral( " " ) ); + title = titleFields.join( QLatin1Char( ' ' ) ); } mLineEdit->setText( title ); } @@ -772,7 +772,7 @@ void QgsRelationReferenceWidget::featureIdentified( const QgsFeature &feature ) QStringList titleFields; for ( const QString &fieldName : qgis::as_const( mReferencedFields ) ) titleFields << mFeature.attribute( fieldName ).toString(); - title = titleFields.join( QStringLiteral( " " ) ); + title = titleFields.join( QLatin1Char( ' ' ) ); } mLineEdit->setText( title ); mForeignKeys.clear(); @@ -927,10 +927,10 @@ void QgsRelationReferenceWidget::filterChanged() QString expression = filterExpression; if ( ! filterExpression.isEmpty() && ! filtersAttrs.values().isEmpty() ) - expression += QStringLiteral( " AND " ); + expression += QLatin1String( " AND " ); expression += filtersAttrs.isEmpty() ? QString() : QStringLiteral( " ( " ); - expression += filtersAttrs.values().join( QStringLiteral( " AND " ) ); + expression += filtersAttrs.values().join( QLatin1String( " AND " ) ); expression += filtersAttrs.isEmpty() ? QString() : QStringLiteral( " ) " ); subset << mReferencedLayer->fields().lookupField( fieldName ); @@ -963,10 +963,10 @@ void QgsRelationReferenceWidget::filterChanged() } if ( ! filterExpression.isEmpty() && ! filters.values().isEmpty() ) - filterExpression += QStringLiteral( " AND " ); + filterExpression += QLatin1String( " AND " ); filterExpression += filters.isEmpty() ? QString() : QStringLiteral( " ( " ); - filterExpression += filters.values().join( QStringLiteral( " AND " ) ); + filterExpression += filters.values().join( QLatin1String( " AND " ) ); filterExpression += filters.isEmpty() ? QString() : QStringLiteral( " ) " ); mComboBox->setFilterExpression( filterExpression ); diff --git a/src/gui/editorwidgets/qgssearchwidgettoolbutton.cpp b/src/gui/editorwidgets/qgssearchwidgettoolbutton.cpp index 1b2b89b7ae05..1a4bfb89c493 100644 --- a/src/gui/editorwidgets/qgssearchwidgettoolbutton.cpp +++ b/src/gui/editorwidgets/qgssearchwidgettoolbutton.cpp @@ -248,7 +248,7 @@ void QgsSearchWidgetToolButton::updateState() if ( active ) { - QString text = toolTips.join( QStringLiteral( ", " ) ); + QString text = toolTips.join( QLatin1String( ", " ) ); setText( text ); setToolTip( text ); } diff --git a/src/gui/editorwidgets/qgstexteditwrapper.cpp b/src/gui/editorwidgets/qgstexteditwrapper.cpp index f916f660c766..44853cb1f281 100644 --- a/src/gui/editorwidgets/qgstexteditwrapper.cpp +++ b/src/gui/editorwidgets/qgstexteditwrapper.cpp @@ -292,7 +292,7 @@ void QgsTextEditWrapper::setWidgetValue( const QVariant &val ) // uses QJsonDocument which doesn't recognise this as valid JSON although it technically is if ( field().displayString( val ).isEmpty() ) { - if ( val.type() == QVariant::String && val.toString() != QStringLiteral( "\"\"" ) ) + if ( val.type() == QVariant::String && val.toString() != QLatin1String( "\"\"" ) ) { v = val.toString().append( "\"" ).insert( 0, "\"" ); } diff --git a/src/gui/layertree/qgscustomlayerorderwidget.cpp b/src/gui/layertree/qgscustomlayerorderwidget.cpp index b0006dee84c7..2e4a285143ba 100644 --- a/src/gui/layertree/qgscustomlayerorderwidget.cpp +++ b/src/gui/layertree/qgscustomlayerorderwidget.cpp @@ -173,7 +173,7 @@ QMimeData *CustomLayerOrderModel::mimeData( const QModelIndexList &indexes ) con lst << data( index, Qt::UserRole + 1 ).toString(); QMimeData *mimeData = new QMimeData(); - mimeData->setData( QStringLiteral( "application/qgis.layerorderdata" ), lst.join( QStringLiteral( "\n" ) ).toUtf8() ); + mimeData->setData( QStringLiteral( "application/qgis.layerorderdata" ), lst.join( QLatin1Char( '\n' ) ).toUtf8() ); return mimeData; } diff --git a/src/gui/layertree/qgslayertreeview.cpp b/src/gui/layertree/qgslayertreeview.cpp index de6f38c238e3..7b0a6f9f5469 100644 --- a/src/gui/layertree/qgslayertreeview.cpp +++ b/src/gui/layertree/qgslayertreeview.cpp @@ -303,7 +303,7 @@ void QgsLayerTreeView::onExpandedChanged( QgsLayerTreeNode *node, bool expanded void QgsLayerTreeView::onCustomPropertyChanged( QgsLayerTreeNode *node, const QString &key ) { - if ( key != QStringLiteral( "expandedLegendNodes" ) || !QgsLayerTree::isLayer( node ) ) + if ( key != QLatin1String( "expandedLegendNodes" ) || !QgsLayerTree::isLayer( node ) ) return; QSet expandedLegendNodes = qgis::listToSet( node->customProperty( QStringLiteral( "expandedLegendNodes" ) ).toStringList() ); diff --git a/src/gui/layout/qgslayoutattributeselectiondialog.cpp b/src/gui/layout/qgslayoutattributeselectiondialog.cpp index 306ac8c6e4fd..3faa03439be0 100644 --- a/src/gui/layout/qgslayoutattributeselectiondialog.cpp +++ b/src/gui/layout/qgslayoutattributeselectiondialog.cpp @@ -149,7 +149,7 @@ QVariant QgsLayoutAttributeTableColumnModelBase::data( const QModelIndex &index, { if ( role == Qt::DisplayRole ) { - return column.width() <= 0 ? tr( "Automatic" ) : QString( tr( "%1 mm" ) ).arg( column.width(), 0, 'f', 2 ); + return column.width() <= 0 ? tr( "Automatic" ) : tr( "%1 mm" ).arg( column.width(), 0, 'f', 2 ); } else { diff --git a/src/gui/layout/qgslayoutmapwidget.cpp b/src/gui/layout/qgslayoutmapwidget.cpp index ef9901a539bb..cc5d5ab641b5 100644 --- a/src/gui/layout/qgslayoutmapwidget.cpp +++ b/src/gui/layout/qgslayoutmapwidget.cpp @@ -1458,7 +1458,7 @@ void QgsLayoutMapWidget::mOverviewListWidget_itemChanged( QListWidgetItem *item if ( item->isSelected() ) { //update checkbox title if item is current item - mOverviewCheckBox->setTitle( QString( tr( "Draw \"%1\" overview" ) ).arg( overview->name() ) ); + mOverviewCheckBox->setTitle( tr( "Draw \"%1\" overview" ).arg( overview->name() ) ); } } @@ -1498,7 +1498,7 @@ void QgsLayoutMapWidget::setOverviewItems( QgsLayoutItemMapOverview *overview ) blockOverviewItemsSignals( true ); - mOverviewCheckBox->setTitle( QString( tr( "Draw \"%1\" overview" ) ).arg( overview->name() ) ); + mOverviewCheckBox->setTitle( tr( "Draw \"%1\" overview" ).arg( overview->name() ) ); mOverviewCheckBox->setChecked( overview->enabled() ); //overview frame diff --git a/src/gui/mesh/qgsmeshlayerproperties.cpp b/src/gui/mesh/qgsmeshlayerproperties.cpp index ae1d3c755f5c..f67e8a6f56ca 100644 --- a/src/gui/mesh/qgsmeshlayerproperties.cpp +++ b/src/gui/mesh/qgsmeshlayerproperties.cpp @@ -162,13 +162,13 @@ void QgsMeshLayerProperties::syncToLayer() QString info; if ( mMeshLayer->dataProvider() ) { - info += QStringLiteral( "" ); + info += QLatin1String( "
    " ); info += QStringLiteral( "" ).arg( tr( "Uri" ) ).arg( mMeshLayer->dataProvider()->dataSourceUri() ); info += QStringLiteral( "" ).arg( tr( "Vertex count" ) ).arg( mMeshLayer->dataProvider()->vertexCount() ); info += QStringLiteral( "" ).arg( tr( "Face count" ) ).arg( mMeshLayer->dataProvider()->faceCount() ); info += QStringLiteral( "" ).arg( tr( "Edge count" ) ).arg( mMeshLayer->dataProvider()->edgeCount() ); info += QStringLiteral( "" ).arg( tr( "Dataset groups count" ) ).arg( mMeshLayer->dataProvider()->datasetGroupCount() ); - info += QStringLiteral( "
    %1: %2
    %1: %2
    %1: %2
    %1: %2
    %1: %2
    " ); + info += QLatin1String( "" ); } else { diff --git a/src/gui/mesh/qgsmeshrendereractivedatasetwidget.cpp b/src/gui/mesh/qgsmeshrendereractivedatasetwidget.cpp index b1d835214768..c0828ed65831 100644 --- a/src/gui/mesh/qgsmeshrendereractivedatasetwidget.cpp +++ b/src/gui/mesh/qgsmeshrendereractivedatasetwidget.cpp @@ -115,7 +115,7 @@ void QgsMeshRendererActiveDatasetWidget::updateMetadata() msg += metadata( mActiveScalarDatasetGroup ); msg += QStringLiteral( "

    %1

    " ).arg( tr( "Vector dataset" ) ); msg += metadata( mActiveVectorDatasetGroup ); - msg += QStringLiteral( "

    " ); + msg += QLatin1String( "

    " ); } } else @@ -144,7 +144,7 @@ QString QgsMeshRendererActiveDatasetWidget::metadata( QgsMeshDatasetIndex datase { QString msg; - msg += QStringLiteral( "" ); + msg += QLatin1String( "
    " ); QString definedOnMesh; if ( mMeshLayer->dataProvider()->contains( QgsMesh::ElementType::Face ) ) @@ -198,7 +198,7 @@ QString QgsMeshRendererActiveDatasetWidget::metadata( QgsMeshDatasetIndex datase const auto options = gmeta.extraOptions(); for ( auto it = options.constBegin(); it != options.constEnd(); ++it ) { - if ( it.key() == QStringLiteral( "classification" ) ) + if ( it.key() == QLatin1String( "classification" ) ) { msg += QStringLiteral( "" ).arg( tr( "Classified values" ) ); continue; @@ -206,7 +206,7 @@ QString QgsMeshRendererActiveDatasetWidget::metadata( QgsMeshDatasetIndex datase msg += QStringLiteral( "" ).arg( it.key() ).arg( it.value() ); } - msg += QStringLiteral( "
    %1
    %1%2
    " ); + msg += QLatin1String( "" ); return msg; } diff --git a/src/gui/ogr/qgsogrhelperfunctions.cpp b/src/gui/ogr/qgsogrhelperfunctions.cpp index bfc49163d2d9..07dc56be0dd6 100644 --- a/src/gui/ogr/qgsogrhelperfunctions.cpp +++ b/src/gui/ogr/qgsogrhelperfunctions.cpp @@ -294,7 +294,7 @@ QString createProtocolURI( const QString &type, const QString &url, const QStrin } else if ( !( username.isEmpty() || password.isEmpty( ) ) ) { - uri.replace( QStringLiteral( "://" ), QStringLiteral( "://%1:%2@" ).arg( username, password ) ); + uri.replace( QLatin1String( "://" ), QStringLiteral( "://%1:%2@" ).arg( username, password ) ); } return uri; } diff --git a/src/gui/processing/models/qgsmodeldesignerdialog.cpp b/src/gui/processing/models/qgsmodeldesignerdialog.cpp index 15bcf24510c1..b8000e5ab39a 100644 --- a/src/gui/processing/models/qgsmodeldesignerdialog.cpp +++ b/src/gui/processing/models/qgsmodeldesignerdialog.cpp @@ -807,7 +807,7 @@ void QgsModelDesignerDialog::validate() { longMessage += QStringLiteral( "
  4. %1
  5. " ).arg( issue ); } - longMessage += QStringLiteral( "" ); + longMessage += QLatin1String( "" ); dialog->setMessage( longMessage, QgsMessageOutput::MessageHtml ); dialog->showMessage(); diff --git a/src/gui/processing/qgsprocessingalgorithmdialogbase.cpp b/src/gui/processing/qgsprocessingalgorithmdialogbase.cpp index 5afa7e31c700..ee08f4e4aaeb 100644 --- a/src/gui/processing/qgsprocessingalgorithmdialogbase.cpp +++ b/src/gui/processing/qgsprocessingalgorithmdialogbase.cpp @@ -647,7 +647,7 @@ void QgsProcessingAlgorithmDialogBase::setCurrentTask( QgsProcessingAlgRunnerTas QString QgsProcessingAlgorithmDialogBase::formatStringForLog( const QString &string ) { QString s = string; - s.replace( '\n', QStringLiteral( "
    " ) ); + s.replace( '\n', QLatin1String( "
    " ) ); return s; } diff --git a/src/gui/processing/qgsprocessingconfigurationwidgets.cpp b/src/gui/processing/qgsprocessingconfigurationwidgets.cpp index bd6542c97c26..09bfc3c91226 100644 --- a/src/gui/processing/qgsprocessingconfigurationwidgets.cpp +++ b/src/gui/processing/qgsprocessingconfigurationwidgets.cpp @@ -152,7 +152,7 @@ void QgsFilterAlgorithmConfigurationWidget::addOutput() QgsProcessingAlgorithmConfigurationWidget *QgsFilterAlgorithmConfigurationWidgetFactory::create( const QgsProcessingAlgorithm *algorithm ) const { - if ( algorithm->name() == QStringLiteral( "filter" ) ) + if ( algorithm->name() == QLatin1String( "filter" ) ) return new QgsFilterAlgorithmConfigurationWidget(); else return nullptr; @@ -160,7 +160,7 @@ QgsProcessingAlgorithmConfigurationWidget *QgsFilterAlgorithmConfigurationWidget bool QgsFilterAlgorithmConfigurationWidgetFactory::canCreateFor( const QgsProcessingAlgorithm *algorithm ) const { - return algorithm->name() == QStringLiteral( "filter" ); + return algorithm->name() == QLatin1String( "filter" ); } @@ -281,7 +281,7 @@ void QgsConditionalBranchAlgorithmConfigurationWidget::addCondition() QgsConditionalBranchAlgorithmConfigurationWidget *QgsConditionalBranchAlgorithmConfigurationWidgetFactory::create( const QgsProcessingAlgorithm *algorithm ) const { - if ( algorithm->name() == QStringLiteral( "condition" ) ) + if ( algorithm->name() == QLatin1String( "condition" ) ) return new QgsConditionalBranchAlgorithmConfigurationWidget(); else return nullptr; @@ -289,7 +289,7 @@ QgsConditionalBranchAlgorithmConfigurationWidget *QgsConditionalBranchAlgorithmC bool QgsConditionalBranchAlgorithmConfigurationWidgetFactory::canCreateFor( const QgsProcessingAlgorithm *algorithm ) const { - return algorithm->name() == QStringLiteral( "condition" ); + return algorithm->name() == QLatin1String( "condition" ); } diff --git a/src/gui/processing/qgsprocessingoutputdestinationwidget.cpp b/src/gui/processing/qgsprocessingoutputdestinationwidget.cpp index 1077ef47ab80..be7b21e21f8c 100644 --- a/src/gui/processing/qgsprocessingoutputdestinationwidget.cpp +++ b/src/gui/processing/qgsprocessingoutputdestinationwidget.cpp @@ -92,14 +92,14 @@ void QgsProcessingLayerOutputDestinationWidget::setValue( const QVariant &value } else { - if ( value.toString() == QStringLiteral( "memory:" ) || value.toString() == QgsProcessing::TEMPORARY_OUTPUT ) + if ( value.toString() == QLatin1String( "memory:" ) || value.toString() == QgsProcessing::TEMPORARY_OUTPUT ) { saveToTemporary(); } else if ( value.canConvert< QgsProcessingOutputLayerDefinition >() ) { const QgsProcessingOutputLayerDefinition def = value.value< QgsProcessingOutputLayerDefinition >(); - if ( def.sink.staticValue().toString() == QStringLiteral( "memory:" ) || def.sink.staticValue().toString() == QgsProcessing::TEMPORARY_OUTPUT || def.sink.staticValue().toString().isEmpty() ) + if ( def.sink.staticValue().toString() == QLatin1String( "memory:" ) || def.sink.staticValue().toString() == QgsProcessing::TEMPORARY_OUTPUT || def.sink.staticValue().toString().isEmpty() ) { saveToTemporary(); } diff --git a/src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp b/src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp index 14f8fb81e4e1..aa914a9c0479 100644 --- a/src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp +++ b/src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp @@ -1343,7 +1343,7 @@ QgsProcessingParameterDefinition *QgsProcessingRangeParameterDefinitionWidget::c if ( mMaxLineEdit->text().isEmpty() ) { - defaultValue += QStringLiteral( ",None" ); + defaultValue += QLatin1String( ",None" ); } else { @@ -1510,7 +1510,7 @@ QVariant QgsProcessingRangeWidgetWrapper::widgetValue() const value = QString::number( mMinSpinBox->value() ); if ( qgsDoubleNear( mMaxSpinBox->value(), mMaxSpinBox->minimum() ) ) - value += QStringLiteral( ",None" ); + value += QLatin1String( ",None" ); else value += QStringLiteral( ",%1" ).arg( mMaxSpinBox->value() ); diff --git a/src/gui/providers/gdal/qgsgdalguiprovider.cpp b/src/gui/providers/gdal/qgsgdalguiprovider.cpp index 4d53d09b86ca..5d637d1c112e 100644 --- a/src/gui/providers/gdal/qgsgdalguiprovider.cpp +++ b/src/gui/providers/gdal/qgsgdalguiprovider.cpp @@ -54,7 +54,7 @@ void QgsGdalItemGuiProvider::onDeleteLayer( QgsDataItemGuiContext context ) QPointer< QgsDataItem > parent = data[QStringLiteral( "parentItem" )].value>(); // Messages are different for files and tables - bool isPostgresRaster { uri.startsWith( QStringLiteral( "PG:" ) ) }; + bool isPostgresRaster { uri.startsWith( QLatin1String( "PG:" ) ) }; const QString title = isPostgresRaster ? tr( "Delete Table" ) : tr( "Delete File" ); @@ -164,7 +164,7 @@ void QgsGdalItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu *menu if ( QgsGdalLayerItem *layerItem = qobject_cast< QgsGdalLayerItem * >( item ) ) { // Messages are different for files and tables - bool isPostgresRaster { layerItem->uri().startsWith( QStringLiteral( "PG:" ) ) }; + bool isPostgresRaster { layerItem->uri().startsWith( QLatin1String( "PG:" ) ) }; const QString message = isPostgresRaster ? QObject::tr( "Delete Table “%1”…" ).arg( layerItem->name() ) : QObject::tr( "Delete File “%1”…" ).arg( layerItem->name() ); diff --git a/src/gui/providers/gdal/qgsgdalsourceselect.cpp b/src/gui/providers/gdal/qgsgdalsourceselect.cpp index c25231e0e9ec..9f02baa3a4d9 100644 --- a/src/gui/providers/gdal/qgsgdalsourceselect.cpp +++ b/src/gui/providers/gdal/qgsgdalsourceselect.cpp @@ -49,7 +49,7 @@ QgsGdalSourceSelect::QgsGdalSourceSelect( QWidget *parent, Qt::WindowFlags fl, Q cmbProtocolTypes->addItem( protocol.split( ',' ).at( 0 ) ); } - mAuthWarning->setText( tr( " Additional credential options are required as documented here." ).arg( QStringLiteral( "https://gdal.org/user/virtual_file_systems.html#drivers-supporting-virtual-file-systems" ) ) ); + mAuthWarning->setText( tr( " Additional credential options are required as documented here." ).arg( QLatin1String( "https://gdal.org/user/virtual_file_systems.html#drivers-supporting-virtual-file-systems" ) ) ); connect( protocolURI, &QLineEdit::textChanged, this, [ = ]( const QString & text ) { @@ -80,11 +80,11 @@ QgsGdalSourceSelect::QgsGdalSourceSelect( QWidget *parent, Qt::WindowFlags fl, Q bool QgsGdalSourceSelect::isProtocolCloudType() { - return ( cmbProtocolTypes->currentText() == QStringLiteral( "AWS S3" ) || - cmbProtocolTypes->currentText() == QStringLiteral( "Google Cloud Storage" ) || - cmbProtocolTypes->currentText() == QStringLiteral( "Microsoft Azure Blob" ) || - cmbProtocolTypes->currentText() == QStringLiteral( "Alibaba Cloud OSS" ) || - cmbProtocolTypes->currentText() == QStringLiteral( "OpenStack Swift Object Storage" ) ); + return ( cmbProtocolTypes->currentText() == QLatin1String( "AWS S3" ) || + cmbProtocolTypes->currentText() == QLatin1String( "Google Cloud Storage" ) || + cmbProtocolTypes->currentText() == QLatin1String( "Microsoft Azure Blob" ) || + cmbProtocolTypes->currentText() == QLatin1String( "Alibaba Cloud OSS" ) || + cmbProtocolTypes->currentText() == QLatin1String( "OpenStack Swift Object Storage" ) ); } void QgsGdalSourceSelect::setProtocolWidgetsVisibility() diff --git a/src/gui/providers/ogr/qgsgeopackageitemguiprovider.cpp b/src/gui/providers/ogr/qgsgeopackageitemguiprovider.cpp index 4d16e6585aab..49dd39f62c07 100644 --- a/src/gui/providers/ogr/qgsgeopackageitemguiprovider.cpp +++ b/src/gui/providers/ogr/qgsgeopackageitemguiprovider.cpp @@ -437,13 +437,13 @@ bool QgsGeoPackageItemGuiProvider::handleDropGeopackage( QgsGeoPackageCollection QString error; // Common checks for raster and vector // aspatial is treated like vector - if ( dropUri.layerType == QStringLiteral( "vector" ) ) + if ( dropUri.layerType == QLatin1String( "vector" ) ) { // open the source layer srcLayer = dropUri.vectorLayer( owner, error ); isVector = true; } - else if ( dropUri.layerType == QStringLiteral( "mesh" ) ) + else if ( dropUri.layerType == QLatin1String( "mesh" ) ) { // unsupported hasError = true; @@ -560,7 +560,7 @@ bool QgsGeoPackageItemGuiProvider::handleDropGeopackage( QgsGeoPackageCollection { QgsMessageOutput *output = QgsMessageOutput::createMessageOutput(); output->setTitle( tr( "Import to GeoPackage database" ) ); - output->setMessage( tr( "Failed to import some layers!\n\n" ) + importResults.join( QStringLiteral( "\n" ) ), QgsMessageOutput::MessageText ); + output->setMessage( tr( "Failed to import some layers!\n\n" ) + importResults.join( QLatin1Char( '\n' ) ), QgsMessageOutput::MessageText ); output->showMessage(); } if ( ! importTasks.isEmpty() ) diff --git a/src/gui/providers/ogr/qgsogrdbsourceselect.cpp b/src/gui/providers/ogr/qgsogrdbsourceselect.cpp index 8a92e995d795..631bcf539740 100644 --- a/src/gui/providers/ogr/qgsogrdbsourceselect.cpp +++ b/src/gui/providers/ogr/qgsogrdbsourceselect.cpp @@ -135,7 +135,7 @@ void QgsOgrDbSourceSelect::cbxAllowGeometrylessTables_stateChanged( int ) void QgsOgrDbSourceSelect::mTablesTreeView_clicked( const QModelIndex &index ) { - mBuildQueryButton->setEnabled( index.parent().isValid() && mTablesTreeView->currentIndex().data( Qt::UserRole + 2 ) != QStringLiteral( "Raster" ) ); + mBuildQueryButton->setEnabled( index.parent().isValid() && mTablesTreeView->currentIndex().data( Qt::UserRole + 2 ) != QLatin1String( "Raster" ) ); } void QgsOgrDbSourceSelect::mTablesTreeView_doubleClicked( const QModelIndex &index ) @@ -348,7 +348,7 @@ void QgsOgrDbSourceSelect::btnConnect_clicked() for ( const QgsOgrDbLayerInfo *table : layers ) { - if ( cbxAllowGeometrylessTables->isChecked() || table->geometryType() != QStringLiteral( "None" ) ) + if ( cbxAllowGeometrylessTables->isChecked() || table->geometryType() != QLatin1String( "None" ) ) { mTableModel.addTableEntry( table->layerType(), table->name(), table->uri(), table->geometryColumn(), table->geometryType(), QString() ); } diff --git a/src/gui/providers/ogr/qgsogrsourceselect.cpp b/src/gui/providers/ogr/qgsogrsourceselect.cpp index 5658d1877b71..961e0784ef60 100644 --- a/src/gui/providers/ogr/qgsogrsourceselect.cpp +++ b/src/gui/providers/ogr/qgsogrsourceselect.cpp @@ -107,7 +107,7 @@ QgsOgrSourceSelect::QgsOgrSourceSelect( QWidget *parent, Qt::WindowFlags fl, Qgs cmbDatabaseTypes->blockSignals( false ); cmbConnections->blockSignals( false ); - mAuthWarning->setText( tr( " Additional credential options are required as documented here." ).arg( QStringLiteral( "http://gdal.org/gdal_virtual_file_systems.html#gdal_virtual_file_systems_network" ) ) ); + mAuthWarning->setText( tr( " Additional credential options are required as documented here." ).arg( QLatin1String( "http://gdal.org/gdal_virtual_file_systems.html#gdal_virtual_file_systems_network" ) ) ); mFileWidget->setDialogTitle( tr( "Open OGR Supported Vector Dataset(s)" ) ); mFileWidget->setFilter( mVectorFileFilter ); @@ -163,11 +163,11 @@ QString QgsOgrSourceSelect::dataSourceType() bool QgsOgrSourceSelect::isProtocolCloudType() { - return ( cmbProtocolTypes->currentText() == QStringLiteral( "AWS S3" ) || - cmbProtocolTypes->currentText() == QStringLiteral( "Google Cloud Storage" ) || - cmbProtocolTypes->currentText() == QStringLiteral( "Microsoft Azure Blob" ) || - cmbProtocolTypes->currentText() == QStringLiteral( "Alibaba Cloud OSS" ) || - cmbProtocolTypes->currentText() == QStringLiteral( "OpenStack Swift Object Storage" ) ); + return ( cmbProtocolTypes->currentText() == QLatin1String( "AWS S3" ) || + cmbProtocolTypes->currentText() == QLatin1String( "Google Cloud Storage" ) || + cmbProtocolTypes->currentText() == QLatin1String( "Microsoft Azure Blob" ) || + cmbProtocolTypes->currentText() == QLatin1String( "Alibaba Cloud OSS" ) || + cmbProtocolTypes->currentText() == QLatin1String( "OpenStack Swift Object Storage" ) ); } void QgsOgrSourceSelect::addNewConnection() diff --git a/src/gui/qgsattributeform.cpp b/src/gui/qgsattributeform.cpp index e2ab88d8d098..3edd0386193e 100644 --- a/src/gui/qgsattributeform.cpp +++ b/src/gui/qgsattributeform.cpp @@ -847,7 +847,7 @@ QString QgsAttributeForm::createFilterExpression() const if ( filters.isEmpty() ) return QString(); - QString filter = filters.join( QStringLiteral( ") AND (" ) ).prepend( '(' ).append( ')' ); + QString filter = filters.join( QLatin1String( ") AND (" ) ).prepend( '(' ).append( ')' ); return filter; } @@ -1572,7 +1572,7 @@ void QgsAttributeForm::init() //show attribute alias if available QString fieldName = mLayer->attributeDisplayName( idx ); QString labelText = fieldName; - labelText.replace( '&', QStringLiteral( "&&" ) ); // need to escape '&' or they'll be replace by _ in the label text + labelText.replace( '&', QLatin1String( "&&" ) ); // need to escape '&' or they'll be replace by _ in the label text const QgsEditorWidgetSetup widgetSetup = QgsGui::editorWidgetRegistry()->findBest( mLayer, field.name() ); @@ -1936,7 +1936,7 @@ QgsAttributeForm::WidgetInfo QgsAttributeForm::createWidgetFromDef( const QgsAtt newWidgetInfo.labelOnTop = mLayer->editFormConfig().labelOnTop( fldIdx ); newWidgetInfo.labelText = mLayer->attributeDisplayName( fldIdx ); - newWidgetInfo.labelText.replace( '&', QStringLiteral( "&&" ) ); // need to escape '&' or they'll be replace by _ in the label text + newWidgetInfo.labelText.replace( '&', QLatin1String( "&&" ) ); // need to escape '&' or they'll be replace by _ in the label text newWidgetInfo.toolTip = QStringLiteral( "%1

    %2

    " ).arg( mLayer->attributeDisplayName( fldIdx ), newWidgetInfo.hint ); newWidgetInfo.showLabel = widgetDef->showLabel(); @@ -2420,7 +2420,7 @@ QString QgsAttributeForm::aggregateFilter() const filters << '(' + filter + ')'; } - return filters.join( QStringLiteral( " AND " ) ); + return filters.join( QLatin1String( " AND " ) ); } void QgsAttributeForm::setExtraContextScope( QgsExpressionContextScope *extraScope ) diff --git a/src/gui/qgscolorwidgets.cpp b/src/gui/qgscolorwidgets.cpp index ba75aa8ac0c0..9ab93c614fc9 100644 --- a/src/gui/qgscolorwidgets.cpp +++ b/src/gui/qgscolorwidgets.cpp @@ -1469,10 +1469,10 @@ void QgsColorTextWidget::updateText() mLineEdit->setText( mCurrentColor.name() + QStringLiteral( "%1" ).arg( mCurrentColor.alpha(), 2, 16, QChar( '0' ) ) ); break; case Rgb: - mLineEdit->setText( QString( tr( "rgb( %1, %2, %3 )" ) ).arg( mCurrentColor.red() ).arg( mCurrentColor.green() ).arg( mCurrentColor.blue() ) ); + mLineEdit->setText( tr( "rgb( %1, %2, %3 )" ).arg( mCurrentColor.red() ).arg( mCurrentColor.green() ).arg( mCurrentColor.blue() ) ); break; case Rgba: - mLineEdit->setText( QString( tr( "rgba( %1, %2, %3, %4 )" ) ).arg( mCurrentColor.red() ).arg( mCurrentColor.green() ).arg( mCurrentColor.blue() ).arg( QString::number( mCurrentColor.alphaF(), 'f', 2 ) ) ); + mLineEdit->setText( tr( "rgba( %1, %2, %3, %4 )" ).arg( mCurrentColor.red() ).arg( mCurrentColor.green() ).arg( mCurrentColor.blue() ).arg( QString::number( mCurrentColor.alphaF(), 'f', 2 ) ) ); break; } } diff --git a/src/gui/qgscompoundcolorwidget.cpp b/src/gui/qgscompoundcolorwidget.cpp index ec5724d4f007..8c4d025768bc 100644 --- a/src/gui/qgscompoundcolorwidget.cpp +++ b/src/gui/qgscompoundcolorwidget.cpp @@ -393,7 +393,7 @@ void QgsCompoundColorWidget::importPalette() bool QgsCompoundColorWidget::removeUserPalette( QgsUserColorScheme *scheme, QWidget *parent ) { if ( QMessageBox::question( parent, tr( "Remove Color Palette" ), - QString( tr( "Are you sure you want to remove %1?" ) ).arg( scheme->schemeName() ), + tr( "Are you sure you want to remove %1?" ).arg( scheme->schemeName() ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes ) { //user canceled diff --git a/src/gui/qgscoordinateoperationwidget.cpp b/src/gui/qgscoordinateoperationwidget.cpp index df5607e169c4..4b95f8d7e800 100644 --- a/src/gui/qgscoordinateoperationwidget.cpp +++ b/src/gui/qgscoordinateoperationwidget.cpp @@ -265,7 +265,7 @@ void QgsCoordinateOperationWidget::loadAvailableOperations() if ( !singleOpDetails.remarks.isEmpty() ) { if ( !text.isEmpty() ) - text += QStringLiteral( "
    " ); + text += QLatin1String( "
    " ); text += QStringLiteral( "%1: %2" ).arg( tr( "Remarks" ), singleOpDetails.remarks ); lastSingleOpRemarks = singleOpDetails.remarks; } @@ -295,7 +295,7 @@ void QgsCoordinateOperationWidget::loadAvailableOperations() if ( !transform.remarks.isEmpty() && transform.remarks != lastSingleOpRemarks ) { if ( !text.isEmpty() ) - text += QStringLiteral( "
    " ); + text += QLatin1String( "
    " ); text += QStringLiteral( "%1: %2" ).arg( tr( "Remarks" ), transform.remarks ); } if ( !text.isEmpty() ) @@ -325,8 +325,8 @@ void QgsCoordinateOperationWidget::loadAvailableOperations() static_cast< int >( active.blue() * 0.6 + disabled.blue() * 0.4 ) ); const QString toolTipString = QStringLiteral( "%1" ).arg( transform.name ) + ( !opText.empty() ? ( opText.count() == 1 ? QStringLiteral( "

    %1

    " ).arg( opText.at( 0 ) ) : QStringLiteral( "
      %1
    " ).arg( opText.join( QString() ) ) ) : QString() ) - + ( !areasOfUse.empty() ? QStringLiteral( "

    %1: %2

    " ).arg( tr( "Area of use" ), areasOfUse.join( QStringLiteral( ", " ) ) ) : QString() ) - + ( !authorityCodes.empty() ? QStringLiteral( "

    %1: %2

    " ).arg( tr( "Identifiers" ), authorityCodes.join( QStringLiteral( ", " ) ) ) : QString() ) + + ( !areasOfUse.empty() ? QStringLiteral( "

    %1: %2

    " ).arg( tr( "Area of use" ), areasOfUse.join( QLatin1String( ", " ) ) ) : QString() ) + + ( !authorityCodes.empty() ? QStringLiteral( "

    %1: %2

    " ).arg( tr( "Identifiers" ), authorityCodes.join( QLatin1String( ", " ) ) ) : QString() ) + ( !missingMessage.isEmpty() ? QStringLiteral( "

    %1

    " ).arg( missingMessage ) : QString() ) + QStringLiteral( "

    %2

    " ).arg( codeColor.name(), transform.proj ); @@ -348,7 +348,7 @@ void QgsCoordinateOperationWidget::loadAvailableOperations() // area of use column item = qgis::make_unique< QTableWidgetItem >(); item->setFlags( item->flags() & ~Qt::ItemIsEditable ); - item->setText( areasOfUse.join( QStringLiteral( ", " ) ) ); + item->setText( areasOfUse.join( QLatin1String( ", " ) ) ); item->setToolTip( toolTipString ); if ( !transform.isAvailable ) { diff --git a/src/gui/qgsexpressiontreeview.cpp b/src/gui/qgsexpressiontreeview.cpp index 8608ac30996d..e3d93c1f1dd0 100644 --- a/src/gui/qgsexpressiontreeview.cpp +++ b/src/gui/qgsexpressiontreeview.cpp @@ -679,14 +679,14 @@ void QgsExpressionTreeView::loadExpressionsFromJson( const QJsonDocument &expres } // we want to import only items of type expression for now - if ( expressionObj["type"].toString() != QStringLiteral( "expression" ) ) + if ( expressionObj["type"].toString() != QLatin1String( "expression" ) ) { skippedExpressionLabels.append( expressionObj["name"].toString() ); continue; } // we want to import only items of type expression for now - if ( expressionObj["group"].toString() != QStringLiteral( "user" ) ) + if ( expressionObj["group"].toString() != QLatin1String( "user" ) ) { skippedExpressionLabels.append( expressionObj["name"].toString() ); continue; diff --git a/src/gui/qgsfeaturelistcombobox.cpp b/src/gui/qgsfeaturelistcombobox.cpp index 5df26e1806cd..2495bd0faffd 100644 --- a/src/gui/qgsfeaturelistcombobox.cpp +++ b/src/gui/qgsfeaturelistcombobox.cpp @@ -286,7 +286,7 @@ QgsFeatureRequest QgsFeatureListComboBox::currentFeatureRequest() const filtersAttrs << QgsExpression::createFieldEqualityExpression( identifierFields.at( i ), values.at( i ) ); } } - const QString expression = filtersAttrs.join( QStringLiteral( " AND " ) ); + const QString expression = filtersAttrs.join( QLatin1String( " AND " ) ); return QgsFeatureRequest().setFilterExpression( expression ); } } diff --git a/src/gui/qgsfeatureselectiondlg.cpp b/src/gui/qgsfeatureselectiondlg.cpp index d794f0a5ccc1..5555e70328d9 100644 --- a/src/gui/qgsfeatureselectiondlg.cpp +++ b/src/gui/qgsfeatureselectiondlg.cpp @@ -79,7 +79,7 @@ void QgsFeatureSelectionDlg::showEvent( QShowEvent *event ) QWindow *mainWindow = nullptr; for ( const auto &w : QgsApplication::instance()->topLevelWindows() ) { - if ( w->objectName() == QStringLiteral( "QgisAppWindow" ) ) + if ( w->objectName() == QLatin1String( "QgisAppWindow" ) ) { mainWindow = w; break; diff --git a/src/gui/qgsfieldmappingmodel.cpp b/src/gui/qgsfieldmappingmodel.cpp index 411540381445..c212a1ff6a56 100644 --- a/src/gui/qgsfieldmappingmodel.cpp +++ b/src/gui/qgsfieldmappingmodel.cpp @@ -155,7 +155,7 @@ QVariant QgsFieldMappingModel::data( const QModelIndex &index, int role ) const { constraintDescription.push_back( tr( "Expression" ) ); } - return constraintDescription.join( QStringLiteral( "
    " ) ); + return constraintDescription.join( QLatin1String( "
    " ) ); } break; } diff --git a/src/gui/qgsfiledownloaderdialog.cpp b/src/gui/qgsfiledownloaderdialog.cpp index 09602a6c6152..86c0df021518 100644 --- a/src/gui/qgsfiledownloaderdialog.cpp +++ b/src/gui/qgsfiledownloaderdialog.cpp @@ -41,7 +41,7 @@ QgsFileDownloaderDialog::QgsFileDownloaderDialog( const QUrl &url, const QString void QgsFileDownloaderDialog::onError( const QStringList &errors ) { - QMessageBox::warning( nullptr, tr( "Download File" ), errors.join( QStringLiteral( "
    " ) ) ); + QMessageBox::warning( nullptr, tr( "Download File" ), errors.join( QLatin1String( "
    " ) ) ); } void QgsFileDownloaderDialog::onDownloadProgress( qint64 bytesReceived, qint64 bytesTotal ) diff --git a/src/gui/qgsfilewidget.cpp b/src/gui/qgsfilewidget.cpp index a6b809f59c7f..fed2aa6642a8 100644 --- a/src/gui/qgsfilewidget.cpp +++ b/src/gui/qgsfilewidget.cpp @@ -161,7 +161,7 @@ void QgsFileWidget::textEdited( const QString &path ) // Show tooltip if multiple files are selected if ( path.contains( QStringLiteral( "\" \"" ) ) ) { - mLineEdit->setToolTip( tr( "Selected files:
    • %1

    " ).arg( splitFilePaths( path ).join( QStringLiteral( "
  6. " ) ) ) ); + mLineEdit->setToolTip( tr( "Selected files:
    • %1

    " ).arg( splitFilePaths( path ).join( QLatin1String( "
  7. " ) ) ) ); } else { @@ -391,7 +391,7 @@ void QgsFileWidget::openFileDialog() } if ( fileNames.length() > 1 ) { - setFilePath( QStringLiteral( "\"%1\"" ).arg( fileNames.join( QStringLiteral( "\" \"" ) ) ) ); + setFilePath( QStringLiteral( "\"%1\"" ).arg( fileNames.join( QLatin1String( "\" \"" ) ) ) ); } else { @@ -548,7 +548,7 @@ QString QgsFileDropEdit::acceptableFilePath( QDropEvent *event ) const if ( paths.size() > 1 ) { - return QStringLiteral( "\"%1\"" ).arg( paths.join( QStringLiteral( "\" \"" ) ) ); + return QStringLiteral( "\"%1\"" ).arg( paths.join( QLatin1String( "\" \"" ) ) ); } else if ( paths.size() == 1 ) { diff --git a/src/gui/qgsguiutils.cpp b/src/gui/qgsguiutils.cpp index a796526b19b0..264eef80dd75 100644 --- a/src/gui/qgsguiutils.cpp +++ b/src/gui/qgsguiutils.cpp @@ -131,7 +131,7 @@ namespace QgsGuiUtils QString outputFileName; QString ext; #if defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_LINUX) - outputFileName = QFileDialog::getSaveFileName( parent, message, initialPath, QStringList( filterMap.keys() ).join( QStringLiteral( ";;" ) ), &selectedFilter ); + outputFileName = QFileDialog::getSaveFileName( parent, message, initialPath, QStringList( filterMap.keys() ).join( QLatin1String( ";;" ) ), &selectedFilter ); if ( !outputFileName.isNull() ) { diff --git a/src/gui/qgshelp.cpp b/src/gui/qgshelp.cpp index 96275c2f0183..caa63e9c9444 100644 --- a/src/gui/qgshelp.cpp +++ b/src/gui/qgshelp.cpp @@ -59,7 +59,7 @@ QUrl QgsHelp::helpUrl( const QString &key ) const auto constPaths = paths; for ( const QString &path : constPaths ) { - if ( path.endsWith( QLatin1String( "\\" ) ) || path.endsWith( QLatin1String( "/" ) ) ) + if ( path.endsWith( QLatin1String( "\\" ) ) || path.endsWith( QLatin1Char( '/' ) ) ) { fullPath = path.left( path.size() - 1 ); } @@ -90,16 +90,16 @@ QUrl QgsHelp::helpUrl( const QString &key ) } else { - QString filePath = helpPath.mid( 0, helpPath.lastIndexOf( QLatin1String( "#" ) ) ); + QString filePath = helpPath.mid( 0, helpPath.lastIndexOf( QLatin1Char( '#' ) ) ); if ( !QFileInfo::exists( filePath ) ) { continue; } helpUrl = QUrl::fromLocalFile( filePath ); - int pos = helpPath.lastIndexOf( QLatin1String( "#" ) ); + int pos = helpPath.lastIndexOf( QLatin1Char( '#' ) ); if ( pos != -1 ) { - helpUrl.setFragment( helpPath.mid( helpPath.lastIndexOf( QLatin1String( "#" ) ) + 1, -1 ) ); + helpUrl.setFragment( helpPath.mid( helpPath.lastIndexOf( QLatin1Char( '#' ) ) + 1, -1 ) ); } } diff --git a/src/gui/qgsmapcanvas.cpp b/src/gui/qgsmapcanvas.cpp index 5656562b0e2d..7208e667a8b5 100644 --- a/src/gui/qgsmapcanvas.cpp +++ b/src/gui/qgsmapcanvas.cpp @@ -2458,7 +2458,7 @@ void QgsMapCanvas::readProject( const QDomDocument &doc ) QgsMapSettings tmpSettings; tmpSettings.readXml( node ); - if ( objectName() != QStringLiteral( "theMapCanvas" ) ) + if ( objectName() != QLatin1String( "theMapCanvas" ) ) { // never manually set the crs for the main canvas - this is instead connected to the project CRS setDestinationCrs( tmpSettings.destinationCrs() ); diff --git a/src/gui/qgsmaptoolidentify.cpp b/src/gui/qgsmaptoolidentify.cpp index ce1b9fa06605..3b489b000cf6 100644 --- a/src/gui/qgsmaptoolidentify.cpp +++ b/src/gui/qgsmaptoolidentify.cpp @@ -1034,7 +1034,7 @@ bool QgsMapToolIdentify::identifyRasterLayer( QList *results, Qg QMap< QString, QString > derAttributes = derivedAttributes; derAttributes.unite( featureDerivedAttributes( feature, layer, toLayerCoordinates( layer, point ) ) ); - IdentifyResult identifyResult( qobject_cast( layer ), labels.join( QStringLiteral( " / " ) ), featureStore.fields(), feature, derAttributes ); + IdentifyResult identifyResult( qobject_cast( layer ), labels.join( QLatin1String( " / " ) ), featureStore.fields(), feature, derAttributes ); identifyResult.mParams.insert( QStringLiteral( "getFeatureInfoUrl" ), featureStore.params().value( QStringLiteral( "getFeatureInfoUrl" ) ) ); results->append( identifyResult ); diff --git a/src/gui/qgsmessagebar.cpp b/src/gui/qgsmessagebar.cpp index 49765a4409ac..6f2571ddccb0 100644 --- a/src/gui/qgsmessagebar.cpp +++ b/src/gui/qgsmessagebar.cpp @@ -55,7 +55,7 @@ QgsMessageBar::QgsMessageBar( QWidget *parent ) " image: url(:/images/themes/default/%1) }" "QProgressBar::chunk { background-color: rgba(0, 0, 0, 30%); width: 5px; }" ); - mCountProgress->setStyleSheet( mCountStyleSheet.arg( QStringLiteral( "mIconTimerPause.svg" ) ) ); + mCountProgress->setStyleSheet( mCountStyleSheet.arg( QLatin1String( "mIconTimerPause.svg" ) ) ); mCountProgress->setObjectName( QStringLiteral( "mCountdown" ) ); const int barWidth = std::max( 25.0, Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 1.25 ); const int barHeight = std::max( 14.0, Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 0.7 ); @@ -114,12 +114,12 @@ void QgsMessageBar::mousePressEvent( QMouseEvent *e ) if ( mCountdownTimer->isActive() ) { mCountdownTimer->stop(); - mCountProgress->setStyleSheet( mCountStyleSheet.arg( QStringLiteral( "mIconTimerContinue.svg" ) ) ); + mCountProgress->setStyleSheet( mCountStyleSheet.arg( QLatin1String( "mIconTimerContinue.svg" ) ) ); } else { mCountdownTimer->start(); - mCountProgress->setStyleSheet( mCountStyleSheet.arg( QStringLiteral( "mIconTimerPause.svg" ) ) ); + mCountProgress->setStyleSheet( mCountStyleSheet.arg( QLatin1String( "mIconTimerPause.svg" ) ) ); } } } @@ -403,7 +403,7 @@ void QgsMessageBar::resetCountdown() if ( mCountdownTimer->isActive() ) mCountdownTimer->stop(); - mCountProgress->setStyleSheet( mCountStyleSheet.arg( QStringLiteral( "mIconTimerPause.svg" ) ) ); + mCountProgress->setStyleSheet( mCountStyleSheet.arg( QLatin1String( "mIconTimerPause.svg" ) ) ); mCountProgress->setVisible( false ); } diff --git a/src/gui/qgsmessagebaritem.cpp b/src/gui/qgsmessagebaritem.cpp index 8dc00ff36736..9929dc5e0883 100644 --- a/src/gui/qgsmessagebaritem.cpp +++ b/src/gui/qgsmessagebaritem.cpp @@ -139,7 +139,7 @@ void QgsMessageBarItem::writeContent() "QLabel,QTextEdit { color: #2554a1; } " ); contentStyleSheet = QStringLiteral( "" ); } - mStyleSheet += QStringLiteral( "QLabel#mItemCount { font-style: italic; }" ); + mStyleSheet += QLatin1String( "QLabel#mItemCount { font-style: italic; }" ); // TITLE AND TEXT if ( mTitle.isEmpty() && mText.isEmpty() ) diff --git a/src/gui/qgsmetadatawidget.cpp b/src/gui/qgsmetadatawidget.cpp index 99a5650af981..ce2e9e963918 100644 --- a/src/gui/qgsmetadatawidget.cpp +++ b/src/gui/qgsmetadatawidget.cpp @@ -220,7 +220,7 @@ void QgsMetadataWidget::addVocabulary() QTableWidgetItem *pCell = nullptr; // Vocabulary - pCell = new QTableWidgetItem( QString( tr( "undefined %1" ) ).arg( row + 1 ) ); + pCell = new QTableWidgetItem( tr( "undefined %1" ).arg( row + 1 ) ); tabKeywords->setItem( row, 0, pCell ); // Keywords @@ -288,8 +288,8 @@ void QgsMetadataWidget::removeSelectedRight() void QgsMetadataWidget::addConstraint() { int row = mConstraintsModel->rowCount(); - mConstraintsModel->setItem( row, 0, new QStandardItem( QString( tr( "undefined %1" ) ).arg( row + 1 ) ) ); - mConstraintsModel->setItem( row, 1, new QStandardItem( QString( tr( "undefined %1" ) ).arg( row + 1 ) ) ); + mConstraintsModel->setItem( row, 0, new QStandardItem( tr( "undefined %1" ).arg( row + 1 ) ) ); + mConstraintsModel->setItem( row, 1, new QStandardItem( tr( "undefined %1" ).arg( row + 1 ) ) ); } void QgsMetadataWidget::removeSelectedConstraint() @@ -340,7 +340,7 @@ void QgsMetadataWidget::addAddress() QTableWidgetItem *pCell = nullptr; // Type - pCell = new QTableWidgetItem( QString( tr( "postal" ) ) ); + pCell = new QTableWidgetItem( tr( "postal" ) ); tabAddresses->setItem( row, 0, pCell ); // Address @@ -384,7 +384,7 @@ void QgsMetadataWidget::fillCrsFromProvider() void QgsMetadataWidget::addLink() { int row = mLinksModel->rowCount(); - mLinksModel->setItem( row, 0, new QStandardItem( QString( tr( "undefined %1" ) ).arg( row + 1 ) ) ); + mLinksModel->setItem( row, 0, new QStandardItem( tr( "undefined %1" ).arg( row + 1 ) ) ); mLinksModel->setItem( row, 1, new QStandardItem() ); mLinksModel->setItem( row, 2, new QStandardItem() ); mLinksModel->setItem( row, 3, new QStandardItem() ); @@ -511,7 +511,7 @@ void QgsMetadataWidget::setUiFromMetadata() addVocabulary(); int currentRow = tabKeywords->rowCount() - 1; tabKeywords->item( currentRow, 0 )->setText( i.key() ); - tabKeywords->item( currentRow, 1 )->setText( i.value().join( QStringLiteral( "," ) ) ); + tabKeywords->item( currentRow, 1 )->setText( i.value().join( QLatin1Char( ',' ) ) ); } if ( QgsLayerMetadata *layerMetadata = dynamic_cast< QgsLayerMetadata * >( mMetadata.get() ) ) @@ -800,14 +800,14 @@ bool QgsMetadataWidget::checkMetadata() errors += QLatin1String( "" ) % result.section; if ( ! result._identifier().isNull() ) { - errors += QLatin1String( " " ) % QVariant( result._identifier().toInt() + 1 ).toString(); + errors += QLatin1Char( ' ' ) % QVariant( result._identifier().toInt() + 1 ).toString(); } errors += QLatin1String( ": " ) % result.note % QLatin1String( "
    " ); } } else { - errors = QString( tr( "Ok, it seems valid according to the QGIS Schema." ) ); + errors = tr( "Ok, it seems valid according to the QGIS Schema." ); } QString myStyle = QgsApplication::reportStyleSheet(); @@ -1011,7 +1011,7 @@ void QgsMetadataWidget::syncFromCategoriesTabToKeywordsTab() row = tabKeywords->rowCount() - 1; tabKeywords->item( row, 0 )->setText( QStringLiteral( "gmd:topicCategory" ) ); } - tabKeywords->item( row, 1 )->setText( mCategoriesModel->stringList().join( QStringLiteral( "," ) ) ); + tabKeywords->item( row, 1 )->setText( mCategoriesModel->stringList().join( QLatin1Char( ',' ) ) ); } } @@ -1019,7 +1019,7 @@ void QgsMetadataWidget::updatePanel() { int index = tabWidget->currentIndex(); QString currentTabText = tabWidget->widget( index )->objectName(); - if ( currentTabText == QStringLiteral( "tabCategoriesDialog" ) ) + if ( currentTabText == QLatin1String( "tabCategoriesDialog" ) ) { // Categories tab // We need to take keywords and insert them into the list @@ -1034,13 +1034,13 @@ void QgsMetadataWidget::updatePanel() mCategoriesModel->setStringList( QStringList() ); } } - else if ( currentTabText == QStringLiteral( "tabKeywordsDialog" ) ) + else if ( currentTabText == QLatin1String( "tabKeywordsDialog" ) ) { // Keywords tab // We need to take categories and insert them into the table syncFromCategoriesTabToKeywordsTab(); } - else if ( currentTabText == QStringLiteral( "tabValidationDialog" ) ) + else if ( currentTabText == QLatin1String( "tabValidationDialog" ) ) { checkMetadata(); } diff --git a/src/gui/qgsnewnamedialog.cpp b/src/gui/qgsnewnamedialog.cpp index cdf8b6a3d8f2..570a4bd750bd 100644 --- a/src/gui/qgsnewnamedialog.cpp +++ b/src/gui/qgsnewnamedialog.cpp @@ -145,7 +145,7 @@ void QgsNewNameDialog::nameChanged() QStringList newNames = fullNames( newName, mExtensions ); if ( !mExtensions.isEmpty() ) { - namesString += ' ' + newNames.join( QStringLiteral( ", " ) ); + namesString += ' ' + newNames.join( QLatin1String( ", " ) ); mNamesLabel->setText( namesString ); } @@ -154,7 +154,7 @@ void QgsNewNameDialog::nameChanged() if ( !conflicts.isEmpty() ) { QString warning = !mConflictingNameWarning.isEmpty() ? mConflictingNameWarning - : tr( "%n Name(s) %1 exists", nullptr, conflicts.size() ).arg( conflicts.join( QStringLiteral( ", " ) ) ); + : tr( "%n Name(s) %1 exists", nullptr, conflicts.size() ).arg( conflicts.join( QLatin1String( ", " ) ) ); mErrorLabel->setText( highlightText( warning ) ); if ( mOverwriteEnabled ) { diff --git a/src/gui/qgsnewvectortabledialog.cpp b/src/gui/qgsnewvectortabledialog.cpp index 1136dfb4fb84..b7de867d2993 100644 --- a/src/gui/qgsnewvectortabledialog.cpp +++ b/src/gui/qgsnewvectortabledialog.cpp @@ -385,7 +385,7 @@ void QgsNewVectorTableDialog::validate() const bool isValid { mValidationErrors.isEmpty() }; if ( ! isValid ) { - mValidationResults->setText( mValidationErrors.join( QStringLiteral( "
    " ) ) ); + mValidationResults->setText( mValidationErrors.join( QLatin1String( "
    " ) ) ); } mValidationFrame->setVisible( ! isValid ); diff --git a/src/gui/qgsprojectionselectiontreewidget.cpp b/src/gui/qgsprojectionselectiontreewidget.cpp index 053e9183b6ec..0e22f7495776 100644 --- a/src/gui/qgsprojectionselectiontreewidget.cpp +++ b/src/gui/qgsprojectionselectiontreewidget.cpp @@ -198,7 +198,7 @@ QString QgsProjectionSelectionTreeWidget::ogcWmsCrsFilterAsSqlExpression( QSet%1
    %2
    " ).arg( tr( "Extent" ), extentString ); - const QString wktString = tr( "
    %1
    %2
    " ).arg( tr( "WKT" ), currentCrs.toWkt( QgsCoordinateReferenceSystem::WKT_PREFERRED, true ).replace( '\n', QStringLiteral( "
    " ) ).replace( ' ', QStringLiteral( " " ) ) ); + const QString wktString = tr( "
    %1
    %2
    " ).arg( tr( "WKT" ), currentCrs.toWkt( QgsCoordinateReferenceSystem::WKT_PREFERRED, true ).replace( '\n', QLatin1String( "
    " ) ).replace( ' ', QLatin1String( " " ) ) ); const QString proj4String = tr( "
    %1
    %2
    " ).arg( tr( "Proj4" ), currentCrs.toProj() ); #ifdef Q_OS_WIN diff --git a/src/gui/qgspropertyoverridebutton.cpp b/src/gui/qgspropertyoverridebutton.cpp index c1c829bbcdac..da23123f0b08 100644 --- a/src/gui/qgspropertyoverridebutton.cpp +++ b/src/gui/qgspropertyoverridebutton.cpp @@ -134,7 +134,7 @@ void QgsPropertyOverrideButton::init( int propertyKey, const QgsProperty &proper if ( !ts.isEmpty() ) { - mDataTypesString = ts.join( QStringLiteral( ", " ) ); + mDataTypesString = ts.join( QLatin1String( ", " ) ); mActionDataTypes->setText( tr( "Field type: " ) + mDataTypesString ); } diff --git a/src/gui/qgsquerybuilder.cpp b/src/gui/qgsquerybuilder.cpp index aefbf4619db8..0a2448fe8877 100644 --- a/src/gui/qgsquerybuilder.cpp +++ b/src/gui/qgsquerybuilder.cpp @@ -255,7 +255,7 @@ void QgsQueryBuilder::test() QMessageBox::warning( this, tr( "Query Result" ), tr( "An error occurred when executing the query." ) - + tr( "\nThe data provider said:\n%1" ).arg( mLayer->dataProvider()->errors().join( QStringLiteral( "\n" ) ) ) ); + + tr( "\nThe data provider said:\n%1" ).arg( mLayer->dataProvider()->errors().join( QLatin1Char( '\n' ) ) ) ); mLayer->dataProvider()->clearErrors(); } else @@ -278,7 +278,7 @@ void QgsQueryBuilder::accept() QMessageBox::warning( this, tr( "Query Result" ), tr( "An error occurred when executing the query." ) - + tr( "\nThe data provider said:\n%1" ).arg( mLayer->dataProvider()->errors().join( QStringLiteral( "\n" ) ) ) ); + + tr( "\nThe data provider said:\n%1" ).arg( mLayer->dataProvider()->errors().join( QLatin1Char( '\n' ) ) ) ); mLayer->dataProvider()->clearErrors(); } else diff --git a/src/gui/qgsrasterformatsaveoptionswidget.cpp b/src/gui/qgsrasterformatsaveoptionswidget.cpp index cff32904ecdb..773f23d2f93e 100644 --- a/src/gui/qgsrasterformatsaveoptionswidget.cpp +++ b/src/gui/qgsrasterformatsaveoptionswidget.cpp @@ -508,7 +508,7 @@ void QgsRasterFormatSaveOptionsWidget::setCreateOptions( const QString &profileN void QgsRasterFormatSaveOptionsWidget::setCreateOptions( const QString &profileName, const QStringList &list ) { - setCreateOptions( profileName, list.join( QStringLiteral( " " ) ) ); + setCreateOptions( profileName, list.join( QLatin1Char( ' ' ) ) ); } QStringList QgsRasterFormatSaveOptionsWidget::profiles() const diff --git a/src/gui/qgsrasterlayersaveasdialog.cpp b/src/gui/qgsrasterlayersaveasdialog.cpp index 2be169647113..786a0ed1a429 100644 --- a/src/gui/qgsrasterlayersaveasdialog.cpp +++ b/src/gui/qgsrasterlayersaveasdialog.cpp @@ -217,7 +217,7 @@ QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog( QgsRasterLayer *rasterLa break; if ( QMessageBox::warning( this, tr( "Save Raster Layer" ), - tr( "The directory %1 contains files which will be overwritten: %2" ).arg( dir.absolutePath(), files.join( QStringLiteral( ", " ) ) ), + tr( "The directory %1 contains files which will be overwritten: %2" ).arg( dir.absolutePath(), files.join( QLatin1String( ", " ) ) ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Ok ) break; @@ -263,12 +263,12 @@ void QgsRasterLayerSaveAsDialog::insertAvailableOutputFormats() // skip GDAL vrt driver, since we handle that format manually continue; } - else if ( driverShortName == QStringLiteral( "GTiff" ) ) + else if ( driverShortName == QLatin1String( "GTiff" ) ) { // always list geotiff first topPriorityDrivers.insert( 1, qMakePair( driverLongName, driverShortName ) ); } - else if ( driverShortName == QStringLiteral( "GPKG" ) ) + else if ( driverShortName == QLatin1String( "GPKG" ) ) { // and gpkg second topPriorityDrivers.insert( 2, qMakePair( driverLongName, driverShortName ) ); @@ -320,15 +320,15 @@ void QgsRasterLayerSaveAsDialog::mFormatComboBox_currentIndexChanged( const QStr else { filter = QStringLiteral( "%1 (*.%2);;%3" ).arg( mFormatComboBox->currentText(), - extensions.join( QStringLiteral( " *." ) ), + extensions.join( QLatin1String( " *." ) ), tr( "All files (*.*)" ) ); } mFilename->setFilter( filter ); // Disable mTileModeCheckBox for GeoPackages - mTileModeCheckBox->setEnabled( outputFormat() != QStringLiteral( "GPKG" ) ); - mFilename->setConfirmOverwrite( outputFormat() != QStringLiteral( "GPKG" ) ); - mLayerName->setEnabled( outputFormat() == QStringLiteral( "GPKG" ) ); + mTileModeCheckBox->setEnabled( outputFormat() != QLatin1String( "GPKG" ) ); + mFilename->setConfirmOverwrite( outputFormat() != QLatin1String( "GPKG" ) ); + mLayerName->setEnabled( outputFormat() == QLatin1String( "GPKG" ) ); if ( mLayerName->isEnabled() ) { QString layerName = QFileInfo( mFilename->filePath() ).baseName(); @@ -412,7 +412,7 @@ QString QgsRasterLayerSaveAsDialog::outputFileName() const QString QgsRasterLayerSaveAsDialog::outputLayerName() const { - if ( mLayerName->text().isEmpty() && outputFormat() == QStringLiteral( "GPKG" ) && !mTileModeCheckBox->isChecked() ) + if ( mLayerName->text().isEmpty() && outputFormat() == QLatin1String( "GPKG" ) && !mTileModeCheckBox->isChecked() ) { // Always return layer name for GeoPackages return QFileInfo( mFilename->filePath() ).baseName(); @@ -431,7 +431,7 @@ QString QgsRasterLayerSaveAsDialog::outputFormat() const QStringList QgsRasterLayerSaveAsDialog::createOptions() const { QStringList options = mCreateOptionsGroupBox->isChecked() ? mCreateOptionsWidget->options() : QStringList(); - if ( outputFormat() == QStringLiteral( "GPKG" ) ) + if ( outputFormat() == QLatin1String( "GPKG" ) ) { // Overwrite the GPKG table options int indx = options.indexOf( QRegularExpression( "^RASTER_TABLE=.*", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption ) ); @@ -921,7 +921,7 @@ bool QgsRasterLayerSaveAsDialog::outputLayerExists() const { QString vectorUri; QString rasterUri; - if ( outputFormat() == QStringLiteral( "GPKG" ) ) + if ( outputFormat() == QLatin1String( "GPKG" ) ) { rasterUri = QStringLiteral( "GPKG:%1:%2" ).arg( outputFileName(), outputLayerName() ); vectorUri = QStringLiteral( "%1|layername=%2" ).arg( outputFileName(), outputLayerName() ); @@ -950,7 +950,7 @@ void QgsRasterLayerSaveAsDialog::accept() return; } - if ( outputFormat() == QStringLiteral( "GPKG" ) && outputLayerExists() && + if ( outputFormat() == QLatin1String( "GPKG" ) && outputLayerExists() && QMessageBox::warning( this, tr( "Save Raster Layer" ), tr( "The layer %1 already exists in the target file, and overwriting layers in GeoPackage is not supported. " "Do you want to overwrite the whole file?" ).arg( outputLayerName() ), diff --git a/src/gui/qgsrelationeditorwidget.cpp b/src/gui/qgsrelationeditorwidget.cpp index 1de6a16549aa..db1f53a82dc1 100644 --- a/src/gui/qgsrelationeditorwidget.cpp +++ b/src/gui/qgsrelationeditorwidget.cpp @@ -808,7 +808,7 @@ void QgsRelationEditorWidget::unlinkFeatures( const QgsFeatureIds &featureids ) QString filter = QStringLiteral( "(%1) AND (%2)" ).arg( mRelation.getRelatedFeaturesRequest( mFeature ).filterExpression()->expression(), - filters.join( QStringLiteral( " OR " ) ) ); + filters.join( QLatin1String( " OR " ) ) ); QgsFeatureIterator linkedIterator = mRelation.referencingLayer()->getFeatures( QgsFeatureRequest() .setNoAttributes() @@ -915,7 +915,7 @@ void QgsRelationEditorWidget::updateUi() QgsFeatureRequest nmRequest; - nmRequest.setFilterExpression( filters.join( QStringLiteral( " OR " ) ) ); + nmRequest.setFilterExpression( filters.join( QLatin1String( " OR " ) ) ); initDualView( mNmRelation.referencedLayer(), nmRequest ); } diff --git a/src/gui/qgssqlcomposerdialog.cpp b/src/gui/qgssqlcomposerdialog.cpp index 581183598b92..5a1dc36ad23c 100644 --- a/src/gui/qgssqlcomposerdialog.cpp +++ b/src/gui/qgssqlcomposerdialog.cpp @@ -462,12 +462,12 @@ void QgsSQLComposerDialog::getFunctionList( const QList &list, { listApi << f.name; QString entryText( f.name ); - entryText += QLatin1String( "(" ); + entryText += QLatin1Char( '(' ); if ( !f.argumentList.isEmpty() ) { for ( int i = 0; i < f.argumentList.size(); i++ ) { - if ( f.minArgs >= 0 && i >= f.minArgs ) entryText += QLatin1String( "[" ); + if ( f.minArgs >= 0 && i >= f.minArgs ) entryText += QLatin1Char( '[' ); if ( i > 0 ) entryText += QLatin1String( ", " ); if ( f.argumentList[i].name == QLatin1String( "number" ) && !f.argumentList[i].type.isEmpty() ) { @@ -484,12 +484,12 @@ void QgsSQLComposerDialog::getFunctionList( const QList &list, entryText += sanitizedType; } } - if ( f.minArgs >= 0 && i >= f.minArgs ) entryText += QLatin1String( "]" ); + if ( f.minArgs >= 0 && i >= f.minArgs ) entryText += QLatin1Char( ']' ); } if ( entryText.size() > 60 ) { entryText = f.name; - entryText += QLatin1String( "(" ); + entryText += QLatin1Char( '(' ); entryText += getFunctionAbbridgedParameters( f ); } } @@ -497,7 +497,7 @@ void QgsSQLComposerDialog::getFunctionList( const QList &list, { entryText += getFunctionAbbridgedParameters( f ); } - entryText += QLatin1String( ")" ); + entryText += QLatin1Char( ')' ); if ( !f.returnType.isEmpty() ) entryText += ": " + sanitizeType( f.returnType ); listCombo << entryText; diff --git a/src/gui/raster/qgsrasterlayerproperties.cpp b/src/gui/raster/qgsrasterlayerproperties.cpp index 99f6c57e2ab1..3cbc3a7e12c0 100644 --- a/src/gui/raster/qgsrasterlayerproperties.cpp +++ b/src/gui/raster/qgsrasterlayerproperties.cpp @@ -465,7 +465,7 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanv mBandRenderingGrpBx->updateGeometry(); } - if ( mRasterLayer->providerType() != QStringLiteral( "wms" ) ) + if ( mRasterLayer->providerType() != QLatin1String( "wms" ) ) { mWMSPrintGroupBox->hide(); mPublishDataSourceUrlCheckBox->hide(); @@ -2355,7 +2355,7 @@ void QgsRasterLayerProperties::updateInformationContent() { const QString myStyle = QgsApplication::reportStyleSheet( QgsApplication::StyleSheetType::WebBrowser ); // Inject the stylesheet - const QString html { mRasterLayer->htmlMetadata().replace( QStringLiteral( "" ), QStringLiteral( R"raw()raw" ) ).arg( myStyle ) }; + const QString html { mRasterLayer->htmlMetadata().replace( QLatin1String( "" ), QStringLiteral( R"raw()raw" ) ).arg( myStyle ) }; mMetadataViewer->setHtml( html ); mMetadataFilled = true; } diff --git a/src/gui/symbology/qgslayerpropertieswidget.cpp b/src/gui/symbology/qgslayerpropertieswidget.cpp index 1aaed74f5cf4..e59752b8426c 100644 --- a/src/gui/symbology/qgslayerpropertieswidget.cpp +++ b/src/gui/symbology/qgslayerpropertieswidget.cpp @@ -186,7 +186,7 @@ void QgsLayerPropertiesWidget::populateLayerTypes() if ( layerInfo->type() != QgsSymbol::Hybrid ) { QString visibleName = layerInfo->visibleName(); - QString name = QString( tr( "Outline: %1" ) ).arg( visibleName ); + QString name = tr( "Outline: %1" ).arg( visibleName ); cboLayerType->addItem( name, lineLayerId ); } } diff --git a/src/gui/symbology/qgsrulebasedrendererwidget.cpp b/src/gui/symbology/qgsrulebasedrendererwidget.cpp index dc2655648fc5..2251f8dc4c02 100644 --- a/src/gui/symbology/qgsrulebasedrendererwidget.cpp +++ b/src/gui/symbology/qgsrulebasedrendererwidget.cpp @@ -337,7 +337,7 @@ void QgsRuleBasedRendererWidget::refineRuleScalesGui( const QModelIndexList &ind if ( ok ) scales.append( scale ); else - QMessageBox::information( this, tr( "Scale Refinement" ), QString( tr( "\"%1\" is not valid scale denominator, ignoring it." ) ).arg( item ) ); + QMessageBox::information( this, tr( "Scale Refinement" ), tr( "\"%1\" is not valid scale denominator, ignoring it." ).arg( item ) ); } for ( const QModelIndex &index : indexList ) diff --git a/src/gui/vector/qgsattributeactiondialog.cpp b/src/gui/vector/qgsattributeactiondialog.cpp index 1833864e6434..ab55c26a7856 100644 --- a/src/gui/vector/qgsattributeactiondialog.cpp +++ b/src/gui/vector/qgsattributeactiondialog.cpp @@ -135,7 +135,7 @@ void QgsAttributeActionDialog::insertRow( int row, const QgsAction &action ) item->setFlags( item->flags() & ~( Qt::ItemIsEditable ) ); QStringList actionScopes = qgis::setToList( action.actionScopes() ); std::sort( actionScopes.begin(), actionScopes.end() ); - item->setText( actionScopes.join( QStringLiteral( ", " ) ) ); + item->setText( actionScopes.join( QLatin1String( ", " ) ) ); item->setData( Qt::UserRole, QVariant::fromValue>( action.actionScopes() ) ); mAttributeActionTable->setItem( row, ActionScopes, item ); @@ -357,7 +357,7 @@ void QgsAttributeActionDialog::itemDoubleClicked( QTableWidgetItem *item ) QTableWidgetItem *item = mAttributeActionTable->item( row, ActionScopes ); QStringList actionScopes = qgis::setToList( actionProperties.actionScopes() ); std::sort( actionScopes.begin(), actionScopes.end() ); - item->setText( actionScopes.join( QStringLiteral( ", " ) ) ); + item->setText( actionScopes.join( QLatin1String( ", " ) ) ); item->setData( Qt::UserRole, QVariant::fromValue>( actionProperties.actionScopes() ) ); mAttributeActionTable->verticalHeaderItem( row )->setData( Qt::UserRole, actionProperties.iconPath() ); diff --git a/src/gui/vector/qgsattributeactionpropertiesdialog.cpp b/src/gui/vector/qgsattributeactionpropertiesdialog.cpp index 883d21de5f40..627d40705325 100644 --- a/src/gui/vector/qgsattributeactionpropertiesdialog.cpp +++ b/src/gui/vector/qgsattributeactionpropertiesdialog.cpp @@ -167,7 +167,7 @@ void QgsAttributeActionPropertiesDialog::chooseIcon() for ( const QByteArray &format : constList ) formatList << QStringLiteral( "*.%1" ).arg( QString( format ) ); - QString filter = tr( "Images( %1 ); All( *.* )" ).arg( formatList.join( QStringLiteral( " " ) ) ); + QString filter = tr( "Images( %1 ); All( *.* )" ).arg( formatList.join( QLatin1Char( ' ' ) ) ); QString icon = QFileDialog::getOpenFileName( this, tr( "Choose Icon…" ), mActionIcon->text(), filter ); if ( !icon.isNull() ) @@ -207,7 +207,7 @@ void QgsAttributeActionPropertiesDialog::init( const QSet &actionScopes tooltip += QLatin1String( "

    " ); tooltip += tr( "Additional variables" ); tooltip += QLatin1String( "
    • " ); - tooltip += variables.join( QStringLiteral( "
    • " ) ); + tooltip += variables.join( QLatin1String( "
    • " ) ); tooltip += QLatin1String( "
  8. " ); } actionScopeCheckBox->setToolTip( tooltip ); diff --git a/src/gui/vector/qgsvectorlayerproperties.cpp b/src/gui/vector/qgsvectorlayerproperties.cpp index d11f8a24731f..faedc849e4a1 100644 --- a/src/gui/vector/qgsvectorlayerproperties.cpp +++ b/src/gui/vector/qgsvectorlayerproperties.cpp @@ -2061,7 +2061,7 @@ void QgsVectorLayerProperties::deleteAuxiliaryField( int index ) { const QString title = QObject::tr( "Delete Auxiliary Field" ); const int timeout = QgsSettings().value( QStringLiteral( "qgis/messageTimeout" ), 5 ).toInt(); - const QString errors = mLayer->auxiliaryLayer()->commitErrors().join( QStringLiteral( "\n " ) ); + const QString errors = mLayer->auxiliaryLayer()->commitErrors().join( QLatin1String( "\n " ) ); const QString msg = QObject::tr( "Unable to remove auxiliary field (%1)" ).arg( errors ); mMessageBar->pushMessage( title, msg, Qgis::Warning, timeout ); } diff --git a/src/gui/vectortile/qgsvectortilebasiclabelingwidget.cpp b/src/gui/vectortile/qgsvectortilebasiclabelingwidget.cpp index 6bb26644d3ab..b359d6aa8883 100644 --- a/src/gui/vectortile/qgsvectortilebasiclabelingwidget.cpp +++ b/src/gui/vectortile/qgsvectortilebasiclabelingwidget.cpp @@ -345,7 +345,7 @@ void QgsVectorTileBasicLabelingWidget::setLayer( QgsVectorTileLayer *layer ) { mVTLayer = layer; - if ( layer && layer->labeling() && layer->labeling()->type() == QStringLiteral( "basic" ) ) + if ( layer && layer->labeling() && layer->labeling()->type() == QLatin1String( "basic" ) ) { mLabeling.reset( static_cast( layer->labeling()->clone() ) ); } diff --git a/src/gui/vectortile/qgsvectortilebasicrendererwidget.cpp b/src/gui/vectortile/qgsvectortilebasicrendererwidget.cpp index 59c34c33c710..101f200b37cc 100644 --- a/src/gui/vectortile/qgsvectortilebasicrendererwidget.cpp +++ b/src/gui/vectortile/qgsvectortilebasicrendererwidget.cpp @@ -347,7 +347,7 @@ void QgsVectorTileBasicRendererWidget::setLayer( QgsVectorTileLayer *layer ) { mVTLayer = layer; - if ( layer && layer->renderer() && layer->renderer()->type() == QStringLiteral( "basic" ) ) + if ( layer && layer->renderer() && layer->renderer()->type() == QLatin1String( "basic" ) ) { mRenderer.reset( static_cast( layer->renderer()->clone() ) ); } diff --git a/src/plugins/geometry_checker/qgsgeometrycheckerfixsummarydialog.cpp b/src/plugins/geometry_checker/qgsgeometrycheckerfixsummarydialog.cpp index cfb2791ff369..65405a24cbf6 100644 --- a/src/plugins/geometry_checker/qgsgeometrycheckerfixsummarydialog.cpp +++ b/src/plugins/geometry_checker/qgsgeometrycheckerfixsummarydialog.cpp @@ -59,7 +59,7 @@ QgsGeometryCheckerFixSummaryDialog::QgsGeometryCheckerFixSummaryDialog( const St setupTable( ui.tableWidgetNotFixed ); setupTable( ui.tableWidgetObsoleteErrors ); - ui.plainTextEditMessages->setPlainText( checker->getMessages().join( QStringLiteral( "\n" ) ) ); + ui.plainTextEditMessages->setPlainText( checker->getMessages().join( QLatin1Char( '\n' ) ) ); ui.groupBoxFixedErrors->setVisible( !stats.fixedErrors.isEmpty() ); ui.groupBoxNewErrors->setVisible( !stats.newErrors.isEmpty() ); diff --git a/src/plugins/geometry_checker/qgsgeometrycheckerresulttab.cpp b/src/plugins/geometry_checker/qgsgeometrycheckerresulttab.cpp index 696c0d3cf5d1..5e3811976808 100644 --- a/src/plugins/geometry_checker/qgsgeometrycheckerresulttab.cpp +++ b/src/plugins/geometry_checker/qgsgeometrycheckerresulttab.cpp @@ -127,7 +127,7 @@ void QgsGeometryCheckerResultTab::finalize() QDialog dialog; dialog.setLayout( new QVBoxLayout() ); dialog.layout()->addWidget( new QLabel( tr( "The following checks reported errors:" ) ) ); - dialog.layout()->addWidget( new QPlainTextEdit( mChecker->getMessages().join( QStringLiteral( "\n" ) ) ) ); + dialog.layout()->addWidget( new QPlainTextEdit( mChecker->getMessages().join( QLatin1Char( '\n' ) ) ) ); QDialogButtonBox *bbox = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal ); dialog.layout()->addWidget( bbox ); connect( bbox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); @@ -455,7 +455,7 @@ void QgsGeometryCheckerResultTab::openAttributeTable() { mAttribTableDialogs[layerId]->close(); } - mAttribTableDialogs[layerId] = mIface->showAttributeTable( mChecker->featurePools()[layerId]->layer(), expr.join( QStringLiteral( " or " ) ) ); + mAttribTableDialogs[layerId] = mIface->showAttributeTable( mChecker->featurePools()[layerId]->layer(), expr.join( QLatin1String( " or " ) ) ); } } diff --git a/src/plugins/gps_importer/qgsgpsdevicedialog.cpp b/src/plugins/gps_importer/qgsgpsdevicedialog.cpp index b28c2d73ad61..c2b859d607ff 100644 --- a/src/plugins/gps_importer/qgsgpsdevicedialog.cpp +++ b/src/plugins/gps_importer/qgsgpsdevicedialog.cpp @@ -140,17 +140,17 @@ void QgsGpsDeviceDialog::slotSelectionChanged( QListWidgetItem *current ) leDeviceName->setText( devName ); QgsGpsDevice *device = mDevices[devName]; leWptDown->setText( device-> - importCommand( QStringLiteral( "%babel" ), QStringLiteral( "-w" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QStringLiteral( " " ) ) ); + importCommand( QStringLiteral( "%babel" ), QStringLiteral( "-w" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QLatin1Char( ' ' ) ) ); leWptUp->setText( device-> - exportCommand( QStringLiteral( "%babel" ), QStringLiteral( "-w" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QStringLiteral( " " ) ) ); + exportCommand( QStringLiteral( "%babel" ), QStringLiteral( "-w" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QLatin1Char( ' ' ) ) ); leRteDown->setText( device-> - importCommand( QStringLiteral( "%babel" ), QStringLiteral( "-r" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QStringLiteral( " " ) ) ); + importCommand( QStringLiteral( "%babel" ), QStringLiteral( "-r" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QLatin1Char( ' ' ) ) ); leRteUp->setText( device-> - exportCommand( QStringLiteral( "%babel" ), QStringLiteral( "-r" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QStringLiteral( " " ) ) ); + exportCommand( QStringLiteral( "%babel" ), QStringLiteral( "-r" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QLatin1Char( ' ' ) ) ); leTrkDown->setText( device-> - importCommand( QStringLiteral( "%babel" ), QStringLiteral( "-t" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QStringLiteral( " " ) ) ); + importCommand( QStringLiteral( "%babel" ), QStringLiteral( "-t" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QLatin1Char( ' ' ) ) ); leTrkUp->setText( device-> - exportCommand( QStringLiteral( "%babel" ), QStringLiteral( "-t" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QStringLiteral( " " ) ) ); + exportCommand( QStringLiteral( "%babel" ), QStringLiteral( "-t" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QLatin1Char( ' ' ) ) ); } } @@ -167,17 +167,17 @@ void QgsGpsDeviceDialog::writeDeviceSettings() { deviceNames.append( iter->first ); QString wptDownload = - iter->second->importCommand( QStringLiteral( "%babel" ), QStringLiteral( "-w" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QStringLiteral( " " ) ); + iter->second->importCommand( QStringLiteral( "%babel" ), QStringLiteral( "-w" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QLatin1Char( ' ' ) ); QString wptUpload = - iter->second->exportCommand( QStringLiteral( "%babel" ), QStringLiteral( "-w" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QStringLiteral( " " ) ); + iter->second->exportCommand( QStringLiteral( "%babel" ), QStringLiteral( "-w" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QLatin1Char( ' ' ) ); QString rteDownload = - iter->second->importCommand( QStringLiteral( "%babel" ), QStringLiteral( "-r" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QStringLiteral( " " ) ); + iter->second->importCommand( QStringLiteral( "%babel" ), QStringLiteral( "-r" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QLatin1Char( ' ' ) ); QString rteUpload = - iter->second->exportCommand( QStringLiteral( "%babel" ), QStringLiteral( "-r" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QStringLiteral( " " ) ); + iter->second->exportCommand( QStringLiteral( "%babel" ), QStringLiteral( "-r" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QLatin1Char( ' ' ) ); QString trkDownload = - iter->second->importCommand( QStringLiteral( "%babel" ), QStringLiteral( "-t" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QStringLiteral( " " ) ); + iter->second->importCommand( QStringLiteral( "%babel" ), QStringLiteral( "-t" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QLatin1Char( ' ' ) ); QString trkUpload = - iter->second->exportCommand( QStringLiteral( "%babel" ), QStringLiteral( "-t" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QStringLiteral( " " ) ); + iter->second->exportCommand( QStringLiteral( "%babel" ), QStringLiteral( "-t" ), QStringLiteral( "%in" ), QStringLiteral( "%out" ) ).join( QLatin1Char( ' ' ) ); settings.setValue( devPath.arg( iter->first ) + "/wptdownload", wptDownload ); settings.setValue( devPath.arg( iter->first ) + "/wptupload", wptUpload ); diff --git a/src/plugins/grass/qgsgrassmodule.cpp b/src/plugins/grass/qgsgrassmodule.cpp index 5af628e593e2..99b72f70e062 100644 --- a/src/plugins/grass/qgsgrassmodule.cpp +++ b/src/plugins/grass/qgsgrassmodule.cpp @@ -499,7 +499,7 @@ void QgsGrassModule::run() if ( outsideRegion.size() > 0 ) { QMessageBox questionBox( QMessageBox::Question, tr( "Warning" ), - tr( "Input %1 outside current region!" ).arg( outsideRegion.join( QStringLiteral( "," ) ) ), + tr( "Input %1 outside current region!" ).arg( outsideRegion.join( QLatin1Char( ',' ) ) ), QMessageBox::Ok | QMessageBox::Cancel ); QPushButton *resetButton = nullptr; if ( QgsGrass::versionMajor() > 6 || ( QgsGrass::versionMajor() == 6 && QgsGrass::versionMinor() >= 1 ) ) @@ -532,7 +532,7 @@ void QgsGrassModule::run() if ( outputExists.size() > 0 ) { QMessageBox::StandardButton ret = QMessageBox::question( nullptr, QStringLiteral( "Warning" ), - tr( "Output %1 exists! Overwrite?" ).arg( outputExists.join( QStringLiteral( "," ) ) ), + tr( "Output %1 exists! Overwrite?" ).arg( outputExists.join( QLatin1Char( ',' ) ) ), QMessageBox::Ok | QMessageBox::Cancel ); if ( ret == QMessageBox::Cancel ) @@ -626,7 +626,7 @@ void QgsGrassModule::run() } } - QString commandHtml = mXName + " " + argumentsHtml.join( QStringLiteral( " " ) ); + QString commandHtml = mXName + " " + argumentsHtml.join( QLatin1Char( ' ' ) ); QgsDebugMsg( "command: " + commandHtml ); commandHtml.replace( QLatin1String( "&" ), QLatin1String( "&" ) ); diff --git a/src/plugins/grass/qgsgrassmoduleinput.cpp b/src/plugins/grass/qgsgrassmoduleinput.cpp index b1eb35e12034..55e38baacb3e 100644 --- a/src/plugins/grass/qgsgrassmoduleinput.cpp +++ b/src/plugins/grass/qgsgrassmoduleinput.cpp @@ -1035,7 +1035,7 @@ QStringList QgsGrassModuleInput::options() { maps << mSelectedModel->item( i )->text(); } - list << mKey + "=" + maps.join( QStringLiteral( "," ) ); + list << mKey + "=" + maps.join( QLatin1Char( ',' ) ); } else { @@ -1058,7 +1058,7 @@ QStringList QgsGrassModuleInput::options() if ( !mGeometryTypeOption.isEmpty() ) { - list << mGeometryTypeOption + "=" + currentGeometryTypeNames().join( QStringLiteral( "," ) ); + list << mGeometryTypeOption + "=" + currentGeometryTypeNames().join( QLatin1Char( ',' ) ); } } diff --git a/src/plugins/grass/qgsgrassmoduleoptions.cpp b/src/plugins/grass/qgsgrassmoduleoptions.cpp index a00a6dbf7df8..e375c00c3f9f 100644 --- a/src/plugins/grass/qgsgrassmoduleoptions.cpp +++ b/src/plugins/grass/qgsgrassmoduleoptions.cpp @@ -906,7 +906,7 @@ QDomDocument QgsGrassModuleStandardOptions::readInterfaceDescription( const QStr + "

    PATH=" + environment.value( QStringLiteral( "PATH" ) ) + "

    PYTHONPATH=" + environment.value( QStringLiteral( "PYTHONPATH" ) ) + "

    " + tr( "command" ) + QStringLiteral( ": %1 %2
    %3
    %4" ) - .arg( cmd, arguments.join( QStringLiteral( " " ) ), + .arg( cmd, arguments.join( QLatin1Char( ' ' ) ), process.readAllStandardOutput().constData(), process.readAllStandardError().constData() ); QgsDebugMsg( msg ); diff --git a/src/plugins/grass/qgsgrassmoduleparam.cpp b/src/plugins/grass/qgsgrassmoduleparam.cpp index e9984967500e..bd6f719909ee 100644 --- a/src/plugins/grass/qgsgrassmoduleparam.cpp +++ b/src/plugins/grass/qgsgrassmoduleparam.cpp @@ -654,7 +654,7 @@ QString QgsGrassModuleOption::value() values.append( mValues[i] ); } } - value = values.join( QStringLiteral( "," ) ); + value = values.join( QLatin1Char( ',' ) ); } return value; } @@ -1148,7 +1148,7 @@ QStringList QgsGrassModuleVectorField::options() if ( !valueList.isEmpty() ) { - QString opt = mKey + "=" + valueList.join( QStringLiteral( "," ) ); + QString opt = mKey + "=" + valueList.join( QLatin1Char( ',' ) ); list << opt; } @@ -1364,7 +1364,7 @@ void QgsGrassModuleSelection::onLayerSelectionChanged() { if ( !list.isEmpty() ) { - list += QLatin1String( "," ); + list += QLatin1Char( ',' ); } list += QString::number( cat ); } @@ -1476,7 +1476,7 @@ void QgsGrassModuleFile::browse() lastDir = QFileInfo( files[0] ).absolutePath(); - mLineEdit->setText( files.join( QStringLiteral( "," ) ) ); + mLineEdit->setText( files.join( QLatin1Char( ',' ) ) ); } else { diff --git a/src/plugins/grass/qgsgrasstools.cpp b/src/plugins/grass/qgsgrasstools.cpp index 0eeb69061f95..fd524b48fc49 100644 --- a/src/plugins/grass/qgsgrasstools.cpp +++ b/src/plugins/grass/qgsgrasstools.cpp @@ -209,7 +209,7 @@ void QgsGrassTools::runModule( QString name, bool direct ) QApplication::restoreOverrideCursor(); if ( !gmod->errors().isEmpty() ) { - QgsGrass::warning( gmod->errors().join( QStringLiteral( "\n" ) ) ); + QgsGrass::warning( gmod->errors().join( QLatin1Char( '\n' ) ) ); } m = qobject_cast( gmod ); } @@ -365,7 +365,7 @@ void QgsGrassTools::addModules( QStandardItem *parent, QDomElement &element, QSt if ( !errors.isEmpty() ) { QString label = e.attribute( QStringLiteral( "label" ) ) + e.attribute( QStringLiteral( "name" ) ); // one should be non empty - label += "\n ERROR:\t" + errors.join( QStringLiteral( "\n\t" ) ); + label += "\n ERROR:\t" + errors.join( QLatin1String( "\n\t" ) ); QStandardItem *item = new QStandardItem( label ); item->setData( label, Qt::UserRole + Label ); item->setData( label, Qt::UserRole + Search ); diff --git a/src/plugins/offline_editing/offline_editing_plugin_gui.cpp b/src/plugins/offline_editing/offline_editing_plugin_gui.cpp index 0ff267361c4e..396711e98af2 100644 --- a/src/plugins/offline_editing/offline_editing_plugin_gui.cpp +++ b/src/plugins/offline_editing/offline_editing_plugin_gui.cpp @@ -73,7 +73,7 @@ QVariant QgsSelectLayerTreeModel::data( const QModelIndex &index, int role ) con if ( QgsLayerTree::isLayer( node ) && index.column() > 0 ) { QgsLayerTreeLayer *nodeLayer = QgsLayerTree::toLayer( node ); - if ( nodeLayer->layer()->providerType() == QStringLiteral( "WFS" ) ) + if ( nodeLayer->layer()->providerType() == QLatin1String( "WFS" ) ) { switch ( role ) { diff --git a/src/providers/arcgisrest/qgsafsprovider.cpp b/src/providers/arcgisrest/qgsafsprovider.cpp index 4e10feeede03..7e82181e887c 100644 --- a/src/providers/arcgisrest/qgsafsprovider.cpp +++ b/src/providers/arcgisrest/qgsafsprovider.cpp @@ -158,7 +158,7 @@ QgsAfsProvider::QgsAfsProvider( const QString &uri, const ProviderOptions &optio if ( !fieldAlias.isEmpty() && fieldAlias != fieldName ) field.setAlias( fieldAlias ); - if ( fieldDataMap.contains( QStringLiteral( "domain" ) ) && fieldDataMap.value( QStringLiteral( "domain" ) ).toMap().value( QStringLiteral( "type" ) ).toString() == QStringLiteral( "codedValue" ) ) + if ( fieldDataMap.contains( QStringLiteral( "domain" ) ) && fieldDataMap.value( QStringLiteral( "domain" ) ).toMap().value( QStringLiteral( "type" ) ).toString() == QLatin1String( "codedValue" ) ) { const QVariantList values = fieldDataMap.value( QStringLiteral( "domain" ) ).toMap().value( QStringLiteral( "codedValues" ) ).toList(); QVariantList valueConfig; diff --git a/src/providers/arcgisrest/qgsamsprovider.cpp b/src/providers/arcgisrest/qgsamsprovider.cpp index a08915d739a9..151965f50b3e 100644 --- a/src/providers/arcgisrest/qgsamsprovider.cpp +++ b/src/providers/arcgisrest/qgsamsprovider.cpp @@ -447,7 +447,7 @@ static inline QString dumpVariantMap( const QVariantMap &variantMap, const QStri result += QStringLiteral( "
  9. %1
  10. " ).arg( QgsStringUtils::insertLinks( v.toString() ) ); } } - result += QStringLiteral( "" ); + result += QLatin1String( "" ); } else if ( !childMap.isEmpty() ) { diff --git a/src/providers/arcgisrest/qgsarcgisrestutils.cpp b/src/providers/arcgisrest/qgsarcgisrestutils.cpp index 209e57a96284..17556822b898 100644 --- a/src/providers/arcgisrest/qgsarcgisrestutils.cpp +++ b/src/providers/arcgisrest/qgsarcgisrestutils.cpp @@ -446,8 +446,8 @@ QVariantMap QgsArcGisRestUtils::getObjects( const QString &layerurl, const QStri QUrl queryUrl( layerurl + "/query" ); QUrlQuery query( queryUrl ); query.addQueryItem( QStringLiteral( "f" ), QStringLiteral( "json" ) ); - query.addQueryItem( QStringLiteral( "objectIds" ), ids.join( QStringLiteral( "," ) ) ); - QString wkid = crs.indexOf( QLatin1String( ":" ) ) >= 0 ? crs.split( ':' )[1] : QString(); + query.addQueryItem( QStringLiteral( "objectIds" ), ids.join( QLatin1Char( ',' ) ) ); + QString wkid = crs.indexOf( QLatin1Char( ':' ) ) >= 0 ? crs.split( ':' )[1] : QString(); query.addQueryItem( QStringLiteral( "inSR" ), wkid ); query.addQueryItem( QStringLiteral( "outSR" ), wkid ); @@ -1090,7 +1090,7 @@ QUrl QgsArcGisRestUtils::parseUrl( const QUrl &url ) QString modifiedUrlString = modifiedUrl.toString(); // Qt5 does URL encoding from some reason (of the FILTER parameter for example) modifiedUrlString = QUrl::fromPercentEncoding( modifiedUrlString.toUtf8() ); - modifiedUrlString.replace( QStringLiteral( "fake_qgis_http_endpoint/" ), QStringLiteral( "fake_qgis_http_endpoint_" ) ); + modifiedUrlString.replace( QLatin1String( "fake_qgis_http_endpoint/" ), QLatin1String( "fake_qgis_http_endpoint_" ) ); QgsDebugMsg( QStringLiteral( "Get %1" ).arg( modifiedUrlString ) ); modifiedUrlString = modifiedUrlString.mid( QStringLiteral( "http://" ).size() ); QString args = modifiedUrlString.mid( modifiedUrlString.indexOf( '?' ) ); @@ -1288,7 +1288,7 @@ void QgsArcGisRestUtils::adjustBaseUrl( QString &baseUrl, const QString name ) checkString += QString( '/' ); checkString += part; - if ( baseUrl.indexOf( QRegularExpression( checkString.replace( '/', QStringLiteral( "\\/" ) ) + QStringLiteral( "\\/?$" ) ) ) > -1 ) + if ( baseUrl.indexOf( QRegularExpression( checkString.replace( '/', QLatin1String( "\\/" ) ) + QStringLiteral( "\\/?$" ) ) ) > -1 ) { baseUrl = baseUrl.left( baseUrl.length() - checkString.length() - 1 ); break; @@ -1301,7 +1301,7 @@ void QgsArcGisRestUtils::visitFolderItems( const std::function< void( const QStr QString base( baseUrl ); bool baseChecked = false; if ( !base.endsWith( '/' ) ) - base += QStringLiteral( "/" ); + base += QLatin1Char( '/' ); const QStringList folderList = serviceData.value( QStringLiteral( "folders" ) ).toStringList(); for ( const QString &folder : folderList ) @@ -1320,7 +1320,7 @@ void QgsArcGisRestUtils::visitServiceItems( const std::function< void( const QSt QString base( baseUrl ); bool baseChecked = false; if ( !base.endsWith( '/' ) ) - base += QStringLiteral( "/" ); + base += QLatin1Char( '/' ); const QVariantList serviceList = serviceData.value( QStringLiteral( "services" ) ).toList(); for ( const QVariant &service : serviceList ) diff --git a/src/providers/db2/qgsdb2dataitems.cpp b/src/providers/db2/qgsdb2dataitems.cpp index 251c21da4819..ec910fffec73 100644 --- a/src/providers/db2/qgsdb2dataitems.cpp +++ b/src/providers/db2/qgsdb2dataitems.cpp @@ -182,12 +182,12 @@ QVector QgsDb2ConnectionItem::createChildren() /* Enabling the DB2 Spatial Extender creates the DB2GSE schema and tables, so the Extender is either not enabled or set up if SQLCODE -204 is returned. */ - if ( sqlcode == QStringLiteral( "-204" ) ) + if ( sqlcode == QLatin1String( "-204" ) ) { children.append( new QgsErrorItem( this, tr( "DB2 Spatial Extender is not enabled or set up." ), mPath + "/error" ) ); return children; } - else if ( !sqlcode.isEmpty() && sqlcode != QStringLiteral( "0" ) ) + else if ( !sqlcode.isEmpty() && sqlcode != QLatin1String( "0" ) ) { children.append( new QgsErrorItem( this, db.lastError().text(), mPath + "/error" ) ); return children; @@ -326,7 +326,7 @@ bool QgsDb2ConnectionItem::handleDrop( const QMimeData *data, const QString &toS { QgsMessageOutput *output = QgsMessageOutput::createMessageOutput(); output->setTitle( tr( "Import to DB2 database" ) ); - output->setMessage( tr( "Failed to import some layers!\n\n" ) + importResults.join( QStringLiteral( "\n" ) ), QgsMessageOutput::MessageText ); + output->setMessage( tr( "Failed to import some layers!\n\n" ) + importResults.join( QLatin1Char( '\n' ) ), QgsMessageOutput::MessageText ); output->showMessage(); } diff --git a/src/providers/db2/qgsdb2featureiterator.cpp b/src/providers/db2/qgsdb2featureiterator.cpp index b0b488604f68..3e63d5ec22ca 100644 --- a/src/providers/db2/qgsdb2featureiterator.cpp +++ b/src/providers/db2/qgsdb2featureiterator.cpp @@ -269,7 +269,7 @@ void QgsDb2FeatureIterator::BuildStatement( const QgsFeatureRequest &request ) if ( !orderByParts.isEmpty() ) { - mOrderByClause = QStringLiteral( " ORDER BY %1" ).arg( orderByParts.join( QStringLiteral( "," ) ) ); + mOrderByClause = QStringLiteral( " ORDER BY %1" ).arg( orderByParts.join( QLatin1Char( ',' ) ) ); mStatement += mOrderByClause; } diff --git a/src/providers/db2/qgsdb2geometrycolumns.cpp b/src/providers/db2/qgsdb2geometrycolumns.cpp index ae4e671ed602..27627f46c0fe 100644 --- a/src/providers/db2/qgsdb2geometrycolumns.cpp +++ b/src/providers/db2/qgsdb2geometrycolumns.cpp @@ -65,7 +65,7 @@ QString QgsDb2GeometryColumns::open( const QString &schemaName, const QString &t QgsDebugMsg( QStringLiteral( "SQLCODE: %1" ).arg( nativeError ) ); /* The MIN_X, MIN_Y, MAX_X, and MAX_Y columns are not available on z/OS (and LUW 9.5) so SQLCODE -206 is returned when specifying non-existent columns. */ - if ( mQuery.lastError().nativeErrorCode() == QStringLiteral( "-206" ) ) + if ( mQuery.lastError().nativeErrorCode() == QLatin1String( "-206" ) ) { QgsDebugMsg( QStringLiteral( "Try query with no extents" ) ); mQuery.clear(); diff --git a/src/providers/db2/qgsdb2provider.cpp b/src/providers/db2/qgsdb2provider.cpp index 2ed8b3277304..e4111df4ac4c 100644 --- a/src/providers/db2/qgsdb2provider.cpp +++ b/src/providers/db2/qgsdb2provider.cpp @@ -611,7 +611,7 @@ void QgsDb2Provider::updateStatistics() const QgsDebugMsg( QStringLiteral( "mSRId: %1" ).arg( mSRId ) ); QgsDb2GeometryColumns gc( mDatabase ); QString rc = gc.open( mSchemaName, mTableName ); // returns SQLCODE if failure - if ( rc.isEmpty() || rc == QStringLiteral( "0" ) ) + if ( rc.isEmpty() || rc == QLatin1String( "0" ) ) { mEnvironment = gc.db2Environment(); if ( -1 == mSRId ) @@ -1418,7 +1418,7 @@ QgsVectorLayerExporter::ExportError QgsDb2Provider::createEmptyLayer( const QStr sql = "DROP TABLE " + fullName; if ( !q.exec( sql ) ) { - if ( q.lastError().nativeErrorCode() != QStringLiteral( "-206" ) ) // -206 is "not found" just ignore + if ( q.lastError().nativeErrorCode() != QLatin1String( "-206" ) ) // -206 is "not found" just ignore { QString lastError = q.lastError().text(); QgsDebugMsg( lastError ); @@ -1523,7 +1523,7 @@ QgsVectorLayerExporter::ExportError QgsDb2Provider::createEmptyLayer( const QStr // get the environment QgsDb2GeometryColumns gc( db ); QString rc = gc.open( schemaName, tableName ); // returns SQLCODE if failure - if ( rc.isEmpty() || rc == QStringLiteral( "0" ) ) + if ( rc.isEmpty() || rc == QLatin1String( "0" ) ) { db2Environment = gc.db2Environment(); } diff --git a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp index 53e90d2e3e45..951e16c787a4 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp @@ -748,28 +748,28 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes ) } } - if ( typeName == QStringLiteral( "integer" ) ) + if ( typeName == QLatin1String( "integer" ) ) { fieldType = QVariant::Int; } - else if ( typeName == QStringLiteral( "longlong" ) ) + else if ( typeName == QLatin1String( "longlong" ) ) { fieldType = QVariant::LongLong; } - else if ( typeName == QStringLiteral( "real" ) || typeName == QStringLiteral( "double" ) ) + else if ( typeName == QLatin1String( "real" ) || typeName == QLatin1String( "double" ) ) { typeName = QStringLiteral( "double" ); fieldType = QVariant::Double; } - else if ( typeName == QStringLiteral( "datetime" ) ) + else if ( typeName == QLatin1String( "datetime" ) ) { fieldType = QVariant::DateTime; } - else if ( typeName == QStringLiteral( "date" ) ) + else if ( typeName == QLatin1String( "date" ) ) { fieldType = QVariant::Date; } - else if ( typeName == QStringLiteral( "time" ) ) + else if ( typeName == QLatin1String( "time" ) ) { fieldType = QVariant::Time; } diff --git a/src/providers/geonode/qgsgeonodedataitems.cpp b/src/providers/geonode/qgsgeonodedataitems.cpp index f8da694e70bd..4d0a1e8caf1e 100644 --- a/src/providers/geonode/qgsgeonodedataitems.cpp +++ b/src/providers/geonode/qgsgeonodedataitems.cpp @@ -71,7 +71,7 @@ QgsGeoNodeServiceItem::QgsGeoNodeServiceItem( QgsDataItem *parent, QgsGeoNodeCon , mServiceName( serviceName ) , mConnection( conn ) { - if ( serviceName == QStringLiteral( "WMS" ) || serviceName == QStringLiteral( "XYZ" ) ) + if ( serviceName == QLatin1String( "WMS" ) || serviceName == QLatin1String( "XYZ" ) ) { mIconName = QStringLiteral( "mIconWms.svg" ); } @@ -95,7 +95,7 @@ QVector QgsGeoNodeServiceItem::createChildren() while ( !skipProvider ) { - const QString &key = mServiceName != QStringLiteral( "WFS" ) ? QStringLiteral( "wms" ) : mServiceName; + const QString &key = mServiceName != QLatin1String( "WFS" ) ? QStringLiteral( "wms" ) : mServiceName; const QList providerList = QgsProviderRegistry::instance()->dataItemProviders( key ); if ( providerList.isEmpty() ) @@ -125,7 +125,7 @@ QVector QgsGeoNodeServiceItem::createChildren() continue; } - if ( mServiceName == QStringLiteral( "XYZ" ) ) + if ( mServiceName == QLatin1String( "XYZ" ) ) { return items; } diff --git a/src/providers/geonode/qgsgeonodesourceselect.cpp b/src/providers/geonode/qgsgeonodesourceselect.cpp index 30b803a9b932..0f286b589428 100644 --- a/src/providers/geonode/qgsgeonodesourceselect.cpp +++ b/src/providers/geonode/qgsgeonodesourceselect.cpp @@ -392,7 +392,7 @@ void QgsGeoNodeSourceSelect::addButtonClicked() layerName = titleName; } - if ( webServiceType == QStringLiteral( "WMS" ) ) + if ( webServiceType == QLatin1String( "WMS" ) ) { QgsDataSourceUri uri; uri.setParam( QStringLiteral( "url" ), serviceURL ); @@ -414,7 +414,7 @@ void QgsGeoNodeSourceSelect::addButtonClicked() QgsDebugMsg( "Add WMS from GeoNode : " + uri.encodedUri() ); emit addRasterLayer( uri.encodedUri(), layerName, QStringLiteral( "wms" ) ); } - else if ( webServiceType == QStringLiteral( "WFS" ) ) + else if ( webServiceType == QLatin1String( "WFS" ) ) { // Set static first, to see that it works. Need to think about the UI also. QString typeName = mModel->item( row, 0 )->data( Qt::UserRole + 3 ).toString(); @@ -446,7 +446,7 @@ void QgsGeoNodeSourceSelect::addButtonClicked() QgsDebugMsg( "Add WFS from GeoNode : " + uri.uri() + " and typename: " + typeName ); emit addVectorLayer( uri.uri(), typeName, QStringLiteral( "WFS" ) ); } - else if ( webServiceType == QStringLiteral( "XYZ" ) ) + else if ( webServiceType == QLatin1String( "XYZ" ) ) { QgsDebugMsg( "XYZ Url: " + serviceURL ); QgsDebugMsg( "Add XYZ from GeoNode : " + serviceURL ); diff --git a/src/providers/grass/qgsgrass.cpp b/src/providers/grass/qgsgrass.cpp index 359dd54ee47e..c8d04eead5d5 100644 --- a/src/providers/grass/qgsgrass.cpp +++ b/src/providers/grass/qgsgrass.cpp @@ -883,7 +883,7 @@ QString QgsGrass::openMapset( const QString &gisdbase, QString lockProgram( gisbase() + "/etc/lock" ); QStringList lockArguments; lockArguments << lock << QString::number( pid ); - QString lockCommand = lockProgram + " " + lockArguments.join( QStringLiteral( " " ) ); // for debug + QString lockCommand = lockProgram + " " + lockArguments.join( QLatin1Char( ' ' ) ); // for debug QgsDebugMsg( "lock command: " + lockCommand ); process.start( lockProgram, lockArguments ); @@ -1953,7 +1953,7 @@ QProcess *QgsGrass::startModule( const QString &gisdbase, const QString &locati throw QgsGrass::Exception( QObject::tr( "Cannot open GISRC file" ) ); } - QString error = tr( "Cannot start module" ) + "\n" + tr( "command: %1 %2" ).arg( module, arguments.join( QStringLiteral( " " ) ) ); + QString error = tr( "Cannot start module" ) + "\n" + tr( "command: %1 %2" ).arg( module, arguments.join( QLatin1Char( ' ' ) ) ); QTextStream out( &gisrcFile ); out << "GISDBASE: " << gisdbase << "\n"; @@ -2011,7 +2011,7 @@ QByteArray QgsGrass::runModule( const QString &gisdbase, const QString &locatio throw QgsGrass::Exception( QObject::tr( "Cannot run module" ) + "\n" + QObject::tr( "command: %1 %2\nstdout: %3\nstderr: %4" ) - .arg( moduleName, arguments.join( QStringLiteral( " " ) ), + .arg( moduleName, arguments.join( QLatin1Char( ' ' ) ), process->readAllStandardOutput().constData(), process->readAllStandardError().constData() ) ); } @@ -2410,7 +2410,7 @@ void QgsGrass::createTable( dbDriver *driver, const QString &tableName, const Qg } fieldsStringList << name + " " + typeName; } - QString sql = QStringLiteral( "create table %1 (%2);" ).arg( tableName, fieldsStringList.join( QStringLiteral( ", " ) ) ); + QString sql = QStringLiteral( "create table %1 (%2);" ).arg( tableName, fieldsStringList.join( QLatin1String( ", " ) ) ); dbString dbstr; db_init_string( &dbstr ); @@ -2473,7 +2473,7 @@ void QgsGrass::insertRow( dbDriver *driver, const QString &tableName, valuesStringList << valueString; } - QString sql = QStringLiteral( "insert into %1 values (%2);" ).arg( tableName, valuesStringList.join( QStringLiteral( ", " ) ) ); + QString sql = QStringLiteral( "insert into %1 values (%2);" ).arg( tableName, valuesStringList.join( QLatin1String( ", " ) ) ); dbString dbstr; db_init_string( &dbstr ); diff --git a/src/providers/grass/qgsgrassfeatureiterator.cpp b/src/providers/grass/qgsgrassfeatureiterator.cpp index 850651a00e1f..69953a52eb41 100644 --- a/src/providers/grass/qgsgrassfeatureiterator.cpp +++ b/src/providers/grass/qgsgrassfeatureiterator.cpp @@ -541,7 +541,7 @@ bool QgsGrassFeatureIterator::fetchFeature( QgsFeature &feature ) { int line = Vect_get_node_line( mSource->map(), lid, i ); QgsDebugMsg( "cancel" ); - if ( i > 0 ) lines += QLatin1String( "," ); + if ( i > 0 ) lines += QLatin1Char( ',' ); lines += QString::number( line ); } feature.setAttribute( 1, lines ); diff --git a/src/providers/grass/qgsgrassprovidermodule.cpp b/src/providers/grass/qgsgrassprovidermodule.cpp index 3430e6a3a88f..0c031aec6b8f 100644 --- a/src/providers/grass/qgsgrassprovidermodule.cpp +++ b/src/providers/grass/qgsgrassprovidermodule.cpp @@ -926,7 +926,7 @@ bool QgsGrassMapsetItem::handleDrop( const QMimeData *data, Qt::DropAction ) if ( !errors.isEmpty() ) { QgsMessageOutput::showMessage( tr( "Import to GRASS mapset" ), - tr( "Failed to import some layers!\n\n" ) + errors.join( QStringLiteral( "\n" ) ), + tr( "Failed to import some layers!\n\n" ) + errors.join( QLatin1Char( '\n' ) ), QgsMessageOutput::MessageText ); } diff --git a/src/providers/grass/qgsgrassvectormaplayer.cpp b/src/providers/grass/qgsgrassvectormaplayer.cpp index 2ba105a4db46..0e594a717c24 100644 --- a/src/providers/grass/qgsgrassvectormaplayer.cpp +++ b/src/providers/grass/qgsgrassvectormaplayer.cpp @@ -714,7 +714,7 @@ void QgsGrassVectorMapLayer::addColumn( const QgsField &field, QString &error ) } if ( errors.size() > 5 ) { - error = tr( "Errors updating restored column, update interrupted" ) + " : " + errors.join( QStringLiteral( "; " ) ); + error = tr( "Errors updating restored column, update interrupted" ) + " : " + errors.join( QLatin1String( "; " ) ); break; } } @@ -757,7 +757,7 @@ void QgsGrassVectorMapLayer::deleteColumn( const QgsField &field, QString &error } QStringList queries; queries << QStringLiteral( "BEGIN TRANSACTION" ); - queries << QStringLiteral( "CREATE TEMPORARY TABLE %1_tmp_drop_column AS SELECT %2 FROM %1" ).arg( mFieldInfo->table, columns.join( QStringLiteral( "," ) ) ); + queries << QStringLiteral( "CREATE TEMPORARY TABLE %1_tmp_drop_column AS SELECT %2 FROM %1" ).arg( mFieldInfo->table, columns.join( QLatin1Char( ',' ) ) ); queries << QStringLiteral( "DROP TABLE %1" ).arg( mFieldInfo->table ); queries << QStringLiteral( "CREATE TABLE %1 AS SELECT * FROM %1_tmp_drop_column" ).arg( mFieldInfo->table ); queries << QStringLiteral( "DROP TABLE %1_tmp_drop_column" ).arg( mFieldInfo->table ); @@ -873,7 +873,7 @@ void QgsGrassVectorMapLayer::insertAttributes( int cat, const QgsFeature &featur } QString query = QStringLiteral( "INSERT INTO %1 ( %2 ) VALUES ( %3 )" ).arg( mFieldInfo->table, - names.join( QStringLiteral( ", " ) ), values.join( QStringLiteral( "," ) ) ); + names.join( QLatin1String( ", " ) ), values.join( QLatin1Char( ',' ) ) ); executeSql( query, error ); if ( error.isEmpty() ) { @@ -920,7 +920,7 @@ void QgsGrassVectorMapLayer::reinsertAttributes( int cat, QString &error ) } } - QString query = QStringLiteral( "INSERT INTO %1 ( %2 ) VALUES ( %3 )" ).arg( mFieldInfo->table, names.join( QStringLiteral( ", " ) ), values.join( QStringLiteral( "," ) ) ); + QString query = QStringLiteral( "INSERT INTO %1 ( %2 ) VALUES ( %3 )" ).arg( mFieldInfo->table, names.join( QLatin1String( ", " ) ), values.join( QLatin1Char( ',' ) ) ); executeSql( query, error ); } else @@ -993,7 +993,7 @@ void QgsGrassVectorMapLayer::updateAttributes( int cat, QgsFeature &feature, QSt } QString query = QStringLiteral( "UPDATE %1 SET %2 WHERE %3 = %4" ).arg( mFieldInfo->table, - updates.join( QStringLiteral( ", " ) ), mFieldInfo->key ).arg( cat ); + updates.join( QLatin1String( ", " ) ), mFieldInfo->key ).arg( cat ); executeSql( query, error ); if ( error.isEmpty() ) @@ -1106,7 +1106,7 @@ void QgsGrassVectorMapLayer::changeAttributeValue( int cat, const QgsField &fiel names << field.name(); values << quotedValue( value ); query = QStringLiteral( "INSERT INTO %1 ( %2 ) VALUES ( %3 )" ).arg( mFieldInfo->table, - names.join( QStringLiteral( ", " ) ), values.join( QStringLiteral( "," ) ) ); + names.join( QLatin1String( ", " ) ), values.join( QLatin1Char( ',' ) ) ); } QgsDebugMsg( QString( "query: %1" ).arg( query ) ); diff --git a/src/providers/mdal/qgsmdalprovider.cpp b/src/providers/mdal/qgsmdalprovider.cpp index c57f8645a888..5006d14c9652 100644 --- a/src/providers/mdal/qgsmdalprovider.cpp +++ b/src/providers/mdal/qgsmdalprovider.cpp @@ -508,7 +508,7 @@ void QgsMdalProvider::fileMeshFilters( QString &fileMeshFiltersString, QString & QString longName = MDAL_DR_longName( mdalDriver ); QString driverFilters = MDAL_DR_filters( mdalDriver ); - driverFilters = driverFilters.replace( QStringLiteral( ";;" ), QStringLiteral( " " ) ); + driverFilters = driverFilters.replace( QLatin1String( ";;" ), QLatin1String( " " ) ); bool isMeshDriver = MDAL_DR_meshLoadCapability( mdalDriver ); @@ -531,11 +531,11 @@ void QgsMdalProvider::fileMeshFilters( QString &fileMeshFiltersString, QString & // sort file filters alphabetically QStringList filters = fileMeshFiltersString.split( QStringLiteral( ";;" ), QString::SkipEmptyParts ); filters.sort(); - fileMeshFiltersString = filters.join( QStringLiteral( ";;" ) ) + ";;"; + fileMeshFiltersString = filters.join( QLatin1String( ";;" ) ) + ";;"; filters = fileMeshDatasetFiltersString.split( QStringLiteral( ";;" ), QString::SkipEmptyParts ); filters.sort(); - fileMeshDatasetFiltersString = filters.join( QStringLiteral( ";;" ) ) + ";;"; + fileMeshDatasetFiltersString = filters.join( QLatin1String( ";;" ) ) + ";;"; // can't forget the default case - first fileMeshFiltersString.prepend( QObject::tr( "All files" ) + " (*);;" ); @@ -597,8 +597,8 @@ void QgsMdalProvider::fileMeshExtensions( QStringList &fileMeshExtensions, fileMeshExtensions.erase( std::unique( fileMeshExtensions.begin(), fileMeshExtensions.end() ), fileMeshExtensions.end() ); fileMeshDatasetExtensions.erase( std::unique( fileMeshDatasetExtensions.begin(), fileMeshDatasetExtensions.end() ), fileMeshDatasetExtensions.end() ); - QgsDebugMsgLevel( "Mesh extensions list built: " + fileMeshExtensions.join( QStringLiteral( ";;" ) ), 2 ); - QgsDebugMsgLevel( "Mesh dataset extensions list built: " + fileMeshDatasetExtensions.join( QStringLiteral( ";;" ) ), 2 ); + QgsDebugMsgLevel( "Mesh extensions list built: " + fileMeshExtensions.join( QLatin1String( ";;" ) ), 2 ); + QgsDebugMsgLevel( "Mesh dataset extensions list built: " + fileMeshDatasetExtensions.join( QLatin1String( ";;" ) ), 2 ); } /*----------------------------------------------------------------------------------------------*/ diff --git a/src/providers/mssql/qgsmssqldataitems.cpp b/src/providers/mssql/qgsmssqldataitems.cpp index dbcb6f228b8f..264355df4676 100644 --- a/src/providers/mssql/qgsmssqldataitems.cpp +++ b/src/providers/mssql/qgsmssqldataitems.cpp @@ -466,7 +466,7 @@ bool QgsMssqlConnectionItem::handleDrop( const QMimeData *data, const QString &t { QgsMessageOutput *output = QgsMessageOutput::createMessageOutput(); output->setTitle( tr( "Import to MSSQL database" ) ); - output->setMessage( tr( "Failed to import some layers!\n\n" ) + importResults.join( QStringLiteral( "\n" ) ), QgsMessageOutput::MessageText ); + output->setMessage( tr( "Failed to import some layers!\n\n" ) + importResults.join( QLatin1Char( '\n' ) ), QgsMessageOutput::MessageText ); output->showMessage(); } diff --git a/src/providers/mssql/qgsmssqlexpressioncompiler.cpp b/src/providers/mssql/qgsmssqlexpressioncompiler.cpp index 55e9066359ac..b992cf436bd8 100644 --- a/src/providers/mssql/qgsmssqlexpressioncompiler.cpp +++ b/src/providers/mssql/qgsmssqlexpressioncompiler.cpp @@ -120,8 +120,8 @@ QString QgsMssqlExpressionCompiler::quotedValue( const QVariant &value, bool &ok QString QgsMssqlExpressionCompiler::quotedIdentifier( const QString &identifier ) { QString quoted = identifier; - quoted.replace( '[', QStringLiteral( "[[" ) ); - quoted.replace( ']', QStringLiteral( "]]" ) ); + quoted.replace( '[', QLatin1String( "[[" ) ); + quoted.replace( ']', QLatin1String( "]]" ) ); quoted = quoted.prepend( '[' ).append( ']' ); return quoted; } diff --git a/src/providers/mssql/qgsmssqlfeatureiterator.cpp b/src/providers/mssql/qgsmssqlfeatureiterator.cpp index a1ef722546c1..4cbbf910161c 100644 --- a/src/providers/mssql/qgsmssqlfeatureiterator.cpp +++ b/src/providers/mssql/qgsmssqlfeatureiterator.cpp @@ -112,7 +112,7 @@ QString QgsMssqlFeatureIterator::whereClauseFid( QgsFeatureId featureId ) delim = QStringLiteral( " AND " ); } - whereClause += QStringLiteral( ")" ); + whereClause += QLatin1Char( ')' ); } else { @@ -222,7 +222,7 @@ void QgsMssqlFeatureIterator::BuildStatement( const QgsFeatureRequest &request ) << qgsDoubleToString( validLon( mFilterRect.xMinimum() ) ) << ' ' << qgsDoubleToString( validLat( mFilterRect.yMinimum() ) ); } - mStatement += QStringLiteral( " WHERE " ); + mStatement += QLatin1String( " WHERE " ); if ( !mDisableInvalidGeometryHandling ) mStatement += QStringLiteral( "[%1].STIsValid() = 1 AND " ).arg( mSource->mGeometryColName ); @@ -416,7 +416,7 @@ void QgsMssqlFeatureIterator::BuildStatement( const QgsFeatureRequest &request ) if ( !orderByParts.isEmpty() ) { - mOrderByClause = QStringLiteral( " ORDER BY %1" ).arg( orderByParts.join( QStringLiteral( "," ) ) ); + mOrderByClause = QStringLiteral( " ORDER BY %1" ).arg( orderByParts.join( QLatin1Char( ',' ) ) ); } QgsDebugMsgLevel( mStatement + " " + mOrderByClause, 2 ); diff --git a/src/providers/mssql/qgsmssqlgeomcolumntypethread.cpp b/src/providers/mssql/qgsmssqlgeomcolumntypethread.cpp index c03c12ce27b6..771134c51d73 100644 --- a/src/providers/mssql/qgsmssqlgeomcolumntypethread.cpp +++ b/src/providers/mssql/qgsmssqlgeomcolumntypethread.cpp @@ -105,8 +105,8 @@ void QgsMssqlGeomColumnTypeThread::run() srids << srid; } - type = types.join( QStringLiteral( "," ) ); - srid = srids.join( QStringLiteral( "," ) ); + type = types.join( QLatin1Char( ',' ) ); + srid = srids.join( QLatin1Char( ',' ) ); } layerProperty.type = type; diff --git a/src/providers/mssql/qgsmssqlprovider.cpp b/src/providers/mssql/qgsmssqlprovider.cpp index bf4cb0526114..62c8527a916a 100644 --- a/src/providers/mssql/qgsmssqlprovider.cpp +++ b/src/providers/mssql/qgsmssqlprovider.cpp @@ -299,7 +299,7 @@ void QgsMssqlProvider::loadMetadata() QString detectedType = query.value( 2 ).toString(); QString dim = query.value( 3 ).toString(); if ( dim == QLatin1String( "3" ) && !detectedType.endsWith( 'M' ) ) - detectedType += QLatin1String( "Z" ); + detectedType += QLatin1Char( 'Z' ); else if ( dim == QLatin1String( "4" ) ) detectedType += QLatin1String( "ZM" ); mWkbType = getWkbType( detectedType ); @@ -389,7 +389,7 @@ void QgsMssqlProvider::loadFields() // Field length in chars is column 7 ("Length") of the sp_columns output, // except for uniqueidentifiers which must use column 6 ("Precision"). int length = query.value( sqlTypeName.startsWith( QLatin1String( "uniqueidentifier" ), Qt::CaseInsensitive ) ? 6 : 7 ).toInt(); - if ( sqlTypeName.startsWith( QLatin1String( "n" ) ) ) + if ( sqlTypeName.startsWith( QLatin1Char( 'n' ) ) ) { length = length / 2; } @@ -1045,7 +1045,7 @@ bool QgsMssqlProvider::addFeatures( QgsFeatureList &flist, Flags flags ) QString values; if ( !( flags & QgsFeatureSink::FastInsert ) ) { - statement += QStringLiteral( "DECLARE @px TABLE (" ); + statement += QLatin1String( "DECLARE @px TABLE (" ); QString delim; for ( auto idx : mPrimaryKeyAttrs ) @@ -1112,7 +1112,7 @@ bool QgsMssqlProvider::addFeatures( QgsFeatureList &flist, Flags flags ) first = false; statement += QStringLiteral( "[%1]" ).arg( fld.name() ); - values += QStringLiteral( "?" ); + values += QLatin1Char( '?' ); } // append geometry column name @@ -1141,10 +1141,10 @@ bool QgsMssqlProvider::addFeatures( QgsFeatureList &flist, Flags flags ) } } - statement += QStringLiteral( ") " ); + statement += QLatin1String( ") " ); if ( !( flags & QgsFeatureSink::FastInsert ) && !mPrimaryKeyAttrs.isEmpty() ) { - statement += QStringLiteral( " OUTPUT " ); + statement += QLatin1String( " OUTPUT " ); QString delim; @@ -1155,14 +1155,14 @@ bool QgsMssqlProvider::addFeatures( QgsFeatureList &flist, Flags flags ) delim = QStringLiteral( "," ); } - statement += QStringLiteral( " INTO @px " ); + statement += QLatin1String( " INTO @px " ); } statement += QStringLiteral( " VALUES (" ) + values + ')'; if ( !( flags & QgsFeatureSink::FastInsert && !mPrimaryKeyAttrs.isEmpty() ) ) { - statement += QStringLiteral( "; SELECT * FROM @px;" ); + statement += QLatin1String( "; SELECT * FROM @px;" ); } // use prepared statement to prevent from sql injection @@ -1968,7 +1968,7 @@ void QgsMssqlProvider::mssqlWkbTypeAndDimension( QgsWkbTypes::Type wkbType, QStr } else if ( QgsWkbTypes::hasM( wkbType ) ) { - geometryType += QLatin1String( "M" ); + geometryType += QLatin1Char( 'M' ); dim = 3; } else if ( wkbType >= QgsWkbTypes::Point25D && wkbType <= QgsWkbTypes::MultiPolygon25D ) @@ -2856,7 +2856,7 @@ QString QgsMssqlProvider::whereClauseFid( QgsFeatureId featureId ) delim = QStringLiteral( " AND " ); } - whereClause += QStringLiteral( ")" ); + whereClause += QLatin1Char( ')' ); } else { diff --git a/src/providers/oracle/qgsoracleconn.cpp b/src/providers/oracle/qgsoracleconn.cpp index 7671bb2d3b8e..f4edf1112877 100644 --- a/src/providers/oracle/qgsoracleconn.cpp +++ b/src/providers/oracle/qgsoracleconn.cpp @@ -354,7 +354,7 @@ bool QgsOracleConn::supportedLayers( QVector &layers, co QString QgsOracleConn::quotedIdentifier( QString ident ) { - ident.replace( '"', QStringLiteral( "\"\"" ) ); + ident.replace( '"', QLatin1String( "\"\"" ) ); ident = ident.prepend( '\"' ).append( '\"' ); return ident; } @@ -406,8 +406,8 @@ QString QgsOracleConn::quotedValue( const QVariant &value, QVariant::Type type ) } QString v = value.toString(); - v.replace( '\'', QStringLiteral( "''" ) ); - v.replace( QStringLiteral( "\\\"" ), QStringLiteral( "\\\\\"" ) ); + v.replace( '\'', QLatin1String( "''" ) ); + v.replace( QLatin1String( "\\\"" ), QLatin1String( "\\\\\"" ) ); return v.prepend( '\'' ).append( '\'' ); } @@ -566,7 +566,7 @@ void QgsOracleConn::retrieveLayerTypes( QgsOracleLayerProperty &layerProperty, b QString sql = QStringLiteral( "SELECT DISTINCT " ); if ( detectedType == QgsWkbTypes::Unknown ) { - sql += QStringLiteral( "t.%1.SDO_GTYPE" ); + sql += QLatin1String( "t.%1.SDO_GTYPE" ); if ( detectedSrid <= 0 ) { sql += ','; @@ -576,10 +576,10 @@ void QgsOracleConn::retrieveLayerTypes( QgsOracleLayerProperty &layerProperty, b if ( detectedSrid <= 0 ) { - sql += QStringLiteral( "t.%1.SDO_SRID" ); + sql += QLatin1String( "t.%1.SDO_SRID" ); } - sql += QStringLiteral( " FROM %2 t WHERE NOT t.%1 IS NULL%3" ); + sql += QLatin1String( " FROM %2 t WHERE NOT t.%1 IS NULL%3" ); if ( !exec( qry, sql .arg( quotedIdentifier( layerProperty.geometryColName ), diff --git a/src/providers/oracle/qgsoraclefeatureiterator.cpp b/src/providers/oracle/qgsoraclefeatureiterator.cpp index 3d2089ab6001..4fddfeb33e82 100644 --- a/src/providers/oracle/qgsoraclefeatureiterator.cpp +++ b/src/providers/oracle/qgsoraclefeatureiterator.cpp @@ -174,7 +174,7 @@ QgsOracleFeatureIterator::QgsOracleFeatureIterator( QgsOracleFeatureSource *sour if ( mSource->mRequestedGeomType != QgsWkbTypes::Unknown && mSource->mRequestedGeomType != mSource->mDetectedGeomType ) { if ( !whereClause.isEmpty() ) - whereClause += QStringLiteral( " AND " ); + whereClause += QLatin1String( " AND " ); whereClause += '('; @@ -188,7 +188,7 @@ QgsOracleFeatureIterator::QgsOracleFeatureIterator( QgsOracleFeatureSource *sour if ( !mSource->mSqlWhereClause.isEmpty() ) { if ( !whereClause.isEmpty() ) - whereClause += QStringLiteral( " AND " ); + whereClause += QLatin1String( " AND " ); whereClause += '(' + mSource->mSqlWhereClause + ')'; } @@ -233,10 +233,10 @@ QgsOracleFeatureIterator::QgsOracleFeatureIterator( QgsOracleFeatureSource *sour if ( mRequest.limit() >= 0 && limitAtProvider ) { if ( !whereClause.isEmpty() ) - whereClause += QStringLiteral( " AND " ); + whereClause += QLatin1String( " AND " ); - whereClause += QStringLiteral( "rownum<=?" ); - fallbackStatement += QStringLiteral( "rownum<=?" ); + whereClause += QLatin1String( "rownum<=?" ); + fallbackStatement += QLatin1String( "rownum<=?" ); args << QVariant::fromValue( mRequest.limit() ); } @@ -405,7 +405,7 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature &feature ) QgsField fld = mSource->mFields.at( idx ); QVariant v = mQry.value( col ); - if ( fld.type() == QVariant::ByteArray && fld.typeName().endsWith( QStringLiteral( ".SDO_GEOMETRY" ) ) ) + if ( fld.type() == QVariant::ByteArray && fld.typeName().endsWith( QLatin1String( ".SDO_GEOMETRY" ) ) ) { QByteArray ba( v.toByteArray() ); if ( ba.size() > 0 ) diff --git a/src/providers/postgres/qgspgsourceselect.cpp b/src/providers/postgres/qgspgsourceselect.cpp index 88ca4159d7e3..306c258dfe02 100644 --- a/src/providers/postgres/qgspgsourceselect.cpp +++ b/src/providers/postgres/qgspgsourceselect.cpp @@ -177,7 +177,7 @@ void QgsPgSourceSelectDelegate::setModelData( QWidget *editor, QAbstractItemMode cols << item->text(); } - model->setData( index, cols.isEmpty() ? tr( "Select…" ) : cols.join( QStringLiteral( ", " ) ) ); + model->setData( index, cols.isEmpty() ? tr( "Select…" ) : cols.join( QLatin1String( ", " ) ) ); model->setData( index, cols, Qt::UserRole + 2 ); } } @@ -511,7 +511,7 @@ void QgsPgSourceSelect::addButtonClicked() continue; mSelectedTables << uri; - if ( uri.startsWith( QStringLiteral( "PG: " ) ) ) + if ( uri.startsWith( QLatin1String( "PG: " ) ) ) { rasterTables.append( QPair( idx.data().toString(), uri ) ); } diff --git a/src/providers/postgres/qgspgtablemodel.cpp b/src/providers/postgres/qgspgtablemodel.cpp index d006ce163988..b38f6af8dbec 100644 --- a/src/providers/postgres/qgspgtablemodel.cpp +++ b/src/providers/postgres/qgspgtablemodel.cpp @@ -105,7 +105,7 @@ void QgsPgTableModel::addTableEntry( const QgsPostgresLayerProperty &layerProper QString commentText { layerProperty.tableComment }; commentText.replace( QRegularExpression( QStringLiteral( "^\n*" ) ), QString() ); commentItem->setText( commentText ); - commentItem->setToolTip( QStringLiteral( "%1" ).arg( commentText.replace( '\n', QStringLiteral( "
    " ) ) ) ); + commentItem->setToolTip( QStringLiteral( "%1" ).arg( commentText.replace( '\n', QLatin1String( "
    " ) ) ) ); commentItem->setTextAlignment( Qt::AlignTop ); } QStandardItem *geomItem = new QStandardItem( layerProperty.geometryColName ); diff --git a/src/providers/postgres/qgspostgresconn.cpp b/src/providers/postgres/qgspostgresconn.cpp index b224408007d3..d34baf69b8d6 100644 --- a/src/providers/postgres/qgspostgresconn.cpp +++ b/src/providers/postgres/qgspostgresconn.cpp @@ -589,7 +589,7 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP query += sql; } - query += QStringLiteral( " ORDER BY 2,1,3" ); + query += QLatin1String( " ORDER BY 2,1,3" ); QgsDebugMsgLevel( "getting table info from layer registries: " + query, 2 ); @@ -655,7 +655,7 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP layerProperty.geometryColName = column; layerProperty.geometryColType = columnType; if ( dim == 3 && !type.endsWith( 'M' ) ) - type += QLatin1String( "Z" ); + type += QLatin1Char( 'Z' ); else if ( dim == 4 ) type += QLatin1String( "ZM" ); layerProperty.types = QList() << ( QgsPostgresConn::wkbTypeFromPostgis( type ) ); @@ -849,7 +849,7 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP if ( !schema.isEmpty() ) sql += QStringLiteral( " AND pg_namespace.nspname='%2'" ).arg( schema ); - sql += QStringLiteral( " GROUP BY 1,2,3,4" ); + sql += QLatin1String( " GROUP BY 1,2,3,4" ); QgsDebugMsgLevel( "getting non-spatial table info: " + sql, 2 ); @@ -1181,7 +1181,7 @@ static QString quotedMap( const QVariantMap &map ) { if ( !ret.isEmpty() ) { - ret += QLatin1String( "," ); + ret += QLatin1Char( ',' ); } ret.append( doubleQuotedMapValue( i.key() ) + "=>" + doubleQuotedMapValue( i.value().toString() ) ); @@ -1196,7 +1196,7 @@ static QString quotedList( const QVariantList &list ) { if ( !ret.isEmpty() ) { - ret += QLatin1String( "," ); + ret += QLatin1Char( ',' ); } QString inner = i->toString(); @@ -1890,7 +1890,7 @@ void QgsPostgresConn::retrieveLayerTypes( QVector &l bool castToGeometry = layerProperty.geometryColType == SctGeography || layerProperty.geometryColType == SctPcPatch; - sql += QStringLiteral( "array_agg(DISTINCT " ); + sql += QLatin1String( "array_agg(DISTINCT " ); int srid = layerProperty.srids.value( 0, std::numeric_limits::min() ); if ( srid == std::numeric_limits::min() ) @@ -1922,7 +1922,7 @@ void QgsPostgresConn::retrieveLayerTypes( QVector &l } - sql += QStringLiteral( ") " ); + sql += QLatin1String( ") " ); sql += " FROM " + table; @@ -2183,12 +2183,12 @@ void QgsPostgresConn::postgisWkbType( QgsWkbTypes::Type wkbType, QString &geomet } else if ( QgsWkbTypes::hasZ( wkbType ) ) { - geometryType += QLatin1String( "Z" ); + geometryType += QLatin1Char( 'Z' ); dim = 3; } else if ( QgsWkbTypes::hasM( wkbType ) ) { - geometryType += QLatin1String( "M" ); + geometryType += QLatin1Char( 'M' ); dim = 3; } else if ( wkbType >= QgsWkbTypes::Point25D && wkbType <= QgsWkbTypes::MultiPolygon25D ) diff --git a/src/providers/postgres/qgspostgresconn.h b/src/providers/postgres/qgspostgresconn.h index 758eaa1531a8..419e4b110c42 100644 --- a/src/providers/postgres/qgspostgresconn.h +++ b/src/providers/postgres/qgspostgresconn.h @@ -148,7 +148,7 @@ struct QgsPostgresLayerProperty geometryColName, typeString, sridString, - pkCols.join( QStringLiteral( "|" ) ), + pkCols.join( QLatin1Char( '|' ) ), sql ) .arg( nSpCols ); } diff --git a/src/providers/postgres/qgspostgresdataitemguiprovider.cpp b/src/providers/postgres/qgspostgresdataitemguiprovider.cpp index fc8d0585508e..09525359a9eb 100644 --- a/src/providers/postgres/qgspostgresdataitemguiprovider.cpp +++ b/src/providers/postgres/qgspostgresdataitemguiprovider.cpp @@ -296,7 +296,7 @@ void QgsPostgresDataItemGuiProvider::deleteSchema( QgsPGSchemaItem *schemaItem, int count = result.PQntuples(); if ( count > 0 ) { - QString objects = childObjects.join( QStringLiteral( "\n" ) ); + QString objects = childObjects.join( QLatin1Char( '\n' ) ); if ( count > maxListed ) { objects += QStringLiteral( "\n[%1 additional objects not listed]" ).arg( count - maxListed ); diff --git a/src/providers/postgres/qgspostgresdataitems.cpp b/src/providers/postgres/qgspostgresdataitems.cpp index 0072b729ce0c..142422b89be0 100644 --- a/src/providers/postgres/qgspostgresdataitems.cpp +++ b/src/providers/postgres/qgspostgresdataitems.cpp @@ -302,7 +302,7 @@ bool QgsPGConnectionItem::handleDrop( const QMimeData *data, const QString &toSc { QgsMessageOutput *output = QgsMessageOutput::createMessageOutput(); output->setTitle( tr( "Import to PostGIS database" ) ); - output->setMessage( tr( "Failed to import some layers!\n\n" ) + importResults.join( QStringLiteral( "\n" ) ), QgsMessageOutput::MessageText ); + output->setMessage( tr( "Failed to import some layers!\n\n" ) + importResults.join( QLatin1Char( '\n' ) ), QgsMessageOutput::MessageText ); output->showMessage(); } diff --git a/src/providers/postgres/qgspostgresfeatureiterator.cpp b/src/providers/postgres/qgspostgresfeatureiterator.cpp index 82ffc24c59ad..3408b8a3fef5 100644 --- a/src/providers/postgres/qgspostgresfeatureiterator.cpp +++ b/src/providers/postgres/qgspostgresfeatureiterator.cpp @@ -199,11 +199,11 @@ QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresFeatureSource if ( !mOrderByCompiled ) limitAtProvider = false; - bool success = declareCursor( whereClause, limitAtProvider ? mRequest.limit() : -1, false, orderByParts.join( QStringLiteral( "," ) ) ); + bool success = declareCursor( whereClause, limitAtProvider ? mRequest.limit() : -1, false, orderByParts.join( QLatin1Char( ',' ) ) ); if ( !success && useFallbackWhereClause ) { //try with the fallback where clause, e.g., for cases when using compiled expression failed to prepare - success = declareCursor( fallbackWhereClause, -1, false, orderByParts.join( QStringLiteral( "," ) ) ); + success = declareCursor( fallbackWhereClause, -1, false, orderByParts.join( QLatin1Char( ',' ) ) ); if ( success ) { mExpressionCompiled = false; diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp index 4343fc00cb46..c391627ae1d2 100644 --- a/src/providers/postgres/qgspostgresprovider.cpp +++ b/src/providers/postgres/qgspostgresprovider.cpp @@ -653,7 +653,7 @@ QString QgsPostgresUtils::whereClause( const QgsFeatureIds &featureIds, const Qg { whereClauses << whereClause( featureId, fields, conn, pkType, pkAttrs, sharedData ); } - return whereClauses.isEmpty() ? QString() : whereClauses.join( QStringLiteral( " OR " ) ).prepend( '(' ).append( ')' ); + return whereClauses.isEmpty() ? QString() : whereClauses.join( QLatin1String( " OR " ) ).prepend( '(' ).append( ')' ); } } return QString(); //avoid warning @@ -855,7 +855,7 @@ bool QgsPostgresProvider::loadFields() tableoidsList.append( QString::number( tableoid ) ); } - QString tableoidsFilter = '(' + tableoidsList.join( QStringLiteral( "," ) ) + ')'; + QString tableoidsFilter = '(' + tableoidsList.join( QLatin1Char( ',' ) ) + ')'; // Collect formatted field types sql = QStringLiteral( @@ -1214,15 +1214,15 @@ bool QgsPostgresProvider::loadFields() { const QString seqName { mTableName + '_' + fieldName + QStringLiteral( "_seq" ) }; const QString seqSql { QStringLiteral( "SELECT c.oid " - " FROM pg_class c " - " LEFT JOIN pg_namespace n " - " ON ( n.oid = c.relnamespace ) " - " WHERE c.relkind = 'S' " - " AND c.relname = %1 " - " AND n.nspname = %2" ) - .arg( quotedValue( seqName ) ) - .arg( quotedValue( mSchemaName ) ) - }; + " FROM pg_class c " + " LEFT JOIN pg_namespace n " + " ON ( n.oid = c.relnamespace ) " + " WHERE c.relkind = 'S' " + " AND c.relname = %1 " + " AND n.nspname = %2" ) + .arg( quotedValue( seqName ) ) + .arg( quotedValue( mSchemaName ) ) + }; QgsPostgresResult seqResult( connectionRO()->PQexec( seqSql ) ); if ( seqResult.PQntuples() == 1 ) { @@ -2247,7 +2247,7 @@ QString QgsPostgresProvider::geomParam( int offset ) const if ( mSpatialColType == SctTopoGeometry ) { - geometry += QStringLiteral( "toTopoGeom(" ); + geometry += QLatin1String( "toTopoGeom(" ); } if ( forceMulti ) @@ -3900,7 +3900,7 @@ bool QgsPostgresProvider::getGeometryDetails() QString dim = result.PQgetvalue( 0, 2 ); if ( dim == QLatin1String( "3" ) && !detectedType.endsWith( 'M' ) ) - detectedType += QLatin1String( "Z" ); + detectedType += QLatin1Char( 'Z' ); else if ( dim == QLatin1String( "4" ) ) detectedType += QLatin1String( "ZM" ); @@ -4281,7 +4281,7 @@ void postgisGeometryType( QgsWkbTypes::Type wkbType, QString &geometryType, int } else if ( QgsWkbTypes::hasM( wkbType ) ) { - geometryType += QLatin1String( "M" ); + geometryType += QLatin1Char( 'M' ); dim = 3; } else if ( wkbType >= QgsWkbTypes::Point25D && wkbType <= QgsWkbTypes::MultiPolygon25D ) @@ -4458,8 +4458,8 @@ QgsVectorLayerExporter::ExportError QgsPostgresProvider::createEmptyLayer( const if ( i ) { - pk += QLatin1String( "," ); - sql += QLatin1String( "," ); + pk += QLatin1Char( ',' ); + sql += QLatin1Char( ',' ); } pk += col; @@ -5510,7 +5510,7 @@ QString QgsPostgresProviderMetadata::getStyleById( const QString &uri, QString s if ( result.PQntuples() == 1 ) style = result.PQgetvalue( 0, 0 ); else - errCause = QObject::tr( "Consistency error in table '%1'. Style id should be unique" ).arg( QStringLiteral( "layer_styles" ) ); + errCause = QObject::tr( "Consistency error in table '%1'. Style id should be unique" ).arg( QLatin1String( "layer_styles" ) ); } else { diff --git a/src/providers/postgres/qgspostgresproviderconnection.cpp b/src/providers/postgres/qgspostgresproviderconnection.cpp index fef072a2592b..34a5d0e82e3a 100644 --- a/src/providers/postgres/qgspostgresproviderconnection.cpp +++ b/src/providers/postgres/qgspostgresproviderconnection.cpp @@ -293,23 +293,23 @@ QList QgsPostgresProviderConnection::executeSqlPrivate( const QStr { vType = QVariant::LongLong; } - else if ( typName == QStringLiteral( "date" ) ) + else if ( typName == QLatin1String( "date" ) ) { vType = QVariant::Date; } - else if ( typName.startsWith( QStringLiteral( "timestamp" ) ) ) + else if ( typName.startsWith( QLatin1String( "timestamp" ) ) ) { vType = QVariant::DateTime; } - else if ( typName == QStringLiteral( "time" ) ) + else if ( typName == QLatin1String( "time" ) ) { vType = QVariant::Time; } - else if ( typName == QStringLiteral( "bool" ) ) + else if ( typName == QLatin1String( "bool" ) ) { vType = QVariant::Bool; } - else if ( typName == QStringLiteral( "char" ) ) + else if ( typName == QLatin1String( "char" ) ) { vType = QVariant::Char; } diff --git a/src/providers/postgres/raster/qgspostgresrasterprovider.cpp b/src/providers/postgres/raster/qgspostgresrasterprovider.cpp index 652251d0d995..e27334ce9ca8 100644 --- a/src/providers/postgres/raster/qgspostgresrasterprovider.cpp +++ b/src/providers/postgres/raster/qgspostgresrasterprovider.cpp @@ -731,7 +731,7 @@ static inline QString dumpVariantMap( const QVariantMap &variantMap, const QStri result += QStringLiteral( "
  11. %1
  12. " ).arg( QgsStringUtils::insertLinks( v.toString() ) ); } } - result += QStringLiteral( "" ); + result += QLatin1String( "" ); } else if ( !childMap.isEmpty() ) { @@ -963,31 +963,31 @@ bool QgsPostgresRasterProvider::init() 64BF - 64-bit float */ Qgis::DataType type { Qgis::DataType::UnknownDataType }; - if ( t == QStringLiteral( "8BUI" ) ) + if ( t == QLatin1String( "8BUI" ) ) { type = Qgis::DataType::Byte; } - else if ( t == QStringLiteral( "16BUI" ) ) + else if ( t == QLatin1String( "16BUI" ) ) { type = Qgis::DataType::UInt16; } - else if ( t == QStringLiteral( "16BSI" ) ) + else if ( t == QLatin1String( "16BSI" ) ) { type = Qgis::DataType::Int16; } - else if ( t == QStringLiteral( "32BSI" ) ) + else if ( t == QLatin1String( "32BSI" ) ) { type = Qgis::DataType::Int32; } - else if ( t == QStringLiteral( "32BUI" ) ) + else if ( t == QLatin1String( "32BUI" ) ) { type = Qgis::DataType::UInt32; } - else if ( t == QStringLiteral( "32BF" ) ) + else if ( t == QLatin1String( "32BF" ) ) { type = Qgis::DataType::Float32; } - else if ( t == QStringLiteral( "64BF" ) ) + else if ( t == QLatin1String( "64BF" ) ) { type = Qgis::DataType::Float64; } @@ -1066,7 +1066,7 @@ bool QgsPostgresRasterProvider::init() double nodataValue { noDataValues.at( i ).toDouble( &ok ) }; if ( ! ok ) { - if ( noDataValues.at( i ) != QStringLiteral( "NULL" ) ) + if ( noDataValues.at( i ) != QLatin1String( "NULL" ) ) { QgsMessageLog::logMessage( tr( "Cannot convert nodata value '%1' to double" ) .arg( noDataValues.at( i ) ), @@ -1530,7 +1530,7 @@ bool QgsPostgresRasterProvider::loadFields() tableoidsList.append( QString::number( tableoid ) ); } - QString tableoidsFilter = '(' + tableoidsList.join( QStringLiteral( "," ) ) + ')'; + QString tableoidsFilter = '(' + tableoidsList.join( QLatin1Char( ',' ) ) + ')'; // Collect formatted field types sql = QStringLiteral( diff --git a/src/providers/spatialite/qgsspatialiteconnection.cpp b/src/providers/spatialite/qgsspatialiteconnection.cpp index fb9e94257f03..ed12d657ed23 100644 --- a/src/providers/spatialite/qgsspatialiteconnection.cpp +++ b/src/providers/spatialite/qgsspatialiteconnection.cpp @@ -152,7 +152,7 @@ int QgsSpatiaLiteConnection::checkHasMetadataTables( sqlite3 *handle ) ret = sqlite3_get_table( handle, "PRAGMA table_info(geometry_columns)", &results, &rows, &columns, &errMsg ); if ( ret != SQLITE_OK ) { - mErrorMsg = tr( "table info on %1 failed" ).arg( QStringLiteral( "geometry_columns" ) ); + mErrorMsg = tr( "table info on %1 failed" ).arg( QLatin1String( "geometry_columns" ) ); goto error; } if ( rows < 1 ) @@ -188,7 +188,7 @@ int QgsSpatiaLiteConnection::checkHasMetadataTables( sqlite3 *handle ) ret = sqlite3_get_table( handle, "PRAGMA table_info(spatial_ref_sys)", &results, &rows, &columns, &errMsg ); if ( ret != SQLITE_OK ) { - mErrorMsg = tr( "table info on %1 failed" ).arg( QStringLiteral( "spatial_ref_sys" ) ); + mErrorMsg = tr( "table info on %1 failed" ).arg( QLatin1String( "spatial_ref_sys" ) ); goto error; } if ( rows < 1 ) diff --git a/src/providers/spatialite/qgsspatialitedataitemguiprovider.cpp b/src/providers/spatialite/qgsspatialitedataitemguiprovider.cpp index 7bdce67bdf55..a89ca73abf81 100644 --- a/src/providers/spatialite/qgsspatialitedataitemguiprovider.cpp +++ b/src/providers/spatialite/qgsspatialitedataitemguiprovider.cpp @@ -206,7 +206,7 @@ bool QgsSpatiaLiteDataItemGuiProvider::handleDropConnectionItem( QgsSLConnection { QgsMessageOutput *output = QgsMessageOutput::createMessageOutput(); output->setTitle( tr( "Import to SpatiaLite database" ) ); - output->setMessage( tr( "Failed to import some layers!\n\n" ) + importResults.join( QStringLiteral( "\n" ) ), QgsMessageOutput::MessageText ); + output->setMessage( tr( "Failed to import some layers!\n\n" ) + importResults.join( QLatin1Char( '\n' ) ), QgsMessageOutput::MessageText ); output->showMessage(); } diff --git a/src/providers/spatialite/qgsspatialitefeatureiterator.cpp b/src/providers/spatialite/qgsspatialitefeatureiterator.cpp index 2ba6bd04076c..0afcf45678e4 100644 --- a/src/providers/spatialite/qgsspatialitefeatureiterator.cpp +++ b/src/providers/spatialite/qgsspatialitefeatureiterator.cpp @@ -135,7 +135,7 @@ QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeature if ( !whereClause.isEmpty() ) { useFallbackWhereClause = true; - fallbackWhereClause = whereClauses.join( QStringLiteral( " AND " ) ); + fallbackWhereClause = whereClauses.join( QLatin1String( " AND " ) ); whereClauses.append( whereClause ); //if only partial success when compiling expression, we need to double-check results using QGIS' expressions mExpressionCompiled = ( result == QgsSqlExpressionCompiler::Complete ); @@ -156,7 +156,7 @@ QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeature if ( !mClosed ) { - whereClause = whereClauses.join( QStringLiteral( " AND " ) ); + whereClause = whereClauses.join( QLatin1String( " AND " ) ); // Setup the order by QStringList orderByParts; @@ -216,12 +216,12 @@ QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeature } // preparing the SQL statement - bool success = prepareStatement( whereClause, limitAtProvider ? mRequest.limit() : -1, orderByParts.join( QStringLiteral( "," ) ) ); + bool success = prepareStatement( whereClause, limitAtProvider ? mRequest.limit() : -1, orderByParts.join( QLatin1Char( ',' ) ) ); if ( !success && useFallbackWhereClause ) { //try with the fallback where clause, e.g., for cases when using compiled expression failed to prepare mExpressionCompiled = false; - success = prepareStatement( fallbackWhereClause, -1, orderByParts.join( QStringLiteral( "," ) ) ); + success = prepareStatement( fallbackWhereClause, -1, orderByParts.join( QLatin1Char( ',' ) ) ); mCompileFailed = true; } diff --git a/src/providers/spatialite/qgsspatialiteprovider.cpp b/src/providers/spatialite/qgsspatialiteprovider.cpp index 255042cdd85b..03de683e403e 100644 --- a/src/providers/spatialite/qgsspatialiteprovider.cpp +++ b/src/providers/spatialite/qgsspatialiteprovider.cpp @@ -1059,11 +1059,11 @@ QVariant QgsSpatiaLiteProvider::defaultValue( int fieldId ) const return QVariant(); QVariant resultVar = defaultVal; - if ( defaultVal == QStringLiteral( "CURRENT_TIMESTAMP" ) ) + if ( defaultVal == QLatin1String( "CURRENT_TIMESTAMP" ) ) resultVar = QDateTime::currentDateTime(); - else if ( defaultVal == QStringLiteral( "CURRENT_DATE" ) ) + else if ( defaultVal == QLatin1String( "CURRENT_DATE" ) ) resultVar = QDate::currentDate(); - else if ( defaultVal == QStringLiteral( "CURRENT_TIME" ) ) + else if ( defaultVal == QLatin1String( "CURRENT_TIME" ) ) resultVar = QTime::currentTime(); else if ( defaultVal.startsWith( '\'' ) ) { @@ -6017,7 +6017,7 @@ bool QgsSpatiaLiteProviderMetadata::saveStyle( const QString &uri, const QString sqlite3 *sqliteHandle = handle->handle(); // check if layer_styles table already exist - QString countIfExist = QStringLiteral( "SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='%1';" ).arg( QStringLiteral( "layer_styles" ) ); + QString countIfExist = QStringLiteral( "SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='%1';" ).arg( QLatin1String( "layer_styles" ) ); char **results = nullptr; int rows; @@ -6255,7 +6255,7 @@ int QgsSpatiaLiteProviderMetadata::listStyles( const QString &uri, QStringList & sqlite3 *sqliteHandle = handle->handle(); // check if layer_styles table already exist - QString countIfExist = QStringLiteral( "SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='%1';" ).arg( QStringLiteral( "layer_styles" ) ); + QString countIfExist = QStringLiteral( "SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='%1';" ).arg( QLatin1String( "layer_styles" ) ); char **results = nullptr; int rows; @@ -6372,7 +6372,7 @@ QString QgsSpatiaLiteProviderMetadata::getStyleById( const QString &uri, QString if ( 1 == rows ) style = QString::fromUtf8( results[( rows * columns ) + 0 ] ); else - errCause = QObject::tr( "Consistency error in table '%1'. Style id should be unique" ).arg( QStringLiteral( "layer_styles" ) ); + errCause = QObject::tr( "Consistency error in table '%1'. Style id should be unique" ).arg( QLatin1String( "layer_styles" ) ); } else { diff --git a/src/providers/virtual/qgsvirtuallayerfeatureiterator.cpp b/src/providers/virtual/qgsvirtuallayerfeatureiterator.cpp index 277580c877fd..423a90306b1f 100644 --- a/src/providers/virtual/qgsvirtuallayerfeatureiterator.cpp +++ b/src/providers/virtual/qgsvirtuallayerfeatureiterator.cpp @@ -100,12 +100,12 @@ QgsVirtualLayerFeatureIterator::QgsVirtualLayerFeatureIterator( QgsVirtualLayerF { if ( !first ) { - values += QLatin1String( "," ); + values += QLatin1Char( ',' ); } first = false; values += QString::number( v ); } - values += QLatin1String( ")" ); + values += QLatin1Char( ')' ); wheres << values; } } @@ -185,7 +185,7 @@ QgsVirtualLayerFeatureIterator::QgsVirtualLayerFeatureIterator( QgsVirtualLayerF const auto constMAttributes = mAttributes; for ( int i : constMAttributes ) { - columns += QLatin1String( "," ); + columns += QLatin1Char( ',' ); QString cname = mSource->mFields.at( i ).name().toLower(); columns += quotedColumn( cname ); } @@ -201,7 +201,7 @@ QgsVirtualLayerFeatureIterator::QgsVirtualLayerFeatureIterator( QgsVirtualLayerF mSqlQuery = "SELECT " + columns + " FROM " + tableName; if ( !wheres.isEmpty() ) { - mSqlQuery += " WHERE " + wheres.join( QStringLiteral( " AND " ) ); + mSqlQuery += " WHERE " + wheres.join( QLatin1String( " AND " ) ); } if ( !offset.isEmpty() ) diff --git a/src/providers/virtual/qgsvirtuallayersqlitemodule.cpp b/src/providers/virtual/qgsvirtuallayersqlitemodule.cpp index 261347c22450..cb42fc56deb1 100644 --- a/src/providers/virtual/qgsvirtuallayersqlitemodule.cpp +++ b/src/providers/virtual/qgsvirtuallayersqlitemodule.cpp @@ -241,7 +241,7 @@ struct VTable mPkColumn = pkAttributeIndexes.at( 0 ); } - mCreationStr = "CREATE TABLE vtable (" + sqlFields.join( QStringLiteral( "," ) ) + ")"; + mCreationStr = "CREATE TABLE vtable (" + sqlFields.join( QLatin1Char( ',' ) ) + ")"; mCrs = provider->crs().postgisSrid(); } @@ -887,7 +887,7 @@ void registerQgisFunctions( sqlite3 *db ) { if ( reservedFunctions.contains( name ) ) // reserved keyword name = "_" + name; - if ( name.startsWith( QLatin1String( "$" ) ) ) + if ( name.startsWith( QLatin1Char( '$' ) ) ) continue; // register the function and pass the pointer to the Function* as user data diff --git a/src/providers/wcs/qgswcscapabilities.cpp b/src/providers/wcs/qgswcscapabilities.cpp index d52f74e6891e..1c81378e8a71 100644 --- a/src/providers/wcs/qgswcscapabilities.cpp +++ b/src/providers/wcs/qgswcscapabilities.cpp @@ -606,7 +606,7 @@ QList QgsWcsCapabilities::domElements( const QDomElement &element, } else { - list.append( domElements( nodeElement, names.join( QStringLiteral( "." ) ) ) ); + list.append( domElements( nodeElement, names.join( QLatin1Char( '.' ) ) ) ); } } } @@ -640,7 +640,7 @@ QDomElement QgsWcsCapabilities::domElement( const QDomElement &element, const QS return firstChildElement; } names.removeFirst(); - return domElement( firstChildElement, names.join( QStringLiteral( "." ) ) ); + return domElement( firstChildElement, names.join( QLatin1Char( '.' ) ) ); } QString QgsWcsCapabilities::domElementText( const QDomElement &element, const QString &path ) diff --git a/src/providers/wcs/qgswcsprovider.cpp b/src/providers/wcs/qgswcsprovider.cpp index 430a5e219a0d..7df37f1154e3 100644 --- a/src/providers/wcs/qgswcsprovider.cpp +++ b/src/providers/wcs/qgswcsprovider.cpp @@ -1374,7 +1374,7 @@ QString QgsWcsProvider::htmlMetadata() metadata += tr( "And %1 more coverages" ).arg( mCapabilities.coverages().size() - count ); } - metadata += QStringLiteral( "\n" ); // End nested table 1 + metadata += QLatin1String( "\n" ); // End nested table 1 return metadata; } diff --git a/src/providers/wfs/qgsbackgroundcachedshareddata.cpp b/src/providers/wfs/qgsbackgroundcachedshareddata.cpp index 623b54e1f4a2..49f935ade735 100644 --- a/src/providers/wfs/qgsbackgroundcachedshareddata.cpp +++ b/src/providers/wfs/qgsbackgroundcachedshareddata.cpp @@ -277,7 +277,7 @@ bool QgsBackgroundCachedSharedData::createCache() sql += QStringLiteral( ", %1 %2" ).arg( quotedIdentifier( field.name() ), type ); } - sql += QLatin1String( ")" ); + sql += QLatin1Char( ')' ); rc = sqlite3_exec( database.get(), sql.toUtf8(), nullptr, nullptr, nullptr ); if ( rc != SQLITE_OK ) { @@ -909,19 +909,19 @@ QSet QgsBackgroundCachedSharedData::getExistingCachedMD5( const QVector for ( int i = 0; i < featureList.size(); i ++ ) { if ( !first ) - expr += QLatin1String( "," ); + expr += QLatin1Char( ',' ); else { expr = QgsBackgroundCachedFeatureIteratorConstants::FIELD_MD5 + " IN ("; first = false; } - expr += QLatin1String( "'" ); + expr += QLatin1Char( '\'' ); expr += getMD5( featureList[i].first ); - expr += QLatin1String( "'" ); + expr += QLatin1Char( '\'' ); if ( ( i > 0 && ( i % 1000 ) == 0 ) || i + 1 == featureList.size() ) { - expr += QLatin1String( ")" ); + expr += QLatin1Char( ')' ); QgsFeatureRequest request; request.setFilterExpression( expr ); diff --git a/src/providers/wfs/qgsoapifprovider.cpp b/src/providers/wfs/qgsoapifprovider.cpp index fd12c2cb67d2..65195784c622 100644 --- a/src/providers/wfs/qgsoapifprovider.cpp +++ b/src/providers/wfs/qgsoapifprovider.cpp @@ -549,9 +549,9 @@ QString QgsOapifSharedData::translateNodeToServer( if ( i == 0 ) untranslatedPart = QStringLiteral( "(" ); else - untranslatedPart += QStringLiteral( " AND (" ); + untranslatedPart += QLatin1String( " AND (" ); untranslatedPart += topAndNodes[i]->dump(); - untranslatedPart += QStringLiteral( ")" ); + untranslatedPart += QLatin1Char( ')' ); } } } diff --git a/src/providers/wfs/qgswfscapabilities.cpp b/src/providers/wfs/qgswfscapabilities.cpp index 10bfb5fefedb..a7da322e263f 100644 --- a/src/providers/wfs/qgswfscapabilities.cpp +++ b/src/providers/wfs/qgswfscapabilities.cpp @@ -391,7 +391,7 @@ void QgsWfsCapabilities::capabilitiesReplyFinished() bool updateCap = false; bool deleteCap = false; // WFS < 2 - if ( mCaps.version.startsWith( QLatin1String( "1" ) ) ) + if ( mCaps.version.startsWith( QLatin1Char( '1' ) ) ) { parseSupportedOperations( featureTypeListElem.firstChildElement( QStringLiteral( "Operations" ) ), insertCap, diff --git a/src/providers/wfs/qgswfsdataitems.cpp b/src/providers/wfs/qgswfsdataitems.cpp index a48937c66a01..aea7468663f2 100644 --- a/src/providers/wfs/qgswfsdataitems.cpp +++ b/src/providers/wfs/qgswfsdataitems.cpp @@ -102,7 +102,7 @@ void QgsWfsLayerItem::copyStyle() } QString url( connection->uri().encodedUri() ); - QgsGeoNodeRequest geoNodeRequest( url.replace( QStringLiteral( "url=" ), QString() ), true ); + QgsGeoNodeRequest geoNodeRequest( url.replace( QLatin1String( "url=" ), QString() ), true ); QgsGeoNodeStyle style = geoNodeRequest.fetchDefaultStyleBlocking( this->name() ); if ( style.name.isEmpty() ) { diff --git a/src/providers/wfs/qgswfsdatasourceuri.cpp b/src/providers/wfs/qgswfsdatasourceuri.cpp index 36ef5d3a10fd..dc37ace522c8 100644 --- a/src/providers/wfs/qgswfsdatasourceuri.cpp +++ b/src/providers/wfs/qgswfsdatasourceuri.cpp @@ -271,7 +271,7 @@ bool QgsWFSDataSourceURI::pagingEnabled() const { if ( !mURI.hasParam( QgsWFSConstants::URI_PARAM_PAGING_ENABLED ) ) return true; - return mURI.param( QgsWFSConstants::URI_PARAM_PAGING_ENABLED ) == QStringLiteral( "true" ); + return mURI.param( QgsWFSConstants::URI_PARAM_PAGING_ENABLED ) == QLatin1String( "true" ); } void QgsWFSDataSourceURI::setTypeName( const QString &typeName ) @@ -387,7 +387,7 @@ QString QgsWFSDataSourceURI::build( const QString &baseUri, uri.setFilter( filter ); if ( restrictToCurrentViewExtent ) uri.mURI.setParam( QgsWFSConstants::URI_PARAM_RESTRICT_TO_REQUEST_BBOX, QStringLiteral( "1" ) ); - if ( uri.version() == QStringLiteral( "OGC_API_FEATURES" ) ) + if ( uri.version() == QLatin1String( "OGC_API_FEATURES" ) ) { uri.setVersion( QString() ); } diff --git a/src/providers/wfs/qgswfsfeatureiterator.cpp b/src/providers/wfs/qgswfsfeatureiterator.cpp index 79a53e1564d3..a46ee33c4dbc 100644 --- a/src/providers/wfs/qgswfsfeatureiterator.cpp +++ b/src/providers/wfs/qgswfsfeatureiterator.cpp @@ -124,7 +124,7 @@ QUrl QgsWFSFeatureDownloaderImpl::buildURL( qint64 startIndex, int maxFeatures, Q_FOREACH ( const QgsOgcUtils::LayerProperties layerProperties, mShared->mLayerPropertiesList ) { if ( !typenames.isEmpty() ) - typenames += QLatin1String( "," ); + typenames += QLatin1Char( ',' ); typenames += layerProperties.mName; } } diff --git a/src/providers/wfs/qgswfsprovider.cpp b/src/providers/wfs/qgswfsprovider.cpp index 57c1c1580b76..b8a6a8b09920 100644 --- a/src/providers/wfs/qgswfsprovider.cpp +++ b/src/providers/wfs/qgswfsprovider.cpp @@ -308,7 +308,7 @@ bool QgsWFSProvider::processSQL( const QString &sqlString, QString &errorMsg, QS else if ( part.startsWith( QLatin1String( " expecting " ) ) ) newPart = tr( "%1 is expected instead." ).arg( part.mid( QStringLiteral( " expecting " ).size() ) ); if ( !parserErrorString.isEmpty() ) - parserErrorString += QLatin1String( " " ); + parserErrorString += QLatin1Char( ' ' ); parserErrorString += newPart; } parserErrorString.replace( QLatin1String( " or " ), tr( "%1 or %2" ).arg( QString(), QString() ) ); @@ -429,7 +429,7 @@ bool QgsWFSProvider::processSQL( const QString &sqlString, QString &errorMsg, QS for ( const QString &typeName : qgis::as_const( typenameList ) ) { if ( !concatenatedTypenames.isEmpty() ) - concatenatedTypenames += QLatin1String( "," ); + concatenatedTypenames += QLatin1Char( ',' ); concatenatedTypenames += typeName; } @@ -1511,7 +1511,7 @@ bool QgsWFSProvider::readAttributesFromSchema( QDomDocument &schemaDoc, foundGeometryAttribute = true; geometryAttribute = name; // We have a choice parent element we cannot assume any valid information over the geometry type - if ( attributeElement.parentNode().nodeName() == QStringLiteral( "choice" ) && ! attributeElement.nextSibling().isNull() ) + if ( attributeElement.parentNode().nodeName() == QLatin1String( "choice" ) && ! attributeElement.nextSibling().isNull() ) geomType = QgsWkbTypes::Unknown; else geomType = geomTypeFromPropertyType( geometryAttribute, gmlPT.cap( 1 ) ); diff --git a/src/providers/wfs/qgswfsshareddata.cpp b/src/providers/wfs/qgswfsshareddata.cpp index 397e22c6ade9..4e3aa27c329c 100644 --- a/src/providers/wfs/qgswfsshareddata.cpp +++ b/src/providers/wfs/qgswfsshareddata.cpp @@ -115,7 +115,7 @@ bool QgsWFSSharedData::computeFilter( QString &errorMsg ) for ( QgsSQLStatement::NodeColumnSorted *columnSorted : constOrderBy ) { if ( !mSortBy.isEmpty() ) - mSortBy += QLatin1String( "," ); + mSortBy += QLatin1Char( ',' ); mSortBy += columnSorted->column()->name(); if ( !columnSorted->ascending() ) { diff --git a/src/providers/wms/qgswmscapabilities.cpp b/src/providers/wms/qgswmscapabilities.cpp index 360c6eba290d..fd2f2566532c 100644 --- a/src/providers/wms/qgswmscapabilities.cpp +++ b/src/providers/wms/qgswmscapabilities.cpp @@ -1663,11 +1663,11 @@ void QgsWmsCapabilities::parseTileSetProfile( const QDomElement &element ) node = node.nextSibling(); } - matrixSet.identifier = QStringLiteral( "%1-wmsc-%2" ).arg( layers.join( QStringLiteral( "_" ) ) ).arg( mTileLayersSupported.size() ); + matrixSet.identifier = QStringLiteral( "%1-wmsc-%2" ).arg( layers.join( QLatin1Char( '_' ) ) ).arg( mTileLayersSupported.size() ); - tileLayer.identifier = layers.join( QStringLiteral( "," ) ); + tileLayer.identifier = layers.join( QLatin1Char( ',' ) ); QgsWmtsStyle style; - style.identifier = styles.join( QStringLiteral( "," ) ); + style.identifier = styles.join( QLatin1Char( ',' ) ); tileLayer.styles.insert( style.identifier, style ); tileLayer.defaultStyle = style.identifier; diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp index 244886af6984..3d654367aa4c 100644 --- a/src/providers/wms/qgswmsprovider.cpp +++ b/src/providers/wms/qgswmsprovider.cpp @@ -1205,8 +1205,8 @@ void QgsWmsProvider::createTileRequestsWMSC( const QgsWmtsTileMatrix *tm, const setQueryItem( query, QStringLiteral( "SERVICE" ), QStringLiteral( "WMS" ) ); setQueryItem( query, QStringLiteral( "VERSION" ), mCaps.mCapabilities.version ); setQueryItem( query, QStringLiteral( "REQUEST" ), QStringLiteral( "GetMap" ) ); - setQueryItem( query, QStringLiteral( "LAYERS" ), mSettings.mActiveSubLayers.join( QStringLiteral( "," ) ) ); - setQueryItem( query, QStringLiteral( "STYLES" ), mSettings.mActiveSubStyles.join( QStringLiteral( "," ) ) ); + setQueryItem( query, QStringLiteral( "LAYERS" ), mSettings.mActiveSubLayers.join( QLatin1Char( ',' ) ) ); + setQueryItem( query, QStringLiteral( "STYLES" ), mSettings.mActiveSubStyles.join( QLatin1Char( ',' ) ) ); setQueryItem( query, QStringLiteral( "WIDTH" ), QString::number( tm->tileWidth ) ); setQueryItem( query, QStringLiteral( "HEIGHT" ), QString::number( tm->tileHeight ) ); setFormatQueryItem( query ); @@ -2193,7 +2193,7 @@ QString QgsWmsProvider::layerMetadata( QgsWmsLayerProperty &layer ) const QgsWmsLegendUrlProperty &l = style.legendUrl[k]; metadata += QStringLiteral( "" ) % l.format % QStringLiteral( "" ) % l.onlineResource.xlinkHref % QStringLiteral( "" ); } - metadata += QStringLiteral( "" ); + metadata += QLatin1String( "" ); } // Close the nested table @@ -2278,7 +2278,7 @@ QString QgsWmsProvider::htmlMetadata() tr( "Keywords" ) % QStringLiteral( "" "" ) % - mCaps.mCapabilities.service.keywordList.join( QStringLiteral( "
    " ) ) % + mCaps.mCapabilities.service.keywordList.join( QLatin1String( "
    " ) ) % QStringLiteral( "" ); // Service Online Resource @@ -2385,14 +2385,14 @@ QString QgsWmsProvider::htmlMetadata() { metadata += QStringLiteral( "%1:%2
    " ).arg( it.key(), it.value() ); } - metadata += QStringLiteral( "" ); + metadata += QLatin1String( "" ); // GetFeatureInfo Request Formats metadata += QStringLiteral( "" ) % tr( "Identify Formats" ) % QStringLiteral( "" "" ) % - mTileLayer->infoFormats.join( QStringLiteral( "
    " ) ) % + mTileLayer->infoFormats.join( QLatin1String( "
    " ) ) % QStringLiteral( "" ); } } @@ -2403,7 +2403,7 @@ QString QgsWmsProvider::htmlMetadata() tr( "Image Formats" ) % QStringLiteral( "" "" ) % - mCaps.mCapabilities.capability.request.getMap.format.join( QStringLiteral( "
    " ) ) % + mCaps.mCapabilities.capability.request.getMap.format.join( QLatin1String( "
    " ) ) % QStringLiteral( "" // GetFeatureInfo Request Formats @@ -2411,7 +2411,7 @@ QString QgsWmsProvider::htmlMetadata() tr( "Identify Formats" ) % QStringLiteral( "" "" ) % - mCaps.mCapabilities.capability.request.getFeatureInfo.format.join( QStringLiteral( "
    " ) ) % + mCaps.mCapabilities.capability.request.getFeatureInfo.format.join( QLatin1String( "
    " ) ) % QStringLiteral( "" // Layer Count (as managed by this provider) @@ -2529,7 +2529,7 @@ QString QgsWmsProvider::htmlMetadata() tr( "Selected" ) % QStringLiteral( "" "" ) % - ( l.identifier == mSettings.mActiveSubLayers.join( QStringLiteral( "," ) ) ? tr( "Yes" ) : tr( "No" ) ) % + ( l.identifier == mSettings.mActiveSubLayers.join( QLatin1Char( ',' ) ) ? tr( "Yes" ) : tr( "No" ) ) % QStringLiteral( "" ); if ( !l.styles.isEmpty() ) @@ -2543,7 +2543,7 @@ QString QgsWmsProvider::htmlMetadata() { styles << style.identifier; } - metadata += styles.join( QStringLiteral( ", " ) ) % + metadata += styles.join( QLatin1String( ", " ) ) % QStringLiteral( "" ); } @@ -2576,10 +2576,10 @@ QString QgsWmsProvider::htmlMetadata() metadata += setLink.tileMatrixSet + "
    "; } - metadata += QStringLiteral( "" ); + metadata += QLatin1String( "" ); } - metadata += QStringLiteral( "" ); // End nested table 3 + metadata += QLatin1String( "" ); // End nested table 3 if ( mTileMatrixSet ) { @@ -2693,10 +2693,10 @@ QString QgsWmsProvider::htmlMetadata() metadata += QStringLiteral( "%1" ).arg( r.xMaximum(), 0, 'f' ); } - metadata += QStringLiteral( "" ); + metadata += QLatin1String( "" ); } - metadata += QStringLiteral( "" ); // End nested table 3 + metadata += QLatin1String( "" ); // End nested table 3 } const QgsWmsStatistics::Stat &stat = QgsWmsStatistics::statForUri( dataSourceUri() ); @@ -3330,7 +3330,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRa if ( xsdPart < 0 && !featureTypeNames.isEmpty() && featureStoreList.isEmpty() ) { QgsError err = QGS_ERROR( tr( "Cannot identify" ) ); - err.append( tr( "Result parsing failed. %1 feature types were guessed from gml (%2) but no features were parsed." ).arg( featureTypeNames.size() ).arg( featureTypeNames.join( QStringLiteral( "," ) ) ) ); + err.append( tr( "Result parsing failed. %1 feature types were guessed from gml (%2) but no features were parsed." ).arg( featureTypeNames.size() ).arg( featureTypeNames.join( QLatin1Char( ',' ) ) ) ); QgsDebugMsg( "parsing GML error: " + err.message() ); return QgsRasterIdentifyResult( err ); } @@ -4578,8 +4578,8 @@ void QgsWmsLegendDownloadHandler::finished() { QVariant phrase = mReply->attribute( QNetworkRequest::HttpReasonPhraseAttribute ); QString msg( tr( "GetLegendGraphic request error" ) ); - msg += QStringLiteral( " - " ); - msg += QString( tr( "Status: %1\nReason phrase: %2" ) ).arg( status.toInt() ).arg( phrase.toString() ); + msg += QLatin1String( " - " ); + msg += tr( "Status: %1\nReason phrase: %2" ).arg( status.toInt() ).arg( phrase.toString() ); sendError( msg ); return; } diff --git a/src/providers/wms/qgswmssourceselect.cpp b/src/providers/wms/qgswmssourceselect.cpp index 0a19044ed0cb..1502c6179827 100644 --- a/src/providers/wms/qgswmssourceselect.cpp +++ b/src/providers/wms/qgswmssourceselect.cpp @@ -545,7 +545,7 @@ void QgsWMSSourceSelect::addButtonClicked() for ( const QgsWmtsTileLayer &l : qgis::as_const( mTileLayers ) ) { - if ( l.identifier == layers.join( QStringLiteral( "," ) ) ) + if ( l.identifier == layers.join( QLatin1Char( ',' ) ) ) { layer = &l; break; @@ -598,7 +598,7 @@ void QgsWMSSourceSelect::addButtonClicked() uri.setParam( QStringLiteral( "contextualWMSLegend" ), mContextualLegendCheckbox->isChecked() ? "1" : "0" ); emit addRasterLayer( uri.encodedUri(), - leLayerName->text().isEmpty() ? titles.join( QStringLiteral( "/" ) ) : leLayerName->text(), + leLayerName->text().isEmpty() ? titles.join( QLatin1Char( '/' ) ) : leLayerName->text(), QStringLiteral( "wms" ) ); } @@ -1005,7 +1005,7 @@ void QgsWMSSourceSelect::updateButtons() { QStringList layers, styles, titles; collectSelectedLayers( layers, styles, titles ); - mLastLayerName = titles.join( QStringLiteral( "/" ) ); + mLastLayerName = titles.join( QLatin1Char( '/' ) ); leLayerName->setText( mLastLayerName ); } } diff --git a/src/python/qgspythonutilsimpl.cpp b/src/python/qgspythonutilsimpl.cpp index adbfc2b4f523..2b84dba9b919 100644 --- a/src/python/qgspythonutilsimpl.cpp +++ b/src/python/qgspythonutilsimpl.cpp @@ -99,7 +99,7 @@ bool QgsPythonUtilsImpl::checkSystemImports() newpaths << '"' + pythonPath() + '"'; newpaths << homePythonPath(); newpaths << pluginpaths; - runString( "sys.path = [" + newpaths.join( QStringLiteral( "," ) ) + "] + sys.path" ); + runString( "sys.path = [" + newpaths.join( QLatin1Char( ',' ) ) + "] + sys.path" ); // import SIP if ( !runString( QStringLiteral( "from qgis.PyQt import sip" ), diff --git a/src/quickgui/attributes/qgsquickattributeformmodelbase.cpp b/src/quickgui/attributes/qgsquickattributeformmodelbase.cpp index 8a6101d1a7ad..4a1e41241c02 100644 --- a/src/quickgui/attributes/qgsquickattributeformmodelbase.cpp +++ b/src/quickgui/attributes/qgsquickattributeformmodelbase.cpp @@ -185,7 +185,7 @@ QgsAttributeEditorContainer *QgsQuickAttributeFormModelBase::generateRootContain QgsFields fields = mLayer->fields(); for ( int i = 0; i < fields.size(); ++i ) { - if ( fields.at( i ).editorWidgetSetup().type() != QStringLiteral( "Hidden" ) ) + if ( fields.at( i ).editorWidgetSetup().type() != QLatin1String( "Hidden" ) ) { QgsAttributeEditorField *field = new QgsAttributeEditorField( fields.at( i ).name(), i, root ); root->addChildElement( field ); @@ -201,7 +201,7 @@ QgsAttributeEditorContainer *QgsQuickAttributeFormModelBase::invisibleRootContai void QgsQuickAttributeFormModelBase::updateAttributeValue( QStandardItem *item ) { - if ( item->data( QgsQuickAttributeFormModel::ElementType ) == QStringLiteral( "field" ) ) + if ( item->data( QgsQuickAttributeFormModel::ElementType ) == QLatin1String( "field" ) ) { item->setData( mAttributeModel->featureLayerPair().feature().attribute( item->data( QgsQuickAttributeFormModel::FieldIndex ).toInt() ), QgsQuickAttributeFormModel::AttributeValue ); } diff --git a/src/quickgui/qgsquickfeatureslistmodel.cpp b/src/quickgui/qgsquickfeatureslistmodel.cpp index b56c59e34198..8440e1755ed7 100644 --- a/src/quickgui/qgsquickfeatureslistmodel.cpp +++ b/src/quickgui/qgsquickfeatureslistmodel.cpp @@ -117,7 +117,7 @@ QString QgsQuickFeaturesListModel::buildFilterExpression() expressionParts << QStringLiteral( "%1 ILIKE '%%2%'" ).arg( QgsExpression::quotedColumnRef( field.name() ), mFilterExpression ); } - QString expression = QStringLiteral( "(%1)" ).arg( expressionParts.join( QStringLiteral( " ) OR ( " ) ) ); + QString expression = QStringLiteral( "(%1)" ).arg( expressionParts.join( QLatin1String( " ) OR ( " ) ) ); return expression; } diff --git a/src/quickgui/qgsquickutils.cpp b/src/quickgui/qgsquickutils.cpp index dc86f3cb09ab..5c1e346ca062 100644 --- a/src/quickgui/qgsquickutils.cpp +++ b/src/quickgui/qgsquickutils.cpp @@ -167,7 +167,7 @@ const QUrl QgsQuickUtils::getEditorComponentSource( const QString &widgetName ) } else { - return QUrl( path.arg( QStringLiteral( "textedit" ) ) ); + return QUrl( path.arg( QLatin1String( "textedit" ) ) ); } } diff --git a/src/server/qgis_mapserver.cpp b/src/server/qgis_mapserver.cpp index 97e8a99b841e..b8bfdb742e9c 100644 --- a/src/server/qgis_mapserver.cpp +++ b/src/server/qgis_mapserver.cpp @@ -323,7 +323,7 @@ int main( int argc, char *argv[] ) } const QString protocol { firstLinePieces.at( 2 )}; - if ( protocol != QStringLiteral( "HTTP/1.0" ) && protocol != QStringLiteral( "HTTP/1.1" ) ) + if ( protocol != QLatin1String( "HTTP/1.0" ) && protocol != QLatin1String( "HTTP/1.1" ) ) { throw HttpException( QStringLiteral( "HTTP error unsupported protocol: %1" ).arg( protocol ) ); } diff --git a/src/server/qgsaccesscontrol.cpp b/src/server/qgsaccesscontrol.cpp index a63208d637b7..c4a1b0b4a8e5 100644 --- a/src/server/qgsaccesscontrol.cpp +++ b/src/server/qgsaccesscontrol.cpp @@ -52,7 +52,7 @@ QString QgsAccessControl::resolveFilterFeatures( const QgsVectorLayer *layer ) c QString expression; if ( !expressions.isEmpty() ) { - expression = QStringLiteral( "((" ).append( expressions.join( QStringLiteral( ") AND (" ) ) ).append( "))" ); + expression = QStringLiteral( "((" ).append( expressions.join( QLatin1String( ") AND (" ) ) ).append( "))" ); } return expression; @@ -98,7 +98,7 @@ QString QgsAccessControl::extraSubsetString( const QgsVectorLayer *layer ) const sqls.append( sql ); } } - return sqls.isEmpty() ? QString() : QStringLiteral( "((" ).append( sqls.join( QStringLiteral( ") AND (" ) ) ).append( "))" ); + return sqls.isEmpty() ? QString() : QStringLiteral( "((" ).append( sqls.join( QLatin1String( ") AND (" ) ) ).append( "))" ); } //! Returns the layer read right diff --git a/src/server/qgsconfigcache.cpp b/src/server/qgsconfigcache.cpp index f7a2f7264bf7..c2916e050c9c 100644 --- a/src/server/qgsconfigcache.cpp +++ b/src/server/qgsconfigcache.cpp @@ -90,14 +90,14 @@ const QgsProject *QgsConfigCache::project( const QString &path, QgsServerSetting if ( ! settings || ! settings->ignoreBadLayers() ) { QgsMessageLog::logMessage( - QStringLiteral( "Error, Layer(s) %1 not valid in project %2" ).arg( unrestrictedBadLayers.join( QStringLiteral( ", " ) ), path ), + QStringLiteral( "Error, Layer(s) %1 not valid in project %2" ).arg( unrestrictedBadLayers.join( QLatin1String( ", " ) ), path ), QStringLiteral( "Server" ), Qgis::Critical ); throw QgsServerException( QStringLiteral( "Layer(s) not valid" ) ); } else { QgsMessageLog::logMessage( - QStringLiteral( "Warning, Layer(s) %1 not valid in project %2" ).arg( unrestrictedBadLayers.join( QStringLiteral( ", " ) ), path ), + QStringLiteral( "Warning, Layer(s) %1 not valid in project %2" ).arg( unrestrictedBadLayers.join( QLatin1String( ", " ) ), path ), QStringLiteral( "Server" ), Qgis::Warning ); } } diff --git a/src/server/qgsrequesthandler.cpp b/src/server/qgsrequesthandler.cpp index 7d0f87fead38..0afc90822835 100644 --- a/src/server/qgsrequesthandler.cpp +++ b/src/server/qgsrequesthandler.cpp @@ -255,7 +255,7 @@ void QgsRequestHandler::parseInput() mRequest.setParameter( attrName.toUpper(), attr.value() ); } - mRequest.setParameter( QStringLiteral( "REQUEST_BODY" ), inputString.replace( '+', QStringLiteral( "%2B" ) ) ); + mRequest.setParameter( QStringLiteral( "REQUEST_BODY" ), inputString.replace( '+', QLatin1String( "%2B" ) ) ); } } } diff --git a/src/server/qgsserverapiutils.cpp b/src/server/qgsserverapiutils.cpp index db7264f2e142..aeacc4a7c097 100644 --- a/src/server/qgsserverapiutils.cpp +++ b/src/server/qgsserverapiutils.cpp @@ -98,7 +98,7 @@ template T QgsServerApiUtils::parseTemporalInterval( const auto parseDate = [ ]( const QString & date ) -> T2 { T2 result; - if ( date == QStringLiteral( ".." ) || date.isEmpty() ) + if ( date == QLatin1String( ".." ) || date.isEmpty() ) { return result; } @@ -264,7 +264,7 @@ QgsExpression QgsServerApiUtils::temporalFilterExpression( const QgsVectorLayer { const QStringList parts { interval.split( '/' ) }; testType = parts[0]; - if ( testType.isEmpty() || testType == QStringLiteral( ".." ) ) + if ( testType.isEmpty() || testType == QLatin1String( ".." ) ) { testType = parts[1]; } @@ -284,7 +284,7 @@ QgsExpression QgsServerApiUtils::temporalFilterExpression( const QgsVectorLayer { // Determine the field type from the dimension name "time"/"date" - const QVariant::Type fieldType { dimension.name.toLower() == QStringLiteral( "time" ) ? QVariant::Type::DateTime : QVariant::Type::Date }; + const QVariant::Type fieldType { dimension.name.toLower() == QLatin1String( "time" ) ? QVariant::Type::DateTime : QVariant::Type::Date }; const auto fieldBeginCasted { refFieldCast( dimension.fieldName, queryType, fieldType ) }; if ( fieldBeginCasted.isEmpty() ) @@ -320,7 +320,7 @@ QgsExpression QgsServerApiUtils::temporalFilterExpression( const QgsVectorLayer { // Determine the field type from the dimension name "time"/"date" - const QVariant::Type fieldType { dimension.name.toLower() == QStringLiteral( "time" ) ? QVariant::Type::DateTime : QVariant::Type::Date }; + const QVariant::Type fieldType { dimension.name.toLower() == QLatin1String( "time" ) ? QVariant::Type::DateTime : QVariant::Type::Date }; const auto fieldfBeginCasted { refFieldCast( dimension.fieldName, queryType, fieldType ) }; if ( fieldfBeginCasted.isEmpty() ) @@ -368,7 +368,7 @@ QgsExpression QgsServerApiUtils::temporalFilterExpression( const QgsVectorLayer for ( const auto &dimension : qgis::as_const( dimensions ) ) { // Determine the field type from the dimension name "time"/"date" - const bool fieldIsDateTime { dimension.name.toLower() == QStringLiteral( "time" ) }; + const bool fieldIsDateTime { dimension.name.toLower() == QLatin1String( "time" ) }; const QVariant::Type fieldType { fieldIsDateTime ? QVariant::Type::DateTime : QVariant::Type::Date }; const auto fieldRefBegin { refFieldCast( dimension.fieldName, queryType, fieldType ) }; @@ -430,7 +430,7 @@ QgsExpression QgsServerApiUtils::temporalFilterExpression( const QgsVectorLayer } if ( ! conditions.isEmpty() ) { - expression.setExpression( conditions.join( QStringLiteral( " AND " ) ) ); + expression.setExpression( conditions.join( QLatin1String( " AND " ) ) ); } return expression; } @@ -569,7 +569,7 @@ const QVector QgsServerApiUtils::publishedWfsLayers( const Qgs QString QgsServerApiUtils::sanitizedFieldValue( const QString &value ) { QString result { QUrl( value ).toString() }; - return result.replace( '\'', QStringLiteral( "\'" ) ); + return result.replace( '\'', QLatin1String( "\'" ) ); } QStringList QgsServerApiUtils::publishedCrsList( const QgsProject *project ) @@ -596,9 +596,9 @@ QString QgsServerApiUtils::crsToOgcUri( const QgsCoordinateReferenceSystem &crs const auto parts { crs.authid().split( ':' ) }; if ( parts.length() == 2 ) { - if ( parts[0] == QStringLiteral( "EPSG" ) ) + if ( parts[0] == QLatin1String( "EPSG" ) ) return QStringLiteral( "http://www.opengis.net/def/crs/EPSG/9.6.2/%1" ).arg( parts[1] ) ; - else if ( parts[0] == QStringLiteral( "OGC" ) ) + else if ( parts[0] == QLatin1String( "OGC" ) ) { return QStringLiteral( "http://www.opengis.net/def/crs/OGC/1.3/%1" ).arg( parts[1] ) ; } diff --git a/src/server/qgsserverexception.h b/src/server/qgsserverexception.h index 8a26ba5cc8c0..e68c39723ad1 100644 --- a/src/server/qgsserverexception.h +++ b/src/server/qgsserverexception.h @@ -167,11 +167,11 @@ class SERVER_EXPORT QgsServerApiException: public QgsServerException { "description", what().toStdString() }, } }; - if ( responseFormat == QStringLiteral( "application/json" ) ) + if ( responseFormat == QLatin1String( "application/json" ) ) { return QByteArray::fromStdString( data.dump() ); } - else if ( responseFormat == QStringLiteral( "text/html" ) ) + else if ( responseFormat == QLatin1String( "text/html" ) ) { // TODO: template return QByteArray::fromStdString( data.dump() ); diff --git a/src/server/qgsserverogcapihandler.cpp b/src/server/qgsserverogcapihandler.cpp index d39d8b9c3e71..982146ede7a7 100644 --- a/src/server/qgsserverogcapihandler.cpp +++ b/src/server/qgsserverogcapihandler.cpp @@ -257,11 +257,11 @@ const QString QgsServerOgcApiHandler::templatePath( const QgsServerApiContext &c { // resources/server/api + /ogc/templates/ + operationId + .html QString path { context.serverInterface()->serverSettings()->apiResourcesDirectory() }; - path += QStringLiteral( "/ogc/templates" ); + path += QLatin1String( "/ogc/templates" ); path += context.apiRootPath(); path += '/'; path += QString::fromStdString( operationId() ); - path += QStringLiteral( ".html" ); + path += QLatin1String( ".html" ); return path; } diff --git a/src/server/qgsserverparameters.cpp b/src/server/qgsserverparameters.cpp index 1f20cd235282..f7c8e6ec1e6f 100644 --- a/src/server/qgsserverparameters.cpp +++ b/src/server/qgsserverparameters.cpp @@ -550,7 +550,7 @@ void QgsServerParameters::load( const QUrlQuery &query ) { // clean query string first QUrlQuery cleanQuery( query ); - cleanQuery.setQuery( query.query().replace( '+', QStringLiteral( "%20" ) ) ); + cleanQuery.setQuery( query.query().replace( '+', QLatin1String( "%20" ) ) ); // load parameters for ( const auto &item : cleanQuery.queryItems( QUrl::FullyDecoded ) ) diff --git a/src/server/services/landingpage/qgslandingpage.cpp b/src/server/services/landingpage/qgslandingpage.cpp index f09f8da5187b..42d684d2e124 100644 --- a/src/server/services/landingpage/qgslandingpage.cpp +++ b/src/server/services/landingpage/qgslandingpage.cpp @@ -48,12 +48,12 @@ class QgsLandingPageApi: public QgsServerOgcApi // The plugin installation is optional so this won't be an issue in production. return ! qgetenv( "QGIS_SERVER_DISABLED_APIS" ).contains( name().toUtf8() ) && ( url.path().isEmpty() || url.path() == '/' - || url.path().startsWith( QStringLiteral( "/map/" ) ) - || url.path().startsWith( QStringLiteral( "/index" ) ) + || url.path().startsWith( QLatin1String( "/map/" ) ) + || url.path().startsWith( QLatin1String( "/index" ) ) // Static - || url.path().startsWith( QStringLiteral( "/css/" ) ) - || url.path().startsWith( QStringLiteral( "/js/" ) ) - || url.path() == QStringLiteral( "/favicon.ico" ) ); + || url.path().startsWith( QLatin1String( "/css/" ) ) + || url.path().startsWith( QLatin1String( "/js/" ) ) + || url.path() == QLatin1String( "/favicon.ico" ) ); } }; @@ -75,7 +75,7 @@ class QgsProjectLoaderFilter: public QgsServerFilter void requestReady() override { const auto handler { serverInterface()->requestHandler() }; - if ( handler->path().startsWith( QStringLiteral( "/project/" ) ) ) + if ( handler->path().startsWith( QLatin1String( "/project/" ) ) ) { const QString projectPath { QgsLandingPageUtils::projectUriFromUrl( handler->url(), *serverInterface()->serverSettings() ) }; if ( ! projectPath.isEmpty() ) diff --git a/src/server/services/landingpage/qgslandingpagehandlers.cpp b/src/server/services/landingpage/qgslandingpagehandlers.cpp index 27b05d3285a9..aec6c361d1b2 100644 --- a/src/server/services/landingpage/qgslandingpagehandlers.cpp +++ b/src/server/services/landingpage/qgslandingpagehandlers.cpp @@ -59,7 +59,7 @@ void QgsLandingPageHandler::handleRequest( const QgsServerApiContext &context ) const QString QgsLandingPageHandler::templatePath( const QgsServerApiContext &context ) const { QString path { context.serverInterface()->serverSettings()->apiResourcesDirectory() }; - path += QStringLiteral( "/ogc/static/landingpage/index.html" ); + path += QLatin1String( "/ogc/static/landingpage/index.html" ); return path; } diff --git a/src/server/services/wfs/qgswfsdescribefeaturetype.cpp b/src/server/services/wfs/qgswfsdescribefeaturetype.cpp index 59302006d476..1ef3d78f2295 100644 --- a/src/server/services/wfs/qgswfsdescribefeaturetype.cpp +++ b/src/server/services/wfs/qgswfsdescribefeaturetype.cpp @@ -326,9 +326,9 @@ namespace QgsWfs QgsDateTimeFieldFormatter fieldFormatter; const QVariantMap config = setup.config(); const QString fieldFormat = config.value( QStringLiteral( "field_format" ), fieldFormatter.defaultFormat( field.type() ) ).toString(); - if ( fieldFormat == QStringLiteral( "yyyy-MM-dd" ) ) + if ( fieldFormat == QLatin1String( "yyyy-MM-dd" ) ) attElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "date" ) ); - else if ( fieldFormat == QStringLiteral( "HH:mm:ss" ) ) + else if ( fieldFormat == QLatin1String( "HH:mm:ss" ) ) attElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "time" ) ); else attElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "dateTime" ) ); diff --git a/src/server/services/wfs/qgswfsgetcapabilities.cpp b/src/server/services/wfs/qgswfsgetcapabilities.cpp index 4602117ff2e9..4aadda03e908 100644 --- a/src/server/services/wfs/qgswfsgetcapabilities.cpp +++ b/src/server/services/wfs/qgswfsgetcapabilities.cpp @@ -187,7 +187,7 @@ namespace QgsWfs } QStringList keywords = QgsServerProjectUtils::owsServiceKeywords( *project ); - if ( !keywords.isEmpty() && !keywords.join( QStringLiteral( ", " ) ).isEmpty() ) + if ( !keywords.isEmpty() && !keywords.join( QLatin1String( ", " ) ).isEmpty() ) { QDomElement keywordsElem = doc.createElement( QStringLiteral( "ows:Keywords" ) ); for ( const QString &keyword : keywords ) diff --git a/src/server/services/wfs/qgswfsgetcapabilities_1_0_0.cpp b/src/server/services/wfs/qgswfsgetcapabilities_1_0_0.cpp index 67aad16754fd..9e86a23e1f06 100644 --- a/src/server/services/wfs/qgswfsgetcapabilities_1_0_0.cpp +++ b/src/server/services/wfs/qgswfsgetcapabilities_1_0_0.cpp @@ -159,10 +159,10 @@ namespace QgsWfs } const QStringList keywords = QgsServerProjectUtils::owsServiceKeywords( *project ); - if ( !keywords.isEmpty() && !keywords.join( QStringLiteral( ", " ) ).isEmpty() ) + if ( !keywords.isEmpty() && !keywords.join( QLatin1String( ", " ) ).isEmpty() ) { QDomElement keywordsElem = doc.createElement( QStringLiteral( "Keywords" ) ); - QDomText keywordsText = doc.createTextNode( keywords.join( QStringLiteral( ", " ) ) ); + QDomText keywordsText = doc.createTextNode( keywords.join( QLatin1String( ", " ) ) ); keywordsElem.appendChild( keywordsText ); serviceElem.appendChild( keywordsElem ); } diff --git a/src/server/services/wfs/qgswfsgetfeature.cpp b/src/server/services/wfs/qgswfsgetfeature.cpp index 8c8c9cf410be..133be00e386f 100644 --- a/src/server/services/wfs/qgswfsgetfeature.cpp +++ b/src/server/services/wfs/qgswfsgetfeature.cpp @@ -251,7 +251,7 @@ namespace QgsWfs QgsAttributeList attrIndexes = vlayer->attributeList(); const QgsFields fields = vlayer->fields(); bool withGeom = true; - if ( !propertyList.isEmpty() && propertyList.first() != QStringLiteral( "*" ) ) + if ( !propertyList.isEmpty() && propertyList.first() != QLatin1String( "*" ) ) { withGeom = false; QStringList::const_iterator plstIt; @@ -277,7 +277,7 @@ namespace QgsWfs { idxList.append( fieldNameIdx ); } - else if ( fieldName == QStringLiteral( "geometry" ) ) + else if ( fieldName == QLatin1String( "geometry" ) ) { withGeom = true; } @@ -578,7 +578,7 @@ namespace QgsWfs query.srsName = mWfsParameters.srsName(); // Parse PropertyName - if ( propertyName != QStringLiteral( "*" ) ) + if ( propertyName != QLatin1String( "*" ) ) { QStringList propertyList; @@ -653,7 +653,7 @@ namespace QgsWfs query.srsName = mWfsParameters.srsName(); // Parse PropertyName - if ( propertyName != QStringLiteral( "*" ) ) + if ( propertyName != QLatin1String( "*" ) ) { QStringList propertyList; @@ -1010,7 +1010,7 @@ namespace QgsWfs fcString = QStringLiteral( "{\"type\": \"FeatureCollection\",\n" ); fcString += QStringLiteral( " \"timeStamp\": \"%1\"\n" ).arg( now.toString( Qt::ISODate ) ); fcString += QStringLiteral( " \"numberOfFeatures\": %1\n" ).arg( QString::number( numberOfFeatures ) ); - fcString += QLatin1String( "}" ); + fcString += QLatin1Char( '}' ); } else { @@ -1069,7 +1069,7 @@ namespace QgsWfs fcString += "\n timeStamp=\"" + now.toString( Qt::ISODate ) + "\""; fcString += "\n numberOfFeatures=\"" + QString::number( numberOfFeatures ) + "\""; fcString += QLatin1String( ">\n" ); - fcString += QStringLiteral( "" ); + fcString += QLatin1String( "" ); } response.write( fcString.toUtf8() ); @@ -1255,7 +1255,7 @@ namespace QgsWfs if ( format == QgsWfsParameters::Format::GeoJSON ) { fcString += QLatin1String( " ]\n" ); - fcString += QLatin1String( "}" ); + fcString += QLatin1Char( '}' ); } else { diff --git a/src/server/services/wfs/qgswfstransaction.cpp b/src/server/services/wfs/qgswfstransaction.cpp index 5f6871934f61..d07d5c7df2cf 100644 --- a/src/server/services/wfs/qgswfstransaction.cpp +++ b/src/server/services/wfs/qgswfstransaction.cpp @@ -532,7 +532,7 @@ namespace QgsWfs if ( !vlayer->commitChanges() ) { action.error = true; - action.errorMsg = QStringLiteral( "Error committing updates: %1" ).arg( vlayer->commitErrors().join( QStringLiteral( "; " ) ) ); + action.errorMsg = QStringLiteral( "Error committing updates: %1" ).arg( vlayer->commitErrors().join( QLatin1String( "; " ) ) ); vlayer->rollBack(); continue; } @@ -651,7 +651,7 @@ namespace QgsWfs if ( !vlayer->commitChanges() ) { action.error = true; - action.errorMsg = QStringLiteral( "Error committing deletes: %1" ).arg( vlayer->commitErrors().join( QStringLiteral( "; " ) ) ); + action.errorMsg = QStringLiteral( "Error committing deletes: %1" ).arg( vlayer->commitErrors().join( QLatin1String( "; " ) ) ); vlayer->rollBack(); continue; } @@ -767,7 +767,7 @@ namespace QgsWfs if ( !vlayer->commitChanges() ) { action.error = true; - action.errorMsg = QStringLiteral( "Error committing inserts: %1" ).arg( vlayer->commitErrors().join( QStringLiteral( "; " ) ) ); + action.errorMsg = QStringLiteral( "Error committing inserts: %1" ).arg( vlayer->commitErrors().join( QLatin1String( "; " ) ) ); vlayer->rollBack(); continue; } @@ -861,7 +861,7 @@ namespace QgsWfs { throw QgsRequestNotWellFormedException( QStringLiteral( "OPERATION parameter is mandatory" ) ); } - if ( parameters.value( QStringLiteral( "OPERATION" ) ).toUpper() != QStringLiteral( "DELETE" ) ) + if ( parameters.value( QStringLiteral( "OPERATION" ) ).toUpper() != QLatin1String( "DELETE" ) ) { throw QgsRequestNotWellFormedException( QStringLiteral( "Only DELETE value is defined for OPERATION parameter" ) ); } diff --git a/src/server/services/wfs/qgswfstransaction_1_0_0.cpp b/src/server/services/wfs/qgswfstransaction_1_0_0.cpp index 2c707c20832d..4f51bd87f1d7 100644 --- a/src/server/services/wfs/qgswfstransaction_1_0_0.cpp +++ b/src/server/services/wfs/qgswfstransaction_1_0_0.cpp @@ -185,8 +185,8 @@ namespace QgsWfs } else { - QString locator = errorLocators.join( QStringLiteral( "; " ) ); - QString message = errorMessages.join( QStringLiteral( "; " ) ); + QString locator = errorLocators.join( QLatin1String( "; " ) ); + QString message = errorMessages.join( QLatin1String( "; " ) ); if ( errorCount != actionCount ) { addTransactionResult( resp, respElem, QStringLiteral( "PARTIAL" ), locator, message ); @@ -508,7 +508,7 @@ namespace QgsWfs if ( !vlayer->commitChanges() ) { action.error = true; - action.errorMsg = QStringLiteral( "Error committing updates: %1" ).arg( vlayer->commitErrors().join( QStringLiteral( "; " ) ) ); + action.errorMsg = QStringLiteral( "Error committing updates: %1" ).arg( vlayer->commitErrors().join( QLatin1String( "; " ) ) ); vlayer->rollBack(); continue; } @@ -626,7 +626,7 @@ namespace QgsWfs if ( !vlayer->commitChanges() ) { action.error = true; - action.errorMsg = QStringLiteral( "Error committing deletes: %1" ).arg( vlayer->commitErrors().join( QStringLiteral( "; " ) ) ); + action.errorMsg = QStringLiteral( "Error committing deletes: %1" ).arg( vlayer->commitErrors().join( QLatin1String( "; " ) ) ); vlayer->rollBack(); continue; } @@ -741,7 +741,7 @@ namespace QgsWfs if ( !vlayer->commitChanges() ) { action.error = true; - action.errorMsg = QStringLiteral( "Error committing inserts: %1" ).arg( vlayer->commitErrors().join( QStringLiteral( "; " ) ) ); + action.errorMsg = QStringLiteral( "Error committing inserts: %1" ).arg( vlayer->commitErrors().join( QLatin1String( "; " ) ) ); vlayer->rollBack(); continue; } @@ -835,7 +835,7 @@ namespace QgsWfs { throw QgsRequestNotWellFormedException( QStringLiteral( "OPERATION parameter is mandatory" ) ); } - if ( parameters.value( QStringLiteral( "OPERATION" ) ).toUpper() != QStringLiteral( "DELETE" ) ) + if ( parameters.value( QStringLiteral( "OPERATION" ) ).toUpper() != QLatin1String( "DELETE" ) ) { throw QgsRequestNotWellFormedException( QStringLiteral( "Only DELETE value is defined for OPERATION parameter" ) ); } diff --git a/src/server/services/wfs3/qgswfs3handlers.cpp b/src/server/services/wfs3/qgswfs3handlers.cpp index 144a68b2b4ab..cb433ae20174 100644 --- a/src/server/services/wfs3/qgswfs3handlers.cpp +++ b/src/server/services/wfs3/qgswfs3handlers.cpp @@ -818,7 +818,7 @@ QList QgsWfs3CollectionsItemsHandler::parameters( QgsServerQueryStringParameter properties { QStringLiteral( "properties" ), false, QgsServerQueryStringParameter::Type::List, QStringLiteral( "Comma separated list of feature property names to be added to the result. Valid values: %1" ) - .arg( publishedFieldNames.join( QStringLiteral( "', '" ) ) + .arg( publishedFieldNames.join( QLatin1String( "', '" ) ) .append( '\'' ) .prepend( '\'' ) ) }; @@ -1244,7 +1244,7 @@ void QgsWfs3CollectionsItemsHandler::handleRequest( const QgsServerApiContext &c if ( re2.match( it.value() ).hasMatch() ) { QString val { it.value() }; - expressions.push_back( QStringLiteral( "\"%1\" LIKE '%2'" ).arg( it.key() ).arg( val.replace( '%', QStringLiteral( "%%" ) ).replace( '*', '%' ) ) ); + expressions.push_back( QStringLiteral( "\"%1\" LIKE '%2'" ).arg( it.key() ).arg( val.replace( '%', QLatin1String( "%%" ) ).replace( '*', '%' ) ) ); } else { @@ -1256,7 +1256,7 @@ void QgsWfs3CollectionsItemsHandler::handleRequest( const QgsServerApiContext &c // Join all expression filters if ( ! expressions.isEmpty() ) { - filterExpression = expressions.join( QStringLiteral( " AND " ) ); + filterExpression = expressions.join( QLatin1String( " AND " ) ); featureRequest.setFilterExpression( filterExpression ); QgsDebugMsgLevel( QStringLiteral( "Filter expression: %1" ).arg( featureRequest.filterExpression()->expression() ), 4 ); } diff --git a/src/server/services/wms/qgswmsgetcapabilities.cpp b/src/server/services/wms/qgswmsgetcapabilities.cpp index feea0baf034f..c8d3e2be7335 100644 --- a/src/server/services/wms/qgswmsgetcapabilities.cpp +++ b/src/server/services/wms/qgswmsgetcapabilities.cpp @@ -1293,7 +1293,7 @@ namespace QgsWms { strValues << v.toString(); } - QDomText dimValuesText = doc.createTextNode( strValues.join( QStringLiteral( ", " ) ) ); + QDomText dimValuesText = doc.createTextNode( strValues.join( QLatin1String( ", " ) ) ); dimElem.appendChild( dimValuesText ); layerElem.appendChild( dimElem ); } diff --git a/src/server/services/wms/qgswmsparameters.cpp b/src/server/services/wms/qgswmsparameters.cpp index d159e99c2bbc..f6af07e29ebb 100644 --- a/src/server/services/wms/qgswmsparameters.cpp +++ b/src/server/services/wms/qgswmsparameters.cpp @@ -604,7 +604,7 @@ namespace QgsWms } else //maybe an external wms parameter? { - int separator = key.indexOf( QStringLiteral( ":" ) ); + int separator = key.indexOf( QLatin1Char( ':' ) ); if ( separator >= 1 ) { QString id = key.left( separator ); @@ -1435,7 +1435,7 @@ namespace QgsWms for ( int i = 0; i < rawFilters.size(); i++ ) { const QString f = rawFilters[i]; - if ( f.startsWith( QLatin1String( "<" ) ) \ + if ( f.startsWith( QLatin1Char( '<' ) ) \ && f.endsWith( QLatin1String( "Filter>" ) ) \ && i < layers.size() ) { @@ -2066,7 +2066,7 @@ namespace QgsWms const QStringList unmanagedNames = mUnmanagedParameters.keys(); for ( const QString &key : unmanagedNames ) { - if ( key.startsWith( QStringLiteral( "DIM_" ) ) ) + if ( key.startsWith( QLatin1String( "DIM_" ) ) ) { dimValues[key.mid( 4 )] = mUnmanagedParameters[key]; } diff --git a/src/server/services/wms/qgswmsrenderer.cpp b/src/server/services/wms/qgswmsrenderer.cpp index d1af2e806cc2..1dc6ab371bdd 100644 --- a/src/server/services/wms/qgswmsrenderer.cpp +++ b/src/server/services/wms/qgswmsrenderer.cpp @@ -335,7 +335,7 @@ namespace QgsWms } int maxAtlasFeatures = QgsServerProjectUtils::wmsMaxAtlasFeatures( *mProject ); - if ( atlasPk.size() == 1 && atlasPk.at( 0 ) == QStringLiteral( "*" ) ) + if ( atlasPk.size() == 1 && atlasPk.at( 0 ) == QLatin1String( "*" ) ) { atlas->setFilterFeatures( false ); atlas->updateFeatures(); @@ -2484,7 +2484,7 @@ namespace QgsWms QgsFieldFormatter *fieldFormatter = QgsApplication::fieldFormatterRegistry()->fieldFormatter( setup.type() ); QString value( fieldFormatter->representValue( vl, idx, setup.config(), QVariant(), attributeVal ) ); - if ( setup.config().value( QStringLiteral( "AllowMulti" ) ).toBool() && value.startsWith( QLatin1String( "{" ) ) && value.endsWith( QLatin1String( "}" ) ) ) + if ( setup.config().value( QStringLiteral( "AllowMulti" ) ).toBool() && value.startsWith( QLatin1Char( '{' ) ) && value.endsWith( QLatin1Char( '}' ) ) ) { value = value.mid( 1, value.size() - 2 ); } @@ -2824,7 +2824,7 @@ namespace QgsWms } else if ( expList.size() > 1 ) { - exp = QStringLiteral( "( %1 )" ).arg( expList.join( QStringLiteral( " ) AND ( " ) ) ); + exp = QStringLiteral( "( %1 )" ).arg( expList.join( QLatin1String( " ) AND ( " ) ) ); } if ( !exp.isEmpty() ) { @@ -3012,7 +3012,7 @@ namespace QgsWms } else if ( dimExplist.size() > 1 ) { - expList << QStringLiteral( "( %1 )" ).arg( dimExplist.join( QStringLiteral( " ) OR ( " ) ) ); + expList << QStringLiteral( "( %1 )" ).arg( dimExplist.join( QLatin1String( " ) OR ( " ) ) ); } } } diff --git a/src/server/services/wms/qgswmsserviceexception.h b/src/server/services/wms/qgswmsserviceexception.h index 74cf9c75ea7a..6949e4301a1a 100644 --- a/src/server/services/wms/qgswmsserviceexception.h +++ b/src/server/services/wms/qgswmsserviceexception.h @@ -176,8 +176,8 @@ namespace QgsWms QString key = metaEnum.valueToKey( code ); // remove prefix - key.replace( QStringLiteral( "OGC_" ), QString() ); - key.replace( QStringLiteral( "QGIS_" ), QString() ); + key.replace( QLatin1String( "OGC_" ), QString() ); + key.replace( QLatin1String( "QGIS_" ), QString() ); return key; } diff --git a/tests/bench/qgsbench.cpp b/tests/bench/qgsbench.cpp index 4d2f799cdd54..9fd5cdae88a7 100644 --- a/tests/bench/qgsbench.cpp +++ b/tests/bench/qgsbench.cpp @@ -317,7 +317,7 @@ QString QgsBench::serialize( const QMap &map, int level ) } ++i; } - return space + "{\n" + list.join( QStringLiteral( ",\n" ) ) + '\n' + space + '}'; + return space + "{\n" + list.join( QLatin1String( ",\n" ) ) + '\n' + space + '}'; } void QgsBench::saveLog( const QString &fileName ) diff --git a/tests/src/analysis/testqgsprocessing.cpp b/tests/src/analysis/testqgsprocessing.cpp index 4f0dbe2ef7ea..60c16136e99c 100644 --- a/tests/src/analysis/testqgsprocessing.cpp +++ b/tests/src/analysis/testqgsprocessing.cpp @@ -1676,7 +1676,7 @@ void TestQgsProcessing::generateTemporaryDestination() std::unique_ptr< QgsProcessingParameterVectorDestination > def( new QgsProcessingParameterVectorDestination( "with.inside", QString(), QgsProcessing::TypeVectorAnyGeometry, QString(), false ) ); // check that temporary destination does not have dot at the end when there is no extension - QVERIFY( !def->generateTemporaryDestination().endsWith( QLatin1String( "." ) ) ); + QVERIFY( !def->generateTemporaryDestination().endsWith( QLatin1Char( '.' ) ) ); // check that temporary destination starts with tempFolder QVERIFY( def->generateTemporaryDestination().startsWith( QgsProcessingUtils::tempFolder() ) ); // check that extension with QFileInfo::completeSuffix is "gpkg" @@ -1687,7 +1687,7 @@ void TestQgsProcessing::generateTemporaryDestination() std::unique_ptr< QgsProcessingParameterRasterDestination > def2( new QgsProcessingParameterRasterDestination( "with.inside", QString(), QString(), false ) ); // check that temporary destination does not have dot at the end when there is no extension - QVERIFY( !def2->generateTemporaryDestination().endsWith( QLatin1String( "." ) ) ); + QVERIFY( !def2->generateTemporaryDestination().endsWith( QLatin1Char( '.' ) ) ); // check that temporary destination starts with tempFolder QVERIFY( def2->generateTemporaryDestination().startsWith( QgsProcessingUtils::tempFolder() ) ); // check that extension with QFileInfo::completeSuffix is "tif" @@ -1698,7 +1698,7 @@ void TestQgsProcessing::generateTemporaryDestination() std::unique_ptr< QgsProcessingParameterVectorDestination > def3( new QgsProcessingParameterVectorDestination( "without_inside", QString(), QgsProcessing::TypeVectorAnyGeometry, QString(), false ) ); // check that temporary destination does not have dot at the end when there is no extension - QVERIFY( !def3->generateTemporaryDestination().endsWith( QLatin1String( "." ) ) ); + QVERIFY( !def3->generateTemporaryDestination().endsWith( QLatin1Char( '.' ) ) ); // check that temporary destination starts with tempFolder QVERIFY( def3->generateTemporaryDestination().startsWith( QgsProcessingUtils::tempFolder() ) ); // check that extension with QFileInfo::completeSuffix is "gpkg" @@ -6663,7 +6663,7 @@ void TestQgsProcessing::parameterFolderOut() QVERIFY( def->checkValueIsAcceptable( "c:/Users/admin/Desktop/", &context ) ); // check that temporary destination does not have dot at the end when there is no extension - QVERIFY( !def->generateTemporaryDestination().endsWith( QLatin1String( "." ) ) ); + QVERIFY( !def->generateTemporaryDestination().endsWith( QLatin1Char( '.' ) ) ); QVERIFY( def->generateTemporaryDestination().startsWith( QgsProcessingUtils::tempFolder() ) ); QVariantMap params; @@ -11118,8 +11118,8 @@ void TestQgsProcessing::defaultExtensionsForProvider() // unless the user has set a default format, which IS supported by that provider QgsSettings settings; - settings.setValue( QStringLiteral( "Processing/Configuration/DefaultOutputVectorLayerExt" ), QgsVectorFileWriter::supportedFormatExtensions().indexOf( QStringLiteral( "tab" ) ) ); - settings.setValue( QStringLiteral( "Processing/Configuration/DefaultOutputRasterLayerExt" ), QgsRasterFileWriter::supportedFormatExtensions().indexOf( QStringLiteral( "sdat" ) ) ); + settings.setValue( QStringLiteral( "Processing/Configuration/DefaultOutputVectorLayerExt" ), QgsVectorFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "tab" ) ) ); + settings.setValue( QStringLiteral( "Processing/Configuration/DefaultOutputRasterLayerExt" ), QgsRasterFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "sdat" ) ) ); QCOMPARE( provider.defaultVectorFileExtension( true ), QStringLiteral( "tab" ) ); QCOMPARE( provider.defaultRasterFileExtension(), QStringLiteral( "sdat" ) ); @@ -11130,8 +11130,8 @@ void TestQgsProcessing::defaultExtensionsForProvider() QCOMPARE( context2.preferredRasterFormat(), QStringLiteral( "sdat" ) ); // but if default is not supported by provider, we use a supported format - settings.setValue( QStringLiteral( "Processing/Configuration/DefaultOutputVectorLayerExt" ), QgsVectorFileWriter::supportedFormatExtensions().indexOf( QStringLiteral( "gpkg" ) ) ); - settings.setValue( QStringLiteral( "Processing/Configuration/DefaultOutputRasterLayerExt" ), QgsRasterFileWriter::supportedFormatExtensions().indexOf( QStringLiteral( "ecw" ) ) ); + settings.setValue( QStringLiteral( "Processing/Configuration/DefaultOutputVectorLayerExt" ), QgsVectorFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "gpkg" ) ) ); + settings.setValue( QStringLiteral( "Processing/Configuration/DefaultOutputRasterLayerExt" ), QgsRasterFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "ecw" ) ) ); QCOMPARE( provider.defaultVectorFileExtension( true ), QStringLiteral( "mif" ) ); QCOMPARE( provider.defaultRasterFileExtension(), QStringLiteral( "mig" ) ); } diff --git a/tests/src/analysis/testqgsprocessingalgs.cpp b/tests/src/analysis/testqgsprocessingalgs.cpp index 4b1339c78fad..a8555a03308e 100644 --- a/tests/src/analysis/testqgsprocessingalgs.cpp +++ b/tests/src/analysis/testqgsprocessingalgs.cpp @@ -769,8 +769,8 @@ void TestQgsProcessingAlgs::categorizeByStyle() QCOMPARE( catRenderer->categories().count(), 3 ); QCOMPARE( catRenderer->categories().at( catRenderer->categoryIndexForValue( QStringLiteral( "a" ) ) ).symbol()->color().name(), QStringLiteral( "#ff0000" ) ); - QVERIFY( catRenderer->categories().at( catRenderer->categoryIndexForValue( QStringLiteral( "b" ) ) ).symbol()->color().name() != QStringLiteral( "#00ff00" ) ); - QVERIFY( catRenderer->categories().at( catRenderer->categoryIndexForValue( QStringLiteral( "c " ) ) ).symbol()->color().name() != QStringLiteral( "#0000ff" ) ); + QVERIFY( catRenderer->categories().at( catRenderer->categoryIndexForValue( QStringLiteral( "b" ) ) ).symbol()->color().name() != QLatin1String( "#00ff00" ) ); + QVERIFY( catRenderer->categories().at( catRenderer->categoryIndexForValue( QStringLiteral( "c " ) ) ).symbol()->color().name() != QLatin1String( "#0000ff" ) ); // reset renderer layer->setRenderer( new QgsSingleSymbolRenderer( QgsSymbol::defaultSymbol( QgsWkbTypes::PointGeometry ) ) ); @@ -791,7 +791,7 @@ void TestQgsProcessingAlgs::categorizeByStyle() QCOMPARE( catRenderer->categories().count(), 3 ); QCOMPARE( catRenderer->categories().at( catRenderer->categoryIndexForValue( QStringLiteral( "a" ) ) ).symbol()->color().name(), QStringLiteral( "#ff0000" ) ); QCOMPARE( catRenderer->categories().at( catRenderer->categoryIndexForValue( QStringLiteral( "b" ) ) ).symbol()->color().name(), QStringLiteral( "#00ff00" ) ); - QVERIFY( catRenderer->categories().at( catRenderer->categoryIndexForValue( QStringLiteral( "c " ) ) ).symbol()->color().name() != QStringLiteral( "#0000ff" ) ); + QVERIFY( catRenderer->categories().at( catRenderer->categoryIndexForValue( QStringLiteral( "c " ) ) ).symbol()->color().name() != QLatin1String( "#0000ff" ) ); // reset renderer layer->setRenderer( new QgsSingleSymbolRenderer( QgsSymbol::defaultSymbol( QgsWkbTypes::PointGeometry ) ) ); @@ -813,7 +813,7 @@ void TestQgsProcessingAlgs::categorizeByStyle() QCOMPARE( catRenderer->categories().count(), 3 ); QCOMPARE( catRenderer->categories().at( catRenderer->categoryIndexForValue( QStringLiteral( "a" ) ) ).symbol()->color().name(), QStringLiteral( "#ff0000" ) ); - QVERIFY( catRenderer->categories().at( catRenderer->categoryIndexForValue( QStringLiteral( "b" ) ) ).symbol()->color().name() != QStringLiteral( "#00ff00" ) ); + QVERIFY( catRenderer->categories().at( catRenderer->categoryIndexForValue( QStringLiteral( "b" ) ) ).symbol()->color().name() != QLatin1String( "#00ff00" ) ); QCOMPARE( catRenderer->categories().at( catRenderer->categoryIndexForValue( QStringLiteral( "c " ) ) ).symbol()->color().name(), QStringLiteral( "#0000ff" ) ); // reset renderer layer->setRenderer( new QgsSingleSymbolRenderer( QgsSymbol::defaultSymbol( QgsWkbTypes::PointGeometry ) ) ); @@ -3084,14 +3084,14 @@ void TestQgsProcessingAlgs::layoutMapExtent() QVERIFY( it.nextFeature( f1 ) ); QgsFeature f2; QVERIFY( it.nextFeature( f2 ) ); - f = f1.attribute( 0 ).toString() == QStringLiteral( "m" ) ? f1 : f2; + f = f1.attribute( 0 ).toString() == QLatin1String( "m" ) ? f1 : f2; QCOMPARE( f.attribute( 0 ).toString(), QStringLiteral( "m" ) ); QCOMPARE( f.attribute( 1 ).toDouble(), 150.0 ); QCOMPARE( f.attribute( 2 ).toDouble(), 180.0 ); QCOMPARE( f.attribute( 3 ).toDouble(), 10000.0 ); QCOMPARE( f.attribute( 4 ).toDouble(), 45.0 ); QCOMPARE( f.geometry().asWkt( 0 ), QStringLiteral( "Polygon ((12077408 -7108521, 12079627 -7107575, 12080760 -7110245, 12078540 -7111191, 12077408 -7108521))" ) ); - f = f1.attribute( 0 ).toString() == QStringLiteral( "m" ) ? f2 : f1; + f = f1.attribute( 0 ).toString() == QLatin1String( "m" ) ? f2 : f1; QCOMPARE( f.attribute( 0 ).toString(), QStringLiteral( "m2" ) ); QCOMPARE( f.attribute( 1 ).toDouble(), 50.0 ); QCOMPARE( f.attribute( 2 ).toDouble(), 80.0 ); @@ -3113,14 +3113,14 @@ void TestQgsProcessingAlgs::layoutMapExtent() it = qobject_cast< QgsVectorLayer * >( context->getMapLayer( results.value( QStringLiteral( "OUTPUT" ) ).toString() ) )->getFeatures(); QVERIFY( it.nextFeature( f1 ) ); QVERIFY( it.nextFeature( f2 ) ); - f = f1.attribute( 0 ).toString() == QStringLiteral( "m" ) ? f1 : f2; + f = f1.attribute( 0 ).toString() == QLatin1String( "m" ) ? f1 : f2; QCOMPARE( f.attribute( 0 ).toString(), QStringLiteral( "m" ) ); QCOMPARE( f.attribute( 1 ).toDouble(), 150.0 ); QCOMPARE( f.attribute( 2 ).toDouble(), 180.0 ); QCOMPARE( f.attribute( 3 ).toDouble(), 10000.0 ); QCOMPARE( f.attribute( 4 ).toDouble(), 45.0 ); QCOMPARE( f.geometry().asWkt( 0 ), QStringLiteral( "Polygon ((33833 140106, 34894 141167, 36167 139894, 35106 138833, 33833 140106))" ) ); - f = f1.attribute( 0 ).toString() == QStringLiteral( "m" ) ? f2 : f1; + f = f1.attribute( 0 ).toString() == QLatin1String( "m" ) ? f2 : f1; QCOMPARE( f.attribute( 0 ).toString(), QStringLiteral( "m2" ) ); QCOMPARE( f.attribute( 1 ).toDouble(), 50.0 ); QCOMPARE( f.attribute( 2 ).toDouble(), 80.0 ); diff --git a/tests/src/app/testqgsgpsinformationwidget.cpp b/tests/src/app/testqgsgpsinformationwidget.cpp index b42c4b5187dd..144abba1491e 100644 --- a/tests/src/app/testqgsgpsinformationwidget.cpp +++ b/tests/src/app/testqgsgpsinformationwidget.cpp @@ -178,12 +178,12 @@ void TestQgsGpsInformationWidget::testStorePreferredFields() std::unique_ptr widget = prepareWidget(); QgsMapCanvas *canvas = mQgisApp->mapCanvas(); canvas->setCurrentLayer( tempLayerDateTime ); - int fieldIdx = tempLayerDateTime->fields().indexOf( QStringLiteral( "datetimef" ) ); + int fieldIdx = tempLayerDateTime->fields().indexOf( QLatin1String( "datetimef" ) ); QVERIFY( fieldIdx != -1 ); widget->mCboTimestampField->setCurrentIndex( widget->mCboTimestampField->findText( QStringLiteral( "datetimef" ) ) ); canvas->setCurrentLayer( tempLayerString ); - fieldIdx = tempLayerString->fields().indexOf( QStringLiteral( "stringf" ) ); + fieldIdx = tempLayerString->fields().indexOf( QLatin1String( "stringf" ) ); QVERIFY( fieldIdx != -1 ); widget->mCboTimestampField->setCurrentIndex( widget->mCboTimestampField->findText( QStringLiteral( "stringf" ) ) ); @@ -208,7 +208,7 @@ void TestQgsGpsInformationWidget::testTimestamp() // Test datetime layer canvas->setCurrentLayer( tempLayerDateTime ); - int fieldIdx { tempLayerDateTime->fields().indexOf( QStringLiteral( "datetimef" ) ) }; + int fieldIdx { tempLayerDateTime->fields().indexOf( QLatin1String( "datetimef" ) ) }; widget->mCboTimestampField->setCurrentIndex( widget->mCboTimestampField->findText( QStringLiteral( "datetimef" ) ) ); QVERIFY( fieldIdx != -1 ); // UTC @@ -230,7 +230,7 @@ void TestQgsGpsInformationWidget::testTimestamp() /////////////////////////////////////////// // Test string canvas->setCurrentLayer( tempLayerString ); - fieldIdx = tempLayerString->fields().indexOf( QStringLiteral( "stringf" ) ); + fieldIdx = tempLayerString->fields().indexOf( QLatin1String( "stringf" ) ); widget->mCboTimestampField->setCurrentIndex( widget->mCboTimestampField->findText( QStringLiteral( "stringf" ) ) ); // UTC diff --git a/tests/src/core/testqgsbrowsermodel.cpp b/tests/src/core/testqgsbrowsermodel.cpp index ef6972cbe985..1a09255a961d 100644 --- a/tests/src/core/testqgsbrowsermodel.cpp +++ b/tests/src/core/testqgsbrowsermodel.cpp @@ -201,7 +201,7 @@ static int testRootItemCount( QgsBrowserModel &model ) int count = 0; for ( int i = 0; i < model.rowCount(); ++i ) { - if ( model.data( model.index( i, 0 ) ).toString() == QStringLiteral( "test-root-item" ) ) + if ( model.data( model.index( i, 0 ) ).toString() == QLatin1String( "test-root-item" ) ) ++count; } return count; diff --git a/tests/src/core/testqgscolorschemeregistry.cpp b/tests/src/core/testqgscolorschemeregistry.cpp index 4d3ed221f84c..1780dd53a6a7 100644 --- a/tests/src/core/testqgscolorschemeregistry.cpp +++ b/tests/src/core/testqgscolorschemeregistry.cpp @@ -239,7 +239,7 @@ void TestQgsColorSchemeRegistry::fetchRandomStyleColor() for ( int i = 0; i < 10; ++i ) { QString color = registry->fetchRandomStyleColor().name(); - QVERIFY( color == QStringLiteral( "#ff0000" ) || color == QStringLiteral( "#00ff00" ) ); + QVERIFY( color == QLatin1String( "#ff0000" ) || color == QLatin1String( "#00ff00" ) ); } // remove current random style color scheme diff --git a/tests/src/core/testqgsgeometry.cpp b/tests/src/core/testqgsgeometry.cpp index ded2d55839e1..7256a9dce4f2 100644 --- a/tests/src/core/testqgsgeometry.cpp +++ b/tests/src/core/testqgsgeometry.cpp @@ -5805,19 +5805,19 @@ void TestQgsGeometry::polygon() // as GML2 QString expectedGML2( QStringLiteral( "0,0 0,10 10,10 10,0 0,0" ) ); - expectedGML2 += QStringLiteral( "1,1 1,9 9,9 9,1 1,1" ); + expectedGML2 += QLatin1String( "1,1 1,9 9,9 9,1 1,1" ); QGSCOMPAREGML( elemToString( exportPolygon.asGml2( doc ) ), expectedGML2 ); QString expectedGML2prec3( QStringLiteral( "1.111,1.111 1.111,11.111 11.111,11.111 11.111,1.111 1.111,1.111" ) ); - expectedGML2prec3 += QStringLiteral( "0.667,0.667 0.667,1.333 1.333,1.333 1.333,0.667 0.667,0.667" ); + expectedGML2prec3 += QLatin1String( "0.667,0.667 0.667,1.333 1.333,1.333 1.333,0.667 0.667,0.667" ); QGSCOMPAREGML( elemToString( exportPolygonFloat.asGml2( doc, 3 ) ), expectedGML2prec3 ); //as GML3 QString expectedGML3( QStringLiteral( "0 0 0 10 10 10 10 0 0 0" ) ); - expectedGML3 += QStringLiteral( "1 1 1 9 9 9 9 1 1 1" ); + expectedGML3 += QLatin1String( "1 1 1 9 9 9 9 1 1 1" ); QCOMPARE( elemToString( exportPolygon.asGml3( doc ) ), expectedGML3 ); QString expectedGML3prec3( QStringLiteral( "1.111 1.111 1.111 11.111 11.111 11.111 11.111 1.111 1.111 1.111" ) ); - expectedGML3prec3 += QStringLiteral( "0.667 0.667 0.667 1.333 1.333 1.333 1.333 0.667 0.667 0.667" ); + expectedGML3prec3 += QLatin1String( "0.667 0.667 0.667 1.333 1.333 1.333 1.333 0.667 0.667 0.667" ); QCOMPARE( elemToString( exportPolygonFloat.asGml3( doc, 3 ) ), expectedGML3prec3 ); //asKML diff --git a/tests/src/core/testqgsgeopdfexport.cpp b/tests/src/core/testqgsgeopdfexport.cpp index e12cb85db034..5c385d581367 100644 --- a/tests/src/core/testqgsgeopdfexport.cpp +++ b/tests/src/core/testqgsgeopdfexport.cpp @@ -133,7 +133,7 @@ void TestQgsGeoPdfExport::testCollectingFeatures() QgsAbstractGeoPdfExporter::VectorComponentDetail component; for ( const auto &it : qgis::as_const( geoPdfExporter.mVectorComponents ) ) { - if ( it.mapLayerId == QStringLiteral( "layer1" ) ) + if ( it.mapLayerId == QLatin1String( "layer1" ) ) { component = it; break; @@ -160,7 +160,7 @@ void TestQgsGeoPdfExport::testCollectingFeatures() for ( const auto &it : qgis::as_const( geoPdfExporter.mVectorComponents ) ) { - if ( it.mapLayerId == QStringLiteral( "layer2" ) ) + if ( it.mapLayerId == QLatin1String( "layer2" ) ) { component = it; break; @@ -211,12 +211,12 @@ void TestQgsGeoPdfExport::testComposition() for ( const auto &it : qgis::as_const( geoPdfExporter.mVectorComponents ) ) { - if ( it.mapLayerId == QStringLiteral( "layer1" ) ) + if ( it.mapLayerId == QLatin1String( "layer1" ) ) { layer1Path = it.sourceVectorPath; layer1Layer = it.sourceVectorLayer; } - else if ( it.mapLayerId == QStringLiteral( "layer2" ) ) + else if ( it.mapLayerId == QLatin1String( "layer2" ) ) { layer2Path = it.sourceVectorPath; layer2Layer = it.sourceVectorLayer; @@ -244,12 +244,12 @@ void TestQgsGeoPdfExport::testComposition() QDomNodeList ifLayerOnList = doc.elementsByTagName( QStringLiteral( "IfLayerOn" ) ); QCOMPARE( ifLayerOnList.count(), 3 ); - int layer1Idx = ifLayerOnList.at( 0 ).toElement().attribute( QStringLiteral( "layerId" ) ) == QStringLiteral( "layer1" ) ? 0 : - ifLayerOnList.at( 1 ).toElement().attribute( QStringLiteral( "layerId" ) ) == QStringLiteral( "layer1" ) ? 1 : 2; - int layer2Idx = ifLayerOnList.at( 0 ).toElement().attribute( QStringLiteral( "layerId" ) ) == QStringLiteral( "layer2" ) ? 0 : - ifLayerOnList.at( 1 ).toElement().attribute( QStringLiteral( "layerId" ) ) == QStringLiteral( "layer2" ) ? 1 : 2; - int layer3Idx = ifLayerOnList.at( 0 ).toElement().attribute( QStringLiteral( "layerId" ) ) == QStringLiteral( "layer3" ) ? 0 : - ifLayerOnList.at( 1 ).toElement().attribute( QStringLiteral( "layerId" ) ) == QStringLiteral( "layer3" ) ? 1 : 2; + int layer1Idx = ifLayerOnList.at( 0 ).toElement().attribute( QStringLiteral( "layerId" ) ) == QLatin1String( "layer1" ) ? 0 : + ifLayerOnList.at( 1 ).toElement().attribute( QStringLiteral( "layerId" ) ) == QLatin1String( "layer1" ) ? 1 : 2; + int layer2Idx = ifLayerOnList.at( 0 ).toElement().attribute( QStringLiteral( "layerId" ) ) == QLatin1String( "layer2" ) ? 0 : + ifLayerOnList.at( 1 ).toElement().attribute( QStringLiteral( "layerId" ) ) == QLatin1String( "layer2" ) ? 1 : 2; + int layer3Idx = ifLayerOnList.at( 0 ).toElement().attribute( QStringLiteral( "layerId" ) ) == QLatin1String( "layer3" ) ? 0 : + ifLayerOnList.at( 1 ).toElement().attribute( QStringLiteral( "layerId" ) ) == QLatin1String( "layer3" ) ? 1 : 2; QCOMPARE( ifLayerOnList.at( layer1Idx ).toElement().attribute( QStringLiteral( "layerId" ) ), QStringLiteral( "layer1" ) ); QCOMPARE( ifLayerOnList.at( layer1Idx ).toElement().elementsByTagName( QStringLiteral( "Vector" ) ).at( 0 ).toElement().attribute( QStringLiteral( "dataset" ) ), layer1Path ); QCOMPARE( ifLayerOnList.at( layer1Idx ).toElement().elementsByTagName( QStringLiteral( "Vector" ) ).at( 0 ).toElement().attribute( QStringLiteral( "layer" ) ), layer1Layer ); @@ -363,7 +363,7 @@ void TestQgsGeoPdfExport::testGeoref() { const QString x = cps.at( i ).toElement().attribute( QStringLiteral( "GeoX" ) ).left( 10 ); const QString y = cps.at( i ).toElement().attribute( QStringLiteral( "GeoY" ) ).left( 10 ); - if ( x == QStringLiteral( "-122.40000" ) && y == QStringLiteral( "53.6000000" ) ) + if ( x == QLatin1String( "-122.40000" ) && y == QLatin1String( "53.6000000" ) ) { cp1 = cps.at( i ).toElement(); break; @@ -409,7 +409,7 @@ void TestQgsGeoPdfExport::testGeorefPolygon() { const QString x = cps.at( i ).toElement().attribute( QStringLiteral( "GeoX" ) ).left( 10 ); const QString y = cps.at( i ).toElement().attribute( QStringLiteral( "GeoY" ) ).left( 10 ); - if ( x == QStringLiteral( "-122.40000" ) && y == QStringLiteral( "53.6000000" ) ) + if ( x == QLatin1String( "-122.40000" ) && y == QLatin1String( "53.6000000" ) ) { cp1 = cps.at( i ).toElement(); break; @@ -450,12 +450,12 @@ void TestQgsGeoPdfExport::testGroups() for ( const auto &it : qgis::as_const( geoPdfExporter.mVectorComponents ) ) { - if ( it.mapLayerId == QStringLiteral( "layer1" ) ) + if ( it.mapLayerId == QLatin1String( "layer1" ) ) { layer1Path = it.sourceVectorPath; layer1Layer = it.sourceVectorLayer; } - else if ( it.mapLayerId == QStringLiteral( "layer2" ) ) + else if ( it.mapLayerId == QLatin1String( "layer2" ) ) { layer2Path = it.sourceVectorPath; layer2Layer = it.sourceVectorLayer; @@ -472,7 +472,7 @@ void TestQgsGeoPdfExport::testGroups() QDomNodeList ifLayerOnList = doc.elementsByTagName( QStringLiteral( "IfLayerOn" ) ); QCOMPARE( ifLayerOnList.count(), 2 ); - int layer1Idx = ifLayerOnList.at( 0 ).toElement().attribute( QStringLiteral( "layerId" ) ) == QStringLiteral( "layer1" ) ? 0 : 1; + int layer1Idx = ifLayerOnList.at( 0 ).toElement().attribute( QStringLiteral( "layerId" ) ) == QLatin1String( "layer1" ) ? 0 : 1; int layer2Idx = layer1Idx == 0 ? 1 : 0; QCOMPARE( ifLayerOnList.at( layer1Idx ).toElement().attribute( QStringLiteral( "layerId" ) ), QStringLiteral( "layer1" ) ); QCOMPARE( ifLayerOnList.at( layer1Idx ).toElement().elementsByTagName( QStringLiteral( "Vector" ) ).at( 0 ).toElement().attribute( QStringLiteral( "dataset" ) ), layer1Path ); @@ -492,7 +492,7 @@ void TestQgsGeoPdfExport::testGroups() QDomNodeList layerTreeList = doc.elementsByTagName( QStringLiteral( "LayerTree" ) ).at( 0 ).toElement().childNodes(); QCOMPARE( layerTreeList.count(), 2 ); - layer1Idx = layerTreeList.at( 0 ).toElement().attribute( QStringLiteral( "id" ) ) == QStringLiteral( "layer1" ) ? 0 : 1; + layer1Idx = layerTreeList.at( 0 ).toElement().attribute( QStringLiteral( "id" ) ) == QLatin1String( "layer1" ) ? 0 : 1; layer2Idx = layer1Idx == 0 ? 1 : 0; QCOMPARE( layerTreeList.at( layer1Idx ).toElement().attribute( QStringLiteral( "id" ) ), QStringLiteral( "layer1" ) ); QCOMPARE( layerTreeList.at( layer1Idx ).toElement().attribute( QStringLiteral( "name" ) ), QStringLiteral( "name layer1" ) ); @@ -531,12 +531,12 @@ void TestQgsGeoPdfExport::testCustomGroups() for ( const auto &it : qgis::as_const( geoPdfExporter.mVectorComponents ) ) { - if ( it.mapLayerId == QStringLiteral( "layer1" ) ) + if ( it.mapLayerId == QLatin1String( "layer1" ) ) { layer1Path = it.sourceVectorPath; layer1Layer = it.sourceVectorLayer; } - else if ( it.mapLayerId == QStringLiteral( "layer2" ) ) + else if ( it.mapLayerId == QLatin1String( "layer2" ) ) { layer2Path = it.sourceVectorPath; layer2Layer = it.sourceVectorLayer; @@ -557,7 +557,7 @@ void TestQgsGeoPdfExport::testCustomGroups() QDomNodeList layerTreeList = doc.elementsByTagName( QStringLiteral( "LayerTree" ) ).at( 0 ).toElement().childNodes(); QCOMPARE( layerTreeList.count(), 2 ); - int layer1Idx = layerTreeList.at( 0 ).toElement().attribute( QStringLiteral( "name" ) ) == QStringLiteral( "my group" ) ? 0 : 1; + int layer1Idx = layerTreeList.at( 0 ).toElement().attribute( QStringLiteral( "name" ) ) == QLatin1String( "my group" ) ? 0 : 1; int layer2Idx = layer1Idx == 0 ? 1 : 0; QString group1Id = layerTreeList.at( layer1Idx ).toElement().attribute( QStringLiteral( "id" ) ); diff --git a/tests/src/core/testqgsjsonutils.cpp b/tests/src/core/testqgsjsonutils.cpp index ab6fe87f4a18..d704377462af 100644 --- a/tests/src/core/testqgsjsonutils.cpp +++ b/tests/src/core/testqgsjsonutils.cpp @@ -281,7 +281,7 @@ void TestQgsJsonUtils::testExportGeomToJson() { const auto g { QgsGeometry::fromWkt( w.first ) }; QVERIFY( !g.isNull( ) ); - if ( w.first.startsWith( QStringLiteral( "CIRCULARSTRING" ) ) ) + if ( w.first.startsWith( QLatin1String( "CIRCULARSTRING" ) ) ) { QVERIFY( g.asJson( 3 ).startsWith( w.second ) ); QCOMPARE( QString::fromStdString( g.asJsonObject( 3 )["type"].dump() ), QStringLiteral( R"("LineString")" ) ); diff --git a/tests/src/core/testqgslayoutgeopdfexport.cpp b/tests/src/core/testqgslayoutgeopdfexport.cpp index 86343997eb35..1370d21dd784 100644 --- a/tests/src/core/testqgslayoutgeopdfexport.cpp +++ b/tests/src/core/testqgslayoutgeopdfexport.cpp @@ -300,7 +300,7 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() vectorDetail = QgsAbstractGeoPdfExporter::VectorComponentDetail(); for ( const auto &it : geoPdfExporter2.mVectorComponents ) { - if ( it.mapLayerId == linesLayer->id() && it.group == QStringLiteral( "test preset2" ) ) + if ( it.mapLayerId == linesLayer->id() && it.group == QLatin1String( "test preset2" ) ) vectorDetail = it; } @@ -312,7 +312,7 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() vectorDetail = QgsAbstractGeoPdfExporter::VectorComponentDetail(); for ( const auto &it : geoPdfExporter2.mVectorComponents ) { - if ( it.mapLayerId == linesLayer->id() && it.group == QStringLiteral( "test preset" ) ) + if ( it.mapLayerId == linesLayer->id() && it.group == QLatin1String( "test preset" ) ) vectorDetail = it; } @@ -324,7 +324,7 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() vectorDetail = QgsAbstractGeoPdfExporter::VectorComponentDetail(); for ( const auto &it : geoPdfExporter2.mVectorComponents ) { - if ( it.mapLayerId == pointsLayer->id() && it.group == QStringLiteral( "test preset2" ) ) + if ( it.mapLayerId == pointsLayer->id() && it.group == QLatin1String( "test preset2" ) ) vectorDetail = it; } layer2 = qgis::make_unique< QgsVectorLayer >( QStringLiteral( "%1|layername=%2" ).arg( vectorDetail.sourceVectorPath, vectorDetail.sourceVectorLayer ), @@ -344,7 +344,7 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() vectorDetail = QgsAbstractGeoPdfExporter::VectorComponentDetail(); for ( const auto &it : geoPdfExporter2.mVectorComponents ) { - if ( it.mapLayerId == polygonLayer->id() && it.group == QStringLiteral( "test preset3" ) ) + if ( it.mapLayerId == polygonLayer->id() && it.group == QLatin1String( "test preset3" ) ) vectorDetail = it; } layer3 = qgis::make_unique< QgsVectorLayer >( QStringLiteral( "%1|layername=%2" ).arg( vectorDetail.sourceVectorPath, vectorDetail.sourceVectorLayer ), diff --git a/tests/src/core/testqgsmapsettings.cpp b/tests/src/core/testqgsmapsettings.cpp index e08554aceec4..360db306c3a7 100644 --- a/tests/src/core/testqgsmapsettings.cpp +++ b/tests/src/core/testqgsmapsettings.cpp @@ -579,7 +579,7 @@ void TestQgsMapSettings::testCustomRenderingFlags() settings.setCustomRenderingFlag( QStringLiteral( "myexport" ), true ); settings.setCustomRenderingFlag( QStringLiteral( "omitgeometries" ), QStringLiteral( "points" ) ); QVERIFY( settings.customRenderingFlags()[ QStringLiteral( "myexport" ) ].toBool() == true ); - QVERIFY( settings.customRenderingFlags()[ QStringLiteral( "omitgeometries" ) ].toString() == QStringLiteral( "points" ) ); + QVERIFY( settings.customRenderingFlags()[ QStringLiteral( "omitgeometries" ) ].toString() == QLatin1String( "points" ) ); // Test deprecated API Q_NOWARN_DEPRECATED_PUSH diff --git a/tests/src/core/testqgsmeshlayer.cpp b/tests/src/core/testqgsmeshlayer.cpp index a10dcf113087..657dacdb6884 100644 --- a/tests/src/core/testqgsmeshlayer.cpp +++ b/tests/src/core/testqgsmeshlayer.cpp @@ -430,7 +430,7 @@ void TestQgsMeshLayer::test_read_1d_edge_scalar_dataset() QgsMeshDatasetIndex ds( 3, i ); QgsMeshDatasetGroupMetadata meta = dp->datasetGroupMetadata( ds ); - if ( dp->name() == QStringLiteral( "mesh_memory" ) ) + if ( dp->name() == QLatin1String( "mesh_memory" ) ) QCOMPARE( meta.extraOptions()["description"], QString( "Edge Scalar Dataset" ) ); QCOMPARE( meta.name(), QString( "EdgeScalarDataset" ) ); QVERIFY( meta.isScalar() ); @@ -441,7 +441,7 @@ void TestQgsMeshLayer::test_read_1d_edge_scalar_dataset() QVERIFY( dmeta.isValid() ); meta = ly->datasetGroupMetadata( ds ); - if ( dp->name() == QStringLiteral( "mesh_memory" ) ) + if ( dp->name() == QLatin1String( "mesh_memory" ) ) QCOMPARE( meta.extraOptions()["description"], QString( "Edge Scalar Dataset" ) ); QCOMPARE( meta.name(), QString( "EdgeScalarDataset" ) ); QVERIFY( meta.isScalar() ); @@ -484,7 +484,7 @@ void TestQgsMeshLayer::test_read_1d_edge_vector_dataset() QgsMeshDatasetIndex ds( 4, i ); QgsMeshDatasetGroupMetadata meta = dp->datasetGroupMetadata( ds ); - if ( dp->name() == QStringLiteral( "mesh_memory" ) ) + if ( dp->name() == QLatin1String( "mesh_memory" ) ) QCOMPARE( meta.extraOptions()["description"], QString( "Edge Vector Dataset" ) ); QCOMPARE( meta.name(), QString( "EdgeVectorDataset" ) ); QVERIFY( !meta.isScalar() ); @@ -500,7 +500,7 @@ void TestQgsMeshLayer::test_read_1d_edge_vector_dataset() QCOMPARE( QgsMeshDatasetValue( 3 + i, 3 + i ), dp->datasetValue( ds, 2 ) ); meta = ly->datasetGroupMetadata( ds ); - if ( dp->name() == QStringLiteral( "mesh_memory" ) ) + if ( dp->name() == QLatin1String( "mesh_memory" ) ) QCOMPARE( meta.extraOptions()["description"], QString( "Edge Vector Dataset" ) ); QCOMPARE( meta.name(), QString( "EdgeVectorDataset" ) ); QVERIFY( !meta.isScalar() ); @@ -632,7 +632,7 @@ void TestQgsMeshLayer::test_read_vertex_scalar_dataset() QgsMeshDatasetIndex ds( 1, i ); QgsMeshDatasetGroupMetadata meta = dp->datasetGroupMetadata( ds ); - if ( dp->name() == QStringLiteral( "mesh_memory" ) ) + if ( dp->name() == QLatin1String( "mesh_memory" ) ) { QCOMPARE( meta.extraOptions()["description"], QString( "Vertex Scalar Dataset" ) ); QCOMPARE( meta.extraOptions()["meta2"], QString( "best dataset" ) ); @@ -655,7 +655,7 @@ void TestQgsMeshLayer::test_read_vertex_scalar_dataset() QVERIFY( dp->isFaceActive( ds, 0 ) ); meta = ly->datasetGroupMetadata( ds ); - if ( dp->name() == QStringLiteral( "mesh_memory" ) ) + if ( dp->name() == QLatin1String( "mesh_memory" ) ) { QCOMPARE( meta.extraOptions()["description"], QString( "Vertex Scalar Dataset" ) ); QCOMPARE( meta.extraOptions()["meta2"], QString( "best dataset" ) ); @@ -700,7 +700,7 @@ void TestQgsMeshLayer::test_read_vertex_vector_dataset() QgsMeshDatasetIndex ds( 2, i ); QgsMeshDatasetGroupMetadata meta = dp->datasetGroupMetadata( ds ); - if ( dp->name() == QStringLiteral( "mesh_memory" ) ) + if ( dp->name() == QLatin1String( "mesh_memory" ) ) QCOMPARE( meta.extraOptions()["description"], QString( "Vertex Vector Dataset" ) ); QCOMPARE( meta.name(), QString( "VertexVectorDataset" ) ); QVERIFY( !meta.isScalar() ); @@ -720,7 +720,7 @@ void TestQgsMeshLayer::test_read_vertex_vector_dataset() QVERIFY( dp->isFaceActive( ds, 0 ) ); meta = ly->datasetGroupMetadata( ds ); - if ( dp->name() == QStringLiteral( "mesh_memory" ) ) + if ( dp->name() == QLatin1String( "mesh_memory" ) ) QCOMPARE( meta.extraOptions()["description"], QString( "Vertex Vector Dataset" ) ); QCOMPARE( meta.name(), QString( "VertexVectorDataset" ) ); QVERIFY( !meta.isScalar() ); @@ -762,7 +762,7 @@ void TestQgsMeshLayer::test_read_face_scalar_dataset() QgsMeshDatasetIndex ds( 3, i ); QgsMeshDatasetGroupMetadata meta = dp->datasetGroupMetadata( ds ); - if ( dp->name() == QStringLiteral( "mesh_memory" ) ) + if ( dp->name() == QLatin1String( "mesh_memory" ) ) QCOMPARE( meta.extraOptions()["description"], QString( "Face Scalar Dataset" ) ); QCOMPARE( meta.name(), QString( "FaceScalarDataset" ) ); QVERIFY( meta.isScalar() ); @@ -779,7 +779,7 @@ void TestQgsMeshLayer::test_read_face_scalar_dataset() QVERIFY( dp->isFaceActive( ds, 0 ) ); meta = ly->datasetGroupMetadata( ds ); - if ( dp->name() == QStringLiteral( "mesh_memory" ) ) + if ( dp->name() == QLatin1String( "mesh_memory" ) ) QCOMPARE( meta.extraOptions()["description"], QString( "Face Scalar Dataset" ) ); QCOMPARE( meta.name(), QString( "FaceScalarDataset" ) ); QVERIFY( meta.isScalar() ); @@ -819,7 +819,7 @@ void TestQgsMeshLayer::test_read_face_vector_dataset() QgsMeshDatasetIndex ds( 4, i ); QgsMeshDatasetGroupMetadata meta = dp->datasetGroupMetadata( ds ); - if ( dp->name() == QStringLiteral( "mesh_memory" ) ) + if ( dp->name() == QLatin1String( "mesh_memory" ) ) QCOMPARE( meta.extraOptions()["description"], QString( "Face Vector Dataset" ) ); QCOMPARE( meta.name(), QString( "FaceVectorDataset" ) ); QVERIFY( !meta.isScalar() ); @@ -836,7 +836,7 @@ void TestQgsMeshLayer::test_read_face_vector_dataset() QVERIFY( dp->isFaceActive( ds, 0 ) ); meta = ly->datasetGroupMetadata( ds ); - if ( dp->name() == QStringLiteral( "mesh_memory" ) ) + if ( dp->name() == QLatin1String( "mesh_memory" ) ) QCOMPARE( meta.extraOptions()["description"], QString( "Face Vector Dataset" ) ); QCOMPARE( meta.name(), QString( "FaceVectorDataset" ) ); QVERIFY( !meta.isScalar() ); diff --git a/tests/src/core/testqgsnewsfeedparser.cpp b/tests/src/core/testqgsnewsfeedparser.cpp index d5c3d7a0aa1c..b8369ad5368b 100644 --- a/tests/src/core/testqgsnewsfeedparser.cpp +++ b/tests/src/core/testqgsnewsfeedparser.cpp @@ -297,15 +297,15 @@ void TestQgsNewsFeedParser::testModel() loop.exec(); QCOMPARE( model.rowCount(), 5 ); - QVERIFY( model.data( model.index( 0, 0, QModelIndex() ), Qt::DisplayRole ).toString().startsWith( QStringLiteral( "

    Rumors from a whistleblower revealed the next Windows release code nam" ) ) ); - QVERIFY( model.data( model.index( 1, 0, QModelIndex() ), Qt::DisplayRole ).toString().startsWith( QStringLiteral( "

    Tired with C++ intricacies, the core developers h" ) ) ); + QVERIFY( model.data( model.index( 0, 0, QModelIndex() ), Qt::DisplayRole ).toString().startsWith( QLatin1String( "

    Rumors from a whistleblower revealed the next Windows release code nam" ) ) ); + QVERIFY( model.data( model.index( 1, 0, QModelIndex() ), Qt::DisplayRole ).toString().startsWith( QLatin1String( "

    Tired with C++ intricacies, the core developers h" ) ) ); QCOMPARE( model.data( model.index( 2, 0, QModelIndex() ), Qt::DisplayRole ).toString(), QStringLiteral( "

    Ciao from Italy!

    " ) ); - QVERIFY( model.data( model.index( 3, 0, QModelIndex() ), Qt::DisplayRole ).toString().startsWith( QStringLiteral( "

    QGIS is finally part of the ESRI ecosystem, i" ) ) ); + QVERIFY( model.data( model.index( 3, 0, QModelIndex() ), Qt::DisplayRole ).toString().startsWith( QLatin1String( "

    QGIS is finally part of the ESRI ecosystem, i" ) ) ); QCOMPARE( model.data( model.index( 4, 0, QModelIndex() ), Qt::DisplayRole ).toString(), QStringLiteral( "

    Let's dive in the ocean together!

    " ) ); - QVERIFY( model.data( model.index( 0, 0, QModelIndex() ), QgsNewsFeedModel::Content ).toString().startsWith( QStringLiteral( "

    Rumors from a whistleblower revealed the next Windows release code nam" ) ) ); - QVERIFY( model.data( model.index( 1, 0, QModelIndex() ), QgsNewsFeedModel::Content ).toString().startsWith( QStringLiteral( "

    Tired with C++ intricacies, the core developers h" ) ) ); + QVERIFY( model.data( model.index( 0, 0, QModelIndex() ), QgsNewsFeedModel::Content ).toString().startsWith( QLatin1String( "

    Rumors from a whistleblower revealed the next Windows release code nam" ) ) ); + QVERIFY( model.data( model.index( 1, 0, QModelIndex() ), QgsNewsFeedModel::Content ).toString().startsWith( QLatin1String( "

    Tired with C++ intricacies, the core developers h" ) ) ); QCOMPARE( model.data( model.index( 2, 0, QModelIndex() ), QgsNewsFeedModel::Content ).toString(), QStringLiteral( "

    Ciao from Italy!

    " ) ); - QVERIFY( model.data( model.index( 3, 0, QModelIndex() ), QgsNewsFeedModel::Content ).toString().startsWith( QStringLiteral( "

    QGIS is finally part of the ESRI ecosystem, i" ) ) ); + QVERIFY( model.data( model.index( 3, 0, QModelIndex() ), QgsNewsFeedModel::Content ).toString().startsWith( QLatin1String( "

    QGIS is finally part of the ESRI ecosystem, i" ) ) ); QCOMPARE( model.data( model.index( 4, 0, QModelIndex() ), QgsNewsFeedModel::Content ).toString(), QStringLiteral( "

    Let's dive in the ocean together!

    " ) ); QCOMPARE( model.data( model.index( 0, 0, QModelIndex() ), Qt::ToolTipRole ).toString(), QStringLiteral( "Next Microsoft Windows code name revealed" ) ); QCOMPARE( model.data( model.index( 1, 0, QModelIndex() ), Qt::ToolTipRole ).toString(), QStringLiteral( "QGIS core will be rewritten in Rust" ) ); diff --git a/tests/src/core/testqgsofflineediting.cpp b/tests/src/core/testqgsofflineediting.cpp index 1ce7a4273072..e03c07984064 100644 --- a/tests/src/core/testqgsofflineediting.cpp +++ b/tests/src/core/testqgsofflineediting.cpp @@ -240,7 +240,7 @@ void TestQgsOfflineEditing::removeConstraintsOnDefaultValues() QString name = gpkgLayer->name(); //check constraints (not null and unique) - QgsFieldConstraints constraintsOfFidField = gpkgLayer->fields().at( gpkgLayer->fields().indexOf( QStringLiteral( "fid" ) ) ).constraints(); + QgsFieldConstraints constraintsOfFidField = gpkgLayer->fields().at( gpkgLayer->fields().indexOf( QLatin1String( "fid" ) ) ).constraints(); QVERIFY( constraintsOfFidField.constraints() & QgsFieldConstraints::ConstraintNotNull ); QVERIFY( constraintsOfFidField.constraints() & QgsFieldConstraints::ConstraintUnique ); @@ -252,7 +252,7 @@ void TestQgsOfflineEditing::removeConstraintsOnDefaultValues() name = gpkgLayer->name(); //check constraints (unique but not not null) - constraintsOfFidField = gpkgLayer->fields().at( gpkgLayer->fields().indexOf( QStringLiteral( "fid" ) ) ).constraints(); + constraintsOfFidField = gpkgLayer->fields().at( gpkgLayer->fields().indexOf( QLatin1String( "fid" ) ) ).constraints(); QVERIFY( !( constraintsOfFidField.constraints() & QgsFieldConstraints::ConstraintNotNull ) ); QVERIFY( constraintsOfFidField.constraints() & QgsFieldConstraints::ConstraintUnique ); @@ -263,7 +263,7 @@ void TestQgsOfflineEditing::removeConstraintsOnDefaultValues() name = gpkgLayer->name(); //check constraints (not null and unique) - constraintsOfFidField = gpkgLayer->fields().at( gpkgLayer->fields().indexOf( QStringLiteral( "fid" ) ) ).constraints(); + constraintsOfFidField = gpkgLayer->fields().at( gpkgLayer->fields().indexOf( QLatin1String( "fid" ) ) ).constraints(); QVERIFY( constraintsOfFidField.constraints() & QgsFieldConstraints::ConstraintNotNull ); QVERIFY( constraintsOfFidField.constraints() & QgsFieldConstraints::ConstraintUnique ); } diff --git a/tests/src/core/testqgsogrutils.cpp b/tests/src/core/testqgsogrutils.cpp index 3841659c4bd0..20d5f12a525b 100644 --- a/tests/src/core/testqgsogrutils.cpp +++ b/tests/src/core/testqgsogrutils.cpp @@ -205,7 +205,7 @@ void TestQgsOgrUtils::ogrGeometryToQgsGeometry2() QCOMPARE( static_cast< int >( geom.wkbType() ), type ); // bit of trickiness here - QGIS wkt conversion changes 25D -> Z, so account for that - wkt.replace( QStringLiteral( "25D" ), QStringLiteral( "Z" ) ); + wkt.replace( QLatin1String( "25D" ), QLatin1String( "Z" ) ); QCOMPARE( geom.asWkt( 3 ), wkt ); } diff --git a/tests/src/core/testqgsrastersublayer.cpp b/tests/src/core/testqgsrastersublayer.cpp index 2dd80f702c8d..0bddbbec9979 100644 --- a/tests/src/core/testqgsrastersublayer.cpp +++ b/tests/src/core/testqgsrastersublayer.cpp @@ -140,9 +140,9 @@ void TestQgsRasterSubLayer::subLayersList() qDebug() << "sublayer: " << s; sublayers << s.split( ':' ).last(); } - qDebug() << "sublayers: " << sublayers.join( QStringLiteral( "," ) ); - mReport += QStringLiteral( "sublayers:
    %1
    \n" ).arg( sublayers.join( QStringLiteral( "
    " ) ) ); - mReport += QStringLiteral( "expected:
    %1
    \n" ).arg( expected.join( QStringLiteral( "
    " ) ) ); + qDebug() << "sublayers: " << sublayers.join( QLatin1Char( ',' ) ); + mReport += QStringLiteral( "sublayers:
    %1
    \n" ).arg( sublayers.join( QLatin1String( "
    " ) ) ); + mReport += QStringLiteral( "expected:
    %1
    \n" ).arg( expected.join( QLatin1String( "
    " ) ) ); QCOMPARE( sublayers, expected ); mReport += QLatin1String( "

    Passed

    " ); } diff --git a/tests/src/core/testqgssqliteexpressioncompiler.cpp b/tests/src/core/testqgssqliteexpressioncompiler.cpp index 65de5a2d86a1..031ce6b1be1a 100644 --- a/tests/src/core/testqgssqliteexpressioncompiler.cpp +++ b/tests/src/core/testqgssqliteexpressioncompiler.cpp @@ -56,7 +56,7 @@ QgsExpression TestQgsSQLiteExpressionCompiler::makeExpression( const int length { expString.append( QStringLiteral( "(\"Z\" >= %1) AND (\"Bottom\" <= %2)" ).arg( i ).arg( i + 1 ) ); } - QgsExpression exp( expString.join( QStringLiteral( ") OR (" ) ).prepend( '(' ).append( ')' ) ); + QgsExpression exp( expString.join( QLatin1String( ") OR (" ) ).prepend( '(' ).append( ')' ) ); return exp; } diff --git a/tests/src/core/testqgsvectorfilewriter.cpp b/tests/src/core/testqgsvectorfilewriter.cpp index d4a4216bd399..1561652135e3 100644 --- a/tests/src/core/testqgsvectorfilewriter.cpp +++ b/tests/src/core/testqgsvectorfilewriter.cpp @@ -546,11 +546,11 @@ void TestQgsVectorFileWriter::_testExportToGpx( const QString &geomTypeName, QString memLayerDef( geomTypeName ); if ( inputLayerName == QLatin1String( "track_points" ) ) { - memLayerDef += QStringLiteral( "?field=track_fid:int&field=track_seg_id:int" ); + memLayerDef += QLatin1String( "?field=track_fid:int&field=track_seg_id:int" ); } else if ( inputLayerName == QLatin1String( "route_points" ) ) { - memLayerDef += QStringLiteral( "?field=route_fid:int" ); + memLayerDef += QLatin1String( "?field=route_fid:int" ); } QgsVectorLayer vl( memLayerDef, "test", "memory" ); QgsFeature f { vl.fields() }; diff --git a/tests/src/gui/testqgsdatumtransformdialog.cpp b/tests/src/gui/testqgsdatumtransformdialog.cpp index 19ae3b23c359..49a31bc7bd19 100644 --- a/tests/src/gui/testqgsdatumtransformdialog.cpp +++ b/tests/src/gui/testqgsdatumtransformdialog.cpp @@ -87,7 +87,7 @@ void TestQgsDatumTransformDialog::defaultTransform() def = dlg2.defaultDatumTransform(); QCOMPARE( def.sourceCrs.authid(), QStringLiteral( "EPSG:4326" ) ); QCOMPARE( def.destinationCrs.authid(), QStringLiteral( "EPSG:26742" ) ); - if ( def.proj == QStringLiteral( "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +inv +proj=hgridshift +grids=conus +step +proj=lcc +lat_0=37.6666666666667 +lon_0=-122 +lat_1=39.8333333333333 +lat_2=38.3333333333333 +x_0=609601.219202438 +y_0=0 +ellps=clrk66 +step +proj=unitconvert +xy_in=m +xy_out=us-ft" ) ) + if ( def.proj == QLatin1String( "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +inv +proj=hgridshift +grids=conus +step +proj=lcc +lat_0=37.6666666666667 +lon_0=-122 +lat_1=39.8333333333333 +lat_2=38.3333333333333 +x_0=609601.219202438 +y_0=0 +ellps=clrk66 +step +proj=unitconvert +xy_in=m +xy_out=us-ft" ) ) { QCOMPARE( def.proj, QStringLiteral( "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +inv +proj=hgridshift +grids=conus +step +proj=lcc +lat_0=37.6666666666667 +lon_0=-122 +lat_1=39.8333333333333 +lat_2=38.3333333333333 +x_0=609601.219202438 +y_0=0 +ellps=clrk66 +step +proj=unitconvert +xy_in=m +xy_out=us-ft" ) ); } diff --git a/tests/src/gui/testqgsfiledownloader.cpp b/tests/src/gui/testqgsfiledownloader.cpp index 71861c52fde7..196f10b1749f 100644 --- a/tests/src/gui/testqgsfiledownloader.cpp +++ b/tests/src/gui/testqgsfiledownloader.cpp @@ -52,7 +52,7 @@ class TestQgsFileDownloader: public QObject { mError = true; errorMessages.sort(); - mErrorMessage = errorMessages.join( QStringLiteral( ";" ) ); + mErrorMessage = errorMessages.join( QLatin1Char( ';' ) ); } //! Called when data ready to be processed void downloadProgress( qint64 bytesReceived, qint64 bytesTotal ) diff --git a/tests/src/gui/testqgsogrprovidergui.cpp b/tests/src/gui/testqgsogrprovidergui.cpp index 8fffd12a2b52..8352dfc5a1cd 100644 --- a/tests/src/gui/testqgsogrprovidergui.cpp +++ b/tests/src/gui/testqgsogrprovidergui.cpp @@ -62,9 +62,9 @@ void TestQgsOgrProviderGui::providersRegistered() bool hasGpkgProvider = false; for ( QgsDataItemGuiProvider *provider : providers ) { - if ( provider->name() == QStringLiteral( "ogr_items" ) ) + if ( provider->name() == QLatin1String( "ogr_items" ) ) hasOgrProvider = true; - if ( provider->name() == QStringLiteral( "geopackage_items" ) ) + if ( provider->name() == QLatin1String( "geopackage_items" ) ) hasGpkgProvider = true; } QVERIFY( hasOgrProvider ); @@ -93,7 +93,7 @@ void TestQgsOgrProviderGui::testGpkgDataItemRename() QgsDataItem *itemLayer1 = nullptr; for ( QgsDataItem *item : items ) { - if ( item->name() == QStringLiteral( "layer 1" ) ) + if ( item->name() == QLatin1String( "layer 1" ) ) itemLayer1 = item; } QVERIFY( itemLayer1 ); diff --git a/tests/src/gui/testqgstexteditwrapper.cpp b/tests/src/gui/testqgstexteditwrapper.cpp index e726a561a600..cc7645e806d0 100644 --- a/tests/src/gui/testqgstexteditwrapper.cpp +++ b/tests/src/gui/testqgstexteditwrapper.cpp @@ -84,7 +84,7 @@ void TestQgsTextEditWrapper::testWithJsonInPostgres() QgsProject::instance()->addMapLayer( vl_json, false, false ); QCOMPARE( vl_json->fields().at( 1 ).type(), QVariant::Map ); - QgsTextEditWrapper w_json( vl_json, vl_json->fields().indexOf( QStringLiteral( "jvalue" ) ), nullptr, nullptr ); + QgsTextEditWrapper w_json( vl_json, vl_json->fields().indexOf( QLatin1String( "jvalue" ) ), nullptr, nullptr ); QLineEdit *widget = qobject_cast< QLineEdit * >( w_json.widget() ); w_json.setEnabled( true ); @@ -188,7 +188,7 @@ void TestQgsTextEditWrapper::testWithJsonBInPostgres() QgsProject::instance()->addMapLayer( vl_json, false, false ); QCOMPARE( vl_json->fields().at( 1 ).type(), QVariant::Map ); - QgsTextEditWrapper w_json( vl_json, vl_json->fields().indexOf( QStringLiteral( "jbvalue" ) ), nullptr, nullptr ); + QgsTextEditWrapper w_json( vl_json, vl_json->fields().indexOf( QLatin1String( "jbvalue" ) ), nullptr, nullptr ); QLineEdit *widget = qobject_cast< QLineEdit * >( w_json.widget() ); w_json.setEnabled( true ); diff --git a/tests/src/gui/testqgsvaluerelationwidgetwrapper.cpp b/tests/src/gui/testqgsvaluerelationwidgetwrapper.cpp index e428fc1705de..a5739c593b6a 100644 --- a/tests/src/gui/testqgsvaluerelationwidgetwrapper.cpp +++ b/tests/src/gui/testqgsvaluerelationwidgetwrapper.cpp @@ -161,7 +161,7 @@ void TestQgsValueRelationWidgetWrapper::testDrillDown() QVERIFY( vl2.dataProvider()->addFeature( f3 ) ); // build a value relation widget wrapper for municipality - QgsValueRelationWidgetWrapper w_municipality( &vl2, vl2.fields().indexOf( QStringLiteral( "fk_municipality" ) ), nullptr, nullptr ); + QgsValueRelationWidgetWrapper w_municipality( &vl2, vl2.fields().indexOf( QLatin1String( "fk_municipality" ) ), nullptr, nullptr ); QVariantMap cfg_municipality; cfg_municipality.insert( QStringLiteral( "Layer" ), vl1.id() ); cfg_municipality.insert( QStringLiteral( "Key" ), QStringLiteral( "pk" ) ); @@ -270,7 +270,7 @@ void TestQgsValueRelationWidgetWrapper::testDrillDownMulti() QVERIFY( vl2.dataProvider()->addFeature( f3 ) ); // build a value relation widget wrapper for municipality - QgsValueRelationWidgetWrapper w_municipality( &vl2, vl2.fields().indexOf( QStringLiteral( "fk_municipality" ) ), nullptr, nullptr ); + QgsValueRelationWidgetWrapper w_municipality( &vl2, vl2.fields().indexOf( QLatin1String( "fk_municipality" ) ), nullptr, nullptr ); QVariantMap cfg_municipality; cfg_municipality.insert( QStringLiteral( "Layer" ), vl1.id() ); cfg_municipality.insert( QStringLiteral( "Key" ), QStringLiteral( "pk" ) ); @@ -374,7 +374,7 @@ void TestQgsValueRelationWidgetWrapper::testZeroIndexInRelatedTable() QVERIFY( vl2.dataProvider()->addFeature( f3 ) ); // build a value relation widget wrapper for municipality - QgsValueRelationWidgetWrapper w_municipality( &vl2, vl2.fields().indexOf( QStringLiteral( "fk_municipality" ) ), nullptr, nullptr ); + QgsValueRelationWidgetWrapper w_municipality( &vl2, vl2.fields().indexOf( QLatin1String( "fk_municipality" ) ), nullptr, nullptr ); QVariantMap cfg_municipality; cfg_municipality.insert( QStringLiteral( "Layer" ), vl1.id() ); cfg_municipality.insert( QStringLiteral( "Key" ), QStringLiteral( "pk" ) ); @@ -415,7 +415,7 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInPostgres() QCOMPARE( vl_json->fields().at( 1 ).type(), QVariant::Map ); // build a value relation widget wrapper for json field - QgsValueRelationWidgetWrapper w_favoriteauthors( vl_json, vl_json->fields().indexOf( QStringLiteral( "jvalue" ) ), nullptr, nullptr ); + QgsValueRelationWidgetWrapper w_favoriteauthors( vl_json, vl_json->fields().indexOf( QLatin1String( "jvalue" ) ), nullptr, nullptr ); QVariantMap cfg_favoriteauthors; cfg_favoriteauthors.insert( QStringLiteral( "Layer" ), vl_authors->id() ); cfg_favoriteauthors.insert( QStringLiteral( "Key" ), QStringLiteral( "pk" ) ); @@ -460,7 +460,7 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInPostgres() QCOMPARE( w_favoriteauthors.mTableWidget->item( 5, 0 )->checkState(), Qt::Unchecked ); // build a value relation widget wrapper for jsonb field - QgsValueRelationWidgetWrapper w_favoriteauthors_b( vl_json, vl_json->fields().indexOf( QStringLiteral( "jbvalue" ) ), nullptr, nullptr ); + QgsValueRelationWidgetWrapper w_favoriteauthors_b( vl_json, vl_json->fields().indexOf( QLatin1String( "jbvalue" ) ), nullptr, nullptr ); QVariantMap cfg_favoriteauthors_b; cfg_favoriteauthors_b.insert( QStringLiteral( "Layer" ), vl_authors->id() ); cfg_favoriteauthors_b.insert( QStringLiteral( "Key" ), QStringLiteral( "pk" ) ); @@ -528,7 +528,7 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInGPKG() vl_json->startEditing(); // build a value relation widget wrapper for authors - QgsValueRelationWidgetWrapper w_favoriteauthors( vl_json, vl_json->fields().indexOf( QStringLiteral( "json_content" ) ), nullptr, nullptr ); + QgsValueRelationWidgetWrapper w_favoriteauthors( vl_json, vl_json->fields().indexOf( QLatin1String( "json_content" ) ), nullptr, nullptr ); QVariantMap cfg_favoriteauthors; cfg_favoriteauthors.insert( QStringLiteral( "Layer" ), vl_authors->id() ); cfg_favoriteauthors.insert( QStringLiteral( "Key" ), QStringLiteral( "fid" ) ); @@ -656,7 +656,7 @@ void TestQgsValueRelationWidgetWrapper::testWithTextInGPKG() vl_text->startEditing(); // build a value relation widget wrapper for authors - QgsValueRelationWidgetWrapper w_favoriteauthors( vl_text, vl_text->fields().indexOf( QStringLiteral( "PRFEDEA" ) ), nullptr, nullptr ); + QgsValueRelationWidgetWrapper w_favoriteauthors( vl_text, vl_text->fields().indexOf( QLatin1String( "PRFEDEA" ) ), nullptr, nullptr ); QVariantMap cfg_favoriteauthors; cfg_favoriteauthors.insert( QStringLiteral( "Layer" ), vl_authors->id() ); cfg_favoriteauthors.insert( QStringLiteral( "Key" ), QStringLiteral( "fid" ) ); @@ -787,7 +787,7 @@ void TestQgsValueRelationWidgetWrapper::testWithTextInGPKG() vl_text_reread->startEditing(); // build a value relation widget wrapper for authors - QgsValueRelationWidgetWrapper w_favoriteauthors_reread( vl_text_reread, vl_text->fields().indexOf( QStringLiteral( "PRFEDEA" ) ), nullptr, nullptr ); + QgsValueRelationWidgetWrapper w_favoriteauthors_reread( vl_text_reread, vl_text->fields().indexOf( QLatin1String( "PRFEDEA" ) ), nullptr, nullptr ); w_favoriteauthors_reread.setConfig( cfg_favoriteauthors ); w_favoriteauthors_reread.widget(); w_favoriteauthors_reread.setEnabled( true ); @@ -828,7 +828,7 @@ void TestQgsValueRelationWidgetWrapper::testWithTextInGPKGTextFk() vl_text->startEditing(); // build a value relation widget wrapper for authors - QgsValueRelationWidgetWrapper w_favoriteauthors( vl_text, vl_text->fields().indexOf( QStringLiteral( "PRFEDEA" ) ), nullptr, nullptr ); + QgsValueRelationWidgetWrapper w_favoriteauthors( vl_text, vl_text->fields().indexOf( QLatin1String( "PRFEDEA" ) ), nullptr, nullptr ); QVariantMap cfg_favoriteauthors; cfg_favoriteauthors.insert( QStringLiteral( "Layer" ), vl_authors->id() ); cfg_favoriteauthors.insert( QStringLiteral( "Key" ), QStringLiteral( "NAME" ) ); @@ -958,7 +958,7 @@ void TestQgsValueRelationWidgetWrapper::testWithTextInGPKGTextFk() vl_text_reread->startEditing(); // build a value relation widget wrapper for authors - QgsValueRelationWidgetWrapper w_favoriteauthors_reread( vl_text_reread, vl_text_reread->fields().indexOf( QStringLiteral( "PRFEDEA" ) ), nullptr, nullptr ); + QgsValueRelationWidgetWrapper w_favoriteauthors_reread( vl_text_reread, vl_text_reread->fields().indexOf( QLatin1String( "PRFEDEA" ) ), nullptr, nullptr ); w_favoriteauthors_reread.setConfig( cfg_favoriteauthors ); w_favoriteauthors_reread.widget(); w_favoriteauthors_reread.setEnabled( true ); @@ -1015,7 +1015,7 @@ void TestQgsValueRelationWidgetWrapper::testWithTextInGPKGTextFk() vl_text_reread2->startEditing(); // build a value relation widget wrapper for authors - QgsValueRelationWidgetWrapper w_favoriteauthors_reread2( vl_text_reread2, vl_text_reread2->fields().indexOf( QStringLiteral( "PRFEDEA" ) ), nullptr, nullptr ); + QgsValueRelationWidgetWrapper w_favoriteauthors_reread2( vl_text_reread2, vl_text_reread2->fields().indexOf( QLatin1String( "PRFEDEA" ) ), nullptr, nullptr ); w_favoriteauthors_reread2.setConfig( cfg_favoriteauthors ); w_favoriteauthors_reread2.widget(); w_favoriteauthors_reread2.setEnabled( true ); @@ -1055,7 +1055,7 @@ void TestQgsValueRelationWidgetWrapper::testWithTextInGPKGWeirdTextFk() myTempFileName ); QFileInfo myMapFileInfoAuthor( myTempFileName ); QgsVectorLayer *vl_authors = new QgsVectorLayer( QStringLiteral( R"(dbname='%1' table="%2")" ) - .arg( myMapFileInfoAuthor.filePath() ).arg( QStringLiteral( "authors" ) ), + .arg( myMapFileInfoAuthor.filePath() ).arg( QLatin1String( "authors" ) ), QStringLiteral( "test" ), QStringLiteral( "spatialite" ) ); QVERIFY( vl_authors->isValid() ); @@ -1065,7 +1065,7 @@ void TestQgsValueRelationWidgetWrapper::testWithTextInGPKGWeirdTextFk() vl_text->startEditing(); // build a value relation widget wrapper for authors - QgsValueRelationWidgetWrapper w_favoriteauthors( vl_text, vl_text->fields().indexOf( QStringLiteral( "PRFEDEA" ) ), nullptr, nullptr ); + QgsValueRelationWidgetWrapper w_favoriteauthors( vl_text, vl_text->fields().indexOf( QLatin1String( "PRFEDEA" ) ), nullptr, nullptr ); QVariantMap cfg_favoriteauthors; cfg_favoriteauthors.insert( QStringLiteral( "Layer" ), vl_authors->id() ); cfg_favoriteauthors.insert( QStringLiteral( "Key" ), QStringLiteral( "pk_text" ) ); @@ -1194,7 +1194,7 @@ void TestQgsValueRelationWidgetWrapper::testWithTextInGPKGWeirdTextFk() vl_text_reread->startEditing(); // build a value relation widget wrapper for authors - QgsValueRelationWidgetWrapper w_favoriteauthors_reread( vl_text_reread, vl_text_reread->fields().indexOf( QStringLiteral( "PRFEDEA" ) ), nullptr, nullptr ); + QgsValueRelationWidgetWrapper w_favoriteauthors_reread( vl_text_reread, vl_text_reread->fields().indexOf( QLatin1String( "PRFEDEA" ) ), nullptr, nullptr ); w_favoriteauthors_reread.setConfig( cfg_favoriteauthors ); w_favoriteauthors_reread.widget(); w_favoriteauthors_reread.setEnabled( true ); @@ -1230,11 +1230,11 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInSpatialite() myTempFileName ); QFileInfo myMapFileInfo( myTempFileName ); QgsVectorLayer *vl_json = new QgsVectorLayer( QStringLiteral( R"(dbname='%1' table="%2")" ) - .arg( myMapFileInfo.filePath() ).arg( QStringLiteral( "json" ) ), + .arg( myMapFileInfo.filePath() ).arg( QLatin1String( "json" ) ), QStringLiteral( "test" ), QStringLiteral( "spatialite" ) ); QgsVectorLayer *vl_authors = new QgsVectorLayer( QStringLiteral( R"(dbname='%1' table="%2")" ) - .arg( myMapFileInfo.filePath() ).arg( QStringLiteral( "authors" ) ), + .arg( myMapFileInfo.filePath() ).arg( QLatin1String( "authors" ) ), QStringLiteral( "test" ), QStringLiteral( "spatialite" ) ); const auto fk_field_idx { vl_json->fields().indexOf( fk_field ) }; @@ -1373,11 +1373,11 @@ void TestQgsValueRelationWidgetWrapper::testWithJsonInSpatialiteTextFk() myTempFileName ); QFileInfo myMapFileInfo( myTempFileName ); QgsVectorLayer *vl_json = new QgsVectorLayer( QStringLiteral( R"(dbname='%1' table="%2")" ) - .arg( myMapFileInfo.filePath() ).arg( QStringLiteral( "json" ) ), + .arg( myMapFileInfo.filePath() ).arg( QLatin1String( "json" ) ), QStringLiteral( "test" ), QStringLiteral( "spatialite" ) ); QgsVectorLayer *vl_authors = new QgsVectorLayer( QStringLiteral( R"(dbname='%1' table="%2")" ) - .arg( myMapFileInfo.filePath() ).arg( QStringLiteral( "authors" ) ), + .arg( myMapFileInfo.filePath() ).arg( QLatin1String( "authors" ) ), QStringLiteral( "test" ), QStringLiteral( "spatialite" ) ); const auto fk_field_idx { vl_json->fields().indexOf( fk_field ) }; @@ -1554,7 +1554,7 @@ void TestQgsValueRelationWidgetWrapper::testMatchLayerName() QVERIFY( vl2.dataProvider()->addFeature( f3 ) ); // build a value relation widget wrapper for municipality - QgsValueRelationWidgetWrapper w_municipality( &vl2, vl2.fields().indexOf( QStringLiteral( "fk_municipality" ) ), nullptr, nullptr ); + QgsValueRelationWidgetWrapper w_municipality( &vl2, vl2.fields().indexOf( QLatin1String( "fk_municipality" ) ), nullptr, nullptr ); QVariantMap cfg_municipality; cfg_municipality.insert( QStringLiteral( "Layer" ), QStringLiteral( "wrong_id_here_hope_name_is_good" ) ); cfg_municipality.insert( QStringLiteral( "LayerName" ), vl1.name() ); diff --git a/tests/src/providers/grass/testqgsgrassprovider.cpp b/tests/src/providers/grass/testqgsgrassprovider.cpp index 1a0106c79d13..29ed1c53d694 100644 --- a/tests/src/providers/grass/testqgsgrassprovider.cpp +++ b/tests/src/providers/grass/testqgsgrassprovider.cpp @@ -371,8 +371,8 @@ void TestQgsGrassProvider::locations() QStringList expectedLocations; expectedLocations << QStringLiteral( "wgs84" ); QStringList locations = QgsGrass::locations( mGisdbase ); - reportRow( "expectedLocations: " + expectedLocations.join( QStringLiteral( ", " ) ) ); - reportRow( "locations: " + locations.join( QStringLiteral( ", " ) ) ); + reportRow( "expectedLocations: " + expectedLocations.join( QLatin1String( ", " ) ) ); + reportRow( "locations: " + locations.join( QLatin1String( ", " ) ) ); compare( expectedLocations, locations, ok ); GVERIFY( ok ); } @@ -395,8 +395,8 @@ void TestQgsGrassProvider::mapsets() QStringList expectedMapsets; expectedMapsets << QStringLiteral( "PERMANENT" ) << QStringLiteral( "test" ) << QStringLiteral( "test6" ) << QStringLiteral( "test7" ); QStringList mapsets = QgsGrass::mapsets( tmpGisdbase, mLocation ); - reportRow( "expectedMapsets: " + expectedMapsets.join( QStringLiteral( ", " ) ) ); - reportRow( "mapsets: " + mapsets.join( QStringLiteral( ", " ) ) ); + reportRow( "expectedMapsets: " + expectedMapsets.join( QLatin1String( ", " ) ) ); + reportRow( "mapsets: " + mapsets.join( QLatin1String( ", " ) ) ); compare( expectedMapsets, mapsets, ok ); QgsGrass::setLocation( tmpGisdbase, mLocation ); // for G_is_mapset_in_search_path // Disabled because adding of all mapsets to search path was disabled in setLocation() @@ -461,16 +461,16 @@ void TestQgsGrassProvider::maps() QStringList expectedVectors; expectedVectors << QStringLiteral( "test" ); QStringList vectors = QgsGrass::vectors( mGisdbase, mLocation, mBuildMapset ); - reportRow( "expectedVectors: " + expectedVectors.join( QStringLiteral( ", " ) ) ); - reportRow( "vectors: " + vectors.join( QStringLiteral( ", " ) ) ); + reportRow( "expectedVectors: " + expectedVectors.join( QLatin1String( ", " ) ) ); + reportRow( "vectors: " + vectors.join( QLatin1String( ", " ) ) ); compare( expectedVectors, vectors, ok ); reportRow( QLatin1String( "" ) ); QStringList expectedRasters; expectedRasters << QStringLiteral( "cell" ) << QStringLiteral( "dcell" ) << QStringLiteral( "fcell" ); QStringList rasters = QgsGrass::rasters( mGisdbase, mLocation, QStringLiteral( "test" ) ); - reportRow( "expectedRasters: " + expectedRasters.join( QStringLiteral( ", " ) ) ); - reportRow( "rasters: " + rasters.join( QStringLiteral( ", " ) ) ); + reportRow( "expectedRasters: " + expectedRasters.join( QLatin1String( ", " ) ) ); + reportRow( "rasters: " + rasters.join( QLatin1String( ", " ) ) ); compare( expectedRasters, rasters, ok ); GVERIFY( ok ); } @@ -485,13 +485,13 @@ void TestQgsGrassProvider::vectorLayers() reportRow( "mapset: " + mapset ); reportRow( "mapName: " + mapName ); - reportRow( "expectedLayers: " + expectedLayers.join( QStringLiteral( ", " ) ) ); + reportRow( "expectedLayers: " + expectedLayers.join( QLatin1String( ", " ) ) ); bool ok = true; G_TRY { QStringList layers = QgsGrass::vectorLayers( mGisdbase, mLocation, mapset, mapName ); - reportRow( "layers: " + layers.join( QStringLiteral( ", " ) ) ); + reportRow( "layers: " + layers.join( QLatin1String( ", " ) ) ); compare( expectedLayers, layers, ok ); } G_CATCH( QgsGrass::Exception & e ) @@ -897,7 +897,7 @@ void TestQgsGrassProvider::vectorImport() delete import; QStringList layers = QgsGrass::vectorLayers( tmpGisdbase, tmpLocation, tmpMapset, name ); - reportRow( "created layers: " + layers.join( QStringLiteral( "," ) ) ); + reportRow( "created layers: " + layers.join( QLatin1Char( ',' ) ) ); } removeRecursively( tmpGisdbase ); GVERIFY( ok ); @@ -1518,7 +1518,7 @@ bool TestQgsGrassProvider::equal( QgsFeature feature, QgsFeature expectedFeature { names << feature.fields().at( j ).name(); } - reportRow( QStringLiteral( "Attribute %1 not found, feature attributes: %2" ).arg( name, names.join( QStringLiteral( "," ) ) ) ); + reportRow( QStringLiteral( "Attribute %1 not found, feature attributes: %2" ).arg( name, names.join( QLatin1Char( ',' ) ) ) ); return false; } indexes.remove( index ); @@ -1537,7 +1537,7 @@ bool TestQgsGrassProvider::equal( QgsFeature feature, QgsFeature expectedFeature { names << feature.fields().at( i ).name(); } - reportRow( QStringLiteral( "feature has %1 unexpected attributes: %2" ).arg( indexes.size() ).arg( names.join( QStringLiteral( "," ) ) ) ); + reportRow( QStringLiteral( "feature has %1 unexpected attributes: %2" ).arg( indexes.size() ).arg( names.join( QLatin1Char( ',' ) ) ) ); return false; } return true; diff --git a/tests/src/providers/testqgswcspublicservers.cpp b/tests/src/providers/testqgswcspublicservers.cpp index 77d1659a7290..fab8805e9a17 100644 --- a/tests/src/providers/testqgswcspublicservers.cpp +++ b/tests/src/providers/testqgswcspublicservers.cpp @@ -514,7 +514,7 @@ void TestQgsWcsPublicServers::test() Q_ASSERT( myLogFile.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) ); QTextStream myStream( &myLogFile ); - myStream << myLog.join( QStringLiteral( "\n" ) ); + myStream << myLog.join( QLatin1Char( '\n' ) ); myLogFile.close(); QgsProject::instance()->removeAllMapLayers(); @@ -526,13 +526,13 @@ void TestQgsWcsPublicServers::test() QFile myVersionLogFile( myVersionLogPath ); Q_ASSERT( myVersionLogFile.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) ); QTextStream myVersionStream( &myVersionLogFile ); - myVersionStream << myVersionLog.join( QStringLiteral( "\n" ) ); + myVersionStream << myVersionLog.join( QLatin1Char( '\n' ) ); myVersionLogFile.close(); } QFile myServerLogFile( myServerLogPath ); Q_ASSERT( myServerLogFile.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) ); QTextStream myServerStream( &myServerLogFile ); - myServerStream << myServerLog.join( QStringLiteral( "\n" ) ); + myServerStream << myServerLog.join( QLatin1Char( '\n' ) ); myServerLogFile.close(); } } @@ -638,7 +638,7 @@ void TestQgsWcsPublicServers::report() myValues.clear(); QStringList issues = issueDescriptions( myServerLog.value( QStringLiteral( "server" ) ), myLog.value( QStringLiteral( "identifier" ) ), myLog.value( QStringLiteral( "version" ) ) ); - QString issuesString = issues.join( QStringLiteral( "
    " ) ); + QString issuesString = issues.join( QLatin1String( "
    " ) ); QStringList providers; providers << QStringLiteral( "wcs" ) << QStringLiteral( "gdal" ); diff --git a/tests/src/quickgui/testqgsquickutils.cpp b/tests/src/quickgui/testqgsquickutils.cpp index 040662de52a8..55e3570f736f 100644 --- a/tests/src/quickgui/testqgsquickutils.cpp +++ b/tests/src/quickgui/testqgsquickutils.cpp @@ -143,11 +143,11 @@ void TestQgsQuickUtils::formatDistance() void TestQgsQuickUtils::loadIcon() { QUrl url = utils.getThemeIcon( "ic_save_white" ); - Q_ASSERT( url.toString() == QStringLiteral( "qrc:/ic_save_white.svg" ) ); + Q_ASSERT( url.toString() == QLatin1String( "qrc:/ic_save_white.svg" ) ); QFileInfo fileInfo( url.toString() ); QString fileName( fileInfo.fileName() ); - Q_ASSERT( fileName == QStringLiteral( "ic_save_white.svg" ) ); + Q_ASSERT( fileName == QLatin1String( "ic_save_white.svg" ) ); } void TestQgsQuickUtils::fileExists() From 66f19ab81073dc7010745e1bd33bb996ddb4efe0 Mon Sep 17 00:00:00 2001 From: Salvatore Larosa Date: Sat, 10 Oct 2020 13:38:42 +0200 Subject: [PATCH 19/48] [ui] use grid layout for groupbox widgets in digitizing option --- src/app/qgsvectorlayerdigitizingproperties.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/qgsvectorlayerdigitizingproperties.cpp b/src/app/qgsvectorlayerdigitizingproperties.cpp index 02a382a5db8e..194a8229e720 100644 --- a/src/app/qgsvectorlayerdigitizingproperties.cpp +++ b/src/app/qgsvectorlayerdigitizingproperties.cpp @@ -98,19 +98,21 @@ QgsVectorLayerDigitizingPropertiesPage::QgsVectorLayerDigitizingPropertiesPage( mGapCheckAllowExceptionsActivatedCheckBox = new QgsCollapsibleGroupBox( tr( "Allowed Gaps" ) ); mGapCheckAllowExceptionsActivatedCheckBox->setCheckable( true ); mGapCheckAllowExceptionsActivatedCheckBox->setChecked( gapCheckConfig.value( QStringLiteral( "allowedGapsEnabled" ), false ).toBool() ); - QFormLayout *layout = new QFormLayout(); + QGridLayout *layout = new QGridLayout(); mGapCheckAllowExceptionsActivatedCheckBox->setLayout( layout ); topologyCheckLayout->addWidget( mGapCheckAllowExceptionsActivatedCheckBox ); mGapCheckAllowExceptionsLayerComboBox = new QgsMapLayerComboBox(); mGapCheckAllowExceptionsLayerComboBox->setFilters( QgsMapLayerProxyModel::PolygonLayer ); mGapCheckAllowExceptionsLayerComboBox->setExceptedLayerList( QList { vlayer } ); mGapCheckAllowExceptionsLayerComboBox->setLayer( QgsProject::instance()->mapLayer( gapCheckConfig.value( QStringLiteral( "allowedGapsLayer" ) ).toString() ) ); - layout->addRow( new QLabel( tr( "Layer" ) ), mGapCheckAllowExceptionsLayerComboBox ); + layout->addWidget( new QLabel( tr( "Layer" ) ), 0, 0 ); + layout->addWidget( mGapCheckAllowExceptionsLayerComboBox, 0, 1 ); mGapCheckAllowExceptionsBufferSpinBox = new QgsDoubleSpinBox(); mGapCheckAllowExceptionsBufferSpinBox->setInputMethodHints( Qt::ImhFormattedNumbersOnly ); mGapCheckAllowExceptionsBufferSpinBox->setSuffix( QgsUnitTypes::toAbbreviatedString( vlayer->crs().mapUnits() ) ); mGapCheckAllowExceptionsBufferSpinBox->setValue( gapCheckConfig.value( QStringLiteral( "allowedGapsBuffer" ) ).toDouble() ); - layout->addRow( new QLabel( tr( "Buffer" ) ), mGapCheckAllowExceptionsBufferSpinBox ); + layout->addWidget( new QLabel( tr( "Buffer" ) ), 0, 2 ); + layout->addWidget( mGapCheckAllowExceptionsBufferSpinBox, 0, 3 ); } } mTopologyChecksGroupBox->setLayout( topologyCheckLayout ); From 6de9f602562d2e6bb9495b4723e63e27e0690244 Mon Sep 17 00:00:00 2001 From: Salvatore Larosa Date: Sat, 10 Oct 2020 10:31:28 +0200 Subject: [PATCH 20/48] [ui] stretch last section in filed table widget --- src/gui/vector/qgssourcefieldsproperties.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/vector/qgssourcefieldsproperties.cpp b/src/gui/vector/qgssourcefieldsproperties.cpp index 421c8b954c26..3ac099375110 100644 --- a/src/gui/vector/qgssourcefieldsproperties.cpp +++ b/src/gui/vector/qgssourcefieldsproperties.cpp @@ -73,6 +73,7 @@ QgsSourceFieldsProperties::QgsSourceFieldsProperties( QgsVectorLayer *layer, QWi mFieldsList->sortByColumn( 0, Qt::AscendingOrder ); mFieldsList->setSelectionBehavior( QAbstractItemView::SelectRows ); mFieldsList->setSelectionMode( QAbstractItemView::ExtendedSelection ); + mFieldsList->horizontalHeader()->setStretchLastSection( true ); mFieldsList->verticalHeader()->hide(); //load buttons and field list From 1ddfbe689ba8934b7f40831f54ac98740b7842b1 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Fri, 9 Oct 2020 19:33:51 +0200 Subject: [PATCH 21/48] Fix translation for geometry checks Q_DELCARE_TR_FUNCTIONS must be used in the subclass. If used from the super class it simply does not work. --- src/analysis/vector/geometry_checker/qgsgeometryanglecheck.h | 1 + src/analysis/vector/geometry_checker/qgsgeometryareacheck.h | 1 + src/analysis/vector/geometry_checker/qgsgeometrycheck.h | 1 - .../vector/geometry_checker/qgsgeometrycontainedcheck.h | 1 + src/analysis/vector/geometry_checker/qgsgeometrydanglecheck.h | 1 + .../geometry_checker/qgsgeometrydegeneratepolygoncheck.h | 1 + .../vector/geometry_checker/qgsgeometryduplicatecheck.h | 1 + .../vector/geometry_checker/qgsgeometryduplicatenodescheck.h | 1 + .../geometry_checker/qgsgeometryfollowboundariescheck.h | 1 + src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h | 4 +++- src/analysis/vector/geometry_checker/qgsgeometryholecheck.h | 1 + .../vector/geometry_checker/qgsgeometryisvalidcheck.h | 1 + .../geometry_checker/qgsgeometrylineintersectioncheck.h | 1 + .../geometry_checker/qgsgeometrylinelayerintersectioncheck.h | 1 + .../vector/geometry_checker/qgsgeometrymissingvertexcheck.h | 2 +- .../vector/geometry_checker/qgsgeometrymultipartcheck.h | 1 + .../vector/geometry_checker/qgsgeometryoverlapcheck.h | 1 + .../geometry_checker/qgsgeometrypointcoveredbylinecheck.h | 1 + .../vector/geometry_checker/qgsgeometrypointinpolygoncheck.h | 1 + .../vector/geometry_checker/qgsgeometrysegmentlengthcheck.h | 1 + .../vector/geometry_checker/qgsgeometryselfcontactcheck.h | 1 + .../geometry_checker/qgsgeometryselfintersectioncheck.h | 1 + src/analysis/vector/geometry_checker/qgsgeometrytypecheck.h | 1 + 23 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/analysis/vector/geometry_checker/qgsgeometryanglecheck.h b/src/analysis/vector/geometry_checker/qgsgeometryanglecheck.h index 63a0c21f8bb5..09198be77465 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometryanglecheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometryanglecheck.h @@ -25,6 +25,7 @@ */ class ANALYSIS_EXPORT QgsGeometryAngleCheck : public QgsGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryAngleCheck ) public: enum ResolutionMethod { diff --git a/src/analysis/vector/geometry_checker/qgsgeometryareacheck.h b/src/analysis/vector/geometry_checker/qgsgeometryareacheck.h index 2e1b2ce29f6a..91c938709a98 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometryareacheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometryareacheck.h @@ -27,6 +27,7 @@ class QgsSurface; */ class ANALYSIS_EXPORT QgsGeometryAreaCheck : public QgsGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryAreaCheck ) public: enum ResolutionMethod { MergeLongestEdge, MergeLargestArea, MergeIdenticalAttribute, Delete, NoChange }; diff --git a/src/analysis/vector/geometry_checker/qgsgeometrycheck.h b/src/analysis/vector/geometry_checker/qgsgeometrycheck.h index 2f8737201192..f18947df3ff3 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrycheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometrycheck.h @@ -91,7 +91,6 @@ class QgsFeaturePool; class ANALYSIS_EXPORT QgsGeometryCheck { Q_GADGET - Q_DECLARE_TR_FUNCTIONS( QgsGeometryCheck ) public: diff --git a/src/analysis/vector/geometry_checker/qgsgeometrycontainedcheck.h b/src/analysis/vector/geometry_checker/qgsgeometrycontainedcheck.h index 6ea65c161aff..95fd3d43d3f8 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrycontainedcheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometrycontainedcheck.h @@ -54,6 +54,7 @@ class ANALYSIS_EXPORT QgsGeometryContainedCheckError : public QgsGeometryCheckEr */ class ANALYSIS_EXPORT QgsGeometryContainedCheck : public QgsGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryContainedCheck ) public: enum ResolutionMethod { Delete, NoChange }; diff --git a/src/analysis/vector/geometry_checker/qgsgeometrydanglecheck.h b/src/analysis/vector/geometry_checker/qgsgeometrydanglecheck.h index 711a0c3b6f4c..8da34572b00c 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrydanglecheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometrydanglecheck.h @@ -25,6 +25,7 @@ */ class ANALYSIS_EXPORT QgsGeometryDangleCheck : public QgsGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryDangleCheck ) public: QgsGeometryDangleCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration ) : QgsGeometryCheck( context, configuration ) diff --git a/src/analysis/vector/geometry_checker/qgsgeometrydegeneratepolygoncheck.h b/src/analysis/vector/geometry_checker/qgsgeometrydegeneratepolygoncheck.h index 4f033e1521d5..f911f760ab44 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrydegeneratepolygoncheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometrydegeneratepolygoncheck.h @@ -25,6 +25,7 @@ */ class ANALYSIS_EXPORT QgsGeometryDegeneratePolygonCheck : public QgsGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryDegeneratePolygonCheck ) public: enum ResolutionMethod { DeleteRing, NoChange }; diff --git a/src/analysis/vector/geometry_checker/qgsgeometryduplicatecheck.h b/src/analysis/vector/geometry_checker/qgsgeometryduplicatecheck.h index aea25dd0176e..ee0e17dc7f1b 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometryduplicatecheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometryduplicatecheck.h @@ -58,6 +58,7 @@ class ANALYSIS_EXPORT QgsGeometryDuplicateCheckError : public QgsGeometryCheckEr */ class ANALYSIS_EXPORT QgsGeometryDuplicateCheck : public QgsGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryDuplicateCheck ) public: explicit QgsGeometryDuplicateCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration ) : QgsGeometryCheck( context, configuration ) {} diff --git a/src/analysis/vector/geometry_checker/qgsgeometryduplicatenodescheck.h b/src/analysis/vector/geometry_checker/qgsgeometryduplicatenodescheck.h index c042afd8f26c..7048d30681a4 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometryduplicatenodescheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometryduplicatenodescheck.h @@ -25,6 +25,7 @@ */ class ANALYSIS_EXPORT QgsGeometryDuplicateNodesCheck : public QgsGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryDuplicateNodesCheck ) public: explicit QgsGeometryDuplicateNodesCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration ) : QgsGeometryCheck( context, configuration ) {} diff --git a/src/analysis/vector/geometry_checker/qgsgeometryfollowboundariescheck.h b/src/analysis/vector/geometry_checker/qgsgeometryfollowboundariescheck.h index c5015c8e9094..6bc380806927 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometryfollowboundariescheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometryfollowboundariescheck.h @@ -28,6 +28,7 @@ class QgsSpatialIndex; */ class ANALYSIS_EXPORT QgsGeometryFollowBoundariesCheck : public QgsGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryFollowBoundariesCheck ) public: QgsGeometryFollowBoundariesCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration, QgsVectorLayer *checkLayer ); ~QgsGeometryFollowBoundariesCheck() override; diff --git a/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h b/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h index cd127167dc6a..dc1fa4dda698 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h @@ -21,6 +21,7 @@ #include "qgsgeometrycheck.h" #include "qgsgeometrycheckerror.h" #include "qgsfeatureid.h" +#include /** * \ingroup analysis @@ -88,7 +89,8 @@ class ANALYSIS_EXPORT QgsGeometryGapCheckError : public QgsGeometryCheckError */ class ANALYSIS_EXPORT QgsGeometryGapCheck : public QgsGeometryCheck { - Q_GADGET + Q_DECLARE_TR_FUNCTIONS( QgsGeometryGapCheck ) + public: //! Resolution methods for geometry gap checks enum ResolutionMethod diff --git a/src/analysis/vector/geometry_checker/qgsgeometryholecheck.h b/src/analysis/vector/geometry_checker/qgsgeometryholecheck.h index ee50e3a540e3..e23bac351ca8 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometryholecheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometryholecheck.h @@ -25,6 +25,7 @@ */ class ANALYSIS_EXPORT QgsGeometryHoleCheck : public QgsGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryHoleCheck ) public: explicit QgsGeometryHoleCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration ) : QgsGeometryCheck( context, configuration ) {} diff --git a/src/analysis/vector/geometry_checker/qgsgeometryisvalidcheck.h b/src/analysis/vector/geometry_checker/qgsgeometryisvalidcheck.h index 25710b3477d2..e844d9a47342 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometryisvalidcheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometryisvalidcheck.h @@ -53,6 +53,7 @@ class ANALYSIS_EXPORT QgsGeometryIsValidCheckError : public QgsSingleGeometryChe */ class ANALYSIS_EXPORT QgsGeometryIsValidCheck : public QgsSingleGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryIsValidCheck ) public: /** diff --git a/src/analysis/vector/geometry_checker/qgsgeometrylineintersectioncheck.h b/src/analysis/vector/geometry_checker/qgsgeometrylineintersectioncheck.h index f57d1d128b8a..ca162a7a5faf 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrylineintersectioncheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometrylineintersectioncheck.h @@ -25,6 +25,7 @@ */ class ANALYSIS_EXPORT QgsGeometryLineIntersectionCheck : public QgsGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryLineIntersectionCheck ) public: QgsGeometryLineIntersectionCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration ) : QgsGeometryCheck( context, configuration ) diff --git a/src/analysis/vector/geometry_checker/qgsgeometrylinelayerintersectioncheck.h b/src/analysis/vector/geometry_checker/qgsgeometrylinelayerintersectioncheck.h index a4db90ce8482..e9c573f91742 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrylinelayerintersectioncheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometrylinelayerintersectioncheck.h @@ -25,6 +25,7 @@ */ class ANALYSIS_EXPORT QgsGeometryLineLayerIntersectionCheck : public QgsGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryLineLayerIntersectionCheck ) public: QgsGeometryLineLayerIntersectionCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration ) : QgsGeometryCheck( context, configuration ) diff --git a/src/analysis/vector/geometry_checker/qgsgeometrymissingvertexcheck.h b/src/analysis/vector/geometry_checker/qgsgeometrymissingvertexcheck.h index 08aa9a3ca817..638a1ca59114 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrymissingvertexcheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometrymissingvertexcheck.h @@ -84,7 +84,7 @@ class ANALYSIS_EXPORT QgsGeometryMissingVertexCheckError : public QgsGeometryChe */ class ANALYSIS_EXPORT QgsGeometryMissingVertexCheck : public QgsGeometryCheck { - Q_GADGET + Q_DECLARE_TR_FUNCTIONS( QgsGeometryMissingVertexCheck ) public: diff --git a/src/analysis/vector/geometry_checker/qgsgeometrymultipartcheck.h b/src/analysis/vector/geometry_checker/qgsgeometrymultipartcheck.h index 695fe960b791..993cffb3a4c8 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrymultipartcheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometrymultipartcheck.h @@ -25,6 +25,7 @@ */ class ANALYSIS_EXPORT QgsGeometryMultipartCheck : public QgsSingleGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryMultipartCheck ) public: explicit QgsGeometryMultipartCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration ) : QgsSingleGeometryCheck( context, diff --git a/src/analysis/vector/geometry_checker/qgsgeometryoverlapcheck.h b/src/analysis/vector/geometry_checker/qgsgeometryoverlapcheck.h index 690f082bba59..89d469a8e229 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometryoverlapcheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometryoverlapcheck.h @@ -92,6 +92,7 @@ class ANALYSIS_EXPORT QgsGeometryOverlapCheckError : public QgsGeometryCheckErro */ class ANALYSIS_EXPORT QgsGeometryOverlapCheck : public QgsGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryOverlapCheck ) public: /** diff --git a/src/analysis/vector/geometry_checker/qgsgeometrypointcoveredbylinecheck.h b/src/analysis/vector/geometry_checker/qgsgeometrypointcoveredbylinecheck.h index b507efccbd4f..d4333d3977b2 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrypointcoveredbylinecheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometrypointcoveredbylinecheck.h @@ -25,6 +25,7 @@ */ class ANALYSIS_EXPORT QgsGeometryPointCoveredByLineCheck : public QgsGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryPointCoveredByLineCheck ) public: QgsGeometryPointCoveredByLineCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration ) : QgsGeometryCheck( context, configuration ) diff --git a/src/analysis/vector/geometry_checker/qgsgeometrypointinpolygoncheck.h b/src/analysis/vector/geometry_checker/qgsgeometrypointinpolygoncheck.h index 8043451bd277..251b3a33b6ec 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrypointinpolygoncheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometrypointinpolygoncheck.h @@ -25,6 +25,7 @@ */ class ANALYSIS_EXPORT QgsGeometryPointInPolygonCheck : public QgsGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryPointInPolygonCheck ) public: QgsGeometryPointInPolygonCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration ) : QgsGeometryCheck( context, configuration ) diff --git a/src/analysis/vector/geometry_checker/qgsgeometrysegmentlengthcheck.h b/src/analysis/vector/geometry_checker/qgsgeometrysegmentlengthcheck.h index 8aa04ec6bcd7..6b46e6784dde 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrysegmentlengthcheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometrysegmentlengthcheck.h @@ -25,6 +25,7 @@ */ class ANALYSIS_EXPORT QgsGeometrySegmentLengthCheck : public QgsGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometrySegmentLengthCheck ) public: QgsGeometrySegmentLengthCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration ) : QgsGeometryCheck( context, configuration ) diff --git a/src/analysis/vector/geometry_checker/qgsgeometryselfcontactcheck.h b/src/analysis/vector/geometry_checker/qgsgeometryselfcontactcheck.h index b18f929d7a91..cb0525a320a0 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometryselfcontactcheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometryselfcontactcheck.h @@ -25,6 +25,7 @@ */ class ANALYSIS_EXPORT QgsGeometrySelfContactCheck : public QgsSingleGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometrySelfContactCheck ) public: QgsGeometrySelfContactCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration ) : QgsSingleGeometryCheck( context, configuration ) {} diff --git a/src/analysis/vector/geometry_checker/qgsgeometryselfintersectioncheck.h b/src/analysis/vector/geometry_checker/qgsgeometryselfintersectioncheck.h index 696cab915975..ef43c431fb97 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometryselfintersectioncheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometryselfintersectioncheck.h @@ -50,6 +50,7 @@ class ANALYSIS_EXPORT QgsGeometrySelfIntersectionCheckError : public QgsSingleGe */ class ANALYSIS_EXPORT QgsGeometrySelfIntersectionCheck : public QgsSingleGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometrySelfIntersectionCheck ) public: enum ResolutionMethod { diff --git a/src/analysis/vector/geometry_checker/qgsgeometrytypecheck.h b/src/analysis/vector/geometry_checker/qgsgeometrytypecheck.h index 1cd4274a3d16..6268dcbae754 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrytypecheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometrytypecheck.h @@ -48,6 +48,7 @@ class ANALYSIS_EXPORT QgsGeometryTypeCheckError : public QgsSingleGeometryCheckE */ class ANALYSIS_EXPORT QgsGeometryTypeCheck : public QgsSingleGeometryCheck { + Q_DECLARE_TR_FUNCTIONS( QgsGeometryTypeCheck ) public: QgsGeometryTypeCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration, int allowedTypes ) : QgsSingleGeometryCheck( context, configuration ) From 99dc28e9b16644189e4fc13a0e8c8eabed700866 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Sat, 10 Oct 2020 12:54:46 +0200 Subject: [PATCH 22/48] Readd q_gadget --- src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h b/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h index dc1fa4dda698..fd146e41b178 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h @@ -89,6 +89,7 @@ class ANALYSIS_EXPORT QgsGeometryGapCheckError : public QgsGeometryCheckError */ class ANALYSIS_EXPORT QgsGeometryGapCheck : public QgsGeometryCheck { + Q_GADGET Q_DECLARE_TR_FUNCTIONS( QgsGeometryGapCheck ) public: From bd60cf11f55d822d922fd2757fedd7fab8040c14 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Sat, 10 Oct 2020 12:55:30 +0200 Subject: [PATCH 23/48] Remove include --- src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h b/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h index fd146e41b178..9ba9a2f52dc4 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h +++ b/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h @@ -21,7 +21,6 @@ #include "qgsgeometrycheck.h" #include "qgsgeometrycheckerror.h" #include "qgsfeatureid.h" -#include /** * \ingroup analysis From 18bfe1f56c9a7544f63a9aef9f33eb1059950e5e Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Fri, 9 Oct 2020 19:40:14 +0200 Subject: [PATCH 24/48] Try to make PROJ >= 6 related tests more robust to output from different PROJ versions --- .../core/testqgscoordinatereferencesystem.cpp | 48 ++++++++++++------- tests/src/core/testqgscoordinatetransform.cpp | 19 ++++---- tests/src/python/test_qgsdatumtransforms.py | 10 ++-- 3 files changed, 47 insertions(+), 30 deletions(-) diff --git a/tests/src/core/testqgscoordinatereferencesystem.cpp b/tests/src/core/testqgscoordinatereferencesystem.cpp index 50197865ecf8..e25d5dbbadd5 100644 --- a/tests/src/core/testqgscoordinatereferencesystem.cpp +++ b/tests/src/core/testqgscoordinatereferencesystem.cpp @@ -1042,11 +1042,10 @@ void TestQgsCoordinateReferenceSystem::readWriteXml() QCOMPARE( myCrs13.authid(), QStringLiteral( "USER:100007" ) ); QCOMPARE( myCrs13.toProj(), QStringLiteral( "+proj=lcc +lat_0=-37.2 +lon_0=145.1 +lat_1=-36 +lat_2=-38 +x_0=2510000 +y_0=2520000 +ellps=GRS80 +towgs84=1,2,3,4,5,6,7 +units=m +no_defs" ) ); QgsDebugMsg( myCrs13.toWkt() ); -#if PROJ_VERSION_MAJOR>=7 - QCOMPARE( myCrs13.toWkt(), QStringLiteral( R"""(PROJCS["unknown",GEOGCS["unknown",DATUM["Unknown_based_on_GRS80_ellipsoid",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[1,2,3,4,5,6,7]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["latitude_of_origin",-37.2],PARAMETER["central_meridian",145.1],PARAMETER["standard_parallel_1",-36],PARAMETER["standard_parallel_2",-38],PARAMETER["false_easting",2510000],PARAMETER["false_northing",2520000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH]])""" ) ); -#else - QCOMPARE( myCrs13.toWkt(), QStringLiteral( R"""(PROJCS["unknown",GEOGCS["unknown",DATUM["Unknown based on GRS80 ellipsoid",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[1,2,3,4,5,6,7]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["latitude_of_origin",-37.2],PARAMETER["central_meridian",145.1],PARAMETER["standard_parallel_1",-36],PARAMETER["standard_parallel_2",-38],PARAMETER["false_easting",2510000],PARAMETER["false_northing",2520000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH]])""" ) ); -#endif + QVERIFY( myCrs13.toWkt().contains( QLatin1String( R"""(SPHEROID["GRS 1980",)""" ) ) ); + QVERIFY( myCrs13.toWkt().contains( QLatin1String( R"""(TOWGS84[1,2,3,4,5,6,7])""" ) ) ); + QVERIFY( myCrs13.toWkt().contains( QLatin1String( R"""(PROJECTION["Lambert_Conformal_Conic_2SP"])""" ) ) ); + QVERIFY( myCrs13.toWkt().contains( QLatin1String( R"""(PARAMETER["latitude_of_origin",-37.2],PARAMETER["central_meridian",145.1],PARAMETER["standard_parallel_1",-36],PARAMETER["standard_parallel_2",-38],PARAMETER["false_easting",2510000],PARAMETER["false_northing",2520000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH])""" ) ) ); #else QCOMPARE( myCrs13.authid(), QStringLiteral( "USER:100004" ) ); QCOMPARE( myCrs13.toProj(), QStringLiteral( "+proj=lcc +lat_1=-36 +lat_2=-38 +lat_0=-37.2 +lon_0=145.1 +x_0=2510000 +y_0=2520000 +ellps=GRS80 +towgs84=1,2,3,4,5,6,7 +units=m +no_defs" ) ); @@ -1503,11 +1502,8 @@ void TestQgsCoordinateReferenceSystem::noProj() QCOMPARE( crs.authid(), QStringLiteral( "EPSG:22300" ) ); QVERIFY( crs.isValid() ); QgsDebugMsg( crs.toWkt() ); -#if PROJ_VERSION_MAJOR>=7 - QCOMPARE( crs.toWkt(), QStringLiteral( "PROJCS[\"Carthage (Paris) / Tunisia Mining Grid\",GEOGCS[\"Carthage (Paris)\",DATUM[\"Carthage_Paris\",SPHEROID[\"Clarke 1880 (IGN)\",6378249.2,293.466021293627,AUTHORITY[\"EPSG\",\"7011\"]],AUTHORITY[\"EPSG\",\"6816\"]],PRIMEM[\"Paris\",2.33722916999999,AUTHORITY[\"EPSG\",\"8903\"]],UNIT[\"grad\",0.0157079632679489,AUTHORITY[\"EPSG\",\"9105\"]],AUTHORITY[\"EPSG\",\"4816\"]],PROJECTION[\"Tunisia_Mapping_Grid\"],PARAMETER[\"latitude_of_origin\",36.5964],PARAMETER[\"central_meridian\",7.83445],PARAMETER[\"false_easting\",270],PARAMETER[\"false_northing\",360],UNIT[\"kilometre\",1000,AUTHORITY[\"EPSG\",\"9036\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"22300\"]]" ) ); //#spellok -#else - QCOMPARE( crs.toWkt(), QStringLiteral( "PROJCS[\"Carthage (Paris) / Tunisia Mining Grid\",GEOGCS[\"Carthage (Paris)\",DATUM[\"Carthage_Paris\",SPHEROID[\"Clarke 1880 (IGN)\",6378249.2,293.466021293627,AUTHORITY[\"EPSG\",\"7011\"]],AUTHORITY[\"EPSG\",\"6816\"]],PRIMEM[\"Paris\",2.33722917,AUTHORITY[\"EPSG\",\"8903\"]],UNIT[\"grad\",0.0157079632679489,AUTHORITY[\"EPSG\",\"9105\"]],AUTHORITY[\"EPSG\",\"4816\"]],PROJECTION[\"Tunisia_Mapping_Grid\"],PARAMETER[\"latitude_of_origin\",36.5964],PARAMETER[\"central_meridian\",7.83445],PARAMETER[\"false_easting\",270],PARAMETER[\"false_northing\",360],UNIT[\"kilometre\",1000,AUTHORITY[\"EPSG\",\"9036\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"22300\"]]" ) ); //#spellok -#endif + QVERIFY( crs.toWkt().startsWith( QLatin1String( "PROJCS[\"Carthage (Paris) / Tunisia Mining Grid\"," ) ) ); + QVERIFY( crs.toWkt().contains( QLatin1String( "PROJECTION[\"Tunisia_Mapping_Grid\"]" ) ) ); #endif } @@ -1518,7 +1514,10 @@ void TestQgsCoordinateReferenceSystem::customProjString() QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem::fromProj( QStringLiteral( "+proj=sterea +lat_0=47.4860018439082 +lon_0=19.0491441390302 +k=1 +x_0=500000 +y_0=500000 +ellps=bessel +towgs84=595.75,121.09,515.50,8.2270,-1.5193,5.5971,-2.6729 +units=m +vunits=m +no_defs" ) ); QVERIFY( crs.isValid() ); QCOMPARE( crs.toProj(), QStringLiteral( "+proj=sterea +lat_0=47.4860018439082 +lon_0=19.0491441390302 +k=1 +x_0=500000 +y_0=500000 +ellps=bessel +towgs84=595.75,121.09,515.50,8.2270,-1.5193,5.5971,-2.6729 +units=m +vunits=m +no_defs" ) ); - QCOMPARE( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ), QStringLiteral( R"""(BOUNDCRS[SOURCECRS[COMPOUNDCRS["unknown",PROJCRS["unknown",BASEGEOGCRS["unknown",DATUM["Unknown based on Bessel 1841 ellipsoid",ELLIPSOID["Bessel 1841",6377397.155,299.1528128,LENGTHUNIT["metre",1,ID["EPSG",9001]]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Oblique Stereographic",ID["EPSG",9809]],PARAMETER["Latitude of natural origin",47.4860018439082,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",19.0491441390302,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Scale factor at natural origin",1,SCALEUNIT["unity",1],ID["EPSG",8805]],PARAMETER["False easting",500000,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",500000,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]],VERTCRS["unknown",VDATUM["unknown"],CS[vertical,1],AXIS["gravity-related height (H)",up,LENGTHUNIT["metre",1,ID["EPSG",9001]]]]]],TARGETCRS[GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["latitude",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["longitude",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]]],ABRIDGEDTRANSFORMATION["Transformation from unknown to WGS84",METHOD["Position Vector transformation (geog2D domain)",ID["EPSG",9606]],PARAMETER["X-axis translation",595.75,ID["EPSG",8605]],PARAMETER["Y-axis translation",121.09,ID["EPSG",8606]],PARAMETER["Z-axis translation",515.5,ID["EPSG",8607]],PARAMETER["X-axis rotation",8.227,ID["EPSG",8608]],PARAMETER["Y-axis rotation",-1.5193,ID["EPSG",8609]],PARAMETER["Z-axis rotation",5.5971,ID["EPSG",8610]],PARAMETER["Scale difference",0.9999973271,ID["EPSG",8611]]]])""" ) ); + QgsDebugMsg( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ) ); + QVERIFY( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).startsWith( QLatin1String( R"""(BOUNDCRS[SOURCECRS[)""" ) ) ); + QVERIFY( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(METHOD["Oblique Stereographic",ID["EPSG",9809]])""" ) ) ); + QVERIFY( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["X-axis translation",595.75,ID["EPSG",8605]],PARAMETER["Y-axis translation",121.09,ID["EPSG",8606]],PARAMETER["Z-axis translation",515.5,ID["EPSG",8607]],PARAMETER["X-axis rotation",8.227,ID["EPSG",8608]],PARAMETER["Y-axis rotation",-1.5193,ID["EPSG",8609]],PARAMETER["Z-axis rotation",5.5971,ID["EPSG",8610]],PARAMETER["Scale difference",0.9999973271,ID["EPSG",8611]])""" ) ) ); long id = crs.saveAsUserCrs( QStringLiteral( "custom proj crs" ), QgsCoordinateReferenceSystem::FormatProj ); QVERIFY( id ); @@ -1526,7 +1525,11 @@ void TestQgsCoordinateReferenceSystem::customProjString() crs = QgsCoordinateReferenceSystem::fromProj( QStringLiteral( "+proj=sterea +lat_0=47.4860018439082 +lon_0=19.0491441390302 +k=1 +x_0=500000 +y_0=500000 +ellps=bessel +towgs84=595.75,121.09,515.50,8.2270,-1.5193,5.5971,-2.6729 +units=m +vunits=m +no_defs" ) ); QVERIFY( crs.isValid() ); QCOMPARE( crs.toProj(), QStringLiteral( "+proj=sterea +lat_0=47.4860018439082 +lon_0=19.0491441390302 +k=1 +x_0=500000 +y_0=500000 +ellps=bessel +towgs84=595.75,121.09,515.50,8.2270,-1.5193,5.5971,-2.6729 +units=m +vunits=m +no_defs" ) ); - QCOMPARE( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ), QStringLiteral( R"""(BOUNDCRS[SOURCECRS[COMPOUNDCRS["unknown",PROJCRS["unknown",BASEGEOGCRS["unknown",DATUM["Unknown based on Bessel 1841 ellipsoid",ELLIPSOID["Bessel 1841",6377397.155,299.1528128,LENGTHUNIT["metre",1,ID["EPSG",9001]]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Oblique Stereographic",ID["EPSG",9809]],PARAMETER["Latitude of natural origin",47.4860018439082,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",19.0491441390302,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Scale factor at natural origin",1,SCALEUNIT["unity",1],ID["EPSG",8805]],PARAMETER["False easting",500000,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",500000,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]],VERTCRS["unknown",VDATUM["unknown"],CS[vertical,1],AXIS["gravity-related height (H)",up,LENGTHUNIT["metre",1,ID["EPSG",9001]]]]]],TARGETCRS[GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["latitude",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["longitude",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]]],ABRIDGEDTRANSFORMATION["Transformation from unknown to WGS84",METHOD["Position Vector transformation (geog2D domain)",ID["EPSG",9606]],PARAMETER["X-axis translation",595.75,ID["EPSG",8605]],PARAMETER["Y-axis translation",121.09,ID["EPSG",8606]],PARAMETER["Z-axis translation",515.5,ID["EPSG",8607]],PARAMETER["X-axis rotation",8.227,ID["EPSG",8608]],PARAMETER["Y-axis rotation",-1.5193,ID["EPSG",8609]],PARAMETER["Z-axis rotation",5.5971,ID["EPSG",8610]],PARAMETER["Scale difference",0.9999973271,ID["EPSG",8611]]]])""" ) ); + QgsDebugMsg( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ) ); + QVERIFY( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).startsWith( QLatin1String( R"""(BOUNDCRS[SOURCECRS[)""" ) ) ); + QVERIFY( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(METHOD["Oblique Stereographic",ID["EPSG",9809]])""" ) ) ); + QVERIFY( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["X-axis translation",595.75,ID["EPSG",8605]],PARAMETER["Y-axis translation",121.09,ID["EPSG",8606]],PARAMETER["Z-axis translation",515.5,ID["EPSG",8607]],PARAMETER["X-axis rotation",8.227,ID["EPSG",8608]],PARAMETER["Y-axis rotation",-1.5193,ID["EPSG",8609]],PARAMETER["Z-axis rotation",5.5971,ID["EPSG",8610]],PARAMETER["Scale difference",0.9999973271,ID["EPSG",8611]])""" ) ) ); + QCOMPARE( crs.authid(), QStringLiteral( "USER:%1" ).arg( id ) ); // make sure it works without cache @@ -1534,7 +1537,11 @@ void TestQgsCoordinateReferenceSystem::customProjString() crs = QgsCoordinateReferenceSystem::fromProj( QStringLiteral( "+proj=sterea +lat_0=47.4860018439082 +lon_0=19.0491441390302 +k=1 +x_0=500000 +y_0=500000 +ellps=bessel +towgs84=595.75,121.09,515.50,8.2270,-1.5193,5.5971,-2.6729 +units=m +vunits=m +no_defs" ) ); QVERIFY( crs.isValid() ); QCOMPARE( crs.toProj(), QStringLiteral( "+proj=sterea +lat_0=47.4860018439082 +lon_0=19.0491441390302 +k=1 +x_0=500000 +y_0=500000 +ellps=bessel +towgs84=595.75,121.09,515.50,8.2270,-1.5193,5.5971,-2.6729 +units=m +vunits=m +no_defs" ) ); - QCOMPARE( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ), QStringLiteral( R"""(BOUNDCRS[SOURCECRS[COMPOUNDCRS["unknown",PROJCRS["unknown",BASEGEOGCRS["unknown",DATUM["Unknown based on Bessel 1841 ellipsoid",ELLIPSOID["Bessel 1841",6377397.155,299.1528128,LENGTHUNIT["metre",1,ID["EPSG",9001]]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Oblique Stereographic",ID["EPSG",9809]],PARAMETER["Latitude of natural origin",47.4860018439082,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",19.0491441390302,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Scale factor at natural origin",1,SCALEUNIT["unity",1],ID["EPSG",8805]],PARAMETER["False easting",500000,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",500000,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]],VERTCRS["unknown",VDATUM["unknown"],CS[vertical,1],AXIS["gravity-related height (H)",up,LENGTHUNIT["metre",1,ID["EPSG",9001]]]]]],TARGETCRS[GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["latitude",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["longitude",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]]],ABRIDGEDTRANSFORMATION["Transformation from unknown to WGS84",METHOD["Position Vector transformation (geog2D domain)",ID["EPSG",9606]],PARAMETER["X-axis translation",595.75,ID["EPSG",8605]],PARAMETER["Y-axis translation",121.09,ID["EPSG",8606]],PARAMETER["Z-axis translation",515.5,ID["EPSG",8607]],PARAMETER["X-axis rotation",8.227,ID["EPSG",8608]],PARAMETER["Y-axis rotation",-1.5193,ID["EPSG",8609]],PARAMETER["Z-axis rotation",5.5971,ID["EPSG",8610]],PARAMETER["Scale difference",0.9999973271,ID["EPSG",8611]]]])""" ) ); + QgsDebugMsg( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ) ); + QVERIFY( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).startsWith( QLatin1String( R"""(BOUNDCRS[SOURCECRS[)""" ) ) ); + QVERIFY( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(METHOD["Oblique Stereographic",ID["EPSG",9809]])""" ) ) ); + QVERIFY( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["X-axis translation",595.75,ID["EPSG",8605]],PARAMETER["Y-axis translation",121.09,ID["EPSG",8606]],PARAMETER["Z-axis translation",515.5,ID["EPSG",8607]],PARAMETER["X-axis rotation",8.227,ID["EPSG",8608]],PARAMETER["Y-axis rotation",-1.5193,ID["EPSG",8609]],PARAMETER["Z-axis rotation",5.5971,ID["EPSG",8610]],PARAMETER["Scale difference",0.9999973271,ID["EPSG",8611]])""" ) ) ); + QCOMPARE( crs.authid(), QStringLiteral( "USER:%1" ).arg( id ) ); // make sure it matches to user crs when parameter order is different @@ -1543,7 +1550,10 @@ void TestQgsCoordinateReferenceSystem::customProjString() QVERIFY( crs.isValid() ); QCOMPARE( crs.authid(), QStringLiteral( "USER:%1" ).arg( id ) ); QCOMPARE( crs.toProj(), QStringLiteral( "+proj=sterea +lat_0=47.4860018439082 +lon_0=19.0491441390302 +k=1 +x_0=500000 +y_0=500000 +ellps=bessel +towgs84=595.75,121.09,515.50,8.2270,-1.5193,5.5971,-2.6729 +units=m +vunits=m +no_defs" ) ); - QCOMPARE( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ), QStringLiteral( R"""(BOUNDCRS[SOURCECRS[COMPOUNDCRS["unknown",PROJCRS["unknown",BASEGEOGCRS["unknown",DATUM["Unknown based on Bessel 1841 ellipsoid",ELLIPSOID["Bessel 1841",6377397.155,299.1528128,LENGTHUNIT["metre",1,ID["EPSG",9001]]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Oblique Stereographic",ID["EPSG",9809]],PARAMETER["Latitude of natural origin",47.4860018439082,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",19.0491441390302,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Scale factor at natural origin",1,SCALEUNIT["unity",1],ID["EPSG",8805]],PARAMETER["False easting",500000,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",500000,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]],VERTCRS["unknown",VDATUM["unknown"],CS[vertical,1],AXIS["gravity-related height (H)",up,LENGTHUNIT["metre",1,ID["EPSG",9001]]]]]],TARGETCRS[GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["latitude",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["longitude",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]]],ABRIDGEDTRANSFORMATION["Transformation from unknown to WGS84",METHOD["Position Vector transformation (geog2D domain)",ID["EPSG",9606]],PARAMETER["X-axis translation",595.75,ID["EPSG",8605]],PARAMETER["Y-axis translation",121.09,ID["EPSG",8606]],PARAMETER["Z-axis translation",515.5,ID["EPSG",8607]],PARAMETER["X-axis rotation",8.227,ID["EPSG",8608]],PARAMETER["Y-axis rotation",-1.5193,ID["EPSG",8609]],PARAMETER["Z-axis rotation",5.5971,ID["EPSG",8610]],PARAMETER["Scale difference",0.9999973271,ID["EPSG",8611]]]])""" ) ); + QgsDebugMsg( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ) ); + QVERIFY( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).startsWith( QLatin1String( R"""(BOUNDCRS[SOURCECRS[)""" ) ) ); + QVERIFY( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(METHOD["Oblique Stereographic",ID["EPSG",9809]])""" ) ) ); + QVERIFY( crs.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["X-axis translation",595.75,ID["EPSG",8605]],PARAMETER["Y-axis translation",121.09,ID["EPSG",8606]],PARAMETER["Z-axis translation",515.5,ID["EPSG",8607]],PARAMETER["X-axis rotation",8.227,ID["EPSG",8608]],PARAMETER["Y-axis rotation",-1.5193,ID["EPSG",8609]],PARAMETER["Z-axis rotation",5.5971,ID["EPSG",8610]],PARAMETER["Scale difference",0.9999973271,ID["EPSG",8611]])""" ) ) ); #endif } @@ -1628,8 +1638,14 @@ void TestQgsCoordinateReferenceSystem::displayIdentifier() // non registered custom CRS crs = QgsCoordinateReferenceSystem::fromProj( QStringLiteral( "+proj=sterea +lat_0=47.9860018439082 +lon_0=19.0491441390302 +k=1 +x_0=500000 +y_0=500000 +ellps=bessel +towgs84=595.75,121.09,515.50,8.2270,-1.5193,5.5971,-2.6729 +units=m +vunits=m +no_defs" ) ); #if PROJ_VERSION_MAJOR>=6 - QCOMPARE( crs.userFriendlyIdentifier(), QStringLiteral( "Custom CRS: BOUNDCRS[SOURCECRS[COMPOUNDCRS[\"unknown\",PROJCRS[\"%1" ).arg( QString( QChar( 0x2026 ) ) ) ); //#spellok - QCOMPARE( crs.userFriendlyIdentifier( QgsCoordinateReferenceSystem::FullString ), QStringLiteral( R"""(Custom CRS: BOUNDCRS[SOURCECRS[COMPOUNDCRS["unknown",PROJCRS["unknown",BASEGEOGCRS["unknown",DATUM["Unknown based on Bessel 1841 ellipsoid",ELLIPSOID["Bessel 1841",6377397.155,299.1528128,LENGTHUNIT["metre",1,ID["EPSG",9001]]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Oblique Stereographic",ID["EPSG",9809]],PARAMETER["Latitude of natural origin",47.9860018439082,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",19.0491441390302,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Scale factor at natural origin",1,SCALEUNIT["unity",1],ID["EPSG",8805]],PARAMETER["False easting",500000,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",500000,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]],VERTCRS["unknown",VDATUM["unknown"],CS[vertical,1],AXIS["gravity-related height (H)",up,LENGTHUNIT["metre",1,ID["EPSG",9001]]]]]],TARGETCRS[GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["latitude",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["longitude",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]]],ABRIDGEDTRANSFORMATION["Transformation from unknown to WGS84",METHOD["Position Vector transformation (geog2D domain)",ID["EPSG",9606]],PARAMETER["X-axis translation",595.75,ID["EPSG",8605]],PARAMETER["Y-axis translation",121.09,ID["EPSG",8606]],PARAMETER["Z-axis translation",515.5,ID["EPSG",8607]],PARAMETER["X-axis rotation",8.227,ID["EPSG",8608]],PARAMETER["Y-axis rotation",-1.5193,ID["EPSG",8609]],PARAMETER["Z-axis rotation",5.5971,ID["EPSG",8610]],PARAMETER["Scale difference",0.9999973271,ID["EPSG",8611]]]])""" ) ); + QgsDebugMsg( crs.userFriendlyIdentifier() ); + QVERIFY( crs.userFriendlyIdentifier().startsWith( QLatin1String( "Custom CRS: BOUNDCRS[" ) ) ); + QVERIFY( !crs.userFriendlyIdentifier().contains( QLatin1String( "PARAMETER[\"Scale difference\",0.9999973271,ID[\"EPSG\",8611]]" ) ) ); + QVERIFY( crs.userFriendlyIdentifier().endsWith( QChar( 0x2026 ) ) ); //#spellok + + QgsDebugMsg( crs.userFriendlyIdentifier( QgsCoordinateReferenceSystem::FullString ) ); + QVERIFY( crs.userFriendlyIdentifier( QgsCoordinateReferenceSystem::FullString ).startsWith( QLatin1String( "Custom CRS: BOUNDCRS[" ) ) ); + QVERIFY( crs.userFriendlyIdentifier( QgsCoordinateReferenceSystem::FullString ).contains( QLatin1String( "PARAMETER[\"Scale difference\",0.9999973271,ID[\"EPSG\",8611]]" ) ) ); #else QCOMPARE( crs.userFriendlyIdentifier(), QStringLiteral( "Custom CRS: PROJCS[\"unnamed\",GEOGCS[\"Bessel 1841\",DATUM[\"unkno%1" ).arg( QString( QChar( 0x2026 ) ) ) ); #endif diff --git a/tests/src/core/testqgscoordinatetransform.cpp b/tests/src/core/testqgscoordinatetransform.cpp index bf7d99c80255..a7ccd7824a39 100644 --- a/tests/src/core/testqgscoordinatetransform.cpp +++ b/tests/src/core/testqgscoordinatetransform.cpp @@ -601,17 +601,20 @@ void TestQgsCoordinateTransform::testCustomProjTransform() #if PROJ_VERSION_MAJOR >= 6 // test custom proj string // refs https://github.com/qgis/QGIS/issues/32928 - QgsCoordinateReferenceSystem ss( QgsCoordinateReferenceSystem::fromProj( QStringLiteral( "+proj=sterea +lat_0=47.4860018439082 +lon_0=19.0491441390302 +k=1 +x_0=500000 +y_0=500000 +ellps=bessel +towgs84=595.75,121.09,515.50,8.2270,-1.5193,5.5971,-2.6729 +units=m +vunits=m +no_defs" ) ) ); - QgsCoordinateReferenceSystem dd( QStringLiteral( "EPSG:23700" ) ); + QgsCoordinateReferenceSystem ss( QgsCoordinateReferenceSystem::fromProj( QStringLiteral( "+proj=longlat +ellps=GRS80 +towgs84=1,2,3,4,5,6,7 +no_defs" ) ) ); + QgsCoordinateReferenceSystem dd( QStringLiteral( "EPSG:4326" ) ); QgsCoordinateTransform ct( ss, dd, QgsCoordinateTransformContext() ); QVERIFY( ct.isValid() ); QgsDebugMsg( ct.instantiatedCoordinateOperationDetails().proj ); - QCOMPARE( ct.instantiatedCoordinateOperationDetails().proj, QStringLiteral( "+proj=pipeline +step +inv +proj=sterea +lat_0=47.4860018439082 +lon_0=19.0491441390302 +k=1 +x_0=500000 +y_0=500000 +ellps=bessel +step +proj=push +v_3 +step +proj=cart +ellps=bessel +step +proj=helmert +x=595.75 +y=121.09 +z=515.5 +rx=8.227 +ry=-1.5193 +rz=5.5971 +s=-2.6729 +convention=position_vector +step +inv +proj=helmert +x=52.684 +y=-71.194 +z=-13.975 +rx=0.312 +ry=0.1063 +rz=0.3729 +s=1.0191 +convention=coordinate_frame +step +inv +proj=cart +ellps=GRS67 +step +proj=pop +v_3 +step +proj=somerc +lat_0=47.1443937222222 +lon_0=19.0485717777778 +k_0=0.99993 +x_0=650000 +y_0=200000 +ellps=GRS67" ) ); - - QgsPointXY pp( 529127, 479348 ); - pp = ct.transform( pp ); - QGSCOMPARENEAR( pp.x(), 679125.816475, 0.00001 ); - QGSCOMPARENEAR( pp.y(), 217454.893093, 0.00001 ); + QCOMPARE( ct.instantiatedCoordinateOperationDetails().proj, + QStringLiteral( "+proj=pipeline " + "+step +proj=unitconvert +xy_in=deg +xy_out=rad " + "+step +proj=push +v_3 " + "+step +proj=cart +ellps=GRS80 " + "+step +proj=helmert +x=1 +y=2 +z=3 +rx=4 +ry=5 +rz=6 +s=7 +convention=position_vector " + "+step +inv +proj=cart +ellps=WGS84 " + "+step +proj=pop +v_3 " + "+step +proj=unitconvert +xy_in=rad +xy_out=deg" ) ); #endif } diff --git a/tests/src/python/test_qgsdatumtransforms.py b/tests/src/python/test_qgsdatumtransforms.py index 745a44a707d7..03a5985c9931 100644 --- a/tests/src/python/test_qgsdatumtransforms.py +++ b/tests/src/python/test_qgsdatumtransforms.py @@ -237,17 +237,15 @@ def testOperations(self): @unittest.skipIf(QgsProjUtils.projVersionMajor() < 7, 'Not a proj >= 7 build') def testNoLasLos(self): """ - Test that operations which rely on an las/los grid shift file (which are unsupported by Proj6) are not returned + Test that operations which rely on an NADCON5 grid shift file (which are unsupported by Proj... at time of writing !) are not returned """ - ops = QgsDatumTransform.operations(QgsCoordinateReferenceSystem('EPSG:3035'), - QgsCoordinateReferenceSystem('EPSG:5514')) - self.assertEqual(len(ops), 3) + ops = QgsDatumTransform.operations(QgsCoordinateReferenceSystem('EPSG:4138'), + QgsCoordinateReferenceSystem('EPSG:4269')) + self.assertEqual(len(ops), 2) self.assertTrue(ops[0].name) self.assertTrue(ops[0].proj) self.assertTrue(ops[1].name) self.assertTrue(ops[1].proj) - self.assertTrue(ops[2].name) - self.assertTrue(ops[2].proj) if __name__ == '__main__': From e29f17cf2f3368873bbb95e16910bee909ab9c36 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Sun, 11 Oct 2020 13:07:04 +1000 Subject: [PATCH 25/48] Use edge color for tab indentation guide in code editors --- src/gui/codeeditors/qgscodeeditor.cpp | 2 ++ src/ui/qgscodeditorsettings.ui | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/codeeditors/qgscodeeditor.cpp b/src/gui/codeeditors/qgscodeeditor.cpp index 3f59ddde0446..ce4159be86e8 100644 --- a/src/gui/codeeditors/qgscodeeditor.cpp +++ b/src/gui/codeeditors/qgscodeeditor.cpp @@ -201,6 +201,8 @@ void QgsCodeEditor::runPostLexerConfigurationTasks() SendScintilla( SCI_MARKERSETBACK, SC_MARKNUM_FOLDEROPEN, lexerColor( QgsCodeEditorColorScheme::ColorRole::FoldIconForeground ) ); SendScintilla( SCI_MARKERSETFORE, SC_MARKNUM_FOLDER, lexerColor( QgsCodeEditorColorScheme::ColorRole::FoldIconHalo ) ); SendScintilla( SCI_MARKERSETBACK, SC_MARKNUM_FOLDER, lexerColor( QgsCodeEditorColorScheme::ColorRole::FoldIconForeground ) ); + SendScintilla( SCI_STYLESETFORE, STYLE_INDENTGUIDE, lexerColor( QgsCodeEditorColorScheme::ColorRole::Edge ) ); + SendScintilla( SCI_STYLESETBACK, STYLE_INDENTGUIDE, lexerColor( QgsCodeEditorColorScheme::ColorRole::Edge ) ); } void QgsCodeEditor::setSciWidget() diff --git a/src/ui/qgscodeditorsettings.ui b/src/ui/qgscodeditorsettings.ui index d462b00d4c95..1019b2308f03 100644 --- a/src/ui/qgscodeditorsettings.ui +++ b/src/ui/qgscodeditorsettings.ui @@ -702,7 +702,7 @@ - Edge + Edge/indentation guide From 5e4707fcbf779ce660a47cdc1f362753d1565d1f Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 11 Oct 2020 03:12:56 +0200 Subject: [PATCH 26/48] Enable -DQT_USE_QSTRINGBUILDER and fix related build errors Background: https://www.qt.io/blog/2011/06/13/string-concatenation-with-qstringbuilder When enabling -DQT_USE_QSTRINGBUILDER, QString() concatenation with operator + are done in a more efficient way, especially with repeated + operators. Qt and creator themselves are built with that enabled. --- CMakeLists.txt | 3 + .../processing/qgsalgorithmlayouttoimage.cpp | 2 +- .../qgsalgorithmstringconcatenation.cpp | 2 +- .../processing/qgsprojectstylealgorithms.cpp | 2 +- src/app/options/qgsoptions.cpp | 2 +- src/app/qgisapp.cpp | 12 +- src/app/qgsabout.cpp | 2 +- src/app/qgsidentifyresultsdialog.cpp | 2 +- src/app/qgstemplateprojectsmodel.cpp | 2 +- src/core/layout/qgslayoutitemhtml.cpp | 2 +- src/core/layout/qgslayoutitemlabel.cpp | 2 +- src/core/processing/qgsprocessingutils.cpp | 4 +- src/core/qgsnetworkaccessmanager.h | 4 +- src/core/symbology/qgscptcityarchive.cpp | 10 +- .../vectortile/qgsmapboxglstyleconverter.cpp | 2 +- src/gui/locator/qgslocatorwidget.cpp | 2 +- .../qgsgraduatedsymbolrendererwidget.cpp | 2 +- src/plugins/grass/qgsgrassmoduleinput.cpp | 2 +- .../postgres/qgspostgresprovider.cpp | 4 +- src/providers/wfs/qgswfsprovider.cpp | 2 +- src/server/qgsserverogcapihandler.cpp | 2 +- tests/src/analysis/testqgsprocessing.cpp | 108 +++++++++--------- tests/src/analysis/testqgsprocessingalgs.cpp | 22 ++-- tests/src/core/testqgslayoutmapgrid.cpp | 10 +- tests/src/core/testqgsproject.cpp | 4 +- tests/src/core/testqgsziputils.cpp | 2 +- tests/src/gui/testprocessinggui.cpp | 32 +++--- tests/src/gui/testqgsfilewidget.cpp | 18 +-- .../src/gui/testqgsnewdatabasetablewidget.cpp | 2 +- 29 files changed, 134 insertions(+), 131 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a5864ffdcbbc..a2324cd8d7ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -624,6 +624,9 @@ ADD_DEFINITIONS(-DQT_DEPRECATED_WARNINGS) # Unfortunately Qwt uses deprecated QString::null in headers, preventing this being raised above 5.8 ADD_DEFINITIONS(-DQT_DISABLE_DEPRECATED_BEFORE=0x050800) +# For fast string concatenation +ADD_DEFINITIONS(-DQT_USE_QSTRINGBUILDER) + IF (WITH_GEOREFERENCER) FIND_PACKAGE(GSL REQUIRED) SET(HAVE_GEOREFERENCER TRUE) diff --git a/src/analysis/processing/qgsalgorithmlayouttoimage.cpp b/src/analysis/processing/qgsalgorithmlayouttoimage.cpp index 1f2dc530389c..d99dd614123d 100644 --- a/src/analysis/processing/qgsalgorithmlayouttoimage.cpp +++ b/src/analysis/processing/qgsalgorithmlayouttoimage.cpp @@ -92,7 +92,7 @@ void QgsLayoutToImageAlgorithm::initAlgorithm( const QVariantMap & ) continue; QString longName = format.toUpper() + QObject::tr( " format" ); - QString glob = "*." + format; + QString glob = QStringLiteral( "*." ) + format; if ( format == "png" && !imageFilters.empty() ) imageFilters.insert( 0, QStringLiteral( "%1 (%2 %3)" ).arg( longName, glob.toLower(), glob.toUpper() ) ); diff --git a/src/analysis/processing/qgsalgorithmstringconcatenation.cpp b/src/analysis/processing/qgsalgorithmstringconcatenation.cpp index 97579d7f257f..8a9dda635757 100644 --- a/src/analysis/processing/qgsalgorithmstringconcatenation.cpp +++ b/src/analysis/processing/qgsalgorithmstringconcatenation.cpp @@ -72,7 +72,7 @@ QVariantMap QgsStringConcatenationAlgorithm::processAlgorithm( const QVariantMap QString input_2 = parameterAsString( parameters, QStringLiteral( "INPUT_2" ), context ); QVariantMap outputs; - outputs.insert( QStringLiteral( "CONCATENATION" ), input_1 + input_2 ); + outputs.insert( QStringLiteral( "CONCATENATION" ), QString( input_1 + input_2 ) ); return outputs; } diff --git a/src/analysis/processing/qgsprojectstylealgorithms.cpp b/src/analysis/processing/qgsprojectstylealgorithms.cpp index dd79d0c7982a..730c7b0f09b6 100644 --- a/src/analysis/processing/qgsprojectstylealgorithms.cpp +++ b/src/analysis/processing/qgsprojectstylealgorithms.cpp @@ -34,7 +34,7 @@ bool QgsSaveToStyleVisitor::visit( const QgsStyleEntityVisitorInterface::StyleLe { if ( mObjects.empty() || mObjects.contains( entity.entity->type() ) ) { - const QString name = ( mParentNames.join( ' ' ) + ' ' + entity.description ).trimmed(); + const QString name = QString( mParentNames.join( ' ' ) + ' ' + entity.description ).trimmed(); QString candidate = name; int i = 1; bool exists = true; diff --git a/src/app/options/qgsoptions.cpp b/src/app/options/qgsoptions.cpp index 4fd17b8df3eb..cb3e1289c427 100644 --- a/src/app/options/qgsoptions.cpp +++ b/src/app/options/qgsoptions.cpp @@ -793,7 +793,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QListsetChecked( mSettings->value( QStringLiteral( "/qgis/newProjectDefault" ), QVariant( false ) ).toBool() ); QString templateDirName = mSettings->value( QStringLiteral( "/qgis/projectTemplateDir" ), - QgsApplication::qgisSettingsDirPath() + "project_templates" ).toString(); + QString( QgsApplication::qgisSettingsDirPath() + "project_templates" ) ).toString(); // make dir if it doesn't exist - should just be called once QDir templateDir; if ( ! templateDir.exists( templateDirName ) ) diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 9b9f9244e79c..1542183a5b31 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -1117,7 +1117,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh mSaveRollbackInProgress = false; QString templateDirName = settings.value( QStringLiteral( "qgis/projectTemplateDir" ), - QgsApplication::qgisSettingsDirPath() + "project_templates" ).toString(); + QString( QgsApplication::qgisSettingsDirPath() + "project_templates" ) ).toString(); if ( !QFileInfo::exists( templateDirName ) ) { // create default template directory @@ -5049,7 +5049,7 @@ void QgisApp::saveRecentProjectPath( bool savePreviewImage, const QIcon &iconOve QgsRecentProjectItemsModel::RecentProjectData projectData; projectData.path = QgsProject::instance()->absoluteFilePath(); QString templateDirName = QgsSettings().value( QStringLiteral( "qgis/projectTemplateDir" ), - QgsApplication::qgisSettingsDirPath() + "project_templates" ).toString(); + QString( QgsApplication::qgisSettingsDirPath() + "project_templates" ) ).toString(); // We don't want the template path to appear in the recent projects list. Never. if ( projectData.path.startsWith( templateDirName ) ) @@ -5160,7 +5160,7 @@ void QgisApp::updateProjectFromTemplates() // get list of project files in template dir QgsSettings settings; QString templateDirName = settings.value( QStringLiteral( "qgis/projectTemplateDir" ), - QgsApplication::qgisSettingsDirPath() + "project_templates" ).toString(); + QString( QgsApplication::qgisSettingsDirPath() + "project_templates" ) ).toString(); QDir templateDir( templateDirName ); QStringList filters( QStringLiteral( "*.qgs" ) ); filters << QStringLiteral( "*.qgz" ); @@ -6672,7 +6672,7 @@ void QgisApp::fileNewFromTemplateAction( QAction *qAction ) { QgsSettings settings; QString templateDirName = settings.value( QStringLiteral( "qgis/projectTemplateDir" ), - QgsApplication::qgisSettingsDirPath() + "project_templates" ).toString(); + QString( QgsApplication::qgisSettingsDirPath() + "project_templates" ) ).toString(); fileNewFromTemplate( templateDirName + QDir::separator() + qAction->text() ); } } @@ -7243,7 +7243,7 @@ void QgisApp::fileSaveAs() // Retrieve last used project dir from persistent settings QgsSettings settings; defaultPath = settings.value( QStringLiteral( "UI/lastProjectDir" ), QDir::homePath() ).toString(); - defaultPath += + '/' + QgsProject::instance()->title(); + defaultPath += QString( '/' + QgsProject::instance()->title() ); } const QString qgsExt = tr( "QGIS files" ) + " (*.qgs *.QGS)"; @@ -16484,7 +16484,7 @@ void QgisApp::populateProjectStorageMenu( QMenu *menu, const bool saving ) { QgsSettings settings; QString templateDirName = settings.value( QStringLiteral( "qgis/projectTemplateDir" ), - QgsApplication::qgisSettingsDirPath() + "project_templates" ).toString(); + QString( QgsApplication::qgisSettingsDirPath() + "project_templates" ) ).toString(); const QString originalFilename = QgsProject::instance()->fileName(); QString templateName = QFileInfo( originalFilename ).baseName(); diff --git a/src/app/qgsabout.cpp b/src/app/qgsabout.cpp index 94c4693f236f..932faa53af09 100644 --- a/src/app/qgsabout.cpp +++ b/src/app/qgsabout.cpp @@ -233,7 +233,7 @@ void QgsAbout::setWhatsNew() if ( !QFile::exists( QgsApplication::pkgDataPath() + "/doc/NEWS.html" ) ) return; - txtWhatsNew->setSource( "file:///" + QgsApplication::pkgDataPath() + "/doc/NEWS.html" ); + txtWhatsNew->setSource( QString( "file:///" + QgsApplication::pkgDataPath() + "/doc/NEWS.html" ) ); } void QgsAbout::setPluginInfo() diff --git a/src/app/qgsidentifyresultsdialog.cpp b/src/app/qgsidentifyresultsdialog.cpp index 14c553aed947..984818d42a67 100644 --- a/src/app/qgsidentifyresultsdialog.cpp +++ b/src/app/qgsidentifyresultsdialog.cpp @@ -574,7 +574,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat item = new QTableWidgetItem( QString::number( i ) ); if ( fields.at( i ).name() == vlayer->displayField() ) - item->setData( Qt::DisplayRole, vlayer->attributeDisplayName( i ) + " *" ); + item->setData( Qt::DisplayRole, QString( vlayer->attributeDisplayName( i ) + " *" ) ); else item->setData( Qt::DisplayRole, vlayer->attributeDisplayName( i ) ); item->setData( Qt::UserRole, fields.at( i ).name() ); diff --git a/src/app/qgstemplateprojectsmodel.cpp b/src/app/qgstemplateprojectsmodel.cpp index b6a8e82b8026..5b0102f8885a 100644 --- a/src/app/qgstemplateprojectsmodel.cpp +++ b/src/app/qgstemplateprojectsmodel.cpp @@ -34,7 +34,7 @@ QgsTemplateProjectsModel::QgsTemplateProjectsModel( QObject *parent ) { const QStringList paths = QStandardPaths::standardLocations( QStandardPaths::AppDataLocation ); QString templateDirName = QgsSettings().value( QStringLiteral( "qgis/projectTemplateDir" ), - QgsApplication::qgisSettingsDirPath() + QStringLiteral( "project_templates" ) ).toString(); + QString( QgsApplication::qgisSettingsDirPath() + QStringLiteral( "project_templates" ) ) ).toString(); for ( const QString &templatePath : paths ) { diff --git a/src/core/layout/qgslayoutitemhtml.cpp b/src/core/layout/qgslayoutitemhtml.cpp index 5bf729635598..1980bcc6bef3 100644 --- a/src/core/layout/qgslayoutitemhtml.cpp +++ b/src/core/layout/qgslayoutitemhtml.cpp @@ -198,7 +198,7 @@ void QgsLayoutItemHtml::loadHtml( const bool useCache, const QgsExpressionContex { QByteArray ba; ba.append( mUserStylesheet.toUtf8() ); - QUrl cssFileURL = QUrl( "data:text/css;charset=utf-8;base64," + ba.toBase64() ); + QUrl cssFileURL = QUrl( QString( "data:text/css;charset=utf-8;base64," + ba.toBase64() ) ); settings->setUserStyleSheetUrl( cssFileURL ); } else diff --git a/src/core/layout/qgslayoutitemlabel.cpp b/src/core/layout/qgslayoutitemlabel.cpp index 4ee7f74d5395..e43874f9329e 100644 --- a/src/core/layout/qgslayoutitemlabel.cpp +++ b/src/core/layout/qgslayoutitemlabel.cpp @@ -611,7 +611,7 @@ QUrl QgsLayoutItemLabel::createStylesheetUrl() const QByteArray ba; ba.append( stylesheet.toUtf8() ); - QUrl cssFileURL = QUrl( "data:text/css;charset=utf-8;base64," + ba.toBase64() ); + QUrl cssFileURL = QUrl( QString( "data:text/css;charset=utf-8;base64," + ba.toBase64() ) ); return cssFileURL; } diff --git a/src/core/processing/qgsprocessingutils.cpp b/src/core/processing/qgsprocessingutils.cpp index 46fbcf97e926..6198194dd693 100644 --- a/src/core/processing/qgsprocessingutils.cpp +++ b/src/core/processing/qgsprocessingutils.cpp @@ -908,14 +908,14 @@ QVariant QgsProcessingUtils::generateIteratingDestination( const QVariant &input } else if ( res.startsWith( QLatin1String( "memory:" ) ) ) { - return res + '_' + id.toString(); + return QString( res + '_' + id.toString() ); } else { // assume a filename type output for now // TODO - uris? int lastIndex = res.lastIndexOf( '.' ); - return res.left( lastIndex ) + '_' + id.toString() + res.mid( lastIndex ); + return QString( res.left( lastIndex ) + '_' + id.toString() + res.mid( lastIndex ) ); } } } diff --git a/src/core/qgsnetworkaccessmanager.h b/src/core/qgsnetworkaccessmanager.h index f5f22963cb89..97ca9ee06cbc 100644 --- a/src/core/qgsnetworkaccessmanager.h +++ b/src/core/qgsnetworkaccessmanager.h @@ -38,8 +38,8 @@ class QgsFeedback; #include "qgsconfig.h" constexpr int sFilePrefixLength = CMAKE_SOURCE_DIR[sizeof( CMAKE_SOURCE_DIR ) - 1] == '/' ? sizeof( CMAKE_SOURCE_DIR ) + 1 : sizeof( CMAKE_SOURCE_DIR ); -#define QgsSetRequestInitiatorClass(request, _class) request.setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorClass ), _class ); request.setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorRequestId ), QString( __FILE__ ).mid( sFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + __FUNCTION__ + ")" ); -#define QgsSetRequestInitiatorId(request, str) request.setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorRequestId ), QString( __FILE__ ).mid( sFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + __FUNCTION__ + "): " + str ); +#define QgsSetRequestInitiatorClass(request, _class) request.setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorClass ), _class ); request.setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorRequestId ), QString(QString( __FILE__ ).mid( sFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + __FUNCTION__ + ")") ); +#define QgsSetRequestInitiatorId(request, str) request.setAttribute( static_cast< QNetworkRequest::Attribute >( QgsNetworkRequestParameters::AttributeInitiatorRequestId ), QString(QString( __FILE__ ).mid( sFilePrefixLength ) + ':' + QString::number( __LINE__ ) + " (" + __FUNCTION__ + "): " + str) ); #endif /** diff --git a/src/core/symbology/qgscptcityarchive.cpp b/src/core/symbology/qgscptcityarchive.cpp index 7c0abe344a79..5b20320163d4 100644 --- a/src/core/symbology/qgscptcityarchive.cpp +++ b/src/core/symbology/qgscptcityarchive.cpp @@ -138,7 +138,7 @@ QString QgsCptCityArchive::defaultBaseDir() // use CptCity/baseDir setting if set, default is user dir baseDir = settings.value( QStringLiteral( "CptCity/baseDir" ), - QgsApplication::pkgDataPath() + "/resources" ).toString(); + QString( QgsApplication::pkgDataPath() + "/resources" ) ).toString(); // sub-dir defaults to cpt-city archiveName = settings.value( QStringLiteral( "CptCity/archiveName" ), DEFAULT_CPTCITY_ARCHIVE ).toString(); @@ -447,7 +447,7 @@ void QgsCptCityArchive::initDefaultArchive() QgsSettings settings; // use CptCity/baseDir setting if set, default is user dir QString baseDir = settings.value( QStringLiteral( "CptCity/baseDir" ), - QgsApplication::pkgDataPath() + "/resources" ).toString(); + QString( QgsApplication::pkgDataPath() + "/resources" ) ).toString(); // sub-dir defaults to QString defArchiveName = settings.value( QStringLiteral( "CptCity/archiveName" ), DEFAULT_CPTCITY_ARCHIVE ).toString(); @@ -463,7 +463,7 @@ void QgsCptCityArchive::initArchives( bool loadAll ) // use CptCity/baseDir setting if set, default is user dir baseDir = settings.value( QStringLiteral( "CptCity/baseDir" ), - QgsApplication::pkgDataPath() + "/resources" ).toString(); + QString( QgsApplication::pkgDataPath() + "/resources" ) ).toString(); // sub-dir defaults to defArchiveName = settings.value( QStringLiteral( "CptCity/archiveName" ), DEFAULT_CPTCITY_ARCHIVE ).toString(); @@ -1312,7 +1312,7 @@ QgsCptCityBrowserModel::QgsCptCityBrowserModel( QObject *parent, , mViewType( viewType ) { Q_ASSERT( mArchive ); - QgsDebugMsg( "archiveName = " + archive->archiveName() + " viewType=" + static_cast< int >( viewType ) ); + QgsDebugMsg( QLatin1String( "archiveName = " ) + archive->archiveName() + " viewType=" + QString::number( static_cast< int >( viewType ) ) ); // keep iconsize for now, but not effectively used mIconSize = QSize( 100, 15 ); addRootItems(); @@ -1381,7 +1381,7 @@ QVariant QgsCptCityBrowserModel::data( const QModelIndex &index, int role ) cons { if ( item->type() == QgsCptCityDataItem::ColorRamp && mViewType == List ) - return item->path() + '\n' + item->info(); + return QString( item->path() + '\n' + item->info() ); return item->toolTip(); } else if ( role == Qt::DecorationRole && index.column() == 1 && diff --git a/src/core/vectortile/qgsmapboxglstyleconverter.cpp b/src/core/vectortile/qgsmapboxglstyleconverter.cpp index 782f6c3d1213..2c6d75c7653c 100644 --- a/src/core/vectortile/qgsmapboxglstyleconverter.cpp +++ b/src/core/vectortile/qgsmapboxglstyleconverter.cpp @@ -2303,7 +2303,7 @@ QString QgsMapBoxGlStyleConverter::parseExpression( const QVariantList &expressi { // ! inverts next expression's meaning QVariantList contraJsonExpr = expression.value( 1 ).toList(); - contraJsonExpr[0] = op + contraJsonExpr[0].toString(); + contraJsonExpr[0] = QString( op + contraJsonExpr[0].toString() ); // ['!', ['has', 'level']] -> ['!has', 'level'] return parseKey( contraJsonExpr ); } diff --git a/src/gui/locator/qgslocatorwidget.cpp b/src/gui/locator/qgslocatorwidget.cpp index 7192a2d0d2e4..657fe5a833b2 100644 --- a/src/gui/locator/qgslocatorwidget.cpp +++ b/src/gui/locator/qgslocatorwidget.cpp @@ -439,7 +439,7 @@ void QgsLocatorFilterFilter::fetchResults( const QString &string, const QgsLocat QgsLocatorResult result; result.displayString = filter->activePrefix(); result.description = filter->displayName(); - result.userData = filter->activePrefix() + ' '; + result.userData = QString( filter->activePrefix() + ' ' ); result.icon = QgsApplication::getThemeIcon( QStringLiteral( "/search.svg" ) ); emit resultFetched( result ); } diff --git a/src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp b/src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp index 717911cbcfa6..338620756b98 100644 --- a/src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp +++ b/src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp @@ -165,7 +165,7 @@ QVariant QgsGraduatedSymbolRendererModel::data( const QModelIndex &index, int ro { int decimalPlaces = mRenderer->classificationMethod()->labelPrecision() + 2; if ( decimalPlaces < 0 ) decimalPlaces = 0; - return QLocale().toString( range.lowerValue(), 'f', decimalPlaces ) + " - " + QLocale().toString( range.upperValue(), 'f', decimalPlaces ); + return QString( QLocale().toString( range.lowerValue(), 'f', decimalPlaces ) + " - " + QLocale().toString( range.upperValue(), 'f', decimalPlaces ) ); } case 2: return range.label(); diff --git a/src/plugins/grass/qgsgrassmoduleinput.cpp b/src/plugins/grass/qgsgrassmoduleinput.cpp index 55e38baacb3e..9487c56724c7 100644 --- a/src/plugins/grass/qgsgrassmoduleinput.cpp +++ b/src/plugins/grass/qgsgrassmoduleinput.cpp @@ -332,7 +332,7 @@ QVariant QgsGrassModuleInputModel::data( const QModelIndex &index, int role ) co QString mapset = QStandardItemModel::data( index, QgsGrassModuleInputModel::MapsetRole ).toString(); if ( mapset != QgsGrass::getDefaultMapset() ) { - data = data.toString() + "@" + mapset; + data = QString( data.toString() + "@" + mapset ); } } } diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp index c391627ae1d2..b54716003553 100644 --- a/src/providers/postgres/qgspostgresprovider.cpp +++ b/src/providers/postgres/qgspostgresprovider.cpp @@ -4935,9 +4935,9 @@ QList QgsPostgresProvider::discoverRelations( const QgsVectorLayer " FROM pg_constraint c " " WHERE contype = 'f' " " AND c.conrelid::regclass = " + - QgsPostgresConn::quotedValue( QgsPostgresConn::quotedIdentifier( mSchemaName ) + + QgsPostgresConn::quotedValue( QString( QgsPostgresConn::quotedIdentifier( mSchemaName ) + '.' + - QgsPostgresConn::quotedIdentifier( mTableName ) ) + + QgsPostgresConn::quotedIdentifier( mTableName ) ) ) + "::regclass ) " "SELECT fk.conname as constraint_name, " " a.attname as column_name, " diff --git a/src/providers/wfs/qgswfsprovider.cpp b/src/providers/wfs/qgswfsprovider.cpp index b8a6a8b09920..541e342a079a 100644 --- a/src/providers/wfs/qgswfsprovider.cpp +++ b/src/providers/wfs/qgswfsprovider.cpp @@ -185,7 +185,7 @@ void QgsWFSProviderSQLFunctionValidator::visit( const QgsSQLStatement::NodeFunct for ( const QgsWfsCapabilities::Function &f : constMSpatialPredicatesList ) { if ( n.name().compare( f.name, Qt::CaseInsensitive ) == 0 || - ( "ST_" + n.name() ).compare( f.name, Qt::CaseInsensitive ) == 0 ) + QString( "ST_" + n.name() ).compare( f.name, Qt::CaseInsensitive ) == 0 ) { foundMatch = true; } diff --git a/src/server/qgsserverogcapihandler.cpp b/src/server/qgsserverogcapihandler.cpp index 982146ede7a7..3880508a4efe 100644 --- a/src/server/qgsserverogcapihandler.cpp +++ b/src/server/qgsserverogcapihandler.cpp @@ -287,7 +287,7 @@ void QgsServerOgcApiHandler::htmlDump( const json &data, const QgsServerApiConte { // Get the template directory and the file name QFileInfo pathInfo { path }; - Environment env { ( pathInfo.dir().path() + QDir::separator() ).toStdString() }; + Environment env { QString( pathInfo.dir().path() + QDir::separator() ).toStdString() }; // For template debugging: env.add_callback( "json_dump", 0, [ = ]( Arguments & ) diff --git a/tests/src/analysis/testqgsprocessing.cpp b/tests/src/analysis/testqgsprocessing.cpp index 60c16136e99c..487e0618d488 100644 --- a/tests/src/analysis/testqgsprocessing.cpp +++ b/tests/src/analysis/testqgsprocessing.cpp @@ -2183,7 +2183,7 @@ void TestQgsProcessing::parameters() QVERIFY( context.temporaryLayerStore()->mapLayers().isEmpty() ); QString testDataDir = QStringLiteral( TEST_DATA_DIR ) + '/'; //defined in CmakeLists.txt - f.setAttribute( 0, testDataDir + "/raster/band1_float32_noct_epsg4326.tif" ); + f.setAttribute( 0, QString( testDataDir + "/raster/band1_float32_noct_epsg4326.tif" ) ); context.expressionContext().setFeature( f ); def->setName( QStringLiteral( "prop" ) ); QVERIFY( QgsProcessingParameters::parameterAsLayer( def.get(), params, context ) ); @@ -2648,8 +2648,8 @@ void TestQgsProcessing::parameterCrs() QCOMPARE( def->valueAsPythonString( "EPSG:12003", context ), QStringLiteral( "'EPSG:12003'" ) ); QCOMPARE( def->valueAsPythonString( "ProjectCrs", context ), QStringLiteral( "'ProjectCrs'" ) ); QCOMPARE( def->valueAsPythonString( QStringLiteral( "c:\\test\\new data\\test.dat" ), context ), QStringLiteral( "'c:\\\\test\\\\new data\\\\test.dat'" ) ); - QCOMPARE( def->valueAsPythonString( raster1, context ), QString( "'" ) + testDataDir + QStringLiteral( "landsat_4326.tif'" ) ); - QCOMPARE( def->valueAsPythonString( r1->id(), context ), QString( "'" ) + testDataDir + QStringLiteral( "landsat_4326.tif'" ) ); + QCOMPARE( def->valueAsPythonString( raster1, context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "landsat_4326.tif'" ) ) ); + QCOMPARE( def->valueAsPythonString( r1->id(), context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "landsat_4326.tif'" ) ) ); QCOMPARE( def->valueAsPythonString( QVariant::fromValue( QgsProperty::fromExpression( "\"a\"=1" ) ), context ), QStringLiteral( "QgsProperty.fromExpression('\"a\"=1')" ) ); QCOMPARE( def->valueAsPythonString( "uri='complex' username=\"complex\"", context ), QStringLiteral( "'uri=\\'complex\\' username=\\\"complex\\\"'" ) ); @@ -2771,9 +2771,9 @@ void TestQgsProcessing::parameterMapLayer() QCOMPARE( QgsProcessingParameters::parameterAsLayer( def.get(), params, context ), v1 ); QCOMPARE( def->valueAsPythonString( QVariant(), context ), QStringLiteral( "None" ) ); - QCOMPARE( def->valueAsPythonString( raster1, context ), QString( "'" ) + testDataDir + QStringLiteral( "tenbytenraster.asc'" ) ); - QCOMPARE( def->valueAsPythonString( r1->id(), context ), QString( "'" ) + testDataDir + QStringLiteral( "tenbytenraster.asc'" ) ); - QCOMPARE( def->valueAsPythonString( QVariant::fromValue( r1 ), context ), QString( "'" ) + testDataDir + QStringLiteral( "tenbytenraster.asc'" ) ); + QCOMPARE( def->valueAsPythonString( raster1, context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "tenbytenraster.asc'" ) ) ); + QCOMPARE( def->valueAsPythonString( r1->id(), context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "tenbytenraster.asc'" ) ) ); + QCOMPARE( def->valueAsPythonString( QVariant::fromValue( r1 ), context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "tenbytenraster.asc'" ) ) ); QCOMPARE( def->valueAsPythonString( QVariant::fromValue( QgsProperty::fromExpression( "\"a\"=1" ) ), context ), QStringLiteral( "QgsProperty.fromExpression('\"a\"=1')" ) ); QCOMPARE( def->valueAsPythonString( QStringLiteral( "c:\\test\\new data\\test.dat" ), context ), QStringLiteral( "'c:\\\\test\\\\new data\\\\test.dat'" ) ); @@ -2850,10 +2850,10 @@ void TestQgsProcessing::parameterMapLayer() QVERIFY( def->checkValueIsAcceptable( QVariant::fromValue( v1 ) ) ); pythonCode = def->asPythonString(); - QCOMPARE( pythonCode, QStringLiteral( "QgsProcessingParameterMapLayer('optional', '', optional=True, defaultValue='" ) + v1->id() + "')" ); + QCOMPARE( pythonCode, QString( QStringLiteral( "QgsProcessingParameterMapLayer('optional', '', optional=True, defaultValue='" ) + v1->id() + "')" ) ); code = def->asScriptCode(); - QCOMPARE( code, QStringLiteral( "##optional=optional layer " ) + v1->id() ); + QCOMPARE( code, QString( QStringLiteral( "##optional=optional layer " ) + v1->id() ) ); fromCode.reset( dynamic_cast< QgsProcessingParameterMapLayer * >( QgsProcessingParameters::parameterFromScriptCode( code ) ) ); QVERIFY( fromCode.get() ); QCOMPARE( fromCode->name(), def->name() ); @@ -3139,9 +3139,9 @@ void TestQgsProcessing::parameterExtent() QCOMPARE( def->valueAsPythonString( QVariant(), context ), QStringLiteral( "None" ) ); QCOMPARE( def->valueAsPythonString( "1,2,3,4", context ), QStringLiteral( "'1,2,3,4'" ) ); - QCOMPARE( def->valueAsPythonString( r1->id(), context ), QString( "'" ) + testDataDir + QStringLiteral( "landsat_4326.tif'" ) ); - QCOMPARE( def->valueAsPythonString( QVariant::fromValue( r1 ), context ), QString( "'" ) + testDataDir + QStringLiteral( "landsat_4326.tif'" ) ); - QCOMPARE( def->valueAsPythonString( raster2, context ), QString( "'" ) + testDataDir + QStringLiteral( "landsat.tif'" ) ); + QCOMPARE( def->valueAsPythonString( r1->id(), context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "landsat_4326.tif'" ) ) ); + QCOMPARE( def->valueAsPythonString( QVariant::fromValue( r1 ), context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "landsat_4326.tif'" ) ) ); + QCOMPARE( def->valueAsPythonString( raster2, context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "landsat.tif'" ) ) ); QCOMPARE( def->valueAsPythonString( QVariant::fromValue( QgsProperty::fromExpression( "\"a\"=1" ) ), context ), QStringLiteral( "QgsProperty.fromExpression('\"a\"=1')" ) ); QCOMPARE( def->valueAsPythonString( QgsRectangle( 11, 12, 13, 14 ), context ), QStringLiteral( "'11, 13, 12, 14'" ) ); QCOMPARE( def->valueAsPythonString( QgsReferencedRectangle( QgsRectangle( 11, 12, 13, 14 ), QgsCoordinateReferenceSystem( "epsg:4326" ) ), context ), QStringLiteral( "'11, 13, 12, 14 [EPSG:4326]'" ) ); @@ -3929,9 +3929,9 @@ void TestQgsProcessing::parameterLayerList() QCOMPARE( def->valueAsPythonString( QVariant(), context ), QStringLiteral( "None" ) ); QCOMPARE( def->valueAsPythonString( "layer12312312", context ), QStringLiteral( "'layer12312312'" ) ); - QCOMPARE( def->valueAsPythonString( QVariant::fromValue( r1 ), context ), QStringLiteral( "['" ) + testDataDir + QStringLiteral( "tenbytenraster.asc']" ) ); - QCOMPARE( def->valueAsPythonString( r1->id(), context ), QStringLiteral( "['" ) + testDataDir + QStringLiteral( "tenbytenraster.asc']" ) ); - QCOMPARE( def->valueAsPythonString( QStringList() << r1->id() << raster2, context ), QStringLiteral( "['" ) + testDataDir + QStringLiteral( "tenbytenraster.asc','" ) + testDataDir + QStringLiteral( "landsat.tif']" ) ); + QCOMPARE( def->valueAsPythonString( QVariant::fromValue( r1 ), context ), QString( QStringLiteral( "['" ) + testDataDir + QStringLiteral( "tenbytenraster.asc']" ) ) ); + QCOMPARE( def->valueAsPythonString( r1->id(), context ), QString( QStringLiteral( "['" ) + testDataDir + QStringLiteral( "tenbytenraster.asc']" ) ) ); + QCOMPARE( def->valueAsPythonString( QStringList() << r1->id() << raster2, context ), QString( QStringLiteral( "['" ) + testDataDir + QStringLiteral( "tenbytenraster.asc','" ) + testDataDir + QStringLiteral( "landsat.tif']" ) ) ); QCOMPARE( def->valueAsPythonString( QVariant::fromValue( QgsProperty::fromExpression( "\"a\"=1" ) ), context ), QStringLiteral( "QgsProperty.fromExpression('\"a\"=1')" ) ); QCOMPARE( def->valueAsPythonString( "uri='complex' username=\"complex\"", context ), QStringLiteral( "'uri=\\'complex\\' username=\\\"complex\\\"'" ) ); @@ -3986,10 +3986,10 @@ void TestQgsProcessing::parameterLayerList() QCOMPARE( QgsProcessingParameters::parameterAsLayerList( def.get(), params, context ), QList< QgsMapLayer *>() << r1 ); pythonCode = def->asPythonString(); - QCOMPARE( pythonCode, QStringLiteral( "QgsProcessingParameterMultipleLayers('optional', '', optional=True, layerType=QgsProcessing.TypeMapLayer, defaultValue='" ) + v1->id() + "')" ); + QCOMPARE( pythonCode, QString( QStringLiteral( "QgsProcessingParameterMultipleLayers('optional', '', optional=True, layerType=QgsProcessing.TypeMapLayer, defaultValue='" ) + v1->id() + "')" ) ); code = def->asScriptCode(); - QCOMPARE( code, QStringLiteral( "##optional=optional multiple vector " ) + v1->id() ); + QCOMPARE( code, QString( QStringLiteral( "##optional=optional multiple vector " ) + v1->id() ) ); fromCode.reset( dynamic_cast< QgsProcessingParameterMultipleLayers * >( QgsProcessingParameters::parameterFromScriptCode( code ) ) ); QVERIFY( fromCode.get() ); QCOMPARE( fromCode->name(), def->name() ); @@ -4008,16 +4008,16 @@ void TestQgsProcessing::parameterLayerList() QVERIFY( def->createFileFilter().contains( QStringLiteral( "*.*" ) ) ); pythonCode = def->asPythonString(); - QCOMPARE( pythonCode, QStringLiteral( "QgsProcessingParameterMultipleLayers('optional', '', optional=True, layerType=QgsProcessing.TypeMapLayer, defaultValue=['" ) + r1->publicSource() + "'])" ); + QCOMPARE( pythonCode, QString( QStringLiteral( "QgsProcessingParameterMultipleLayers('optional', '', optional=True, layerType=QgsProcessing.TypeMapLayer, defaultValue=['" ) + r1->publicSource() + "'])" ) ); code = def->asScriptCode(); - QCOMPARE( code, QStringLiteral( "##optional=optional multiple vector " ) + v1->id() + "," + r1->publicSource() ); + QCOMPARE( code, QString( QStringLiteral( "##optional=optional multiple vector " ) + v1->id() + "," + r1->publicSource() ) ); fromCode.reset( dynamic_cast< QgsProcessingParameterMultipleLayers * >( QgsProcessingParameters::parameterFromScriptCode( code ) ) ); QVERIFY( fromCode.get() ); QCOMPARE( fromCode->name(), def->name() ); QCOMPARE( fromCode->description(), QStringLiteral( "optional" ) ); QCOMPARE( fromCode->flags(), def->flags() ); - QCOMPARE( fromCode->defaultValue().toString(), v1->id() + "," + r1->publicSource() ); + QCOMPARE( fromCode->defaultValue().toString(), QString( v1->id() + "," + r1->publicSource() ) ); QCOMPARE( fromCode->layerType(), QgsProcessing::TypeVectorAnyGeometry ); // optional with one default direct layer @@ -4676,9 +4676,9 @@ void TestQgsProcessing::parameterRasterLayer() QVERIFY( !QgsProcessingParameters::parameterAsRasterLayer( def.get(), params, context ) ); QCOMPARE( def->valueAsPythonString( QVariant(), context ), QStringLiteral( "None" ) ); - QCOMPARE( def->valueAsPythonString( raster1, context ), QString( "'" ) + testDataDir + QStringLiteral( "tenbytenraster.asc'" ) ); - QCOMPARE( def->valueAsPythonString( r1->id(), context ), QString( "'" ) + testDataDir + QStringLiteral( "tenbytenraster.asc'" ) ); - QCOMPARE( def->valueAsPythonString( QVariant::fromValue( r1 ), context ), QString( "'" ) + testDataDir + QStringLiteral( "tenbytenraster.asc'" ) ); + QCOMPARE( def->valueAsPythonString( raster1, context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "tenbytenraster.asc'" ) ) ); + QCOMPARE( def->valueAsPythonString( r1->id(), context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "tenbytenraster.asc'" ) ) ); + QCOMPARE( def->valueAsPythonString( QVariant::fromValue( r1 ), context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "tenbytenraster.asc'" ) ) ); QCOMPARE( def->valueAsPythonString( QVariant::fromValue( QgsProperty::fromExpression( "\"a\"=1" ) ), context ), QStringLiteral( "QgsProperty.fromExpression('\"a\"=1')" ) ); QCOMPARE( def->valueAsPythonString( QStringLiteral( "c:\\test\\new data\\test.dat" ), context ), QStringLiteral( "'c:\\\\test\\\\new data\\\\test.dat'" ) ); @@ -4709,10 +4709,10 @@ void TestQgsProcessing::parameterRasterLayer() QCOMPARE( QgsProcessingParameters::parameterAsRasterLayer( def.get(), params, context )->id(), r1->id() ); pythonCode = def->asPythonString(); - QCOMPARE( pythonCode, QStringLiteral( "QgsProcessingParameterRasterLayer('optional', '', optional=True, defaultValue='" ) + r1->id() + "')" ); + QCOMPARE( pythonCode, QString( QStringLiteral( "QgsProcessingParameterRasterLayer('optional', '', optional=True, defaultValue='" ) + r1->id() + "')" ) ); code = def->asScriptCode(); - QCOMPARE( code, QStringLiteral( "##optional=optional raster " ) + r1->id() ); + QCOMPARE( code, QString( QStringLiteral( "##optional=optional raster " ) + r1->id() ) ); fromCode.reset( dynamic_cast< QgsProcessingParameterRasterLayer * >( QgsProcessingParameters::parameterFromScriptCode( code ) ) ); QVERIFY( fromCode.get() ); QCOMPARE( fromCode->name(), def->name() ); @@ -5635,9 +5635,9 @@ void TestQgsProcessing::parameterVectorLayer() QVERIFY( !QgsProcessingParameters::parameterAsVectorLayer( def.get(), params, context ) ); QCOMPARE( def->valueAsPythonString( QVariant(), context ), QStringLiteral( "None" ) ); - QCOMPARE( def->valueAsPythonString( vector1, context ), QString( "'" ) + testDataDir + QStringLiteral( "multipoint.shp'" ) ); - QCOMPARE( def->valueAsPythonString( v1->id(), context ), QString( "'" ) + testDataDir + QStringLiteral( "multipoint.shp'" ) ); - QCOMPARE( def->valueAsPythonString( QVariant::fromValue( v1 ), context ), QString( "'" ) + testDataDir + QStringLiteral( "multipoint.shp'" ) ); + QCOMPARE( def->valueAsPythonString( vector1, context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "multipoint.shp'" ) ) ); + QCOMPARE( def->valueAsPythonString( v1->id(), context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "multipoint.shp'" ) ) ); + QCOMPARE( def->valueAsPythonString( QVariant::fromValue( v1 ), context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "multipoint.shp'" ) ) ); QCOMPARE( def->valueAsPythonString( QVariant::fromValue( QgsProperty::fromExpression( "\"a\"=1" ) ), context ), QStringLiteral( "QgsProperty.fromExpression('\"a\"=1')" ) ); QCOMPARE( def->valueAsPythonString( QStringLiteral( "c:\\test\\new data\\test.dat" ), context ), QStringLiteral( "'c:\\\\test\\\\new data\\\\test.dat'" ) ); @@ -5677,10 +5677,10 @@ void TestQgsProcessing::parameterVectorLayer() QVERIFY( def->checkValueIsAcceptable( QgsProcessingFeatureSourceDefinition( "layer1231123" ) ) ); pythonCode = def->asPythonString(); - QCOMPARE( pythonCode, QStringLiteral( "QgsProcessingParameterVectorLayer('optional', '', optional=True, defaultValue='" ) + v1->id() + "')" ); + QCOMPARE( pythonCode, QString( QStringLiteral( "QgsProcessingParameterVectorLayer('optional', '', optional=True, defaultValue='" ) + v1->id() + "')" ) ); code = def->asScriptCode(); - QCOMPARE( code, QStringLiteral( "##optional=optional vector " ) + v1->id() ); + QCOMPARE( code, QString( QStringLiteral( "##optional=optional vector " ) + v1->id() ) ); fromCode.reset( dynamic_cast< QgsProcessingParameterVectorLayer * >( QgsProcessingParameters::parameterFromScriptCode( code ) ) ); QVERIFY( fromCode.get() ); QCOMPARE( fromCode->name(), def->name() ); @@ -5764,9 +5764,9 @@ void TestQgsProcessing::parameterMeshLayer() QVERIFY( !QgsProcessingParameters::parameterAsVectorLayer( def.get(), params, context ) ); QCOMPARE( def->valueAsPythonString( QVariant(), context ), QStringLiteral( "None" ) ); - QCOMPARE( def->valueAsPythonString( mesh, context ), QString( "'" ) + testDataDir + QStringLiteral( "mesh/quad_and_triangle.2dm'" ) ); - QCOMPARE( def->valueAsPythonString( m1->id(), context ), QString( "'" ) + testDataDir + QStringLiteral( "mesh/quad_and_triangle.2dm'" ) ); - QCOMPARE( def->valueAsPythonString( QVariant::fromValue( m1 ), context ), QString( "'" ) + testDataDir + QStringLiteral( "mesh/quad_and_triangle.2dm'" ) ); + QCOMPARE( def->valueAsPythonString( mesh, context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "mesh/quad_and_triangle.2dm'" ) ) ); + QCOMPARE( def->valueAsPythonString( m1->id(), context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "mesh/quad_and_triangle.2dm'" ) ) ); + QCOMPARE( def->valueAsPythonString( QVariant::fromValue( m1 ), context ), QString( QString( "'" ) + testDataDir + QStringLiteral( "mesh/quad_and_triangle.2dm'" ) ) ); QCOMPARE( def->valueAsPythonString( QVariant::fromValue( QgsProperty::fromExpression( "\"a\"=1" ) ), context ), QStringLiteral( "QgsProperty.fromExpression('\"a\"=1')" ) ); QCOMPARE( def->valueAsPythonString( QStringLiteral( "c:\\test\\new data\\test.2dm" ), context ), QStringLiteral( "'c:\\\\test\\\\new data\\\\test.2dm'" ) ); @@ -5806,10 +5806,10 @@ void TestQgsProcessing::parameterMeshLayer() QVERIFY( def->checkValueIsAcceptable( QgsProcessingFeatureSourceDefinition( "layer1231123" ) ) ); pythonCode = def->asPythonString(); - QCOMPARE( pythonCode, QStringLiteral( "QgsProcessingParameterMeshLayer('optional', '', optional=True, defaultValue='" ) + m1->id() + "')" ); + QCOMPARE( pythonCode, QString( QStringLiteral( "QgsProcessingParameterMeshLayer('optional', '', optional=True, defaultValue='" ) + m1->id() + "')" ) ); code = def->asScriptCode(); - QCOMPARE( code, QStringLiteral( "##optional=optional mesh " ) + m1->id() ); + QCOMPARE( code, QString( QStringLiteral( "##optional=optional mesh " ) + m1->id() ) ); fromCode.reset( dynamic_cast< QgsProcessingParameterMeshLayer * >( QgsProcessingParameters::parameterFromScriptCode( code ) ) ); QVERIFY( fromCode.get() ); QCOMPARE( fromCode->name(), def->name() ); @@ -5977,9 +5977,9 @@ void TestQgsProcessing::parameterFeatureSource() QVERIFY( def->checkValueIsAcceptable( QgsProcessingFeatureSourceDefinition( "layer1231123" ) ) ); pythonCode = def->asPythonString(); - QCOMPARE( pythonCode, QStringLiteral( "QgsProcessingParameterFeatureSource('optional', '', optional=True, types=[QgsProcessing.TypeVectorAnyGeometry], defaultValue='" ) + v1->id() + "')" ); + QCOMPARE( pythonCode, QString( QStringLiteral( "QgsProcessingParameterFeatureSource('optional', '', optional=True, types=[QgsProcessing.TypeVectorAnyGeometry], defaultValue='" ) + v1->id() + "')" ) ); code = def->asScriptCode(); - QCOMPARE( code, QStringLiteral( "##optional=optional source " ) + v1->id() ); + QCOMPARE( code, QString( QStringLiteral( "##optional=optional source " ) + v1->id() ) ); fromCode.reset( dynamic_cast< QgsProcessingParameterFeatureSource * >( QgsProcessingParameters::parameterFromScriptCode( code ) ) ); QVERIFY( fromCode.get() ); QCOMPARE( fromCode->name(), def->name() ); @@ -8643,13 +8643,13 @@ void TestQgsProcessing::modelScope() pc.setProject( &p ); p.setFileName( TEST_DATA_DIR + QStringLiteral( "/test_file.qgs" ) ); scope.reset( QgsExpressionContextUtils::processingModelAlgorithmScope( &alg, params, pc ) ); - QCOMPARE( scope->variable( QStringLiteral( "model_path" ) ).toString(), QStringLiteral( TEST_DATA_DIR ) + QStringLiteral( "/test_file.qgs" ) ); + QCOMPARE( scope->variable( QStringLiteral( "model_path" ) ).toString(), QString( QStringLiteral( TEST_DATA_DIR ) + QStringLiteral( "/test_file.qgs" ) ) ); QCOMPARE( scope->variable( QStringLiteral( "model_folder" ) ).toString(), QStringLiteral( TEST_DATA_DIR ) ); alg.setSourceFilePath( TEST_DATA_DIR + QStringLiteral( "/processing/my_model.model3" ) ); scope.reset( QgsExpressionContextUtils::processingModelAlgorithmScope( &alg, params, pc ) ); - QCOMPARE( scope->variable( QStringLiteral( "model_path" ) ).toString(), QStringLiteral( TEST_DATA_DIR ) + QStringLiteral( "/processing/my_model.model3" ) ); - QCOMPARE( scope->variable( QStringLiteral( "model_folder" ) ).toString(), QStringLiteral( TEST_DATA_DIR ) + QStringLiteral( "/processing" ) ); + QCOMPARE( scope->variable( QStringLiteral( "model_path" ) ).toString(), QString( QStringLiteral( TEST_DATA_DIR ) + QStringLiteral( "/processing/my_model.model3" ) ) ); + QCOMPARE( scope->variable( QStringLiteral( "model_folder" ) ).toString(), QString( QStringLiteral( TEST_DATA_DIR ) + QStringLiteral( "/processing" ) ) ); QgsExpressionContext ctx = alg.createExpressionContext( QVariantMap(), pc ); QVERIFY( scope->hasVariable( QStringLiteral( "model_path" ) ) ); @@ -10536,7 +10536,7 @@ void TestQgsProcessing::modelValidate() QCOMPARE( errors.at( 0 ), QStringLiteral( "Model input cc used for parameter INPUT does not exist" ) ); goodSource.setSource( QgsProcessingModelChildParameterSource::StaticValue ); - goodSource.setStaticValue( QStringLiteral( TEST_DATA_DIR ) + "/polys.shp" ); + goodSource.setStaticValue( QString( QStringLiteral( TEST_DATA_DIR ) + "/polys.shp" ) ); m.childAlgorithm( QStringLiteral( "cx1" ) ).addParameterSources( QStringLiteral( "INPUT" ), QList< QgsProcessingModelChildParameterSource >() << goodSource ); QVERIFY( m.validateChildAlgorithm( QStringLiteral( "cx1" ), errors ) ); @@ -10836,7 +10836,7 @@ void TestQgsProcessing::convertCompatible() QVERIFY( gpkgLayer->isValid() ); out = QgsProcessingUtils::convertToCompatibleFormat( gpkgLayer.get(), false, QStringLiteral( "test" ), QStringList() << "gpkg" << "shp", QString( "shp" ), context, &feedback ); // layer must be translated -- we do not know if external tool can handle picking the correct layer automatically - QCOMPARE( out, testDataDir + QStringLiteral( "points_gpkg.gpkg" ) ); + QCOMPARE( out, QString( testDataDir + QStringLiteral( "points_gpkg.gpkg" ) ) ); gpkgPath = testDataDir + "points_gpkg.gpkg|layername=points_small"; gpkgLayer = qgis::make_unique< QgsVectorLayer >( gpkgPath, "vl" ); QVERIFY( gpkgLayer->isValid() ); @@ -10849,13 +10849,13 @@ void TestQgsProcessing::convertCompatible() QVERIFY( gpkgLayer->isValid() ); out = QgsProcessingUtils::convertToCompatibleFormatAndLayerName( gpkgLayer.get(), false, QStringLiteral( "test" ), QStringList() << "gpkg" << "shp", QString( "shp" ), context, &feedback, layerName ); // layer SHOULD NOT be translated -- in this case we know that the external tool can handle specifying the correct layer - QCOMPARE( out, testDataDir + QStringLiteral( "points_gpkg.gpkg" ) ); + QCOMPARE( out, QString( testDataDir + QStringLiteral( "points_gpkg.gpkg" ) ) ); QCOMPARE( layerName, QStringLiteral( "points_gpkg" ) ); gpkgPath = testDataDir + "points_gpkg.gpkg|layername=points_small"; gpkgLayer = qgis::make_unique< QgsVectorLayer >( gpkgPath, "vl" ); QVERIFY( gpkgLayer->isValid() ); out = QgsProcessingUtils::convertToCompatibleFormatAndLayerName( gpkgLayer.get(), false, QStringLiteral( "test" ), QStringList() << "gpkg" << "shp", QString( "shp" ), context, &feedback, layerName ); - QCOMPARE( out, testDataDir + QStringLiteral( "points_gpkg.gpkg" ) ); + QCOMPARE( out, QString( testDataDir + QStringLiteral( "points_gpkg.gpkg" ) ) ); QCOMPARE( layerName, QStringLiteral( "points_small" ) ); // also test evaluating parameter to compatible format @@ -10863,9 +10863,9 @@ void TestQgsProcessing::convertCompatible() QVariantMap params; params.insert( QStringLiteral( "source" ), QgsProcessingFeatureSourceDefinition( layer->id(), false ) ); out = QgsProcessingParameters::parameterAsCompatibleSourceLayerPath( def.get(), params, context, QStringList() << "shp", QString( "shp" ), &feedback ); - QCOMPARE( out, testDataDir + "points.shp" ); + QCOMPARE( out, QString( testDataDir + "points.shp" ) ); out = QgsProcessingParameters::parameterAsCompatibleSourceLayerPathAndLayerName( def.get(), params, context, QStringList() << "shp", QString( "shp" ), &feedback, &layerName ); - QCOMPARE( out, testDataDir + "points.shp" ); + QCOMPARE( out, QString( testDataDir + "points.shp" ) ); QCOMPARE( layerName, QString() ); // incompatible format, will be converted @@ -10882,9 +10882,9 @@ void TestQgsProcessing::convertCompatible() // layer as input params.insert( QStringLiteral( "source" ), QVariant::fromValue( layer ) ); out = QgsProcessingParameters::parameterAsCompatibleSourceLayerPath( def.get(), params, context, QStringList() << "shp", QString( "shp" ), &feedback ); - QCOMPARE( out, testDataDir + "points.shp" ); + QCOMPARE( out, QString( testDataDir + "points.shp" ) ); out = QgsProcessingParameters::parameterAsCompatibleSourceLayerPathAndLayerName( def.get(), params, context, QStringList() << "shp", QString( "shp" ), &feedback, &layerName ); - QCOMPARE( out, testDataDir + "points.shp" ); + QCOMPARE( out, QString( testDataDir + "points.shp" ) ); QCOMPARE( layerName, QString() ); // incompatible format, will be converted @@ -10935,9 +10935,9 @@ void TestQgsProcessing::convertCompatible() def.reset( new QgsProcessingParameterFeatureSource( QStringLiteral( "source" ), QString(), QList(), QVariant::fromValue( layer ) ) ); params.remove( QStringLiteral( "source" ) ); out = QgsProcessingParameters::parameterAsCompatibleSourceLayerPath( def.get(), params, context, QStringList() << "shp", QString( "shp" ), &feedback ); - QCOMPARE( out, testDataDir + "points.shp" ); + QCOMPARE( out, QString( testDataDir + "points.shp" ) ); out = QgsProcessingParameters::parameterAsCompatibleSourceLayerPathAndLayerName( def.get(), params, context, QStringList() << "shp", QString( "shp" ), &feedback, &layerName ); - QCOMPARE( out, testDataDir + "points.shp" ); + QCOMPARE( out, QString( testDataDir + "points.shp" ) ); QCOMPARE( layerName, QString() ); // geopackage with layer @@ -10947,7 +10947,7 @@ void TestQgsProcessing::convertCompatible() params.insert( QStringLiteral( "source" ), QVariant::fromValue( gpkgLayer.get() ) ); out = QgsProcessingParameters::parameterAsCompatibleSourceLayerPath( def.get(), params, context, QStringList() << "gpkg" << "shp", QString( "shp" ), &feedback ); // layer must be translated -- we do not know if external tool can handle picking the correct layer automatically - QCOMPARE( out, testDataDir + QStringLiteral( "points_gpkg.gpkg" ) ); + QCOMPARE( out, QString( testDataDir + QStringLiteral( "points_gpkg.gpkg" ) ) ); gpkgPath = testDataDir + "points_gpkg.gpkg|layername=points_small"; gpkgLayer = qgis::make_unique< QgsVectorLayer >( gpkgPath, "vl" ); QVERIFY( gpkgLayer->isValid() ); @@ -10962,22 +10962,22 @@ void TestQgsProcessing::convertCompatible() params.insert( QStringLiteral( "source" ), QVariant::fromValue( gpkgLayer.get() ) ); out = QgsProcessingParameters::parameterAsCompatibleSourceLayerPathAndLayerName( def.get(), params, context, QStringList() << "gpkg" << "shp", QString( "shp" ), &feedback, &layerName ); // layer SHOULD NOT be translated -- in this case we know that the external tool can handle specifying the correct layer - QCOMPARE( out, testDataDir + QStringLiteral( "points_gpkg.gpkg" ) ); + QCOMPARE( out, QString( testDataDir + QStringLiteral( "points_gpkg.gpkg" ) ) ); QCOMPARE( layerName, QStringLiteral( "points_gpkg" ) ); gpkgPath = testDataDir + "points_gpkg.gpkg|layername=points_small"; gpkgLayer = qgis::make_unique< QgsVectorLayer >( gpkgPath, "vl" ); QVERIFY( gpkgLayer->isValid() ); params.insert( QStringLiteral( "source" ), QVariant::fromValue( gpkgLayer.get() ) ); out = QgsProcessingParameters::parameterAsCompatibleSourceLayerPathAndLayerName( def.get(), params, context, QStringList() << "gpkg" << "shp", QString( "shp" ), &feedback, &layerName ); - QCOMPARE( out, testDataDir + QStringLiteral( "points_gpkg.gpkg" ) ); + QCOMPARE( out, QString( testDataDir + QStringLiteral( "points_gpkg.gpkg" ) ) ); QCOMPARE( layerName, QStringLiteral( "points_small" ) ); // output layer as input - e.g. from a previous model child params.insert( QStringLiteral( "source" ), QgsProcessingOutputLayerDefinition( layer->id() ) ); out = QgsProcessingParameters::parameterAsCompatibleSourceLayerPath( def.get(), params, context, QStringList() << "shp", QString( "shp" ), &feedback ); - QCOMPARE( out, testDataDir + "points.shp" ); + QCOMPARE( out, QString( testDataDir + "points.shp" ) ); out = QgsProcessingParameters::parameterAsCompatibleSourceLayerPathAndLayerName( def.get(), params, context, QStringList() << "shp", QString( "shp" ), &feedback, &layerName ); - QCOMPARE( out, testDataDir + "points.shp" ); + QCOMPARE( out, QString( testDataDir + "points.shp" ) ); QCOMPARE( layerName, QString() ); } diff --git a/tests/src/analysis/testqgsprocessingalgs.cpp b/tests/src/analysis/testqgsprocessingalgs.cpp index a8555a03308e..dff5ccd4482a 100644 --- a/tests/src/analysis/testqgsprocessingalgs.cpp +++ b/tests/src/analysis/testqgsprocessingalgs.cpp @@ -261,7 +261,7 @@ void TestQgsProcessingAlgs::saveFeaturesAlg() QString dataDir( TEST_DATA_DIR ); //defined in CmakeLists.txt QVariantMap parameters; - parameters.insert( QStringLiteral( "INPUT" ), dataDir + "/points.shp" ); + parameters.insert( QStringLiteral( "INPUT" ), QString( dataDir + "/points.shp" ) ); parameters.insert( QStringLiteral( "LAYER_NAME" ), layerName ); parameters.insert( QStringLiteral( "LAYER_OPTIONS" ), QStringLiteral( "COORDINATE_PRECISION=1" ) ); parameters.insert( QStringLiteral( "OUTPUT" ), outputGeoJson ); @@ -1667,7 +1667,7 @@ void TestQgsProcessingAlgs::fillNoData() QVariantMap parameters; - parameters.insert( QStringLiteral( "INPUT" ), myDataPath + inputRaster ); + parameters.insert( QStringLiteral( "INPUT" ), QString( myDataPath + inputRaster ) ); parameters.insert( QStringLiteral( "BAND" ), inputBand ); parameters.insert( QStringLiteral( "FILL_VALUE" ), fillValue ); parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); @@ -2337,7 +2337,7 @@ void TestQgsProcessingAlgs::cellStatistics() parameters.insert( QStringLiteral( "INPUT" ), inputDatasetPaths ); parameters.insert( QStringLiteral( "STATISTIC" ), statistic ); parameters.insert( QStringLiteral( "IGNORE_NODATA" ), ignoreNoData ); - parameters.insert( QStringLiteral( "REFERENCE_LAYER" ), myDataPath + referenceLayer ); + parameters.insert( QStringLiteral( "REFERENCE_LAYER" ), QString( myDataPath + referenceLayer ) ); parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); //prepare expectedRaster @@ -2578,7 +2578,7 @@ void TestQgsProcessingAlgs::rasterFrequencyByComparisonOperator() QVariantMap parameters; - parameters.insert( QStringLiteral( "INPUT_VALUE_RASTER" ), myDataPath + inputValueRaster ); + parameters.insert( QStringLiteral( "INPUT_VALUE_RASTER" ), QString( myDataPath + inputValueRaster ) ); parameters.insert( QStringLiteral( "INPUT_VALUE_RASTER_BAND" ), inputValueRasterBand ); parameters.insert( QStringLiteral( "INPUT_RASTERS" ), inputDatasetPaths ); parameters.insert( QStringLiteral( "IGNORE_NODATA" ), ignoreNoData ); @@ -2724,7 +2724,7 @@ void TestQgsProcessingAlgs::rasterLocalPosition() QVariantMap parameters; parameters.insert( QStringLiteral( "INPUT_RASTERS" ), inputDatasetPaths ); - parameters.insert( QStringLiteral( "REFERENCE_LAYER" ), myDataPath + referenceRaster ); + parameters.insert( QStringLiteral( "REFERENCE_LAYER" ), QString( myDataPath + referenceRaster ) ); parameters.insert( QStringLiteral( "IGNORE_NODATA" ), ignoreNoData ); parameters.insert( QStringLiteral( "OUTPUT" ), QgsProcessing::TEMPORARY_OUTPUT ); @@ -2946,7 +2946,7 @@ void TestQgsProcessingAlgs::roundRasterValues() QVariantMap parameters; - parameters.insert( QStringLiteral( "INPUT" ), myDataPath + inputRaster ); + parameters.insert( QStringLiteral( "INPUT" ), QString( myDataPath + inputRaster ) ); parameters.insert( QStringLiteral( "BAND" ), inputBand ); parameters.insert( QStringLiteral( "ROUNDING_DIRECTION" ), roundingDirection ); parameters.insert( QStringLiteral( "DECIMAL_PLACES" ), decimals ); @@ -3761,21 +3761,21 @@ void TestQgsProcessingAlgs::shapefileEncoding() QVariantMap results; results = alg->run( parameters, *context, &feedback, &ok ); - parameters.insert( QStringLiteral( "INPUT" ), QStringLiteral( TEST_DATA_DIR ) + "/shapefile/iso-8859-1.shp" ); + parameters.insert( QStringLiteral( "INPUT" ), QString( QStringLiteral( TEST_DATA_DIR ) + "/shapefile/iso-8859-1.shp" ) ); results = alg->run( parameters, *context, &feedback, &ok ); QVERIFY( ok ); QCOMPARE( results.value( QStringLiteral( "ENCODING" ) ).toString(), QStringLiteral( "ISO-8859-1" ) ); QCOMPARE( results.value( QStringLiteral( "CPG_ENCODING" ) ).toString(), QStringLiteral( "ISO-8859-1" ) ); QCOMPARE( results.value( QStringLiteral( "LDID_ENCODING" ) ).toString(), QString() ); - parameters.insert( QStringLiteral( "INPUT" ), QStringLiteral( TEST_DATA_DIR ) + "/shapefile/windows-1252_ldid.shp" ); + parameters.insert( QStringLiteral( "INPUT" ), QString( QStringLiteral( TEST_DATA_DIR ) + "/shapefile/windows-1252_ldid.shp" ) ); results = alg->run( parameters, *context, &feedback, &ok ); QVERIFY( ok ); QCOMPARE( results.value( QStringLiteral( "ENCODING" ) ).toString(), QStringLiteral( "CP1252" ) ); QCOMPARE( results.value( QStringLiteral( "CPG_ENCODING" ) ).toString(), QString() ); QCOMPARE( results.value( QStringLiteral( "LDID_ENCODING" ) ).toString(), QStringLiteral( "CP1252" ) ); - parameters.insert( QStringLiteral( "INPUT" ), QStringLiteral( TEST_DATA_DIR ) + "/shapefile/system_encoding.shp" ); + parameters.insert( QStringLiteral( "INPUT" ), QString( QStringLiteral( TEST_DATA_DIR ) + "/shapefile/system_encoding.shp" ) ); results = alg->run( parameters, *context, &feedback, &ok ); QVERIFY( ok ); QCOMPARE( results.value( QStringLiteral( "ENCODING" ) ).toString(), QString() ); @@ -4722,7 +4722,7 @@ void TestQgsProcessingAlgs::exportAtlasLayoutPng() QVariantMap parameters; parameters.insert( QStringLiteral( "LAYOUT" ), QStringLiteral( "my layout" ) ); parameters.insert( QStringLiteral( "COVERAGE_LAYER" ), QVariant::fromValue( polygonLayer ) ); - parameters.insert( QStringLiteral( "FOLDER" ), QDir::tempPath() + "/my_atlas" ); + parameters.insert( QStringLiteral( "FOLDER" ), QString( QDir::tempPath() + "/my_atlas" ) ); parameters.insert( QStringLiteral( "FILENAME_EXPRESSION" ), QStringLiteral( "'export_'||@atlas_featurenumber" ) ); parameters.insert( QStringLiteral( "DPI" ), 96 ); @@ -4774,7 +4774,7 @@ void TestQgsProcessingAlgs::tinMeshCreation() QVariantMap parameters; parameters.insert( QStringLiteral( "SOURCE_DATA" ), inputLayers ); - parameters.insert( QStringLiteral( "OUTPUT_MESH" ), QDir::tempPath() + "/meshLayer.2dm" ); + parameters.insert( QStringLiteral( "OUTPUT_MESH" ), QString( QDir::tempPath() + "/meshLayer.2dm" ) ); parameters.insert( QStringLiteral( "MESH_FORMAT" ), 0 ); std::unique_ptr< QgsProcessingContext > context = qgis::make_unique< QgsProcessingContext >(); diff --git a/tests/src/core/testqgslayoutmapgrid.cpp b/tests/src/core/testqgslayoutmapgrid.cpp index 31e03721e4a6..f438548eb59d 100644 --- a/tests/src/core/testqgslayoutmapgrid.cpp +++ b/tests/src/core/testqgslayoutmapgrid.cpp @@ -1225,23 +1225,23 @@ void TestQgsLayoutMapGrid::annotationFormats() QgsExpressionContext expressionContext = gridGeographic.createExpressionContext(); //normal e/w - QCOMPARE( gridGeographic.gridAnnotationString( 90, QgsLayoutItemMapGrid::Longitude, expressionContext ), QString( "90.0" ) + QChar( 176 ) + QString( "E" ) ); + QCOMPARE( gridGeographic.gridAnnotationString( 90, QgsLayoutItemMapGrid::Longitude, expressionContext ), QString( "90.0°E" ) ); QCOMPARE( gridProjected.gridAnnotationString( 90, QgsLayoutItemMapGrid::Longitude, expressionContext ), QString( "90.0E" ) ); //0 degrees - QCOMPARE( gridGeographic.gridAnnotationString( 0, QgsLayoutItemMapGrid::Longitude, expressionContext ), QString( "0.0" ) + QChar( 176 ) ); + QCOMPARE( gridGeographic.gridAnnotationString( 0, QgsLayoutItemMapGrid::Longitude, expressionContext ), QString( "0.0°" ) ); QCOMPARE( gridProjected.gridAnnotationString( 0, QgsLayoutItemMapGrid::Longitude, expressionContext ), QString( "0.0E" ) ); //180 degrees - QCOMPARE( gridGeographic.gridAnnotationString( 180, QgsLayoutItemMapGrid::Longitude, expressionContext ), QString( "180.0" ) + QChar( 176 ) ); + QCOMPARE( gridGeographic.gridAnnotationString( 180, QgsLayoutItemMapGrid::Longitude, expressionContext ), QString( "180.0°" ) ); QCOMPARE( gridProjected.gridAnnotationString( 180, QgsLayoutItemMapGrid::Longitude, expressionContext ), QString( "180.0E" ) ); //normal n/s - QCOMPARE( gridGeographic.gridAnnotationString( 45, QgsLayoutItemMapGrid::Latitude, expressionContext ), QString( "45.0" ) + QChar( 176 ) + QString( "N" ) ); + QCOMPARE( gridGeographic.gridAnnotationString( 45, QgsLayoutItemMapGrid::Latitude, expressionContext ), QString( "45.0°N" ) ); QCOMPARE( gridProjected.gridAnnotationString( 45, QgsLayoutItemMapGrid::Latitude, expressionContext ), QString( "45.0N" ) ); //0 north/south - QCOMPARE( gridGeographic.gridAnnotationString( 0, QgsLayoutItemMapGrid::Latitude, expressionContext ), QString( "0.0" ) + QChar( 176 ) ); + QCOMPARE( gridGeographic.gridAnnotationString( 0, QgsLayoutItemMapGrid::Latitude, expressionContext ), QString( "0.0°" ) ); QCOMPARE( gridProjected.gridAnnotationString( 0, QgsLayoutItemMapGrid::Latitude, expressionContext ), QString( "0.0N" ) ); //Custom format annotations diff --git a/tests/src/core/testqgsproject.cpp b/tests/src/core/testqgsproject.cpp index fc18d1b3c694..9b82c5c81091 100644 --- a/tests/src/core/testqgsproject.cpp +++ b/tests/src/core/testqgsproject.cpp @@ -150,7 +150,7 @@ void TestQgsProject::testPathResolver() QVERIFY( testFile.open( QIODevice::WriteOnly | QIODevice::Text ) ); testFile.close(); QVERIFY( QFile::exists( fi.path() + QStringLiteral( "/file1.txt" ) ) ); - QCOMPARE( tempRel.readPath( "file1.txt" ), fi.path() + QStringLiteral( "/file1.txt" ) ); + QCOMPARE( tempRel.readPath( "file1.txt" ), QString( fi.path() + QStringLiteral( "/file1.txt" ) ) ); QgsPathResolver resolverAbs; QCOMPARE( resolverAbs.writePath( "/home/qgis/file1.txt" ), QString( "/home/qgis/file1.txt" ) ); @@ -269,7 +269,7 @@ void TestQgsProject::testPathResolverSvg() project.write( projectFilename ); // make sure the path resolver works with relative paths (enabled by default) - QCOMPARE( project.pathResolver().readPath( "./a.txt" ), dirPath + "/a.txt" ); + QCOMPARE( project.pathResolver().readPath( "./a.txt" ), QString( dirPath + "/a.txt" ) ); QCOMPARE( project.pathResolver().writePath( dirPath + "/a.txt" ), QString( "./a.txt" ) ); // check that the saved paths are relative diff --git a/tests/src/core/testqgsziputils.cpp b/tests/src/core/testqgsziputils.cpp index 11fad10d1e74..f17daa29d801 100644 --- a/tests/src/core/testqgsziputils.cpp +++ b/tests/src/core/testqgsziputils.cpp @@ -113,7 +113,7 @@ void TestQgsZipUtils::testZip() QVERIFY( QgsZipUtils::zip( zipDirPath + "/special_zip æì.zip", QStringList() << txtFile ) ); QVERIFY( QgsZipUtils::unzip( zipDirPath + "/special_zip æì.zip", zipDirPath, files ) ); QCOMPARE( files.count(), 1 ); - QCOMPARE( files.at( 0 ), zipDirPath + "/aæýì.txt" ); + QCOMPARE( files.at( 0 ), QString( zipDirPath + "/aæýì.txt" ) ); QVERIFY( QFile::exists( zipDirPath + "/aæýì.txt" ) ); } diff --git a/tests/src/gui/testprocessinggui.cpp b/tests/src/gui/testprocessinggui.cpp index a7e700f9cd36..13fdd83ad195 100644 --- a/tests/src/gui/testprocessinggui.cpp +++ b/tests/src/gui/testprocessinggui.cpp @@ -1144,10 +1144,10 @@ void TestProcessingGui::testFileWrapper() QWidget *w = wrapper.createWrappedWidget( context ); QSignalSpy spy( &wrapper, &QgsProcessingFileWidgetWrapper::widgetValueHasChanged ); - wrapper.setWidgetValue( TEST_DATA_DIR + QStringLiteral( "/points.shp" ), context ); + wrapper.setWidgetValue( QString( TEST_DATA_DIR + QStringLiteral( "/points.shp" ) ), context ); QCOMPARE( spy.count(), 1 ); - QCOMPARE( wrapper.widgetValue().toString(), TEST_DATA_DIR + QStringLiteral( "/points.shp" ) ); - QCOMPARE( static_cast< QgsFileWidget * >( wrapper.wrappedWidget() )->filePath(), TEST_DATA_DIR + QStringLiteral( "/points.shp" ) ); + QCOMPARE( wrapper.widgetValue().toString(), QString( TEST_DATA_DIR + QStringLiteral( "/points.shp" ) ) ); + QCOMPARE( static_cast< QgsFileWidget * >( wrapper.wrappedWidget() )->filePath(), QString( TEST_DATA_DIR + QStringLiteral( "/points.shp" ) ) ); QCOMPARE( static_cast< QgsFileWidget * >( wrapper.wrappedWidget() )->filter(), QStringLiteral( "All files (*.*)" ) ); QCOMPARE( static_cast< QgsFileWidget * >( wrapper.wrappedWidget() )->storageMode(), QgsFileWidget::GetFile ); wrapper.setWidgetValue( QString(), context ); @@ -3213,27 +3213,27 @@ void TestProcessingGui::testMultipleFileSelectionDialog() QCOMPARE( dlg->selectedOptions().size(), 1 ); QCOMPARE( dlg->selectedOptions().at( 0 ).toString(), raster->source() ); // existing value using full layer path not matching a project layer should work - dlg = qgis::make_unique< QgsProcessingMultipleInputPanelWidget >( param.get(), QVariantList() << raster->source() << QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif", QList() ); + dlg = qgis::make_unique< QgsProcessingMultipleInputPanelWidget >( param.get(), QVariantList() << raster->source() << QString( QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif" ), QList() ); dlg->setProject( QgsProject::instance() ); QCOMPARE( dlg->mModel->rowCount(), 2 ); QCOMPARE( dlg->mModel->data( dlg->mModel->index( 0, 0 ) ).toString(), QStringLiteral( "raster [EPSG:4326]" ) ); QCOMPARE( dlg->mModel->data( dlg->mModel->index( 0, 0 ), Qt::UserRole ).toString(), raster->source() ); - QCOMPARE( dlg->mModel->data( dlg->mModel->index( 1, 0 ) ).toString(), QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif" ); - QCOMPARE( dlg->mModel->data( dlg->mModel->index( 1, 0 ), Qt::UserRole ).toString(), QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif" ); + QCOMPARE( dlg->mModel->data( dlg->mModel->index( 1, 0 ) ).toString(), QString( QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif" ) ); + QCOMPARE( dlg->mModel->data( dlg->mModel->index( 1, 0 ), Qt::UserRole ).toString(), QString( QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif" ) ); QCOMPARE( dlg->selectedOptions().size(), 2 ); QCOMPARE( dlg->selectedOptions().at( 0 ).toString(), raster->source() ); - QCOMPARE( dlg->selectedOptions().at( 1 ).toString(), QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif" ); + QCOMPARE( dlg->selectedOptions().at( 1 ).toString(), QString( QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif" ) ); // should remember layer order - dlg = qgis::make_unique< QgsProcessingMultipleInputPanelWidget >( param.get(), QVariantList() << QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif" << raster->source(), QList() ); + dlg = qgis::make_unique< QgsProcessingMultipleInputPanelWidget >( param.get(), QVariantList() << QString( QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif" ) << raster->source(), QList() ); dlg->setProject( QgsProject::instance() ); QCOMPARE( dlg->mModel->rowCount(), 2 ); - QCOMPARE( dlg->mModel->data( dlg->mModel->index( 0, 0 ) ).toString(), QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif" ); - QCOMPARE( dlg->mModel->data( dlg->mModel->index( 0, 0 ), Qt::UserRole ).toString(), QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif" ); + QCOMPARE( dlg->mModel->data( dlg->mModel->index( 0, 0 ) ).toString(), QString( QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif" ) ); + QCOMPARE( dlg->mModel->data( dlg->mModel->index( 0, 0 ), Qt::UserRole ).toString(), QString( QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif" ) ); QCOMPARE( dlg->mModel->data( dlg->mModel->index( 1, 0 ) ).toString(), QStringLiteral( "raster [EPSG:4326]" ) ); QCOMPARE( dlg->mModel->data( dlg->mModel->index( 1, 0 ), Qt::UserRole ).toString(), raster->source() ); QCOMPARE( dlg->selectedOptions().size(), 2 ); - QCOMPARE( dlg->selectedOptions().at( 0 ).toString(), QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif" ); + QCOMPARE( dlg->selectedOptions().at( 0 ).toString(), QString( QStringLiteral( TEST_DATA_DIR ) + "/landsat.tif" ) ); QCOMPARE( dlg->selectedOptions().at( 1 ).toString(), raster->source() ); // mesh @@ -7866,7 +7866,7 @@ void TestProcessingGui::testOutputDefinitionWidget() v = panel.value(); QVERIFY( v.canConvert< QgsProcessingOutputLayerDefinition>() ); QCOMPARE( v.value< QgsProcessingOutputLayerDefinition>().createOptions.value( QStringLiteral( "fileEncoding" ) ).toString(), QStringLiteral( "utf8" ) ); - QCOMPARE( v.value< QgsProcessingOutputLayerDefinition>().sink.staticValue().toString(), TEST_DATA_DIR + QStringLiteral( "/test.shp" ) ); + QCOMPARE( v.value< QgsProcessingOutputLayerDefinition>().sink.staticValue().toString(), QString( TEST_DATA_DIR + QStringLiteral( "/test.shp" ) ) ); // optional, test skipping sink.setFlags( sink.flags() | QgsProcessingParameterDefinition::FlagOptional ); @@ -8041,7 +8041,7 @@ void TestProcessingGui::testOutputDefinitionWidgetVectorOut() v = panel.value(); QVERIFY( v.canConvert< QgsProcessingOutputLayerDefinition>() ); QCOMPARE( v.value< QgsProcessingOutputLayerDefinition>().createOptions.value( QStringLiteral( "fileEncoding" ) ).toString(), QStringLiteral( "System" ) ); - QCOMPARE( v.value< QgsProcessingOutputLayerDefinition>().sink.staticValue().toString(), TEST_DATA_DIR + QStringLiteral( "/test.shp" ) ); + QCOMPARE( v.value< QgsProcessingOutputLayerDefinition>().sink.staticValue().toString(), QString( TEST_DATA_DIR + QStringLiteral( "/test.shp" ) ) ); // optional, test skipping vector.setFlags( vector.flags() | QgsProcessingParameterDefinition::FlagOptional ); @@ -8154,7 +8154,7 @@ void TestProcessingGui::testOutputDefinitionWidgetRasterOut() v = panel.value(); QVERIFY( v.canConvert< QgsProcessingOutputLayerDefinition>() ); QCOMPARE( v.value< QgsProcessingOutputLayerDefinition>().createOptions.value( QStringLiteral( "fileEncoding" ) ).toString(), QStringLiteral( "System" ) ); - QCOMPARE( v.value< QgsProcessingOutputLayerDefinition>().sink.staticValue().toString(), TEST_DATA_DIR + QStringLiteral( "/test.tif" ) ); + QCOMPARE( v.value< QgsProcessingOutputLayerDefinition>().sink.staticValue().toString(), QString( TEST_DATA_DIR + QStringLiteral( "/test.tif" ) ) ); // optional, test skipping raster.setFlags( raster.flags() | QgsProcessingParameterDefinition::FlagOptional ); @@ -8260,7 +8260,7 @@ void TestProcessingGui::testOutputDefinitionWidgetFolder() settings.setValue( QStringLiteral( "/Processing/Configuration/OUTPUTS_FOLDER" ), TEST_DATA_DIR ); panel.setValue( QStringLiteral( "mystuff" ) ); v = panel.value(); - QCOMPARE( v.toString(), TEST_DATA_DIR + QStringLiteral( "/mystuff" ) ); + QCOMPARE( v.toString(), QString( TEST_DATA_DIR + QStringLiteral( "/mystuff" ) ) ); // optional, test skipping folder.setFlags( folder.flags() | QgsProcessingParameterDefinition::FlagOptional ); @@ -8361,7 +8361,7 @@ void TestProcessingGui::testOutputDefinitionWidgetFileOut() settings.setValue( QStringLiteral( "/Processing/Configuration/OUTPUTS_FOLDER" ), TEST_DATA_DIR ); panel.setValue( QStringLiteral( "test.tif" ) ); v = panel.value(); - QCOMPARE( v.toString(), TEST_DATA_DIR + QStringLiteral( "/test.tif" ) ); + QCOMPARE( v.toString(), QString( TEST_DATA_DIR + QStringLiteral( "/test.tif" ) ) ); // optional, test skipping file.setFlags( file.flags() | QgsProcessingParameterDefinition::FlagOptional ); diff --git a/tests/src/gui/testqgsfilewidget.cpp b/tests/src/gui/testqgsfilewidget.cpp index d2d5debd3082..6717d761966f 100644 --- a/tests/src/gui/testqgsfilewidget.cpp +++ b/tests/src/gui/testqgsfilewidget.cpp @@ -104,7 +104,7 @@ void TestQgsFileWidget::testDroppedFiles() mime->setUrls( QList() << QUrl::fromLocalFile( TEST_DATA_DIR + QStringLiteral( "/bug5598.shp" ) ) ); event.reset( new QDropEvent( QPointF( 1, 1 ), Qt::CopyAction, mime.get(), Qt::LeftButton, Qt::NoModifier ) ); qobject_cast< QgsFileDropEdit * >( w->lineEdit() )->dropEvent( event.get() ); - QCOMPARE( w->lineEdit()->text(), TEST_DATA_DIR + QStringLiteral( "/bug5598.shp" ) ); + QCOMPARE( w->lineEdit()->text(), QString( TEST_DATA_DIR + QStringLiteral( "/bug5598.shp" ) ) ); // also should support files dragged from browser mime->setUrls( QList() ); @@ -115,7 +115,7 @@ void TestQgsFileWidget::testDroppedFiles() mime.reset( QgsMimeDataUtils::encodeUriList( uriList ) ); event.reset( new QDropEvent( QPointF( 1, 1 ), Qt::CopyAction, mime.get(), Qt::LeftButton, Qt::NoModifier ) ); qobject_cast< QgsFileDropEdit * >( w->lineEdit() )->dropEvent( event.get() ); - QCOMPARE( w->lineEdit()->text(), TEST_DATA_DIR + QStringLiteral( "/mesh/quad_and_triangle.2dm" ) ); + QCOMPARE( w->lineEdit()->text(), QString( TEST_DATA_DIR + QStringLiteral( "/mesh/quad_and_triangle.2dm" ) ) ); QgsBrowserModel m; m.initialize(); @@ -124,14 +124,14 @@ void TestQgsFileWidget::testDroppedFiles() mime.reset( m.mimeData( QModelIndexList() << m.findItem( layerItem ) ) ); event.reset( new QDropEvent( QPointF( 1, 1 ), Qt::CopyAction, mime.get(), Qt::LeftButton, Qt::NoModifier ) ); qobject_cast< QgsFileDropEdit * >( w->lineEdit() )->dropEvent( event.get() ); - QCOMPARE( w->lineEdit()->text(), QString( TEST_DATA_DIR ) + QStringLiteral( "/mesh/quad_and_triangle.txt" ) ); + QCOMPARE( w->lineEdit()->text(), QString( QString( TEST_DATA_DIR ) + QStringLiteral( "/mesh/quad_and_triangle.txt" ) ) ); // plain text should also be permitted mime = qgis::make_unique< QMimeData >(); mime->setText( TEST_DATA_DIR + QStringLiteral( "/mesh/quad_and_triangle.2dm" ) ); event.reset( new QDropEvent( QPointF( 1, 1 ), Qt::CopyAction, mime.get(), Qt::LeftButton, Qt::NoModifier ) ); qobject_cast< QgsFileDropEdit * >( w->lineEdit() )->dropEvent( event.get() ); - QCOMPARE( w->lineEdit()->text(), TEST_DATA_DIR + QStringLiteral( "/mesh/quad_and_triangle.2dm" ) ); + QCOMPARE( w->lineEdit()->text(), QString( TEST_DATA_DIR + QStringLiteral( "/mesh/quad_and_triangle.2dm" ) ) ); mime.reset( new QMimeData() ); mime->setUrls( QList() << QUrl::fromLocalFile( TEST_DATA_DIR + QStringLiteral( "/bug5598.shp" ) ) ); @@ -140,7 +140,7 @@ void TestQgsFileWidget::testDroppedFiles() w->setFilter( QStringLiteral( "Data (*.shp)" ) ); w->setFilePath( QString() ); qobject_cast< QgsFileDropEdit * >( w->lineEdit() )->dropEvent( event.get() ); - QCOMPARE( w->lineEdit()->text(), TEST_DATA_DIR + QStringLiteral( "/bug5598.shp" ) ); + QCOMPARE( w->lineEdit()->text(), QString( TEST_DATA_DIR + QStringLiteral( "/bug5598.shp" ) ) ); w->setFilePath( QString() ); // should be rejected, not compatible with filter mime->setUrls( QList() << QUrl::fromLocalFile( TEST_DATA_DIR + QStringLiteral( "/encoded_html.html" ) ) ); @@ -150,14 +150,14 @@ void TestQgsFileWidget::testDroppedFiles() // new filter, should be allowed now w->setFilter( QStringLiteral( "Data (*.shp);;HTML (*.HTML)" ) ); qobject_cast< QgsFileDropEdit * >( w->lineEdit() )->dropEvent( event.get() ); - QCOMPARE( w->lineEdit()->text(), TEST_DATA_DIR + QStringLiteral( "/encoded_html.html" ) ); + QCOMPARE( w->lineEdit()->text(), QString( TEST_DATA_DIR + QStringLiteral( "/encoded_html.html" ) ) ); //try with wildcard filter w->setFilter( QStringLiteral( "All files (*.*);;Data (*.shp);;HTML (*.HTML)" ) ); mime->setUrls( QList() << QUrl::fromLocalFile( TEST_DATA_DIR + QStringLiteral( "/bug5598.prj" ) ) ); event.reset( new QDropEvent( QPointF( 1, 1 ), Qt::CopyAction, mime.get(), Qt::LeftButton, Qt::NoModifier ) ); qobject_cast< QgsFileDropEdit * >( w->lineEdit() )->dropEvent( event.get() ); - QCOMPARE( w->lineEdit()->text(), TEST_DATA_DIR + QStringLiteral( "/bug5598.prj" ) ); + QCOMPARE( w->lineEdit()->text(), QString( TEST_DATA_DIR + QStringLiteral( "/bug5598.prj" ) ) ); // try with folders w->setStorageMode( QgsFileWidget::GetDirectory ); @@ -166,7 +166,7 @@ void TestQgsFileWidget::testDroppedFiles() mime->setUrls( QList() << QUrl::fromLocalFile( TEST_DATA_DIR + QStringLiteral( "/mesh/quad_and_triangle.2dm" ) ) ); event.reset( new QDropEvent( QPointF( 1, 1 ), Qt::CopyAction, mime.get(), Qt::LeftButton, Qt::NoModifier ) ); qobject_cast< QgsFileDropEdit * >( w->lineEdit() )->dropEvent( event.get() ); - QCOMPARE( w->lineEdit()->text(), QString( TEST_DATA_DIR ) + QStringLiteral( "/mesh" ) ); + QCOMPARE( w->lineEdit()->text(), QString( QString( TEST_DATA_DIR ) + QStringLiteral( "/mesh" ) ) ); // but dropping a folder should work mime->setUrls( QList() << QUrl::fromLocalFile( TEST_DATA_DIR ) ); @@ -180,7 +180,7 @@ void TestQgsFileWidget::testDroppedFiles() mime.reset( m.mimeData( QModelIndexList() << m.findItem( dirItem ) ) ); event.reset( new QDropEvent( QPointF( 1, 1 ), Qt::CopyAction, mime.get(), Qt::LeftButton, Qt::NoModifier ) ); qobject_cast< QgsFileDropEdit * >( w->lineEdit() )->dropEvent( event.get() ); - QCOMPARE( w->lineEdit()->text(), QString( TEST_DATA_DIR ) + QStringLiteral( "/mesh" ) ); + QCOMPARE( w->lineEdit()->text(), QString( QString( TEST_DATA_DIR ) + QStringLiteral( "/mesh" ) ) ); } void TestQgsFileWidget::testMultipleFiles() diff --git a/tests/src/gui/testqgsnewdatabasetablewidget.cpp b/tests/src/gui/testqgsnewdatabasetablewidget.cpp index 72666c187434..82c7d892aa95 100644 --- a/tests/src/gui/testqgsnewdatabasetablewidget.cpp +++ b/tests/src/gui/testqgsnewdatabasetablewidget.cpp @@ -273,7 +273,7 @@ void TestQgsNewDatabaseTableNameWidget::testWidgetSignalsGeopackage() QCOMPARE( w->table(), QString( "newTableName" ) ); QCOMPARE( w->schema(), mGpkgPath ); QCOMPARE( w->dataProviderKey(), QString( "ogr" ) ); - QCOMPARE( w->uri(), mGpkgPath + QStringLiteral( "|layername=newTableName" ) ); + QCOMPARE( w->uri(), QString( mGpkgPath + QStringLiteral( "|layername=newTableName" ) ) ); #endif } From e4fa6cbc82f8aa7de8db32fb6e24f25c7f8ef966 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 11 Oct 2020 03:58:43 +0200 Subject: [PATCH 27/48] qgspostgresprovider.cpp: use classic initialization --- src/providers/postgres/qgspostgresprovider.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp index b54716003553..9df00b977faf 100644 --- a/src/providers/postgres/qgspostgresprovider.cpp +++ b/src/providers/postgres/qgspostgresprovider.cpp @@ -1213,7 +1213,7 @@ bool QgsPostgresProvider::loadFields() && defValMap[tableoid][attnum].isEmpty() ) { const QString seqName { mTableName + '_' + fieldName + QStringLiteral( "_seq" ) }; - const QString seqSql { QStringLiteral( "SELECT c.oid " + const QString seqSql = QStringLiteral( "SELECT c.oid " " FROM pg_class c " " LEFT JOIN pg_namespace n " " ON ( n.oid = c.relnamespace ) " @@ -1221,8 +1221,7 @@ bool QgsPostgresProvider::loadFields() " AND c.relname = %1 " " AND n.nspname = %2" ) .arg( quotedValue( seqName ) ) - .arg( quotedValue( mSchemaName ) ) - }; + .arg( quotedValue( mSchemaName ) ); QgsPostgresResult seqResult( connectionRO()->PQexec( seqSql ) ); if ( seqResult.PQntuples() == 1 ) { From cce7aa7315df395d8f1c0ee85f9cf58ece99fef1 Mon Sep 17 00:00:00 2001 From: Salvatore Larosa Date: Sun, 11 Oct 2020 20:00:02 +0200 Subject: [PATCH 28/48] [pyqgis-console] restore marker icon for syntax check --- python/console/console.py | 2 +- python/console/console_editor.py | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/python/console/console.py b/python/console/console.py index cb32fe4be0e7..16dee3aba928 100644 --- a/python/console/console.py +++ b/python/console/console.py @@ -618,7 +618,7 @@ def _textFindChanged(self): def onClickGoToLine(self, item, column): tabEditor = self.tabEditorWidget.currentWidget().newEditor if item.text(1) == 'syntaxError': - check = tabEditor.syntaxCheck(fromContextMenu=False) + check = tabEditor.syntaxCheck() if check and not tabEditor.isReadOnly(): self.tabEditorWidget.currentWidget().save() return diff --git a/python/console/console_editor.py b/python/console/console_editor.py index 4d1fa54f5fab..4f5be86d66b9 100644 --- a/python/console/console_editor.py +++ b/python/console/console_editor.py @@ -495,14 +495,16 @@ def goToLine(self, objName, linenr): self.ensureLineVisible(linenr) self.setFocus() - def syntaxCheck(self, filename=None, fromContextMenu=True): + def syntaxCheck(self): eline = None ecolumn = 0 edescr = '' source = self.text() try: + filename = self.parent.tw.currentWidget().path if not filename: - filename = self.parent.tw.currentWidget().path + tmpFile = self.createTempFile() + filename = tmpFile # source = open(filename, 'r').read() + '\n' if isinstance(source, type("")): source = source.encode('utf-8') @@ -522,13 +524,15 @@ def syntaxCheck(self, filename=None, fromContextMenu=True): self.bufferMarkerLine.remove(markerLine) if (eline) not in self.bufferMarkerLine: self.bufferMarkerLine.append(eline) + + self.setMarginWidth(1, "0000") self.markerAdd(eline, self.MARKER_NUM) - loadFont = self.settings.value("pythonConsole/fontfamilytext", - "Monospace") + font = self.lexerFont() + font.setItalic(True) styleAnn = QsciStyle(-1, "Annotation", QColor(255, 0, 0), QColor(255, 200, 0), - QFont(loadFont, 8, -1, True), + font, True) self.annotate(eline, edescr, styleAnn) self.setCursorPosition(eline, ecolumn - 1) @@ -537,6 +541,7 @@ def syntaxCheck(self, filename=None, fromContextMenu=True): # self.ensureCursorVisible() return False else: + self.setMarginWidth(1, 0) self.markerDeleteAll() self.clearAnnotations() return True From aaa813a15adf2e99e18e29b54974970bf24596e6 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 12 Oct 2020 09:31:22 +1000 Subject: [PATCH 29/48] Split indentation guide color from edge color in code editor settings Reusing the same color resulted in too subtle indentation guides --- .../qgscodeeditorcolorscheme.sip.in | 1 + src/app/options/qgscodeeditoroptions.cpp | 1 + src/gui/codeeditors/qgscodeeditor.cpp | 6 +- .../codeeditors/qgscodeeditorcolorscheme.h | 1 + .../qgscodeeditorcolorschemeregistry.cpp | 3 + src/ui/qgscodeditorsettings.ui | 377 +++++++++--------- 6 files changed, 206 insertions(+), 183 deletions(-) diff --git a/python/gui/auto_generated/codeeditors/qgscodeeditorcolorscheme.sip.in b/python/gui/auto_generated/codeeditors/qgscodeeditorcolorscheme.sip.in index fa447891ea4e..11edee52f6e0 100644 --- a/python/gui/auto_generated/codeeditors/qgscodeeditorcolorscheme.sip.in +++ b/python/gui/auto_generated/codeeditors/qgscodeeditorcolorscheme.sip.in @@ -56,6 +56,7 @@ Defines a color scheme for use in QgsCodeEditor widgets. Error, FoldIconForeground, FoldIconHalo, + IndentationGuide, }; QgsCodeEditorColorScheme( const QString &id = QString(), const QString &name = QString() ); diff --git a/src/app/options/qgscodeeditoroptions.cpp b/src/app/options/qgscodeeditoroptions.cpp index 9a175fda9e85..e3e6bff55415 100644 --- a/src/app/options/qgscodeeditoroptions.cpp +++ b/src/app/options/qgscodeeditoroptions.cpp @@ -68,6 +68,7 @@ QgsCodeEditorOptionsWidget::QgsCodeEditorOptionsWidget( QWidget *parent ) {QgsCodeEditorColorScheme::ColorRole::Error, mColorError }, {QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, mColorFoldIcon }, {QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, mColorFoldIconHalo }, + {QgsCodeEditorColorScheme::ColorRole::IndentationGuide, mColorIndentation }, }; for ( auto it = mColorButtonMap.constBegin(); it != mColorButtonMap.constEnd(); ++it ) diff --git a/src/gui/codeeditors/qgscodeeditor.cpp b/src/gui/codeeditors/qgscodeeditor.cpp index ce4159be86e8..6027b4129c29 100644 --- a/src/gui/codeeditors/qgscodeeditor.cpp +++ b/src/gui/codeeditors/qgscodeeditor.cpp @@ -63,6 +63,7 @@ QMap< QgsCodeEditorColorScheme::ColorRole, QString > QgsCodeEditor::sColorRoleTo {QgsCodeEditorColorScheme::ColorRole::Error, QStringLiteral( "stderrFontColor" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QStringLiteral( "foldIconForeground" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QStringLiteral( "foldIconHalo" ) }, + {QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QStringLiteral( "indentationGuide" ) }, }; @@ -201,8 +202,8 @@ void QgsCodeEditor::runPostLexerConfigurationTasks() SendScintilla( SCI_MARKERSETBACK, SC_MARKNUM_FOLDEROPEN, lexerColor( QgsCodeEditorColorScheme::ColorRole::FoldIconForeground ) ); SendScintilla( SCI_MARKERSETFORE, SC_MARKNUM_FOLDER, lexerColor( QgsCodeEditorColorScheme::ColorRole::FoldIconHalo ) ); SendScintilla( SCI_MARKERSETBACK, SC_MARKNUM_FOLDER, lexerColor( QgsCodeEditorColorScheme::ColorRole::FoldIconForeground ) ); - SendScintilla( SCI_STYLESETFORE, STYLE_INDENTGUIDE, lexerColor( QgsCodeEditorColorScheme::ColorRole::Edge ) ); - SendScintilla( SCI_STYLESETBACK, STYLE_INDENTGUIDE, lexerColor( QgsCodeEditorColorScheme::ColorRole::Edge ) ); + SendScintilla( SCI_STYLESETFORE, STYLE_INDENTGUIDE, lexerColor( QgsCodeEditorColorScheme::ColorRole::IndentationGuide ) ); + SendScintilla( SCI_STYLESETBACK, STYLE_INDENTGUIDE, lexerColor( QgsCodeEditorColorScheme::ColorRole::IndentationGuide ) ); } void QgsCodeEditor::setSciWidget() @@ -353,6 +354,7 @@ QColor QgsCodeEditor::defaultColor( QgsCodeEditorColorScheme::ColorRole role, co {QgsCodeEditorColorScheme::ColorRole::Error, QStringLiteral( "stderrFontColor" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QStringLiteral( "foldIconForeground" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QStringLiteral( "foldIconHalo" ) }, + {QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QStringLiteral( "indentationGuide" ) }, }; const QgsCodeEditorColorScheme defaultScheme = QgsGui::codeEditorColorSchemeRegistry()->scheme( QStringLiteral( "default" ) ); diff --git a/src/gui/codeeditors/qgscodeeditorcolorscheme.h b/src/gui/codeeditors/qgscodeeditorcolorscheme.h index ef18e4fda813..f9be04880033 100644 --- a/src/gui/codeeditors/qgscodeeditorcolorscheme.h +++ b/src/gui/codeeditors/qgscodeeditorcolorscheme.h @@ -69,6 +69,7 @@ class GUI_EXPORT QgsCodeEditorColorScheme Error, //!< Error color FoldIconForeground, //!< Fold icon foreground color FoldIconHalo, //!< Fold icon halo color + IndentationGuide, //!< Indentation guide line }; /** diff --git a/src/gui/codeeditors/qgscodeeditorcolorschemeregistry.cpp b/src/gui/codeeditors/qgscodeeditorcolorschemeregistry.cpp index 5ebbe716f0a8..e63a8f572fb4 100644 --- a/src/gui/codeeditors/qgscodeeditorcolorschemeregistry.cpp +++ b/src/gui/codeeditors/qgscodeeditorcolorschemeregistry.cpp @@ -54,6 +54,7 @@ QgsCodeEditorColorSchemeRegistry::QgsCodeEditorColorSchemeRegistry() {QgsCodeEditorColorScheme::ColorRole::Error, QColor( "#e31a1c" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QColor( "#ffffff" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QColor( "#000000" ) }, + {QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QColor( "#d5d5d5" ) }, } ); addColorScheme( defaultScheme ); @@ -93,6 +94,7 @@ QgsCodeEditorColorSchemeRegistry::QgsCodeEditorColorSchemeRegistry() {QgsCodeEditorColorScheme::ColorRole::Error, QColor( "#DC322F" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QColor( "#ffffff" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QColor( "#93a1a1" ) }, + {QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QColor( "#c2beb3" ) }, } ); addColorScheme( solarizedLight ); @@ -132,6 +134,7 @@ QgsCodeEditorColorSchemeRegistry::QgsCodeEditorColorSchemeRegistry() {QgsCodeEditorColorScheme::ColorRole::Error, QColor( "#DC322F" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QColor( "#586e75" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QColor( "#839496" ) }, + {QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QColor( "#586E75" ) }, } ); addColorScheme( solarizedDark ); } diff --git a/src/ui/qgscodeditorsettings.ui b/src/ui/qgscodeditorsettings.ui index 1019b2308f03..0bc5d4469def 100644 --- a/src/ui/qgscodeditorsettings.ui +++ b/src/ui/qgscodeditorsettings.ui @@ -216,8 +216,8 @@ 0 0 - 677 - 541 + 663 + 549 @@ -297,272 +297,279 @@ true - - + + - Selection background + - - + + - - + + - + Comment - - + + - - + + - Background + - - + + - Cursor + - - + + - - + + - Keyword + - - + + - - + + - Triple single quote + Decorator - - + + - - + + - - + + - + Brace background - - + + - Margin foreground + - - + + - Function + Comment block - - + + - - + + - Identifier + - - + + - + Quoted operator - - + + - - + + - Comment + Default - - + + - Fold guide + - - + + - - + + + + Margin foreground + + - - + + - + Selection background - - + + - Caretline + Selection foreground - - + + - + Unknown tag - - + + - Margin background + - - + + - Color scheme + - - + + - - + + - - + + - Decorator + - - + + - Selection foreground + - - + + - Number + - - + + - Default + Quoted identifier - - + + - Comment block + Indentation guide - - + + + + + - Fold icon + Color scheme - - + + - Operator + - - + + - Quoted operator + Class name - - + + - + Fold icon @@ -573,66 +580,66 @@ - - + + - + Comment line - - + + - Quoted identifier + - - + + - + Single quote - - + + - Brace background + Error - - + + - - + + - - + + - Single quote + Function - - + + - - + + - Tag + Background @@ -643,92 +650,99 @@ - - + + - Double quote + Identifier - - + + - + Tag - - + + - Class name + Fold guide - - + + - + Fold icon halo - - + + - Unknown tag + Margin background - - + + - Comment line + Triple single quote - - + + - - + + - - + + - Edge/indentation guide + Keyword - - + + - + Cursor - - + + - - + + - + Double quote - - + + + + Caretline + + + + + @@ -741,29 +755,29 @@ - - + + - Error + Number - - + + - Fold icon halo + Edge guide - - + + - + Operator - - + + @@ -854,18 +868,19 @@ mColorCommentLine mColorSingleQuote mColorDoubleQuote - mColorEdge + mColorIndentation mColorTripleSingleQuote mColorTripleDoubleQuote - mColorFold + mColorEdge mColorMarginBackground mColorMarginForeground - mColorCaretLine + mColorFold mColorSelectionBackground mColorSelectionForeground - mColorFoldIcon + mColorCaretLine mColorBraceBackground mColorBraceForeground + mColorFoldIcon mColorFoldIconHalo mListLanguage From 5c8013df6129a2bc06d25a98ff20dbf27621bff5 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 12 Oct 2020 10:18:32 +1000 Subject: [PATCH 30/48] [console] Fix exception when running scripts (followup cce7aa7) and move responsibility for showing warning messages to QgsCodeEditor base class, so that the same code can be used by other dialog script editors --- python/console/console_editor.py | 61 ++++--------------- .../codeeditors/qgscodeeditor.sip.in | 18 ++++++ src/gui/codeeditors/qgscodeeditor.cpp | 34 +++++++++++ src/gui/codeeditors/qgscodeeditor.h | 20 ++++++ 4 files changed, 84 insertions(+), 49 deletions(-) diff --git a/python/console/console_editor.py b/python/console/console_editor.py index 4f5be86d66b9..8d395cd123d0 100644 --- a/python/console/console_editor.py +++ b/python/console/console_editor.py @@ -80,8 +80,6 @@ def eventFilter(self, obj, event): class Editor(QgsCodeEditorPython): - MARKER_NUM = 6 - def __init__(self, parent=None): super().__init__(parent) self.parent = parent @@ -89,22 +87,11 @@ def __init__(self, parent=None): self.lastModified = 0 self.opening = ['(', '{', '[', "'", '"'] self.closing = [')', '}', ']', "'", '"'] - - # List of marker line to be deleted from check syntax - self.bufferMarkerLine = [] - self.settings = QgsSettings() - self.markerDefine(QgsApplication.getThemePixmap("console/iconSyntaxErrorConsole.svg"), - self.MARKER_NUM) - self.setMinimumHeight(120) - self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) - # Annotations - self.setAnnotationDisplay(QsciScintilla.ANNOTATION_BOXED) - # Disable command key ctrl, shift = self.SCMOD_CTRL << 16, self.SCMOD_SHIFT << 16 self.SendScintilla(QsciScintilla.SCI_CLEARCMDKEY, ord('L') + ctrl) @@ -160,9 +147,9 @@ def contextMenuEvent(self, e): QCoreApplication.translate("PythonConsole", "Hide Editor"), self.hideEditor) menu.addSeparator() # ------------------------------ - syntaxCheck = menu.addAction(QgsApplication.getThemeIcon("console/iconSyntaxErrorConsole.svg"), - QCoreApplication.translate("PythonConsole", "Check Syntax"), - self.syntaxCheck, 'Ctrl+4') + syntaxCheckAction = menu.addAction(QgsApplication.getThemeIcon("console/iconSyntaxErrorConsole.svg"), + QCoreApplication.translate("PythonConsole", "Check Syntax"), + self.syntaxCheck, 'Ctrl+4') runSelected = menu.addAction(QgsApplication.getThemeIcon("console/mIconRunConsole.svg"), # spellok QCoreApplication.translate("PythonConsole", "Run Selected"), self.runSelectedCode, 'Ctrl+E') # spellok @@ -218,7 +205,7 @@ def contextMenuEvent(self, e): menu.addAction(QgsApplication.getThemeIcon("console/iconSettingsConsole.svg"), QCoreApplication.translate("PythonConsole", "Options…"), self.parent.pc.openSettings) - syntaxCheck.setEnabled(False) + syntaxCheckAction.setEnabled(False) pasteAction.setEnabled(False) pyQGISHelpAction.setEnabled(False) gist_menu.setEnabled(False) @@ -237,7 +224,7 @@ def contextMenuEvent(self, e): pyQGISHelpAction.setEnabled(True) if not self.text() == '': selectAllAction.setEnabled(True) - syntaxCheck.setEnabled(True) + syntaxCheckAction.setEnabled(True) if self.isUndoAvailable(): undoAction.setEnabled(True) if self.isRedoAvailable(): @@ -461,7 +448,7 @@ def runScriptCode(self): self.parent.pc.callWidgetMessageBarEditor(msgEditorBlank, 0, True) return - if self.syntaxCheck(fromContextMenu=False): + if self.syntaxCheck(): if filename and self.isModified() and autoSave: self.parent.save(filename) elif not filename or self.isModified(): @@ -496,16 +483,13 @@ def goToLine(self, objName, linenr): self.setFocus() def syntaxCheck(self): - eline = None - ecolumn = 0 - edescr = '' source = self.text() + self.clearWarnings() try: filename = self.parent.tw.currentWidget().path if not filename: tmpFile = self.createTempFile() filename = tmpFile - # source = open(filename, 'r').read() + '\n' if isinstance(source, type("")): source = source.encode('utf-8') if isinstance(filename, type("")): @@ -514,37 +498,16 @@ def syntaxCheck(self): compile(source, filename, 'exec') except SyntaxError as detail: eline = detail.lineno and detail.lineno or 1 + eline -= 1 ecolumn = detail.offset and detail.offset or 1 edescr = detail.msg - if eline is not None: - eline -= 1 - for markerLine in self.bufferMarkerLine: - self.markerDelete(markerLine) - self.clearAnnotations(markerLine) - self.bufferMarkerLine.remove(markerLine) - if (eline) not in self.bufferMarkerLine: - self.bufferMarkerLine.append(eline) - - self.setMarginWidth(1, "0000") - self.markerAdd(eline, self.MARKER_NUM) - font = self.lexerFont() - font.setItalic(True) - styleAnn = QsciStyle(-1, "Annotation", - QColor(255, 0, 0), - QColor(255, 200, 0), - font, - True) - self.annotate(eline, edescr, styleAnn) + + self.addWarning(eline, edescr) self.setCursorPosition(eline, ecolumn - 1) - # self.setSelection(eline, ecolumn, eline, self.lineLength(eline)-1) self.ensureLineVisible(eline) - # self.ensureCursorVisible() return False - else: - self.setMarginWidth(1, 0) - self.markerDeleteAll() - self.clearAnnotations() - return True + + return True def keyPressEvent(self, e): t = e.text() diff --git a/python/gui/auto_generated/codeeditors/qgscodeeditor.sip.in b/python/gui/auto_generated/codeeditors/qgscodeeditor.sip.in index 008ef925707a..05afe50601f0 100644 --- a/python/gui/auto_generated/codeeditors/qgscodeeditor.sip.in +++ b/python/gui/auto_generated/codeeditors/qgscodeeditor.sip.in @@ -120,6 +120,24 @@ Returns the monospaced font to use for code editors. %End + void addWarning( int lineNumber, const QString &warning ); +%Docstring +Adds a ``warning`` message and indicator to the specified a ``lineNumber``. + +.. seealso:: :py:func:`clearWarnings` + +.. versionadded:: 3.16 +%End + + void clearWarnings(); +%Docstring +Clears all warning messages from the editor. + +.. seealso:: :py:func:`addWarning` + +.. versionadded:: 3.16 +%End + protected: bool isFixedPitch( const QFont &font ); diff --git a/src/gui/codeeditors/qgscodeeditor.cpp b/src/gui/codeeditors/qgscodeeditor.cpp index 6027b4129c29..242846545abf 100644 --- a/src/gui/codeeditors/qgscodeeditor.cpp +++ b/src/gui/codeeditors/qgscodeeditor.cpp @@ -27,6 +27,7 @@ #include #include #include +#include QMap< QgsCodeEditorColorScheme::ColorRole, QString > QgsCodeEditor::sColorRoleToSettingsKey { @@ -88,6 +89,13 @@ QgsCodeEditor::QgsCodeEditor( QWidget *parent, const QString &title, bool foldin SendScintilla( SCI_SETMULTIPASTE, 1 ); SendScintilla( SCI_SETVIRTUALSPACEOPTIONS, SCVS_RECTANGULARSELECTION ); + markerDefine( QgsApplication::getThemePixmap( "console/iconSyntaxErrorConsole.svg" ), + MARKER_NUMBER ); + SendScintilla( SCI_SETMARGINTYPEN, 3, SC_MARGIN_SYMBOL ); + SendScintilla( SCI_SETMARGINMASKN, 3, 1 << MARKER_NUMBER ); + setMarginWidth( 3, 0 ); + setAnnotationDisplay( QsciScintilla::AnnotationBoxed ); + connect( QgsGui::instance(), &QgsGui::optionsChanged, this, [ = ] { setSciWidget(); @@ -443,3 +451,29 @@ void QgsCodeEditor::setCustomAppearance( const QString &scheme, const QMap &customColors = QMap< QgsCodeEditorColorScheme::ColorRole, QColor >(), const QString &fontFamily = QString(), int fontSize = 0 ) SIP_SKIP; + /** + * Adds a \a warning message and indicator to the specified a \a lineNumber. + * + * \see clearWarnings() + * \since QGIS 3.16 + */ + void addWarning( int lineNumber, const QString &warning ); + + /** + * Clears all warning messages from the editor. + * + * \see addWarning() + * \since QGIS 3.16 + */ + void clearWarnings(); + protected: bool isFixedPitch( const QFont &font ); @@ -188,7 +204,11 @@ class GUI_EXPORT QgsCodeEditor : public QsciScintilla QString mFontFamily; int mFontSize = 0; + QVector< int > mWarningLines; + static QMap< QgsCodeEditorColorScheme::ColorRole, QString > sColorRoleToSettingsKey; + + static constexpr int MARKER_NUMBER = 6; }; // clazy:excludeall=qstring-allocations From 1d2bb41752c51e6c9b84124a1ce1599d3d42b41c Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 12 Oct 2020 08:22:13 +1000 Subject: [PATCH 31/48] Lazy construct expression context for memory provider feature sources It's not free to calculate, and is only used when iterating over a memory layer with a subset string set Results in a big speed up to scripts which fire off many individual feature requests to a memory provider layer --- .../memory/qgsmemoryfeatureiterator.cpp | 30 +++++++++++++------ .../memory/qgsmemoryfeatureiterator.h | 4 ++- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/core/providers/memory/qgsmemoryfeatureiterator.cpp b/src/core/providers/memory/qgsmemoryfeatureiterator.cpp index 20b041e866ee..4a0a8a5ec9cf 100644 --- a/src/core/providers/memory/qgsmemoryfeatureiterator.cpp +++ b/src/core/providers/memory/qgsmemoryfeatureiterator.cpp @@ -47,7 +47,7 @@ QgsMemoryFeatureIterator::QgsMemoryFeatureIterator( QgsMemoryFeatureSource *sour if ( !mSource->mSubsetString.isEmpty() ) { mSubsetExpression = qgis::make_unique< QgsExpression >( mSource->mSubsetString ); - mSubsetExpression->prepare( &mSource->mExpressionContext ); + mSubsetExpression->prepare( mSource->expressionContext() ); } if ( !mFilterRect.isNull() && mRequest.flags() & QgsFeatureRequest::ExactIntersect ) @@ -63,7 +63,7 @@ QgsMemoryFeatureIterator::QgsMemoryFeatureIterator( QgsMemoryFeatureSource *sour { mUsingFeatureIdList = true; mFeatureIdList = mSource->mSpatialIndex->intersects( mFilterRect ); - QgsDebugMsg( "Features returned by spatial index: " + QString::number( mFeatureIdList.count() ) ); + QgsDebugMsgLevel( "Features returned by spatial index: " + QString::number( mFeatureIdList.count() ), 2 ); } else if ( mRequest.filterType() == QgsFeatureRequest::FilterFid ) { @@ -138,8 +138,8 @@ bool QgsMemoryFeatureIterator::nextFeatureUsingList( QgsFeature &feature ) if ( hasFeature && mSubsetExpression ) { - mSource->mExpressionContext.setFeature( candidate ); - if ( !mSubsetExpression->evaluate( &mSource->mExpressionContext ).toBool() ) + mSource->expressionContext()->setFeature( candidate ); + if ( !mSubsetExpression->evaluate( mSource->expressionContext() ).toBool() ) hasFeature = false; } @@ -198,8 +198,8 @@ bool QgsMemoryFeatureIterator::nextFeatureTraverseAll( QgsFeature &feature ) if ( mSubsetExpression ) { - mSource->mExpressionContext.setFeature( *mSelectIterator ); - if ( !mSubsetExpression->evaluate( &mSource->mExpressionContext ).toBool() ) + mSource->expressionContext()->setFeature( *mSelectIterator ); + if ( !mSubsetExpression->evaluate( mSource->expressionContext() ).toBool() ) hasFeature = false; } @@ -257,9 +257,6 @@ QgsMemoryFeatureSource::QgsMemoryFeatureSource( const QgsMemoryProvider *p ) , mSubsetString( p->mSubsetString ) , mCrs( p->mCrs ) { - mExpressionContext << QgsExpressionContextUtils::globalScope() - << QgsExpressionContextUtils::projectScope( QgsProject::instance() ); - mExpressionContext.setFields( mFields ); } QgsFeatureIterator QgsMemoryFeatureSource::getFeatures( const QgsFeatureRequest &request ) @@ -267,4 +264,19 @@ QgsFeatureIterator QgsMemoryFeatureSource::getFeatures( const QgsFeatureRequest return QgsFeatureIterator( new QgsMemoryFeatureIterator( this, false, request ) ); } +QgsExpressionContext *QgsMemoryFeatureSource::expressionContext() +{ + // lazy construct expression context -- it's not free to calculate, and is only used when + // iterating over a memory layer with a subset string set + if ( !mExpressionContext ) + { + mExpressionContext = qgis::make_unique< QgsExpressionContext >( + QList() + << QgsExpressionContextUtils::globalScope() + << QgsExpressionContextUtils::projectScope( QgsProject::instance() ) ); + mExpressionContext->setFields( mFields ); + } + return mExpressionContext.get(); +} + ///@endcond PRIVATE diff --git a/src/core/providers/memory/qgsmemoryfeatureiterator.h b/src/core/providers/memory/qgsmemoryfeatureiterator.h index 1c771dab6edd..404fccec17b4 100644 --- a/src/core/providers/memory/qgsmemoryfeatureiterator.h +++ b/src/core/providers/memory/qgsmemoryfeatureiterator.h @@ -38,12 +38,14 @@ class QgsMemoryFeatureSource final: public QgsAbstractFeatureSource QgsFeatureIterator getFeatures( const QgsFeatureRequest &request ) override; + QgsExpressionContext *expressionContext(); + private: QgsFields mFields; QgsFeatureMap mFeatures; std::unique_ptr< QgsSpatialIndex > mSpatialIndex; QString mSubsetString; - QgsExpressionContext mExpressionContext; + std::unique_ptr< QgsExpressionContext > mExpressionContext; QgsCoordinateReferenceSystem mCrs; friend class QgsMemoryFeatureIterator; From c2831cc6184184b0097db55e7872c44f0c8df35e Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Fri, 9 Oct 2020 14:54:52 +0200 Subject: [PATCH 32/48] Don't crash on transaction save Fixes #39265 --- src/core/qgstransactiongroup.cpp | 32 +++++++++++++---- src/core/qgstransactiongroup.h | 2 ++ tests/src/python/test_provider_ogr_gpkg.py | 41 ++++++++++++++++++++-- 3 files changed, 66 insertions(+), 9 deletions(-) diff --git a/src/core/qgstransactiongroup.cpp b/src/core/qgstransactiongroup.cpp index 1ba97b1f3518..057e7ae719c7 100644 --- a/src/core/qgstransactiongroup.cpp +++ b/src/core/qgstransactiongroup.cpp @@ -19,6 +19,7 @@ #include "qgsvectorlayer.h" #include "qgsdatasourceuri.h" #include "qgsvectordataprovider.h" +#include "qgslogger.h" #include @@ -102,7 +103,7 @@ void QgsTransactionGroup::onBeforeCommitChanges( bool stopEditing ) mEditingStopping = true; - QgsVectorLayer *triggeringLayer = qobject_cast( sender() ); + const QgsVectorLayer *triggeringLayer = qobject_cast( sender() ); QString errMsg; if ( mTransaction->commit( errMsg ) ) @@ -110,17 +111,29 @@ void QgsTransactionGroup::onBeforeCommitChanges( bool stopEditing ) const auto constMLayers = mLayers; for ( QgsVectorLayer *layer : constMLayers ) { - if ( layer != sender() ) + if ( layer != triggeringLayer ) + { layer->commitChanges( stopEditing ); + } + } + + if ( stopEditing ) + { + disableTransaction(); + } + else + { + if ( ! mTransaction->begin( errMsg ) ) + { + QgsDebugMsg( QStringLiteral( "Could not restart a transaction for %1: %2" ).arg( triggeringLayer->name() ).arg( errMsg ) ); + } } - disableTransaction(); } else { emit commitError( errMsg ); - // Restart editing the calling layer in the next event loop cycle - QTimer::singleShot( 0, triggeringLayer, &QgsVectorLayer::startEditing ); + restartTransaction( triggeringLayer ); } mEditingStopping = false; } @@ -147,8 +160,7 @@ void QgsTransactionGroup::onRollback() } else { - // Restart editing the calling layer in the next event loop cycle - QTimer::singleShot( 0, triggeringLayer, &QgsVectorLayer::startEditing ); + restartTransaction( triggeringLayer ); } mEditingStopping = false; } @@ -165,6 +177,12 @@ void QgsTransactionGroup::disableTransaction() } } +void QgsTransactionGroup::restartTransaction( const QgsVectorLayer *layer ) +{ + // Restart editing the calling layer in the next event loop cycle + QTimer::singleShot( 0, layer, &QgsVectorLayer::startEditing ); +} + QString QgsTransactionGroup::providerKey() const { return mProviderKey; diff --git a/src/core/qgstransactiongroup.h b/src/core/qgstransactiongroup.h index 158b3183be3b..eb211e0143f8 100644 --- a/src/core/qgstransactiongroup.h +++ b/src/core/qgstransactiongroup.h @@ -91,6 +91,8 @@ class CORE_EXPORT QgsTransactionGroup : public QObject void disableTransaction(); + void restartTransaction( const QgsVectorLayer *layer ); + QSet mLayers; //! Only set while a transaction is active std::unique_ptr mTransaction; diff --git a/tests/src/python/test_provider_ogr_gpkg.py b/tests/src/python/test_provider_ogr_gpkg.py index ba88f611738e..9e06ba89d38e 100644 --- a/tests/src/python/test_provider_ogr_gpkg.py +++ b/tests/src/python/test_provider_ogr_gpkg.py @@ -1728,7 +1728,7 @@ def testExporterWithFIDColumn(self): self.assertEqual(f.id(), 123) def testTransactionGroup(self): - """Issue https://github.com/qgis/QGIS/issues/36525""" + """Test issue GH #36525""" project = QgsProject() project.setAutoTransaction(True) @@ -1768,7 +1768,7 @@ def testTransactionGroup(self): self.assertFalse(vl1_1.isEditable()) self.assertFalse(vl1_2.isEditable()) - @unittest.skipIf(int(gdal.VersionInfo('VERSION_NUM')) < GDAL_COMPUTE_VERSION(2, 3, 0), "GDAL 2.3 required") + @unittest.skipIf(int(gdal.VersionInfo('VERSION_NUM')) < GDAL_COMPUTE_VERSION(2, 3, 0), "GDAL 2.3 required") def testTransactionGroupIterator(self): """Test issue GH #39178: the bug is that this test hangs forever in an endless loop""" @@ -1800,6 +1800,43 @@ def testTransactionGroupIterator(self): # Test that QGIS sees the new changes self.assertEqual(next(vl.getFeatures()).attribute(1), 'new value') + def testTransactionGroupCrash(self): + """Test issue GH #39265 segfault""" + + project = QgsProject() + project.setAutoTransaction(True) + tmpfile = os.path.join( + self.basetestpath, 'tempGeoPackageTransactionCrash.gpkg') + ds = ogr.GetDriverByName('GPKG').CreateDataSource(tmpfile) + lyr = ds.CreateLayer('test', geom_type=ogr.wkbPoint) + lyr.CreateField(ogr.FieldDefn('str_field', ogr.OFTString)) + + f = ogr.Feature(lyr.GetLayerDefn()) + f.SetGeometry(ogr.CreateGeometryFromWkt('POINT (1 1)')) + f.SetField('str_field', 'one') + lyr.CreateFeature(f) + + del lyr + del ds + + vl = QgsVectorLayer(tmpfile + '|layername=test', 'test', 'ogr') + + project.addMapLayers([vl]) + + feature = next(vl.getFeatures()) + feature.setAttributes([None, 'two']) + + self.assertTrue(vl.startEditing()) + self.assertTrue(vl.addFeature(feature)) + + # Save without leaving editing + self.assertTrue(vl.commitChanges(False)) + + # Now add another one + feature.setAttributes([None, 'three']) + self.assertTrue(vl.addFeature(feature)) + if __name__ == '__main__': unittest.main() + From ea90774621c85f00405df899af40c26b7420ea5e Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Fri, 9 Oct 2020 16:11:36 +0200 Subject: [PATCH 33/48] flake8 --- tests/src/python/test_provider_ogr_gpkg.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/src/python/test_provider_ogr_gpkg.py b/tests/src/python/test_provider_ogr_gpkg.py index 9e06ba89d38e..a2b39853016b 100644 --- a/tests/src/python/test_provider_ogr_gpkg.py +++ b/tests/src/python/test_provider_ogr_gpkg.py @@ -1768,7 +1768,7 @@ def testTransactionGroup(self): self.assertFalse(vl1_1.isEditable()) self.assertFalse(vl1_2.isEditable()) - @unittest.skipIf(int(gdal.VersionInfo('VERSION_NUM')) < GDAL_COMPUTE_VERSION(2, 3, 0), "GDAL 2.3 required") + @unittest.skipIf(int(gdal.VersionInfo('VERSION_NUM')) < GDAL_COMPUTE_VERSION(2, 3, 0), "GDAL 2.3 required") def testTransactionGroupIterator(self): """Test issue GH #39178: the bug is that this test hangs forever in an endless loop""" @@ -1839,4 +1839,3 @@ def testTransactionGroupCrash(self): if __name__ == '__main__': unittest.main() - From 9b99ecb56f429899ce9c152d30fef626c5bdeaa9 Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Mon, 12 Oct 2020 12:09:33 +0200 Subject: [PATCH 34/48] OGR decodeUri: be tolerant on layerName case Unreported issue: discovered in the QGIS-Documentation test CI issue https://travis-ci.org/github/qgis/QGIS-Documentation/builds/734917369#L679 --- src/core/providers/ogr/qgsogrprovider.cpp | 6 +++--- tests/src/python/test_provider_ogr_gpkg.py | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/core/providers/ogr/qgsogrprovider.cpp b/src/core/providers/ogr/qgsogrprovider.cpp index d64e5338b37d..3e81d1cb3052 100644 --- a/src/core/providers/ogr/qgsogrprovider.cpp +++ b/src/core/providers/ogr/qgsogrprovider.cpp @@ -3473,9 +3473,9 @@ QVariantMap QgsOgrProviderMetadata::decodeUri( const QString &uri ) if ( path.contains( '|' ) ) { - const QRegularExpression geometryTypeRegex( QStringLiteral( "\\|geometrytype=([a-zA-Z0-9]*)" ) ); - const QRegularExpression layerNameRegex( QStringLiteral( "\\|layername=([^|]*)" ) ); - const QRegularExpression layerIdRegex( QStringLiteral( "\\|layerid=([^|]*)" ) ); + const QRegularExpression geometryTypeRegex( QStringLiteral( "\\|geometrytype=([a-zA-Z0-9]*)" ), QRegularExpression::PatternOption::CaseInsensitiveOption ); + const QRegularExpression layerNameRegex( QStringLiteral( "\\|layername=([^|]*)" ), QRegularExpression::PatternOption::CaseInsensitiveOption ); + const QRegularExpression layerIdRegex( QStringLiteral( "\\|layerid=([^|]*)" ), QRegularExpression::PatternOption::CaseInsensitiveOption ); const QRegularExpression subsetRegex( QStringLiteral( "\\|subset=((?:.*[\r\n]*)*)\\Z" ) ); const QRegularExpression openOptionRegex( QStringLiteral( "\\|option:([^|]*)" ) ); diff --git a/tests/src/python/test_provider_ogr_gpkg.py b/tests/src/python/test_provider_ogr_gpkg.py index ba88f611738e..34250d8de599 100644 --- a/tests/src/python/test_provider_ogr_gpkg.py +++ b/tests/src/python/test_provider_ogr_gpkg.py @@ -257,11 +257,26 @@ def testDecodeUri(self): self.assertEqual(components["path"], filename) self.assertEqual(components["layerName"], 'test') + uri = '{}|layerName=test'.format(filename) + components = registry.decodeUri('ogr', uri) + self.assertEqual(components["path"], filename) + self.assertEqual(components["layerName"], 'test') + uri = '{}|layerid=0'.format(filename) components = registry.decodeUri('ogr', uri) self.assertEqual(components["path"], filename) self.assertEqual(components["layerId"], 0) + uri = '{}|layerId=0'.format(filename) + components = registry.decodeUri('ogr', uri) + self.assertEqual(components["path"], filename) + self.assertEqual(components["layerId"], 0) + + uri = '{}|geometryType=POINT'.format(filename) + components = registry.decodeUri('ogr', uri) + self.assertEqual(components["path"], filename) + self.assertEqual(components["geometryType"], 'POINT') + def testEncodeUri(self): filename = '/home/to/path/my_file.gpkg' From 00ccfc8cea56bd7b896149dfa467be76d9277edc Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Mon, 12 Oct 2020 16:36:40 +0200 Subject: [PATCH 35/48] GDAL provider: don't crash on invalid bands Fix unreported crash --- src/core/providers/gdal/qgsgdalprovider.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/providers/gdal/qgsgdalprovider.cpp b/src/core/providers/gdal/qgsgdalprovider.cpp index d436ddde057f..1fb090aaa472 100644 --- a/src/core/providers/gdal/qgsgdalprovider.cpp +++ b/src/core/providers/gdal/qgsgdalprovider.cpp @@ -1309,6 +1309,12 @@ QString QgsGdalProvider::generateBandName( int bandNumber ) const } QString generatedBandName = QgsRasterDataProvider::generateBandName( bandNumber ); GDALRasterBandH myGdalBand = getBand( bandNumber ); + if ( ! myGdalBand ) + { + QgsLogger::warning( QStringLiteral( "Band %1 does not exist." ).arg( bandNumber ) ); + return QString(); + } + QString gdalBandName( GDALGetDescription( myGdalBand ) ); if ( !gdalBandName.isEmpty() ) { From dbe2a3beb6be6a2418c1a5e481109d1b2cb928f3 Mon Sep 17 00:00:00 2001 From: Etienne Trimaille Date: Mon, 12 Oct 2020 09:08:54 +0200 Subject: [PATCH 36/48] Add note about Python bindings in QgsAction --- python/core/auto_generated/qgsaction.sip.in | 10 ++++++++-- src/core/qgsaction.h | 11 +++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/python/core/auto_generated/qgsaction.sip.in b/python/core/auto_generated/qgsaction.sip.in index 17c64e41e9df..e3671c46eb77 100644 --- a/python/core/auto_generated/qgsaction.sip.in +++ b/python/core/auto_generated/qgsaction.sip.in @@ -42,7 +42,7 @@ Create a new QgsAction :param description: A human readable description string :param command: The action text. Its interpretation depends on the type :param capture: If this is set to ``True``, the output will be captured when an action is run -:param enabledOnlyWhenEditable: if ``True`` then action is only enable in editmode +:param enabledOnlyWhenEditable: if ``True`` then action is only enable in editmode. Not available in Python bindings. %End QgsAction( ActionType type, const QString &description, const QString &action, const QString &icon, bool capture, const QString &shortTitle = QString(), const QSet &actionScopes = QSet(), const QString ¬ificationMessage = QString() ); @@ -57,7 +57,7 @@ Create a new QgsAction :param shortTitle: A short string used to label user interface elements like buttons :param actionScopes: A set of scopes in which this action will be available :param notificationMessage: A particular message which reception will trigger the action -:param enabledOnlyWhenEditable: if ``True`` then action is only enable in editmode +:param enabledOnlyWhenEditable: if ``True`` then action is only enable in editmode. Not available in Python bindings. %End QString name() const; @@ -126,6 +126,12 @@ Whether to capture output for display when this action is run Returns whether only enabled in editable mode %End + void setEnabledOnlyWhenEditable( bool enable ); +%Docstring +Set whether the action is only enabled in editable mode + +.. versionadded:: 3.16 +%End bool runable() const; %Docstring diff --git a/src/core/qgsaction.h b/src/core/qgsaction.h index 875fc54729c1..62123502f131 100644 --- a/src/core/qgsaction.h +++ b/src/core/qgsaction.h @@ -57,7 +57,7 @@ class CORE_EXPORT QgsAction * \param description A human readable description string * \param command The action text. Its interpretation depends on the type * \param capture If this is set to TRUE, the output will be captured when an action is run - * \param enabledOnlyWhenEditable if TRUE then action is only enable in editmode + * \param enabledOnlyWhenEditable if TRUE then action is only enable in editmode. Not available in Python bindings. */ #ifndef SIP_RUN QgsAction( ActionType type, const QString &description, const QString &command, bool capture = false, bool enabledOnlyWhenEditable = false ) @@ -90,7 +90,7 @@ class CORE_EXPORT QgsAction * \param shortTitle A short string used to label user interface elements like buttons * \param actionScopes A set of scopes in which this action will be available * \param notificationMessage A particular message which reception will trigger the action - * \param enabledOnlyWhenEditable if TRUE then action is only enable in editmode + * \param enabledOnlyWhenEditable if TRUE then action is only enable in editmode. Not available in Python bindings. */ #ifndef SIP_RUN QgsAction( ActionType type, const QString &description, const QString &action, const QString &icon, bool capture, const QString &shortTitle = QString(), const QSet &actionScopes = QSet(), const QString ¬ificationMessage = QString(), bool enabledOnlyWhenEditable = false ) @@ -172,6 +172,13 @@ class CORE_EXPORT QgsAction //! Returns whether only enabled in editable mode bool isEnabledOnlyWhenEditable() const { return mIsEnabledOnlyWhenEditable; } + /** + * Set whether the action is only enabled in editable mode + * + * \since QGIS 3.16 + */ + void setEnabledOnlyWhenEditable( bool enable ) { mIsEnabledOnlyWhenEditable = enable; }; + //! Checks if the action is runable on the current platform bool runable() const; From 5aba56c0a4c5986d5129d4fc23a6a2458020cefb Mon Sep 17 00:00:00 2001 From: vcloarec Date: Sun, 11 Oct 2020 23:13:25 -0400 Subject: [PATCH 37/48] fix 3d mesh dataset rendering --- src/3d/mesh/qgsmesh3dgeometry_p.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3d/mesh/qgsmesh3dgeometry_p.cpp b/src/3d/mesh/qgsmesh3dgeometry_p.cpp index 0d0cd05e09d3..80bec0318f15 100644 --- a/src/3d/mesh/qgsmesh3dgeometry_p.cpp +++ b/src/3d/mesh/qgsmesh3dgeometry_p.cpp @@ -416,7 +416,7 @@ int QgsMeshDataset3dGeometry::extractDataset( QVector &verticalMagnitude //if invalid (for example, static mode) use the scalar dataset index int vertDataSetIndex = scalarDatasetIndex.dataset(); vertDataSetIndex = std::min( vertDataSetIndex, layer->datasetCount( mVerticalGroupDatasetIndex ) - 1 ); - verticalMagDatasetIndex = QgsMeshDatasetIndex( vertDataSetIndex, mVerticalGroupDatasetIndex ); + verticalMagDatasetIndex = QgsMeshDatasetIndex( mVerticalGroupDatasetIndex, vertDataSetIndex ); } //define the active face for vertical magnitude, the inactive faces will not be rendered // The active face flag values are defined based on the vertival magnitude dataset From 364e2e92d732b2c25e9007f29a8df83b48811d39 Mon Sep 17 00:00:00 2001 From: vcloarec Date: Mon, 12 Oct 2020 08:56:36 -0400 Subject: [PATCH 38/48] fix and improve test --- tests/src/3d/testqgs3drendering.cpp | 3 ++- .../3d/expected_mesh3d/expected_mesh3d.png | Bin 15158 -> 29658 bytes 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/src/3d/testqgs3drendering.cpp b/tests/src/3d/testqgs3drendering.cpp index b7bfe07ded4f..b7a832755d94 100644 --- a/tests/src/3d/testqgs3drendering.cpp +++ b/tests/src/3d/testqgs3drendering.cpp @@ -140,7 +140,7 @@ void TestQgs3DRendering::initTestCase() QVERIFY( mLayerMeshDataset->isValid() ); mLayerMeshDataset->setCrs( mLayerDtm->crs() ); // this testing mesh does not have any CRS defined originally mLayerMeshDataset->temporalProperties()->setIsActive( false ); - mLayerMeshDataset->setStaticScalarDatasetIndex( QgsMeshDatasetIndex( 0, 0 ) ); + mLayerMeshDataset->setStaticScalarDatasetIndex( QgsMeshDatasetIndex( 1, 0 ) ); mLayerMeshDataset->setStaticVectorDatasetIndex( QgsMeshDatasetIndex( 2, 0 ) ); mProject->addMapLayer( mLayerMeshDataset ); mProject->addMapLayer( mLayerMeshDataset ); @@ -148,6 +148,7 @@ void TestQgs3DRendering::initTestCase() QgsMesh3DSymbol *symbolMesh3d = new QgsMesh3DSymbol; symbolMesh3d->setVerticalDatasetGroupIndex( 0 ); symbolMesh3d->setVerticalScale( 10 ); + symbolMesh3d->setRenderingStyle( QgsMesh3DSymbol::ColorRamp2DRendering ); symbolMesh3d->setArrowsEnabled( true ); symbolMesh3d->setArrowsSpacing( 300 ); QgsMeshLayer3DRenderer *meshDatasetRenderer3d = new QgsMeshLayer3DRenderer( symbolMesh3d ); diff --git a/tests/testdata/control_images/3d/expected_mesh3d/expected_mesh3d.png b/tests/testdata/control_images/3d/expected_mesh3d/expected_mesh3d.png index da65dd64ca41f57a2c8ca9830306f3d80171b121..63417be00687851f19b9570db273ee76189408a2 100644 GIT binary patch literal 29658 zcmeEt^;cV6&~9*wI|YgqEe@rH;uWNLk>Ku5v7iB3N{bXI?oiwbnxMf76fX`5S~Ng# zx8A(pUEd#Yf4^BLD{GzPWcHptduGo(&qRIDR3;^2Bmw{cq$=+fbN~SCFaQ8+l@J?q zr?o+?0rT^sD$+tANPQBMJ)Hf4{3_CthkCbVPZ09R}HqXjo4Zl1UhdL^0w~D~o790bmi7 zq%J&rteDTh82D=MLA$LY*As{akDJaxA^O!7?Eekx|G)m9HDFnx zq9zLfq~1wQ(Q3ov~8y32A?2MGfT zuXK1ERB$md04(tUSm7yz2EsG{ND7u>y$#&g*RTNk*c2j$o+D&rI^JUn<*7CET;kH; z!^L>$0wETFAB*sD6uuk!WK=E*DGq=RA9I_=o`66lU&^Ycl}bRz>o$J# z;I6mt2`|7>5hDiW0Q&gh#o(fHhXSu1yAk}x=G{X#dn^M$zG!{t#H#- z$PZk)SP}}s!YIla^VLFa7wlhkM|Y-!uDR=W*+-=M!olc8=$6_r0Up5c5k?(4R-Zhs zUJds2Em`)zN)H{=T&uTR7eYkKkEbap6Z~HR2|oDnO$K|9|9)^WjXa!$WbJ(4g$CEj z$pE^D0ND7{N)%Ug`eqBsAC)qbIlLXLb{!TDK3?lPJ`SVB$0gy$uUQT(Y~PJe-WWO^ z&)H3haQoywtVDbLJ2bUZ4G>0)nI?C5;MhWx&+UjvJP0L`Ml79{daI!-o#08M^Y2CI zHvmAF6qh7b+IMx2uqiJP*gcH+=JCXRJqR*+E&)9Z5=GoK=t0DIH54S?^#auK zFh*=XB7B6VXwZEglh~0}kB1nczXqV7QF_l_>JFN zrgi6Q3mw}RgUytM5XBZqLjELTTHhPeGYxEjI$Ohk+b#0zCyxQKY9g@_J5g!h`z{F| z+g1Bg@MQgyi4|s-TDSN!!aybVRu)El%SnvsPKrstGBgq-48DacJl(z}a3TQKFO5OV zPxQnY=!Lqfl{Gs<6j++LCofAK^iAd_BnSZ_k1UB81-Np&$2L^z_>VN0wrb{mj|@v~ z$zc(LCqQk1r8D_bSC-TT0c9pQHLirOOX z=6&p+D&h}6&vLq$t2H?fIi4>yF&SXiLVyS3kI+9pK_Y!J5(i(EP+Wmzyu(%8r62 ztXCoVXn#vhNPl@-Aojbad0_!g#f@*N@+qvlU`qH%(53#zUW%)5mDF$r8ld;-6;+PG zCxr{eZ|>E(g_}%xtbQ+UIa+@J0BTscBy^MvSJCh1ZfvHz<|270&-1)lx-Vsk&e{YG zWmbl&XBx^K^*V@}xk3p^acV~~60Ak@y5^>eg!QzCJ8KbhId7h!^x~Ci8zHRwi&ORY z)Iqc#)hf`Lx14EVSC`QkSjK6 zJ;Gi0@k0)>KDdDYWDc`7ju>IxJM!DE4Zl5=y1gU1<{-2LF&!gl(s9<{Tjc|E zo2ysOi%UXEy(*;^_|!PHgqVl049mJCBHx5xZ(FZQkG~w}Fu!>zH_UvB?CAX)X9!(+ zURmHiBhFtr6f7K?0ss&b;F4?+69?bQAv0tm{9Ed_&+cW2o3{dr=(&twT$iXsn{q!A zR#+$<@lH>>=HOJ6P)_()EW^hb*C$8Jd_|}58)xNsQ>wEWs;vCBBR5Nt7HRWz!tLYq z2Se5f)#w?dy#y+41RMbXoMPOVP5tU82tS{opw-I3@1{`Gy*RhV5=2mJ6|uAjsJ_Do zzs-(SdVtoww5QD0p(G&&qrZMUYT( z!$A7P`7HK4=73c_ej(~&=O)DR8#8T#%|R9u?J8K>U7t1DU85;$y-Iv7>yHQki$a9Z zsH{)_*Vu^p4r*L7jp-1g4$HCZa`OsswW=xGEAscOU}~ZJyhO?JwV3$v;BF%Cdswf| zHd&oIqD}kz4pWwuH2{}Fj*N@CmY)QjZ9#OgsDT=PqN=;j2*VvL9*rrgKv%4^z;{c`I-n6+~7~_`Mt=q7dSBst%RGF5mIo-SL z{bjj{32IMeu~&`{pZ`T7RAlK)XxlEnO?29RD{Am|>}WKjau|2ek&+VvaWb84@QGjj zbJrcEr!e8pIEm7$YmE?yDQnG$6#DYDI~o@oUxE0}bnthfIW5l-8k&=3B4G5xC;!cM z%hcpMj>wiD)>Lk~Ih&*Y-^tDaLsMh3kP95QL6rjnuAFOU>qPjfoa5sv0k+kYvCnem zg=|ja$zx33ZC{pBkih!O;uX^oX2lNk0ExZ}DpFwbTvT~_WhOCAC9_k!0>~lSZU#Fc z8(1681Wk?FabdEuu4NAkGk9@I930^*zHPCT7W!79jf};Fc0t7NI2=##-fIqKHx^j(pES1&~Ez((rOTY;(_%)0RX+&;S!7s3GRsG1S zSJm4SCY{MQTQ9iRBPF4@i43$mmx^-!1&_~(O!ZT3(jCR({9C{^Irlv&;5QdwiV(M5 zXCD6(WXXMc53~zvq)5Doi6C&4ncU7AxSK{=^h2c=K64n%HW&5__1)CWM5si|Qc9BR zJY`o6BAXSr__#q?fB8y>h^OqSl}N|yF8v!6WjZ~PMvUgp*smT1R=LkgHR z`k!l)vC%3`rV!RlAEP`*xGp5|HWr3MJRM_FAI^(ylWAmX_pcaQ<6u z%{B3uk3^d1cC$0u(Ixx)AB5 zK}KfnU;?_j0!sS&Zp~g(i|NVW@R8hGQJ#cmW$Fnj-=x!{SS#u=S-7jjd2WDv10Y?W zZ53sk)uHmI9RBQ+$2jtH5I$VCH*ot|qDAGMl@hOP#ORGGbA-zYY-`K|#3KL7l?M?K zAC|Vlf#yO?vVO~W_L#1Ws-73ppVR7)t5^|WoGK{}D8VQ6C(5|PL<-bI#g27LnuYS9 z^?*73LH=^xS@vT0i*sEXQFHOjbLaJ)46!?)fok5{Pos8*%!pa}dLc--jpR&rqW=Sa zj8F0RO$w}ZCAQV_&*cXEMV<1~&`R^t8!wXJ&4jIqf`6jZF2wZ2&Ad<}?l-#ka;@7Z z!C2Y@!Dy1vCz9S$)Ya=UBdKX!K$m?V@2Z+ z8c$6B+%L!S9v-{wuv3(O_5cfn@XW;s!InK{@1lV{gX#|^eM25j9VIK zr`}$RKk1S8Fl)WwY7s@TT3N?umv_j4A_t0z-bpNHlI`)FV%38@miw~qq-t>Shpf7j zgdLZ<{RT~ySM@^a)2G#m(lgl`HLe-tap-c)*_oK)$W{!K#JPp3)kp@a)(tm?n#dUXkkBix4XI2NHKIn3u(lf$ze z*ejkw_jGC%;=Z5EoT`~#oG#%^C6O2KAn}X2?Sysw;~8ZF{+&5mG@jJvtmNGU4}OJ? zloSL%r=HmDw@@AdJr<`AbHc;Uecw+M92IRH2W3XuA^p>8+xm4uR%;>w*HFU)nT@jY zx3oO`UTC34aml{BXGV?XU?((E+>usVtuiiMax~SU!`8)O($T`XJ~6#<3SN*6^W0<=|R?CLC|q70N;TyT%4y~^|{9dbq_@$0v^EnjFv&9F|u z$Na5thiINEvIOs?J(6nGxcg>G%tr7!c^};6{Jx$CDGZo;gexOD-vx`ea7)cX*2xap zB;DTT<{1-bl8`Buwoc7XMVnctQkoTV!X}twx6E%PmHVBF&Cfe&)Zac zw)OO^dC6&oAJrh^Nh)j08pzj>*#xQ0VcdW=LHJbq;jaFP1=fh;yB<&QdFv zB;}I+pGsI&dS3~TO#(8MOJ6D( z_kO{dnrN@xgYMq_Q@inOx^xU&2(#Zf-lY^bYu*mk%9zly7(oufdEfI)y=T3xx8L-J zT=gL)Eht0oywd#mF3)dCmoQ#Rl;X&%8yC*0^(SHZ31#bvx8i&C4tM2yDRk=DMI*ob zb(Z*jlV(Z#iw_+;4$6p}NS1d4blcfzbx7W0;hqyZV&PP9!0k|dl}20F&^#>uyPc43 z;ZVvts_!*bYlrIX1R=pwgpYARTS+Aav9z$>UZ#cBd?~6j^NM zn)Qj2Ilw2yA#1-1o_WF82WO75rCPG`zYvTxy%uhS-1ryUZ7S0vB@*jgEKJhp7waJ= zM$Ko|_=g5++!7f*P!hlt0dD)R5wcmM;^R}e2J6Ausoh|qy{AiPfJYiA!KO^&&JrPe znb`^+mey+DZT-vt)s}iG@r~dToZo&k`ENy~+{H@*yZyaKz_>Tx1%i>5&X*0No9^O9 zqmL8439{xVY2DmYu&+O(Fm~|Vf7OLcN_AC@#(36~N1Lh6zn_+;ALvA1_>6z7#ArFW zzS&X6nNw(dasi2JJpm2Hf8#8zIrlRn6~|jTZ_OHMKmu_aOsTv1F!`Z(*H0Ls_0UF` z)A<51^taHeiJf83)C5!g!NoRb#3(F9`QCW+;%f^(REr!TC;Pj}gG*$FhO%0<(pPl* z1xu7z0#q1c54ozqP7wIAo7tV_m4mXoq^4WvOe#BUwqkZOxh2}{yRa)bu(Oby{y0N> z3>-CvRiwS1te0j~HM>t~>VjL^g>|BkjKW8;Bg*|sLr*kU+pG?vp~48?^VI~mDD?)X zCMR)Fg=@>t?IH+?)TE&1OX(Bup$7jEw^6ZzF;W?37JFNZmzD{{LKu3C+0fPEzG2X}ithLO zL22iO+b2Y3{I?Z(r!Wueh=m_Ff(_3*zuPYF50m}8yTCL0?l(YI(9x0ZQzP)+iUCkU zPUz3njb^$UzpQLB9?LoyoSPQ{X~ygE29f11XhlQ)%+zQdsbaxulfG!X(P~=@)NehV2r5>Cv%-ug9wT11!^ zZ_kWnw#ina!j{USO3%oUz6!v$+E;Aus`v>{B`4Y5kw>?AX-O0fvq6l%cs2&CbR4Y- zA4rznwM!vD#m+7g7k&G?pcl>NC8KtD&uBC^`YBNnO+)i+XF-Ez;4cz}w(+?g>J}~o zyID2l{FT7v7abmdb^~sp$=Rx)m&5<>uy0t~mG=9K1`c9keh$c8?j0{ULVfu}ruW6n z=7gwyskejRWwQG;)%R+;V3mRm+-756_W~Qa0k|ncd+n8B&q+R5_b(nj0`8g?>-`G; zF(c*fDzS5S=>EeqMF^W7cu+_>cz?eeZmIeyj6Q<AQX6RIR^QG$76NnSdWxUcUw^#(1kyO%snL@u7n44RqDUAFS$-Rjcqv`HaU)HRosVjmtShSqW*Bxt>|>L|6@ zWlKFmO>)7b&>P3E%)dK#>cQYIH)F+C1-$rO)6WfevDA68pyrx!VDRSI{KquM*v3X@ z&IN+mxr@yRX)-~^(kZi9!OCvjmNpUiddPZvT=`$J`ZTbvv+DvZuy)xi2fBgEZMBEarTl%6kD)C2U{F3%0$OjAK^a}I(Tvu^6; z!|*7eYn--ST}{Mk;u9*r3OyTlC7ojM>9WVM7Dw?Urjm)&h|C}x6cVn9z0L2Lc4xmnfceMjm6+YVC|bFM$V z#cgdC`Whe=f9dJ+%s%L_eCiaGlWrJhf?Ty(geFJU!2cPu2QIOcN{0&HcZT(uVG8UD zT`|L8?-gA#!hI&Uqoj8JCHwHa%EUoIA2dUR$JUX0`HkRr`E2j%*!%B~$I|?%a zDvVi|S<^qT+nUUg4Yswazws{_dL>Ap3N?a;@%t{(vj)4pT&Z_&9$_L<$ZG#(AIyQ2 zxW2G6+JYFDf~ljHtaJ|`Lmy|rb0Irvterc#hvGnlU3C2@<9)$9Og@Pb8;KFS6mX=# zH#kC>o8_pfobxtT{BNy^@YiVP1ybeK_8K8!i&rk3=rg9O&!8`6UZqZXFL$G+Qpxo) z4PT%Iw#D}wfy;ew$igN5-#FxO{x^rBADUa|U4V&D%2#oms z-k$mbZ;BYV9o_73kT?_0qmTS_eP%Sloq5XR;kN%HO~H!!R;ej*fkMF-`7|Pa&x2g@ zN8NAV;pD|ZqUIHn)*Dsz;z`X`uGs`i=x_Z2Y4Y1>E5CV(1s>a%NT$>N(Eu?nRY~dz z`Nebc#y?M*dpVHDKW@0T zj}Wa_N_;ZVEez1RVL zR;BcVz%7)GGQ)u9n4oEceEC6}$iLSdvj0)Ajql0B2_QZA$RNlG1HEu^nT^9Y6^IJv z6Nnm~w=@(iQG|crRmvoH*Wuf^5u~RA&e_mVL{0Q;8Fy++4HuL!SjlCS$vMhJjT+mx z)q$J7pL_9vPhT?C`19jXmY3E=y3i{1*MyNT9Iuu_LacS+s518^ryqMQ3uCO!=qE^S zKoT+gYOz)CVqY6su4}AfF18W-O5_*g8-2SWlJOwzIq+7t2CcS1sq}?!>wy@D*?V=F zh4TV$0qq7i{z8O7$k5xy5^zctx-u&h21b+qau>C+b4Y_JDI5@0DIYc;WK`yH#zUGQ zu4(kUh9h`g3OHE83`|?_Hv1!dG<(?pasg}u4!mB_?fjr$M^MZ{X*C#B?Pa-Z3KGj6r!;W$S3N$bMa%^|-%&dt zod-?t7N1}H-K;W`1z+rzir2)3E=)GHYAk-oEukRv=WX#mXloF5^&Aq%H^%Qmt96i3{W z3TOb_talyefqVqWLGz6F%PJ{6I`SqB&y6k}gQ86L$mTnek&beX?ZHNK9XiOI9sNt9 zS2-0n4pYM=5rLp)s*ioz;Ra%MMETSF`Cq(!3qTcjUb>Orm7&7rKlL^HA~V($ehKR} zw)OJe^?jE4VHa~VqG&Ott^2yMtMYENx*4COgh=L*3#!HDK>7gJL2?7_W^ppSLn|I4 zTw;feU}`*y`}G5;n@bpF%K(J^NVkO#)}z}->rV#JZ_{;vGNA`mr?A}3mz(F-`;~ES zqG5Wzm(?|GIk4k=~rJI4SblDNAFB(v%G_AUk zvm2=rGT`V8hk^Tqs6BZpdSCVMQC+A>uq9TgOr0w$Iq7$1O7FY0n~Wd8u=H#W*0O{-$7&Djl_&1w<$Wk3NDa`FGZz&#CHa0R9VipE-!Uh<)f$ zENog&2q$|;jl_0;=DPU(eB3e+ldXPb)@RN-g*Z&sgkw%}?5dK*K;bOp-8iR~YA!uT zR6mR*K$w|`ueIZfDP&OUS@dvBqg;z;0qrayo_aVc0QKU*?X@dUN-ovJ`8C1ZhMJwt zi=W+U_U6TD9|j9IpM$t6_ABiK_@hBLrkCev{@nhzoI+C-0x2%vY(WJv@J*9X8bp98 zY~1!2i?C}k7tmFM0_VP3a-_WhbAz3?*tMkb@4d4aZ?m`!_$hG#4%a!zu6Ee zbaa#(eFbxAYtp!NQJQ+Nhla1Xxq zuy)B`dO3M8@YKYyf+xvZ6-VUQlJ+doa~pgJy{HDkOngZwwL5>Ly<|vE)7E&?N+q9& zDm&;H?sgJNgb7rULCb7YHpTlIWRXPw217b-1Kp^V$J=jqG7N&MiPrg^N*bXpe?|D5 zs0w9+#ZY{3ccA->!I>5Q#b|}=%-d7eN?t}>%gnH_v_y-Q%Y)>kdXM$hu7HCmq2(X( zhk|M_iib=ei0z#aLCSKM=x>63E2>ymVC&H_M4;e9>7Mt{1H)(`(87wwsG>t3wciUNt|VK|49R{>enH21VQ;EYOSdtI#9TjQTp%QL7G0`M zl&(+!qO5n%zg|K0P=ZYQu74%&r%3|M_{gwL=UYoW7~+!5s7nK z!lqfBAH5%-0;`Rvg)~F=#I^#h8Eg;vbAC4J&AKwG)<$|do}@{-%bVwyl!Fh*t`}qx z4Xxh<8X@~Re4VNLd+u2?hBN;TgiBaD>pX7L*fQ`31zkf-cu9K?z6^I+?qZaW2V43_ zHV2;xl^$i;%K=_Xe#ll#Y8H3kKZ%7;HjQn$7Fn3RvslG*%`!iqsKGr=XzuqV_>-`s zB@Fv3h&1>+Ld&#gJ7L4NW!S&aPW>Y`oofcw0$#IpG_4t5V*@hKvhQ)7D~aaI zmIR8qEbY#=)R1)fU||Wb82*h|`nv#|1H%I8AG2Ev_o=S;3;u%0S-aoV&Rcmrs#!D6m^i!y(EMnanKv26Q7F$ z#!J!If1?nX@B*zz7}(6uO$kOxkndvi(QHvKJ&08&3XC8PAm+8a|MukN6ang#6i4+o zdFbVB1PlRhGf&#g);qs__%f)@ZiGq{$*|yWazIV1OM5%trs_E(4~x~81ccW?`NWM; zgTh^AJB``?b5(&}#KV*&WkmnDGOA95{)vlZf^&cd91C+p>5CtlL8Z>sSHD%Vo-am( zbtiw~-LV@O%?jbE_ZV`T%Sfv{>7`C~urO11J!}2r;zAiQ^@(6gdj#%&7;>vZ_ae%D z@Pgv+NjH(e0NicmITvaOBy&(zFJpNLWf%RBT8v=mg}b>;B{05by)A({JFZy9(njq* zB=QfyozfSU$Mo(mq2F>}|Ia+VHcB)+wBDT)-Rd*B*qaM+GRoK_&X@ba~vO{GdkuR()+Z z!ni-7dTTT-ZX;R1$S8%i=I6zJ<rQ9Orz9XtDcgB?5fiHJsxj(K*`W;cJetxwxuGFMS=7_~cFN*jIB| z8}`6^ZZQeKO9yD%e3LTIvn&y|1>?$YKWy_fMC*B z;>xJ?*-}aEsk#%aiQBBqmXrTdW#0mvo)TGP(W`H(&$)llv#a*$<~*`zfz+Itfu|zx zS;nx|_y?$ae{b~m^?cf4^i%&(@{Mm4t>OuWUs4Q-g2wFhWdS0n*Ih~7z^s)?T<7Q3 zYB;Jv{hl9-RHEdVU^Aoav%d??LTJs(jBN&Ao%5lXp)*By<=FbnAq-snf>C_?6M7FY z+M0JWaW3GC^q55%s!C{m$cJJvFS)Fz@MrUQcuN;Mq>GXUB3W6)UcT{ z3HS8KzW=X2&lAP!7SiBi!LF(hG|HkCr*S<9^&ZP`vjyu&aGkf;$bEBhiQMHtPLmWC z22Of!wZ>)H{Mw&=P6sQQkhqvO@D88dWw3YCH%c8gA?+<`sB*=#@CdrBi*;F{LBPn; zW~dx*Vs&1n%D{ZY`ND}zeY<@AUC~GLcw1Y*hC=isHO<^=@05hNFKe$0k+@Sl_ zepa#|Ycy1WB$sTTcrm!247~F?R$*G8=Pz+RmGW zKzegaWn8r(@f1nvCyB`wi2MdF zYeu{U_T~)~KN-;-Eeo*?Gcnv6e110?q*b15c4PshrgpI39I>%8hhM)gdTw@m6H_bY zXQT@U-#?oTDMEjCK4!#c*QR8|#~=|h-N7C^mToJ%s1)*C$%Ng-gIIGI6Bi^5a-nH* zx^x`~)2v@c{|YVO-0S6&%y{l53bfl{IaDeEy=nRbJ$Q>qPOGyagldpf*Xs%T=7}aq zQ;sSXpiQ#seQ69;7sIq>dz9?H1$tZnqN0^S&)M z+0TqW9&P3z5^>^H8PCdaah@JeZv1h0o&LM>TL zz0%Z(#fufwmj~b)>svSpYgNDPqGRDw=Xa`jT^ktkgbck$$o-K(-nYuay?;6dXFoEi zrQa4+O$EJ@Zb20qFH}owrffK%v>C7Xc=B28s;sO|W_e&hw`euH!Te?jV&$(nZf1vwd)p*KhYM#zc9Qe*oEAvTQ z(&5+P+!^s8(_*=r{B~bOq&)^r4(Ay}7?63$+-|`Ry#=sD1TmB9g?%Ffy|rQwoF9pL z+q=;62l*aW1~g}@FpLfyZsXA7g|t4Ob&K8WgIDBy7<{;;YUgiWn=G}Wy%e`tR!nlY z`H(RdVj-n47VPRJ;+5HY?UGL)AsN55syyMeqEPi31`bfxWCTp%;>rMnU558eZ^hfl zD^r!|wfvU99wvBAyG#+caTqXo&ZO`?m8UD#qC=PWD8Xc&lO41S$7^65tMVSy)@5#RrPjn(Pi_EoAHa5&$@+ zJnb6CB|&76Crw?%m=YIHy-9w*TLoDJcYh1vl`ty^FC*%!)|=mSh(~;4x}){jW9J&f;hQgq;Lfn9@N&&Z;yvF~$CP{5X)fLx!b*6i#{{0T zKrBqU+KQWm_JeI!!F_XJiLs?NEBAM&d4j!JZumbUYnl%UY_E>ctn#-PTA4VWbDA-< zCg`Uz@sXXgBBrM!WV%~JzczmTX&0XOc{@WC7KI;LS(?2)maCWx&how*HIY*k(B7nq z8MVdgP_yo)7v|P{IF4ax%~TCpS_3`b%n<;(q?g`OVcU1iF4W^m`g0v}*4s+A8{SF= z-_c9?JFO4)`&HWhpiotwCtUyU)8m$T+esZW;pkC;X1~z^C(`;7U zw`r@dfO@nYm@7GfYRi2S(<^cCFh&q^Eb6g=fG?{SG0jsv);Fg9U-mJ0{0Zq%9k@iNIkw(mE;2Pq-x+{$-#+Ct6iIKK|-B@ z!IPtp*)o-q@0XJVY^L0TC6O{gep!fpX6E-PC~YxfSCj6fLlb>5PB-)A04a_SDc@W*KmlBFkcCf|K5OEZC@*5S=T z11~L@g``DA7jUNYo$oDNSLPtHXwsk@x%c7Psj^8^CFb)ZDGTnU0SgAP(J4MuSm{(4 zMra>BtbGWPc6cD~{k*QhbNk&h;r`;WNMp!_-)jIYzO6qU)^^Y?KqUOreIQrI@+hFwN%5z32TP5ao0HbiUNW zDJwc&FW?2#!>_^D5cf<>}7FNsUM;4ETFgelsfMD=eJ{Rnus zpyhP1<50iRfyJdNYtjM4lbA|wC?0QbyYlo*#CWYG&3}m^!-FSFC}1Rx;83n%3pNKo zId{<_7TSSwh}!(loxdx!n2G&vzp}xVIlHJZ8HJ&k9m_k4%si1it?TJfQSe!s^$uVc zHF-JveyxTgIw&5pn;Z#O%yasB`Q?nA9g(2F_i4uOU^x-eA{Vo*DHHmU3T5PCu1#t) zPbIvvNIP=RxU#;tNU@lz<*tAFlzYjNVonJqP-&*gC1+@!@Lu*Z+->jjC240> zrEQNLJ0qpWK{Z#H+QrOV){0;6Hepyf0NcE!-F9nz<|`((F^0PzWNTJKfxl{?t{>FT zf+(p!W|We|U5zbv&Y$(#?H{!0E^-$Q;o_Ag2+p+_z+}bUjdUyBI-Qi9W(=VfV{cWo zU{E>>f36T&h1iYe^u82?l?uA2_05_hh{Y4z+UYo8Aq_*bSHw_5GYcK$YNpjVQytAD z{DhiX77MM@nqwo?vnFKWlLIQl58FN*+Qxap=uibM)+a6A7`CJlf9#`pmqca+;pLS$ z^T%P;^}wcReQ2MLzH+VFfeXnz$e%#OLqVPS)Xc_WHcFnExn`V?OR7UJ>acC?6t_zc zfCcd}mpXmqjLUXNRvq%-e_%RZI3`s243S?WV%(-`FyXGLKtFQ-&PPEwT`~$tGX#<4 zA)k7zca}Ti7*TB^yC>kbxbf1kzRFn@YOhuiV59A6*p*PH!ozRVBsZ4ftT_WRiG(Cy zG|JY1E9F-$MVKuqXH~boO|;f8H1<24FT1)2^*kzL>n0nLYLZJtV2I^xNL?|s5KW#Z zd5kB z@>tTFs=wI8Uck`*aLE4x&c;o&r0tJ7RU)DUWMn^nJZbXYrWh{%O>9%dBOx(-rI9=_ z46)bboOpX@8h3Fgx8Ec;?<#8{o6yVjhAw4Ez+;h*;(MGN&F<|7XB+!l7xG4Rvd*;U zH~AmMTbZZe9QeOv8NYzLX|%8EN%fxyL)I;~TX`ud&7?bD8fgqp(-FD6RLf7C`rQ1{ zrPbSAR0oWr7i^RccJ=fd*$kdY9dov^XsK2EI@n>}@w2|{I%Ji0mbNhH2f{;4fM2?; ziFsjLaWP_$F|%y^rpj|aYX>}+rwmY+iwt`+T)J(pUF$J~`dO5l#1%Q|_Q_c}`@l_* zw)W(?=I`GK27RAt>k8x!=rKA&q%oFqbi|)Yzn^@;vabC5+Kr|{C0(NHz`tKviO_T= zB8NhixzBtt0|R_Z(`YA)P~^xnfXLeGuGdFe-jJVN@R^I&>8im*ofjgk4mr8m*1>a~ z7kr>|JzFo$KNqnoMm!W214yM*YmtK15vrjPx7)3ED%NTNjg2|ZQFQD!0k70+;wF{^ zxYoza9zNmXyLC#@jv80(Aq>O`yKr%^a7N|F?)8cG)tbV|HP3P4$On##?tLOdPWDa@%XPQ+L^Au~@Jt3-l1!i~Sz|bmnyM zLjJhEP-OVA=#5Ow-^+JaZCM($a3smkR~?HiK@F@DFF%9xtwgw9cd>0`2Rj$`Z^>7n zO^PMRxT{U1<)5H>iRz#Fzo^@NuiUDiYR>TTt-Mf`*!4&QV@0Ijtp+pw-=#9c0ry}O zjCb`*kA8oL-_lR0U_ZgEtDX3uWhq=kw^kU_J7D?YZ_-G&Lh>`xX&0tQmK-T}$^$aD zb38R#YtW+5zA1^gR_CN$^4QGL2&S{Fc-`!pHlNJ)-pHb%dNOdK4PE@I*EH?yoz?CA zyHR_3zrw5LLPIlS`Nay`6_VS}C`{WB^IhI-cXgoR>+GpQ6pbu$L}kNhYT?mahXF`Y zv7IpfoZbB3(&^$6W#aNtd)V{3sw)$`G|?cTZ*cIlc7nl-;H|bCCGwK0(KmLvlj8G3 zI(L#jPgw!{-BB0^Yc%_l*QSZT*mR-b=>?Xb(x?V zK4o{IuVcNZL6Z97Q-}juxNT|L0^m+SztT}bzU-wY+OJx|eTurh#;#$1)s4`^f7M&L zc8^9Z(S9KN8o!bSM&9)W(+z8WcNk2>aGUu3E9*NRf;A6UiWNu?HJ<=zZw zvNO!n9NrO>#796){bu0wg-qwHt?t~-_z;l0g60^=Mqglcn8ET;)TmufXsbKW^K1sv z#x$xJL~B>QPrsL3N00k$2KkQqlF;ckl>_C~y21?5#dMk~t*)nphf9Z3PlWA!s5sQ{ z`l}6PYR=e1ym}cz_bs-eg#%qA6xGm9omi6HsGXT;ODdrr*fRgbH}4J(!tuagJ?0LH615KdZESA!ol`u$MR5pYK!e8y4`Y;iPg1=xZc; zD?rA?pLMefFXRli6sB$H2fBp#^VJtH*k5K1Tsg+HktnAF3#bzj1MarY@q)90x40*@ z?5M;g>gk+@QH)i-#l+j^tahg(v+$Ym0sDUp%zeXo7uBD)TwS!f#q~Aab*tV`K9NAZ zd9gn-WSoK^&|8?a5Bg#z;ZEjA;My6PUiY$4gS+nl5#J+JQUA2Qs!d4C9|FtOaK1e9NDSGFeF0U~BmGmaS~NE+Y0W!$F5g z&su0ioE{`Ckc;d#={pfHcQJfEY`yOi>0ABXr`IuMM2y2uWuRWWl~uI!K0%lrgL)G_ z{yu2b6mE7)6%%ekifpm2V?s$1n)q5BzEOVGy7a$X0KHw76=*b%xO3ln2P&U;kKpGR zNdx2BeA0M`;-(W!e|7zJe}Uan+8`-UYQ|iU>@lC}B|7HSV|7wYTU}oK^d)o4MRkZ= zO>PWmD>~|#f0$CaVM?Vt5xZw*s?gbeQGu0%dp4xki^lQYOo8=4b}&n^w1aB4LrcX4 zonnl=w~*l!>a!h>H(JtlKz!Z^5Eey%jeq*L7t!4V|MkQ)6U2QUhpdXZp8GewV8Jcr z(xf*(&?dH5+c;v_@lpI$?mHGMXh8dI+ATI2da|#D zQdz`f2|FH4%?iVlC)pbQwzGlpHvbL#!QM(ERRh>CrT(a*{n8!(q%_hcrup)U%mpvk zMt63M);jcS%eD!F6pFB%8C9=>KR&QV{Mes3U*lU_G2Wza+?}e=8d`p&mE$G;B#H*< zXC-F}NPUcH^aQX9n31!%-))(0T5=OQ57}7*oe`)0$8RBIZb^UQC19@EPiL+0`~VI4 z75^5ki5vOreGFZ>iS$H|jhL#TRxaYa(|UZZ;?gy~pSSqM7ybLbGOdKJ2dq4tH~B_s z-fsPdFP{fsT0JnbNJ7+`U)wIr!tWx8Xj*hvu(IFk(xpnp zJ6jlmzhE@w!&kr9-E8%LD*NhysGcw01q75-kdRbTLO?-~Ht3Y@l#=dVKv6;Dm+$ZW^ZtB)>_2<&%$+%NYCh-887NKnvo+~waH9E^CAYcp z9D2~abh&LL>!9mAwKS0MI5oC_gG`wG_d_>V$8k$LXd!3k zY^|S7@;HQsXkvk2*}TSe%cqqi=lt=?UGZoi>jpJ8d$8l2!6a4UBwRJ#oz_H-e=7L0`2d?PjNM15sAliK2l5{#Q$l46s2wDF zaM+SFW*cOZJW+vqK^hA4WqXMCFk5N|t-ir1^VF$$Am=8gWe&0o}n+K>f*?JWC07|Lj=bsLtr1iw;FbBx?wfN11sJKBptrcs}^SUMY7 zP&H{&b=+HOssXK)25e)TveFifY8E8ehNChg=Y~_7i8&7*bRM;9IQSm!e=<*w zWS2o5b<)<~YQwHIlsO-kz zPC(-CoH8IMjmt>g+vVN2g)pmwZyL2t=r+}|;|5$+_x;Owm?*p0Mr^PI@QZGE^yyb! z_?&g^{pqc?NBSI9sKTAh0rtPEUK=SrVzM#cdNFgs8-&^Ln<#ti5#MOt7H&unpd@EL zCxja43wu_OP)2soFQNi@wc|b0cuRjk$z3Fs&iCPsO|!ZGG?ClLpC(B6)32Jt^TCYd z4Mai*1`<(*zkfmXmrr+(l6Z|=v-NvW5q#;~R{p!=s~^dO*VC}go9yKNnSeA)D-oJ6 zw=P&$?D-OA@f1YmgEJHt5Bj=yTH8wIN8K_g#*QW|US~WXT)`CS7#cLaZpvMxiR5y`)5rI3l0bSg_^2@ zH`BpnMvZE9C_=L;m*bZ2&Biw`B`H80q<3i@wdSW@>1Xf2b?FJ^JHOaPq6)@cA2-W2 zyQc`R2Q>Q*HYdvmb!^jU=9&;RR#@2KP!1J0GVA#)$9>Y{w;FQI&ZN?!u>N*bV{+t1 z;djx)=9H`Q+=B$erPnn6H!CKDG9R|@GOiEdd*aj4;VO{o36wV|^`pt!nKNc%NTUD; zxW*z^6f!sr4i%VvN^4l)(a?eVkH@MqCkQN3PwIPUo%CWlc4Fov(MQ_*JAvf#T>Spa zWp=cE@p7K<@6uTLNCUTTA~KP6mkKExhdcN*3vP3;;M!|dEW*`W;6A$-Yaqw0siQNU zOEuto0Fg!Wd%ivi9z%bSV}D>7ujgPDZor*E+dOihJ4@=L589rpoB zRseM`NQ2YWmn}W^GAJYweqSr@P4_*ttD}+f!ts%U{@qbMA`45jfUuCo#((L&XhlV;(h65YoM z&0i%aaO9hwgiRssXbH74DEYoPhpt(M%y69Ku&lEK3@JGDh7q|_%_PuRr{08W=J|3w z%w`ik_x10pw0&rI)2HVe@}4NxU5kdG^Gf6eyv1q)F91=zhS_XKRH z<#PXv*;AGor2W&Xlk0cL3>PfgM=L*h#yNX}JD$CuNj|+4U%2bGTO7cE4VkJ9awu4{ zOpb+TjCu>ohPrHXGkeR!41!--^l)&ZOpb_clj*`xh!2*%m;(?f5zyYrsnThJ2jt1q zQ16@`1{Il@Cn_C(O1JLvW>X3awn#ETWM!a);yF#&%EH~C-4!3PUuNkA8 zM`TW7J_QqN3BH7GxP*#_WF^>qt3SE4%?*a{K>4TF;DR3)$M=c`SdZG8JTq=Z0%@E2 zZIt_2q&9&2?%-nHFj&<%jVq(3J{-4Hy#Z4f0>VuPN4h(nqti7L8XGzOy!M@;Ps(q(*3LMR{ zP|9Cg_gTddWHCqfr))oIv`v>i?ayWX_+8Ck^vzY={@&AJZNmG5`P>)uuaiS}zJ(^v zQuX8B2As@Ak8Yf$;O1t(%c-OrO%m7aic#4b|L7)|Id#j7Jh#KHrvC|j=jn_?=GG~> z=Fd)+#KIBK<{*a5qTdvSu@t0(laUdd zqMnx90+zI){$KlF$)yMKO_09ZvxDf0+ps=AV(+!5Vs*5alFu@Y4plCCUse z&;VKcc(>(~4&XNrCy>jnjFH&@J7k?8Up|$X>uMX&e(z{AVTSmTIs0u5*PB)&LgJEo zd3xH&*@M(7a_*lBA zG2x>5pqpzpjRkt@I4hJ9P?MO4t1X+|2Q4I5RKdrMd$4>UopH3Rf>OvIY#D-N>g@ zsmPdGsl*jIwa^ZR8Px6gTdB!z*)RebJ$NYMKi=7CGY#AaV0r<=Q$alz@JqQu6e2eMpOo#qz`_hjQe5IM_D~bSf*WV>99?zWqfu9 zjxYXX*@6q#S>1<&>$i9%ePA$Npp_K`ZN81Jw8|Vco@N?4 zRb<51fO&?bg4gdzb@6;q%Fq-X<}y`I>gVhlX{LC|23sq53G-R#9WGCEe5EETKImt2 zZNud#-&y;s!P}XJ%>Pi!|D4`UAk`5dVe#d_T=UqhFy$1?FyE^l!DI}17)+9JbhC3a zs%ZUn_^q8ZT{1e<#-NNy$Lq`XmUL9IU!mbAF)|yE?)YrDgU3vYWKkUrcZwU)$+;R{ zi#y$1O@Br}JnX>!=cq%<*!1S|^%wV11B|F5XdUT_^ z6H)yeZ{J1@Uc=s?lM?!#_Hu=?=qwv?OKaX{Tp*E|gd;=nz+bi%83-9CwuxiL3NIjw zGQ2%!jW@d`;L}g~AP-6*4o_Cu`8CvO8V7rb@-}`E|Knb!d>)n4h-=nJd<)u!MsDw+hE#UY0=WiFA zto|ZvVYW~E2tT5d04=W#tf*wuTI@)~$p^0DAZ=ZG=EBS6z1SUR=Z;!EM=5yij~$}Y zr}Qr|aI6BA-Flh(#8+0uM<`2Vjzlm-~G( zb)AGhmHT@O84gbL3e?_yTWOZ`8Ky|;t{%%MP5 z(-LNc2Ti?eZi;=Ph`1WYNS-ZnSwOqFGb`h&@gr3T9saZ6pY ze*{|K)TQjauJ~??Rmfdh6~XeGwXJyYj(C!Ltz>j4jSZjJF?@5E+F47c0{X0@chgo1 z^|{?wLyZg-h>#PD4h`*C(yb3k^PMo5rKYN*W{wfu>yzU0y7wp~53v1)IWo@5MSXaaMy zGU+6b$gfaI;}te}FkI+zMg1V_^jLY|YDz?fd3BWT$q;fq0+&@R(x#Fs?Zq1_hJHgV z7mz6+cw2n04qtl89pz-?Y|`v^RVLWDD>lil#q>TsuQXKXy~W|DnNp+X^WQ^!S5;Z- zN&yb9zPywpJzX^2)Ox8JeU`TbgXs zxDt=|m&>X07m~ByjL|XovMixnuY7Zq-?fMTCKQyaQgN5Kq(wGfig9D+wA=_Awx??9192e0}==C=i*;samji(#OZuh#dusv z9w_#pG;J>ObYlyi)hW4?T>e|mw0iJ3x~}><#Y}mCcg{T)l||)4-`PHL5P><{&{iVSpkm%$0)Jc4$xohZwiL-hXMHF65v zpC7yvwAXOrKzu(g)g$hOOf7`}0^O}!*W|shF`m&0w+_hC5APn*eBq;$^s*s6o$1|R zJMx+uuwg)vNL?04=$Mxo6?U9H>1ptO_Tcy<2|D2sctZ%ppSf(;QN`e?Nc*g03Bwk*T@f&q1FY9tKGJ!F160F2QcK zg1d`V&f$e~GS^-*!$yN%vViFE)sxefyjQ!~a$vv~>`se3KscgNGFQVsdO;H|8QM>` z`s=5;;Ydo6C|oZHc3qh2Pe<_{&;Cv+;bZ4Nq%IgINFURktfn?oOAhw~3E@UY48D0T zux099gWMb%YGT+~29aZaH>qP?0AIQE!Y;>473`@FMUJQ^&NP$zlb;1`F;1k!r9`Ot zZ)%xUA9&=#ZW`K97o?<3TD1q#e_3BRpzC`XAa0*m)NJtt6aoH`74#JFnt>6e#2J92 zhn$!RPk1sLh=?t0>7>3xGiap${hipwW=`w|Om0u@8Kp#}S@8JMSBq^qI;PoHw-F5< z&h4EZih(GBy|AuW;nk{_HFmt*=`o8E7jrf0dBeRMcB0`ti`ObgU&AgS_pW6;PggPD z^$w0RZ-3#t6^%4U3FG=(q(s`C`@^$=3Z@odN{ueI>eFO=EmX4rNz3Xd2QJY42Ul0^ z(lV3z>^DCiG-+%U`EYaEVj+44>cX0J)e|zf=RiChqtHI8|U$ zH@A|GJhDc9iL?c}8NTR!YZ#3mn}ZCm2c?*IKbo=FFE3g=s_P7$lS<$?_ar+4&(Hc3^R}WDy)_ElT1ypD_K}xJHS%_#S>%`^oO$ zHwT016Jd7i@>Hk4j1_w?kK?#dKvLMlyR;$SDa(Ud(bX;x-?sg%!Kh?{M_1eBS(MIa&0HOU53Qp4-j)aL&R;;e>D~r>V zUIIFKg5y7y$+c6~&np=deY|wl@M*I3#;oP1w8_X`P7w!FF2}isUsR zr}1fleO{%b`GQ3n<>{;RF!hgozgZqy@ufr-#IER1D8i~+5pS0?sEyF- zcg$Hnh2U(ipD{O2NqlXGx#VvoVzk{VAPWLhS+T+zRueKcCX>7z$xbLQe-^EQ#Mytf zvW%KmKLdM`c2n~Xo;u6yLv~O3h(O6ebQy$r<$RSeVG`UJ3tvg#@SH1g~C(p`oz~c))y8ryjAN*aV!OFEj>aYFE zFUh#FJR?C^iGTQMawiA;Y^v~Q>)|Ge5CbKnUN1l1Aq%s$HNAp@ovnDwsfvoq zDvS__k_ZrBJBEOMBO~m#>`>r`qA)Fte-D>~83l~S_ZQ+rJ#YHcRVst|06#>A-JYtF zhM9kB-9kicVIHY!0Nt08oL|qi@V5e>?e?eX{m6%9a>?clvG5D0 zcR6%eVQV_9Zj_h$+)fcw+x>Z}{2k6Wn0tQst*qP`hH!^-ovEyniRDa><*xC;s=9b{ z5|9cDFqRKTRnUQ5mj!z)jL9`ALC%>~w4h;_wT9MTwkF1*cEB2I;5WK6w0}0_nu86= z*q##2*5IA-i+c%51mgNFXH6%)g4mf9O*NVF$(^U;A%!}h1ao#(WWuQs(RI0r?Bk!) z*7W9;@8vIsV&k$ZQEFM_EH%79sgXMXSNk0f^DL;zVmWNg03XBbFod<;Z~bR`pN!{{ zMR!B|+fMyS_qC)}MyH$iuj+~w%j0IjL%6tRw+D(qeJOdtCm5TV=@f-Y*z~KtPx2J9 zhB5nx5PU}yb$8zR((25NAA!UT2BUI4`~MuX-Y&f|k;+w;=_yuU0jYrMA&enkmzuho z1}n=8mpF{CJA#8gMR@*7k2q=WQ|Y-hQeFRCt`(*lg2Ko)?|*!}_PDS%@AyQ;MHVt4 zTO7!hb#lgYz5g4P6^~od^ah|r+rI?nYqA(i076;Ai;LK0VbKEs!DJM-+)oQ?Dp}`) zd$v`fJyot&{h7W$_m6A@@*m&|z=4VI(#l^g`e0{Z(?M&Yu_fLpkG9pGF)v#oY2!@I z{q7jPQ-bQXrCIj{p2n{b<9WOyoYeP#!lq7OZN3S(+A~t6%enr+x~=_SG<|Dj9nt3G zlMnqVnZs`~qqf>hpNWf_j>VepujzSXlMdp^T2^sz@G4pu4zCuJ5qm~GD<_1^4}8mV zC005?ZwY~-*><;g1f-7{owu2bO@&FU1!N_wsLLc(gV~oWM$A{y36&)TpWt>CmLVZH z`o5-to#GJ}QzE1=GxT>>6~T+ruQHd#1EOT=TqtwH4dJo=u{Gbev<9=6MGmnH-8Q|V zm&y0bS8>f>0BS}5;cavOsT30dsg+iFfg7rKrlKZ}nJKDIyew)@gxiO$=d8vylf9Xz z-c%}O6{L%9FRp}uTRVW%tP1_6%_AQS%*CsG;1Ri>o6&;Vkf$<7nMR=NhkE zE9`rfjQ|-7XSn>2St%tks0anFz|UKXv+y_VnvBUYV=2~>Hlq<^#zIDuj%F6x>MsLY z%ZkhH&hNkX(Kxc?Qo^JIK|8iYL_nY_l}`~!g$a&deSGIO~jipsXe6I zG7lIUN#&2Qn~8L=6>cmx(if&O^Gaq6FsQ3V1^ew7Oc-O1V|)@{{Te2YL?Q70o3JA* zS@Vgc*Zo;1Kxw`t2fHzX!=98k(iICaN*X55n0rp8TDEE>22Jt1u;(7Tn3_2W#fpRv zx$w~)51L!vj=)>uCgHSVO;5YdrPG1AV0p2iMr3SPx=1uVmWdVmH?Q8E;U1O{cGIMY zxJ-d%2Os-;n7@mM?RiSSpc@iMRR9>aj%%>_?DUq;of&qgpJy|BFBt0A(n};KL|hg+ zk${;yeo5jkhvc|4VJUZ-n_mvXMP3|U{poerzJvYTgFhky;>9rwI0^`uhE1LQQ@{4A zS00d_mD?76*F5!IXTreoCQ-z=?xQo*es>Kkl^)@3Qv1$Cq~3KW<`>-(xpVVgg4t!? zxbIXD;Xb@w4XOGLRp;XYUhQS}1$_mMwI($zn~*Gv3mq%lq5m*w(7c zFgNZeFcH3yIXMC|o6KqIM2ecK$tE35O(dDlVz<5GUg|up;jhJ$A_jI80Jzwa;MS@& zKeK@B$Amkdvv`z_|32gF->*jxE0+JV*;+X7d^RzAo^uu3zEpq3q~o;PFo)TDPYJa8`y6DeKA#jM6yzVHuazmuD@ zpe>d8qDyjlF}Pvr_kbn8?<6Zzo&Ut9H`ntQ$-d(d>CC}N&?M$|j?c}4rpJ@HXD*zVB81B?k_GtO2l& z`BpK*>;iIZhvFKu&M*7s*?G#BJmt#k~I4rUi3_r$IdL8P+nL7AZF9%Dg3r10SI2+S|3oZ&H|2-w`B#1as_C zRByZ;BYeBib+hojHPOs7FPf&iOcna+oiw)vD(*@ z5nqRfmD7}yGI@<;H-uN*-VT>RyRSq)%ssJX2<*Og@D^;ZX#bWyi2om0YVM~Yn(99T z<33-PXJAq#gHaA$zcek>Jvg6tw-c{=WOnvXKC^QFyWlwEa%r%4#%I6Q+Z5D_UEg() zYm@?}RCE3^!j(_#ul7>pUzsG2zz+!lr6RqhXHNo1L)W6c!n1+K2p?0%lTNz{KcH&Z zt>(~=l~`H0*#TPDEmYksU6n=m-rIOJ>zS_brn-HnYG}+lCuPrP5jxIz@!Kn$AYKSC zuKkO`Y@lR*8c8g9K;d5v;*;PNkX55P-6{^dC(qVY$A-}E@n`5%~=HLYFP zV>iL%lOM-+W2>Q_g_aVZ{6ldv!E14!<8dlfZig{$>^aFCYqh{_c@5oZ&ZSo}Ein>N zvf8&9-pSdi*<9*d3WZH?=QO%qEs@W-6!tdGx4%1kpQZ5y(=X$Rf#@~(fq0F8NM%da z`j**^OWy6$uf>N~3xDIu+~Hc=6sxQs-;sEj_mJB5e0eEl->2m-vcP)o2d}oevpnnn zoLHcO>t365fyS;;eluDmo4M50CL?xlTdqyHTard0g^w+K`&qu=qtizq5Q-7tl6#9E zX|4|e(h)VGMaVdF5*iw^y<}JBz#X_#Nd89;w`{&YA|Rk71Ek&R-zf356&qHU%SC+g z95_z5)tK-ZJ&2rC(a+419bI}+R(}}VG9g4uxDQf!2-pzHb}b}k-afAo3@w2%o&~bd zEe)91D%R+|v-KQM5U-VMt|A`$ymjl~CHVGE%!?-gFA9+HxJ{VKoQD#Ebm!kAAapkmu#7xg#?gtpq5AA};60X~JNezqLUnX3WV?Pi~U9y{RqZ1^lR z()O1!_n4lylmE}&O*n|x0Wfa`UpOy!f|78`2NGzcL`- zjc*PIBw9f7a=rPIoNnm_h^MFy2Yl>+CsZoB-}+e#$~d^%|} zi-k-#$t+k#sc*{5TU(Yx=eb)kG&Ud~lnUIt04j*-3SPP?s(tv7qO40(d?e;`QPR5IsLxUE}=A zf;^;!+qlJZAbJVBb#nXG2Df+WeOtuFUt6C!a1uJX=g5A{Xkdr=;%g^^F^J$c>96J6 z;`hNT{2@C`X;sk8-}XsOzIm(WPThGEInz=B*zAV`AZ3#g;98!q@1#y?gmS^qBx&E> z>Km5;pQ8`54+vc^^;XR9r2KIEt|7!4_4sk*-8KQd6%0Qu<%e8O^dclNB;>9IME3P} zFLRp^H!Sgqc{H61S!5*L<4ZjMq5Joz-=XJq5KVqArYQ$l_~Zy`CF`=_!b^v9CY8(D zJy~OZrB~NiC< z({ViL`Uv>U=rBK7gf_I?8S`gt=UZ6a(1ukk6;h{owAv7Z!m+(?{=?(h`SOqX_dPS+ zhZlcB=?13f&Su~5j-I9E2UR)kKL5CKL7&f0Xde#3V|41-AcSmr(%<3fdr%U}uIyS} zu>Jb69~<4klNONG;n`1sOv0u585d9a#i~`r^MDxBXxe(4(;eE7i0)8 zkRgO!X@{i6@oIiY;xIms<9E|nafN3%GC|-y$zsg~*J9oWQ%A=>EUh_9EKCIF9^Wr1 zwXfOOQA10p=Cwe+_dL-dI5OGDGsO>R9VKCDX?;tLo+=**J%Wq$RVWBgLEm%9b?bsa z+%pp5XbQPj)Tbb}TjgosQUxF0ybZzm^^8t@*M(|Sq)Bi0>uDwoz!GPfF~7Di=()XK z!LP%Xt_9Iw1MUidLce~H=N{E#9u_ zx%gd#oE{&;tK;)$G38x?@8-P6)Cs>g1Li%Z#VUVQT7i7y>9Gy1MtGrr===Faz1eWC+C&z<3e5$q{0Z|2S4+G}HBCOy&1vP()kFxrn5 zdhc?F_BHEz);aG*o+nsVhHHu`CbXI;tS;N>DrPb_HG~ov8$rJ$`0X!y@YUX)gCMCc ze5;l>jw-6M%j9GIR}h}v?Cc09T~WD|Mc4H8B&(^jy(izBy$Z7> z#1UFR!xp|>cNe?ZtS3m-T+cACq(mu9>b2igCn&pS=G4DPb0JfCB-a8;KZsnhy)50u z9g;;;#n17VDFvC@=rfRoAEz9E?4utDgy_Pr2aLwyikORUn;-ps>+o}70 zTweT!#F`EbU*$uWhyYHgWx6>j`BEA!tpU+na8>takVy05`ER8S)kI!3&^-H!CMDhj zl414Q2xzX@RKQDQxFqJ>eWGF|B5j1_RcKPSZD?ZCDFnj4Ok#XwN5s)g43Iub{XZf?5<*w| zyK8xrdLL*KO>ZY_S3QrHN0D>n5G0+zyOk!2z?SW-~iNqtcr z(~I1QoXGEsVI6I zP4%hSePyuhD$~f-M*WakS?zu!j;cJ+vU@j!Xjc~OPb z4HWqS2MFcwXSE<3uMfUT5s9F1`BU@xO@#nim^koc8hFy_2zHrA9#6z%So0OO-deu* z^3@nqqMe;)+InS2^*4BYEG-~=`*Eh`RwbDvm7Q(FVZrMDg?n~@1^I!r*+c%aRQBi- zdKQNN>Kh2Js5X0UN|Mzu{|4)O8GxC=(FM>+O_=4O26=l_A%HEoP{y!g5d<6gi literal 15158 zcmdVB^;2BW6E3_+fKRZ51h)itcTa*X1W0gqclSlI0fGmI;7)LN4Z(eJhhV$GVR5@B z-}n6w?oW5CPHoj0>7JRM>1X=s6aGnA4);0Pa}WrG3znBw1%Xh5Kp>P2EL7l4Yn@^p z@b{myyp9_Pg!lX3gObFGM-BqL0fD98se5M}u6ni8%LHGZ7Ke%P{-&qxky4j()_RG9 zmG>p@PwVqM`A<=)TyH9$@8U$X2jvA}kqo^d#d*V|pe^J2`rS)<9AV_0T=wLRx|Y`7 z`W0{XX2#LqzpW`Pdo3CU2J9$+@c&1D9lQLipqyuOq+QL8Lz*Cx*Qg}Djmk^1rX*4q zSjITowztYJdO@YqAhYjh`C3!iQFbi$SV28BLEK`(i1c%`cQ|Oy5upC><}y_`6DZs` z-7ir|pm9GsJta|oa|OYGE~I#T4<9!fV_TO>sX%XnrUEyS9!YK7K|11 zq8xd^>y0~(nm(o^By^}G23umjdhyf0x&8@k&0mC9uopk6pGbjLr9t_$XVXoX|LX@L z2g<(?dD%fo$PgO*NE0;WD2%XsjBUdGtXuDV@coH3fGx^IjWHaeGXkvZ~G$SYx|ip^UnNZ@VI6vGg*;oDG`{C;{8UsYXP zeCSTNNlrSEV=GD!o!r!ZsrgomUdf4U{5O*vKP=;VDK^MR@lrl4PnorzRkOr=>Q~Jf zd90EC=V}5Ft_c=dv@2Cd@DNk|vXn!+mAzpW35ISgNcO`)-hB0fQ9q}Ev${!>Z+}8Q zN0Z14DRwMlzPA~jgfdmG(@hU8`9{8)(7FC<7$8F1{%$)1V33j9KR1yDYGDShW8qm?sQf z-ZTdlol75Xifp87FJrPaka#*#9GS&<1E^>didZg&SMYk-85Wr_n36bu1Bt}OF#!37D>Yeko?9=6er5okYw=9nb!|%xgj9OidOR$VzYgr96?My9arJ2r! zC{hu=2@M7e__aCg^za?B=qOWcCjeqoQ;*uS6`JMnsSAwK%d^|3KxO)c4kPMiH2c+nV~2++jaY^KLMltmwmp zG!9w|mhmVoKE}x|e;!->6C43km5K3C&G}RlAEpf`frHLfJ1a2JlDWBLT=wxfNpcOV zz6^azvo&av7M+Vn2yxvg;7fkMp?A#BX=XUO865h}K-zOnQ$q+3o2O4BZ8-$skg~>AGuhf(U zcW5`cX~V(RPINa-(|PvgavRvQYUn3isRd4j&;C-lRlfCIelf&*MZ~UoR&t+{nO60i zD>Mvr)Rye!@As;sVt7@-%53alYB!r+(lp!z=RcGcyNCU2PbSm-*zL&odIFq=;L+N; z=L>xWV1ie@Bp9g8#dAsOklV|0VBY1&*U9m=lnPoF>8&sva_iEIcSjTHL#MpZovHaH z4)pZ~nlymE|@mxL?ToHO4!n40Ln*4Rk~-(kau_#8`ajDbDu5eOD45Qs96a z(PBZ>@9xPhfA70UydPtPWQLG0uEl5IIR(m}jeZf(z@;>D<5d%A=tdloqw>X2IdhVD z`dcOcwC>b^nvFYrGmNY{&5JS!j-~^bF*ar=FPzm+!d7m|0|_~o9Cl!wT(Tf93d;4o z>2O+UX!o`9O%0_#blTgzQ{f65sDzEU0>WmA$jL2VVdh~?ZEr%d6@1{WJB4|#!y z9ySD1;Cq&40Y=z!rC&VZCOjk$G9a%6ALKaObX|-SxvHk+J3ULYxyq12EfQ+OhM}J$ zqur)Ip5I0Wu2Rl~#yCB$#VD87E;PIMU*>s;P!MpjO=7i?YAdw0kugiO^hFvj@ zu&!jW9V}d2clTs!P;2dgXJs7MLjpo=#(pkyJjw$h^USi3TBU9KQZIY7sYsf^T^y9K zR_#-had^|l7LoLsDN2dsfuI-8kJ`LC7u|WNIUs1Ib+fs1f4)Y)N)KLg)znVLpD!KA zV{as8R|^^PQ5^54fle8rJ4bqmK+2A;C1@Um+cbjNaeu+8NiCkMa}$Zz(JSpZ#)FLn z7_Enlk;Et~3i}L=>OUwPs5}FtTUpvr;^*Qt;{r%mo7<7)f7TOnxY83OnV$6cxH+9ChS$7t2xfe(>i!dXJ0zOknNdy;@4*D-T9! zNx7gqr)x_C19oVJr@vx6uf=YkJcx>SB=7Q$<73?Ve&&*Hv{oP`qxD6JOsym}#Chyv z7wYJX?uyUn)ozc5d%ff5wUKF8Pqok4n3$#34ELUM68OxKU?*yP1$3bC`SX1B3SW=^l+W>S}RAzYf5AT zR#4n*Dnwvh%w`C#B)-xrsk__C`CtrSft8FIxJHtJUSx+`1rJP@&?m!a?PimxWAlt0 z_bQn=n+@UoayX;Ioa;6cf6VfJJ#re$Gz(i# z=Am5w5jc?L)90lcwckl1hT6=5H+}UP5n9h<$Iy6R{BA6S&-8h?S)a-N`% zZE`lc>&x!hk#IxOz$gw5AD9Eo0QLh`M9ROy6L6a0nyGsp@0oqJQ`+&CBkjq1d(i93`H6wt(^SGYcWGW}B~qrC}j&-I^yu1>xTIzfBqnHaLDH5^3m5vS)l!%P`VmQcp@?{#&|O#>d>*6O@nXS`XSg6QZxPM zU~Z>udQhD$;kX#g%{ctTvf(L)VJ(Q-%%ek^Q5dI^)-SnKI=&@v61q80 z%sIiXS+ASpMe?N*MhNTAZE|eusvKUP)tQ=Coyu{1Aj^ob(9TiKa{oeyumr>Gc!!;* zhVk78o7y0cE55;vVusKVIHp+%U=@ENT5qN3X-lW4tCnsA zevWR`l_A-ud)OC+JHaBKTVa>ZIdVX?9aqF6Zf0vHuc9Izr&ma?QG0|kRU?NbQwjT` zih;57K{PBnp0OiTnJY9BRQXvGqwQ9^-0D`N?m}ql?8u1_VR!lvsO>9;ye$92Kl(aA zlR+nP^KH<+MhUh4`RgQwf$T_4Jp{6Bsrg5SM&PZ)+f2jzlJ}~`vI8$h|D9!?{IN1# z?)NR`KKnoR4{+1#i_J~;kC(Fv^nT%Q=(65*gAKF38x&0%fTaTYAHibk2{?`LmDj^F zJg@xABMA?02-zp0O`&?V|KA}T_eM?)?V1!8+VU>F)voq*TlEliDU{0jgXJX@lmGFc z9fR@j@#DDt2VBhLl%*8NkDf8_?(P@eV?RyUew^;zm)f?eAKVkC-2bY$HM*bq-F2QZ zwL4=FrJP@kwIOT3;Q(_dubr6-V@(@~MoODGL2nf76!*1flUwQS%*H(vI&Mq{lA}68 z3J*tSK}g-LE*4sLXk@@yay#hYuWr?9aY?+@88`_Lo<}J06J$8qfhi~qk zzISGQ>AG5W&gh{JON=CHqZueIvkxvT&uHYT}FS&KT{I}kQfl(ZP<-LN9&bL-h_CmkC*aS5qI9zVeS>L{sl_fs;{@ z%zY)@(fjwl=SisIeG}Gg{sB{4@hQOrRS)iw7+>-~*Gv^Hk!#v%l6e8wcgr&u#_L${ehYziI*Kx|T8KxM;fp~PLwWPwOn`AKiO#r!ob={UfPR;+a?BVUkKLmG*6NgWokR5 z6Gs^)h}ca(>e~lmqb$$_E!$;>L2;Cya2}Hr0-V9=f~!G!gLRb~pZ^EGW+jNso$K#J zT_!ywOIpN}Bl@Yh7umnk8;5`#+hQe<3^JT(v8cl-1<*>bl%9^L4#R-YkoVqZ-B=rV z*MlEK!`4F?t-!a9y*QqEDQQ|$?fb!REQ0yaodx~3dorgb`~1No*P;0Z&*!>JnJif- z;~eS8%0zAM^2-{D8lUt~UQ2_#`opLxuAs%)(re};Owa_DOw_~nfJlK!(y{lZD2D(V z9$Ldc$Y{r*Xg@Fb;3!m^>v{3A#WAlD^Cc<-Xg&&*mPhf6&>ep#kF{^~5%?w|O5anGa8Y5Pr^h-VDY~14_Rq%UCPgBre^?D zpuBv%TO(+}IZ)ghVDf=^ISS{^z$VKlD0amZZSjg5ai0Niu}H=Yy5-v-(PPNf5yARv_YeqJNv)hume@r0W5q_uG5D!wc9PSO-afkyxm#oULB+r*(gXG&zF03TH8O>Elyr4}SCOxkJJKEh zrH@7YM(+ONB(ZntWO3DlKPr*T^NUke`&(WzjSAaV3u0MkCz-;RgsCrD@k++xG0`ofyp@E0(YsY$@aWZ zDK8=drWF#oMx!rtiz@ye-}^;p+n<-Y>CmkX6BXa{(&KN`)9U!%mcbZp?L^OTnqDuZ zvN_k$A!>C(=Hmr2H5i6&OtpodeQcaYlQo(|qx#zPWY&ZrH>z2y=6tCB@UW3wb*Alx z_65}rY_~(CC%g1+>9=uT*_ongQp?)~uul#x)<&-P^17E6+;QXQY4I|*7lp20{!($4 zJrm!sF3*G^>*1RYx~r2j)=y*t3|%1T1PKYMx71~`+tp;-XPhv}^_UJf5UIZFZkR9gn8%!@fz z@LnTe@i4ox47p5m3EMGU3MtgO9L&GpH1P2!zRa1&)PK?Y+AuwQ96_yi(GE8XZ4}cw zE1>7WJ1x*FAkQOj8kdlnRmKZ(1EwJ(%h!Ci||pK7I%I>g%86mf0nr4^)&PT4&X zlU(TBQaFyG_+$mzTmIN8d+5q@{q~L4Iluu+a@m|<$(H>MRmKui`Y^p|0S*=iajKBY&0QK% zM@B>8mY$&-NH_1YJ`W@qkeO@Xxa@ZOa*q{GbdxLph>+~c3@~@dj;eXpS7hWs??B&C zEgeFn%X6~`wiWq21?gtL`5W~7Mfdjtpdqh6Z#<`x93$i=z!O8y`690MM98;H$fnR> zEstL5OGQu49|_~`=kr0_9!Rn)V3tpRm${E^%5MUEV{{%3BPlG8g* zsN;+2bq{=X=ctFW_#|phEfw4H^FrtUyj_WZMCoTh&`|Q_#Taqt1MMn`<;~xhAm2_k>R=wuWB>wF(@rp8#t=1YhoFM3Y2Fltk{ zBIDzolpv$q+1uq()&aad!?cXDo^_ky_0Yt+6r@bx%kIItX{C3P-o7f%Upc{yt8P;C zd!8_-O6%_}yDeIWX;1cEm1&elFk&b`GlWt)`8P471k?I4^iHh}U1=ut@OspbELYr2 zSlBjZVP)1us>>R^=uSP17W|s6C`1()6M&cHe=PXd?o*6qTf2p_$f98cVlHVO`{Q~RcP!u%$1_V301S`gjoJizfJv?1In%Z%7H+&PYKK{K9n=v6KZ6SH8TpGn?#hyOx`}DHA`t;WBimVIiFA0CaD*tC_?+}6Ax%6qDMU%0?}WoX9nC-gJ7+L2XFw^ByxC>7ck~3t-eFmBkEOw+z-y z%gIxE2oSO5()S(9mK5?4f5=lSx01ZJczfI zX4HWo??AmZT2BaQ+yMPe+^jI&P3L$3JW@bI^Z;G!bGh|b(Uv2hPdL&fd6p%)_>^ z{XJDJlDgJnsow`?Q-_Bv(Ap-Fmpvv8bwFK;1j%YBufq4U3aoFHQMCb#6^JmsQ^t2r z&F7ySb-Zi%1ReZr2U0+?S1-FuCV!GcAg~7w1xX=!)4+Wh z$+sHRP2(zYK)be~wY)wBU-?@r_mQO8Y`(@pxA9b7fU%RjhO!ik-T(t;>U3?$|_Xb|))%ITSWOgsUqh z2M}1jo+*LSrxO#uU6Wupv4s}SsyDM-@qJYFr6)zFk?R)o`n#QEk%K=?9imxEA#wE; z^)~g7_ZXmuUoZIno<}Nm##4l3=~LnD%J^kg;QArsjk{UWVP-rh)U=}m=sfH*hKyZpP>3$*BQQL}`q0(}fTQ=!DMQ=CfQ zvzcC4NZpUlkb+4FPtT?meMEKMK1?7Tg7ra z1z6GamPF18;98d5SC9L}0U1}qyk1vwl`YqC5J zte$=%7c!PUMkFzV+;PQ?`49(B_b~JD;f#R!Y)C2yM7HuT7vKcD<3Sd4ro~nxU^AmI z{z*}HuAJo@V5-tJ;0%^+JjkFa7vL#y;8>M=bdQdas-?cS3+y`Wtk+%fbU1vjsH?Ul z>#IWp*{S!_I{!j0Lui|oki|WzgU&_PI95nK59ggzqzu7pyqC>ZrVvp~D-=G%4r}6k z>p<&3Tftiv(3D@UQQl}WkVh}gIhlFNhFlSzczAzpSum-FP0K3ZC3UBmgv&`>y4eIf zF9?aCFm0Z1k6K0>)7i`OnOG>0dcgmPo{@(crRj}0zSMw2yk|FGH=k=~Qz`WxqmNk;qcZJV(x*n9rN4_vhdn>=mm z{>rYT!mrZLpAyXt@u4sv7E8ijdqICUJYTS$zJ`D4F_obr5~;$NG~>3~M6cy<#qwia znllt2R@>}7h8VvPZ!T&N1)RuW(^D;QvHbX4mC!vN9-PLUUX>3R;=vDTr0D`cUXN=M z2h!XN6jHOPz?}B(tDp(O2gd@gt4%#zjS>x;pQSl(V?eUx9otR$&PvCav64Rm+dk=H z=ppT}9h%nYi;1P{VoGV^GxY(^18}NBfR_A28{K^21Dsz1PWrGR@4?Yl)x9Jf34FqJ zWzQd&q5C~j7^ozN4LdUV*d5GeZc$HLio~4yE*N^T!h5V_imM8lc@7M|++qMV?=TW6 zk=D)%R;{+5gNL{e(cBeLtX!wooqw`9iKzOoZ8t3z6ZG&Nlz-URZe4#Z3tWy>9^?IQ zI_F_HnsFqJgBAU~3$3J%od2Ow{#H$dhZ;GarWwB*K2eL`9!ikZ>E^k2l z+H@mw&K5G<#)45#juOS;Gvy>f*^V_=khskXdz;nnzysCTL6%*X`Lbv-cK#RiZ_l0o zGCC&iVzoi$9w-@NJ`3oQz97|i!(ke8!Vk)29AE;r{ylwp{@VIWz?jt#9lM!8(Hfa|1V4rtlY^Dsr-JtdEX;tVZoLlPj& zKw@z5#pqBH@`}s{k0^?Ylj88FwPZ7_(pildQs?TvORW{5DUUP-VHvwG5Ov*uv?kDm z%a}^t;-5>9`8ZJ)R&v}5B>ncN#d78N&rBYuwM<0pFB^c&7rLLK@IB;#X5t7DM}L>C zydbhzmG3Y7x6&d`=hzaWt&9sQ5PK+NbmNoDqnzp8*$nT7JuxF8?rS}!MFOC=Zs3;G zv%43lS@YR?Nae1YBcsQn^;f8cx`;wqn`e4p@)<6NIu#tqTM$3JKbI7Q@ZPpx7CAwm zZnFwTlJA|j!(Y9A5II0N`Xaz{s92AS6d^gD1qai>4bRG;k~H)=d~n)nm(=wF?Th_k}W7;636V!bJu^<@2h_TkpW z5LxUX4&Y!FOwYXYu|Wz`9pQ#qnLT@MRc#Xdm*cikI7%@_i&&&Oa~&n;4WK8o-L3P5 z5A{tuRmb!A>xe?h*OCihm8MX(pMS_4(l8Rs3qJYe5Ci&6pO4?X?`LucZ2ZoKluhoX z-uX%y3xkRVA7kXAb`Vc;HRkQ6*RsDp02HVn*nP6HZ%y<4@Z^Qpw)c8ZtV-aqx}1T0 zhoMF1nNHI$a&X}&`4d@wm&9^auv?YffNHND9_o+6YbJtTZ``WlZBwJ4xxYe*%JMtX z$;Zj!nBE*8(-9xvH}dS>q+EX@yQn%%y`d8 zcz6+WrE-4#lzb=UOE})vQn_nLZ@>n=g}UczJa|$l50>U}O)6mjOLoGWUwMkvBU*th zb~);K*7%ID3(Th+`>efsOu!yHrSsY95<{%I35ss#M)I=qbn)rIX&gUYzeIetiKD?} zSmg^iZFWzn*L;?eu*#6#=Pk7`R=I>SQ<1_e9`riQ>2mju3UYlMyK-0T_t^NCK+)+c z@nWKFYsn+oa1){UI8b_?jC`F|*09-yH(FK}L86@bu|AE?rqYEzeq7Ohk>ysP3*6wr zYM?aOnqw{+1SHOod{;C&tr@u3UX5kD-lN412-vqsS%HiwL{1o)oZeJvJFJdrYMUWs zh_O|YlZ&k$&eMHnTcS`Q_)cIu|Z>vz}PAe7RK3xo}Cl~m)E-%HbD;*Zq- z%vzEmUL<>`=LJ5ERzFRXlP@TB;sX%1Z>2Ju@k!7wGN!wDd?*dcdFG`~93IvhX$x;_p@p51yAhV-BwL;8A%_Jq zJ>PI7fsKnCA(84ijm|$*Nz$sM{P4q6Q9V@h=oR(DG)|?}>hE~k?srEVc7C3sm9iCx zv%LA#ug~ORJIlxHg`3>)HMpj&Y+E<UBvm!YI$>!XdI zvf!1?nVYH%uHACVe?q{TJrg_MTaSNj{{Af98JKSs7_N$+-?sN&xa#@nPhVxZBU6&l zb__9N#6(q~(XLwj>j3}UW1k+qC!2ZdEJI?+FTp%6cXn14puf`iBuocsl6T38Fh%St z4QB8e!=00V|1xafcGKH6Gee&i2u6W0?Cnpcp$t{8QoeS`vs~vJce)%#;ov151d_Co zwH-YOJ_n-LXvqTCh<8KuHL@lY_N4T`-G7#+&#m>=UrL13oFgX1ud_htT%Y22E!RK2T9)16n_paZchz;QirL*#eXMLV*gKN~fc))s<>- zx!aOkU9`=885)qAie{n2BLt~X0G~24`v|6tZWNT0f7LgztvC;0bS3WX7Jm^$u62B! z1&;<#r^js%scmZ(8gJ=p1!hzC{NxG0BL@a=`vITC*{p+_l45m3#_;1^_cSKiTJ4%+ z1&OTV_cBM3$#>{n8>7AhloVgzS-%z$xTf&g9BH$7SS=dBr;Ex|iNN?bHTt?&%};_p z;#p5(N`H)_t&QRqzL`5;Z>()|C*%Q46W7K<>wq$kx2sCEAfACr{5^un{l!p|WA%QN zf@tEv#|R7{dnU*)0S9mOMR}rd>~vO*peWP~vvE_o!1u?yqr75ZMhNyP+`jc=TRh93 zJVgiV6LwytwIz$}jOvAsnvI%h%ncdUX*J8Q^cJ4mfhFpYps_;gu z&W1Bf{;cv)2Q&a{W3beZOaU^_C`~fhoS=~GM2ga6k zQtp6lk0;)Rn*!?`D4>I@9W|tcy7kY#isidlxx8ZDyn#N)W#<&b3vAX*VqCzNG z=Hn|u-b1Mu;UP`;9{C1E^rC{w>C?N*1=xjm2I_e3q(H50Qc0nYs@^g&-{4H{&T-dO zOO980^+MXqM?>Gtw$Uq-K+s(TQ+rI(eQ zSLMz(fuFPraHYClbW2raxy*PKP3Owx5_FN;ydK@+5*XV^`-s}G+uf$ps_o0u_EReG zl#MS3MeyME65;mWfC^(&`<(a4^@VK;wSnC$&NwO+d;b_Zn^S_>M~zl`hr51QJHf1> z`XB8aAXqgSMegO7PUq9f7)?c3ZiAyjO-1p1OM~;y1ajCm*}Pq}MXZ=u>FKtW0C;aW z0K2S5quV+hepC$~qGOt{4V`N}Y;k+=9bq8G3Bs%j&qno|MvMX24Op^Lt4mYUPOKQC z;a$A#@J4tSklAZgnWa=HN%mULNO!Jze8}U^`cgfX^$QdnzJsFGtMC8w2F$b*&yDCV z>29+2s$3B@s`-*Vm8!zCEHE`UY`VRFaET01V@;{;I4-UEOkAbrGkl|u30kL)?9G(q zy`kPB-cj?ZL>|x-GXzZmp}xuIf`>J7_omL5O!b0>Ja$RzdzQ|MA8&^RUrPc5`$r(S z<6fblRh-NmLpZ%RRUTt1qWO1}h+wVfEutFh^)OAcr<(4HZa60(H?pDg3Ig8Z7opjI zZ$~jyQ&{WYMN4XLby!3WQU|t;u6ado7xg+{fUoMom(N1s$Non#vw{_d6De7o?Cb8l zK`bx3rP|6puCL_q6^8X9ry@H~j{FTddAy-6NYsDFO-0@Arrbxvfw>S(x>Q=opDw4% z{#G(;w)R@&VGBKU#h~?fcu*zaOaye#+vMn+RIz?}!}f9G7qT(x=FKsd#m7yyTn!Af z7K1pp1n6=)99P}uPlw6F)8qI$-+KGEoot5|CUM-lwC9~k!goF#NgyV+=E=d43Xwt% zLw%YJ{}4>DW}C-^!2q_g%zOwHW*uKAuXnpt*xn7RAu>T$FLU#`4aDYinVHoi29Ww} zNAd+j*CG0tLKyHx*aifb`NYtN(=o-Tg+I6#0@I`Y&!(Gp!(O3X&;$iH>TOli7CYs! zx=Ihrd}u8s6?>H%*#m3|Jne_-e1 zjEdhdj<$_jj4G3=$_mlI2aQxt{+BU|A!2s%Ay&cuJTE2K4BK5EX25AL0%dnpLB$9H zVYF^Dhuy!arx`GRE#e~jf$#6*P2T+cwAe^naApSaKWl=g7E_#|Nyax%5enZU^x@$D zjIz>kl*i^V+8W(|PFbvA;<&>Oj{`SGNsJJFE%c$I= zsD~Qs-yw#y-3Pl2TR()1+1^Xg=kx*RAETx?JQWyN{35ZhkpOhrO^<7m8PJuw%zr<% zolw~SnTkM^`xl4`tgC6!p-C-t4+;HUTsKD}Qp+v4*h= zLi!Q@??RcAttoNRJgA!Z6P(=aqzx0V@>Vi%7?pyXk^qHGK%rc|mZ3tjjFVnOdxa=e zkG~AN1fWKci^G`r*6mn3$oLa?HeE8wF|Jy}`U1bk3O4AnKrERx7EosesKeCBeE1Hm zYTjXe(`vP>B`PHDf(=|!gCF$}7S49Z1Q@yi2E;Habh;Okz!u>n z7U6qNIT}gzaCq11)uz=1VaLl!2LKY2=Iw24VSRg4)cfMs%~u-BS_|c83|*M_TGQ+( z5kTK4I;VD$Y3)?(+N2$<%qBC0js_UhPyYhW-PPsS4cT7@@(43uviHdr7yk!Yzf`i~ z%8dk2Q*e*YX_@4Zb{y?n5fR{hRcW)04elHFDS!yzl4kY4C{CE)f=5gKdV4cTH`I1K zOK8P4-Nr=%lzw9M-zg68ek}q=zuTNbNNwkW&vt~MV0|1y6dauS=SGh)fC0 z3~hWA98FLGjAA^Q{B$<)C!JtKRaUN8POaY3oXZObt?os4_aysMVfKv;?Zl=9v)R53 z=276GCpx=vGzcSSrwhpoKKqcC{xWZB%I5fyvazh*L@M@WH;4`)*?E2bTR>%c&Hna7 z0^RCUtEV}axRbk*|HuEjzpp-=J|*w@Wo_TYi%p~m-s%l69NqL(-bg;ltd1!$92I&9 zqErKXWVgDmq_(Q(p6kppl8)W`ftAHpW0(|ioOg$140`!=8nQ(%V`WTFmB^=4@2aa% z$^re)0QnLH=Z#~_1U0n*t*)wh%kcGw1X%%s0%9&j-vo+$aBwsU&8<$!`lIZhtEZZE+&`4*0mi znw34}lMlTki(mx(y2MF;N?d~!@P&a?mW!k}&0#J$w`DRR=K>;Ly*2XJhHg>@ohyhm z`QadZdTMv!LqcBOgPsZuO>{QB=SgROF^C6HsE++^@l^sjty`|y!^Wg44F8~B36~vR z1W?G>d~rgWSLoCp<6plpb9db}G^bK}XiI;TG61ksbuFI~=tAVOpx?%RU{hXpkI$L| z#_%tk8-$v?_*8HbLGjtp8cTP2wzePTW@DVwV;bu{aR=aYm@LyCR3cU>#Qvg(X&t5- z5?snz&>5{kof?OY9nIfU11tGl&$27Q6hIf>%nJlpNsv$_p48ucpcmaBd$zjup`OS= zXJj+Am`*a!>+F2x>H^I5T8{z_qWx|l$ri-M{(wm6&D@w&FQ1H{h=@{Fp;|uK&}(FH z)UU(Z$4d7^yyrKbH=+2eZ0^H#pF!Zg zm-)r;)P9&JEtFdtkSUmayZtj?Yb)TyodfA!i}dEGuR2knH0Qzq4z`U^)h9pO%i6@L z!~gIPALDC_t(5siLVyC8>JvE<%3Jx!5LWa-t=^s|wJmH)C(R2B6x47h`J~{}Ddy87 zRKKUP?%OFglt9cj!o4ct%We~XoSCh2F`Dy`Usr`%@><*&bi{rWK3(LNEBAiHee_4( z#mRDG)Ini-qy$Y6in{3#L`5<4oWj=p!k2Ip|`~#DXwBCDC7ri}Mld zMyxSW7}oZxh}FG=_4+yL80iHs0V8Lr-yTrW`s@!*!L^p|@jT6sKE9VFR9sU@7S|FWLcD{CX`r{N>>$@{(I8v!8#~R!Un8sh; zCo?Pg+>wr<0Ox~{*DHbtcWbXYCuqpwzz0}T6}y4R(G1p}t|&k(*HrhvudBmdGNA zd0Y>i0T{sfE(C5b<0wUT&KL+j+x=aI77LUBC|Qbi^lox-vuTL@%dz3f!WX%$L9r|x zS%6>%Etwu+PNa>7D6hR}|4maTQ8j4n{v5DlncaYsjKRA}+@3Oyx`k;?ZPWhKcNk8p z;AKz~Fr-7CE3~}=iMCI$_8G7?HxfGa63}@r?Jn5ub-<^1&Kuut?k6LBF-LbmZ;m%X zDD_h-SJ~wID1KSHC*dJfo7ucU$v^HM-FheNwav#faJBSm5wa-b|1`2Yx*NysGH_h` zrPP4#4BVt9Z50nZ*393}eF>{OM#E?g1zvdquMD}KiwD+({BXqHzyVZ7OZGnYIcqo? vcC#XW1_C)|o>WHvaQycf>;J`%^ilHFM-PIZQY>iydI8HQOIN-({_=kS?GSdW From b02d7b33bd7ce879095a15fbb2242ffacf1ac5f8 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 12 Oct 2020 15:09:03 +1000 Subject: [PATCH 39/48] Add option to apply parameterized colors to SVGs returned by QgsApplication::getThemePixmap --- .../core/auto_generated/qgsapplication.sip.in | 6 +++++- src/core/qgsapplication.cpp | 21 +++++++++---------- src/core/qgsapplication.h | 7 ++++++- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/python/core/auto_generated/qgsapplication.sip.in b/python/core/auto_generated/qgsapplication.sip.in index eec36cdd8a18..436e8321bbca 100644 --- a/python/core/auto_generated/qgsapplication.sip.in +++ b/python/core/auto_generated/qgsapplication.sip.in @@ -356,10 +356,14 @@ Cursors are automatically scaled to look like a 16px cursor on 96dpi screens. %End - static QPixmap getThemePixmap( const QString &name ); + static QPixmap getThemePixmap( const QString &name, const QColor &foreColor = QColor(), const QColor &backColor = QColor(), int size = 16 ); %Docstring Helper to get a theme icon as a pixmap. It will fall back to the default theme if the active theme does not have the required icon. + +If ``foreColor`` or ``backColor`` are specified, then these colors will +be used for parameterized colors in SVG files wherever available. If +colors are specified then the ``size`` argument also must be set. %End static QString userStylePath(); diff --git a/src/core/qgsapplication.cpp b/src/core/qgsapplication.cpp index afc03b7638c5..e3f69ce765fd 100644 --- a/src/core/qgsapplication.cpp +++ b/src/core/qgsapplication.cpp @@ -715,20 +715,19 @@ QCursor QgsApplication::getThemeCursor( Cursor cursor ) } // TODO: add some caching mechanism ? -QPixmap QgsApplication::getThemePixmap( const QString &name ) +QPixmap QgsApplication::getThemePixmap( const QString &name, const QColor &foreColor, const QColor &backColor, const int size ) { - QString myPreferredPath = activeThemePath() + QDir::separator() + name; - QString myDefaultPath = defaultThemePath() + QDir::separator() + name; - if ( QFile::exists( myPreferredPath ) ) + const QString preferredPath = activeThemePath() + QDir::separator() + name; + const QString defaultPath = defaultThemePath() + QDir::separator() + name; + const QString path = QFile::exists( preferredPath ) ? preferredPath : defaultPath; + if ( foreColor.isValid() || backColor.isValid() ) { - return QPixmap( myPreferredPath ); - } - else - { - //could still return an empty icon if it - //doesn't exist in the default theme either! - return QPixmap( myDefaultPath ); + bool fitsInCache = false; + const QImage image = svgCache()->svgAsImage( path, size, backColor, foreColor, 1, 1, fitsInCache ); + return QPixmap::fromImage( image ); } + + return QPixmap( path ); } void QgsApplication::setThemeName( const QString &themeName ) diff --git a/src/core/qgsapplication.h b/src/core/qgsapplication.h index 83061c8ad230..d3c3eb54b5dc 100644 --- a/src/core/qgsapplication.h +++ b/src/core/qgsapplication.h @@ -19,6 +19,7 @@ #include #include #include +#include #include "qgis_sip.h" #include "qgsconfig.h" @@ -379,8 +380,12 @@ class CORE_EXPORT QgsApplication : public QApplication /** * Helper to get a theme icon as a pixmap. It will fall back to the * default theme if the active theme does not have the required icon. + * + * If \a foreColor or \a backColor are specified, then these colors will + * be used for parameterized colors in SVG files wherever available. If + * colors are specified then the \a size argument also must be set. */ - static QPixmap getThemePixmap( const QString &name ); + static QPixmap getThemePixmap( const QString &name, const QColor &foreColor = QColor(), const QColor &backColor = QColor(), int size = 16 ); //! Returns the path to user's style. static QString userStylePath(); From 0a3f40a191f4f9d9f8ede138e8b8d8eea376f84e Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 12 Oct 2020 15:09:56 +1000 Subject: [PATCH 40/48] Allow error indicator colors to be controlled for code editor color scheme --- images/images.qrc | 1 + .../console/iconSyntaxErrorConsoleParams.svg | 1 + .../qgscodeeditorcolorscheme.sip.in | 1 + src/app/options/qgscodeeditoroptions.cpp | 1 + src/gui/codeeditors/qgscodeeditor.cpp | 9 +- .../codeeditors/qgscodeeditorcolorscheme.h | 1 + .../qgscodeeditorcolorschemeregistry.cpp | 3 + src/ui/qgscodeditorsettings.ui | 147 ++++++++++-------- 8 files changed, 95 insertions(+), 69 deletions(-) create mode 100644 images/themes/default/console/iconSyntaxErrorConsoleParams.svg diff --git a/images/images.qrc b/images/images.qrc index e5504fbd4849..e87ac81b90e3 100644 --- a/images/images.qrc +++ b/images/images.qrc @@ -891,6 +891,7 @@ themes/default/mActionLabelAnchorStart.svg themes/default/transformation.svg themes/default/mIconCodeEditor.svg + themes/default/console/iconSyntaxErrorConsoleParams.svg qgis_tips/symbol_levels.png diff --git a/images/themes/default/console/iconSyntaxErrorConsoleParams.svg b/images/themes/default/console/iconSyntaxErrorConsoleParams.svg new file mode 100644 index 000000000000..69a692d4a69c --- /dev/null +++ b/images/themes/default/console/iconSyntaxErrorConsoleParams.svg @@ -0,0 +1 @@ + diff --git a/python/gui/auto_generated/codeeditors/qgscodeeditorcolorscheme.sip.in b/python/gui/auto_generated/codeeditors/qgscodeeditorcolorscheme.sip.in index 11edee52f6e0..2d6dc1e5b40f 100644 --- a/python/gui/auto_generated/codeeditors/qgscodeeditorcolorscheme.sip.in +++ b/python/gui/auto_generated/codeeditors/qgscodeeditorcolorscheme.sip.in @@ -54,6 +54,7 @@ Defines a color scheme for use in QgsCodeEditor widgets. Edge, Fold, Error, + ErrorBackground, FoldIconForeground, FoldIconHalo, IndentationGuide, diff --git a/src/app/options/qgscodeeditoroptions.cpp b/src/app/options/qgscodeeditoroptions.cpp index e3e6bff55415..2c5582309dd8 100644 --- a/src/app/options/qgscodeeditoroptions.cpp +++ b/src/app/options/qgscodeeditoroptions.cpp @@ -66,6 +66,7 @@ QgsCodeEditorOptionsWidget::QgsCodeEditorOptionsWidget( QWidget *parent ) {QgsCodeEditorColorScheme::ColorRole::Edge, mColorEdge }, {QgsCodeEditorColorScheme::ColorRole::Fold, mColorFold }, {QgsCodeEditorColorScheme::ColorRole::Error, mColorError }, + {QgsCodeEditorColorScheme::ColorRole::ErrorBackground, mColorErrorBackground }, {QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, mColorFoldIcon }, {QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, mColorFoldIconHalo }, {QgsCodeEditorColorScheme::ColorRole::IndentationGuide, mColorIndentation }, diff --git a/src/gui/codeeditors/qgscodeeditor.cpp b/src/gui/codeeditors/qgscodeeditor.cpp index 242846545abf..9797765f4fe6 100644 --- a/src/gui/codeeditors/qgscodeeditor.cpp +++ b/src/gui/codeeditors/qgscodeeditor.cpp @@ -62,6 +62,7 @@ QMap< QgsCodeEditorColorScheme::ColorRole, QString > QgsCodeEditor::sColorRoleTo {QgsCodeEditorColorScheme::ColorRole::Edge, QStringLiteral( "edgeColor" ) }, {QgsCodeEditorColorScheme::ColorRole::Fold, QStringLiteral( "foldColor" ) }, {QgsCodeEditorColorScheme::ColorRole::Error, QStringLiteral( "stderrFontColor" ) }, + {QgsCodeEditorColorScheme::ColorRole::ErrorBackground, QStringLiteral( "stderrBackgroundColor" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QStringLiteral( "foldIconForeground" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QStringLiteral( "foldIconHalo" ) }, {QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QStringLiteral( "indentationGuide" ) }, @@ -89,8 +90,6 @@ QgsCodeEditor::QgsCodeEditor( QWidget *parent, const QString &title, bool foldin SendScintilla( SCI_SETMULTIPASTE, 1 ); SendScintilla( SCI_SETVIRTUALSPACEOPTIONS, SCVS_RECTANGULARSELECTION ); - markerDefine( QgsApplication::getThemePixmap( "console/iconSyntaxErrorConsole.svg" ), - MARKER_NUMBER ); SendScintilla( SCI_SETMARGINTYPEN, 3, SC_MARGIN_SYMBOL ); SendScintilla( SCI_SETMARGINMASKN, 3, 1 << MARKER_NUMBER ); setMarginWidth( 3, 0 ); @@ -248,6 +247,9 @@ void QgsCodeEditor::setSciWidget() // autocomplete setAutoCompletionThreshold( 2 ); setAutoCompletionSource( QsciScintilla::AcsAPIs ); + + markerDefine( QgsApplication::getThemePixmap( "console/iconSyntaxErrorConsoleParams.svg", lexerColor( QgsCodeEditorColorScheme::ColorRole::Error ), + lexerColor( QgsCodeEditorColorScheme::ColorRole::ErrorBackground ), 16 ), MARKER_NUMBER ); } void QgsCodeEditor::setTitle( const QString &title ) @@ -360,6 +362,7 @@ QColor QgsCodeEditor::defaultColor( QgsCodeEditorColorScheme::ColorRole role, co {QgsCodeEditorColorScheme::ColorRole::Edge, QStringLiteral( "edgeColor" ) }, {QgsCodeEditorColorScheme::ColorRole::Fold, QStringLiteral( "foldColor" ) }, {QgsCodeEditorColorScheme::ColorRole::Error, QStringLiteral( "stderrFontColor" ) }, + {QgsCodeEditorColorScheme::ColorRole::ErrorBackground, QStringLiteral( "stderrBackground" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QStringLiteral( "foldIconForeground" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QStringLiteral( "foldIconHalo" ) }, {QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QStringLiteral( "indentationGuide" ) }, @@ -460,7 +463,7 @@ void QgsCodeEditor::addWarning( const int lineNumber, const QString &warning ) font.setItalic( true ); const QsciStyle styleAnn = QsciStyle( -1, QStringLiteral( "Annotation" ), lexerColor( QgsCodeEditorColorScheme::ColorRole::Error ), - QColor( 255, 200, 0 ), // TODO - expose as configurable color! + lexerColor( QgsCodeEditorColorScheme::ColorRole::ErrorBackground ), font, true ); annotate( lineNumber, warning, styleAnn ); diff --git a/src/gui/codeeditors/qgscodeeditorcolorscheme.h b/src/gui/codeeditors/qgscodeeditorcolorscheme.h index f9be04880033..6de068681d65 100644 --- a/src/gui/codeeditors/qgscodeeditorcolorscheme.h +++ b/src/gui/codeeditors/qgscodeeditorcolorscheme.h @@ -67,6 +67,7 @@ class GUI_EXPORT QgsCodeEditorColorScheme Edge, //!< Edge color Fold, //!< Fold color Error, //!< Error color + ErrorBackground, //!< Error background color FoldIconForeground, //!< Fold icon foreground color FoldIconHalo, //!< Fold icon halo color IndentationGuide, //!< Indentation guide line diff --git a/src/gui/codeeditors/qgscodeeditorcolorschemeregistry.cpp b/src/gui/codeeditors/qgscodeeditorcolorschemeregistry.cpp index e63a8f572fb4..f39c87dc406f 100644 --- a/src/gui/codeeditors/qgscodeeditorcolorschemeregistry.cpp +++ b/src/gui/codeeditors/qgscodeeditorcolorschemeregistry.cpp @@ -52,6 +52,7 @@ QgsCodeEditorColorSchemeRegistry::QgsCodeEditorColorSchemeRegistry() {QgsCodeEditorColorScheme::ColorRole::Edge, QColor( "#efefef" ) }, {QgsCodeEditorColorScheme::ColorRole::Fold, QColor( "#efefef" ) }, {QgsCodeEditorColorScheme::ColorRole::Error, QColor( "#e31a1c" ) }, + {QgsCodeEditorColorScheme::ColorRole::ErrorBackground, QColor( "#ffffff" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QColor( "#ffffff" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QColor( "#000000" ) }, {QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QColor( "#d5d5d5" ) }, @@ -92,6 +93,7 @@ QgsCodeEditorColorSchemeRegistry::QgsCodeEditorColorSchemeRegistry() {QgsCodeEditorColorScheme::ColorRole::Edge, QColor( "#EEE8D5" ) }, {QgsCodeEditorColorScheme::ColorRole::Fold, QColor( "#EEE8D5" ) }, {QgsCodeEditorColorScheme::ColorRole::Error, QColor( "#DC322F" ) }, + {QgsCodeEditorColorScheme::ColorRole::ErrorBackground, QColor( "#ffffff" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QColor( "#ffffff" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QColor( "#93a1a1" ) }, {QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QColor( "#c2beb3" ) }, @@ -132,6 +134,7 @@ QgsCodeEditorColorSchemeRegistry::QgsCodeEditorColorSchemeRegistry() {QgsCodeEditorColorScheme::ColorRole::Edge, QColor( "#586E75" ) }, {QgsCodeEditorColorScheme::ColorRole::Fold, QColor( "#073642" ) }, {QgsCodeEditorColorScheme::ColorRole::Error, QColor( "#DC322F" ) }, + {QgsCodeEditorColorScheme::ColorRole::ErrorBackground, QColor( "#ffffff" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QColor( "#586e75" ) }, {QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QColor( "#839496" ) }, {QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QColor( "#586E75" ) }, diff --git a/src/ui/qgscodeditorsettings.ui b/src/ui/qgscodeditorsettings.ui index 0bc5d4469def..58b00a394526 100644 --- a/src/ui/qgscodeditorsettings.ui +++ b/src/ui/qgscodeditorsettings.ui @@ -297,13 +297,6 @@ true - - - - - - - @@ -479,13 +472,6 @@ - - - - - - - @@ -535,13 +521,6 @@ - - - - Indentation guide - - - @@ -552,13 +531,6 @@ - - - - - - - @@ -580,13 +552,6 @@ - - - - Comment line - - - @@ -615,13 +580,6 @@ - - - - - - - @@ -664,13 +622,6 @@ - - - - Fold guide - - - @@ -734,13 +685,6 @@ - - - - Caretline - - - @@ -762,22 +706,92 @@ - + + + + Operator + + + + + + + Caretline + + + + + + + + + + + + + + Fold guide + + + + + + + + + + + Edge guide - - + + - Operator + + + + + + + + Indentation guide - + + + + + + + + + + Comment line + + + + + + + + + + + + + + Error background + + + + + @@ -865,21 +879,22 @@ mColorError mColorComment mColorCommentBlock - mColorCommentLine + mColorErrorBackground mColorSingleQuote mColorDoubleQuote - mColorIndentation + mColorCommentLine mColorTripleSingleQuote mColorTripleDoubleQuote - mColorEdge + mColorIndentation mColorMarginBackground mColorMarginForeground - mColorFold + mColorEdge mColorSelectionBackground mColorSelectionForeground - mColorCaretLine + mColorFold mColorBraceBackground mColorBraceForeground + mColorCaretLine mColorFoldIcon mColorFoldIconHalo mListLanguage From 56b349479b15c611e0130478f7ade3e44b6fdf11 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 13 Oct 2020 09:01:24 +1000 Subject: [PATCH 41/48] Spelling --- python/core/auto_generated/qgsapplication.sip.in | 2 +- src/core/qgsapplication.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/core/auto_generated/qgsapplication.sip.in b/python/core/auto_generated/qgsapplication.sip.in index 436e8321bbca..4da9afba6c93 100644 --- a/python/core/auto_generated/qgsapplication.sip.in +++ b/python/core/auto_generated/qgsapplication.sip.in @@ -362,7 +362,7 @@ Helper to get a theme icon as a pixmap. It will fall back to the default theme if the active theme does not have the required icon. If ``foreColor`` or ``backColor`` are specified, then these colors will -be used for parameterized colors in SVG files wherever available. If +be used for parametrized colors in SVG files wherever available. If colors are specified then the ``size`` argument also must be set. %End diff --git a/src/core/qgsapplication.h b/src/core/qgsapplication.h index d3c3eb54b5dc..17fb32d6742d 100644 --- a/src/core/qgsapplication.h +++ b/src/core/qgsapplication.h @@ -382,7 +382,7 @@ class CORE_EXPORT QgsApplication : public QApplication * default theme if the active theme does not have the required icon. * * If \a foreColor or \a backColor are specified, then these colors will - * be used for parameterized colors in SVG files wherever available. If + * be used for parametrized colors in SVG files wherever available. If * colors are specified then the \a size argument also must be set. */ static QPixmap getThemePixmap( const QString &name, const QColor &foreColor = QColor(), const QColor &backColor = QColor(), int size = 16 ); From 8298d682ebbc9f8863ab456806f3aeb816701cdc Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Fri, 9 Oct 2020 11:12:44 +1000 Subject: [PATCH 42/48] Catch another situation where the user-set custom CRS name needs to be restored from XML --- src/core/qgscoordinatereferencesystem.cpp | 4 ++ .../core/testqgscoordinatereferencesystem.cpp | 38 +++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/core/qgscoordinatereferencesystem.cpp b/src/core/qgscoordinatereferencesystem.cpp index 0341cf159c2e..a18dc12fd58a 100644 --- a/src/core/qgscoordinatereferencesystem.cpp +++ b/src/core/qgscoordinatereferencesystem.cpp @@ -891,6 +891,10 @@ bool QgsCoordinateReferenceSystem::createFromWktInternal( const QString &wkt, co else { setWktString( wkt ); + if ( !description.isEmpty() ) + { + d->mDescription = description; + } if ( d->mSrsId == 0 ) { #if PROJ_VERSION_MAJOR>=6 diff --git a/tests/src/core/testqgscoordinatereferencesystem.cpp b/tests/src/core/testqgscoordinatereferencesystem.cpp index e25d5dbbadd5..ba1215b2cf1e 100644 --- a/tests/src/core/testqgscoordinatereferencesystem.cpp +++ b/tests/src/core/testqgscoordinatereferencesystem.cpp @@ -1122,7 +1122,7 @@ void TestQgsCoordinateReferenceSystem::readWriteXml() #if PROJ_VERSION_MAJOR>=6 // valid CRS from WKT string, not matching a local user CRS QgsCoordinateReferenceSystem myCrs20; - myCrs20.createFromWkt( QStringLiteral( R"""(PROJCS["xxx",GEOGCS["GDA94",DATUM["Geocentric_Datum_of_Australia_1994",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[1,2,3,4,5,16,17],AUTHORITY["EPSG","6283"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4283"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["standard_parallel_1",-36],PARAMETER["standard_parallel_2",-38],PARAMETER["latitude_of_origin",-37.5],PARAMETER["central_meridian",145.5],PARAMETER["false_easting",2533000],PARAMETER["false_northing",2533000],AXIS["Easting",EAST],AXIS["Northing",NORTH]])""" ) ); + myCrs20.createFromWkt( QStringLiteral( R"""(PROJCS["",GEOGCS["GDA94",DATUM["Geocentric_Datum_of_Australia_1994",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[1,2,3,4,5,16,17],AUTHORITY["EPSG","6283"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4283"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["standard_parallel_1",-36],PARAMETER["standard_parallel_2",-38],PARAMETER["latitude_of_origin",-37.5],PARAMETER["central_meridian",145.5],PARAMETER["false_easting",2533000],PARAMETER["false_northing",2533000],AXIS["Easting",EAST],AXIS["Northing",NORTH]])""" ) ); QVERIFY( myCrs20.isValid() ); node = document.createElement( QStringLiteral( "crs" ) ); document.appendChild( node ); @@ -1131,7 +1131,7 @@ void TestQgsCoordinateReferenceSystem::readWriteXml() QVERIFY( myCrs21.readXml( node ) ); QVERIFY( myCrs21.isValid() ); QgsDebugMsg( myCrs21.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ) ); - QCOMPARE( myCrs21.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ), QStringLiteral( R"""(BOUNDCRS[SOURCECRS[PROJCRS["xxx",BASEGEOGCRS["GDA94",DATUM["Geocentric Datum of Australia 1994",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4283]],CONVERSION["unnamed",METHOD["Lambert Conic Conformal (2SP)",ID["EPSG",9802]],PARAMETER["Latitude of 1st standard parallel",-36,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8823]],PARAMETER["Latitude of 2nd standard parallel",-38,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8824]],PARAMETER["Latitude of false origin",-37.5,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8821]],PARAMETER["Longitude of false origin",145.5,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8822]],PARAMETER["Easting at false origin",2533000,LENGTHUNIT["metre",1],ID["EPSG",8826]],PARAMETER["Northing at false origin",2533000,LENGTHUNIT["metre",1],ID["EPSG",8827]]],CS[Cartesian,2],AXIS["easting",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["northing",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]],TARGETCRS[GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]]],ABRIDGEDTRANSFORMATION["Transformation from GDA94 to WGS84",METHOD["Position Vector transformation (geog2D domain)",ID["EPSG",9606]],PARAMETER["X-axis translation",1,ID["EPSG",8605]],PARAMETER["Y-axis translation",2,ID["EPSG",8606]],PARAMETER["Z-axis translation",3,ID["EPSG",8607]],PARAMETER["X-axis rotation",4,ID["EPSG",8608]],PARAMETER["Y-axis rotation",5,ID["EPSG",8609]],PARAMETER["Z-axis rotation",16,ID["EPSG",8610]],PARAMETER["Scale difference",1.000017,ID["EPSG",8611]]]])""" ) ); + QCOMPARE( myCrs21.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ), QStringLiteral( R"""(BOUNDCRS[SOURCECRS[PROJCRS["",BASEGEOGCRS["GDA94",DATUM["Geocentric Datum of Australia 1994",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4283]],CONVERSION["unnamed",METHOD["Lambert Conic Conformal (2SP)",ID["EPSG",9802]],PARAMETER["Latitude of 1st standard parallel",-36,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8823]],PARAMETER["Latitude of 2nd standard parallel",-38,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8824]],PARAMETER["Latitude of false origin",-37.5,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8821]],PARAMETER["Longitude of false origin",145.5,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8822]],PARAMETER["Easting at false origin",2533000,LENGTHUNIT["metre",1],ID["EPSG",8826]],PARAMETER["Northing at false origin",2533000,LENGTHUNIT["metre",1],ID["EPSG",8827]]],CS[Cartesian,2],AXIS["easting",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["northing",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]],TARGETCRS[GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]]],ABRIDGEDTRANSFORMATION["Transformation from GDA94 to WGS84",METHOD["Position Vector transformation (geog2D domain)",ID["EPSG",9606]],PARAMETER["X-axis translation",1,ID["EPSG",8605]],PARAMETER["Y-axis translation",2,ID["EPSG",8606]],PARAMETER["Z-axis translation",3,ID["EPSG",8607]],PARAMETER["X-axis rotation",4,ID["EPSG",8608]],PARAMETER["Y-axis rotation",5,ID["EPSG",8609]],PARAMETER["Z-axis rotation",16,ID["EPSG",8610]],PARAMETER["Scale difference",1.000017,ID["EPSG",8611]]]])""" ) ); QCOMPARE( myCrs21.description(), QString() ); // now fudge in the description node to mimic as though the XML came from a different QGIS install where this CRS was a user-defined CRS with a name @@ -1143,9 +1143,41 @@ void TestQgsCoordinateReferenceSystem::readWriteXml() QVERIFY( myCrs22.readXml( node ) ); QVERIFY( myCrs22.isValid() ); QgsDebugMsg( myCrs22.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ) ); - QCOMPARE( myCrs22.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ), QStringLiteral( R"""(BOUNDCRS[SOURCECRS[PROJCRS["xxx",BASEGEOGCRS["GDA94",DATUM["Geocentric Datum of Australia 1994",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4283]],CONVERSION["unnamed",METHOD["Lambert Conic Conformal (2SP)",ID["EPSG",9802]],PARAMETER["Latitude of 1st standard parallel",-36,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8823]],PARAMETER["Latitude of 2nd standard parallel",-38,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8824]],PARAMETER["Latitude of false origin",-37.5,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8821]],PARAMETER["Longitude of false origin",145.5,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8822]],PARAMETER["Easting at false origin",2533000,LENGTHUNIT["metre",1],ID["EPSG",8826]],PARAMETER["Northing at false origin",2533000,LENGTHUNIT["metre",1],ID["EPSG",8827]]],CS[Cartesian,2],AXIS["easting",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["northing",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]],TARGETCRS[GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]]],ABRIDGEDTRANSFORMATION["Transformation from GDA94 to WGS84",METHOD["Position Vector transformation (geog2D domain)",ID["EPSG",9606]],PARAMETER["X-axis translation",1,ID["EPSG",8605]],PARAMETER["Y-axis translation",2,ID["EPSG",8606]],PARAMETER["Z-axis translation",3,ID["EPSG",8607]],PARAMETER["X-axis rotation",4,ID["EPSG",8608]],PARAMETER["Y-axis rotation",5,ID["EPSG",8609]],PARAMETER["Z-axis rotation",16,ID["EPSG",8610]],PARAMETER["Scale difference",1.000017,ID["EPSG",8611]]]])""" ) ); + QCOMPARE( myCrs22.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ), QStringLiteral( R"""(BOUNDCRS[SOURCECRS[PROJCRS["",BASEGEOGCRS["GDA94",DATUM["Geocentric Datum of Australia 1994",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4283]],CONVERSION["unnamed",METHOD["Lambert Conic Conformal (2SP)",ID["EPSG",9802]],PARAMETER["Latitude of 1st standard parallel",-36,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8823]],PARAMETER["Latitude of 2nd standard parallel",-38,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8824]],PARAMETER["Latitude of false origin",-37.5,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8821]],PARAMETER["Longitude of false origin",145.5,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8822]],PARAMETER["Easting at false origin",2533000,LENGTHUNIT["metre",1],ID["EPSG",8826]],PARAMETER["Northing at false origin",2533000,LENGTHUNIT["metre",1],ID["EPSG",8827]]],CS[Cartesian,2],AXIS["easting",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["northing",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]],TARGETCRS[GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]]],ABRIDGEDTRANSFORMATION["Transformation from GDA94 to WGS84",METHOD["Position Vector transformation (geog2D domain)",ID["EPSG",9606]],PARAMETER["X-axis translation",1,ID["EPSG",8605]],PARAMETER["Y-axis translation",2,ID["EPSG",8606]],PARAMETER["Z-axis translation",3,ID["EPSG",8607]],PARAMETER["X-axis rotation",4,ID["EPSG",8608]],PARAMETER["Y-axis rotation",5,ID["EPSG",8609]],PARAMETER["Z-axis rotation",16,ID["EPSG",8610]],PARAMETER["Scale difference",1.000017,ID["EPSG",8611]]]])""" ) ); // description should be restored, even though it's not a user-defined CRS on this install... QCOMPARE( myCrs22.description(), QStringLiteral( "someone else's previously saved CRS" ) ); + + // a different WKT string, which doesn't match any CRS previously used this session + node.toElement().elementsByTagName( QStringLiteral( "spatialrefsys" ) ).at( 0 ).toElement().removeChild( node.toElement().elementsByTagName( QStringLiteral( "spatialrefsys" ) ).at( 0 ).toElement().elementsByTagName( QStringLiteral( "wkt" ) ).at( 0 ) ); + QDomElement wktElementNew = document.createElement( QStringLiteral( "wkt" ) ); + wktElementNew.appendChild( document.createTextNode( R"""(PROJCRS["",BASEGEOGCRS["unknown",DATUM["Unknown based on WGS84 ellipsoid",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1],ID["EPSG",7030]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Hotine Oblique Mercator (variant B)",ID["EPSG",9815]],PARAMETER["Latitude of projection centre",47.173836897,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8811]],PARAMETER["Longitude of projection centre",8.4550705414,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8812]],PARAMETER["Azimuth of initial line",39.3,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8813]],PARAMETER["Angle from Rectified to Skew Grid",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8814]],PARAMETER["Scale factor on initial line",1,SCALEUNIT["unity",1],ID["EPSG",8815]],PARAMETER["Easting at projection centre",750,LENGTHUNIT["metre",1],ID["EPSG",8816]],PARAMETER["Northing at projection centre",250,LENGTHUNIT["metre",1],ID["EPSG",8817]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]])""" ) ); + node.toElement().elementsByTagName( QStringLiteral( "spatialrefsys" ) ).at( 0 ).toElement().appendChild( wktElementNew ); + QDomElement descriptionElementB = document.createElement( QStringLiteral( "description" ) ); + descriptionElementB.appendChild( document.createTextNode( QStringLiteral( "a new CRS" ) ) ); + node.toElement().elementsByTagName( QStringLiteral( "spatialrefsys" ) ).at( 0 ).toElement().removeChild( node.toElement().elementsByTagName( QStringLiteral( "spatialrefsys" ) ).at( 0 ).toElement().elementsByTagName( QStringLiteral( "description" ) ).at( 0 ) ); + node.toElement().elementsByTagName( QStringLiteral( "spatialrefsys" ) ).at( 0 ).toElement().appendChild( descriptionElementB ); + QgsCoordinateReferenceSystem myCrs21b; + QVERIFY( myCrs21b.readXml( node ) ); + QVERIFY( myCrs21b.isValid() ); + QgsDebugMsg( myCrs21b.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ) ); + QCOMPARE( myCrs21b.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ), QStringLiteral( R"""(PROJCRS["",BASEGEOGCRS["unknown",DATUM["Unknown based on WGS84 ellipsoid",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1],ID["EPSG",7030]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Hotine Oblique Mercator (variant B)",ID["EPSG",9815]],PARAMETER["Latitude of projection centre",47.173836897,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8811]],PARAMETER["Longitude of projection centre",8.4550705414,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8812]],PARAMETER["Azimuth of initial line",39.3,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8813]],PARAMETER["Angle from Rectified to Skew Grid",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8814]],PARAMETER["Scale factor on initial line",1,SCALEUNIT["unity",1],ID["EPSG",8815]],PARAMETER["Easting at projection centre",750,LENGTHUNIT["metre",1],ID["EPSG",8816]],PARAMETER["Northing at projection centre",250,LENGTHUNIT["metre",1],ID["EPSG",8817]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]])""" ) ); + QCOMPARE( myCrs21b.description(), QStringLiteral( "a new CRS" ) ); + + // a different WKT string, which doesn't match any CRS previously used this session, and which includes a name in the WKT but which should be overridden with the user set name + node.toElement().elementsByTagName( QStringLiteral( "spatialrefsys" ) ).at( 0 ).toElement().removeChild( node.toElement().elementsByTagName( QStringLiteral( "spatialrefsys" ) ).at( 0 ).toElement().elementsByTagName( QStringLiteral( "wkt" ) ).at( 0 ) ); + QDomElement wktElementNewC = document.createElement( QStringLiteral( "wkt" ) ); + wktElementNewC.appendChild( document.createTextNode( R"""(PROJCRS["XXYYZZ",BASEGEOGCRS["unknown",DATUM["Unknown based on WGS84 ellipsoid",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1],ID["EPSG",7030]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Hotine Oblique Mercator (variant B)",ID["EPSG",9815]],PARAMETER["Latitude of projection centre",47.2,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8811]],PARAMETER["Longitude of projection centre",8.4550705414,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8812]],PARAMETER["Azimuth of initial line",39.3,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8813]],PARAMETER["Angle from Rectified to Skew Grid",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8814]],PARAMETER["Scale factor on initial line",1,SCALEUNIT["unity",1],ID["EPSG",8815]],PARAMETER["Easting at projection centre",750,LENGTHUNIT["metre",1],ID["EPSG",8816]],PARAMETER["Northing at projection centre",250,LENGTHUNIT["metre",1],ID["EPSG",8817]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]])""" ) ); + node.toElement().elementsByTagName( QStringLiteral( "spatialrefsys" ) ).at( 0 ).toElement().appendChild( wktElementNewC ); + QDomElement descriptionElementC = document.createElement( QStringLiteral( "description" ) ); + descriptionElementC.appendChild( document.createTextNode( QStringLiteral( "a new CRS C" ) ) ); + node.toElement().elementsByTagName( QStringLiteral( "spatialrefsys" ) ).at( 0 ).toElement().removeChild( node.toElement().elementsByTagName( QStringLiteral( "spatialrefsys" ) ).at( 0 ).toElement().elementsByTagName( QStringLiteral( "description" ) ).at( 0 ) ); + node.toElement().elementsByTagName( QStringLiteral( "spatialrefsys" ) ).at( 0 ).toElement().appendChild( descriptionElementC ); + QgsCoordinateReferenceSystem myCrs21c; + QVERIFY( myCrs21c.readXml( node ) ); + QVERIFY( myCrs21c.isValid() ); + QgsDebugMsg( myCrs21c.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ) ); + QCOMPARE( myCrs21c.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ), QStringLiteral( R"""(PROJCRS["XXYYZZ",BASEGEOGCRS["unknown",DATUM["Unknown based on WGS84 ellipsoid",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1],ID["EPSG",7030]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Hotine Oblique Mercator (variant B)",ID["EPSG",9815]],PARAMETER["Latitude of projection centre",47.2,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8811]],PARAMETER["Longitude of projection centre",8.4550705414,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8812]],PARAMETER["Azimuth of initial line",39.3,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8813]],PARAMETER["Angle from Rectified to Skew Grid",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8814]],PARAMETER["Scale factor on initial line",1,SCALEUNIT["unity",1],ID["EPSG",8815]],PARAMETER["Easting at projection centre",750,LENGTHUNIT["metre",1],ID["EPSG",8816]],PARAMETER["Northing at projection centre",250,LENGTHUNIT["metre",1],ID["EPSG",8817]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]])""" ) ); + QCOMPARE( myCrs21c.description(), QStringLiteral( "a new CRS C" ) ); #endif } From 9a35b27630982d63101c57c3e3440dcbf1a7786f Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Fri, 9 Oct 2020 11:17:42 +1000 Subject: [PATCH 43/48] When creating a CRS from WKT and the WKT has an embedded CRS name, correctly use this to set the QgsCoordinateReferenceSystem description --- src/core/qgscoordinatereferencesystem.cpp | 6 ++++++ tests/src/core/testqgscoordinatereferencesystem.cpp | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/core/qgscoordinatereferencesystem.cpp b/src/core/qgscoordinatereferencesystem.cpp index a18dc12fd58a..9176d202f705 100644 --- a/src/core/qgscoordinatereferencesystem.cpp +++ b/src/core/qgscoordinatereferencesystem.cpp @@ -692,7 +692,12 @@ bool QgsCoordinateReferenceSystem::loadFromDatabase( const QString &db, const QS if ( !d->mIsValid ) { if ( !wkt.isEmpty() ) + { setWktString( wkt, false ); + // set WKT string resets the description to that description embedded in the WKT, so manually overwrite this back to the + // value from the user DB + d->mDescription = statement.columnAsText( 1 ); + } else setProjString( d->mProj4 ); } @@ -1656,6 +1661,7 @@ bool QgsCoordinateReferenceSystem::setWktString( const QString &wkt, bool allowP { // Still a valid CRS, just not a known one d->mIsValid = true; + d->mDescription = QString( proj_get_name( d->threadLocalProjObject() ) ); } setMapUnits(); } diff --git a/tests/src/core/testqgscoordinatereferencesystem.cpp b/tests/src/core/testqgscoordinatereferencesystem.cpp index ba1215b2cf1e..046285b821f2 100644 --- a/tests/src/core/testqgscoordinatereferencesystem.cpp +++ b/tests/src/core/testqgscoordinatereferencesystem.cpp @@ -522,6 +522,13 @@ void TestQgsCoordinateReferenceSystem::fromWkt() QCOMPARE( myCrs.srsid(), GEOCRS_ID ); myCrs = QgsCoordinateReferenceSystem::fromWkt( QStringLiteral( "not wkt" ) ); QVERIFY( !myCrs.isValid() ); + +#if PROJ_VERSION_MAJOR>=6 + // wkt with embedded name + myCrs = QgsCoordinateReferenceSystem::fromWkt( R"""(PROJCRS["some locally made crs",BASEGEOGCRS["unknown",DATUM["Unknown based on WGS84 ellipsoid",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1],ID["EPSG",7030]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Hotine Oblique Mercator (variant B)",ID["EPSG",9815]],PARAMETER["Latitude of projection centre",47.2,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8811]],PARAMETER["Longitude of projection centre",9,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8812]],PARAMETER["Azimuth of initial line",39.4,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8813]],PARAMETER["Angle from Rectified to Skew Grid",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8814]],PARAMETER["Scale factor on initial line",1,SCALEUNIT["unity",1],ID["EPSG",8815]],PARAMETER["Easting at projection centre",750,LENGTHUNIT["metre",1],ID["EPSG",8816]],PARAMETER["Northing at projection centre",250,LENGTHUNIT["metre",1],ID["EPSG",8817]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]])""" ); + QVERIFY( myCrs.isValid() ); + QCOMPARE( myCrs.description(), QStringLiteral( "some locally made crs" ) ); +#endif } void TestQgsCoordinateReferenceSystem::wktCache() From ad3f0a8f1e95d56794b9a0938d5837f78a72cff7 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 13 Oct 2020 09:39:33 +1000 Subject: [PATCH 44/48] Make test WKT comparison more tolerant --- .../core/testqgscoordinatereferencesystem.cpp | 45 +++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/tests/src/core/testqgscoordinatereferencesystem.cpp b/tests/src/core/testqgscoordinatereferencesystem.cpp index 046285b821f2..82b5919fab23 100644 --- a/tests/src/core/testqgscoordinatereferencesystem.cpp +++ b/tests/src/core/testqgscoordinatereferencesystem.cpp @@ -1138,7 +1138,14 @@ void TestQgsCoordinateReferenceSystem::readWriteXml() QVERIFY( myCrs21.readXml( node ) ); QVERIFY( myCrs21.isValid() ); QgsDebugMsg( myCrs21.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ) ); - QCOMPARE( myCrs21.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ), QStringLiteral( R"""(BOUNDCRS[SOURCECRS[PROJCRS["",BASEGEOGCRS["GDA94",DATUM["Geocentric Datum of Australia 1994",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4283]],CONVERSION["unnamed",METHOD["Lambert Conic Conformal (2SP)",ID["EPSG",9802]],PARAMETER["Latitude of 1st standard parallel",-36,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8823]],PARAMETER["Latitude of 2nd standard parallel",-38,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8824]],PARAMETER["Latitude of false origin",-37.5,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8821]],PARAMETER["Longitude of false origin",145.5,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8822]],PARAMETER["Easting at false origin",2533000,LENGTHUNIT["metre",1],ID["EPSG",8826]],PARAMETER["Northing at false origin",2533000,LENGTHUNIT["metre",1],ID["EPSG",8827]]],CS[Cartesian,2],AXIS["easting",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["northing",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]],TARGETCRS[GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]]],ABRIDGEDTRANSFORMATION["Transformation from GDA94 to WGS84",METHOD["Position Vector transformation (geog2D domain)",ID["EPSG",9606]],PARAMETER["X-axis translation",1,ID["EPSG",8605]],PARAMETER["Y-axis translation",2,ID["EPSG",8606]],PARAMETER["Z-axis translation",3,ID["EPSG",8607]],PARAMETER["X-axis rotation",4,ID["EPSG",8608]],PARAMETER["Y-axis rotation",5,ID["EPSG",8609]],PARAMETER["Z-axis rotation",16,ID["EPSG",8610]],PARAMETER["Scale difference",1.000017,ID["EPSG",8611]]]])""" ) ); + QVERIFY( myCrs21.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(BOUNDCRS[SOURCECRS[PROJCRS["")""" ) ) ); + QVERIFY( myCrs21.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["X-axis translation",1,ID["EPSG",8605]],PARAMETER["Y-axis translation",2,ID["EPSG",8606]],PARAMETER["Z-axis translation",3,ID["EPSG",8607]],PARAMETER["X-axis rotation",4,ID["EPSG",8608]],PARAMETER["Y-axis rotation",5,ID["EPSG",8609]],PARAMETER["Z-axis rotation",16,ID["EPSG",8610]])""" ) ) ); + QVERIFY( myCrs21.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Latitude of 1st standard parallel",-36,)""" ) ) ); + QVERIFY( myCrs21.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Latitude of 2nd standard parallel",-38,)""" ) ) ); + QVERIFY( myCrs21.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Latitude of false origin",-37.5,)""" ) ) ); + QVERIFY( myCrs21.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Longitude of false origin",145.5,)""" ) ) ); + QVERIFY( myCrs21.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Easting at false origin",2533000,)""" ) ) ); + QVERIFY( myCrs21.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Northing at false origin",2533000,)""" ) ) ); QCOMPARE( myCrs21.description(), QString() ); // now fudge in the description node to mimic as though the XML came from a different QGIS install where this CRS was a user-defined CRS with a name @@ -1150,7 +1157,16 @@ void TestQgsCoordinateReferenceSystem::readWriteXml() QVERIFY( myCrs22.readXml( node ) ); QVERIFY( myCrs22.isValid() ); QgsDebugMsg( myCrs22.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ) ); - QCOMPARE( myCrs22.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ), QStringLiteral( R"""(BOUNDCRS[SOURCECRS[PROJCRS["",BASEGEOGCRS["GDA94",DATUM["Geocentric Datum of Australia 1994",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4283]],CONVERSION["unnamed",METHOD["Lambert Conic Conformal (2SP)",ID["EPSG",9802]],PARAMETER["Latitude of 1st standard parallel",-36,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8823]],PARAMETER["Latitude of 2nd standard parallel",-38,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8824]],PARAMETER["Latitude of false origin",-37.5,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8821]],PARAMETER["Longitude of false origin",145.5,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8822]],PARAMETER["Easting at false origin",2533000,LENGTHUNIT["metre",1],ID["EPSG",8826]],PARAMETER["Northing at false origin",2533000,LENGTHUNIT["metre",1],ID["EPSG",8827]]],CS[Cartesian,2],AXIS["easting",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["northing",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]],TARGETCRS[GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]]],ABRIDGEDTRANSFORMATION["Transformation from GDA94 to WGS84",METHOD["Position Vector transformation (geog2D domain)",ID["EPSG",9606]],PARAMETER["X-axis translation",1,ID["EPSG",8605]],PARAMETER["Y-axis translation",2,ID["EPSG",8606]],PARAMETER["Z-axis translation",3,ID["EPSG",8607]],PARAMETER["X-axis rotation",4,ID["EPSG",8608]],PARAMETER["Y-axis rotation",5,ID["EPSG",8609]],PARAMETER["Z-axis rotation",16,ID["EPSG",8610]],PARAMETER["Scale difference",1.000017,ID["EPSG",8611]]]])""" ) ); + + QVERIFY( myCrs22.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(BOUNDCRS[SOURCECRS[PROJCRS["")""" ) ) ); + QVERIFY( myCrs22.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["X-axis translation",1,ID["EPSG",8605]],PARAMETER["Y-axis translation",2,ID["EPSG",8606]],PARAMETER["Z-axis translation",3,ID["EPSG",8607]],PARAMETER["X-axis rotation",4,ID["EPSG",8608]],PARAMETER["Y-axis rotation",5,ID["EPSG",8609]],PARAMETER["Z-axis rotation",16,ID["EPSG",8610]])""" ) ) ); + QVERIFY( myCrs22.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Latitude of 1st standard parallel",-36,)""" ) ) ); + QVERIFY( myCrs22.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Latitude of 2nd standard parallel",-38,)""" ) ) ); + QVERIFY( myCrs22.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Latitude of false origin",-37.5,)""" ) ) ); + QVERIFY( myCrs22.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Longitude of false origin",145.5,)""" ) ) ); + QVERIFY( myCrs22.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Easting at false origin",2533000,)""" ) ) ); + QVERIFY( myCrs22.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Northing at false origin",2533000,)""" ) ) ); + // description should be restored, even though it's not a user-defined CRS on this install... QCOMPARE( myCrs22.description(), QStringLiteral( "someone else's previously saved CRS" ) ); @@ -1167,7 +1183,17 @@ void TestQgsCoordinateReferenceSystem::readWriteXml() QVERIFY( myCrs21b.readXml( node ) ); QVERIFY( myCrs21b.isValid() ); QgsDebugMsg( myCrs21b.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ) ); - QCOMPARE( myCrs21b.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ), QStringLiteral( R"""(PROJCRS["",BASEGEOGCRS["unknown",DATUM["Unknown based on WGS84 ellipsoid",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1],ID["EPSG",7030]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Hotine Oblique Mercator (variant B)",ID["EPSG",9815]],PARAMETER["Latitude of projection centre",47.173836897,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8811]],PARAMETER["Longitude of projection centre",8.4550705414,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8812]],PARAMETER["Azimuth of initial line",39.3,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8813]],PARAMETER["Angle from Rectified to Skew Grid",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8814]],PARAMETER["Scale factor on initial line",1,SCALEUNIT["unity",1],ID["EPSG",8815]],PARAMETER["Easting at projection centre",750,LENGTHUNIT["metre",1],ID["EPSG",8816]],PARAMETER["Northing at projection centre",250,LENGTHUNIT["metre",1],ID["EPSG",8817]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]])""" ) ); + QVERIFY( myCrs21b.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PROJCRS["",)""" ) ) ); + QVERIFY( myCrs21b.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(BASEGEOGCRS["unknown",DATUM["Unknown based on WGS84 ellipsoid",)""" ) ) ); + QVERIFY( myCrs21b.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(CONVERSION["unknown")""" ) ) ); + QVERIFY( myCrs21b.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(METHOD["Hotine Oblique Mercator (variant B)",)""" ) ) ); + QVERIFY( myCrs21b.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Latitude of projection centre",47.173836897)""" ) ) ); + QVERIFY( myCrs21b.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Longitude of projection centre",8.4550705414,)""" ) ) ); + QVERIFY( myCrs21b.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Azimuth of initial line",39.3,)""" ) ) ); + QVERIFY( myCrs21b.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Angle from Rectified to Skew Grid",0,)""" ) ) ); + QVERIFY( myCrs21b.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Scale factor on initial line",1,)""" ) ) ); + QVERIFY( myCrs21b.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Easting at projection centre",750,)""" ) ) ); + QVERIFY( myCrs21b.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Northing at projection centre",250,)""" ) ) ); QCOMPARE( myCrs21b.description(), QStringLiteral( "a new CRS" ) ); // a different WKT string, which doesn't match any CRS previously used this session, and which includes a name in the WKT but which should be overridden with the user set name @@ -1183,7 +1209,18 @@ void TestQgsCoordinateReferenceSystem::readWriteXml() QVERIFY( myCrs21c.readXml( node ) ); QVERIFY( myCrs21c.isValid() ); QgsDebugMsg( myCrs21c.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ) ); - QCOMPARE( myCrs21c.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ), QStringLiteral( R"""(PROJCRS["XXYYZZ",BASEGEOGCRS["unknown",DATUM["Unknown based on WGS84 ellipsoid",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1],ID["EPSG",7030]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Hotine Oblique Mercator (variant B)",ID["EPSG",9815]],PARAMETER["Latitude of projection centre",47.2,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8811]],PARAMETER["Longitude of projection centre",8.4550705414,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8812]],PARAMETER["Azimuth of initial line",39.3,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8813]],PARAMETER["Angle from Rectified to Skew Grid",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8814]],PARAMETER["Scale factor on initial line",1,SCALEUNIT["unity",1],ID["EPSG",8815]],PARAMETER["Easting at projection centre",750,LENGTHUNIT["metre",1],ID["EPSG",8816]],PARAMETER["Northing at projection centre",250,LENGTHUNIT["metre",1],ID["EPSG",8817]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]])""" ) ); + + QVERIFY( myCrs21c.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PROJCRS["XXYYZZ",)""" ) ) ); + QVERIFY( myCrs21c.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(BASEGEOGCRS["unknown",DATUM["Unknown based on WGS84 ellipsoid",)""" ) ) ); + QVERIFY( myCrs21c.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(CONVERSION["unknown")""" ) ) ); + QVERIFY( myCrs21c.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(METHOD["Hotine Oblique Mercator (variant B)",)""" ) ) ); + QVERIFY( myCrs21c.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Latitude of projection centre",47.2)""" ) ) ); + QVERIFY( myCrs21c.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Longitude of projection centre",8.4550705414,)""" ) ) ); + QVERIFY( myCrs21c.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Azimuth of initial line",39.3,)""" ) ) ); + QVERIFY( myCrs21c.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Angle from Rectified to Skew Grid",0,)""" ) ) ); + QVERIFY( myCrs21c.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Scale factor on initial line",1,)""" ) ) ); + QVERIFY( myCrs21c.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Easting at projection centre",750,)""" ) ) ); + QVERIFY( myCrs21c.toWkt( QgsCoordinateReferenceSystem::WKT2_2019 ).contains( QLatin1String( R"""(PARAMETER["Northing at projection centre",250,)""" ) ) ); QCOMPARE( myCrs21c.description(), QStringLiteral( "a new CRS C" ) ); #endif } From 1ac59415ec68007dbaee2940e4ec3f99f918dd3c Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 13 Oct 2020 11:29:41 +1000 Subject: [PATCH 45/48] Cleanup handling of margins in QgsCodeEditor and subclasses --- python/console/console_sci.py | 8 +-- .../codeeditors/qgscodeeditor.sip.in | 43 ++++++++++++++-- src/gui/codeeditors/qgscodeeditor.cpp | 50 +++++++++++++++---- src/gui/codeeditors/qgscodeeditor.h | 46 +++++++++++++++-- src/gui/codeeditors/qgscodeeditorcss.cpp | 1 - .../codeeditors/qgscodeeditorexpression.cpp | 1 - src/gui/codeeditors/qgscodeeditorhtml.cpp | 1 - src/gui/codeeditors/qgscodeeditorjs.cpp | 1 - src/gui/codeeditors/qgscodeeditorpython.cpp | 5 +- src/gui/codeeditors/qgscodeeditorsql.cpp | 1 - src/gui/qgsexpressionbuilderwidget.cpp | 3 +- 11 files changed, 129 insertions(+), 31 deletions(-) diff --git a/python/console/console_sci.py b/python/console/console_sci.py index 2ab84d203ed6..e7faa88ecb3f 100644 --- a/python/console/console_sci.py +++ b/python/console/console_sci.py @@ -33,6 +33,8 @@ import traceback from qgis.core import QgsApplication, QgsSettings, Qgis +from qgis.gui import QgsCodeEditor + from .ui_console_history_dlg import Ui_HistoryDialogPythonConsole _init_commands = ["import sys", "import os", "import re", "import math", "from qgis.core import *", @@ -119,10 +121,8 @@ def refreshSettingsShell(self): self._setMinimumHeight() self.setCaretLineVisible(False) - self.setMarginLineNumbers(0, False) # NO linenumbers for the input line - self.setMarginWidth(0, 0) - # margin 2 is the folding - self.setMarginWidth(2, 0) + self.setLineNumbersVisible(False) # NO linenumbers for the input line + self.setMarginWidth(QgsCodeEditor.FoldingControls, 0) # Margin 1 is used for the '>>>' prompt (console input) self.setMarginLineNumbers(1, True) self.setMarginWidth(1, "00000") diff --git a/python/gui/auto_generated/codeeditors/qgscodeeditor.sip.in b/python/gui/auto_generated/codeeditors/qgscodeeditor.sip.in index 05afe50601f0..8c7d7aeaf9c0 100644 --- a/python/gui/auto_generated/codeeditors/qgscodeeditor.sip.in +++ b/python/gui/auto_generated/codeeditors/qgscodeeditor.sip.in @@ -30,6 +30,13 @@ A text editor based on QScintilla2. %End public: + enum MarginRole + { + LineNumbers, + ErrorIndicators, + FoldingControls, + }; + QgsCodeEditor( QWidget *parent /TransferThis/ = 0, const QString &title = QString(), bool folding = false, bool margin = false ); %Docstring Construct a new code editor. @@ -37,7 +44,7 @@ Construct a new code editor. :param parent: The parent QWidget :param title: The title to show in the code editor dialog :param folding: ``False``: Enable folding for code editor -:param margin: ``False``: Enable margin for code editor +:param margin: ``False``: Enable margin for code editor (deprecated) .. versionadded:: 2.6 %End @@ -49,13 +56,43 @@ Set the widget title :param title: widget title %End - void setMarginVisible( bool margin ); + void setMarginVisible( bool margin ) /Deprecated/; %Docstring Set margin visible state :param margin: Set margin in the editor + +.. deprecated:: + Use base class methods for individual margins instead, or setLineNumbersVisible() +%End + + bool marginVisible() /Deprecated/; +%Docstring +Returns whether margins are in a visible state + +.. deprecated:: + Use base class methods for individual margins instead, or lineNumbersVisible() +%End + + void setLineNumbersVisible( bool visible ); +%Docstring +Sets whether line numbers should be visible in the editor. + +Defaults to ``False``. + +.. seealso:: :py:func:`lineNumbersVisible` + +.. versionadded:: 3.16 +%End + + bool lineNumbersVisible() const; +%Docstring +Returns whether line numbers are visible in the editor. + +.. seealso:: :py:func:`setLineNumbersVisible` + +.. versionadded:: 3.16 %End - bool marginVisible(); void setFoldingVisible( bool folding ); %Docstring diff --git a/src/gui/codeeditors/qgscodeeditor.cpp b/src/gui/codeeditors/qgscodeeditor.cpp index 9797765f4fe6..96c15e07c479 100644 --- a/src/gui/codeeditors/qgscodeeditor.cpp +++ b/src/gui/codeeditors/qgscodeeditor.cpp @@ -90,9 +90,9 @@ QgsCodeEditor::QgsCodeEditor( QWidget *parent, const QString &title, bool foldin SendScintilla( SCI_SETMULTIPASTE, 1 ); SendScintilla( SCI_SETVIRTUALSPACEOPTIONS, SCVS_RECTANGULARSELECTION ); - SendScintilla( SCI_SETMARGINTYPEN, 3, SC_MARGIN_SYMBOL ); - SendScintilla( SCI_SETMARGINMASKN, 3, 1 << MARKER_NUMBER ); - setMarginWidth( 3, 0 ); + SendScintilla( SCI_SETMARGINTYPEN, QgsCodeEditor::MarginRole::ErrorIndicators, SC_MARGIN_SYMBOL ); + SendScintilla( SCI_SETMARGINMASKN, QgsCodeEditor::MarginRole::ErrorIndicators, 1 << MARKER_NUMBER ); + setMarginWidth( QgsCodeEditor::MarginRole::ErrorIndicators, 0 ); setAnnotationDisplay( QsciScintilla::AnnotationBoxed ); connect( QgsGui::instance(), &QgsGui::optionsChanged, this, [ = ] @@ -228,8 +228,12 @@ void QgsCodeEditor::setSciWidget() setBraceMatching( QsciScintilla::SloppyBraceMatch ); setMatchedBraceForegroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MatchedBraceForeground ) ); setMatchedBraceBackgroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MatchedBraceBackground ) ); - // whether margin will be shown - setMarginVisible( mMargin ); + + setLineNumbersVisible( false ); + + setMarginWidth( QgsCodeEditor::MarginRole::ErrorIndicators, 0 ); + setMarginWidth( QgsCodeEditor::MarginRole::FoldingControls, 0 ); + setMarginsForegroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MarginForeground ) ); setMarginsBackgroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MarginBackground ) ); setIndentationGuidesForegroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MarginForeground ) ); @@ -266,18 +270,42 @@ void QgsCodeEditor::setMarginVisible( bool margin ) marginFont.setPointSize( 10 ); setMarginLineNumbers( 0, true ); setMarginsFont( marginFont ); - setMarginWidth( 0, QStringLiteral( "00000" ) ); + setMarginWidth( QgsCodeEditor::MarginRole::LineNumbers, QStringLiteral( "00000" ) ); + setMarginsForegroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MarginForeground ) ); + setMarginsBackgroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MarginBackground ) ); + } + else + { + setMarginWidth( QgsCodeEditor::MarginRole::LineNumbers, 0 ); + setMarginWidth( QgsCodeEditor::MarginRole::ErrorIndicators, 0 ); + setMarginWidth( QgsCodeEditor::MarginRole::FoldingControls, 0 ); + } +} + +void QgsCodeEditor::setLineNumbersVisible( bool visible ) +{ + if ( visible ) + { + QFont marginFont = lexerFont(); + marginFont.setPointSize( 10 ); + setMarginLineNumbers( QgsCodeEditor::MarginRole::LineNumbers, true ); + setMarginsFont( marginFont ); + setMarginWidth( QgsCodeEditor::MarginRole::LineNumbers, QStringLiteral( "00000" ) ); setMarginsForegroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MarginForeground ) ); setMarginsBackgroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MarginBackground ) ); } else { - setMarginWidth( 0, 0 ); - setMarginWidth( 1, 0 ); - setMarginWidth( 2, 0 ); + setMarginLineNumbers( QgsCodeEditor::MarginRole::LineNumbers, false ); + setMarginWidth( QgsCodeEditor::MarginRole::LineNumbers, 0 ); } } +bool QgsCodeEditor::lineNumbersVisible() const +{ + return marginLineNumbers( QgsCodeEditor::MarginRole::LineNumbers ); +} + void QgsCodeEditor::setFoldingVisible( bool folding ) { mFolding = folding; @@ -457,7 +485,7 @@ void QgsCodeEditor::setCustomAppearance( const QString &scheme, const QMapsetCallTipsVisible( 0 ); setExpectedOutputFormat( QString() ); - mFunctionBuilderHelp->setMarginVisible( false ); + mFunctionBuilderHelp->setLineNumbersVisible( false ); + mFunctionBuilderHelp->setMarginWidth( QgsCodeEditor::MarginRole::FoldingControls, 0 ); mFunctionBuilderHelp->setEdgeMode( QsciScintilla::EdgeNone ); mFunctionBuilderHelp->setEdgeColumn( 0 ); mFunctionBuilderHelp->setReadOnly( true ); From 88726e9d5c31068e9be632ab4ca0bd57946a310d Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 13 Oct 2020 11:31:26 +1000 Subject: [PATCH 46/48] Javascript code editor should show line numbers --- src/gui/codeeditors/qgscodeeditorjs.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/codeeditors/qgscodeeditorjs.cpp b/src/gui/codeeditors/qgscodeeditorjs.cpp index 689346e5e018..fb05616654f8 100644 --- a/src/gui/codeeditors/qgscodeeditorjs.cpp +++ b/src/gui/codeeditors/qgscodeeditorjs.cpp @@ -60,5 +60,6 @@ void QgsCodeEditorJavascript::initializeLexer() lexer->setColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::Identifier ), QsciLexerJavaScript::Identifier ); setLexer( lexer ); + setLineNumbersVisible( true ); runPostLexerConfigurationTasks(); } From 66226f6b6b8acd124c2c553270e8c50c5cd3dc72 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 13 Oct 2020 11:33:10 +1000 Subject: [PATCH 47/48] Use proper method to show line numbers in Virtual Layers SQL editor --- src/providers/virtual/qgsvirtuallayersourceselect.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/providers/virtual/qgsvirtuallayersourceselect.cpp b/src/providers/virtual/qgsvirtuallayersourceselect.cpp index 727ed2c7c9b1..e3cea79c684c 100644 --- a/src/providers/virtual/qgsvirtuallayersourceselect.cpp +++ b/src/providers/virtual/qgsvirtuallayersourceselect.cpp @@ -43,8 +43,7 @@ QgsVirtualLayerSourceSelect::QgsVirtualLayerSourceSelect( QWidget *parent, Qt::W setupUi( this ); setupButtons( buttonBox ); - mQueryEdit->setMarginWidth( 1, QStringLiteral( "000" ) ); - mQueryEdit->setMarginLineNumbers( 1, true ); + mQueryEdit->setLineNumbersVisible( true ); connect( mTestButton, &QAbstractButton::clicked, this, &QgsVirtualLayerSourceSelect::testQuery ); connect( mBrowseCRSBtn, &QAbstractButton::clicked, this, &QgsVirtualLayerSourceSelect::browseCRS ); From 8d3e028d152f0142e3d36493b5b59d84b5a78253 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 13 Oct 2020 11:44:19 +1000 Subject: [PATCH 48/48] Cleanup raw margin manipulation used to hide holding controls, use proper methods --- python/console/console_output.py | 8 ++++--- python/console/console_sci.py | 23 ++++++++++--------- .../codeeditors/qgscodeeditor.sip.in | 10 ++++++-- src/gui/codeeditors/qgscodeeditor.cpp | 6 ++++- src/gui/codeeditors/qgscodeeditor.h | 9 ++++++-- src/gui/codeeditors/qgscodeeditorpython.cpp | 6 ----- src/gui/qgsexpressionbuilderwidget.cpp | 2 +- 7 files changed, 38 insertions(+), 26 deletions(-) diff --git a/python/console/console_output.py b/python/console/console_output.py index 7624e6ffd8fb..a85e3961e897 100644 --- a/python/console/console_output.py +++ b/python/console/console_output.py @@ -149,6 +149,11 @@ def insertInitText(self): else: self.setText(txtInit + '\n') + def initializeLexer(self): + super().initializeLexer() + self.setFoldingVisible(False) + self.setEdgeMode(QsciScintilla.EdgeNone) + def refreshSettingsOutput(self): # Set Python lexer self.initializeLexer() @@ -156,9 +161,6 @@ def refreshSettingsOutput(self): self.setCaretWidth(0) # NO (blinking) caret in the output - self.setFoldingVisible(False) - self.setEdgeMode(QsciScintilla.EdgeNone) - def clearConsole(self): self.setText('') self.insertInitText() diff --git a/python/console/console_sci.py b/python/console/console_sci.py index e7faa88ecb3f..c0a2d8c9a4fc 100644 --- a/python/console/console_sci.py +++ b/python/console/console_sci.py @@ -107,6 +107,18 @@ def __init__(self, parent=None): self.newShortcutCAS.activated.connect(self.autoComplete) self.newShortcutCSS.activated.connect(self.showHistory) + def initializeLexer(self): + super().initializeLexer() + self.setCaretLineVisible(False) + self.setLineNumbersVisible(False) # NO linenumbers for the input line + self.setFoldingVisible(False) + # Margin 1 is used for the '>>>' prompt (console input) + self.setMarginLineNumbers(1, True) + self.setMarginWidth(1, "00000") + self.setMarginType(1, 5) # TextMarginRightJustified=5 + self.setMarginsBackgroundColor(self.color(QgsCodeEditorColorScheme.ColorRole.Background)) + self.setEdgeMode(QsciScintilla.EdgeNone) + def _setMinimumHeight(self): font = self.lexer().defaultFont(0) fm = QFontMetrics(font) @@ -120,17 +132,6 @@ def refreshSettingsShell(self): # Sets minimum height for input area based of font metric self._setMinimumHeight() - self.setCaretLineVisible(False) - self.setLineNumbersVisible(False) # NO linenumbers for the input line - self.setMarginWidth(QgsCodeEditor.FoldingControls, 0) - # Margin 1 is used for the '>>>' prompt (console input) - self.setMarginLineNumbers(1, True) - self.setMarginWidth(1, "00000") - self.setMarginType(1, 5) # TextMarginRightJustified=5 - self.setMarginsBackgroundColor(self.color(QgsCodeEditorColorScheme.ColorRole.Background)) - self.setFoldingVisible(False) - self.setEdgeMode(QsciScintilla.EdgeNone) - def showHistory(self): if not self.historyDlg.isVisible(): self.historyDlg.show() diff --git a/python/gui/auto_generated/codeeditors/qgscodeeditor.sip.in b/python/gui/auto_generated/codeeditors/qgscodeeditor.sip.in index 8c7d7aeaf9c0..9ea205ce66b7 100644 --- a/python/gui/auto_generated/codeeditors/qgscodeeditor.sip.in +++ b/python/gui/auto_generated/codeeditors/qgscodeeditor.sip.in @@ -96,11 +96,17 @@ Returns whether line numbers are visible in the editor. void setFoldingVisible( bool folding ); %Docstring -Set folding visible state +Set whether the folding controls are visible in the editor. -:param folding: Set folding in the editor +.. seealso:: :py:func:`foldingVisible` %End + bool foldingVisible(); +%Docstring +Returns ``True`` if the folding controls are visible in the editor. + +.. seealso:: :py:func:`setFoldingVisible` +%End void insertText( const QString &text ); %Docstring diff --git a/src/gui/codeeditors/qgscodeeditor.cpp b/src/gui/codeeditors/qgscodeeditor.cpp index 96c15e07c479..c74b84dc5caa 100644 --- a/src/gui/codeeditors/qgscodeeditor.cpp +++ b/src/gui/codeeditors/qgscodeeditor.cpp @@ -230,9 +230,9 @@ void QgsCodeEditor::setSciWidget() setMatchedBraceBackgroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MatchedBraceBackground ) ); setLineNumbersVisible( false ); + setFoldingVisible( false ); setMarginWidth( QgsCodeEditor::MarginRole::ErrorIndicators, 0 ); - setMarginWidth( QgsCodeEditor::MarginRole::FoldingControls, 0 ); setMarginsForegroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MarginForeground ) ); setMarginsBackgroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MarginBackground ) ); @@ -311,11 +311,15 @@ void QgsCodeEditor::setFoldingVisible( bool folding ) mFolding = folding; if ( folding ) { + setMarginWidth( QgsCodeEditor::MarginRole::FoldingControls, "0" ); + setMarginsForegroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MarginForeground ) ); + setMarginsBackgroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MarginBackground ) ); setFolding( QsciScintilla::PlainFoldStyle ); } else { setFolding( QsciScintilla::NoFoldStyle ); + setMarginWidth( QgsCodeEditor::MarginRole::FoldingControls, 0 ); } } diff --git a/src/gui/codeeditors/qgscodeeditor.h b/src/gui/codeeditors/qgscodeeditor.h index c8a2c18e82a9..0a34ce9b153c 100644 --- a/src/gui/codeeditors/qgscodeeditor.h +++ b/src/gui/codeeditors/qgscodeeditor.h @@ -107,10 +107,15 @@ class GUI_EXPORT QgsCodeEditor : public QsciScintilla bool lineNumbersVisible() const; /** - * Set folding visible state - * \param folding Set folding in the editor + * Set whether the folding controls are visible in the editor. + * \see foldingVisible() */ void setFoldingVisible( bool folding ); + + /** + * Returns TRUE if the folding controls are visible in the editor. + * \see setFoldingVisible() + */ bool foldingVisible() { return mFolding; } /** diff --git a/src/gui/codeeditors/qgscodeeditorpython.cpp b/src/gui/codeeditors/qgscodeeditorpython.cpp index 8045ba4b8930..0e3be4198dec 100644 --- a/src/gui/codeeditors/qgscodeeditorpython.cpp +++ b/src/gui/codeeditors/qgscodeeditorpython.cpp @@ -169,12 +169,6 @@ void QgsCodeEditorPython::initializeLexer() } setLineNumbersVisible( true ); - - // Margin 2 is used for the 'folding' - setMarginWidth( QgsCodeEditor::MarginRole::FoldingControls, "0" ); - setMarginsForegroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MarginForeground ) ); - setMarginsBackgroundColor( lexerColor( QgsCodeEditorColorScheme::ColorRole::MarginBackground ) ); - setFoldingVisible( true ); setIndentationsUseTabs( false ); setIndentationGuides( true ); diff --git a/src/gui/qgsexpressionbuilderwidget.cpp b/src/gui/qgsexpressionbuilderwidget.cpp index 5fd472a064ad..8be5d6131574 100644 --- a/src/gui/qgsexpressionbuilderwidget.cpp +++ b/src/gui/qgsexpressionbuilderwidget.cpp @@ -203,7 +203,7 @@ QgsExpressionBuilderWidget::QgsExpressionBuilderWidget( QWidget *parent ) setExpectedOutputFormat( QString() ); mFunctionBuilderHelp->setLineNumbersVisible( false ); - mFunctionBuilderHelp->setMarginWidth( QgsCodeEditor::MarginRole::FoldingControls, 0 ); + mFunctionBuilderHelp->setFoldingVisible( false ); mFunctionBuilderHelp->setEdgeMode( QsciScintilla::EdgeNone ); mFunctionBuilderHelp->setEdgeColumn( 0 ); mFunctionBuilderHelp->setReadOnly( true );