This commit is contained in:
Pol Welter 2018-06-01 10:31:47 +02:00
parent 70398f7098
commit a48a3776be

View File

@ -509,8 +509,14 @@ class SpinBox(QtGui.QAbstractSpinBox):
def fixup(self, strn):
# fixup is called when the spinbox loses focus with an invalid or intermediate string
self.updateText()
strn.clear()
strn.append(self.lineEdit().text())
# support both PyQt APIs (for Python 2 and 3 respectively)
# http://pyqt.sourceforge.net/Docs/PyQt4/python_v3.html#qvalidator
try:
strn.clear()
strn.append(self.lineEdit().text())
except AttributeError:
return self.lineEdit().text()
def interpret(self):
"""Return value of text or False if text is invalid."""