title: How do I set the minimum value step to 1.0E-14 for QDoubleSpinBox in PyQt4?
body: <p>This is my sample code for QDoubleSpinBox of PyQt4.
  I got this code from the <a href="http://www.qtcentre.org/threads/14662-QDoubleSpinBox-and-Float-Values" rel="nofollow noreferrer">site</a> and modified it.</p>
  
  <hr>
  
  <pre><code>class PowerSpinBox(QtGui.QDoubleSpinBox):
      def __init__(self, min, max, step, decimals, dec_format, parent=None):
          super(PowerSpinBox, self).__init__(parent)
          self.setRange(min,max)
          self.step = step
          self.dec = decimals
          self.dec_fmt = '%.6E'
          self.setDecimals(decimals)
  
      def textFromValue(self, value):
          if value &gt;= 0:
              return ' %.6E'%value
          else:
              return '%.6E'%value
  
      def fixup(self, input):
          value = input.toDouble()[0]
  
          print '&gt;&gt;&gt; PowerSpinBox:fixup:', value, input, step, value%step
  
          if (value % self.step) &gt; 0: #self.step*0.1:  # old: '&gt; 0:'
              if value &lt; 0:
                  value=value*(-1)
                  minus=True
              else:
                  minus=False
              newValue = value # old: float((int(value*1000)/1)*1)/1000
  
              if minus: newValue = newValue*(-1)
              newInput = '%.6E'%newValue  # newInput: string
              if not minus: newInput = '+'+newInput
              print "Invalid value [%s] replaced with [%s]"%(input, newInput)
              QtGui.QApplication.beep()
              input.replace(0, input.length(), newInput)
  
      def validate(self, input, pos):
          valid = QtGui.QValidator.Invalid
          newChar = input.at(pos-1)
          # print '+++ PowerSpinBox.validate:', input, newChar, pos
          if pos &lt; 1:
              valid = QtGui.QValidator.Acceptable
          else:
              if not newChar.isDigit():
                  if ((newChar.cell() == '.') and (input.count('.') == 1)) or \
                     ((newChar.cell() == '-') and (pos == 1)) or \
                     ((newChar.cell() == '+') and (pos == 1)):
                      valid = QtGui.QValidator.Acceptable
                  else:
                      valid = QtGui.QValidator.Invalid
              else:
                  value = input.toDouble()[0]
                  if (not (value &gt;= self.minimum() and value &lt;= self.maximum())) or \
                     (input.length() &gt; input.indexOf('.')+self.decimals()+6):
                      valid = QtGui.QValidator.Invalid
                  else:
                      valid = QtGui.QValidator.Acceptable
          return (valid, pos)
  # class_PowerSpinBox
  </code></pre>
  
  <hr>
  
  <p>In this example code, I want to control the value by stepsize of 1.0e-14. But I couldn't do that. How can I set the minimum value step to 1.0e-14 in QDoubleSpinBox of PyQt4.</p>
  
  <p>Thank you in advance.</p>