[PyQt] resizing layouts

andre hotz andre.hotz at piranha-bytes.com
Tue May 14 17:38:44 BST 2013


Am 14.05.2013 18:18, schrieb Baz Walter:
> On 14/05/13 16:15, andre hotz wrote:
>> My application has 4 areas, defined by a 2x2 QGridLayout. Each area can
>> have single widgets and also sub layouts.
>> Now I want the user to be able to interactivly change the size of each
>> of the 4 areas by a handle.
>> Basically what a QSplitter does, but QSplitter seems only to work on
>> widgets, not on complete layouts.
>
> Are you using Qt Designer? It is very easy to do exactly what you want 
> if you use it.
>
> Firstly, you need to get rid of the top-level grid layout. Next, make 
> sure that each of the four areas consists of either a single widget, 
> or a single layout (which can, of course, contain any number of child 
> widgets and/or sub-layouts).
>
> Now select the top pair of areas, and put them into a horizontal 
> splitter. Then do the same for the bottom pair. Finally, the top and 
> bottom splitters can be put into in a vertical splitter, to complete 
> the four-pane arrangement.
>
> Once the splitters have been set up, you just need to add a top-level 
> layout for the main form.
>

Thanks for that swift response Baz!

I usually don't use the Qt Designer, but I tried what you said and it 
seems to work. Unfortunatly I can't generate the code from the Designer, 
pops up some error message, so I first have to figure this out ;)

But thanks anyway, now I have a direction to go!

Cheers,
Andre



More information about the PyQt mailing list