<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Hi,<br><br>This is regarding the precision in "QDoubleSpinBox". With out sub classing things were not working as I expected.<br> <br><br>class QxDoubleSpinBox(QtGui.QDoubleSpinBox):<br> def __init__(self, parent=None, value=0.):<br> QtGui.QDoubleSpinBox.__init__(self, parent)<br> self.setRange(0., 1.)<br> self.setValue(0.421)<br> self.setSingleStep(0.001)<br> self.setFixedWidth(70)<br> self.setWrapping(True)<br>
self.setDecimals(3)<br> <br> def valueFromText(self, str):<br> return FixedPoint(str, 3)<br> <br> def textFromValue(self, value):<br> print "textFromValue = ", value<br> return str(value)<br><br><br>As soon as I start the application, here are the results printed:<br> <br><br>textFromValue = 0.42<br>textFromValue = 0.42<br>textFromValue = 0.42<br>textFromValue = 0.0<br>textFromValue = 1.0<br>textFromValue = 0.42<br>textFromValue = 0.42<br><br><br>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.<br><br>How do I solve this? <br><br>Prashant<br><br>qt-sdk-win-opensource-2009.03.1.exe<br>Python 2.6.3<br>PyQt-Py2.6-gpl-4.6-1<br>Win XP, 32 Bit <br></div></div><br>
<!--3--><hr size=1></hr> From cricket scores to your friends. Try the <a href="http://in.rd.yahoo.com/tagline_metro_4/*http://in.yahoo.com/trynew" target="_blank">Yahoo! India Homepage!</a></body></html>