From 49d7cf2cc271dac0785f17ab20ce8674ed2a383d Mon Sep 17 00:00:00 2001 From: Jacky Volpes Date: Tue, 14 Jan 2025 16:55:10 +0100 Subject: [PATCH] fix(raster-temporal-properties): add global contexts to start/end date expression As a result, variables like @layer_name can be used now. --- src/gui/raster/qgsrasterlayertemporalpropertieswidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/raster/qgsrasterlayertemporalpropertieswidget.cpp b/src/gui/raster/qgsrasterlayertemporalpropertieswidget.cpp index d0b250206d76..1d4d9dc9780d 100644 --- a/src/gui/raster/qgsrasterlayertemporalpropertieswidget.cpp +++ b/src/gui/raster/qgsrasterlayertemporalpropertieswidget.cpp @@ -236,6 +236,7 @@ void QgsRasterLayerTemporalPropertiesWidget::calculateRangeByExpression( bool is bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band_description" ), mLayer->dataProvider()->bandDescription( 1 ), true, false, tr( "Band description" ) ) ); expressionContext.appendScope( bandScope ); + expressionContext.appendScopes( QgsExpressionContextUtils::globalProjectLayerScopes( mLayer ) ); expressionContext.setHighlightedVariables( { QStringLiteral( "band" ), QStringLiteral( "band_name" ), QStringLiteral( "band_description" ) } ); QgsExpressionBuilderDialog dlg = QgsExpressionBuilderDialog( nullptr, isUpper ? mFixedRangeUpperExpression : mFixedRangeLowerExpression, this, QStringLiteral( "generic" ), expressionContext );