Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[vector tiles] Fix editing of label styles results in missing labels
  • Loading branch information
nirvn authored and github-actions[bot] committed Apr 9, 2023
1 parent bac0de2 commit 9d192cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/core/labeling/qgsvectorlayerlabelprovider.cpp
Expand Up @@ -809,3 +809,8 @@ const QgsPalLayerSettings &QgsVectorLayerLabelProvider::settings() const
{
return mSettings;
}

void QgsVectorLayerLabelProvider::setFields( const QgsFields &fields )
{
mFields = fields;
}
4 changes: 3 additions & 1 deletion src/core/labeling/qgsvectorlayerlabelprovider.h
Expand Up @@ -116,7 +116,7 @@ class CORE_EXPORT QgsVectorLayerLabelProvider : public QgsAbstractLabelProvider
* a call to prepare() which uses the list of fields.
* \since QGIS 3.14
*/
void setFields( const QgsFields &fields ) { mFields = fields; }
void setFields( const QgsFields &fields );

protected:
//! initialization method - called from constructors
Expand Down Expand Up @@ -147,6 +147,8 @@ class CORE_EXPORT QgsVectorLayerLabelProvider : public QgsAbstractLabelProvider
private:

friend class TestQgsLabelingEngine;
friend class QgsVectorTileBasicLabelProvider;

void drawCallout( QgsRenderContext &context, pal::LabelPosition *label ) const;
};

Expand Down
2 changes: 2 additions & 0 deletions src/core/vectortile/qgsvectortilebasiclabeling.cpp
Expand Up @@ -186,6 +186,8 @@ bool QgsVectorTileBasicLabelProvider::prepare( QgsRenderContext &context, QSet<Q
QgsExpressionContextScopePopper popper( context.expressionContext(), scope );

mSubProviders[i]->setFields( fields );
// check is required as fields are not available through the GUI, which can lead to isExpression wrongly set to true
mSubProviders[i]->mSettings.isExpression = !fields.names().contains( mSubProviders[i]->mSettings.fieldName );
if ( !mSubProviders[i]->prepare( context, attributeNames ) )
{
QgsDebugMsg( QStringLiteral( "Failed to prepare labeling for style index" ) + QString::number( i ) );
Expand Down

0 comments on commit 9d192cc

Please sign in to comment.