I'm using PyQt 4.5.1

For some reason the parent is changing, but only when a QGroupBox is used...
Another odd thing is that if I uncomment out the line 
"self.layout.addWidget(self.box), it crashes (e.g. stalls out completely, and I 
have to kill the shell)

Here is the sample script that produces the issue:
#################
import sys

from PyQt4 import QtCore, QtGui


class MyWidget(QtGui.QWidget):
    def __init__(self, parent):
        QtGui.QWidget.__init__(self, parent)

        self.box = QtGui.QGroupBox()
        self.tree = QtGui.QTreeWidget(self)

        print "Tree's parent before being layed out:",  self.tree.parent()

        self.layout = QtGui.QVBoxLayout()
        self.layout.addWidget(self.tree)
        self.box.setLayout(self.layout)

        print "Tree's parent after being layed out:",  self.tree.parent()

        self.othertree = QtGui.QTreeWidget(self)
        print "Other Tree's parent before being layed out:",  
self.othertree.parent()
        self.otherlayout = QtGui.QVBoxLayout()
        self.otherlayout.addWidget(self.othertree)
        self.setLayout(self.otherlayout)
        print "Other Tree's after before being layed out:",  
self.othertree.parent()

#        self.layout.addWidget(self.box)

if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    widget = MyWidget(None)
    widget.show()
    sys.exit(app.exec_())

#################

Thanks!
-Nate
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to