Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QUndoStack::undo not triggered by Shortcut Key

QUndoStack::undo not triggered by Shortcut Key

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 323 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    ModelTech
    wrote on 23 Feb 2020, 13:17 last edited by
    #1

    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'?

    P 1 Reply Last reply 23 Feb 2020, 14:43
    0
    • M ModelTech
      23 Feb 2020, 13:17

      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'?

      P Offline
      P Offline
      Pl45m4
      wrote on 23 Feb 2020, 14:43 last edited by
      #2

      @ModelTech

      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.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      0

      2/2

      23 Feb 2020, 14:43

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved