I have a QTreeWidget
with QTreeWidgetItems
and sometimes the items have an icon. So I set the icon using:
self.setIcon(0, icon)
But how do I remove that icon again?
self.setIcon(0, None)
gives
TypeError: 'PySide.QtGui.QTreeWidgetItem.setIcon' called with wrong argument types:
PySide.QtGui.QTreeWidgetItem.setIcon(int, NoneType)
Supported signatures:
PySide.QtGui.QTreeWidgetItem.setIcon(int, PySide.QtGui.QIcon)
For completeness I write down the comment of vahancho as an answer.
Set an empty icon:
item.setIcon(column, QtGui.QIcon())
This also makes sense since even without setting an icon
item.icon(column)
does return a QIcon
object. So Qt probably internally presets the icons with empty icons anyway.