PDA

View Full Version : spinbox



mickey
26th July 2006, 15:39
I have a spinBox linked to a SLOT; sometimes I used to change its value with keybord and not with arrow; is it possible call SLOT also when I change its value by hand (with keyboard)? thanks

high_flyer
26th July 2006, 16:30
should work with connecting signal valueChanged() to the slot you want, this will call that slot every time the value is change, with out regarding how it was changed.

mickey
26th July 2006, 18:26
valueChanged(int) I suppose. But maybe we aren't understand; actually for change value spinbox I can:
1. use mouse
2.point with mouse over number shown by spinbox then type a number AND PRESS RETURN. I'm loooking to avoid this return...can I do it?

high_flyer
26th July 2006, 18:30
I'm loooking to avoid this return...can I do it
Only if the values are one digit values.
For this you will have to subclass QSpinBox and override keyPressEvent().

mickey
26th July 2006, 18:59
they're two...

high_flyer
26th July 2006, 19:09
actually now that I think of it, you could make it also with more then one digit numbers, but then the user will always need to fill as many digits as the maximal number has, so for smaller number you can do for example:
01,02 etc...