Example #1
0
 def cut(self):
     self.copy()
     index = self.view.tableView.selectionModel().selectedIndexes()[0]
     command = EditCommand(self.table_model, index)
     command.newValue("")
     self.undoStack.beginMacro("Cut")
     self.undoStack.push(command)
     self.undoStack.endMacro()
     self.set_undo_redo_text()
     self.view.tableView.reset()
Example #2
0
    def paste(self):
        if len(self.view.tableView.selectionModel().selectedIndexes()) == 0:
            return

        clipboard = QApplication.clipboard()
        index = self.view.tableView.selectionModel().selectedIndexes()[0]
        command = EditCommand(self.table_model, index)
        command.newValue(str(clipboard.text()))

        self.undoStack.beginMacro("Paste")
        self.undoStack.push(command)
        self.undoStack.endMacro()
        self.set_undo_redo_text()
        self.view.tableView.reset()
Example #3
0
    def paste(self):
        table = self.model.getCurrentTable()
        selectedIndexes = self.model.getCurrentTable().getView().selectionModel().selectedIndexes()
        if len(selectedIndexes) == 0:
            return

        sys_clip = QApplication.clipboard()
        value = str(sys_clip.text())
        index = selectedIndexes[0]
        cmd = EditCommand(self.model.getCurrentTable(), index)
        cmd.newValue(value)
        table.getUndoStack().beginMacro("Pasted Text")
        table.getUndoStack().push(cmd)
        table.getUndoStack().endMacro()
        self.editedSomething()
Example #4
0
    def cut(self):
        table = self.model.getCurrentTable()
        selectedIndexes = self.model.getCurrentTable().getView().selectionModel().selectedIndexes()
        if len(selectedIndexes) == 0:
            return

        sys_clip = QApplication.clipboard()
        selection = selectedIndexes[0]
        selected_text = str(self.model.getCurrentTable().data(selection))
        sys_clip.setText(selected_text)

        cmd = EditCommand(self.model.getCurrentTable(), selection)
        cmd.newValue("")
        table.getUndoStack().beginMacro("Cutted Text")
        table.getUndoStack().push(cmd)
        table.getUndoStack().endMacro()

        self.editedSomething()