[PyKDE] pyuic and Access to QGridLayout

Chad Brantly cbrantly at darwin.sfbr.org
Thu Feb 2 22:52:26 GMT 2006


I need to add some widgets to a QGridLayout that was created in Designer. 
In designer I created a QGroupBox (called group_box) and gave it a
QGridLayout.  I then ran pyuic2.4.  In the resulting python code there is
no way to access group_boxLayout.  I can access self.group_box, but the
layout instance is not preserved.  

My next thought was that I would access the layout widget by name using:

   self.group_box.layout().child('mygridlayout')  

I couldn't find a way in to add a name to a layout in Designer, so I edted
the xml by hand and added the name like this:

   <grid>
      <property name="name">
         <cstring>mygridlayout</cstring>
      </property>

However, when I ran pyuic2.4, the name was not preserved.  I know that it is
possible to name the layout widget in python, because I was able to do it
using group_boxLayout.setName('mygridlayout'), but of course this is
removed every time I run pyuic.

Can anybody tell me a way to access the QGridLayout?  Alternatively, would
it be possible to alter pyuic to preserve the layout name or make layout
instances available throughout the class? (self.group_boxLayout instead of
only group_boxLayout)

Thanks in advance for your help!

Chad Brantly




More information about the PyQt mailing list