Oh, that's easy. Just assign the QAction associated with the menu entry directly to the button (it has to be a QToolButton not a QPushButton) using QToolButton::setDefaultAction().
Oh, that's easy. Just assign the QAction associated with the menu entry directly to the button (it has to be a QToolButton not a QPushButton) using QToolButton::setDefaultAction().
avis_phoenix (19th June 2006)
Sorry; but i don't understand how use a Qtoolbutton.
For example, my code is more o less like...
QToolBar Bar;
QMenu Menu;
....
{
...
Menu = new QMenu("File");
Menu->setIcon(Icon);
Menu->addAction(Action);
Menu->AddAction(Action2);
...
...
Bar = addToolBar("My Bar");
Bar->addAction(Menu->action());
...
}
I don´t remember exactly my code, but i don't use a Qtoolbutton, the buttons are my QMenus in my toolbar, i can´t see how use a propiety of QToolButton, or my toolbar use my Qmenu like QToolButtons?
or i write my previous question incomplete?
![]()
Oh, ok. So it's even easier. Just remove the menu action from the toolbar and add an action associated with one of its entries.
Edit: Sorry... but QMenu doesn't have an "action()" method. Are you sure this is really your code?
Last edited by wysota; 25th May 2006 at 16:52.
Bookmarks