[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyKDE] Re: Disappearing Layout Widget
From:       Chad Brantly <cbrantly () darwin ! sfbr ! org>
Date:       2005-08-16 21:02:06
Message-ID: ddtk8f$ctp$1 () sea ! gmane ! org
[Download RAW message or body]

James Emerton wrote:
> It should be possible to navigate the various layout's children to get
> at the correct instance.    

This method did work.  I was able to walk get the children of the layout and
add my ListView to the child (QGridLayout).  In my case, the QGridLayout is
the only child, so I just chose layout().childrent()[0], but I suppose that
you could check the type of each child if there were multiple children.  

> 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.

Come on...where is your sense of adventure?  That would be way to easy!

Here is a simplified version of my code in case someone else runs into the
same problem:

>From ui.py:
=================
class Form1(QMainWindow):
  def __init__(self,parent=None,name=None,fl=0):
    QMainWindow.__init__(self,parent,name,fl)
    *snip*
    self.GroupBox=QGroupBox(self.SearchTab,"GroupBox")
    GroupBoxLayout=QGridLayout(self.GroupBox.layout())

>From main.py:
=================
class Form2(ui.Form1, QMainWindow):
  def __init__(self, parent=None, name=None, fl=0):
    ui.Form1.__init__(self, parent, name, fl)
    self.GroupBoxLayout=self.GroupBox.layout().children()[0]
    self.GroupBoxLayout.addMultiCellWidget(self.myListView,0,0,0,4)

_______________________________________________
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