PDA

View Full Version : Mainwindow layout problem with QDockWidget.



pastispast
11th January 2011, 15:44
Hi Friends,


I have to create a custom layout for my main application. Layout can be of different type as:




|--------------------------------------|
| | | |
| 2 | | 4 |
|-----| 1 |-----|
| |-----------| |
| 3 | 7 | 5 |
|-----------------------|
| 6 |
|-----------------------|


Here all no's(1...) are the dockwidgets. But I am facing following problems to do so:

1) As DockWidgetAreas have only the following layout option:

Qt::LeftDockWidgetArea
Qt::RightDockWidgetArea
Qt::TopDockWidgetArea
Qt::BottomDockWidgetArea
Qt::AllDockWidgetAreas
Qt::NoDockWidgetArea

then how can I add the position for other windows.

2) Positioning of the 'QDockWidget': When I am positioning the docs using the move and resize functions then it does not work properly.

Note:

I have done the following try:

Try 1: I have tried the sizeHint() and save/load geometry but it does not worked.

Try 2: I have tried the layout on centerwidget using splitter and gridlayout but it does not give me the proper docking feature as the dock-widgets was the child of centerwidget. I am facing the following problem in this:

- Unable to auto dock in the another dock area while moving the window as dock feature.
- While undocking window moves up.

Please provide me some idea or solution on this issue....I have attached the zip file for the "Try 2"

or

Is there any way to do this by removing center widget and add dock directly to the main window in the specified layout.

It will be very helpful for me if you work on the attached examples.

Compiler Used: Visual Studio [GCC will also work but not tested]

Thanks in advance...

pastispast
12th January 2011, 08:23
if I work on Try 1:



Is there any way to do this by removing center widget and add dock directly to the main window in the specified layout.

Here I tried using the above way(with out removing the center widget as it gives some other problems).

I have attached zip file of my work-through.

aamer4yu
12th January 2011, 17:26
What do you mean by layout ? You want to add dock widgets to those layouts ?
If yes, then I guess its a tedious task,, and you may refer to Qt designer code how they do it.

If you simply want to achieve the above layout,,, it can be made out of hor/ver layout..
2/3 - ver
1/7 - ver ( with more space to 1)
4/5 - ver

Then these 3 ver layouts in hor layout.
and finally the hor layout in ver layout with 6.

Hope you get the idea ..

pastispast
13th January 2011, 06:04
Hi Aamer...thanks for the reply...

Actually I want to add dock widgets on that layout (Or something widget like that have all dock features).