Is there a way to see how much a SpinButton has changed when receiving the value-changed signal?
I'm trying to implement a linked set of SpinButtons, where a change in one will result in a change in all of them. I don't want them to be the same value, but to have the same delta (i.e. increment once on one SpinButton will result in an increment on the other SpinButtons).
I can't seem to come up with anything except possibly tracking the values in the background (perhaps triggered by a focus event or something), and then calculating the delta myself. Is that pretty much the only way?
The only way of doing this it is by calculating the delta as you said. Here you have an example:
I believe that if you do it in any other way, you will enter trough infinite loop and you will always reach the maximum of the adjustments. Why? Because the
value-changed
signal tracks when a value have been changed whether it be the program or the user. So if you manually modifyspinbutton1
you activateon_spinbutton_1_changed
, so it modifiesspinbutton2
, and it activateson_spinbutton_2_changed
that modifiesspinbutton1
. You see the infinite loop? This is why you need to storeself.sp1_val and self.sp2_val
.