Skip to content

Commit

Permalink
Fix #8727
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jan 7, 2014
1 parent 5c307b7 commit 1f9c378
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/mapserver/qgsprojectparser.cpp
Expand Up @@ -1543,9 +1543,7 @@ void QgsProjectParser::addLayerProjectSettings( QDomElement& layerElem, QDomDocu
{
QgsVectorLayer* vLayer = static_cast<QgsVectorLayer*>( currentLayer );
const QSet<QString>& excludedAttributes = vLayer->excludeAttributesWMS();

//displayfield
layerElem.setAttribute( "displayField", vLayer->displayField() );
QString displayField = vLayer->displayField();

//attributes
QDomElement attributesElem = doc.createElement( "Attributes" );
Expand All @@ -1557,6 +1555,11 @@ void QgsProjectParser::addLayerProjectSettings( QDomElement& layerElem, QDomDocu
{
continue;
}
// field alias in case of displayField
if ( field.name() == displayField )
{
displayField = vLayer->attributeDisplayName( idx );
}
QDomElement attributeElem = doc.createElement( "Attribute" );
attributeElem.setAttribute( "name", vLayer->attributeDisplayName( idx ) );
attributeElem.setAttribute( "type", QVariant::typeToName( field.type() ) );
Expand All @@ -1569,6 +1572,8 @@ void QgsProjectParser::addLayerProjectSettings( QDomElement& layerElem, QDomDocu
attributeElem.setAttribute( "precision", field.precision() );
attributesElem.appendChild( attributeElem );
}
//displayfield
layerElem.setAttribute( "displayField", displayField );
layerElem.appendChild( attributesElem );
}
}
Expand Down

0 comments on commit 1f9c378

Please sign in to comment.