PDA

View Full Version : Adding a toolbar to a TableWidget



Walter
1st July 2007, 20:59
Hi,

this is my first post on this forum. I'm a complete newbie to Qt so please forgive alle silly questions :)

How can I add a toolbar to a QTableWidget?

On my QMainWindow I used something like

toolbar = new QToolBar( this );
addToolBar( Qt::TopToolBarArea, toolbar );

but now I want to create a TableWidget as a main window and need a toolbar. QTableWidget has no addToolBar() so do I have to make a QMainWindow containing a QTableWidget and a QToolBar or is there another way?

Thanks in advance...

jpn
1st July 2007, 21:12
do I have to make a QMainWindow containing a QTableWidget and a QToolBar or is there another way?
Yes, this is the way to go. Still if any Qt widget can be made a top level widget (aka. window), only QMainWindow provides functionality such as menus, toolbars and dock widgets. You might want to set the QTableWidget as a central widget of the QMainWindow, see QMainWindow::setCentralWidget() for more details.

Walter
1st July 2007, 21:13
Thank you very much!