mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Move wms/wfs exclude legacy attributes reading after field flags reading
so they don't get overriden
This commit is contained in:
parent
9f2b50be6e
commit
94fd3d9723
@ -2311,28 +2311,6 @@ bool QgsVectorLayer::readSymbology( const QDomNode &layerNode, QString &errorMes
|
||||
}
|
||||
|
||||
updateFields();
|
||||
|
||||
// Legacy reading for QGIS 3.14 and older projects
|
||||
// Attributes excluded from WMS and WFS
|
||||
const QList<QPair<QString, QgsField::ConfigurationFlag>> legacyConfig
|
||||
{
|
||||
qMakePair( QStringLiteral( "excludeAttributesWMS" ), QgsField::ConfigurationFlag::HideFromWms ),
|
||||
qMakePair( QStringLiteral( "excludeAttributesWFS" ), QgsField::ConfigurationFlag::HideFromWfs )
|
||||
};
|
||||
for ( const auto &config : legacyConfig )
|
||||
{
|
||||
QDomNode excludeNode = layerNode.namedItem( config.first );
|
||||
if ( !excludeNode.isNull() )
|
||||
{
|
||||
QDomNodeList attributeNodeList = excludeNode.toElement().elementsByTagName( QStringLiteral( "attribute" ) );
|
||||
for ( int i = 0; i < attributeNodeList.size(); ++i )
|
||||
{
|
||||
QString fieldName = attributeNodeList.at( i ).toElement().text();
|
||||
int index = mFields.indexFromName( fieldName );
|
||||
setFieldConfigurationFlag( index, config.second, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// load field configuration
|
||||
@ -2367,6 +2345,31 @@ bool QgsVectorLayer::readSymbology( const QDomNode &layerNode, QString &errorMes
|
||||
}
|
||||
}
|
||||
|
||||
// Legacy reading for QGIS 3.14 and older projects
|
||||
// Attributes excluded from WMS and WFS
|
||||
if ( categories.testFlag( Fields ) )
|
||||
{
|
||||
const QList<QPair<QString, QgsField::ConfigurationFlag>> legacyConfig
|
||||
{
|
||||
qMakePair( QStringLiteral( "excludeAttributesWMS" ), QgsField::ConfigurationFlag::HideFromWms ),
|
||||
qMakePair( QStringLiteral( "excludeAttributesWFS" ), QgsField::ConfigurationFlag::HideFromWfs )
|
||||
};
|
||||
for ( const auto &config : legacyConfig )
|
||||
{
|
||||
QDomNode excludeNode = layerNode.namedItem( config.first );
|
||||
if ( !excludeNode.isNull() )
|
||||
{
|
||||
QDomNodeList attributeNodeList = excludeNode.toElement().elementsByTagName( QStringLiteral( "attribute" ) );
|
||||
for ( int i = 0; i < attributeNodeList.size(); ++i )
|
||||
{
|
||||
QString fieldName = attributeNodeList.at( i ).toElement().text();
|
||||
int index = mFields.indexFromName( fieldName );
|
||||
setFieldConfigurationFlag( index, config.second, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( categories.testFlag( GeometryOptions ) )
|
||||
mGeometryOptions->readXml( layerNode.namedItem( QStringLiteral( "geometryOptions" ) ) );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user