tags:

views:

79

answers:

3

What I wanted is something like the figure below shows. alt text

Thanks.

A: 

Maybe you should use void setAllowedAreas ( Qt::DockWidgetAreas areas ) to set the are allowed areas for your docked widget after you construct it(and set it's parent to the window it would dock to).These enum values are from http://doc.qt.nokia.com/4.6/qt.html#DockWidgetArea-enum. just combine these.

Constant    Value
Qt::LeftDockWidgetArea  0x1
Qt::RightDockWidgetArea 0x2
Qt::TopDockWidgetArea   0x4
Qt::BottomDockWidgetArea    0x8
Qt::AllDockWidgetAreas  DockWidgetArea_Mask
Qt::NoDockWidgetArea    0
schemacs
A: 

If you want the "QDockWidget" in your diagram to float, i.e. possibly obscure other widgets, then what I'd do is don't make it a QDockWidget. Just inherit QWidget, set it's parent to your main window, but don't add it to any layout. Then you can explicity set it's position with setPos (which you'll probably have to update in the resize event of the main window). I'm not sure if this will work, since there's no z-value for QWidgets so it might still end up underneath some. If you use a QGraphicsView for your main window, you can ensure it stays on top. You'd then have to use proxy graphics items for all your widgets.

Long story short, it's possible but not natural to do.

Colin
A: 

Use QMdiArea as central widget of your MainWindow. And then you can put in any position your widget, which need only to subclass QMdiSubWindow. Believe me this is much better choice. I was trying the same thing as you, and ended using QMdiArea and QMdiSubWindow. It work great for me.

firescreamer
Thank you! I will look into it.
Jimmie