[Qt-interest] Qt Global Shortcuts and Modal Windows
Joshua Grauman
jnfo-c at grauman.com
Fri Oct 1 23:19:57 CEST 2010
Hello all,
I have created a global shortcut key in one of my windows as follows:
QAction *act = new QAction(this);
act->setShortcut("Ctrl+Q");
act->setShortcutContext(Qt::ApplicationShortcut);
connect(act, SIGNAL(triggered()), this, SLOT(shortcutQuit()));
addAction(act);
This works great, and you can hit the shortcut key from anywhere in the
program... until I set one of my windows to Qt::ApplicationModal. Now that
shortcut key can't be pressed in that window. Any easy way around this?
(The docs probably need to be updated as well to reflect this limitation,
unless it's a bug, as the documentation says: "Qt::ApplicationShortcut -
The shortcut is active when one of the applications windows are active.")
Thanks!
Josh
More information about the Qt-interest-old
mailing list