Apply suggestions from code review

This commit is contained in:
Nyall Dawson 2025-06-24 10:08:18 +10:00
parent f24d4c4f3d
commit 1a019895c9

View File

@ -498,9 +498,8 @@ void QgsLayoutMapWidget::aboutToShowLayersMenu()
QAction *action = new QAction( icon, text, mLayersMenu );
action->setToolTip( tooltip );
connect( action, &QAction::triggered, this, [=] {
QgsMapLayer *layer = QgsProject::instance()->mapLayer( layerId );
if ( layer )
connect( action, &QAction::triggered, this, [this, layerId] {
if ( QgsMapLayer *layer = QgsProject::instance()->mapLayer( layerId ) )
{
setToCustomExtent( QgsReferencedRectangle( layer->extent(), layer->crs() ) );
}