[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyKDE] autoAdding buttons to a grid
From: Richard Smith <smithbone () gmail ! com>
Date: 2005-05-17 13:55:34
Message-ID: 8a0c36780505170655729dd401 () mail ! gmail ! com
[Download RAW message or body]
I just started using pyQt and I seem to need a little guidance...
I'm trying to auto add several more QPushButtons to a QGridLayout but
I either get runtime type errors or if it dosen't error then they
don't seem to show.
I have a form with a QButtonGroup on it that I created with the
designer called bgMain. I've subclassed my window from the class
generated by pyuic
Via the designer I have 3 buttons in the buttongroup and they are
managed by a GridLayout
So I have self.bgMain which is the reference to the buttongroup.
When one of the buttons is clicked I want to populate several more
buttons into that gridlayout in the buttongroup. I don't really care
about the order so AutoAdd seemed to be what I needed.
Looking at the pyuic code and reading the Qt docs I've come up with
items = ["test1","test2","test3"]
bgMainLayout = QGridLayout(self.bgMain.layout())
bgMainLayout.setAutoAdd(1)
for each in items:
self.bgMain.insert(QPushButton(self.bgMain,each))
bgMainLayout.activate()
But the items never showup in my buttongroup.
I've tried various permutations with bgMainLayout.addWidget() and
setting the row and col directly like I see done in the pyuic code but
still the items never show.
Do I have to call some refresh on the window or something? All the QT
examples I found seems to suggest that activate() should re-layout the
grid.
Thanks.
--
Richard A. Smith
_______________________________________________
PyKDE mailing list PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic