PDA

View Full Version : Space in qtreewidget



ecce
19th April 2015, 13:30
I have a QTreeWidget with a few columns in it. All the items in the list appears a bit in from left side, see the attached file. I want them all the way out to the left. This is the code I use for adding items to the list:


class PolicyList(QTreeWidget):

def addItem(self, ipv4):
self.expandItem(parent)
item = QTreeWidgetItem(self)
item.setText(0, ipv4)
item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsUserCheckable | Qt.ItemIsEnabled | Qt.ItemIsDragEnabled | Qt.ItemIsEditable)
item.setIcon(0,self.style().standardIcon(QStyle.SP _FileIcon))
return item

11098

anda_skoa
19th April 2015, 13:50
Since you set ItemIsUserCheckable, my guess is that empty space is likely where a checkmark will be placed for checked items.

Cheers,
_

ecce
19th April 2015, 14:32
No, that's not it. It's not any of the flags, I've tried removing them all.

How do I know if the item I add is a root item? I get the feeling the space is because of all the items in the list are children to the wrong parents or something.

EDIT: Got it! QTreeWidget.setRootIsDecorated(False)