4

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

6

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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