[PyKDE] Inserting widgets "into" a QGroupBox

Tony Cappellini cappy2112 at gmail.com
Thu Feb 1 07:47:22 GMT 2007


On Wed, 31 Jan 2007 02:08:11 +0100 David Boddie Wrote


>>Would that sort of represent what you're trying to do?
yes

Here's a screenshot of what I am working towards, using another (non-python)
WYSIWIG IDE.
I use it to design the layout I'm trying to construct with pyQT.
http://www.tcapp.com/wysiwig.jpg

Now- there are many more group boxes and widgets in this screenshot than my
original post, but you can still see the "basic 2-column vertical layout" I
described.


>>If each QVBoxLayout is only going to contain a single QGroupBox, you don't
need to bother with them -
Each group will contain more than one widget, which is why I want to put
them in a group. The Group Box Title to provide visual information to the
user what each group is for.

>>just put the group boxes directly in the QHBoxLayout. In pseudocode:
I want a two-column view, left & right, which is why I chose 2 vertical
layouts
(I started with a grid, but nothing would appear in it.)

If you really do want to put two vertical layouts into a horizontal layout
and put a group box into each of them, you need to do something like this:

hboxLayout = QHBoxLayout()
hboxLayout.addLayout(leftLayout)
hboxLayout.addLayout(rightLayout)
self.setLayout(hboxLayout)

Well after struggling with all of my other failures, this is what I came up
with too.
But the text boxes in each vlayout are about half as wide as the main form.
So I'm now trying to make them smaller.

>>he group box is just an ordinary widget that can be used to contain other
>>widgets. It needs a layout inside it to organise those other widgets.
That's the missing piece I needed.

>>You can experiment with this sort of thing with Qt Designer.
I started with designer, then quickly dropped it. It's not like the WYSIWIG
IDE's I've used before.
I couldn't get the widgets I wanted to stay in the place I wanted them, nor
stay the size I wanted. They kept resizing to the maximum width/height.
When I dropped spacers onto the form, I couldn't position them nor keep them
at a specific size.
This is the first time I've dealt with automatic layout management.
(as if you didn't know that already) ;-)

I was able to do the pyuic compile, and subclass that form, but the widgets
size/locations weren't what I wanted.
>>Also, you might want to take a look at this presentation and its
accompanying
http://indico.cern.ch/contributionDisplay.py?contribId=33&sessionId=41&confId=44
This is great! The best docs for pyQT I've seen!
Can you get it on the Wiki, and/or have it included in the pyqt
distribution? It would be a great help for first time pyQT users.

BTW- on page 11- It would help me (and other newbies) if you would
illustrate which widgets are parents and which are children.
For a newbie, the buttons are the widgets. The implication is that the
Layout is a also widget- the parent widget, but the "Placing widgets in a
layout" implies that the layout is not a widget. The separation between
parent & child isn't immediately obvious.


Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070201/439030e5/attachment.html


More information about the PyQt mailing list