while using:

        PyQt-x11-gpl-4.5-snapshot-20090304

on:
        Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) 
        [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2

If I don't keep a persistent reference to a spacer Item I get a
segfault. This is a new event since upgrading from 4.4 to 4.5.  I've
attached the code, and one thing that is peculiar is that I just need
'a' reference to a spacer item.

so should I keep a reference to spacer items?

mbs
from PyQt4 import QtGui,QtCore
import sys
        
class Window(QtGui.QWidget):
    def __init__(self,parent=None):
        QtGui.QWidget.__init__(self,parent)
        self.setWindowTitle("working")
        layout = QtGui.QGridLayout()
        self.ab = QtGui.QLabel("words",self)
        self.bc = QtGui.QLabel("things",self)
        layout.addWidget(self.ab,0,0)
        layout.addWidget(self.bc,1,0)
        
        #SEGFAULTS
        #previous working method, seg faults now
        #layout.addItem(QtGui.QSpacerItem(10,10,QtGui.QSizePolicy.Expanding),2,0)
        
        #SEGFAULTS
        #not working check,
        #x = QtGui.QSpacerItem(10,10,QtGui.QSizePolicy.Expanding)
        #layout.addItem(x,2,0)
        
        #working check
        self.x = QtGui.QSpacerItem(10,10,QtGui.QSizePolicy.Expanding)
        layout.addItem(self.x,3,0)

        #very odd working version
        #layout.addItem(QtGui.QSpacerItem(10,10,QtGui.QSizePolicy.Expanding),2,0)
        #self.x = QtGui.QSpacerItem(10,10,QtGui.QSizePolicy.Expanding)
        
        layout.setRowStretch(2,1)
        self.setLayout(layout)
                
if __name__=="__main__":
    app = QtGui.QApplication(sys.argv)
    qb = Window()
    qb.show()
    sys.exit(app.exec_())
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to