I want to implement the following control : "image":http://img831.imageshack.us/img831/5137/testuvs.jpg . I made a QToolButton and I added a QMenu to it( this menu has a QAction ) but I don't know how to add to the QAction three widgets. I'm on the wrong track? Can you give me a suggestion on how should I implement this control?
Thanks in advance!
You want a button with a drop-down menu in a toolbar?
@QMenu *menu = new QMenu;
Update the menuAction() icon every time you change the current selection. It could be that you don't have to. That I didn't try that myself.
Your solution didn't work for me, maybe because I didn't understand it very well, what I did was:
@QToolButton* button = new QToolButton( parent );
QMenu* menu = new QMenu( shapeButton );
QToolBar* toolbar = new QToolBar( menu );
QAction* a1 = new QAction( "test1",0 );
QAction* a2 = new QAction( "test2",0 );
QAction* fake = new QAction( " ",0 );
menu->addAction( fake );
toolbar->addAction( a1 );
toolbar->addAction( a2 );
button->setMenu( menu ); @
Have a look a the "Main window example":http://doc.qt.nokia.com/latest/demos-mainwindow.html, in particular "toolbar.cpp":http://doc.qt.nokia.com/latest/demos-mainwindow-toolbar-cpp.html.