Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
-
None
Description
When adding a menu to an action, you cannot click (trigger) anymore on this action.
For example, after doing something like this on a QMainWindow:
ui.baseMenu->addAction(myAction);
QMenu* myMenu();
myAction->setMenu(myMenu);
connect(myAction, SIGNAL(triggered()), this, SLOT(doSomething()));}}{{
//...
void MyClass::doSomething()
{{{}}
}
when the window is displayed, you cannot click and trigger myAction, and the programm will never enter into doSomething() slot. And this problem is because we've setted a QMenu to our QAction (myAction->setMenu(myMenu);)
I don't know if its a bug or a wanted behavior, but my suggestion is to add an option in order to let the programmer user define if he wants to make the menu myMenu masking the triggerable action or not.
The solution may like something like this (example of possible solution):
ui.baseMenu->addAction(myAction);
QMenu* myMenu();
myMenu->setMaskingAssociatedAction(false);
myAction->setMenu(myMenu);
//etc...
This is only an example, the goal is to solve this problem anyway.