Hi,
I'm trying to implement a delegate with a custom editor. This editor can validate its content and return True / False on invalid text input.
I need to block the commit somehow if an error occurs, but I'm unable to do this.
I tried implementing eventFilter and throw away the Key_RETURN and Key_ENTER event if the editor contains errors, but the delegate will still accept the input and save the content to the model.
I also tried implementing commitData but this seems to be called after the editor is closed.
Is there a way to make sure I can only close the editor / delegate if there are no input errors?
Right now the validation is a custom funktion isValid(), that simply checks the inputs of both QLineEdit widgets and returns true / false.
I could write this as a QValidator I guess if neccessary, but I hoped there would be another way to handle this topic.
Bookmarks