tags:

views:

664

answers:

1

Is it possible to create custom dock areas using Qt 4.4. I know this is possible in Qt 3 as this document suggests. Excerpt from document"...If you need to create your own dock areas we suggest that you create a subclass of QWidget and add your Q3DockAreas to your subclass...". However, it seems to me that in Qt 4 Q3DockArea has been removed and now the QMainWindow itself has the dock areas. I basically want to have my own dock area widget that I can dock widgets into. This dock area widget can be anywhere in the application. Any ideas on how I can do this?

+1  A: 

At first, Q3DockArea hasn't been removed in Qt4, actually it has been added. The class which got removed was QDockArea. You can still use this Q3* classes if you have old code, thats what they are made for.

But I would not recommend to use the compatibility classes. How about using a QMainWindow like a QWidget. Create it with a parent Widget, but without menu, toolbar, statusbar and revoke its top-level status with setWindowFlags() and the like.

You can use it as an old style QDockArea, place it where you like and add your QDockWidgets.

Besides, the current Qt Version is 4.5.2, no need to use outdated Versions ;-)

drhirsch
The problem I see with creating a QMainWindow as a dock area is that you can only dock on the left, right, top and bottom of a QMainWindow. So when you drop something in this area it is not going to fill up the whole widget but will only place itself on the dockable areas. It doesn't look nice. ;)
Shao
Thats not true, at least if there is no centralWidget in this QMainWindow, a single dock will cover the whole area, if allowed. The dock regions have no inherent limit in size.But use the Q3Dock* classes, if you feel they behave more like you want. Or write your own QDockArea class, using the docking part of QMainWindow as a template.
drhirsch