I have got a layer with distance vectors between polygons. This layer has a rule based style where I can check each polygon to show only the vectors with contact to the polygon. Each vector has as an attribute the start and the endpoint (name of polygon)

I want to add a rule based labeling which should depend on the chosen stylename. Is there a function like "$get_active_stylename" which can be used as a variable?

The layerstyle Looks like this

enter image description here

There are some sub rules.

enter image description here

The polygons are buildings. So I want to chose building 86 and the label hase to be rulebased to building 86. The problem is that building 86 can be the start or the end of the vector.

QGIS 2.14

  • 1
    can u share what u did so far to make things a bit more clear ?
    – Snaileater
    Commented Nov 30, 2017 at 11:54
  • I edit my question. Hope it makes it a little bit more clear.
    – holli
    Commented Nov 30, 2017 at 13:27
  • If I understand what you're going for, you could achieve the same end by duplicating the rules from Style into Labels. Perhaps this could be done by opening the QGIS file in a text editor and copying and pasting the rules. Just a thought. Backup your QGIS file before attempting.
    – csk
    Commented Dec 15, 2017 at 20:09

1 Answer 1


You can access the colour the feature is styled with if that's any help?

CASE WHEN  @symbol_color = '#ffffff'
THEN 'label for symbology 1'
ELSE 'label for symbology 2'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.