Results 1 to 3 of 3

Thread: How to add QAction to existing QMenu from menuBar() of QMainWindow?

  1. #1
    Join Date
    Feb 2006
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default How to add QAction to existing QMenu from menuBar() of QMainWindow?

    The problem is that I'm doing this from my pluigin? So how to get QMenu from main app? Plugin should add QAction to this QMenu.

    Plugin has QMainWindow parent so it can access its QMenuBar?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to add QAction to existing QMenu from menuBar() of QMainWindow?

    Your main application should export some interface for the plugin to add its components to the application or your plugin should export some interface for the main application to offer its components. You may access the parents members as usual of course, but you can encounter many problems when trying to change the structure of your app.

  3. #3
    Join Date
    Feb 2006
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to add QAction to existing QMenu from menuBar() of QMainWindow?

    I would like to be able to load/unload my plugins at any time. I think it's better that plugins keep track of their actions and remove menu entries when they are unloaded? Main app shouldn't do this.

    I'm not sure but I think this can be only done using the first method (app exports interface for plugins). But I have no idea how to do this? Any help?

    The other method is used in plugin example from docs. But I don't like it since plugin signals and slots are managed from main app. My app shouldn't have any knowledge of plugins.

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.