Hello,
your self must be your widget and you may need two more lines. Example with a copy from tableview:
self.
ui.
tableView.
copyAction = QtGui.
QAction('&Copy', self.
ui.
tableView) self.ui.tableView.copyAction.setShortcutContext(QtCore.Qt.WidgetShortcut)
self.ui.tableView.copyAction.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_C)
self.ui.tableView.copyAction.setStatusTip('Copy to the Clipboard')
self.ui.tableView.addAction(self.ui.tableView.copyAction)
self.ui.tableView.copyAction.triggered.connect(self.copy)
self.ui.tableView.copyAction = QtGui.QAction('&Copy', self.ui.tableView)
self.ui.tableView.copyAction.setShortcutContext(QtCore.Qt.WidgetShortcut)
self.ui.tableView.copyAction.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_C)
self.ui.tableView.copyAction.setStatusTip('Copy to the Clipboard')
self.ui.tableView.addAction(self.ui.tableView.copyAction)
self.ui.tableView.copyAction.triggered.connect(self.copy)
To copy to clipboard, switch view to plain text mode
Bookmarks