Unsolved QUndoStack::undo not triggered by Shortcut Key
ModelTech last edited by
I have created a QUndoGroup and used QUndoGroup::createUndoAction to create an QAction, which I named UndoAction. In addition, I have set a shortcut key to this action QAction::setShortcut, using as argument QKeySequence::Undo. Finally, I created a button in the toolbar of my app in which I added the UndoAction.
It turns out that the undo action works perfectly when pressing the toolbar button. However, the undo action does not get triggered when using the shortcut key sequence (on the test machine Ctrl+Z). Does anyone has an idea why the action may not be triggered by the key sequence?
Is there a way to list what key sequences are 'connected'?
Pl45m4 last edited by
What type of shortcut is your shortcut and what kind of widget is the receiver?
Have a look at this (https://doc.qt.io/archives/qt-4.8/qt.html#ShortcutContext-enum).
In most cases, your widget or window needs to have focus in order to receive the keyboard shortcut sequence and you have to make sure, that your OS is not blocking your Ctrl + Z shortcut.