Results 1 to 2 of 2

Thread: Runtime application menu customisation

  1. #1
    Join Date
    Mar 2010
    Posts
    10
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Runtime application menu customisation

    Hi,

    I'd like to find out if it is possible to implement using Qt something similar to the way some MS apps (eg VS 2008, Outlook 2007) provide in terms of modifying the application menus at runtime, in terms of adding/removing/moving menu entries.

    These apps typically provide this functionality in Tools->Customize... which once selected causes a list of available commands to be displayed and also places the application menus in an editable mode allowing you to re-arrange items or drag and drop items from the list of commands to the menus, etc. Once the changes have been applied the app saves the GUI state/layout to be loaded the next time it is started.

    I'm not referring to generating the list of available commands, which would be quite application specific, but to the way the app lets you re-arrange ad modify its menus.

    Does anyone have any experience doing this with Qt or could suggest an alternative scheme that has worked well in the past? Are there any hight level classes or toolkits to do this?

    Thx.

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Runtime application menu customisation

    In Qt menu and toolbars entries are QAction instances.

    Using QWidget::actions() you can retrieve the list of actions of the widget (QMenu, QToolBar) and using QWidget::addAction() / QWidget::removeAction() you can manage them.

    You could then:
    1. load all actions of QMainWindow with findChildren()
    2. load all menu
    3. create a GUI to manage them
    4. use the new configuration to set actions for each menu
    A camel can go 14 days without drink,
    I can't!!!

  3. The following user says thank you to mcosta for this useful post:

    oberlus (29th July 2011)

Similar Threads

  1. Microsoft Visual C++- Runtime Library Error while deploying Qt Application
    By mammaiap in forum Installation and Deployment
    Replies: 1
    Last Post: 7th May 2011, 00:41
  2. Replies: 1
    Last Post: 25th September 2010, 08:20
  3. Application gets aborted runtime
    By Yayati.Ekbote in forum Qt Programming
    Replies: 0
    Last Post: 2nd April 2010, 12:13
  4. Replies: 6
    Last Post: 5th August 2009, 10:40
  5. Add a entry to the application menu
    By mace in forum Qt Programming
    Replies: 1
    Last Post: 28th April 2006, 06:32

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.