diff --git a/src/analysis/vector/geometry_checker/qgsgeometryareacheck.cpp b/src/analysis/vector/geometry_checker/qgsgeometryareacheck.cpp index 38a89c2951c..60ba7088565 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometryareacheck.cpp +++ b/src/analysis/vector/geometry_checker/qgsgeometryareacheck.cpp @@ -173,7 +173,7 @@ bool QgsGeometryAreaCheck::mergeWithNeighbor( const QString &layerId, QgsFeature if ( !matchFound && maxVal == 0. ) { - return method == MergeIdenticalAttribute ? true : false; + return method == MergeIdenticalAttribute; } // Merge geometries diff --git a/src/analysis/vector/geometry_checker/qgsgeometrycheck.cpp b/src/analysis/vector/geometry_checker/qgsgeometrycheck.cpp index 56803fc236c..57a75999008 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrycheck.cpp +++ b/src/analysis/vector/geometry_checker/qgsgeometrycheck.cpp @@ -97,7 +97,7 @@ bool QgsGeometryCheckError::handleChanges( const QgsGeometryCheck::Changes &chan // If the check is checking the feature at geometry nodes level, the // error almost certainly invalid after a geometry change. In the other // cases, it might likely still be valid. - return mCheck->getCheckType() == QgsGeometryCheck::FeatureNodeCheck ? false : true; + return mCheck->getCheckType() != QgsGeometryCheck::FeatureNodeCheck; } } else if ( change.what == QgsGeometryCheck::ChangePart ) diff --git a/src/analysis/vector/geometry_checker/qgsgeometrypointcoveredbylinecheck.cpp b/src/analysis/vector/geometry_checker/qgsgeometrypointcoveredbylinecheck.cpp index 7ffb4401346..89c3d23359f 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrypointcoveredbylinecheck.cpp +++ b/src/analysis/vector/geometry_checker/qgsgeometrypointcoveredbylinecheck.cpp @@ -53,12 +53,12 @@ void QgsGeometryPointCoveredByLineCheck::collectErrors( QList%3%4
%5
%6" ).arg( textSize ).arg( titleSize ) .arg( index.data( QgsWelcomePageItemsModel::TitleRole ).toString(), - index.data( QgsWelcomePageItemsModel::PinRole ).toBool() == true ? QStringLiteral( "" ) : QString(), + index.data( QgsWelcomePageItemsModel::PinRole ).toBool() ? QStringLiteral( "" ) : QString(), index.data( QgsWelcomePageItemsModel::NativePathRole ).toString(), index.data( QgsWelcomePageItemsModel::CrsRole ).toString() ) ); doc.setTextWidth( option.rect.width() - ( !icon.isNull() ? icon.width() + 35 : 35 ) ); @@ -114,7 +114,7 @@ QSize QgsWelcomePageItemDelegate::sizeHint( const QStyleOptionViewItem &option, doc.setHtml( QStringLiteral( "
%3%4
%5
%6
" ).arg( textSize ).arg( titleSize ) .arg( index.data( QgsWelcomePageItemsModel::TitleRole ).toString(), - index.data( QgsWelcomePageItemsModel::PinRole ).toBool() == true ? QStringLiteral( "" ) : QString(), + index.data( QgsWelcomePageItemsModel::PinRole ).toBool() ? QStringLiteral( "" ) : QString(), index.data( QgsWelcomePageItemsModel::NativePathRole ).toString(), index.data( QgsWelcomePageItemsModel::CrsRole ).toString() ) ); doc.setTextWidth( width - ( !icon.isNull() ? icon.width() + 35 : 35 ) ); diff --git a/src/core/pal/rtree.hpp b/src/core/pal/rtree.hpp index fc469846b44..dd215678aa7 100644 --- a/src/core/pal/rtree.hpp +++ b/src/core/pal/rtree.hpp @@ -389,11 +389,7 @@ namespace pal fclose( m_file ); m_file = fopen( a_fileName, "rb" ); - if ( !m_file ) - { - return false; - } - return true; + return m_file != nullptr; } bool OpenWrite( const char *a_fileName ) @@ -402,11 +398,7 @@ namespace pal fclose( m_file ); m_file = fopen( a_fileName, "wb" ); - if ( !m_file ) - { - return false; - } - return true; + return m_file != nullptr; } void Close() diff --git a/src/core/qgsproject.cpp b/src/core/qgsproject.cpp index 2a9f312aa49..463886cee0b 100644 --- a/src/core/qgsproject.cpp +++ b/src/core/qgsproject.cpp @@ -2262,7 +2262,7 @@ QList QgsProject::addMapLayers( QgsVectorLayer *vl = qobject_cast( mlayer ); if ( vl ) { - vl->loadAuxiliaryLayer( *mAuxiliaryStorage.get() ); + vl->loadAuxiliaryLayer( *mAuxiliaryStorage ); } } } diff --git a/src/core/qgsvectorlayerjoinbuffer.cpp b/src/core/qgsvectorlayerjoinbuffer.cpp index 72dc6f66476..d768be8a4dc 100644 --- a/src/core/qgsvectorlayerjoinbuffer.cpp +++ b/src/core/qgsvectorlayerjoinbuffer.cpp @@ -667,8 +667,5 @@ bool QgsVectorLayerJoinBuffer::isAuxiliaryJoin( const QgsVectorLayerJoinInfo &in { const QgsAuxiliaryLayer *al = mLayer->auxiliaryLayer(); - if ( al && al->id() == info.joinLayerId() ) - return true; - else - return false; + return al && al->id() == info.joinLayerId(); } diff --git a/src/gui/qgsmetadatawidget.cpp b/src/gui/qgsmetadatawidget.cpp index b6ca7b4389d..571476bef54 100644 --- a/src/gui/qgsmetadatawidget.cpp +++ b/src/gui/qgsmetadatawidget.cpp @@ -508,7 +508,7 @@ bool QgsMetadataWidget::checkMetadata() const bool results = validator.validate( metadata, validationResults ); QString errors; - if ( results == false ) + if ( !results ) { for ( const QgsMetadataValidator::ValidationResult &result : qgis::as_const( validationResults ) ) { diff --git a/src/plugins/topology/topolTest.cpp b/src/plugins/topology/topolTest.cpp index adafa681e07..c7ae7f1703e 100644 --- a/src/plugins/topology/topolTest.cpp +++ b/src/plugins/topology/topolTest.cpp @@ -1732,14 +1732,7 @@ ErrorList topolTest::runTest( const QString &testName, QgsVectorLayer *layer1, Q //call test routine bool isValidatingExtent; - if ( type == ValidateExtent ) - { - isValidatingExtent = true; - } - else - { - isValidatingExtent = false; - } + isValidatingExtent = type == ValidateExtent; return ( this->*( mTopologyRuleMap[testName].f ) )( tolerance, layer1, layer2, isValidatingExtent ); } diff --git a/src/providers/arcgisrest/qgsamsprovider.cpp b/src/providers/arcgisrest/qgsamsprovider.cpp index 74da09b6f9a..a1039182ed8 100644 --- a/src/providers/arcgisrest/qgsamsprovider.cpp +++ b/src/providers/arcgisrest/qgsamsprovider.cpp @@ -347,7 +347,6 @@ void QgsAmsProvider::draw( const QgsRectangle &viewExtent, int pixelWidth, int p mCachedImage = mCachedImage.convertToFormat( QImage::Format_ARGB32 ); } } - return; } QImage QgsAmsProvider::getLegendGraphic( double /*scale*/, bool forceRefresh, const QgsRectangle * /*visibleExtent*/ ) diff --git a/src/providers/grass/qgsgrassvectormap.cpp b/src/providers/grass/qgsgrassvectormap.cpp index 7f5e612cbba..17781805841 100644 --- a/src/providers/grass/qgsgrassvectormap.cpp +++ b/src/providers/grass/qgsgrassvectormap.cpp @@ -103,7 +103,6 @@ void QgsGrassVectorMap::close() closeMap(); mOpen = false; unlockOpenClose(); - return; } bool QgsGrassVectorMap::openMap() diff --git a/src/providers/grass/qgsgrassvectormaplayer.cpp b/src/providers/grass/qgsgrassvectormaplayer.cpp index ce0fda76981..5b395a80ebf 100644 --- a/src/providers/grass/qgsgrassvectormaplayer.cpp +++ b/src/providers/grass/qgsgrassvectormaplayer.cpp @@ -548,8 +548,7 @@ void QgsGrassVectorMapLayer::executeSql( const QString &sql, QString &error ) QgsDebugMsg( error ); } - db_free_string( &dbstr ); //if ( index < 0 || index > ) - return; + db_free_string( &dbstr ); } void QgsGrassVectorMapLayer::createTable( const QgsFields &fields, QString &error ) diff --git a/src/providers/wfs/qgswfsprovider.cpp b/src/providers/wfs/qgswfsprovider.cpp index e088ed7a1d6..7e32c2abb82 100644 --- a/src/providers/wfs/qgswfsprovider.cpp +++ b/src/providers/wfs/qgswfsprovider.cpp @@ -1484,14 +1484,7 @@ bool QgsWFSProvider::transactionSuccess( const QDomDocument &serverResponse ) co return false; } - if ( statusList.at( 0 ).firstChildElement().localName() == QLatin1String( "SUCCESS" ) ) - { - return true; - } - else - { - return false; - } + return statusList.at( 0 ).firstChildElement().localName() == QLatin1String( "SUCCESS" ); } QStringList QgsWFSProvider::insertedFeatureIds( const QDomDocument &serverResponse ) const diff --git a/src/server/qgsserverprojectutils.cpp b/src/server/qgsserverprojectutils.cpp index 37d83b7d8e0..9ec7ca1facd 100644 --- a/src/server/qgsserverprojectutils.cpp +++ b/src/server/qgsserverprojectutils.cpp @@ -114,36 +114,24 @@ bool QgsServerProjectUtils::wmsInfoFormatSia2045( const QgsProject &project ) { QString sia2045 = project.readEntry( QStringLiteral( "WMSInfoFormatSIA2045" ), QStringLiteral( "/" ), "" ); - if ( sia2045.compare( QLatin1String( "enabled" ), Qt::CaseInsensitive ) == 0 - || sia2045.compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0 ) - { - return true; - } - return false; + return sia2045.compare( QLatin1String( "enabled" ), Qt::CaseInsensitive ) == 0 + || sia2045.compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0; } bool QgsServerProjectUtils::wmsFeatureInfoAddWktGeometry( const QgsProject &project ) { QString wktGeom = project.readEntry( QStringLiteral( "WMSAddWktGeometry" ), QStringLiteral( "/" ), "" ); - if ( wktGeom.compare( QLatin1String( "enabled" ), Qt::CaseInsensitive ) == 0 - || wktGeom.compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0 ) - { - return true; - } - return false; + return wktGeom.compare( QLatin1String( "enabled" ), Qt::CaseInsensitive ) == 0 + || wktGeom.compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0; } bool QgsServerProjectUtils::wmsFeatureInfoSegmentizeWktGeometry( const QgsProject &project ) { QString segmGeom = project.readEntry( QStringLiteral( "WMSSegmentizeFeatureInfoGeometry" ), QStringLiteral( "/" ), "" ); - if ( segmGeom.compare( QLatin1String( "enabled" ), Qt::CaseInsensitive ) == 0 - || segmGeom.compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0 ) - { - return true; - } - return false; + return segmGeom.compare( QLatin1String( "enabled" ), Qt::CaseInsensitive ) == 0 + || segmGeom.compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0; } int QgsServerProjectUtils::wmsFeatureInfoPrecision( const QgsProject &project ) diff --git a/src/server/services/wms/qgswmsrenderer.cpp b/src/server/services/wms/qgswmsrenderer.cpp index 913e68266e2..3ffdc52ef73 100644 --- a/src/server/services/wms/qgswmsrenderer.cpp +++ b/src/server/services/wms/qgswmsrenderer.cpp @@ -317,7 +317,7 @@ namespace QgsWms removeUnwantedLayers( layers ); // configure each layer with opacity, selection filter, ... - bool updateMapExtent = mWmsParameters.bbox().isEmpty() ? true : false; + bool updateMapExtent = mWmsParameters.bbox().isEmpty(); Q_FOREACH ( QgsMapLayer *layer, layers ) { Q_FOREACH ( QgsWmsParametersLayer param, params ) @@ -720,7 +720,7 @@ namespace QgsWms removeUnwantedLayers( layers ); // configure each layer with opacity, selection filter, ... - bool updateMapExtent = mWmsParameters.bbox().isEmpty() ? true : false; + bool updateMapExtent = mWmsParameters.bbox().isEmpty(); Q_FOREACH ( QgsMapLayer *layer, layers ) { Q_FOREACH ( QgsWmsParametersLayer param, params ) @@ -760,7 +760,7 @@ namespace QgsWms mapSettings.setLayers( layers ); // rendering step for layers - painter.reset( layersRendering( mapSettings, *image.get(), hitTest ) ); + painter.reset( layersRendering( mapSettings, *image, hitTest ) ); // rendering step for annotations annotationsRendering( painter.get() ); diff --git a/tests/src/analysis/testqgsprocessing.cpp b/tests/src/analysis/testqgsprocessing.cpp index 683a54f7a93..efc1faa822c 100644 --- a/tests/src/analysis/testqgsprocessing.cpp +++ b/tests/src/analysis/testqgsprocessing.cpp @@ -1173,7 +1173,7 @@ void TestQgsProcessing::createIndex() // disable selected features check std::unique_ptr< QgsFeatureSource > source( QgsProcessingParameters::parameterAsSource( def.get(), params, context ) ); QVERIFY( source.get() ); - QgsSpatialIndex index( *source.get() ); + QgsSpatialIndex index( *source ); QList ids = index.nearestNeighbor( QgsPointXY( 2.1, 2 ), 1 ); QCOMPARE( ids, QList() << 2 ); @@ -1183,7 +1183,7 @@ void TestQgsProcessing::createIndex() bool caught = false; try { - index = QgsSpatialIndex( *source.get() ); + index = QgsSpatialIndex( *source ); ids = index.nearestNeighbor( QgsPointXY( 2.1, 2 ), 1 ); } catch ( ... ) @@ -1195,14 +1195,14 @@ void TestQgsProcessing::createIndex() // create selection layer->selectByIds( QgsFeatureIds() << 4 << 5 ); source.reset( QgsProcessingParameters::parameterAsSource( def.get(), params, context ) ); - index = QgsSpatialIndex( *source.get() ); + index = QgsSpatialIndex( *source ); ids = index.nearestNeighbor( QgsPointXY( 2.1, 2 ), 1 ); QCOMPARE( ids, QList() << 4 ); // selection but not using selection mode params.insert( QStringLiteral( "layer" ), QVariant::fromValue( QgsProcessingFeatureSourceDefinition( layer->id(), false ) ) ); source.reset( QgsProcessingParameters::parameterAsSource( def.get(), params, context ) ); - index = QgsSpatialIndex( *source.get() ); + index = QgsSpatialIndex( *source ); ids = index.nearestNeighbor( QgsPointXY( 2.1, 2 ), 1 ); QCOMPARE( ids, QList() << 2 ); } diff --git a/tests/src/core/testqgsauthmanager.cpp b/tests/src/core/testqgsauthmanager.cpp index 5dd47d81119..6df5c70f2cf 100644 --- a/tests/src/core/testqgsauthmanager.cpp +++ b/tests/src/core/testqgsauthmanager.cpp @@ -209,7 +209,7 @@ void TestQgsAuthManager::testMasterPassword() QCOMPARE( spy.count(), 1 ); spyargs = spy.takeFirst(); QVERIFY( spyargs.at( 0 ).type() == QVariant::Bool ); - QVERIFY( spyargs.at( 0 ).toBool() == true ); + QVERIFY( spyargs.at( 0 ).toBool() ); authm->clearMasterPassword(); QVERIFY( !authm->masterPasswordIsSet() ); @@ -218,7 +218,7 @@ void TestQgsAuthManager::testMasterPassword() QCOMPARE( spy.count(), 1 ); spyargs = spy.takeFirst(); QVERIFY( spyargs.at( 0 ).type() == QVariant::Bool ); - QVERIFY( spyargs.at( 0 ).toBool() == false ); + QVERIFY( !spyargs.at( 0 ).toBool() ); authm->clearMasterPassword(); QVERIFY( !authm->masterPasswordIsSet() ); @@ -227,7 +227,7 @@ void TestQgsAuthManager::testMasterPassword() QCOMPARE( spy.count(), 1 ); spyargs = spy.takeFirst(); QVERIFY( spyargs.at( 0 ).type() == QVariant::Bool ); - QVERIFY( spyargs.at( 0 ).toBool() == true ); + QVERIFY( spyargs.at( 0 ).toBool() ); } void TestQgsAuthManager::testAuthConfigs() diff --git a/tests/src/gui/testqgsrelationreferencewidget.cpp b/tests/src/gui/testqgsrelationreferencewidget.cpp index 6a74e85a764..8541664e876 100644 --- a/tests/src/gui/testqgsrelationreferencewidget.cpp +++ b/tests/src/gui/testqgsrelationreferencewidget.cpp @@ -79,7 +79,7 @@ void TestQgsRelationReferenceWidget::init() mRelation->setReferencedLayer( mLayer2->id() ); mRelation->addFieldPair( QStringLiteral( "fk" ), QStringLiteral( "pk" ) ); QVERIFY( mRelation->isValid() ); - QgsProject::instance()->relationManager()->addRelation( *mRelation.get() ); + QgsProject::instance()->relationManager()->addRelation( *mRelation ); // add features QgsFeature ft0( mLayer1->fields() );