[PyQt] resizing layouts

Baz Walter bazwal at ftml.net
Tue May 14 17:18:14 BST 2013


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.

-- 
Regards
Baz Walter


More information about the PyQt mailing list