TransWikia.com

Emitting signal when project property is changed using PyQGIS

Geographic Information Systems Asked on March 13, 2021

QGIS API provides QgsExpressionContextUtils to set project properties.

But in the class, there isn’t any signal.

I hope to connect to a signal whenever some of the properties were changed.

So is there a way to implement this?

enter image description here

One Answer

Yes, there is a way. It's the customVariablesChanged signal from QgsProject.

def my_slot():
    print("A project variable was just changed!")

QgsProject.instance().customVariablesChanged.connect(my_slot)

Correct answer by Germán Carrillo on March 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP