示例#1
0
    def setModel(self, model):
        BaseTreeView.setModel(self, model)

        if self.contextMenuEnabled:
            self.mainCtxMenu = self.__class__.contextMenuClass(self)

        self.sortByColumn(0, Qt.AscendingOrder)

#        headerView = self.header()
#        if headerView.visualIndex(model.imageSection) > 0:
#            headerView.moveSection(model.imageSection, 0)
#        headerView.setResizeMode(model.imageSection, QtGui.QHeaderView.Fixed)

#        # hiding unwanted column
#        sPropertyList = Item.childrenViewProperties
#        for i, sProperty in enumerate(model.propertyList):
#                self.setColumnHidden(i, sProperty not in sPropertyList)

        self.setItemHeight(self.itemHeight)
        self.resizeColumnsToContents()
示例#2
0
 def setRootIndex(self, newRootIndex):
     res = BaseTreeView.setRootIndex(self, newRootIndex)
     self.rootIndexChanged.emit(newRootIndex)
     return res