PyQt4

This is regarding the precision in "QDoubleSpinBox". With out sub classing things were not working as I expected.
Qt Code:
  1. class QxDoubleSpinBox(QtGui.QDoubleSpinBox):
  2. def __init__(self, parent=None, value=0.):
  3. QtGui.QDoubleSpinBox.__init__(self, parent)
  4. self.setRange(0., 1.)
  5. self.setValue(0.421)
  6. self.setSingleStep(0.001)
  7. self.setFixedWidth(70)
  8. self.setWrapping(True)
  9. self.setDecimals(3)
  10.  
  11. def valueFromText(self, str):
  12. return FixedPoint(str, 3)
  13.  
  14. def textFromValue(self, value):
  15. print "textFromValue = ", value
  16. return str(value)
To copy to clipboard, switch view to plain text mode 

As soon as I start the application, here are the results printed:
Qt Code:
  1. textFromValue = 0.42
  2. textFromValue = 0.42
  3. textFromValue = 0.42
  4. textFromValue = 0.0
  5. textFromValue = 1.0
  6. textFromValue = 0.42
  7. textFromValue = 0.42
To copy to clipboard, switch view to plain text mode 

I have no idea what's going on here and why "textFromValue" is getting called so many times with values getting changed each time. I was hoping that sub classing will solve the problem of precision.

How do I solve this?