How do I prevent the enter key from closing my QDialog (Qt 4.8.1)
问题 I have a QDialog with a QDialogButtonBox . The OK and Cancel buttons are active. Occasionally I disable or hide the OK button based on the state of my dialog. It seems, no matter what I do, the Enter key always activates the OK button. I really DON'T want this to happen. I have tried: Setting default and autoDefault properties to false every time I show/hide/enable/disable/whatever the button installing an event filter on the OK button to intercept key events (pressed and released) for return