Skip to content

Commit 892ac6c

Browse files
author
mhugent
committed
Move reading/writing of label style to qgsvectorlayer. Change argument in readCustomProperties to const. Fixes problem with mixed label settings between qgis server projects
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15235 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 574908d commit 892ac6c

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/core/qgsmaplayer.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,6 @@ QString QgsMapLayer::loadNamedStyle( const QString theURI, bool &theResultFlag )
626626
return myErrorMessage;
627627
}
628628

629-
//also restore custom properties (for labeling-ng)
630-
readCustomProperties( myRoot, "labeling" );
631-
632629
return "";
633630
}
634631

@@ -668,9 +665,6 @@ QString QgsMapLayer::saveNamedStyle( const QString theURI, bool & theResultFlag
668665
return tr( "Could not save symbology because:\n%1" ).arg( errorMsg );
669666
}
670667

671-
//save customproperties (for labeling ng)
672-
writeCustomProperties( myRootNode, myDocument );
673-
674668
// check if the uri is a file or ends with .qml,
675669
// which indicates that it should become one
676670
// everything else goes to the database
@@ -827,7 +821,7 @@ void QgsMapLayer::removeCustomProperty( const QString& key )
827821
mCustomProperties.remove( key );
828822
}
829823

830-
void QgsMapLayer::readCustomProperties( QDomNode & layerNode, const QString& keyStartsWith )
824+
void QgsMapLayer::readCustomProperties( const QDomNode& layerNode, const QString& keyStartsWith )
831825
{
832826
QDomNode propsNode = layerNode.namedItem( "customproperties" );
833827
if ( propsNode.isNull() ) // no properties stored...

src/core/qgsmaplayer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
384384
/** Read custom properties from project file. Added in v1.4
385385
@param layerNode note to read from
386386
@param keyStartsWith reads only properties starting with the specified string (or all if the string is empty)*/
387-
void readCustomProperties( QDomNode & layerNode, const QString& keyStartsWith = "" );
387+
void readCustomProperties( const QDomNode& layerNode, const QString& keyStartsWith = "" );
388388

389389
/** Write custom properties to project file. Added in v1.4 */
390390
void writeCustomProperties( QDomNode & layerNode, QDomDocument & doc ) const;

src/core/qgsvectorlayer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2914,6 +2914,9 @@ bool QgsVectorLayer::readSymbology( const QDomNode& node, QString& errorMessage
29142914
mLabel->setMinScale( e.attribute( "minLabelScale", "1" ).toFloat() );
29152915
mLabel->setMaxScale( e.attribute( "maxLabelScale", "100000000" ).toFloat() );
29162916

2917+
//also restore custom properties (for labeling-ng)
2918+
readCustomProperties( node, "labeling" );
2919+
29172920
// Test if labeling is on or off
29182921
QDomNode labelnode = node.namedItem( "label" );
29192922
QDomElement element = labelnode.toElement();
@@ -3069,6 +3072,9 @@ bool QgsVectorLayer::writeSymbology( QDomNode& node, QDomDocument& doc, QString&
30693072
}
30703073
}
30713074

3075+
//save customproperties (for labeling ng)
3076+
writeCustomProperties( node, doc );
3077+
30723078
// add the display field
30733079
QDomElement dField = doc.createElement( "displayfield" );
30743080
QDomText dFieldText = doc.createTextNode( displayField() );

0 commit comments

Comments
 (0)