OK. Here's what happens in 4.3.1( Sorry Wysota, I promise not to answer any posts until next Saturday ):
A tool button has a list of assigned actions( inherited from QWidget).
When you set the menu via setMenu:
m_selectionModeButton->setMenu(m_selectionModeMenu);
m_selectionModeButton->setMenu(m_selectionModeMenu);
To copy to clipboard, switch view to plain text mode
the default(??) action of m_SelectionModeMenu will be added to m_SelectionModeButton's action list.
Next, you added:
m_selectionModeButton->setDefaultAction(m_actionIntersectsItem);
m_selectionModeButton->setDefaultAction(m_actionIntersectsItem);
To copy to clipboard, switch view to plain text mode
If m_actionIntersectsItem was not already the default action for the menu, it causes the tool button to add it to its action list.
The message you were complaining about is outputted in QToolButton: popupTimerDone, called, for example when the menu is shown.
if(menuAction) {
actualMenu = menuAction->menu();
if (q->actions().size() > 1)
qWarning("QToolButton: Menu in setMenu() overriding actions set in addAction!");
}
if(menuAction) {
actualMenu = menuAction->menu();
if (q->actions().size() > 1)
qWarning("QToolButton: Menu in setMenu() overriding actions set in addAction!");
}
To copy to clipboard, switch view to plain text mode
As you can see later in the function, if you set any menu with setMenu, then this menu will get displayed, rendering any actions that you add via addAction useless( they will be overwritten by the action you will select in the menu ).
Basically the message is just a warning, so you should ignore it if you don't want to fix it.
To fix it, use:
m_selectionModeButton->setDefaultAction(m_actionIntersectsItem);
m_selectionModeButton->setDefaultAction(m_actionIntersectsItem);
To copy to clipboard, switch view to plain text mode
before setting the menu to the toolbutton with setMenu. This way you add only one action to the button( the current one).
Regards
Bookmarks