def __init__(self, parent): QTableView.__init__(self, parent) self._parent = parent self.delete_queue = [] self.source_model = LSPServersModel(self) self.setModel(self.source_model) self.setItemDelegateForColumn(CMD, ItemDelegate(self)) self.setSelectionBehavior(QAbstractItemView.SelectRows) self.setSelectionMode(QAbstractItemView.SingleSelection) self.setSortingEnabled(True) self.setEditTriggers(QAbstractItemView.AllEditTriggers) self.selectionModel().selectionChanged.connect(self.selection) self.verticalHeader().hide() self.load_servers()
def __init__(self, parent, proxy, language=None, text_color=None): super(SnippetTable, self).__init__() self._parent = parent self.language = language self.proxy = proxy self.source_model = proxy.get_model( self, language.lower(), text_color=text_color) self.setModel(self.source_model) self.setItemDelegateForColumn(CMD, ItemDelegate(self)) self.setSelectionBehavior(QAbstractItemView.SelectRows) self.setSelectionMode(QAbstractItemView.SingleSelection) self.setSortingEnabled(True) self.setEditTriggers(QAbstractItemView.AllEditTriggers) self.selectionModel().selectionChanged.connect(self.selection) self.verticalHeader().hide() self.reset_plain()