Parameter Tree: cancel change

20 views
Skip to first unread message

Yannick Willener

unread,
Feb 12, 2020, 3:31:48 AM2/12/20
to pyqtgraph
Hello

I'm trying to cancel a value change in a parameter tree. 

The user enters a value, then the value is checked if supported depending on other values. 
If not I would like to display a warning to the user and cancel the change (reverting to the initial value). 

I have tried to use the sigTreeStateChanged signal to handle that, but with no success.

What is the correct method to implement it?

Thanks
Yannick

Patrick

unread,
Feb 12, 2020, 9:57:54 PM2/12/20
to pyqtgraph
Hi,

I guess you'd connect to the sigValueChanged or sigValueChanging signal for the Parameter you'd like to check. Or maybe both, since on the first sigValueChanging you might want to do a saveState or save the value(), so you can restoreState on sigValueChanged if the value is invalid.

Patrick
Reply all
Reply to author
Forward
0 new messages