File tree 1 file changed +14
-5
lines changed
1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -3000,9 +3000,12 @@ QgsPalLabeling::~QgsPalLabeling()
3000
3000
3001
3001
bool QgsPalLabeling::willUseLayer ( QgsVectorLayer* layer )
3002
3002
{
3003
- QgsPalLayerSettings lyrTmp;
3004
- lyrTmp.readFromLayer ( layer );
3005
- return lyrTmp.enabled ;
3003
+ // don't do QgsPalLayerSettings::readFromLayer( layer ) if not needed
3004
+ bool enabled = false ;
3005
+ if ( layer->customProperty ( " labeling" ).toString () == QString ( " pal" ) )
3006
+ enabled = layer->customProperty ( " labeling/enabled" , QVariant ( false ) ).toBool ();
3007
+
3008
+ return enabled;
3006
3009
}
3007
3010
3008
3011
void QgsPalLabeling::clearActiveLayers ()
@@ -3031,14 +3034,20 @@ void QgsPalLabeling::clearActiveLayer( QgsVectorLayer* layer )
3031
3034
3032
3035
int QgsPalLabeling::prepareLayer ( QgsVectorLayer* layer, QSet<int >& attrIndices, QgsRenderContext& ctx )
3033
3036
{
3034
- QgsDebugMsgLevel ( " PREPARE LAYER " + layer->id (), 4 );
3035
3037
Q_ASSERT ( mMapRenderer != NULL );
3036
3038
3039
+ if ( !willUseLayer ( layer ) )
3040
+ {
3041
+ return 0 ;
3042
+ }
3043
+
3044
+ QgsDebugMsgLevel ( " PREPARE LAYER " + layer->id (), 4 );
3045
+
3037
3046
// start with a temporary settings class, find out labeling info
3038
3047
QgsPalLayerSettings lyrTmp;
3039
3048
lyrTmp.readFromLayer ( layer );
3040
3049
3041
- if ( !lyrTmp. enabled || lyrTmp.fieldName .isEmpty () )
3050
+ if ( lyrTmp.fieldName .isEmpty () )
3042
3051
{
3043
3052
return 0 ;
3044
3053
}
You can’t perform that action at this time.
0 commit comments