def keyPressEvent(self, qkeyevent):
if qkeyevent.matches(QKeySequence.Copy):
selected_rows = [x.row() for x in self.selectionModel().selectedRows()]
logger.info('Copy to clipboard requested [%r rows]' % len(selected_rows))
out_string = ''
for row in selected_rows:
out_string += self.get_row_as_string(row) + os.linesep
if out_string:
QApplication.clipboard().setText(out_string)
else:
super(BasicTable, self).keyPressEvent(qkeyevent)
if qkeyevent.matches(QKeySequence.InsertParagraphSeparator):
if self.hasFocus():
self.on_enter_pressed([(x.row(), x.column()) for x in self.selectedIndexes()])
评论列表
文章目录