PDA

View Full Version : Default action for submenu



mstegehu
23rd February 2011, 15:42
I created a menu with submenu item. While clicking on that item I would like the default action to be performed but I can not get it to work:

Example:
m_menuBar = new QMenuBar(MainWindow);
m_fileMenu = new QMenu(m_menuBar);
m_menuOpen = new QMenu(m_fileMenu);
m_fileMenu->addAction(m_menuOpen->menuAction());
m_menuOpen->addAction(m_actionOpenScene);
m_menuOpen->addAction(m_actionOpenModel);

When you hoover over Open the submenu is opened. When you click on Open the default is selected.

I would like to activate the default when single clicking on Open.

connecting m_menuOpen->menuAction() SIGNAL (triggered ()) to my slot does not work.

How can I do that?

Regards,

Marcel