[PyQt] removeItem from layout problem

Doug Nichols doug16 at gmail.com
Sun Sep 21 03:36:44 BST 2008


I have a QFrame with a QVBoxLayout as it's layout.  The layout has a QLabel,
then anywhere from 0 - 5 QHBoxLayouts in it followed by a QSpacerItem to
push everybody to the top.  The problem I'm having is that when I use
removeItem for the top QHBoxLayout, it does not erase the contents of the
QHBoxLayout.  The remaining ones will move up and fill in the old location
with the background, but the background won't fill in the removed item's
space.  Here is the code I'm trying now, (I added some del item lines to try
to help, I even try hide and reshowing)

        item = self.ListLayout.itemAt(1)
        if not isinstance(item,  QSpacerItem):
            print "removing:", item
            lo = item.layout()
            while True:
                i=lo.takeAt(0)
                print "item:", i
                if i is None : break
                del i
            self.ListLayout.removeItem(item)
            del lo
            del item
            self.ListFrame.hide()
            self.ListFrame.show()

Please provide some insight.

Thanks,

-- 
Doug Nichols
doug16 at gmail.com
http://dnwnichols.home.comcast.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080921/6dd3315e/attachment.html


More information about the PyQt mailing list