PDA

View Full Version : Subclass QDoubleSpinBox



SailinShoes
13th June 2008, 09:49
I would like to subclass a QDoubleSpinBox with the range of 0.50 to 999.

The user cannot enter a value textually, since it is an embedded system and there
are only a few buttons. To alter the value in the spinbox, there are up/down buttons.

My problem is that the value should always have two significant digits.

Values between 0.50 and 0.99 -> two decimals -> singleStep 0.01
Values between 1.0 and 9.9 -> one decimals -> singleStep 0.1
Values between 10 and 999 -> no decimal -> singleStep 1

What is the most suitable solution? QDoubleValidator?

wysota
13th June 2008, 11:29
Why would you want to subclass the spinbox to do that? Just set its properties properly...