Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QKeySequence::Quit shortcut not working in Windows

Tags:

c++

windows

qt

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?

like image 260
maelorn Avatar asked Feb 12 '23 16:02

maelorn


1 Answers

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:

enter image description here

like image 173
sashoalm Avatar answered Feb 15 '23 07:02

sashoalm