Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
1.1.0
-
f93da21b3286db1bf693c26df47a538e581ff908
Description
The method setItemWidget of a QTreeWidget is used to set a widget for a given column for a given item.
setItemWidget has been confirmed to work with PyQt 4.9.1, however, it does not show anything when using either PySide 1.1.0 or PySide 1.1.1
The following test program was used. It will create a small window with single item. The second column of the item will have a QPushButton. Comment the line "from PyQt4 import QtGui" and uncomment the line "from PySide import QtGui" to use PySide. No button will be shown in that case.
import sys # If using PyQt4, a push button will be shown on column 1 of the tree widget from PyQt4 import QtGui # If using PySide, no button will be shown on column 1 of the tree widget #from PySide import QtGui app = QtGui.QApplication(sys.argv) treeWidget = QtGui.QTreeWidget() treeWidget.setColumnCount(2) item = QtGui.QTreeWidgetItem(['text of column 0', '']) treeWidget.insertTopLevelItem(0, item) treeWidget.setItemWidget(item, 1, QtGui.QPushButton('Push button on column 1')) treeWidget.show() app.exec_() sys.exit()