Thanks,
it works. :-)

I have only to adjust the two constants header files:
...
constcharMENU_ID[]="Kepler.Menu";
...

Thomas


Am 22.05.2013 11:52, schrieb Ziller Eike:
On 22.05.2013, at 11:41, Thomas Meyer <[email protected]> wrote:

Hi,
I want to have the menu 'Tools' -> 'Kepler'.
With one plugin I want to add the action 'Ellipse Orbit...'
and with another plugin I want o add the action 'Eccentric Anomaly...'?

In the eccentric anomaly plugin I have in the 'intialize' function the code:
...
         QAction *action = new QAction(tr("Eccentric Anomaly..."), this);
     Core::Command *cmd = Core::ActionManager::registerAction(action,
                                                              
Constants::ACTION_ID,
                                                              
Core::Context(Core::Constants::C_GLOBAL));
     cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Meta+A")));
     connect(action, SIGNAL(triggered()),
             this, SLOT(showEccAnomDialog()));
Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID);
     menu->menu()->setTitle(tr("Kepler"));
     menu->addAction(cmd);
     
Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu
);
...



Similar in the ellipse orbit plugin.
So, I get two 'Kepler' submenus, but I want only one.
How can I reach this?
Usually we have a single plugin creating the menu, and the other depending on 
that plugins. If that doesn't fit your case, you can of course do

Core::ActionContainer *menu = 
Core::ActionManager::actionContainer(Constants::MENU_ID);
if (!menu) {
     menu = Core::ActionManager::createMenu(Constants::MENU_ID);
     menu->menu()->setTitle(tr("Kepler"));
}

in both plugins.


_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qt-creator

Reply via email to