DeadWarlock
DeadWarlock

Reputation: 720

How bind "Alt+space" hotkey to a slot in Qt?

I am trying bind some "actions" (connect to a slot) on this hotkey Qt::ALT + Qt::Key_Space without success (((((.

Other combinations work fine without additional effort. For example Qt::ALT+Qt::Key_Return.

<!-- language: lang-cpp --> 
QShortcut* ptrHotKey = new QShortcut(QKeySequence(Qt::ALT + Qt::Key_Return), this);
connect(ptrHotKey, SIGNAL(activated()), this, SLOT(testSlot())); 

Attempts to catch keyPressEvent fail; they even don't go through that handler.

On Windows systems they call system menu by default "Restore", "Move", "Size", "Minimize", "Maximize", "Close".

Upvotes: 1

Views: 877

Answers (1)

cmannett85
cmannett85

Reputation: 22356

If your desktop environment's window manager uses that shortcut for something, Qt won't even receive the event. As noted by David Heffernan you should be able to access it through your DE API though.

Upvotes: 2

Related Questions