PDA

View Full Version : How to set proportion between dockwidget and central widget



christina123y
9th April 2009, 04:32
Hi, i have encountered a problem that :
i have set a treeWidget as central widget in a mainwindow, i use dockwidget as a display widget, and when i first start the application, the centralWidget is too large while the dockwidget is too small, but what i need is to make centralWidget size up less space, and more space for the dockWidget.
Wish everyone's reply for this problem soon. very grateful for your help.

aamer4yu
9th April 2009, 06:05
Did you try changing / setting size policy for dock widget / central widget ?

christina123y
9th April 2009, 08:23
Did you try changing / setting size policy for dock widget / central widget ?

yes ,i have tried. but it still didn't work, anyother solution? wish your reply again!

christina123y
9th April 2009, 09:01
Did you try changing / setting size policy for dock widget / central widget ?

yes ,i have tried. but it still didn't work, anyother solution? wish your reply again!

spirit
9th April 2009, 09:13
did you create mainwindow in Qt Designer?
if yes, then you can add "Horizontal Spacer" to dockwidget.

Marlog
13th July 2009, 22:51
I have the same problem, and anywhere find solution. Some experiments i and have:
We need class inherit QDockWidget.
In constructor that class (or create time) use setMinimumSize(), setMinimumHeight() or setMinimumWidth() with required dockWidget size.
Reimplement resizeEvent() and in that metod use again setMinimumSize() with zero or other value. First time apllication have appropriate size and proportion and next we might arbitraly resize widget.

manishkyl
14th July 2009, 18:48
no size policies, max, minsizes should be set on the qdockwidget itself
you must use setWidget(w) on dockwidget
set your min sizes/max sizes on w not on dockwidget

(qdockwidget just takes your w and puts in its layout)