Skip to content

Commit

Permalink
Save display expression with qml export
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Feb 28, 2017
1 parent 2ccdac7 commit e20bd88
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) )
{
Expand Down Expand Up @@ -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 );

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit e20bd88

Please sign in to comment.