[PyQt] QDoubleSpinBox & it's precision

Baz Walter bazwal at ftml.net
Fri Oct 9 19:26:01 BST 2009


Prashant Saxena wrote:
> This is regarding the precision in "QDoubleSpinBox". With out sub classing things were not working as I expected.

so what *did* you expect?

> I have no idea what's going on here and why "textFromValue" is getting called so many times with values getting changed each time. 

well, you reimplemented the two virtual functions textFromValue and 
valueFromText. so they will get called by qt instead of the default 
implementations. textFromValue affects the appearance of the text 
displayed in the spin-box. so there will be several other functions 
(like sizeHint) that will need to call your functions internally for 
their own purposes. there's no way to predict what values will get 
passed to your functions at runtime.

> I was hoping that sub classing will solve the problem of precision.

what problem?

> How do I solve this? 

Solve what?


More information about the PyQt mailing list