[PyKDE] Dynamic layouts

Boudewijn Rempt boud at rempt.xs4all.nl
Wed Mar 14 07:17:54 GMT 2001


On Tuesday 13 March 2001 23:56, you wrote:
> Hello,
>
> I am trying to make a dialog widget that consists of three Layouts inside
> of a QVBoxLayout. I would like the center layout to be dynamic in that I
> add and subtract widgets dynamically based on user interactions. However, I
> can't seem
>
> to figure out how to do this. So what I want is this:
> |---------------------|
> |
> |Upper Layout	      |
> |(Static)	      |
> |
> |---------------------|
> |Middle Layout	      |
> |(widgets get added   |
> | and subtracted)     |
> |
> |
> |---------------------|
> |Lower Layout	      |
> |(static)	      |
>
> -----------------------
>
> Any ideas?





I haven't found a way to really delete individual widgets from a layout, yet, 
but as long as you keep an explicit reference to the middle layout you can 
call self.layout.deleteAllItems() and then add new items, I think. 

I haven't tried it myself yet, but will play a bit. By coincidence, I'm just 
now writing up a bit on Qt layouts, so it's an interesting question. ;-)
-- 

Boudewijn Rempt | http://www.valdyas.org




More information about the PyQt mailing list