Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Commit

Permalink
fix #15 use existing fieldName for simple label else use the first fi…
Browse files Browse the repository at this point in the history
…eld name
  • Loading branch information
lbartoletti committed Jun 25, 2019
1 parent 9aa2603 commit c49d74b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion label_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,12 @@ def createDefinedProperties(self):

pal_layer = QgsPalLayerSettings()
pal_layer.setDataDefinedProperties(pc)
pal_layer.fieldName = self.layer.fields()[0].name()
if self.layer.labeling().settings().fieldName == '':
pal_layer.fieldName = self.layer.fields()[0].name()
pal_layer.isExpression = False
else:
pal_layer.fieldName = self.layer.labeling().settings().fieldName
pal_layer.isExpression = self.layer.labeling().settings().isExpression
if self.layer.geometryType() == QgsWkbTypes.LineGeometry:
pal_layer.placement = QgsPalLayerSettings.Line
pal_layer.enabled = True
Expand Down

0 comments on commit c49d74b

Please sign in to comment.