def headerContextMenu(self,pos): model = self.model() import pyqtui4.enhancedstandarditemmodel as esm if typecheck.check_inheritance(model,[esm.EnhancedStandardItemModel]): context = QtGui.QMenu(self) actionmap = {} for colkey,colinfo in model.columninfo.items(): action = context.addAction(colinfo['text']) actionmap[action] = colkey action.setCheckable(True) if not self.isColumnHidden(colinfo['columnindex']): action.setChecked(True) action.column_key = colkey action = context.exec_(QtGui.QCursor.pos()) self.toggleHiddenColumn(model.columnIndexByKey(actionmap[action]))
def setModel(self,model): import pyqtui4.enhancedstandarditemmodel as esm self.enhanced_model = False if typecheck.check_inheritance(model,[esm.EnhancedStandardItemModel]): self.enhanced_model = True self.base_cls.setModel(self,model)