I tried to add a shortcut for the quit action. However it doesn't show up in the menu.
Here's the code:
exitAct = new QAction(tr("&Exit"), this);
exitAct->setShortcuts(QKeySequence::Quit);
exitAct->setStatusTip(tr("Exit the application"));
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
I tried the same thing for the print shortcut and it works so I don't see what I'm doing wrong here. Does anyone have an idea on how to ix it?
Note that is Ctrl+Q is assigned to QKeySequence::Quit for Mac OS X, but not for Windows. For Windows, no keyboard shortcut is assigned to QKeySequence::Quit.
Screenshot from Qt docs:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With