mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
added validation of number values in number delegate
This commit is contained in:
parent
70ed7abeb5
commit
f561e1a864
1 changed files with 8 additions and 1 deletions
|
|
@ -20,7 +20,14 @@ class NumberDelegate(QtWidgets.QStyledItemDelegate):
|
|||
|
||||
value = index.data(QtCore.Qt.EditRole)
|
||||
if value is not None:
|
||||
editor.setValue(value)
|
||||
try:
|
||||
if isinstance(value, str):
|
||||
value = float(value)
|
||||
editor.setValue(value)
|
||||
|
||||
except Exception:
|
||||
print("Couldn't set invalid value \"{}\"".format(str(value)))
|
||||
|
||||
return editor
|
||||
|
||||
# def updateEditorGeometry(self, editor, options, index):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue