def __init__(self, source, column_order, parent=None): QTableWidget.__init__(self, parent) if parent: self.log = parent.parent().log self.setShowGrid(False) self.setSelectionBehavior(QAbstractItemView.SelectRows) # self.setDragDropMode(QAbstractItemView.DragDrop) self.setDragEnabled(True) self.setAcceptDrops(True) # self.setDragDropOverwriteMode(True) # self.setDropIndicatorShown(True) self.verticalHeader().hide() hdr = self.horizontalHeader() if QT_VER == 4: hdr.setResizeMode(QHeaderView.Interactive) else: hdr.setSectionResizeMode(QHeaderView.Interactive) # self.setDropIndicatorShown(True) self.source = source self.hidden_row = None self.empty_row = None self.state = uuid1() self.handle_drop = None self.rearrange = None self.keypress = None self.setColumnHeaders(column_order) self.show() self.source.set_table(self) if hasattr(source, 'sequence') and source.sequence: self._refresh()
def __init__(self, parent=None): QTableWidget.__init__(self, parent) self._cornerText = '' self._cornerButton = self.findChildren(QAbstractButton)[0] self._cornerButton.installEventFilter(self) self.setSelectionMode(QAbstractItemView.NoSelection)
def __init__(self, parent, validator, curvalue, fmtstr, client, allow_enter=False): self._rows, self._cols = curvalue.shape self.validator = validator QTableWidget.__init__(self, self._rows, self._cols, parent) for i in range(self._rows): for j in range(self._cols): self.setItem(i, j, QTableWidgetItem(fmtstr % curvalue[i, j])) self.cellChanged.connect(lambda i, j: self.valueModified.emit())
def __init__(self, parent=None): QTableWidget.__init__(self, parent)