From 9ec2d1f99b3a6f9c1f4284a490743c33a06761aa Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Wed, 28 Mar 2018 08:46:53 +0200 Subject: [PATCH] Make first layer selected on project load just spare a click --- src/app/qgisapp.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 4ee08f3bf5b..e1ed605a85b 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -5591,6 +5591,12 @@ bool QgisApp::addProject( const QString &projectFile ) mActionFilterLegend->setChecked( QgsProject::instance()->readBoolEntry( QStringLiteral( "Legend" ), QStringLiteral( "filterByMap" ) ) ); + // Select the first layer + if ( mLayerTreeView->layerTreeModel()->rootGroup()->findLayers().count() > 0 ) + { + mLayerTreeView->setCurrentLayer( mLayerTreeView->layerTreeModel()->rootGroup()->findLayers().at( 0 )->layer() ); + } + QgsSettings settings; #ifdef WITH_BINDINGS