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

List:       pykde
Subject:    [PyQt] removeItem from layout problem
From:       "Doug Nichols" <doug16 () gmail ! com>
Date:       2008-09-21 2:36:44
Message-ID: dea78ab30809201936m7fa3e19cn11006bcd9c5673e7 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@gmail.com
http://dnwnichols.home.comcast.net/

[Attachment #5 (text/html)]

<div dir="ltr"><br>I have a QFrame with a QVBoxLayout as it&#39;s layout.&nbsp; The \
layout has a QLabel, then anywhere from 0 - 5 QHBoxLayouts in it followed by a \
QSpacerItem to push everybody to the top.&nbsp; The problem I&#39;m having is that \
when I use removeItem for the top QHBoxLayout, it does not erase the contents of the \
QHBoxLayout.&nbsp; The remaining ones will move up and fill in the old location with \
the background, but the background won&#39;t fill in the removed item&#39;s \
space.&nbsp; Here is the code I&#39;m trying now, (I added some del item lines to try \
to help, I even try hide and reshowing)<br> \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; item = \
self.ListLayout.itemAt(1)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if not \
isinstance(item,&nbsp; \
QSpacerItem):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
print &quot;removing:&quot;, \
item<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lo = \
item.layout()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
while True:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
i=lo.takeAt(0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
print &quot;item:&quot;, \
i<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
if i is None : break<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
del i<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
self.ListLayout.removeItem(item)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
del lo<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; del \
item<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
self.ListFrame.hide()<br> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
self.ListFrame.show()<br><br>Please provide some insight.<br><br>Thanks,<br \
clear="all"><br>-- <br>Doug Nichols<br><a \
href="mailto:doug16@gmail.com">doug16@gmail.com</a><br><a \
href="http://dnwnichols.home.comcast.net/">http://dnwnichols.home.comcast.net/</a><br>


</div>



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

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

Configure | About | News | Add a list | Sponsored by KoreLogic