[pyqt maya] How to revert when input fails a Validator?

Can i setup a QDoubleValidator on a specific column of a QTreeWidgetItem to reject bad values? QTreeWidgetItem does’t inherit the setValidator() method from anyone…

Currently, I have a custom function attached to the QTreeWidget’s “itemChanged” Signal to catch the value and validate it before performing any actions, but I can’t quite figure out how to the revert value back to the original value…?

If you create a delegate, you could install the validator on the QLineEdit that it generates in the createEditor function, that’s probably the best way. It’s pretty basic to subclass QStyledItemDelegate and just overload createEditor.

thanks! that is exactly what I was looking for.