qtdockable

Custom dock area using Qt 4.4


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?


Solution

  • 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 ;-)