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

Add Menu Item from QUndoStack

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 484 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.
  • R Offline
    R Offline
    Richard
    wrote on 31 Mar 2015, 14:08 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
    • R Offline
      R Offline
      Richard
      wrote on 31 Mar 2015, 14:32 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

      1/2

      31 Mar 2015, 14:08

      • Login

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