QInputDialog - confirm with enter-key
-
01-07-2021 - |
문제
Im trying to use QInputDialog without buttons. It looks just like I want, but I connot confirm input (using it for text input). Is there a possibility to confirm with the enter key, so that exec()
returns QInputDialog::Accepted
? Just like escape key makes the dialog return QInputDialog::Rejected
?
해결책
You could installEventFilter() on the QInputDialog, then have the eventFilter() accept() the dialog on a keypressevent(). :)
제휴하지 않습니다 StackOverflow