[PyKDE] Disappearing Layout Widget

James Emerton ephelon at gmail.com
Mon Aug 15 18:30:37 BST 2005


On 8/11/05, Chad Brantly <cbrantly at darwin.sfbr.org> wrote:
> This kind of works, but not exactly.
> self.SearchCriteriaGroupBox.layout() is a QVBoxLayout, not the
> QGridLayout.  I need to get to the QGridLayout created in the ui file
> and insert another widget into it.  I tried changing the last line of
> main.py to:
> 
>      SearchCrteriaGroupBoxLayout = QGridLayout
> (self.SearchCriteriaGroupBox.layout())
>      SearchCriteriaGroupBoxLayout.addMultiCellWidget
> (self.SearchCriteriaListView, 0, 0, 0, 4)
> 
> But as you would expect, it just added a second QGridLayout below the
> one created by ui.py.  Is there anyway to get to add a widget to the
> QGridLayout that was created by ui.py?
> 

It should be possible to navigate the various layout's children to get
at the correct instance.    I haven't tried this, so you're going to
have to experiment.  (Python's interactive shell is one of its best
features.)

May I suggest that it might me simpler to use a placeholder.  Use
designer to place a QFrame where you'd like to add your control
programmatically.

James




More information about the PyQt mailing list