[PyQt] QComboBox inside the QTreeWidgetItem?
piotr.byzia at gmail.com
Wed Nov 4 08:24:24 GMT 2009
This is my first post to the list, so hello everyone!
I recently started developing a small PyQT4 application with VTK 3D
visualization, and I encountered a few problems, first one is
described in this email.
I wanted to include a combo box inside my QTreeWidgetItem, but it does
no appear on the screen:
self.tree_item = QTreeWidgetItem(self.widget_layers, [QString
combo = QComboBox()
combo.addItem(QString('1st item'), Qt.DisplayRole)
self.widget_layers.setItemWidget(self.tree_item, 4, combo)
print type(self.widget_layers), type(self.tree_item), type(combo)
print returns following values:
<class 'PyQt4.QtGui.QtreeWidget'> <class
'PyQt4.GtGui.QTreeWidgetItem'> <class 'PyQt4.QtGui.QComboBox'>
What am I doing wrong?
I found similar listing in the archive:
but author seems to have no problem with the QPushButton, which does
not appear in my app, so I assume that there is some other problem
than defining combo box like above?
And once it's working, how can I connect to its activated SIGNAL?
More general question would be: how can I get a reference to the given
item in the QTreeWidgetItem? There is text() but it's now always the
More information about the PyQt