Skip to content
Permalink
Browse files

avoid using copy/paste style when duplicating layers

  • Loading branch information
SebDieBln committed Nov 21, 2015
1 parent 9c7bbb5 commit 7b5c96c6fffd952f6257f27d527b1bd522a171d4
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/app/qgisapp.cpp
@@ -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 );

0 comments on commit 7b5c96c

Please sign in to comment.
You can’t perform that action at this time.