I want to prevent the text box from the user to avoid typing the special characters. I have tried with keyPressEvent
but it's called after clicking the OK button.
Code:
text, okPressed = QInputDialog.getText(
self, "Create category", "Enter category name:", QLineEdit.Normal, ""
)
if okPressed and text != "":
print(text)
def keyPressEvent(self, event):
print("keyPressEvent")
print(event)
How can I avoid some specific characters in the QInputDialog?