Skip to content
Permalink
Browse files
Don't assign all layer style warnings to the "Symbology" group, and
instead refine the categories to more accurate groups
  • Loading branch information
nyalldawson committed May 24, 2021
1 parent e3baef2 commit abf5a8a3c5f1e8b7ee1a89bc2a38ae5c6e2e1e48
Showing with 17 additions and 2 deletions.
  1. +6 −0 src/core/qgsmaplayer.cpp
  2. +11 −2 src/core/vector/qgsvectorlayer.cpp
@@ -1743,6 +1743,8 @@ void QgsMapLayer::readCommonStyle( const QDomElement &layerElement, const QgsRea
{
if ( categories.testFlag( Symbology3D ) )
{
QgsReadWriteContextCategoryPopper p = context.enterCategory( tr( "3D Symbology" ) );

QgsAbstract3DRenderer *r3D = nullptr;
QDomElement renderer3DElem = layerElement.firstChildElement( QStringLiteral( "renderer-3d" ) );
if ( !renderer3DElem.isNull() )
@@ -1803,12 +1805,16 @@ void QgsMapLayer::readCommonStyle( const QDomElement &layerElement, const QgsRea

if ( categories.testFlag( Temporal ) )
{
QgsReadWriteContextCategoryPopper p = context.enterCategory( tr( "Temporal" ) );

if ( QgsMapLayerTemporalProperties *properties = temporalProperties() )
properties->readXml( layerElement.toElement(), context );
}

if ( categories.testFlag( Elevation ) )
{
QgsReadWriteContextCategoryPopper p = context.enterCategory( tr( "Elevation" ) );

if ( QgsMapLayerElevationProperties *properties = elevationProperties() )
properties->readXml( layerElement.toElement(), context );
}
@@ -2151,8 +2151,6 @@ void QgsVectorLayer::resolveReferences( QgsProject *project )
bool QgsVectorLayer::readSymbology( const QDomNode &layerNode, QString &errorMessage,
QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories )
{
QgsReadWriteContextCategoryPopper p = context.enterCategory( tr( "Symbology" ) );

if ( categories.testFlag( Fields ) )
{
if ( !mExpressionFieldBuffer )
@@ -2164,6 +2162,7 @@ bool QgsVectorLayer::readSymbology( const QDomNode &layerNode, QString &errorMes

if ( categories.testFlag( Relations ) )
{
QgsReadWriteContextCategoryPopper p = context.enterCategory( tr( "Relations" ) );

const QgsPathResolver resolver { QgsProject::instance()->pathResolver() };

@@ -2346,6 +2345,8 @@ bool QgsVectorLayer::readSymbology( const QDomNode &layerNode, QString &errorMes
// load field configuration
if ( categories.testFlag( Fields ) || categories.testFlag( Forms ) )
{
QgsReadWriteContextCategoryPopper p = context.enterCategory( tr( "Forms" ) );

QDomElement widgetsElem = layerNode.namedItem( QStringLiteral( "fieldConfiguration" ) ).toElement();
QDomNodeList fieldConfigurationElementList = widgetsElem.elementsByTagName( QStringLiteral( "field" ) );
for ( int i = 0; i < fieldConfigurationElementList.size(); ++i )
@@ -2427,6 +2428,8 @@ bool QgsVectorLayer::readSymbology( const QDomNode &layerNode, QString &errorMes

if ( categories.testFlag( Legend ) )
{
QgsReadWriteContextCategoryPopper p = context.enterCategory( tr( "Legend" ) );

const QDomElement legendElem = layerNode.firstChildElement( QStringLiteral( "legend" ) );
if ( !legendElem.isNull() )
{
@@ -2458,6 +2461,8 @@ bool QgsVectorLayer::readStyle( const QDomNode &node, QString &errorMessage,
// try renderer v2 first
if ( categories.testFlag( Symbology ) )
{
QgsReadWriteContextCategoryPopper p = context.enterCategory( tr( "Symbology" ) );

QDomElement rendererElement = node.firstChildElement( RENDERER_TAG_NAME );
if ( !rendererElement.isNull() )
{
@@ -2481,6 +2486,8 @@ bool QgsVectorLayer::readStyle( const QDomNode &node, QString &errorMessage,
// read labeling definition
if ( categories.testFlag( Labeling ) )
{
QgsReadWriteContextCategoryPopper p = context.enterCategory( tr( "Labeling" ) );

QDomElement labelingElement = node.firstChildElement( QStringLiteral( "labeling" ) );
QgsAbstractVectorLayerLabeling *labeling = nullptr;
if ( labelingElement.isNull() ||
@@ -2571,6 +2578,8 @@ bool QgsVectorLayer::readStyle( const QDomNode &node, QString &errorMessage,
//diagram renderer and diagram layer settings
if ( categories.testFlag( Diagrams ) )
{
QgsReadWriteContextCategoryPopper p = context.enterCategory( tr( "Diagrams" ) );

delete mDiagramRenderer;
mDiagramRenderer = nullptr;
QDomElement singleCatDiagramElem = node.firstChildElement( QStringLiteral( "SingleCategoryDiagramRenderer" ) );

0 comments on commit abf5a8a

Please sign in to comment.