Hi,
This is regarding the precision in "QDoubleSpinBox". With out sub classing
things were not working as I expected.
class QxDoubleSpinBox(QtGui.QDoubleSpinBox):
def __init__(self, parent=None, value=0.):
QtGui.QDoubleSpinBox.__init__(self, parent)
self.setRange(0., 1.)
self.setValue(0.421)
self.setSingleStep(0.001)
self.setFixedWidth(70)
self.setWrapping(True)
self.setDecimals(3)
def valueFromText(self, str):
return FixedPoint(str, 3)
def textFromValue(self, value):
print "textFromValue = ", value
return str(value)
As soon as I start the application, here are the results printed:
textFromValue = 0.42
textFromValue = 0.42
textFromValue = 0.42
textFromValue = 0.0
textFromValue = 1.0
textFromValue = 0.42
textFromValue = 0.42
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?
Prashant
qt-sdk-win-opensource-2009.03.1.exe
Python 2.6.3
PyQt-Py2.6-gpl-4.6-1
Win XP, 32 Bit
Add whatever you love to the Yahoo! India homepage. Try now!
http://in.yahoo.com/trynew_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt