Skip to main content
added 436 characters in body
Source Link

I would like to catch a signal when a rule within a rule based layer toggles visibility. How to permanently check this

layer.renderer().rootRule().children()[0].active()==True

the same way we can receive a signal when a node in the layer tree toggles visibility:

layer= iface.layerTreeView().currentNode()
layer.visibilityChanged.connect(dosomething)

The problem is I cannot catch the visibility change on a rule.

To add more context:

The layer "SM_GIS pds_electricity < 10000" is a copy of "PDS Electricité <2000" but with other scale ranges.

(I will hide it for the user but that's not the question here).

What I want: if I set the rule "Prosumer" to visible in one layer , I want it to be set to visible in the same rule of the other layer.

enter image description here

A workaround is to make copies of the same layer and use single symbol and applying each rule to a new copy of the layer.

I would like to catch a signal when a rule within a rule based layer toggles visibility. How to permanently check this

layer.renderer().rootRule().children()[0].active()==True

the same way we can receive a signal when a node in the layer tree toggles visibility:

layer= iface.layerTreeView().currentNode()
layer.visibilityChanged.connect(dosomething)

The problem is I cannot catch the visibility change on a rule.

I would like to catch a signal when a rule within a rule based layer toggles visibility. How to permanently check this

layer.renderer().rootRule().children()[0].active()==True

the same way we can receive a signal when a node in the layer tree toggles visibility:

layer= iface.layerTreeView().currentNode()
layer.visibilityChanged.connect(dosomething)

The problem is I cannot catch the visibility change on a rule.

To add more context:

The layer "SM_GIS pds_electricity < 10000" is a copy of "PDS Electricité <2000" but with other scale ranges.

(I will hide it for the user but that's not the question here).

What I want: if I set the rule "Prosumer" to visible in one layer , I want it to be set to visible in the same rule of the other layer.

enter image description here

A workaround is to make copies of the same layer and use single symbol and applying each rule to a new copy of the layer.

edited title
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

PyQGIS how to catch Catching signal when a rule toggles (active/inactive) using PyQGIS?

English usage
Source Link
Vince
  • 20.3k
  • 16
  • 48
  • 65

PyQGIS how to catch signal when a rule toglestoggles (active/inactive)

I would like to catch a signal when a rule within a rule based layer toglestoggles visibility. How to permanently check this

layer.renderer().rootRule().children()[0].active()==True

the same way we can receive a signal when a node in the layer tree toglestoggles visibility:

layer= iface.layerTreeView().currentNode()
layer.visibilityChanged.connect(dosomething)

The problem is I cannot catch the visibility change on a rule.

PyQGIS how to catch signal when a rule togles (active/inactive)

I would like to catch a signal when a rule within a rule based layer togles visibility. How to permanently check this

layer.renderer().rootRule().children()[0].active()==True

the same way we can receive a signal when a node in the layer tree togles visibility:

layer= iface.layerTreeView().currentNode()
layer.visibilityChanged.connect(dosomething)

The problem is I cannot catch the visibility change on a rule.

PyQGIS how to catch signal when a rule toggles (active/inactive)

I would like to catch a signal when a rule within a rule based layer toggles visibility. How to permanently check this

layer.renderer().rootRule().children()[0].active()==True

the same way we can receive a signal when a node in the layer tree toggles visibility:

layer= iface.layerTreeView().currentNode()
layer.visibilityChanged.connect(dosomething)

The problem is I cannot catch the visibility change on a rule.

Removed thanks.
Source Link
TomazicM
  • 27k
  • 24
  • 31
  • 42
Loading
Source Link
Loading