Results 1 to 5 of 5

Thread: How to get a menu or action by name or by numbers ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to get a menu or action by name or by numbers ?

    Don't know if this will help you, but for every menu, you can get a list of it's actions by calling:
    Qt Code:
    1. QList<QAction*> actions = menu->actions();
    To copy to clipboard, switch view to plain text mode 

    QMainWindow menus created in designer are held in QMenuBar, maybe you can get list of all menus inserted in menu bar by "findChildren" method:
    Qt Code:
    1. QList<QMenu*> menus = mainWindow->menuBar()->findChildren<QMenu*>();
    To copy to clipboard, switch view to plain text mode 

    Be sure to read documentation for above methods before using them.
    Still, I don't know what do you want to do with such lists.

  2. #2
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to get a menu or action by name or by numbers ?

    Thanks stampede

Similar Threads

  1. Menu item action problem
    By waynew in forum Newbie
    Replies: 5
    Last Post: 14th December 2010, 23:42
  2. Menu open action -reg
    By jsmith in forum Qt Programming
    Replies: 1
    Last Post: 8th May 2009, 11:07
  3. Action-Menu-Button
    By hgedek in forum Newbie
    Replies: 1
    Last Post: 1st October 2007, 16:41
  4. ToolBar Action With Menu
    By indifference in forum Qt Programming
    Replies: 4
    Last Post: 10th September 2007, 19:37
  5. Action on menu to display ui
    By jochen_r in forum Newbie
    Replies: 10
    Last Post: 10th January 2006, 10:10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.