Qt 6.11 is out! See what's new in the release
blog
Problem with QAction's shortcut and QMenu
General and Desktop
8
Posts
3
Posters
9.1k
Views
1
Watching
-
If an action is completely hidden, it is disabled. If you need global shortcuts, event when the actions UI stuff is hidden, us "QShortcut":http://doc.qt.nokia.com/4.7/qshortcut.html
@
shortcut = new QShortcut(QKeySequence(tr("Ctrl+O", "File|Open")), this);
shortcut->setContext(Qt::ApplicationShortcut);
connect(shortcut, SIGNAL(activated ()), this, SLOT(fileOpen()));
@ -
yeah, that works, and i've done something like that, but then if the menu is visible (hiding and showing is done by the user) i get to another problem:
@QAction::eventFilter: Ambiguous shortcut overload: Ctrl+O@
and the only thing comes to my mind is to implement something that manage the shortcuts according to the menu state, what's your opinion about that?