Feature #973
openWSpinBox + WValidator
0%
Description
It appears Validators don't work on Spinboxes.
code example:
// does not work
WSpinBox *b2 = new WSpinBox(root());
WIntValidator *val2 = new WIntValidator(0, 1);
b2->setValidator(val2);
// works
WLineEdit *tst = new WLineEdit(root());
WIntValidator *val3 = new WIntValidator(0, 1);
tst->setValidator(val3);
I have tried this with the git version, and the latest release.
Updated by Koen Deforche about 13 years ago
- Status changed from New to Feedback
- Assignee set to Koen Deforche
Hey Rob,
This may indeed be unexpected. The reason is that the spinbox already uses a validator to accept only valid input according to the defined range and prefix and suffix definitions.
Are you trying to accomplish anything beyond that ?
Regards,
koen
Updated by Rob Van Dyck about 13 years ago
Hi Koen,
I would like to make a spinbox that accepts only odd positive numbers. Is there a way to do this?
Either way, it might be usefull to add some info on this to the documentation.
Thanx!
Rob.
Updated by Koen Deforche about 13 years ago
Hey Rob,
I've updated the documentation. No, currently, this is not possible indeed. I guess it should be doable to compose the two validators (the built-in one, and the user-set one).
Regards,
koen