Then what is the right design pattern for thing as simple as opening of new window? Consider this code:
Qt Code:
{ if (keyEvent->key() == Qt::Key_F1) { HelpDialog help(this); help.exec(); } }To copy to clipboard, switch view to plain text mode
If in MainWindow you press quickly F1 three times, the first QKeyEvent will cause to exec HelpDialog, but the other two events will be handled in HelpDialog, which is totally unacceptable, because it may cause some random actions that user is not aware of. Please don't say that it is pointless to press one button three times and that noone will do it, because you can do it just by accident. But there is a better reason for doing such a thing than accident. When process of displaying new window lasts long (let's say 1s) user doubts if the keyboard/application detected if key had been pressed and then he presses it again.
Bookmarks