예제 #1
0
 def cut(self):
     self.copy()
     index = self.view.tableView.selectionModel().selectedIndexes()[0]
     command = EditCommand(self.model, index)
     command.newValue("")
     self.undoStack.beginMacro("Cut")
     self.undoStack.push(command)
     self.undoStack.endMacro()
     self.view.tableView.reset()
예제 #2
0
 def cut(self):
     self.copy()
     index = self.view.tableView.selectionModel().selectedIndexes()[0]
     command = EditCommand(self.model, index)
     command.newValue("")
     self.undoStack.beginMacro("Cut")
     self.undoStack.push(command)
     self.undoStack.endMacro()
     self.view.tableView.reset()
예제 #3
0
    def paste(self):
        if len(self.view.tableView.selectionModel().selectedIndexes()) != 0:
            clipboard = QApplication.clipboard()
            index = self.view.tableView.selectionModel().selectedIndexes()[0]
            command = EditCommand(self.model, index)
            command.newValue(str(clipboard.text()))

            self.undoStack.beginMacro("Paste")
            self.undoStack.push(command)
            self.undoStack.endMacro()
            self.view.tableView.reset()
예제 #4
0
    def paste(self):
        if len(self.view.tableView.selectionModel().selectedIndexes()) != 0:
            clipboard = QApplication.clipboard()
            index = self.view.tableView.selectionModel().selectedIndexes()[0]
            command = EditCommand(self.model, index)
            command.newValue(str(clipboard.text()))

            self.undoStack.beginMacro("Paste")
            self.undoStack.push(command)
            self.undoStack.endMacro()
            self.view.tableView.reset()
예제 #5
0
    def action_cut_cell(self):
        if self.action_copy_cell():
            # no else case since it was handled in the copy callback
            index = self.first_selected_index()
            command = EditCommand(self.table_model, index)
            command.newValue("0")

            self.model.undo_stack.beginMacro("Cut Cell")
            self.model.undo_stack.push(command)
            self.model.undo_stack.endMacro()

            self.update_undo_actions()
            self.view.tableView.reset()
예제 #6
0
    def action_paste_cell(self):
        if self.cell_selected():
            clipboard = QApplication.clipboard()
            index = self.view.tableView.selectionModel().selectedIndexes()[0]
            command = EditCommand(self.table_model, index)
            command.newValue(clipboard.text())

            self.model.undo_stack.beginMacro("Paste Cell")
            self.model.undo_stack.push(command)
            self.model.undo_stack.endMacro()

            self.update_undo_actions()
            self.view.tableView.reset()
            return True
        else:
            # TODO
            return False
예제 #7
0
 def editorEvent(self, event, model, option, index):
     self.edit = EditCommand(model, index)