From 3dbf70ffe5a9786c344a16f3f4c8314b27f908b2 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Wed, 21 Jan 2015 12:05:03 +0100 Subject: [PATCH] Offline editing: preserve scale based visibility --- src/core/qgsofflineediting.cpp | 8 +++----- src/core/qgsofflineediting.h | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/core/qgsofflineediting.cpp b/src/core/qgsofflineediting.cpp index 08c41b6fee1..9f644949d78 100644 --- a/src/core/qgsofflineediting.cpp +++ b/src/core/qgsofflineediting.cpp @@ -838,17 +838,15 @@ void QgsOfflineEditing::updateFidLookup( QgsVectorLayer* remoteLayer, sqlite3* d } } -void QgsOfflineEditing::copySymbology( const QgsVectorLayer* sourceLayer, QgsVectorLayer* targetLayer ) +void QgsOfflineEditing::copySymbology( QgsVectorLayer* sourceLayer, QgsVectorLayer* targetLayer ) { QString error; QDomDocument doc; - QDomElement node = doc.createElement( "symbology" ); - doc.appendChild( node ); - sourceLayer->writeSymbology( node, doc, error ); + sourceLayer->exportNamedStyle( doc, error ); if ( error.isEmpty() ) { - targetLayer->readSymbology( node, error ); + targetLayer->importNamedStyle( doc, error ); } if ( !error.isEmpty() ) { diff --git a/src/core/qgsofflineediting.h b/src/core/qgsofflineediting.h index d69f8f5f5e5..aaa50ae3135 100644 --- a/src/core/qgsofflineediting.h +++ b/src/core/qgsofflineediting.h @@ -104,7 +104,7 @@ class CORE_EXPORT QgsOfflineEditing : public QObject void applyAttributeValueChanges( QgsVectorLayer* offlineLayer, QgsVectorLayer* remoteLayer, sqlite3* db, int layerId, int commitNo ); void applyGeometryChanges( QgsVectorLayer* remoteLayer, sqlite3* db, int layerId, int commitNo ); void updateFidLookup( QgsVectorLayer* remoteLayer, sqlite3* db, int layerId ); - void copySymbology( const QgsVectorLayer* sourceLayer, QgsVectorLayer* targetLayer ); + void copySymbology( QgsVectorLayer* sourceLayer, QgsVectorLayer* targetLayer ); QMap attributeLookup( QgsVectorLayer* offlineLayer, QgsVectorLayer* remoteLayer ); void showWarning( const QString& message );