PDA

View Full Version : QDockWidget Problem.



pastispast
6th October 2010, 15:55
Hi Friends,

I have some problem regarding to the positioning of the QDockWidget on the QMainWindow. I have 3 dockwidget in my main window [centre widget I put as 0]:

maindock: left side
leftdock: right side
bottomdock: bottom side

But I am facing some problem:

1) I have to position the dockwidget in some ratio (Say 3/4 width for maindock, 1/4 width for left dock and 100 px height for bottom widget).


What I have Done: I have checked two approaches, 1'st is sizeHint() function and another is "savesetting/loadsetting", as I found "savesetting/loadsetting" is more preferable. So I have implemented the approach. But in this case I am not able to maintain the proper ratio[coming some thing 1/2 ratio] of the dockwidgets.

For sizeHint() I am confused how to implement it.

2) I want that when I close one dockwidget then another widget should not take the place of others. DockWidget should fix with respect to the position and place. Only user can do the docking.

Is there any way for the second problem and what I am missing in the first problem.

Live
6th October 2010, 15:57
You might have the results you want with the QSplitter class instead of QDockWidgets if it is possible for you.

pastispast
7th October 2010, 07:03
Hi Live...Thanks for the reply but it seems that I can not use the QSplitter in my application as:

) I need the floating behavior for the windows.
) I need to add some more dock windows later on my application.

Is there any possible way to do this[Point 2] and what I am missing in point 1...thanks :confused:

ChrisW67
9th October 2010, 03:35
Here is what I think you want:

A layout of three panels with some ratio of space allocation.
Each panel can contain zero or more QDockWidgets.
When panel contains no docked widgets it remains present in the layout and empty.

Have you tried using splitters or another layout method to place three QMainWindows inside your application's main window central widget. The QDockWidgets can be docked with these subordinate QMainWindows rather than the top level one.