[PyQt] Can't set icon on QTreeWidgetItem

Filip Gruszczyński gruszczy at gmail.com
Thu Nov 19 16:44:44 GMT 2009

I am trying to set an icon on QTreeWidgetItem and I can't achieve
this. The icon simply doesn't appear. The code is short:

class MessageBoxSelect(QTreeWidget):


	def __init__(self, parent=None):

		QTreeWidget.__init__(self, parent)



		self.setIconSize(QSize(12, 12))

		self.model().setHeaderData(0, Qt.Horizontal,

								   self.tr(u"Wszystkie foldery"))


		self.root = QTreeWidgetItem()

		self.root.setText(0, self.tr(u'Lokalne foldery'))

		self.root.setIcon(0, QIcon(':/images/registration.png'))


Could anyone help me?

Filip Gruszczyński

More information about the PyQt mailing list