I created the shortcut events, such as:
new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this, SLOT(close()));
But now I would like to show "Ctrl+Q" in the menu entry here:
How do I do that? I don't seem to find a way to do that in Qt Creator.
Generally you would use
QAction
class for this, so you would have aQMenu
to which you will add actions, in your caseCLOSE
. Then you can useSetShortcut
to add"CTRL + Q"
in menu.where
pNewAction
is of typeQAction
.