PDA

View Full Version : Make Dock Widgets overlap main view



genjix
22nd October 2010, 15:50
I've been trying to do this for the last few days so forgive the old pictures that show a QToolBox instead (I'm using dock windows now).

http://img829.imageshack.us/img829/7843/smallf.jpg

How can I stop that? If I add dock windows/QToolBox to the right, then it doesn't shift the main view to the left but overlaps/overlays it. I want the same thing on the left.

I tried parenting it to my QMdiArea, then it’s a) transparent b) a fixed size that doesn’t resize.
http://img245.imageshack.us/img245/1999/parent.jpg
Strangely if I add a stylesheet, I at least get a background colour
http://img541.imageshack.us/img541/8438/stylesheet.png

Like if I add it to the right, then opening the toolbox will cause the main area to resize by cutting off a section of the right.

Maybe I want a resize policy for the left hand side? Namely: when resizing from the left, dont cut off from the right but cut off instead from the left? Something like that tongue twister I’ve written :p

wysota
23rd October 2010, 14:16
Dock widgets will always push the central widget aside. If you want to have them "over" the central widget then you have to implement it yourself - make the widget a child of the main window and use QWidget::setGeometry() to set the geometry of the panel. Also reimplement resizeEvent() for the main window so that when the size of the window changes, the panels are adjusted to it (again by using setGeometry).