Skip to content

Commit

Permalink
Auto-select newly duplicated layers in layer tree
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 19, 2018
1 parent 20d9427 commit 11fc287
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -9231,6 +9231,7 @@ void QgisApp::duplicateLayers( const QList<QgsMapLayer *> &lyrList )

freezeCanvases();
QgsMapLayer *dupLayer = nullptr;
QgsMapLayer *newSelection = nullptr;
QString layerDupName, unSppType;
QList<QgsMessageBarItem *> msgBars;

Expand Down Expand Up @@ -9327,10 +9328,17 @@ void QgisApp::duplicateLayers( const QList<QgsMapLayer *> &lyrList )
messageBar()->pushMessage( errMsg,
tr( "Cannot copy style to duplicated layer." ),
Qgis::Critical, messageTimeout() );

if ( !newSelection )
newSelection = dupLayer;
}

dupLayer = nullptr;

// auto select first new duplicate layer
if ( newSelection )
setActiveLayer( newSelection );

freezeCanvases( false );

// display errors in message bar after duplication of layers
Expand Down

1 comment on commit 11fc287

@nirvn
Copy link
Contributor

@nirvn nirvn commented on 11fc287 Mar 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, nice.

Please sign in to comment.