def __init__(self, parent):
        """ Constructor
        """
        super(CollectorTree, self).__init__(parent=parent)

        self._comboLabels = None

        nCols = 1
        model = QtGui.QStandardItemModel(3, nCols)
        self.setModel(model)
        self.setTextElideMode(Qt.ElideMiddle) # ellipsis appear in the middle of the text

        self.setRootIsDecorated(False) # disable expand/collapse triangle
        self.setUniformRowHeights(True)

        self.setAlternatingRowColors(True)
        self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
        self.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
        self.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
        self.setAnimated(True)
        self.setAllColumnsShowFocus(True)
        self.setContextMenuPolicy(Qt.ActionsContextMenu)
        self.setIconSize(COLLECTOR_TREE_ICON_SIZE)

        treeHeader = self.header()
        treeHeader.setStretchLastSection(False)
        treeHeader.setSectionsMovable(False)

        treeHeader.resizeSection(0, 400) # For item path
        treeHeader.setSectionResizeMode(QtWidgets.QHeaderView.Interactive) # don't set to stretch

        labels = [''] * model.columnCount()
        labels[0] = "path"
        model.setHorizontalHeaderLabels(labels)
def __init__ ( self , parent ) : super ( CollectorTree , self ) . __init__ ( parent = parent ) self . _comboLabels = None nCols = 1 model = QtGui . QStandardItemModel ( 3 , nCols ) self . setModel ( model ) self . setTextElideMode ( Qt . ElideMiddle ) self . setRootIsDecorated ( False ) self . setUniformRowHeights ( True ) self . setAlternatingRowColors ( True ) self . setSelectionBehavior ( QtWidgets . QAbstractItemView . SelectRows ) self . setSelectionMode ( QtWidgets . QAbstractItemView . SingleSelection ) self . setHorizontalScrollMode ( QtWidgets . QAbstractItemView . ScrollPerPixel ) self . setAnimated ( True ) self . setAllColumnsShowFocus ( True ) self . setContextMenuPolicy ( Qt . ActionsContextMenu ) self . setIconSize ( COLLECTOR_TREE_ICON_SIZE ) treeHeader = self . header ( ) treeHeader . setStretchLastSection ( False ) treeHeader . setSectionsMovable ( False ) treeHeader . resizeSection ( 0 , 400 ) treeHeader . setSectionResizeMode ( QtWidgets . QHeaderView . Interactive ) labels = [ '' ] * model . columnCount ( ) labels [ 0 ] = "path" model . setHorizontalHeaderLabels ( labels )
Constructor