Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QUndoStack::undo not triggered by Shortcut Key

    General and Desktop
    2
    2
    138
    Loading More Posts
    • 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.
    • ModelTech
      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 1 Reply Last reply Reply Quote 0
      • Pl45m4
        Pl45m4 @ModelTech last edited by

        @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 Reply Quote 0
        • First post
          Last post