PDA

View Full Version : Layout managment



^NyAw^
14th May 2014, 15:27
Hi,

I'm trying to develop an application that will do something like QDesigner does. What I'm interested in is on the layout managment.

Here is what I would like to do:
The main window will let the user to add "windows" using a push button(drag will be avaliable on next versions)
Added "windows" can be moved and resized
Finally, a button "layout" will automatically layout the "windows" as QDesigner does.

I'm just reading the source code of QDesigner but I don't find where the layout managment code is. If anyone knows where I have to search it will be great.

Also I need ideas how to achieve this, so any help will be helpful.

Thanks,

anda_skoa
14th May 2014, 16:34
Box layouts should be easy:
* create the respective box layout, e.g. QVBoxLayout
* interate over the container window's children
* add each widget child to the layout
* set the layout on the container

The two grid type layouts are more tricky, since you need to use the child widgets' current position to somehow calculate where to add them to the layout.

Cheerrs,
_

^NyAw^
14th May 2014, 16:45
Hi,



The two grid type layouts are more tricky, since you need to use the child widgets' current position to somehow calculate where to add them to the layout.


This is what I need. Depending on the position and the size let the widget use more or less space:

Three widgets could have this layout:

W1| |
----| W3 |
W2| |

Will start for the firsts steps, let the user add windows, move and resize them. To let the user resize the widgets, what have I to do?

Thanks,