Skip to content
Permalink
Browse files

Save display expression with qml export

  • Loading branch information
m-kuhn committed Feb 28, 2017
1 parent 2ccdac7 commit e20bd88149c95a992e437421383a3a7b2053e2bf
Showing with 19 additions and 19 deletions.
  1. +19 −19 src/core/qgsvectorlayer.cpp
@@ -1655,18 +1655,6 @@ bool QgsVectorLayer::readXml( const QDomNode& layer_node )
updateFields();
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( checkJoinLayerRemove( QString ) ) );

QDomNode prevExpNode = layer_node.namedItem( "previewExpression" );

if ( prevExpNode.isNull() )
{
mDisplayExpression = "";
}
else
{
QDomElement prevExpElem = prevExpNode.toElement();
mDisplayExpression = prevExpElem.text();
}

QString errorMsg;
if ( !readSymbology( layer_node, errorMsg ) )
{
@@ -1852,12 +1840,6 @@ bool QgsVectorLayer::writeXml( QDomNode & layer_node,
layer_node.appendChild( provider );
}

// save preview expression
QDomElement prevExpElem = document.createElement( "previewExpression" );
QDomText prevExpText = document.createTextNode( mDisplayExpression );
prevExpElem.appendChild( prevExpText );
layer_node.appendChild( prevExpElem );

//save joins
mJoinBuffer->writeXml( layer_node, document );

@@ -1976,13 +1958,25 @@ bool QgsVectorLayer::readSymbology( const QDomNode& node, QString& errorMessage

mConditionalStyles->readXml( node );

QDomNode prevExpNode = node.namedItem( "previewExpression" );

if ( prevExpNode.isNull() )
{
mDisplayExpression = "";
}
else
{
QDomElement prevExpElem = prevExpNode.toElement();
mDisplayExpression = prevExpElem.text();
}


readCustomProperties( node, "variable" );

QDomElement mapLayerNode = node.toElement();
if ( mapLayerNode.attribute( "readOnly", "0" ).toInt() == 1 )
mReadOnly = true;


return true;
}

@@ -2193,6 +2187,12 @@ bool QgsVectorLayer::writeSymbology( QDomNode& node, QDomDocument& doc, QString&
}
node.appendChild( defaultsElem );

// preview expression
QDomElement prevExpElem = doc.createElement( "previewExpression" );
QDomText prevExpText = doc.createTextNode( mDisplayExpression );
prevExpElem.appendChild( prevExpText );
node.appendChild( prevExpElem );

return true;
}

0 comments on commit e20bd88

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