[PyQt] Parent/Child widget clipping

JPolk jpolk5001 at yahoo.com
Wed Feb 1 02:02:08 GMT 2012


So after tinkering with this a bit more, I'm in another conundrum, lol...

When I replace the 'child-table'  (QTableWidget) with another kind of
widget,
and give a size using 'setGeometry'...the solution no longer works...

Why is that? What am I doing wrong, Pete?

#----------------------------------------------------------------------------------------

#!/usr/bin/env python

import sys
from PyQt4 import QtGui, QtCore

class MainExample(QtGui.QWidget):
    def __init__(self, pParent=None):
        super(MainExample, self).__init__(pParent)

        scrX = 2048
        scrY = 1152
        winX = 550
        winY = 400
        pX   = (scrX - winX) / 2
        pY   = (scrY - winY) / 2

        self.setGeometry(pX, pY, winX, winY)
        self.setLayout(QtGui.QVBoxLayout())
        self.LargeTable = QtGui.QTreeWidget()
        self.LargeTable.setColumnCount(3)

        self.layout().addWidget(self.LargeTable)

*        self.widget = QtGui.QWidget(self)
        self.widget.setGeometry(QtCore.QRect(10, 10, 400, 300))*

        for i in range(0, 2):
                parent = QtGui.QTreeWidgetItem(self.LargeTable, ['Parent %s'
% i] )

                for j in range(0, 3):
                        child = QtGui.QTreeWidgetItem(parent, ['Child %s' %
j])

*       
self.LargeTable.setItemWidget(self.LargeTable.topLevelItem(0).child(1), 0,
self.widget)*
       
self.LargeTable.setFirstItemColumnSpanned(self.LargeTable.topLevelItem(0).child(1),
True)
        self.LargeTable.expandAll()

if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    form = MainExample()
    form.show()
    form.raise_()
    sys.exit(app.exec_())

#------------------------------------------------------------------------

--
View this message in context: http://python.6.n6.nabble.com/Parent-Child-widget-clipping-tp4352146p4355087.html
Sent from the PyQt mailing list archive at Nabble.com.


More information about the PyQt mailing list