PDA

View Full Version : QToolbar inside QWidget



theprobe
14th February 2011, 13:50
Hi,
If I have a QMainWindow, I can add toolbars and they look like this:

5947

I have 3 toolbars, and their size can be changed with that line at the start of each.

However, I have a QWidget, and I would like to get the same effect. Is there a way to achieve this?
Thanks,

d_stranz
14th February 2011, 17:53
You can use any QWidget as the parent of a QToolBar. However, if you want all of the same behavior as the toolbars in a QMainWindow (floating, docking, automatic resizing of the other widgets on docking or floating, etc.), then you have to copy the code from QMainWindow that manages toolbars and docking. See the documentation and source code for QToolBar::setAllowedAreas() to see the communication between the toolbar and the main window.