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. Add Menu Item from QUndoStack
QtWS25 Last Chance

Add Menu Item from QUndoStack

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 481 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.
  • RichardR Offline
    RichardR Offline
    Richard
    wrote on last edited by
    #1

    Hi all,
    I have hooked up the QUndoStack in my code. I would like to Add the Undo and Redo Menu items as created by createUndoAction and createRedoAction [link text(http://doc.qt.io/qt-5.4/qundostack.html#createRedoAction) into my application menubar. This menubar was created in the designer. When I try to add the actions with menuBar()->insertAction(before, undo action) they end up as a main menu item add the end of the menu bar. So it is not inserting at all. Can somebody please explain me how this is supposed to work? thanks.

    1 Reply Last reply
    0
    • RichardR Offline
      RichardR Offline
      Richard
      wrote on last edited by
      #2

      I'll answer myself, I am embarrassed to say it was quite easy. Because the insertAction only works on the action list of one widget it is not meant to be used on the menubar directly. Instead this just has to be used on the QMenu child items directly. I had no idea how to get to them until I realized that they just have names as shown in the designer. So I gave m decent names and I call it directly. So I you have a menu Item named menuEdit. It will work correctly when calling menuEdit->insertAction.....

      1 Reply Last reply
      0

      • Login

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