Spinbox Totals
-
Hey, for anyone that has experience using Qt and C++,
Say I have a group of spin boxes, the total values of which need to add up to a certain amount. It is easy enough to disable them all once I reach that amount by using the up/down arrows, but since the user can enter the values manually, they can still exceed the total before I can disable them (since the valueChanged signal would fire AFTER they change the value).
Is there a way to somehow link the values of the spin boxes together so that for instance, if I have 3 spin boxes with values 5, 5 and 0, and the max is 12, the third box can only be set to 2?
-
Hmmm... how do I remember the old values of the spinbox? The valueChanged signal takes the number AFTER it has already been changed.
The way I have it now, everytime a value is changed, it adds the values of all the spin boxes and subtracts from the final total. Then, if the current value is over a certain amount, it just sets the maximum of all the spinboxes to the max total - the current total. This works, but it seems like a hack.
Thanks for the prompt replies by the way =D