[PyQt] QTreeWidget and Qt Designer

Thorsten Kampe thorsten at thorstenkampe.de
Sun Apr 11 17:08:13 BST 2010


Two short questions about creating QTreeWidgets with Qt Designer:

1. When I resize (increase the height of) my main window the tree widget 
"inside" only increases up to a certain size. After that the tree widget 
does not increase in size anymore and I get a (useless) grey border 
between the tree widget and the main window.

This only happens when I use Qt Designer to create the widget. When I 
use "treeWidget = QTreeWidget(); self.setCentralWidget(treeWidget)" the 
tree widget grows dynamically to the size of the main window. What can I 
do to make QTreeWidget created with Qt Designer behave like the ones 
manually created?

2. It is possible to create QTreeWidgetItems inside QTreeWidgets with Qt 
Designer. How can I create child items to these items from within my 
code?

To create a child I have to create a QTreeWidgetItem and pass the name 
(objectName) of the parent QTreeWidgetItem. The problem is that I cannot 
find any "objectName" associated with the QTreeWidgetItems created with 
Qt Designer. 


Thorsten



More information about the PyQt mailing list