Skip to content

Commit

Permalink
avoid using copy/paste style when duplicating layers
Browse files Browse the repository at this point in the history
  • Loading branch information
SebDieBln committed Nov 21, 2015
1 parent 9c7bbb5 commit 7b5c96c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7469,8 +7469,15 @@ void QgisApp::duplicateLayers( const QList<QgsMapLayer *>& lyrList )
nodeDupLayer->setVisible( Qt::Unchecked );

// duplicate the layer style
copyStyle( selectedLyr );
pasteStyle( dupLayer );
QString errMsg;
QDomDocument style;
selectedLyr->exportNamedStyle( style, errMsg );
if ( errMsg.isEmpty() )
dupLayer->importNamedStyle( style, errMsg );
if ( !errMsg.isEmpty() )
messageBar()->pushMessage( errMsg,
tr( "Cannot copy style to duplicated layer." ),
QgsMessageBar::CRITICAL, messageTimeout() );

QgsVectorLayer* vLayer = dynamic_cast<QgsVectorLayer*>( selectedLyr );
QgsVectorLayer* vDupLayer = dynamic_cast<QgsVectorLayer*>( dupLayer );
Expand Down

0 comments on commit 7b5c96c

Please sign in to comment.