def __init__(self, configTreeModel, parent=None):
        """ Constructor
        """
        super(ConfigTreeView, self).__init__(treeModel=configTreeModel, parent=parent)

        self.expanded.connect(configTreeModel.expand)
        self.collapsed.connect(configTreeModel.collapse)
        #configTreeModel.update.connect(self.update) # not necessary
        #self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectItems)

        treeHeader = self.header()
        treeHeader.resizeSection(ConfigTreeModel.COL_NODE_NAME, RIGHT_DOCK_WIDTH * 0.5)
        treeHeader.resizeSection(ConfigTreeModel.COL_VALUE, RIGHT_DOCK_WIDTH * 0.5)

        headerNames = self.model().horizontalHeaders
        enabled = dict((name, True) for name in headerNames)
        enabled[headerNames[ConfigTreeModel.COL_NODE_NAME]] = False # Name cannot be unchecked
        enabled[headerNames[ConfigTreeModel.COL_VALUE]] = False # Value cannot be unchecked
        checked = dict((name, False) for name in headerNames)
        checked[headerNames[ConfigTreeModel.COL_NODE_NAME]] = True # Checked by default
        checked[headerNames[ConfigTreeModel.COL_VALUE]] = True # Checked by default
        self.addHeaderContextMenu(checked=checked, enabled=enabled, checkable={})

        self.setRootIsDecorated(False)
        self.setUniformRowHeights(True)
        self.setItemDelegate(ConfigItemDelegate())
        self.setEditTriggers(QtWidgets.QAbstractItemView.AllEditTriggers)
def __init__ ( self , configTreeModel , parent = None ) : super ( ConfigTreeView , self ) . __init__ ( treeModel = configTreeModel , parent = parent ) self . expanded . connect ( configTreeModel . expand ) self . collapsed . connect ( configTreeModel . collapse ) treeHeader = self . header ( ) treeHeader . resizeSection ( ConfigTreeModel . COL_NODE_NAME , RIGHT_DOCK_WIDTH * 0.5 ) treeHeader . resizeSection ( ConfigTreeModel . COL_VALUE , RIGHT_DOCK_WIDTH * 0.5 ) headerNames = self . model ( ) . horizontalHeaders enabled = dict ( ( name , True ) for name in headerNames ) enabled [ headerNames [ ConfigTreeModel . COL_NODE_NAME ] ] = False enabled [ headerNames [ ConfigTreeModel . COL_VALUE ] ] = False checked = dict ( ( name , False ) for name in headerNames ) checked [ headerNames [ ConfigTreeModel . COL_NODE_NAME ] ] = True checked [ headerNames [ ConfigTreeModel . COL_VALUE ] ] = True self . addHeaderContextMenu ( checked = checked , enabled = enabled , checkable = { } ) self . setRootIsDecorated ( False ) self . setUniformRowHeights ( True ) self . setItemDelegate ( ConfigItemDelegate ( ) ) self . setEditTriggers ( QtWidgets . QAbstractItemView . AllEditTriggers )
Constructor