mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Code linting: modify "if ( foo() ) { foo()->bar }"-like constructs
cppcheck sometimes detects this as a potential null pointer dereference. This makes sense, although it is quite unlikely that the return a foo() might change in between. To avoid such warnings, and also repeated method calls which can have some cost, I've run the following refactoring script to store the result of foo() in a local variable. ```shell for i in `find ../src -name "*.cpp"`; do python analyze.py $i > $i.tmp; diff $i.tmp $i >/dev/null || (echo "Paching $i"; mv $i.tmp $i); rm -f $i.tmp; done ``` with analyze.py being ```python import re import sys lines = [l[0:-1] if l[-1] == '\n' else l for l in open(sys.argv[1], "rt").readlines()] if_pattern = re.compile("(^[ ]*)if \( ([a-zA-Z0-9_\.]+)\(\) \)$") i = 0 while i < len(lines): line = lines[i] modified = False m = if_pattern.match(line) if m: next_line = lines[i+1] indent = m.group(1) s = m.group(2) + "()" tmpVar = m.group(2).split('.')[-1] tmpVar = 'l' + tmpVar[0].upper() + tmpVar[1:] if next_line == indent + '{': found = False # Look in the block after the if() for a pattern where we dereference # "foo()" j = i + 1 while lines[j] != indent + '}': if lines[j].find(s + '->') >= 0 or lines[j].find('*' + s) >= 0 or lines[j].find(s + '[') >= 0: found = True break j += 1 if found: print(indent + 'if ( auto *' + tmpVar + ' = ' + s + ' )') j = i + 1 while lines[j] != indent + '}': print(lines[j].replace(' ' + s, ' ' + tmpVar).replace('.' + s, '.' + tmpVar).replace('*' + s, '*' + tmpVar).replace('!' + s, '!' + tmpVar)) j += 1 print(lines[j]) modified = True i = j else: if next_line.find(s) >= 0: print(indent + 'if ( auto *' + tmpVar + ' = ' + s + ' )') print(next_line.replace(' ' + s, ' ' + tmpVar).replace('.' + s, '.' + tmpVar).replace('*' + s, '*' + tmpVar).replace('!' + s, '!' + tmpVar)) modified = True i += 1 if not modified: print(line) i += 1 ```
This commit is contained in:
parent
a3c4fe44ab
commit
44466a3322
@ -4186,10 +4186,10 @@ void QgisApp::setupConnections()
|
||||
{
|
||||
canvas->setCanvasColor( backgroundColor );
|
||||
}
|
||||
if ( mapOverviewCanvas() )
|
||||
if ( auto *lMapOverviewCanvas = mapOverviewCanvas() )
|
||||
{
|
||||
mapOverviewCanvas()->setBackgroundColor( backgroundColor );
|
||||
mapOverviewCanvas()->refresh();
|
||||
lMapOverviewCanvas->setBackgroundColor( backgroundColor );
|
||||
lMapOverviewCanvas->refresh();
|
||||
}
|
||||
} );
|
||||
|
||||
@ -7300,13 +7300,13 @@ void QgisApp::dxfExport()
|
||||
flags = flags | QgsDxfExport::FlagNoMText;
|
||||
dxfExport.setFlags( flags );
|
||||
|
||||
if ( mapCanvas() )
|
||||
if ( auto *lMapCanvas = mapCanvas() )
|
||||
{
|
||||
//extent
|
||||
if ( d.exportMapExtent() )
|
||||
{
|
||||
QgsCoordinateTransform t( mapCanvas()->mapSettings().destinationCrs(), d.crs(), QgsProject::instance() );
|
||||
dxfExport.setExtent( t.transformBoundingBox( mapCanvas()->extent() ) );
|
||||
QgsCoordinateTransform t( lMapCanvas->mapSettings().destinationCrs(), d.crs(), QgsProject::instance() );
|
||||
dxfExport.setExtent( t.transformBoundingBox( lMapCanvas->extent() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -16272,9 +16272,9 @@ void QgisApp::showSystemNotification( const QString &title, const QString &messa
|
||||
if ( !result.successful )
|
||||
{
|
||||
// fallback - use message bar if available, otherwise use a message log
|
||||
if ( messageBar() )
|
||||
if ( auto *lMessageBar = messageBar() )
|
||||
{
|
||||
messageBar()->pushInfo( title, message );
|
||||
lMessageBar->pushInfo( title, message );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -86,11 +86,11 @@ void QgsMapToolOffsetCurve::canvasReleaseEvent( QgsMapMouseEvent *e )
|
||||
QgsPointLocator::Types( QgsPointLocator::Edge | QgsPointLocator::Area ) );
|
||||
}
|
||||
|
||||
if ( match.layer() )
|
||||
if ( auto *lLayer = match.layer() )
|
||||
{
|
||||
mSourceLayer = match.layer();
|
||||
mSourceLayer = lLayer;
|
||||
QgsFeature fet;
|
||||
if ( match.layer()->getFeatures( QgsFeatureRequest( match.featureId() ) ).nextFeature( fet ) )
|
||||
if ( lLayer->getFeatures( QgsFeatureRequest( match.featureId() ) ).nextFeature( fet ) )
|
||||
{
|
||||
mSourceFeature = fet;
|
||||
mCtrlHeldOnFirstClick = ( e->modifiers() & Qt::ControlModifier ); //no geometry modification if ctrl is pressed
|
||||
@ -98,7 +98,7 @@ void QgsMapToolOffsetCurve::canvasReleaseEvent( QgsMapMouseEvent *e )
|
||||
mRubberBand = createRubberBand();
|
||||
if ( mRubberBand )
|
||||
{
|
||||
mRubberBand->setToGeometry( mManipulatedGeometry, match.layer() );
|
||||
mRubberBand->setToGeometry( mManipulatedGeometry, lLayer );
|
||||
}
|
||||
mModifiedFeature = fet.id();
|
||||
createUserInputWidget();
|
||||
|
@ -60,9 +60,9 @@ static bool getPoints( const QgsPointLocator::Match &match, QgsPoint &p1, QgsPoi
|
||||
const QgsFeatureId fid = match.featureId();
|
||||
const int vertex = match.vertexIndex();
|
||||
|
||||
if ( match.layer() )
|
||||
if ( auto *lLayer = match.layer() )
|
||||
{
|
||||
const QgsGeometry geom = match.layer()->getGeometry( fid );
|
||||
const QgsGeometry geom = lLayer->getGeometry( fid );
|
||||
|
||||
if ( !( geom.isNull() || geom.isEmpty() ) )
|
||||
{
|
||||
@ -250,18 +250,18 @@ void QgsMapToolTrimExtendFeature::canvasReleaseEvent( QgsMapMouseEvent *e )
|
||||
filter.setLayer( mVlayer );
|
||||
match = mCanvas->snappingUtils()->snapToMap( mMapPoint, &filter, true );
|
||||
|
||||
if ( match.layer() )
|
||||
if ( auto *lLayer = match.layer() )
|
||||
{
|
||||
|
||||
match.layer()->beginEditCommand( tr( "Trim/Extend feature" ) );
|
||||
match.layer()->changeGeometry( match.featureId(), mGeom );
|
||||
lLayer->beginEditCommand( tr( "Trim/Extend feature" ) );
|
||||
lLayer->changeGeometry( match.featureId(), mGeom );
|
||||
if ( QgsProject::instance()->topologicalEditing() )
|
||||
{
|
||||
match.layer()->addTopologicalPoints( mIntersection );
|
||||
lLayer->addTopologicalPoints( mIntersection );
|
||||
mLimitLayer->addTopologicalPoints( mIntersection );
|
||||
}
|
||||
match.layer()->endEditCommand();
|
||||
match.layer()->triggerRepaint();
|
||||
lLayer->endEditCommand();
|
||||
lLayer->triggerRepaint();
|
||||
|
||||
emit messageEmitted( tr( "Feature trimmed/extended." ) );
|
||||
}
|
||||
|
@ -197,12 +197,12 @@ QList<QgsVectorLayerRef> QgsRelationReferenceFieldFormatter::layerDependencies(
|
||||
QVariantList QgsRelationReferenceFieldFormatter::availableValues( const QVariantMap &config, int countLimit, const QgsFieldFormatterContext &context ) const
|
||||
{
|
||||
QVariantList values;
|
||||
if ( context.project() )
|
||||
if ( auto *lProject = context.project() )
|
||||
{
|
||||
const QgsVectorLayer *referencedLayer = context.project()->relationManager()->relation( config[QStringLiteral( "Relation" )].toString() ).referencedLayer();
|
||||
const QgsVectorLayer *referencedLayer = lProject->relationManager()->relation( config[QStringLiteral( "Relation" )].toString() ).referencedLayer();
|
||||
if ( referencedLayer )
|
||||
{
|
||||
int fieldIndex = context.project()->relationManager()->relation( config[QStringLiteral( "Relation" )].toString() ).referencedFields().first();
|
||||
int fieldIndex = lProject->relationManager()->relation( config[QStringLiteral( "Relation" )].toString() ).referencedFields().first();
|
||||
values = qgis::setToList( referencedLayer->uniqueValues( fieldIndex, countLimit ) );
|
||||
}
|
||||
}
|
||||
|
@ -213,9 +213,9 @@ QVariantList QgsValueRelationFieldFormatter::availableValues( const QVariantMap
|
||||
{
|
||||
QVariantList values;
|
||||
|
||||
if ( context.project() )
|
||||
if ( auto *lProject = context.project() )
|
||||
{
|
||||
const QgsVectorLayer *referencedLayer = qobject_cast<QgsVectorLayer *>( context.project()->mapLayer( config[QStringLiteral( "Layer" )].toString() ) );
|
||||
const QgsVectorLayer *referencedLayer = qobject_cast<QgsVectorLayer *>( lProject->mapLayer( config[QStringLiteral( "Layer" )].toString() ) );
|
||||
if ( referencedLayer )
|
||||
{
|
||||
int fieldIndex = referencedLayer->fields().indexOf( config.value( QStringLiteral( "Key" ) ).toString() );
|
||||
|
@ -417,9 +417,9 @@ QDomElement QgsCurvePolygon::asGml3( QDomDocument &doc, int precision, const QSt
|
||||
json QgsCurvePolygon::asJsonObject( int precision ) const
|
||||
{
|
||||
json coordinates( json::array( ) );
|
||||
if ( exteriorRing() )
|
||||
if ( auto *lExteriorRing = exteriorRing() )
|
||||
{
|
||||
std::unique_ptr< QgsLineString > exteriorLineString( exteriorRing()->curveToLine() );
|
||||
std::unique_ptr< QgsLineString > exteriorLineString( lExteriorRing->curveToLine() );
|
||||
QgsPointSequence exteriorPts;
|
||||
exteriorLineString->points( exteriorPts );
|
||||
coordinates.push_back( QgsGeometryUtils::pointsToJson( exteriorPts, precision ) );
|
||||
|
@ -557,10 +557,10 @@ void QgsVectorLayerLabelProvider::drawLabelPrivate( pal::LabelPosition *label, Q
|
||||
QString txt = lf->text( label->getPartId() );
|
||||
QFontMetricsF *labelfm = lf->labelFontMetrics();
|
||||
|
||||
if ( context.maskIdProvider() )
|
||||
if ( auto *lMaskIdProvider = context.maskIdProvider() )
|
||||
{
|
||||
int maskId = context.maskIdProvider()->maskId( label->getFeaturePart()->layer()->provider()->layerId(),
|
||||
label->getFeaturePart()->layer()->provider()->providerId() );
|
||||
int maskId = lMaskIdProvider->maskId( label->getFeaturePart()->layer()->provider()->layerId(),
|
||||
label->getFeaturePart()->layer()->provider()->providerId() );
|
||||
context.setCurrentMaskId( maskId );
|
||||
}
|
||||
|
||||
|
@ -253,8 +253,8 @@ QgsSymbolLegendNode::QgsSymbolLegendNode( QgsLayerTreeLayer *nodeLayer, const Qg
|
||||
connect( qobject_cast<QgsVectorLayer *>( nodeLayer->layer() ), &QgsVectorLayer::symbolFeatureCountMapChanged, this, &QgsSymbolLegendNode::updateLabel );
|
||||
connect( nodeLayer, &QObject::destroyed, this, [ = ]() { mLayerNode = nullptr; } );
|
||||
|
||||
if ( mItem.symbol() )
|
||||
mSymbolUsesMapUnits = ( mItem.symbol()->outputUnit() != QgsUnitTypes::RenderMillimeters );
|
||||
if ( auto *lSymbol = mItem.symbol() )
|
||||
mSymbolUsesMapUnits = ( lSymbol->outputUnit() != QgsUnitTypes::RenderMillimeters );
|
||||
}
|
||||
|
||||
Qt::ItemFlags QgsSymbolLegendNode::flags() const
|
||||
@ -402,8 +402,8 @@ QgsRenderContext *QgsLayerTreeModelLegendNode::createTemporaryRenderContext() co
|
||||
double scale = 0.0;
|
||||
double mupp = 0.0;
|
||||
int dpi = 0;
|
||||
if ( model() )
|
||||
model()->legendMapViewData( &mupp, &dpi, &scale );
|
||||
if ( auto *lModel = model() )
|
||||
lModel->legendMapViewData( &mupp, &dpi, &scale );
|
||||
|
||||
if ( qgsDoubleNear( mupp, 0.0 ) || dpi == 0 || qgsDoubleNear( scale, 0.0 ) )
|
||||
return nullptr;
|
||||
|
@ -576,8 +576,8 @@ void QgsLayoutItem::setScenePos( const QPointF destinationPos )
|
||||
//since setPos does not account for item rotation, use difference between
|
||||
//current scenePos (which DOES account for rotation) and destination pos
|
||||
//to calculate how much the item needs to move
|
||||
if ( parentItem() )
|
||||
setPos( pos() + ( destinationPos - scenePos() ) + parentItem()->scenePos() );
|
||||
if ( auto *lParentItem = parentItem() )
|
||||
setPos( pos() + ( destinationPos - scenePos() ) + lParentItem->scenePos() );
|
||||
else
|
||||
setPos( pos() + ( destinationPos - scenePos() ) );
|
||||
}
|
||||
|
@ -64,20 +64,20 @@ QIcon QgsLayoutItemMarker::icon() const
|
||||
|
||||
void QgsLayoutItemMarker::refreshSymbol()
|
||||
{
|
||||
if ( layout() )
|
||||
if ( auto *lLayout = layout() )
|
||||
{
|
||||
QgsRenderContext rc = QgsLayoutUtils::createRenderContextForLayout( layout(), nullptr, layout()->renderContext().dpi() );
|
||||
QgsRenderContext rc = QgsLayoutUtils::createRenderContextForLayout( lLayout, nullptr, lLayout->renderContext().dpi() );
|
||||
|
||||
std::unique_ptr< QgsMarkerSymbol > sym( mShapeStyleSymbol->clone() );
|
||||
sym->setAngle( sym->angle() + mNorthArrowRotation );
|
||||
sym->startRender( rc );
|
||||
QRectF bounds = sym->bounds( QPointF( 0, 0 ), rc );
|
||||
sym->stopRender( rc );
|
||||
mPoint = QPointF( -bounds.left() * 25.4 / layout()->renderContext().dpi(),
|
||||
-bounds.top() * 25.4 / layout()->renderContext().dpi() );
|
||||
mPoint = QPointF( -bounds.left() * 25.4 / lLayout->renderContext().dpi(),
|
||||
-bounds.top() * 25.4 / lLayout->renderContext().dpi() );
|
||||
bounds.translate( mPoint );
|
||||
|
||||
QgsLayoutSize newSizeMm = QgsLayoutSize( bounds.size() * 25.4 / layout()->renderContext().dpi(), QgsUnitTypes::LayoutMillimeters );
|
||||
QgsLayoutSize newSizeMm = QgsLayoutSize( bounds.size() * 25.4 / lLayout->renderContext().dpi(), QgsUnitTypes::LayoutMillimeters );
|
||||
mFixedSize = mLayout->renderContext().measurementConverter().convert( newSizeMm, sizeWithUnits().units() );
|
||||
|
||||
attemptResize( mFixedSize );
|
||||
|
@ -80,10 +80,10 @@ void QgsLayoutItemPolygon::createDefaultPolygonStyleSymbol()
|
||||
|
||||
void QgsLayoutItemPolygon::refreshSymbol()
|
||||
{
|
||||
if ( layout() )
|
||||
if ( auto *lLayout = layout() )
|
||||
{
|
||||
QgsRenderContext rc = QgsLayoutUtils::createRenderContextForLayout( layout(), nullptr, layout()->renderContext().dpi() );
|
||||
mMaxSymbolBleed = ( 25.4 / layout()->renderContext().dpi() ) * QgsSymbolLayerUtils::estimateMaxSymbolBleed( mPolygonStyleSymbol.get(), rc );
|
||||
QgsRenderContext rc = QgsLayoutUtils::createRenderContextForLayout( lLayout, nullptr, lLayout->renderContext().dpi() );
|
||||
mMaxSymbolBleed = ( 25.4 / lLayout->renderContext().dpi() ) * QgsSymbolLayerUtils::estimateMaxSymbolBleed( mPolygonStyleSymbol.get(), rc );
|
||||
}
|
||||
|
||||
updateSceneRect();
|
||||
|
@ -109,10 +109,10 @@ void QgsLayoutItemPolyline::createDefaultPolylineStyleSymbol()
|
||||
|
||||
void QgsLayoutItemPolyline::refreshSymbol()
|
||||
{
|
||||
if ( layout() )
|
||||
if ( auto *lLayout = layout() )
|
||||
{
|
||||
QgsRenderContext rc = QgsLayoutUtils::createRenderContextForLayout( layout(), nullptr, layout()->renderContext().dpi() );
|
||||
mMaxSymbolBleed = ( 25.4 / layout()->renderContext().dpi() ) * QgsSymbolLayerUtils::estimateMaxSymbolBleed( mPolylineStyleSymbol.get(), rc );
|
||||
QgsRenderContext rc = QgsLayoutUtils::createRenderContextForLayout( lLayout, nullptr, lLayout->renderContext().dpi() );
|
||||
mMaxSymbolBleed = ( 25.4 / lLayout->renderContext().dpi() ) * QgsSymbolLayerUtils::estimateMaxSymbolBleed( mPolylineStyleSymbol.get(), rc );
|
||||
}
|
||||
|
||||
updateSceneRect();
|
||||
|
@ -119,10 +119,10 @@ void QgsLayoutItemShape::setShapeType( QgsLayoutItemShape::Shape type )
|
||||
|
||||
void QgsLayoutItemShape::refreshSymbol()
|
||||
{
|
||||
if ( layout() )
|
||||
if ( auto *lLayout = layout() )
|
||||
{
|
||||
QgsRenderContext rc = QgsLayoutUtils::createRenderContextForLayout( layout(), nullptr, layout()->renderContext().dpi() );
|
||||
mMaxSymbolBleed = ( 25.4 / layout()->renderContext().dpi() ) * QgsSymbolLayerUtils::estimateMaxSymbolBleed( mShapeStyleSymbol.get(), rc );
|
||||
QgsRenderContext rc = QgsLayoutUtils::createRenderContextForLayout( lLayout, nullptr, lLayout->renderContext().dpi() );
|
||||
mMaxSymbolBleed = ( 25.4 / lLayout->renderContext().dpi() ) * QgsSymbolLayerUtils::estimateMaxSymbolBleed( mShapeStyleSymbol.get(), rc );
|
||||
}
|
||||
|
||||
updateBoundingRect();
|
||||
|
@ -125,12 +125,12 @@ QgsLayout *QgsReportSectionFieldGroup::nextBody( bool &ok )
|
||||
// no features left for this iteration
|
||||
mFeatures = QgsFeatureIterator();
|
||||
|
||||
if ( footer() )
|
||||
if ( auto *lFooter = footer() )
|
||||
{
|
||||
footer()->reportContext().blockSignals( true );
|
||||
footer()->reportContext().setLayer( mCoverageLayer.get() );
|
||||
footer()->reportContext().blockSignals( false );
|
||||
footer()->reportContext().setFeature( mLastFeature );
|
||||
lFooter->reportContext().blockSignals( true );
|
||||
lFooter->reportContext().setLayer( mCoverageLayer.get() );
|
||||
lFooter->reportContext().blockSignals( false );
|
||||
lFooter->reportContext().setFeature( mLastFeature );
|
||||
}
|
||||
ok = false;
|
||||
return nullptr;
|
||||
|
@ -712,8 +712,8 @@ QgsMeshDatasetIndex QgsMeshLayer::staticVectorDatasetIndex() const
|
||||
|
||||
void QgsMeshLayer::setReferenceTime( const QDateTime &referenceTime )
|
||||
{
|
||||
if ( dataProvider() )
|
||||
mTemporalProperties->setReferenceTime( referenceTime, dataProvider()->temporalCapabilities() );
|
||||
if ( auto *lDataProvider = dataProvider() )
|
||||
mTemporalProperties->setReferenceTime( referenceTime, lDataProvider->temporalCapabilities() );
|
||||
else
|
||||
mTemporalProperties->setReferenceTime( referenceTime, nullptr );
|
||||
}
|
||||
|
@ -1293,8 +1293,8 @@ QgsCoordinateReferenceSystem QgsProcessingParameters::parameterAsExtentCrs( cons
|
||||
else if ( QgsMapLayer *layer = QgsProcessingUtils::mapLayerFromString( valueAsString, context ) )
|
||||
return layer->crs();
|
||||
|
||||
if ( context.project() )
|
||||
return context.project()->crs();
|
||||
if ( auto *lProject = context.project() )
|
||||
return lProject->crs();
|
||||
else
|
||||
return QgsCoordinateReferenceSystem();
|
||||
}
|
||||
@ -1411,8 +1411,8 @@ QgsCoordinateReferenceSystem QgsProcessingParameters::parameterAsPointCrs( const
|
||||
return crs;
|
||||
}
|
||||
|
||||
if ( context.project() )
|
||||
return context.project()->crs();
|
||||
if ( auto *lProject = context.project() )
|
||||
return lProject->crs();
|
||||
else
|
||||
return QgsCoordinateReferenceSystem();
|
||||
}
|
||||
@ -1585,8 +1585,8 @@ QgsCoordinateReferenceSystem QgsProcessingParameters::parameterAsGeometryCrs( co
|
||||
return crs;
|
||||
}
|
||||
|
||||
if ( context.project() )
|
||||
return context.project()->crs();
|
||||
if ( auto *lProject = context.project() )
|
||||
return lProject->crs();
|
||||
else
|
||||
return QgsCoordinateReferenceSystem();
|
||||
}
|
||||
@ -5454,9 +5454,9 @@ QgsProcessingOutputDefinition *QgsProcessingParameterFeatureSink::toOutputDefini
|
||||
|
||||
QString QgsProcessingParameterFeatureSink::defaultFileExtension() const
|
||||
{
|
||||
if ( originalProvider() )
|
||||
if ( auto *lOriginalProvider = originalProvider() )
|
||||
{
|
||||
return originalProvider()->defaultVectorFileExtension( hasGeometry() );
|
||||
return lOriginalProvider->defaultVectorFileExtension( hasGeometry() );
|
||||
}
|
||||
else if ( QgsProcessingProvider *p = provider() )
|
||||
{
|
||||
@ -5513,12 +5513,12 @@ QString QgsProcessingParameterFeatureSink::createFileFilter() const
|
||||
|
||||
QStringList QgsProcessingParameterFeatureSink::supportedOutputVectorLayerExtensions() const
|
||||
{
|
||||
if ( originalProvider() )
|
||||
if ( auto *lOriginalProvider = originalProvider() )
|
||||
{
|
||||
if ( hasGeometry() )
|
||||
return originalProvider()->supportedOutputVectorLayerExtensions();
|
||||
return lOriginalProvider->supportedOutputVectorLayerExtensions();
|
||||
else
|
||||
return originalProvider()->supportedOutputTableExtensions();
|
||||
return lOriginalProvider->supportedOutputTableExtensions();
|
||||
}
|
||||
else if ( QgsProcessingProvider *p = provider() )
|
||||
{
|
||||
@ -5700,9 +5700,9 @@ QgsProcessingOutputDefinition *QgsProcessingParameterRasterDestination::toOutput
|
||||
|
||||
QString QgsProcessingParameterRasterDestination::defaultFileExtension() const
|
||||
{
|
||||
if ( originalProvider() )
|
||||
if ( auto *lOriginalProvider = originalProvider() )
|
||||
{
|
||||
return originalProvider()->defaultRasterFileExtension();
|
||||
return lOriginalProvider->defaultRasterFileExtension();
|
||||
}
|
||||
else if ( QgsProcessingProvider *p = provider() )
|
||||
{
|
||||
@ -5727,9 +5727,9 @@ QString QgsProcessingParameterRasterDestination::createFileFilter() const
|
||||
|
||||
QStringList QgsProcessingParameterRasterDestination::supportedOutputRasterLayerExtensions() const
|
||||
{
|
||||
if ( originalProvider() )
|
||||
if ( auto *lOriginalProvider = originalProvider() )
|
||||
{
|
||||
return originalProvider()->supportedOutputRasterLayerExtensions();
|
||||
return lOriginalProvider->supportedOutputRasterLayerExtensions();
|
||||
}
|
||||
else if ( QgsProcessingProvider *p = provider() )
|
||||
{
|
||||
@ -6028,8 +6028,8 @@ QString QgsProcessingDestinationParameter::generateTemporaryDestination() const
|
||||
|
||||
bool QgsProcessingDestinationParameter::isSupportedOutputValue( const QVariant &value, QgsProcessingContext &context, QString &error ) const
|
||||
{
|
||||
if ( originalProvider() )
|
||||
return originalProvider()->isSupportedOutputValue( value, this, context, error );
|
||||
if ( auto *lOriginalProvider = originalProvider() )
|
||||
return lOriginalProvider->isSupportedOutputValue( value, this, context, error );
|
||||
else if ( provider() )
|
||||
return provider()->isSupportedOutputValue( value, this, context, error );
|
||||
|
||||
@ -6152,9 +6152,9 @@ QgsProcessingOutputDefinition *QgsProcessingParameterVectorDestination::toOutput
|
||||
|
||||
QString QgsProcessingParameterVectorDestination::defaultFileExtension() const
|
||||
{
|
||||
if ( originalProvider() )
|
||||
if ( auto *lOriginalProvider = originalProvider() )
|
||||
{
|
||||
return originalProvider()->defaultVectorFileExtension( hasGeometry() );
|
||||
return lOriginalProvider->defaultVectorFileExtension( hasGeometry() );
|
||||
}
|
||||
else if ( QgsProcessingProvider *p = provider() )
|
||||
{
|
||||
@ -6208,12 +6208,12 @@ QString QgsProcessingParameterVectorDestination::createFileFilter() const
|
||||
|
||||
QStringList QgsProcessingParameterVectorDestination::supportedOutputVectorLayerExtensions() const
|
||||
{
|
||||
if ( originalProvider() )
|
||||
if ( auto *lOriginalProvider = originalProvider() )
|
||||
{
|
||||
if ( hasGeometry() )
|
||||
return originalProvider()->supportedOutputVectorLayerExtensions();
|
||||
return lOriginalProvider->supportedOutputVectorLayerExtensions();
|
||||
else
|
||||
return originalProvider()->supportedOutputTableExtensions();
|
||||
return lOriginalProvider->supportedOutputTableExtensions();
|
||||
}
|
||||
else if ( QgsProcessingProvider *p = provider() )
|
||||
{
|
||||
|
@ -320,9 +320,9 @@ QgsMapLayer *QgsProcessingUtils::mapLayerFromString( const QString &string, QgsP
|
||||
|
||||
// prefer project layers
|
||||
QgsMapLayer *layer = nullptr;
|
||||
if ( context.project() )
|
||||
if ( auto *lProject = context.project() )
|
||||
{
|
||||
QgsMapLayer *layer = mapLayerFromStore( string, context.project()->layerStore(), typeHint );
|
||||
QgsMapLayer *layer = mapLayerFromStore( string, lProject->layerStore(), typeHint );
|
||||
if ( layer )
|
||||
return layer;
|
||||
}
|
||||
|
@ -1280,13 +1280,13 @@ void QgsApplication::initQgis()
|
||||
|
||||
QgsAuthManager *QgsApplication::authManager()
|
||||
{
|
||||
if ( instance() )
|
||||
if ( auto *lInstance = instance() )
|
||||
{
|
||||
if ( !instance()->mAuthManager )
|
||||
if ( !lInstance->mAuthManager )
|
||||
{
|
||||
instance()->mAuthManager = QgsAuthManager::instance();
|
||||
lInstance->mAuthManager = QgsAuthManager::instance();
|
||||
}
|
||||
return instance()->mAuthManager;
|
||||
return lInstance->mAuthManager;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1304,8 +1304,8 @@ void QgsApplication::exitQgis()
|
||||
QThreadPool::globalInstance()->waitForDone();
|
||||
|
||||
// don't create to delete
|
||||
if ( instance() )
|
||||
delete instance()->mAuthManager;
|
||||
if ( auto *lInstance = instance() )
|
||||
delete lInstance->mAuthManager;
|
||||
else
|
||||
delete sAuthManager;
|
||||
|
||||
@ -2136,13 +2136,13 @@ QgsRasterRendererRegistry *QgsApplication::rasterRendererRegistry()
|
||||
|
||||
QgsDataItemProviderRegistry *QgsApplication::dataItemProviderRegistry()
|
||||
{
|
||||
if ( instance() )
|
||||
if ( auto *lInstance = instance() )
|
||||
{
|
||||
if ( !instance()->mDataItemProviderRegistry )
|
||||
{
|
||||
instance()->mDataItemProviderRegistry = new QgsDataItemProviderRegistry();
|
||||
lInstance->mDataItemProviderRegistry = new QgsDataItemProviderRegistry();
|
||||
}
|
||||
return instance()->mDataItemProviderRegistry;
|
||||
return lInstance->mDataItemProviderRegistry;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2475,9 +2475,9 @@ QgsApplication::ApplicationMembers::~ApplicationMembers()
|
||||
|
||||
QgsApplication::ApplicationMembers *QgsApplication::members()
|
||||
{
|
||||
if ( instance() )
|
||||
if ( auto *lInstance = instance() )
|
||||
{
|
||||
return instance()->mApplicationMembers;
|
||||
return lInstance->mApplicationMembers;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -272,8 +272,8 @@ QgsConditionalStyle QgsConditionalStyle::compressStyles( const QList<QgsConditio
|
||||
style.setBackgroundColor( s.backgroundColor() );
|
||||
if ( s.textColor().isValid() && s.textColor().alpha() != 0 )
|
||||
style.setTextColor( s.textColor() );
|
||||
if ( s.symbol() )
|
||||
style.setSymbol( s.symbol() );
|
||||
if ( auto *lSymbol = s.symbol() )
|
||||
style.setSymbol( lSymbol );
|
||||
}
|
||||
return style;
|
||||
}
|
||||
|
@ -976,8 +976,8 @@ QList< QgsLayerTreeModelLegendNode * > QgsLinearlyInterpolatedDiagramRenderer::l
|
||||
const auto constLegendSymbolList = ddSizeLegend.legendSymbolList();
|
||||
for ( const QgsLegendSymbolItem &si : constLegendSymbolList )
|
||||
{
|
||||
if ( si.dataDefinedSizeLegendSettings() )
|
||||
nodes << new QgsDataDefinedSizeLegendNode( nodeLayer, *si.dataDefinedSizeLegendSettings() );
|
||||
if ( auto *lDataDefinedSizeLegendSettings = si.dataDefinedSizeLegendSettings() )
|
||||
nodes << new QgsDataDefinedSizeLegendNode( nodeLayer, *lDataDefinedSizeLegendSettings );
|
||||
else
|
||||
nodes << new QgsSymbolLegendNode( nodeLayer, si );
|
||||
}
|
||||
|
@ -401,8 +401,8 @@ void QgsFeaturePickerModelBase::scheduledReload()
|
||||
QSet<QString> attributes = requestedAttributes();
|
||||
if ( !attributes.isEmpty() )
|
||||
{
|
||||
if ( request.filterExpression() )
|
||||
attributes += request.filterExpression()->referencedColumns();
|
||||
if ( auto *lFilterExpression = request.filterExpression() )
|
||||
attributes += lFilterExpression->referencedColumns();
|
||||
attributes += requestedAttributesForStyle();
|
||||
|
||||
request.setSubsetOfAttributes( attributes, mSourceLayer->fields() );
|
||||
|
@ -562,9 +562,9 @@ QSizeF QgsLegendRenderer::drawTitle( QgsRenderContext &context, double top, Qt::
|
||||
QStringList lines = mSettings.splitStringForWrapping( mSettings.title() );
|
||||
double y = top;
|
||||
|
||||
if ( context.painter() )
|
||||
if ( auto *lPainter = context.painter() )
|
||||
{
|
||||
context.painter()->setPen( mSettings.fontColor() );
|
||||
lPainter->setPen( mSettings.fontColor() );
|
||||
}
|
||||
|
||||
//calculate width and left pos of rectangle to draw text into
|
||||
@ -756,8 +756,8 @@ QSizeF QgsLegendRenderer::drawLayerTitle( QgsLayerTreeLayer *nodeLayer, QgsRende
|
||||
|
||||
double y = top;
|
||||
|
||||
if ( context.painter() )
|
||||
context.painter()->setPen( mSettings.layerFontColor() );
|
||||
if ( auto *lPainter = context.painter() )
|
||||
lPainter->setPen( mSettings.layerFontColor() );
|
||||
|
||||
QFont layerFont = mSettings.style( nodeLegendStyle( nodeLayer ) ).font();
|
||||
|
||||
@ -813,8 +813,8 @@ QSizeF QgsLegendRenderer::drawGroupTitle( QgsLayerTreeGroup *nodeGroup, QgsRende
|
||||
|
||||
double y = top;
|
||||
|
||||
if ( context.painter() )
|
||||
context.painter()->setPen( mSettings.fontColor() );
|
||||
if ( auto *lPainter = context.painter() )
|
||||
lPainter->setPen( mSettings.fontColor() );
|
||||
|
||||
QFont groupFont = mSettings.style( nodeLegendStyle( nodeGroup ) ).font();
|
||||
|
||||
|
@ -321,8 +321,8 @@ QList<QgsLayerTreeModelLegendNode *> QgsDefaultVectorLayerLegend::createLayerTre
|
||||
const auto constLegendSymbolItems = r->legendSymbolItems();
|
||||
for ( const QgsLegendSymbolItem &i : constLegendSymbolItems )
|
||||
{
|
||||
if ( i.dataDefinedSizeLegendSettings() )
|
||||
nodes << new QgsDataDefinedSizeLegendNode( nodeLayer, *i.dataDefinedSizeLegendSettings() );
|
||||
if ( auto *lDataDefinedSizeLegendSettings = i.dataDefinedSizeLegendSettings() )
|
||||
nodes << new QgsDataDefinedSizeLegendNode( nodeLayer, *lDataDefinedSizeLegendSettings );
|
||||
else
|
||||
{
|
||||
QgsSymbolLegendNode *legendNode = new QgsSymbolLegendNode( nodeLayer, i );
|
||||
|
@ -78,8 +78,8 @@ QHash<QgsMapLayer *, int> QgsMapRendererJob::perLayerRenderingTime() const
|
||||
QHash<QgsMapLayer *, int> result;
|
||||
for ( auto it = mPerLayerRenderingTime.constBegin(); it != mPerLayerRenderingTime.constEnd(); ++it )
|
||||
{
|
||||
if ( it.key() )
|
||||
result.insert( it.key(), it.value() );
|
||||
if ( auto &&lKey = it.key() )
|
||||
result.insert( lKey, it.value() );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -422,8 +422,8 @@ void QgsMapThemeCollection::reconnectToLayersStyleManager()
|
||||
{
|
||||
for ( const MapThemeLayerRecord &layerRec : qgis::as_const( rec.mLayerRecords ) )
|
||||
{
|
||||
if ( layerRec.layer() )
|
||||
layers << layerRec.layer();
|
||||
if ( auto *lLayer = layerRec.layer() )
|
||||
layers << lLayer;
|
||||
}
|
||||
}
|
||||
|
||||
@ -736,8 +736,8 @@ QHash<QgsMapLayer *, QgsMapThemeCollection::MapThemeLayerRecord> QgsMapThemeColl
|
||||
QHash<QgsMapLayer *, MapThemeLayerRecord> validSet;
|
||||
for ( const MapThemeLayerRecord &layerRec : mLayerRecords )
|
||||
{
|
||||
if ( layerRec.layer() )
|
||||
validSet.insert( layerRec.layer(), layerRec );
|
||||
if ( auto *lLayer = layerRec.layer() )
|
||||
validSet.insert( lLayer, layerRec );
|
||||
}
|
||||
return validSet;
|
||||
}
|
||||
|
@ -285,27 +285,27 @@ QgsVectorLayer *QgsVectorLayer::clone() const
|
||||
layer->actions()->addAction( action );
|
||||
}
|
||||
|
||||
if ( renderer() )
|
||||
if ( auto *lRenderer = renderer() )
|
||||
{
|
||||
layer->setRenderer( renderer()->clone() );
|
||||
layer->setRenderer( lRenderer->clone() );
|
||||
}
|
||||
|
||||
if ( labeling() )
|
||||
if ( auto *lLabeling = labeling() )
|
||||
{
|
||||
layer->setLabeling( labeling()->clone() );
|
||||
layer->setLabeling( lLabeling->clone() );
|
||||
}
|
||||
layer->setLabelsEnabled( labelsEnabled() );
|
||||
|
||||
layer->setSimplifyMethod( simplifyMethod() );
|
||||
|
||||
if ( diagramRenderer() )
|
||||
if ( auto *lDiagramRenderer = diagramRenderer() )
|
||||
{
|
||||
layer->setDiagramRenderer( diagramRenderer()->clone() );
|
||||
layer->setDiagramRenderer( lDiagramRenderer->clone() );
|
||||
}
|
||||
|
||||
if ( diagramLayerSettings() )
|
||||
if ( auto *lDiagramLayerSettings = diagramLayerSettings() )
|
||||
{
|
||||
layer->setDiagramLayerSettings( *diagramLayerSettings() );
|
||||
layer->setDiagramLayerSettings( *lDiagramLayerSettings );
|
||||
}
|
||||
|
||||
for ( int i = 0; i < fields().count(); i++ )
|
||||
@ -331,8 +331,8 @@ QgsVectorLayer *QgsVectorLayer::clone() const
|
||||
|
||||
layer->setEditFormConfig( editFormConfig() );
|
||||
|
||||
if ( auxiliaryLayer() )
|
||||
layer->setAuxiliaryLayer( auxiliaryLayer()->clone( layer ) );
|
||||
if ( auto *lAuxiliaryLayer = auxiliaryLayer() )
|
||||
layer->setAuxiliaryLayer( lAuxiliaryLayer->clone( layer ) );
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
@ -22,10 +22,10 @@ QString QgsVectorLayerJoinInfo::prefixedFieldName( const QgsField &f ) const
|
||||
{
|
||||
QString name;
|
||||
|
||||
if ( joinLayer() )
|
||||
if ( auto *lJoinLayer = joinLayer() )
|
||||
{
|
||||
if ( prefix().isNull() )
|
||||
name = joinLayer()->name() + '_';
|
||||
name = lJoinLayer->name() + '_';
|
||||
else
|
||||
name = prefix();
|
||||
|
||||
@ -63,11 +63,11 @@ QgsFeature QgsVectorLayerJoinInfo::extractJoinedFeature( const QgsFeature &featu
|
||||
{
|
||||
QgsFeature joinFeature;
|
||||
|
||||
if ( joinLayer() )
|
||||
if ( auto *lJoinLayer = joinLayer() )
|
||||
{
|
||||
const QVariant idFieldValue = feature.attribute( targetFieldName() );
|
||||
joinFeature.initAttributes( joinLayer()->fields().count() );
|
||||
joinFeature.setFields( joinLayer()->fields() );
|
||||
joinFeature.initAttributes( lJoinLayer->fields().count() );
|
||||
joinFeature.setFields( lJoinLayer->fields() );
|
||||
joinFeature.setAttribute( joinFieldName(), idFieldValue );
|
||||
|
||||
const QgsFields joinFields = joinFeature.fields();
|
||||
@ -100,9 +100,9 @@ QStringList QgsVectorLayerJoinInfo::joinFieldNamesSubset( const QgsVectorLayerJo
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( info.joinLayer() )
|
||||
if ( auto *lJoinLayer = info.joinLayer() )
|
||||
{
|
||||
const QgsFields fields { info.joinLayer()->fields() };
|
||||
const QgsFields fields { lJoinLayer->fields() };
|
||||
for ( const QgsField &f : fields )
|
||||
{
|
||||
if ( !info.joinFieldNamesBlockList().contains( f.name() )
|
||||
|
@ -69,9 +69,9 @@ QgsVirtualLayerDefinition QgsVirtualLayerDefinitionUtils::fromJoinedLayer( QgsVe
|
||||
QString prefix = join.prefix().isEmpty() ? joinedLayer->name() + "_" : join.prefix();
|
||||
|
||||
leftJoins << QStringLiteral( "LEFT JOIN \"%1\" AS %2 ON t.\"%5\"=%2.\"%3\"" ).arg( joinedLayer->id(), joinName, join.joinFieldName(), join.targetFieldName() );
|
||||
if ( join.joinFieldNamesSubset() )
|
||||
if ( auto *lJoinFieldNamesSubset = join.joinFieldNamesSubset() )
|
||||
{
|
||||
const QStringList joinFieldNamesSubset { *join.joinFieldNamesSubset() };
|
||||
const QStringList joinFieldNamesSubset { *lJoinFieldNamesSubset };
|
||||
for ( const QString &f : joinFieldNamesSubset )
|
||||
{
|
||||
columns << joinName + ".\"" + f + "\" AS \"" + prefix + f + "\"";
|
||||
|
@ -51,16 +51,16 @@ QgsColorRampShader::QgsColorRampShader( const QgsColorRampShader &other )
|
||||
, mLUTInitialized( other.mLUTInitialized )
|
||||
, mClip( other.mClip )
|
||||
{
|
||||
if ( other.sourceColorRamp() )
|
||||
mSourceColorRamp.reset( other.sourceColorRamp()->clone() );
|
||||
if ( auto *lSourceColorRamp = other.sourceColorRamp() )
|
||||
mSourceColorRamp.reset( lSourceColorRamp->clone() );
|
||||
mColorRampItemList = other.mColorRampItemList;
|
||||
}
|
||||
|
||||
QgsColorRampShader &QgsColorRampShader::operator=( const QgsColorRampShader &other )
|
||||
{
|
||||
QgsRasterShaderFunction::operator=( other );
|
||||
if ( other.sourceColorRamp() )
|
||||
mSourceColorRamp.reset( other.sourceColorRamp()->clone() );
|
||||
if ( auto *lSourceColorRamp = other.sourceColorRamp() )
|
||||
mSourceColorRamp.reset( lSourceColorRamp->clone() );
|
||||
else
|
||||
mSourceColorRamp.reset();
|
||||
|
||||
|
@ -759,9 +759,9 @@ void QgsRasterLayer::setDataProvider( QString const &provider, const QgsDataProv
|
||||
{
|
||||
if ( mDataProvider->colorInterpretation( bandNo ) == QgsRaster::AlphaBand )
|
||||
{
|
||||
if ( mPipe.renderer() )
|
||||
if ( auto *lRenderer = mPipe.renderer() )
|
||||
{
|
||||
mPipe.renderer()->setAlphaBand( bandNo );
|
||||
lRenderer->setAlphaBand( bandNo );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1444,9 +1444,9 @@ QDateTime QgsRasterLayer::timestamp() const
|
||||
|
||||
bool QgsRasterLayer::accept( QgsStyleEntityVisitorInterface *visitor ) const
|
||||
{
|
||||
if ( mPipe.renderer() )
|
||||
if ( auto *lRenderer = mPipe.renderer() )
|
||||
{
|
||||
if ( !mPipe.renderer()->accept( visitor ) )
|
||||
if ( !lRenderer->accept( visitor ) )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -264,16 +264,16 @@ void QgsSingleBandGrayRenderer::toSld( QDomDocument &doc, QDomElement &element,
|
||||
channelElem.appendChild( sourceChannelNameElem );
|
||||
|
||||
// set ContrastEnhancement
|
||||
if ( contrastEnhancement() )
|
||||
if ( auto *lContrastEnhancement = contrastEnhancement() )
|
||||
{
|
||||
QDomElement contrastEnhancementElem = doc.createElement( QStringLiteral( "sld:ContrastEnhancement" ) );
|
||||
contrastEnhancement()->toSld( doc, contrastEnhancementElem );
|
||||
lContrastEnhancement->toSld( doc, contrastEnhancementElem );
|
||||
|
||||
// do changes to minValue/maxValues depending on stretching algorithm. This is necessary because
|
||||
// geoserver does a first stretch on min/max, then applies color map rules.
|
||||
// In some combination it is necessary to use real min/max values and in
|
||||
// others the actual edited min/max values
|
||||
switch ( contrastEnhancement()->contrastEnhancementAlgorithm() )
|
||||
switch ( lContrastEnhancement->contrastEnhancementAlgorithm() )
|
||||
{
|
||||
case QgsContrastEnhancement::StretchAndClipToMinimumMaximum:
|
||||
case QgsContrastEnhancement::ClipToMinimumMaximum:
|
||||
@ -282,7 +282,7 @@ void QgsSingleBandGrayRenderer::toSld( QDomDocument &doc, QDomElement &element,
|
||||
QgsRasterBandStats myRasterBandStats = mInput->bandStatistics( grayBand(), QgsRasterBandStats::Min | QgsRasterBandStats::Max );
|
||||
|
||||
// if minimum range differ from the real minimum => set is in exported SLD vendor option
|
||||
if ( !qgsDoubleNear( contrastEnhancement()->minimumValue(), myRasterBandStats.minimumValue ) )
|
||||
if ( !qgsDoubleNear( lContrastEnhancement->minimumValue(), myRasterBandStats.minimumValue ) )
|
||||
{
|
||||
// look for VendorOption tag to look for that with minValue attribute
|
||||
const QDomNodeList vendorOptions = contrastEnhancementElem.elementsByTagName( QStringLiteral( "sld:VendorOption" ) );
|
||||
|
@ -53,9 +53,9 @@ void QgsSingleBandPseudoColorRenderer::setBand( int bandNo )
|
||||
void QgsSingleBandPseudoColorRenderer::setClassificationMin( double min )
|
||||
{
|
||||
mClassificationMin = min;
|
||||
if ( shader() )
|
||||
if ( auto *lShader = shader() )
|
||||
{
|
||||
QgsColorRampShader *colorRampShader = dynamic_cast<QgsColorRampShader *>( shader()->rasterShaderFunction() );
|
||||
QgsColorRampShader *colorRampShader = dynamic_cast<QgsColorRampShader *>( lShader->rasterShaderFunction() );
|
||||
if ( colorRampShader )
|
||||
{
|
||||
colorRampShader->setMinimumValue( min );
|
||||
@ -66,9 +66,9 @@ void QgsSingleBandPseudoColorRenderer::setClassificationMin( double min )
|
||||
void QgsSingleBandPseudoColorRenderer::setClassificationMax( double max )
|
||||
{
|
||||
mClassificationMax = max;
|
||||
if ( shader() )
|
||||
if ( auto *lShader = shader() )
|
||||
{
|
||||
QgsColorRampShader *colorRampShader = dynamic_cast<QgsColorRampShader *>( shader()->rasterShaderFunction() );
|
||||
QgsColorRampShader *colorRampShader = dynamic_cast<QgsColorRampShader *>( lShader->rasterShaderFunction() );
|
||||
if ( colorRampShader )
|
||||
{
|
||||
colorRampShader->setMaximumValue( max );
|
||||
|
@ -409,10 +409,10 @@ void QgsInterpolatedLineColor::setColor( const QColor &color )
|
||||
|
||||
QColor QgsInterpolatedLineColor::color( double magnitude ) const
|
||||
{
|
||||
if ( mColorRampShader.sourceColorRamp() )
|
||||
if ( auto *lSourceColorRamp = mColorRampShader.sourceColorRamp() )
|
||||
{
|
||||
if ( mColorRampShader.isEmpty() )
|
||||
return mColorRampShader.sourceColorRamp()->color( 0 );
|
||||
return lSourceColorRamp->color( 0 );
|
||||
|
||||
int r, g, b, a;
|
||||
if ( mColorRampShader.shade( magnitude, &r, &g, &b, &a ) )
|
||||
|
@ -93,9 +93,9 @@ void QgsMaskMarkerSymbolLayer::startRender( QgsSymbolRenderContext &context )
|
||||
{
|
||||
// since we need to swap the regular painter with the mask painter during rendering,
|
||||
// effects won't work. So we cheat by handling effects ourselves in renderPoint
|
||||
if ( paintEffect() )
|
||||
if ( auto *lPaintEffect = paintEffect() )
|
||||
{
|
||||
mEffect.reset( paintEffect()->clone() );
|
||||
mEffect.reset( lPaintEffect->clone() );
|
||||
setPaintEffect( nullptr );
|
||||
}
|
||||
mSymbol->startRender( context.renderContext() );
|
||||
|
@ -129,9 +129,9 @@ void QgsVectorTileBasicRenderer::startRender( QgsRenderContext &context, int til
|
||||
QgsExpression expr( layerStyle.filterExpression() );
|
||||
mRequiredFields[layerStyle.layerName()].unite( expr.referencedColumns() );
|
||||
}
|
||||
if ( layerStyle.symbol() )
|
||||
if ( auto *lSymbol = layerStyle.symbol() )
|
||||
{
|
||||
mRequiredFields[layerStyle.layerName()].unite( layerStyle.symbol()->usedAttributes( context ) );
|
||||
mRequiredFields[layerStyle.layerName()].unite( lSymbol->usedAttributes( context ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -364,9 +364,9 @@ void QgsEditConditionalFormatRuleWidget::setFormattingFromStyle( const QgsCondit
|
||||
{
|
||||
btnBackgroundColor->setColor( style.backgroundColor() );
|
||||
btnTextColor->setColor( style.textColor() );
|
||||
if ( style.symbol() )
|
||||
if ( auto *lSymbol = style.symbol() )
|
||||
{
|
||||
btnChangeIcon->setSymbol( style.symbol()->clone() );
|
||||
btnChangeIcon->setSymbol( lSymbol->clone() );
|
||||
checkIcon->setChecked( true );
|
||||
}
|
||||
else
|
||||
|
@ -24,8 +24,8 @@
|
||||
|
||||
QgsExpressionContext QgsCalloutWidget::createExpressionContext() const
|
||||
{
|
||||
if ( mContext.expressionContext() )
|
||||
return *mContext.expressionContext();
|
||||
if ( auto *lExpressionContext = mContext.expressionContext() )
|
||||
return *lExpressionContext;
|
||||
|
||||
QgsExpressionContext expContext( mContext.globalProjectAtlasMapLayerScopes( vectorLayer() ) );
|
||||
QgsExpressionContextScope *symbolScope = QgsExpressionContextUtils::updateSymbolScope( nullptr, new QgsExpressionContextScope() );
|
||||
|
@ -42,9 +42,9 @@ QgsRelationReferenceConfigDlg::QgsRelationReferenceConfigDlg( QgsVectorLayer *vl
|
||||
mComboRelation->addItem( QStringLiteral( "%1 (%2)" ).arg( relation.id(), relation.referencedLayerId() ), relation.id() );
|
||||
else
|
||||
mComboRelation->addItem( QStringLiteral( "%1 (%2)" ).arg( relation.name(), relation.referencedLayerId() ), relation.id() );
|
||||
if ( relation.referencedLayer() )
|
||||
if ( auto *lReferencedLayer = relation.referencedLayer() )
|
||||
{
|
||||
mExpressionWidget->setField( relation.referencedLayer()->displayExpression() );
|
||||
mExpressionWidget->setField( lReferencedLayer->displayExpression() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -439,11 +439,11 @@ void QgsLabelingGui::setLayer( QgsMapLayer *mapLayer )
|
||||
mDataDefinedProperties = mSettings.dataDefinedProperties();
|
||||
|
||||
// callout settings, to move to custom widget when multiple styles exist
|
||||
if ( mSettings.callout() )
|
||||
if ( auto *lCallout = mSettings.callout() )
|
||||
{
|
||||
whileBlocking( mCalloutsDrawCheckBox )->setChecked( mSettings.callout()->enabled() );
|
||||
whileBlocking( mCalloutStyleComboBox )->setCurrentIndex( mCalloutStyleComboBox->findData( mSettings.callout()->type() ) );
|
||||
updateCalloutWidget( mSettings.callout() );
|
||||
whileBlocking( mCalloutsDrawCheckBox )->setChecked( lCallout->enabled() );
|
||||
whileBlocking( mCalloutStyleComboBox )->setCurrentIndex( mCalloutStyleComboBox->findData( lCallout->type() ) );
|
||||
updateCalloutWidget( lCallout );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -46,8 +46,8 @@ void QgsLabelSettingsWidgetBase::setGeometryType( QgsWkbTypes::GeometryType )
|
||||
|
||||
QgsExpressionContext QgsLabelSettingsWidgetBase::createExpressionContext() const
|
||||
{
|
||||
if ( mContext.expressionContext() )
|
||||
return *mContext.expressionContext();
|
||||
if ( auto *lExpressionContext = mContext.expressionContext() )
|
||||
return *lExpressionContext;
|
||||
|
||||
QgsExpressionContext expContext( mContext.globalProjectAtlasMapLayerScopes( mVectorLayer ) );
|
||||
QgsExpressionContextScope *symbolScope = QgsExpressionContextUtils::updateSymbolScope( nullptr, new QgsExpressionContextScope() );
|
||||
|
@ -210,13 +210,13 @@ QgsProcessingAggregateParameterDefinitionWidget::QgsProcessingAggregateParameter
|
||||
if ( const QgsProcessingParameterAggregate *aggregateParam = dynamic_cast<const QgsProcessingParameterAggregate *>( definition ) )
|
||||
initialParent = aggregateParam->parentLayerParameterName();
|
||||
|
||||
if ( widgetContext.model() )
|
||||
if ( auto *lModel = widgetContext.model() )
|
||||
{
|
||||
// populate combo box with other model input choices
|
||||
const QMap<QString, QgsProcessingModelParameter> components = widgetContext.model()->parameterComponents();
|
||||
const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
|
||||
for ( auto it = components.constBegin(); it != components.constEnd(); ++it )
|
||||
{
|
||||
if ( const QgsProcessingParameterFeatureSource *definition = dynamic_cast< const QgsProcessingParameterFeatureSource * >( widgetContext.model()->parameterDefinition( it.value().parameterName() ) ) )
|
||||
if ( const QgsProcessingParameterFeatureSource *definition = dynamic_cast< const QgsProcessingParameterFeatureSource * >( lModel->parameterDefinition( it.value().parameterName() ) ) )
|
||||
{
|
||||
mParentLayerComboBox-> addItem( definition->description(), definition->name() );
|
||||
if ( !initialParent.isEmpty() && initialParent == definition->name() )
|
||||
@ -224,7 +224,7 @@ QgsProcessingAggregateParameterDefinitionWidget::QgsProcessingAggregateParameter
|
||||
mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
|
||||
}
|
||||
}
|
||||
else if ( const QgsProcessingParameterVectorLayer *definition = dynamic_cast< const QgsProcessingParameterVectorLayer * >( widgetContext.model()->parameterDefinition( it.value().parameterName() ) ) )
|
||||
else if ( const QgsProcessingParameterVectorLayer *definition = dynamic_cast< const QgsProcessingParameterVectorLayer * >( lModel->parameterDefinition( it.value().parameterName() ) ) )
|
||||
{
|
||||
mParentLayerComboBox-> addItem( definition->description(), definition->name() );
|
||||
if ( !initialParent.isEmpty() && initialParent == definition->name() )
|
||||
|
@ -204,13 +204,13 @@ QgsProcessingFieldMapParameterDefinitionWidget::QgsProcessingFieldMapParameterDe
|
||||
if ( const QgsProcessingParameterFieldMapping *mapParam = dynamic_cast<const QgsProcessingParameterFieldMapping *>( definition ) )
|
||||
initialParent = mapParam->parentLayerParameterName();
|
||||
|
||||
if ( widgetContext.model() )
|
||||
if ( auto *lModel = widgetContext.model() )
|
||||
{
|
||||
// populate combo box with other model input choices
|
||||
const QMap<QString, QgsProcessingModelParameter> components = widgetContext.model()->parameterComponents();
|
||||
const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
|
||||
for ( auto it = components.constBegin(); it != components.constEnd(); ++it )
|
||||
{
|
||||
if ( const QgsProcessingParameterFeatureSource *definition = dynamic_cast< const QgsProcessingParameterFeatureSource * >( widgetContext.model()->parameterDefinition( it.value().parameterName() ) ) )
|
||||
if ( const QgsProcessingParameterFeatureSource *definition = dynamic_cast< const QgsProcessingParameterFeatureSource * >( lModel->parameterDefinition( it.value().parameterName() ) ) )
|
||||
{
|
||||
mParentLayerComboBox-> addItem( definition->description(), definition->name() );
|
||||
if ( !initialParent.isEmpty() && initialParent == definition->name() )
|
||||
@ -218,7 +218,7 @@ QgsProcessingFieldMapParameterDefinitionWidget::QgsProcessingFieldMapParameterDe
|
||||
mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
|
||||
}
|
||||
}
|
||||
else if ( const QgsProcessingParameterVectorLayer *definition = dynamic_cast< const QgsProcessingParameterVectorLayer * >( widgetContext.model()->parameterDefinition( it.value().parameterName() ) ) )
|
||||
else if ( const QgsProcessingParameterVectorLayer *definition = dynamic_cast< const QgsProcessingParameterVectorLayer * >( lModel->parameterDefinition( it.value().parameterName() ) ) )
|
||||
{
|
||||
mParentLayerComboBox-> addItem( definition->description(), definition->name() );
|
||||
if ( !initialParent.isEmpty() && initialParent == definition->name() )
|
||||
|
@ -402,23 +402,23 @@ QgsExpressionContext QgsProcessingGuiUtils::createExpressionContext( QgsProcessi
|
||||
|
||||
QgsExpressionContext c = context->expressionContext();
|
||||
|
||||
if ( widgetContext.model() )
|
||||
if ( auto *lModel = widgetContext.model() )
|
||||
{
|
||||
c << QgsExpressionContextUtils::processingModelAlgorithmScope( widgetContext.model(), QVariantMap(), *context );
|
||||
c << QgsExpressionContextUtils::processingModelAlgorithmScope( lModel, QVariantMap(), *context );
|
||||
|
||||
const QgsProcessingAlgorithm *alg = nullptr;
|
||||
if ( widgetContext.model()->childAlgorithms().contains( widgetContext.modelChildAlgorithmId() ) )
|
||||
alg = widgetContext.model()->childAlgorithm( widgetContext.modelChildAlgorithmId() ).algorithm();
|
||||
if ( lModel->childAlgorithms().contains( widgetContext.modelChildAlgorithmId() ) )
|
||||
alg = lModel->childAlgorithm( widgetContext.modelChildAlgorithmId() ).algorithm();
|
||||
|
||||
QgsExpressionContextScope *algorithmScope = QgsExpressionContextUtils::processingAlgorithmScope( alg ? alg : algorithm, QVariantMap(), *context );
|
||||
c << algorithmScope;
|
||||
QgsExpressionContextScope *childScope = widgetContext.model()->createExpressionContextScopeForChildAlgorithm( widgetContext.modelChildAlgorithmId(), *context, QVariantMap(), QVariantMap() );
|
||||
QgsExpressionContextScope *childScope = lModel->createExpressionContextScopeForChildAlgorithm( widgetContext.modelChildAlgorithmId(), *context, QVariantMap(), QVariantMap() );
|
||||
c << childScope;
|
||||
|
||||
QStringList highlightedVariables = childScope->variableNames();
|
||||
QStringList highlightedFunctions = childScope->functionNames();
|
||||
highlightedVariables += algorithmScope->variableNames();
|
||||
highlightedVariables += widgetContext.model()->variables().keys();
|
||||
highlightedVariables += lModel->variables().keys();
|
||||
highlightedFunctions += algorithmScope->functionNames();
|
||||
c.setHighlightedVariables( highlightedVariables );
|
||||
c.setHighlightedFunctions( highlightedFunctions );
|
||||
|
@ -926,13 +926,13 @@ QgsProcessingDistanceParameterDefinitionWidget::QgsProcessingDistanceParameterDe
|
||||
if ( const QgsProcessingParameterDistance *distParam = dynamic_cast<const QgsProcessingParameterDistance *>( definition ) )
|
||||
initialParent = distParam->parentParameterName();
|
||||
|
||||
if ( widgetContext.model() )
|
||||
if ( auto *lModel = widgetContext.model() )
|
||||
{
|
||||
// populate combo box with other model input choices
|
||||
const QMap<QString, QgsProcessingModelParameter> components = widgetContext.model()->parameterComponents();
|
||||
const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
|
||||
for ( auto it = components.constBegin(); it != components.constEnd(); ++it )
|
||||
{
|
||||
if ( const QgsProcessingParameterFeatureSource *definition = dynamic_cast< const QgsProcessingParameterFeatureSource * >( widgetContext.model()->parameterDefinition( it.value().parameterName() ) ) )
|
||||
if ( const QgsProcessingParameterFeatureSource *definition = dynamic_cast< const QgsProcessingParameterFeatureSource * >( lModel->parameterDefinition( it.value().parameterName() ) ) )
|
||||
{
|
||||
mParentLayerComboBox-> addItem( definition->description(), definition->name() );
|
||||
if ( !initialParent.isEmpty() && initialParent == definition->name() )
|
||||
@ -940,7 +940,7 @@ QgsProcessingDistanceParameterDefinitionWidget::QgsProcessingDistanceParameterDe
|
||||
mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
|
||||
}
|
||||
}
|
||||
else if ( const QgsProcessingParameterVectorLayer *definition = dynamic_cast< const QgsProcessingParameterVectorLayer * >( widgetContext.model()->parameterDefinition( it.value().parameterName() ) ) )
|
||||
else if ( const QgsProcessingParameterVectorLayer *definition = dynamic_cast< const QgsProcessingParameterVectorLayer * >( lModel->parameterDefinition( it.value().parameterName() ) ) )
|
||||
{
|
||||
mParentLayerComboBox-> addItem( definition->description(), definition->name() );
|
||||
if ( !initialParent.isEmpty() && initialParent == definition->name() )
|
||||
@ -948,7 +948,7 @@ QgsProcessingDistanceParameterDefinitionWidget::QgsProcessingDistanceParameterDe
|
||||
mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
|
||||
}
|
||||
}
|
||||
else if ( const QgsProcessingParameterMapLayer *definition = dynamic_cast< const QgsProcessingParameterMapLayer * >( widgetContext.model()->parameterDefinition( it.value().parameterName() ) ) )
|
||||
else if ( const QgsProcessingParameterMapLayer *definition = dynamic_cast< const QgsProcessingParameterMapLayer * >( lModel->parameterDefinition( it.value().parameterName() ) ) )
|
||||
{
|
||||
mParentLayerComboBox-> addItem( definition->description(), definition->name() );
|
||||
if ( !initialParent.isEmpty() && initialParent == definition->name() )
|
||||
@ -956,7 +956,7 @@ QgsProcessingDistanceParameterDefinitionWidget::QgsProcessingDistanceParameterDe
|
||||
mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
|
||||
}
|
||||
}
|
||||
else if ( const QgsProcessingParameterCrs *definition = dynamic_cast< const QgsProcessingParameterCrs * >( widgetContext.model()->parameterDefinition( it.value().parameterName() ) ) )
|
||||
else if ( const QgsProcessingParameterCrs *definition = dynamic_cast< const QgsProcessingParameterCrs * >( lModel->parameterDefinition( it.value().parameterName() ) ) )
|
||||
{
|
||||
mParentLayerComboBox-> addItem( definition->description(), definition->name() );
|
||||
if ( !initialParent.isEmpty() && initialParent == definition->name() )
|
||||
@ -1872,13 +1872,13 @@ QgsProcessingExpressionParameterDefinitionWidget::QgsProcessingExpressionParamet
|
||||
if ( const QgsProcessingParameterExpression *expParam = dynamic_cast<const QgsProcessingParameterExpression *>( definition ) )
|
||||
initialParent = expParam->parentLayerParameterName();
|
||||
|
||||
if ( widgetContext.model() )
|
||||
if ( auto *lModel = widgetContext.model() )
|
||||
{
|
||||
// populate combo box with other model input choices
|
||||
const QMap<QString, QgsProcessingModelParameter> components = widgetContext.model()->parameterComponents();
|
||||
const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
|
||||
for ( auto it = components.constBegin(); it != components.constEnd(); ++it )
|
||||
{
|
||||
if ( const QgsProcessingParameterFeatureSource *definition = dynamic_cast< const QgsProcessingParameterFeatureSource * >( widgetContext.model()->parameterDefinition( it.value().parameterName() ) ) )
|
||||
if ( const QgsProcessingParameterFeatureSource *definition = dynamic_cast< const QgsProcessingParameterFeatureSource * >( lModel->parameterDefinition( it.value().parameterName() ) ) )
|
||||
{
|
||||
mParentLayerComboBox-> addItem( definition->description(), definition->name() );
|
||||
if ( !initialParent.isEmpty() && initialParent == definition->name() )
|
||||
@ -1886,7 +1886,7 @@ QgsProcessingExpressionParameterDefinitionWidget::QgsProcessingExpressionParamet
|
||||
mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
|
||||
}
|
||||
}
|
||||
else if ( const QgsProcessingParameterVectorLayer *definition = dynamic_cast< const QgsProcessingParameterVectorLayer * >( widgetContext.model()->parameterDefinition( it.value().parameterName() ) ) )
|
||||
else if ( const QgsProcessingParameterVectorLayer *definition = dynamic_cast< const QgsProcessingParameterVectorLayer * >( lModel->parameterDefinition( it.value().parameterName() ) ) )
|
||||
{
|
||||
mParentLayerComboBox-> addItem( definition->description(), definition->name() );
|
||||
if ( !initialParent.isEmpty() && initialParent == definition->name() )
|
||||
@ -2652,13 +2652,13 @@ QgsProcessingLayoutItemParameterDefinitionWidget::QgsProcessingLayoutItemParamet
|
||||
if ( const QgsProcessingParameterLayoutItem *itemParam = dynamic_cast<const QgsProcessingParameterLayoutItem *>( definition ) )
|
||||
initialParent = itemParam->parentLayoutParameterName();
|
||||
|
||||
if ( widgetContext.model() )
|
||||
if ( auto *lModel = widgetContext.model() )
|
||||
{
|
||||
// populate combo box with other model input choices
|
||||
const QMap<QString, QgsProcessingModelParameter> components = widgetContext.model()->parameterComponents();
|
||||
const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
|
||||
for ( auto it = components.constBegin(); it != components.constEnd(); ++it )
|
||||
{
|
||||
if ( const QgsProcessingParameterLayout *definition = dynamic_cast< const QgsProcessingParameterLayout * >( widgetContext.model()->parameterDefinition( it.value().parameterName() ) ) )
|
||||
if ( const QgsProcessingParameterLayout *definition = dynamic_cast< const QgsProcessingParameterLayout * >( lModel->parameterDefinition( it.value().parameterName() ) ) )
|
||||
{
|
||||
mParentLayoutComboBox-> addItem( definition->description(), definition->name() );
|
||||
if ( !initialParent.isEmpty() && initialParent == definition->name() )
|
||||
@ -3458,10 +3458,10 @@ QgsProcessingCoordinateOperationParameterDefinitionWidget::QgsProcessingCoordina
|
||||
|
||||
mSourceParamComboBox->addItem( QString(), QString() );
|
||||
mDestParamComboBox->addItem( QString(), QString() );
|
||||
if ( widgetContext.model() )
|
||||
if ( auto *lModel = widgetContext.model() )
|
||||
{
|
||||
// populate combo box with other model input choices
|
||||
const QMap<QString, QgsProcessingModelParameter> components = widgetContext.model()->parameterComponents();
|
||||
const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
|
||||
for ( auto it = components.constBegin(); it != components.constEnd(); ++it )
|
||||
{
|
||||
if ( definition && it->parameterName() == definition->name() )
|
||||
@ -3863,13 +3863,13 @@ QgsProcessingFieldParameterDefinitionWidget::QgsProcessingFieldParameterDefiniti
|
||||
if ( const QgsProcessingParameterField *fieldParam = dynamic_cast<const QgsProcessingParameterField *>( definition ) )
|
||||
initialParent = fieldParam->parentLayerParameterName();
|
||||
|
||||
if ( widgetContext.model() )
|
||||
if ( auto *lModel = widgetContext.model() )
|
||||
{
|
||||
// populate combo box with other model input choices
|
||||
const QMap<QString, QgsProcessingModelParameter> components = widgetContext.model()->parameterComponents();
|
||||
const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
|
||||
for ( auto it = components.constBegin(); it != components.constEnd(); ++it )
|
||||
{
|
||||
if ( const QgsProcessingParameterFeatureSource *definition = dynamic_cast< const QgsProcessingParameterFeatureSource * >( widgetContext.model()->parameterDefinition( it.value().parameterName() ) ) )
|
||||
if ( const QgsProcessingParameterFeatureSource *definition = dynamic_cast< const QgsProcessingParameterFeatureSource * >( lModel->parameterDefinition( it.value().parameterName() ) ) )
|
||||
{
|
||||
mParentLayerComboBox-> addItem( definition->description(), definition->name() );
|
||||
if ( !initialParent.isEmpty() && initialParent == definition->name() )
|
||||
@ -3877,7 +3877,7 @@ QgsProcessingFieldParameterDefinitionWidget::QgsProcessingFieldParameterDefiniti
|
||||
mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
|
||||
}
|
||||
}
|
||||
else if ( const QgsProcessingParameterVectorLayer *definition = dynamic_cast< const QgsProcessingParameterVectorLayer * >( widgetContext.model()->parameterDefinition( it.value().parameterName() ) ) )
|
||||
else if ( const QgsProcessingParameterVectorLayer *definition = dynamic_cast< const QgsProcessingParameterVectorLayer * >( lModel->parameterDefinition( it.value().parameterName() ) ) )
|
||||
{
|
||||
mParentLayerComboBox-> addItem( definition->description(), definition->name() );
|
||||
if ( !initialParent.isEmpty() && initialParent == definition->name() )
|
||||
@ -4768,16 +4768,16 @@ QgsProcessingDatabaseSchemaParameterDefinitionWidget::QgsProcessingDatabaseSchem
|
||||
initialConnection = schemaParam->parentConnectionParameterName();
|
||||
}
|
||||
|
||||
if ( widgetContext.model() )
|
||||
if ( auto *lModel = widgetContext.model() )
|
||||
{
|
||||
// populate combo box with other model input choices
|
||||
const QMap<QString, QgsProcessingModelParameter> components = widgetContext.model()->parameterComponents();
|
||||
const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
|
||||
for ( auto it = components.constBegin(); it != components.constEnd(); ++it )
|
||||
{
|
||||
if ( definition && it->parameterName() == definition->name() )
|
||||
continue;
|
||||
|
||||
if ( !dynamic_cast< const QgsProcessingParameterProviderConnection * >( widgetContext.model()->parameterDefinition( it->parameterName() ) ) )
|
||||
if ( !dynamic_cast< const QgsProcessingParameterProviderConnection * >( lModel->parameterDefinition( it->parameterName() ) ) )
|
||||
continue;
|
||||
|
||||
mConnectionParamComboBox->addItem( it->parameterName(), it->parameterName() );
|
||||
@ -5006,16 +5006,16 @@ QgsProcessingDatabaseTableParameterDefinitionWidget::QgsProcessingDatabaseTableP
|
||||
initialSchema = tableParam->parentSchemaParameterName();
|
||||
}
|
||||
|
||||
if ( widgetContext.model() )
|
||||
if ( auto *lModel = widgetContext.model() )
|
||||
{
|
||||
// populate combo box with other model input choices
|
||||
const QMap<QString, QgsProcessingModelParameter> components = widgetContext.model()->parameterComponents();
|
||||
const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
|
||||
for ( auto it = components.constBegin(); it != components.constEnd(); ++it )
|
||||
{
|
||||
if ( definition && it->parameterName() == definition->name() )
|
||||
continue;
|
||||
|
||||
if ( dynamic_cast< const QgsProcessingParameterProviderConnection * >( widgetContext.model()->parameterDefinition( it->parameterName() ) ) )
|
||||
if ( dynamic_cast< const QgsProcessingParameterProviderConnection * >( lModel->parameterDefinition( it->parameterName() ) ) )
|
||||
{
|
||||
mConnectionParamComboBox->addItem( it->parameterName(), it->parameterName() );
|
||||
if ( !initialConnection.isEmpty() && initialConnection == it->parameterName() )
|
||||
@ -5023,7 +5023,7 @@ QgsProcessingDatabaseTableParameterDefinitionWidget::QgsProcessingDatabaseTableP
|
||||
mConnectionParamComboBox->setCurrentIndex( mConnectionParamComboBox->count() - 1 );
|
||||
}
|
||||
}
|
||||
else if ( dynamic_cast< const QgsProcessingParameterDatabaseSchema * >( widgetContext.model()->parameterDefinition( it->parameterName() ) ) )
|
||||
else if ( dynamic_cast< const QgsProcessingParameterDatabaseSchema * >( lModel->parameterDefinition( it->parameterName() ) ) )
|
||||
{
|
||||
mSchemaParamComboBox->addItem( it->parameterName(), it->parameterName() );
|
||||
if ( !initialConnection.isEmpty() && initialConnection == it->parameterName() )
|
||||
@ -6065,13 +6065,13 @@ QgsProcessingBandParameterDefinitionWidget::QgsProcessingBandParameterDefinition
|
||||
if ( const QgsProcessingParameterBand *bandParam = dynamic_cast<const QgsProcessingParameterBand *>( definition ) )
|
||||
initialParent = bandParam->parentLayerParameterName();
|
||||
|
||||
if ( widgetContext.model() )
|
||||
if ( auto *lModel = widgetContext.model() )
|
||||
{
|
||||
// populate combo box with other model input choices
|
||||
const QMap<QString, QgsProcessingModelParameter> components = widgetContext.model()->parameterComponents();
|
||||
const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
|
||||
for ( auto it = components.constBegin(); it != components.constEnd(); ++it )
|
||||
{
|
||||
if ( const QgsProcessingParameterRasterLayer *definition = dynamic_cast< const QgsProcessingParameterRasterLayer * >( widgetContext.model()->parameterDefinition( it.value().parameterName() ) ) )
|
||||
if ( const QgsProcessingParameterRasterLayer *definition = dynamic_cast< const QgsProcessingParameterRasterLayer * >( lModel->parameterDefinition( it.value().parameterName() ) ) )
|
||||
{
|
||||
mParentLayerComboBox-> addItem( definition->description(), definition->name() );
|
||||
if ( !initialParent.isEmpty() && initialParent == definition->name() )
|
||||
|
@ -145,10 +145,10 @@ QStringList QgsCheckableComboBox::checkedItems() const
|
||||
{
|
||||
QStringList items;
|
||||
|
||||
if ( model() )
|
||||
if ( auto *lModel = model() )
|
||||
{
|
||||
QModelIndex index = model()->index( 0, modelColumn(), rootModelIndex() );
|
||||
QModelIndexList indexes = model()->match( index, Qt::CheckStateRole, Qt::Checked, -1, Qt::MatchExactly );
|
||||
QModelIndex index = lModel->index( 0, modelColumn(), rootModelIndex() );
|
||||
QModelIndexList indexes = lModel->match( index, Qt::CheckStateRole, Qt::Checked, -1, Qt::MatchExactly );
|
||||
const auto constIndexes = indexes;
|
||||
for ( const QModelIndex &index : constIndexes )
|
||||
{
|
||||
@ -163,10 +163,10 @@ QVariantList QgsCheckableComboBox::checkedItemsData() const
|
||||
{
|
||||
QVariantList data;
|
||||
|
||||
if ( model() )
|
||||
if ( auto *lModel = model() )
|
||||
{
|
||||
QModelIndex index = model()->index( 0, modelColumn(), rootModelIndex() );
|
||||
QModelIndexList indexes = model()->match( index, Qt::CheckStateRole, Qt::Checked, -1, Qt::MatchExactly );
|
||||
QModelIndex index = lModel->index( 0, modelColumn(), rootModelIndex() );
|
||||
QModelIndexList indexes = lModel->match( index, Qt::CheckStateRole, Qt::Checked, -1, Qt::MatchExactly );
|
||||
const auto constIndexes = indexes;
|
||||
for ( const QModelIndex &index : constIndexes )
|
||||
{
|
||||
|
@ -239,9 +239,9 @@ void QgsCollapsibleGroupBoxBasic::toggleCollapsed()
|
||||
{
|
||||
QgsDebugMsg( QStringLiteral( "Alt or Shift key down, syncing group" ) );
|
||||
// get pointer to parent or grandparent widget
|
||||
if ( parentWidget() )
|
||||
if ( auto *lParentWidget = parentWidget() )
|
||||
{
|
||||
mSyncParent = parentWidget();
|
||||
mSyncParent = lParentWidget;
|
||||
if ( mSyncParent->parentWidget() )
|
||||
{
|
||||
// don't use whole app for grandparent (common for dialogs that use main window for parent)
|
||||
|
@ -80,9 +80,9 @@ void QgsDataItemGuiProvider::notify( const QString &title, const QString &messag
|
||||
case Qgis::MessageLevel::Info:
|
||||
case Qgis::MessageLevel::None:
|
||||
{
|
||||
if ( context.messageBar() )
|
||||
if ( auto *lMessageBar = context.messageBar() )
|
||||
{
|
||||
context.messageBar()->pushInfo( title, message );
|
||||
lMessageBar->pushInfo( title, message );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -92,9 +92,9 @@ void QgsDataItemGuiProvider::notify( const QString &title, const QString &messag
|
||||
}
|
||||
case Qgis::MessageLevel::Warning:
|
||||
{
|
||||
if ( context.messageBar() )
|
||||
if ( auto *lMessageBar = context.messageBar() )
|
||||
{
|
||||
context.messageBar()->pushWarning( title, message );
|
||||
lMessageBar->pushWarning( title, message );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -104,9 +104,9 @@ void QgsDataItemGuiProvider::notify( const QString &title, const QString &messag
|
||||
}
|
||||
case Qgis::MessageLevel::Critical:
|
||||
{
|
||||
if ( context.messageBar() )
|
||||
if ( auto *lMessageBar = context.messageBar() )
|
||||
{
|
||||
context.messageBar()->pushCritical( title, message );
|
||||
lMessageBar->pushCritical( title, message );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -116,9 +116,9 @@ void QgsDataItemGuiProvider::notify( const QString &title, const QString &messag
|
||||
}
|
||||
case Qgis::MessageLevel::Success:
|
||||
{
|
||||
if ( context.messageBar() )
|
||||
if ( auto *lMessageBar = context.messageBar() )
|
||||
{
|
||||
context.messageBar()->pushSuccess( title, message );
|
||||
lMessageBar->pushSuccess( title, message );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -56,9 +56,9 @@ void QgsFormAnnotation::setDesignerForm( const QString &uiFile )
|
||||
if ( mDesignerWidget )
|
||||
{
|
||||
mMinimumSize = mDesignerWidget->minimumSize();
|
||||
if ( fillSymbol() )
|
||||
if ( auto *lFillSymbol = fillSymbol() )
|
||||
{
|
||||
QgsFillSymbol *newFill = fillSymbol()->clone();
|
||||
QgsFillSymbol *newFill = lFillSymbol->clone();
|
||||
newFill->setColor( mDesignerWidget->palette().color( QPalette::Window ) );
|
||||
setFillSymbol( newFill );
|
||||
}
|
||||
|
@ -769,8 +769,8 @@ void QgsMapToolCapture::stopCapturing()
|
||||
mCaptureCurve.clear();
|
||||
updateExtraSnapLayer();
|
||||
mSnappingMatches.clear();
|
||||
if ( currentVectorLayer() )
|
||||
currentVectorLayer()->triggerRepaint();
|
||||
if ( auto *lCurrentVectorLayer = currentVectorLayer() )
|
||||
lCurrentVectorLayer->triggerRepaint();
|
||||
}
|
||||
|
||||
void QgsMapToolCapture::deleteTempRubberBand()
|
||||
|
@ -83,9 +83,9 @@ void QgsOptionsDialogBase::initOptionsBase( bool restoreUi, const QString &title
|
||||
|
||||
// don't add to dialog margins
|
||||
// redefine now, or those in inherited .ui file will be added
|
||||
if ( layout() )
|
||||
if ( auto *lLayout = layout() )
|
||||
{
|
||||
layout()->setContentsMargins( 0, 0, 0, 0 ); // Qt default spacing
|
||||
lLayout->setContentsMargins( 0, 0, 0, 0 ); // Qt default spacing
|
||||
}
|
||||
|
||||
// start with copy of qgsoptionsdialog_template.ui to ensure existence of these objects
|
||||
|
@ -49,16 +49,16 @@ QgsPropertyAssistantWidget::QgsPropertyAssistantWidget( QWidget *parent,
|
||||
mExpressionWidget->setFilters( QgsFieldProxyModel::Numeric );
|
||||
mExpressionWidget->setField( initialState.propertyType() == QgsProperty::ExpressionBasedProperty ? initialState.expressionString() : initialState.field() );
|
||||
|
||||
if ( initialState.transformer() )
|
||||
if ( auto *lTransformer = initialState.transformer() )
|
||||
{
|
||||
minValueSpinBox->setValue( initialState.transformer()->minValue() );
|
||||
maxValueSpinBox->setValue( initialState.transformer()->maxValue() );
|
||||
minValueSpinBox->setValue( lTransformer->minValue() );
|
||||
maxValueSpinBox->setValue( lTransformer->maxValue() );
|
||||
|
||||
if ( initialState.transformer()->curveTransform() )
|
||||
if ( lTransformer->curveTransform() )
|
||||
{
|
||||
mTransformCurveCheckBox->setChecked( true );
|
||||
mTransformCurveCheckBox->setCollapsed( false );
|
||||
mCurveEditor->setCurve( *initialState.transformer()->curveTransform() );
|
||||
mCurveEditor->setCurve( *lTransformer->curveTransform() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ void QgsRelationEditorWidget::addFeatureGeometry()
|
||||
connect( mMapToolDigitize, &QgsMapToolDigitizeFeature::digitizingCompleted, this, &QgsRelationEditorWidget::onDigitizingCompleted );
|
||||
connect( mEditorContext.mapCanvas(), &QgsMapCanvas::keyPressed, this, &QgsRelationEditorWidget::onKeyPressed );
|
||||
|
||||
if ( mEditorContext.mainMessageBar() )
|
||||
if ( auto *lMainMessageBar = mEditorContext.mainMessageBar() )
|
||||
{
|
||||
QString displayString = QgsVectorLayerUtils::getFeatureDisplayString( layer, mFeature );
|
||||
|
||||
@ -469,7 +469,7 @@ void QgsRelationEditorWidget::addFeatureGeometry()
|
||||
QString msg = tr( "Digitize the geometry for the new feature on layer %1. Press <ESC> to cancel." )
|
||||
.arg( layer->name() );
|
||||
mMessageBarItem = QgsMessageBar::createMessage( title, msg, this );
|
||||
mEditorContext.mainMessageBar()->pushItem( mMessageBarItem );
|
||||
lMainMessageBar->pushItem( mMessageBarItem );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -849,8 +849,8 @@ void QgsTextFormatWidget::updateWidgetForFormat( const QgsTextFormat &format )
|
||||
mBufferJoinStyleComboBox->setPenJoinStyle( buffer.joinStyle() );
|
||||
mBufferTranspFillChbx->setChecked( buffer.fillBufferInterior() );
|
||||
comboBufferBlendMode->setBlendMode( buffer.blendMode() );
|
||||
if ( buffer.paintEffect() )
|
||||
mBufferEffect.reset( buffer.paintEffect()->clone() );
|
||||
if ( auto *lPaintEffect = buffer.paintEffect() )
|
||||
mBufferEffect.reset( lPaintEffect->clone() );
|
||||
else
|
||||
{
|
||||
mBufferEffect.reset( QgsPaintEffectRegistry::defaultStack() );
|
||||
@ -866,8 +866,8 @@ void QgsTextFormatWidget::updateWidgetForFormat( const QgsTextFormat &format )
|
||||
mMaskBufferUnitWidget->setMapUnitScale( mask.sizeMapUnitScale() );
|
||||
mMaskOpacityWidget->setOpacity( mask.opacity() );
|
||||
mMaskJoinStyleComboBox->setPenJoinStyle( mask.joinStyle() );
|
||||
if ( mask.paintEffect() )
|
||||
mMaskEffect.reset( mask.paintEffect()->clone() );
|
||||
if ( auto *lPaintEffect = mask.paintEffect() )
|
||||
mMaskEffect.reset( lPaintEffect->clone() );
|
||||
else
|
||||
{
|
||||
mMaskEffect.reset( QgsPaintEffectRegistry::defaultStack() );
|
||||
@ -951,8 +951,8 @@ void QgsTextFormatWidget::updateWidgetForFormat( const QgsTextFormat &format )
|
||||
mLoadSvgParams = false;
|
||||
mShapeTypeCmbBx_currentIndexChanged( background.type() ); // force update of shape background gui
|
||||
|
||||
if ( background.paintEffect() )
|
||||
mBackgroundEffect.reset( background.paintEffect()->clone() );
|
||||
if ( auto *lPaintEffect = background.paintEffect() )
|
||||
mBackgroundEffect.reset( lPaintEffect->clone() );
|
||||
else
|
||||
{
|
||||
mBackgroundEffect.reset( QgsPaintEffectRegistry::defaultStack() );
|
||||
@ -1165,9 +1165,9 @@ void QgsTextFormatWidget::setContext( const QgsSymbolWidgetContext &context )
|
||||
{
|
||||
mContext = context;
|
||||
|
||||
if ( mContext.expressionContext() )
|
||||
if ( auto *lExpressionContext = mContext.expressionContext() )
|
||||
{
|
||||
mPreviewExpressionContext = *mContext.expressionContext();
|
||||
mPreviewExpressionContext = *lExpressionContext;
|
||||
if ( mLayer )
|
||||
mPreviewExpressionContext.appendScope( QgsExpressionContextUtils::layerScope( mLayer ) );
|
||||
}
|
||||
@ -2024,8 +2024,8 @@ void QgsTextFormatWidget::enableDataDefinedAlignment( bool enable )
|
||||
|
||||
QgsExpressionContext QgsTextFormatWidget::createExpressionContext() const
|
||||
{
|
||||
if ( mContext.expressionContext() )
|
||||
return *mContext.expressionContext();
|
||||
if ( auto *lExpressionContext = mContext.expressionContext() )
|
||||
return *lExpressionContext;
|
||||
|
||||
QgsExpressionContext expContext;
|
||||
expContext << QgsExpressionContextUtils::globalScope()
|
||||
|
@ -77,9 +77,9 @@ void QgsUserInputWidget::widgetDestroyed( QObject *obj )
|
||||
QMap<QWidget *, QFrame *>::iterator i = mWidgetList.find( w );
|
||||
while ( i != mWidgetList.end() )
|
||||
{
|
||||
if ( i.value() )
|
||||
if ( auto *lValue = i.value() )
|
||||
{
|
||||
i.value()->deleteLater();
|
||||
lValue->deleteLater();
|
||||
}
|
||||
i = mWidgetList.erase( i );
|
||||
}
|
||||
@ -98,9 +98,9 @@ void QgsUserInputWidget::setLayoutDirection( QBoxLayout::Direction direction )
|
||||
QMap<QWidget *, QFrame *>::const_iterator i = mWidgetList.constBegin();
|
||||
while ( i != mWidgetList.constEnd() )
|
||||
{
|
||||
if ( i.value() )
|
||||
if ( auto *lValue = i.value() )
|
||||
{
|
||||
i.value()->setFrameShape( horizontal ? QFrame::VLine : QFrame::HLine );
|
||||
lValue->setFrameShape( horizontal ? QFrame::VLine : QFrame::HLine );
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
@ -723,9 +723,9 @@ void QgsCategorizedSymbolRendererWidget::changeCategorySymbol()
|
||||
|
||||
std::unique_ptr< QgsSymbol > symbol;
|
||||
|
||||
if ( category.symbol() )
|
||||
if ( auto *lSymbol = category.symbol() )
|
||||
{
|
||||
symbol.reset( category.symbol()->clone() );
|
||||
symbol.reset( lSymbol->clone() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1208,11 +1208,11 @@ QgsExpressionContext QgsCategorizedSymbolRendererWidget::createExpressionContext
|
||||
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
|
||||
<< QgsExpressionContextUtils::atlasScope( nullptr );
|
||||
|
||||
if ( mContext.mapCanvas() )
|
||||
if ( auto *lMapCanvas = mContext.mapCanvas() )
|
||||
{
|
||||
expContext << QgsExpressionContextUtils::mapSettingsScope( mContext.mapCanvas()->mapSettings() )
|
||||
<< new QgsExpressionContextScope( mContext.mapCanvas()->expressionContextScope() );
|
||||
if ( const QgsExpressionContextScopeGenerator *generator = dynamic_cast< const QgsExpressionContextScopeGenerator * >( mContext.mapCanvas()->temporalController() ) )
|
||||
expContext << QgsExpressionContextUtils::mapSettingsScope( lMapCanvas->mapSettings() )
|
||||
<< new QgsExpressionContextScope( lMapCanvas->expressionContextScope() );
|
||||
if ( const QgsExpressionContextScopeGenerator *generator = dynamic_cast< const QgsExpressionContextScopeGenerator * >( lMapCanvas->temporalController() ) )
|
||||
{
|
||||
expContext << generator->createExpressionContextScope();
|
||||
}
|
||||
@ -1222,8 +1222,8 @@ QgsExpressionContext QgsCategorizedSymbolRendererWidget::createExpressionContext
|
||||
expContext << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() );
|
||||
}
|
||||
|
||||
if ( vectorLayer() )
|
||||
expContext << QgsExpressionContextUtils::layerScope( vectorLayer() );
|
||||
if ( auto *lVectorLayer = vectorLayer() )
|
||||
expContext << QgsExpressionContextUtils::layerScope( lVectorLayer );
|
||||
|
||||
// additional scopes
|
||||
const auto constAdditionalExpressionContextScopes = mContext.additionalExpressionContextScopes();
|
||||
|
@ -419,11 +419,11 @@ QgsExpressionContext QgsGraduatedSymbolRendererWidget::createExpressionContext()
|
||||
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
|
||||
<< QgsExpressionContextUtils::atlasScope( nullptr );
|
||||
|
||||
if ( mContext.mapCanvas() )
|
||||
if ( auto *lMapCanvas = mContext.mapCanvas() )
|
||||
{
|
||||
expContext << QgsExpressionContextUtils::mapSettingsScope( mContext.mapCanvas()->mapSettings() )
|
||||
<< new QgsExpressionContextScope( mContext.mapCanvas()->expressionContextScope() );
|
||||
if ( const QgsExpressionContextScopeGenerator *generator = dynamic_cast< const QgsExpressionContextScopeGenerator * >( mContext.mapCanvas()->temporalController() ) )
|
||||
expContext << QgsExpressionContextUtils::mapSettingsScope( lMapCanvas->mapSettings() )
|
||||
<< new QgsExpressionContextScope( lMapCanvas->expressionContextScope() );
|
||||
if ( const QgsExpressionContextScopeGenerator *generator = dynamic_cast< const QgsExpressionContextScopeGenerator * >( lMapCanvas->temporalController() ) )
|
||||
{
|
||||
expContext << generator->createExpressionContextScope();
|
||||
}
|
||||
@ -433,8 +433,8 @@ QgsExpressionContext QgsGraduatedSymbolRendererWidget::createExpressionContext()
|
||||
expContext << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() );
|
||||
}
|
||||
|
||||
if ( vectorLayer() )
|
||||
expContext << QgsExpressionContextUtils::layerScope( vectorLayer() );
|
||||
if ( auto *lVectorLayer = vectorLayer() )
|
||||
expContext << QgsExpressionContextUtils::layerScope( lVectorLayer );
|
||||
|
||||
// additional scopes
|
||||
const auto constAdditionalExpressionContextScopes = mContext.additionalExpressionContextScopes();
|
||||
|
@ -42,11 +42,11 @@ QgsExpressionContext QgsHeatmapRendererWidget::createExpressionContext() const
|
||||
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
|
||||
<< QgsExpressionContextUtils::atlasScope( nullptr );
|
||||
|
||||
if ( mContext.mapCanvas() )
|
||||
if ( auto *lMapCanvas = mContext.mapCanvas() )
|
||||
{
|
||||
expContext << QgsExpressionContextUtils::mapSettingsScope( mContext.mapCanvas()->mapSettings() )
|
||||
<< new QgsExpressionContextScope( mContext.mapCanvas()->expressionContextScope() );
|
||||
if ( const QgsExpressionContextScopeGenerator *generator = dynamic_cast< const QgsExpressionContextScopeGenerator * >( mContext.mapCanvas()->temporalController() ) )
|
||||
expContext << QgsExpressionContextUtils::mapSettingsScope( lMapCanvas->mapSettings() )
|
||||
<< new QgsExpressionContextScope( lMapCanvas->expressionContextScope() );
|
||||
if ( const QgsExpressionContextScopeGenerator *generator = dynamic_cast< const QgsExpressionContextScopeGenerator * >( lMapCanvas->temporalController() ) )
|
||||
{
|
||||
expContext << generator->createExpressionContextScope();
|
||||
}
|
||||
@ -56,8 +56,8 @@ QgsExpressionContext QgsHeatmapRendererWidget::createExpressionContext() const
|
||||
expContext << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() );
|
||||
}
|
||||
|
||||
if ( vectorLayer() )
|
||||
expContext << QgsExpressionContextUtils::layerScope( vectorLayer() );
|
||||
if ( auto *lVectorLayer = vectorLayer() )
|
||||
expContext << QgsExpressionContextUtils::layerScope( lVectorLayer );
|
||||
|
||||
// additional scopes
|
||||
const auto constAdditionalExpressionContextScopes = mContext.additionalExpressionContextScopes();
|
||||
@ -149,8 +149,8 @@ QgsFeatureRenderer *QgsHeatmapRendererWidget::renderer()
|
||||
void QgsHeatmapRendererWidget::setContext( const QgsSymbolWidgetContext &context )
|
||||
{
|
||||
QgsRendererWidget::setContext( context );
|
||||
if ( context.mapCanvas() )
|
||||
mRadiusUnitWidget->setMapCanvas( context.mapCanvas() );
|
||||
if ( auto *lMapCanvas = context.mapCanvas() )
|
||||
mRadiusUnitWidget->setMapCanvas( lMapCanvas );
|
||||
}
|
||||
|
||||
void QgsHeatmapRendererWidget::applyColorRamp()
|
||||
|
@ -228,19 +228,19 @@ void QgsLayerPropertiesWidget::updateSymbolLayerWidget( QgsSymbolLayer *layer )
|
||||
|
||||
QgsExpressionContext QgsLayerPropertiesWidget::createExpressionContext() const
|
||||
{
|
||||
if ( mContext.expressionContext() )
|
||||
return *mContext.expressionContext();
|
||||
if ( auto *lExpressionContext = mContext.expressionContext() )
|
||||
return *lExpressionContext;
|
||||
|
||||
QgsExpressionContext expContext;
|
||||
expContext << QgsExpressionContextUtils::globalScope()
|
||||
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
|
||||
<< QgsExpressionContextUtils::atlasScope( nullptr );
|
||||
|
||||
if ( mContext.mapCanvas() )
|
||||
if ( auto *lMapCanvas = mContext.mapCanvas() )
|
||||
{
|
||||
expContext << QgsExpressionContextUtils::mapSettingsScope( mContext.mapCanvas()->mapSettings() )
|
||||
<< new QgsExpressionContextScope( mContext.mapCanvas()->expressionContextScope() );
|
||||
if ( const QgsExpressionContextScopeGenerator *generator = dynamic_cast< const QgsExpressionContextScopeGenerator * >( mContext.mapCanvas()->temporalController() ) )
|
||||
expContext << QgsExpressionContextUtils::mapSettingsScope( lMapCanvas->mapSettings() )
|
||||
<< new QgsExpressionContextScope( lMapCanvas->expressionContextScope() );
|
||||
if ( const QgsExpressionContextScopeGenerator *generator = dynamic_cast< const QgsExpressionContextScopeGenerator * >( lMapCanvas->temporalController() ) )
|
||||
{
|
||||
expContext << generator->createExpressionContextScope();
|
||||
}
|
||||
|
@ -200,8 +200,8 @@ void QgsPointClusterRendererWidget::blockAllSignals( bool block )
|
||||
QgsExpressionContext QgsPointClusterRendererWidget::createExpressionContext() const
|
||||
{
|
||||
QgsExpressionContext context;
|
||||
if ( mContext.expressionContext() )
|
||||
context = *mContext.expressionContext();
|
||||
if ( auto *lExpressionContext = mContext.expressionContext() )
|
||||
context = *lExpressionContext;
|
||||
else
|
||||
context.appendScopes( mContext.globalProjectAtlasMapLayerScopes( mLayer ) );
|
||||
QgsExpressionContextScope scope;
|
||||
|
@ -205,8 +205,8 @@ void QgsPointDisplacementRendererWidget::setContext( const QgsSymbolWidgetContex
|
||||
QgsExpressionContext QgsPointDisplacementRendererWidget::createExpressionContext() const
|
||||
{
|
||||
QgsExpressionContext context;
|
||||
if ( mContext.expressionContext() )
|
||||
context = *mContext.expressionContext();
|
||||
if ( auto *lExpressionContext = mContext.expressionContext() )
|
||||
context = *lExpressionContext;
|
||||
else
|
||||
context.appendScopes( mContext.globalProjectAtlasMapLayerScopes( mLayer ) );
|
||||
QgsExpressionContextScope scope;
|
||||
|
@ -407,12 +407,12 @@ QgsExpressionContext QgsDataDefinedValueDialog::createExpressionContext() const
|
||||
expContext << QgsExpressionContextUtils::globalScope()
|
||||
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
|
||||
<< QgsExpressionContextUtils::atlasScope( nullptr );
|
||||
if ( mContext.mapCanvas() )
|
||||
if ( auto *lMapCanvas = mContext.mapCanvas() )
|
||||
{
|
||||
expContext << QgsExpressionContextUtils::mapSettingsScope( mContext.mapCanvas()->mapSettings() )
|
||||
<< new QgsExpressionContextScope( mContext.mapCanvas()->expressionContextScope() );
|
||||
expContext << QgsExpressionContextUtils::mapSettingsScope( lMapCanvas->mapSettings() )
|
||||
<< new QgsExpressionContextScope( lMapCanvas->expressionContextScope() );
|
||||
|
||||
if ( const QgsExpressionContextScopeGenerator *generator = dynamic_cast< const QgsExpressionContextScopeGenerator * >( mContext.mapCanvas()->temporalController() ) )
|
||||
if ( const QgsExpressionContextScopeGenerator *generator = dynamic_cast< const QgsExpressionContextScopeGenerator * >( lMapCanvas->temporalController() ) )
|
||||
{
|
||||
expContext << generator->createExpressionContextScope();
|
||||
}
|
||||
@ -422,8 +422,8 @@ QgsExpressionContext QgsDataDefinedValueDialog::createExpressionContext() const
|
||||
expContext << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() );
|
||||
}
|
||||
|
||||
if ( vectorLayer() )
|
||||
expContext << QgsExpressionContextUtils::layerScope( vectorLayer() );
|
||||
if ( auto *lVectorLayer = vectorLayer() )
|
||||
expContext << QgsExpressionContextUtils::layerScope( lVectorLayer );
|
||||
|
||||
// additional scopes
|
||||
const auto constAdditionalExpressionContextScopes = mContext.additionalExpressionContextScopes();
|
||||
|
@ -61,8 +61,8 @@
|
||||
|
||||
QgsExpressionContext QgsSymbolLayerWidget::createExpressionContext() const
|
||||
{
|
||||
if ( mContext.expressionContext() )
|
||||
return *mContext.expressionContext();
|
||||
if ( auto *lExpressionContext = mContext.expressionContext() )
|
||||
return *lExpressionContext;
|
||||
|
||||
QgsExpressionContext expContext( mContext.globalProjectAtlasMapLayerScopes( vectorLayer() ) );
|
||||
|
||||
|
@ -162,8 +162,8 @@ class SymbolLayerItem : public QStandardItem
|
||||
icon = QgsSymbolLayerUtils::symbolPreviewIcon( mSymbol, mSize );
|
||||
setIcon( icon );
|
||||
|
||||
if ( parent() )
|
||||
static_cast<SymbolLayerItem *>( parent() )->updatePreview();
|
||||
if ( auto *lParent = parent() )
|
||||
static_cast<SymbolLayerItem *>( lParent )->updatePreview();
|
||||
}
|
||||
|
||||
int type() const override { return SYMBOL_LAYER_ITEM_TYPE; }
|
||||
@ -356,9 +356,9 @@ void QgsSymbolSelectorWidget::setContext( const QgsSymbolWidgetContext &context
|
||||
{
|
||||
mContext = context;
|
||||
|
||||
if ( mContext.expressionContext() )
|
||||
if ( auto *lExpressionContext = mContext.expressionContext() )
|
||||
{
|
||||
mPreviewExpressionContext = *mContext.expressionContext();
|
||||
mPreviewExpressionContext = *lExpressionContext;
|
||||
if ( mVectorLayer )
|
||||
mPreviewExpressionContext.appendScope( QgsExpressionContextUtils::layerScope( mVectorLayer ) );
|
||||
|
||||
|
@ -364,8 +364,8 @@ void QgsSymbolsListWidget::updateSymbolColor()
|
||||
|
||||
QgsExpressionContext QgsSymbolsListWidget::createExpressionContext() const
|
||||
{
|
||||
if ( mContext.expressionContext() )
|
||||
return QgsExpressionContext( *mContext.expressionContext() );
|
||||
if ( auto *lExpressionContext = mContext.expressionContext() )
|
||||
return QgsExpressionContext( *lExpressionContext );
|
||||
|
||||
//otherwise create a default symbol context
|
||||
QgsExpressionContext expContext( mContext.globalProjectAtlasMapLayerScopes( layer() ) );
|
||||
|
@ -34,17 +34,17 @@ QgsVectorFieldSymbolLayerWidget::QgsVectorFieldSymbolLayerWidget( QgsVectorLayer
|
||||
mDistanceUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderMapUnits << QgsUnitTypes::RenderPixels
|
||||
<< QgsUnitTypes::RenderPoints << QgsUnitTypes::RenderInches );
|
||||
|
||||
if ( vectorLayer() )
|
||||
if ( auto *lVectorLayer = vectorLayer() )
|
||||
{
|
||||
mXAttributeComboBox->addItem( QString() );
|
||||
mYAttributeComboBox->addItem( QString() );
|
||||
int i = 0;
|
||||
const QgsFields fields = vectorLayer()->fields();
|
||||
const QgsFields fields = lVectorLayer->fields();
|
||||
for ( const QgsField &f : fields )
|
||||
{
|
||||
QString fieldName = f.name();
|
||||
mXAttributeComboBox->addItem( vectorLayer()->fields().iconForField( i ), fieldName );
|
||||
mYAttributeComboBox->addItem( vectorLayer()->fields().iconForField( i ), fieldName );
|
||||
mXAttributeComboBox->addItem( lVectorLayer->fields().iconForField( i ), fieldName );
|
||||
mYAttributeComboBox->addItem( lVectorLayer->fields().iconForField( i ), fieldName );
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -333,9 +333,9 @@ void QgsTableEditorWidget::setTableContents( const QgsTableContents &contents )
|
||||
if ( col.content().value< QgsProperty >().isActive() )
|
||||
item->setFlags( item->flags() & ( ~Qt::ItemIsEditable ) );
|
||||
|
||||
if ( col.numericFormat() )
|
||||
if ( auto *lNumericFormat = col.numericFormat() )
|
||||
{
|
||||
mNumericFormats.insert( item, col.numericFormat()->clone() );
|
||||
mNumericFormats.insert( item, lNumericFormat->clone() );
|
||||
item->setData( Qt::DisplayRole, mNumericFormats.value( item )->formatDouble( col.content().toDouble(), numericContext ) );
|
||||
}
|
||||
setItem( rowNumber, colNumber, item );
|
||||
|
@ -1120,12 +1120,12 @@ QStringList QgsGrassModuleInput::currentLayerCodes()
|
||||
{
|
||||
QStringList list;
|
||||
|
||||
if ( currentLayer() )
|
||||
if ( auto *lCurrentLayer = currentLayer() )
|
||||
{
|
||||
Q_FOREACH ( QString type, currentGeometryTypeNames() )
|
||||
{
|
||||
type.replace( QLatin1String( "area" ), QLatin1String( "polygon" ) );
|
||||
list << QStringLiteral( "%1_%2" ).arg( currentLayer()->number() ).arg( type );
|
||||
list << QStringLiteral( "%1_%2" ).arg( lCurrentLayer->number() ).arg( type );
|
||||
}
|
||||
}
|
||||
QgsDebugMsg( "list = " + list.join( "," ) );
|
||||
|
@ -303,10 +303,10 @@ void QgsArcGisServiceSourceSelect::addButtonClicked()
|
||||
//prepare canvas extent info for layers with "cache features" option not set
|
||||
QgsRectangle extent;
|
||||
QgsCoordinateReferenceSystem canvasCrs;
|
||||
if ( mapCanvas() )
|
||||
if ( auto *lMapCanvas = mapCanvas() )
|
||||
{
|
||||
extent = mapCanvas()->extent();
|
||||
canvasCrs = mapCanvas()->mapSettings().destinationCrs();
|
||||
extent = lMapCanvas->extent();
|
||||
canvasCrs = lMapCanvas->mapSettings().destinationCrs();
|
||||
}
|
||||
//does canvas have "on the fly" reprojection set?
|
||||
if ( pCrs.isValid() && canvasCrs.isValid() )
|
||||
|
@ -1034,9 +1034,9 @@ QgsGrassVectorItem::~QgsGrassVectorItem()
|
||||
|
||||
void QgsGrassVectorItem::onDirectoryChanged()
|
||||
{
|
||||
if ( parent() )
|
||||
if ( auto *lParent = parent() )
|
||||
{
|
||||
parent()->refresh();
|
||||
lParent->refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -602,8 +602,8 @@ QgsMssqlLayerItem *QgsMssqlSchemaItem::addLayer( const QgsMssqlLayerProperty &la
|
||||
|
||||
void QgsMssqlSchemaItem::refresh()
|
||||
{
|
||||
if ( parent() )
|
||||
parent()->refresh();
|
||||
if ( auto *lParent = parent() )
|
||||
lParent->refresh();
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,8 +81,8 @@ QWidget *QgsOracleSourceSelectDelegate::createEditor( QWidget *parent, const QSt
|
||||
if ( values.size() == 0 )
|
||||
{
|
||||
QString ownerName = index.sibling( index.row(), QgsOracleTableModel::DbtmOwner ).data( Qt::DisplayRole ).toString();
|
||||
if ( conn() )
|
||||
values = conn()->pkCandidates( ownerName, tableName );
|
||||
if ( auto *lConn = conn() )
|
||||
values = lConn->pkCandidates( ownerName, tableName );
|
||||
}
|
||||
|
||||
if ( values.size() == 0 )
|
||||
|
@ -4665,17 +4665,17 @@ QString QgsPostgresProvider::description() const
|
||||
QString pgVersion( tr( "PostgreSQL version: unknown" ) );
|
||||
QString postgisVersion( tr( "unknown" ) );
|
||||
|
||||
if ( connectionRO() )
|
||||
if ( auto *lConnectionRO = connectionRO() )
|
||||
{
|
||||
QgsPostgresResult result;
|
||||
|
||||
result = connectionRO()->PQexec( QStringLiteral( "SELECT version()" ) );
|
||||
result = lConnectionRO->PQexec( QStringLiteral( "SELECT version()" ) );
|
||||
if ( result.PQresultStatus() == PGRES_TUPLES_OK )
|
||||
{
|
||||
pgVersion = result.PQgetvalue( 0, 0 );
|
||||
}
|
||||
|
||||
result = connectionRO()->PQexec( QStringLiteral( "SELECT postgis_version()" ) );
|
||||
result = lConnectionRO->PQexec( QStringLiteral( "SELECT postgis_version()" ) );
|
||||
if ( result.PQresultStatus() == PGRES_TUPLES_OK )
|
||||
{
|
||||
postgisVersion = result.PQgetvalue( 0, 0 );
|
||||
|
@ -48,9 +48,9 @@ void QgsQuickAttributeModel::setVectorLayer( QgsVectorLayer *layer )
|
||||
mFeatureLayerPair = QgsQuickFeatureLayerPair( mFeatureLayerPair.feature(), layer );
|
||||
|
||||
|
||||
if ( mFeatureLayerPair.layer() )
|
||||
if ( auto *lLayer = mFeatureLayerPair.layer() )
|
||||
{
|
||||
mRememberedAttributes.resize( mFeatureLayerPair.layer()->fields().size() );
|
||||
mRememberedAttributes.resize( lLayer->fields().size() );
|
||||
mRememberedAttributes.fill( false );
|
||||
}
|
||||
else
|
||||
|
@ -25,9 +25,9 @@ void QgsFeatureFilterProviderGroup::filterFeatures( const QgsVectorLayer *layer,
|
||||
{
|
||||
QgsFeatureRequest temp;
|
||||
provider->filterFeatures( layer, temp );
|
||||
if ( temp.filterExpression() )
|
||||
if ( auto *lFilterExpression = temp.filterExpression() )
|
||||
{
|
||||
filterFeatures.combineFilterExpression( temp.filterExpression()->dump() );
|
||||
filterFeatures.combineFilterExpression( lFilterExpression->dump() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user