def keyPressEvent(self, e):
completion_prefix = self.text_under_cursor()
if self.cmp and self.popup_widget.func_list_widget.isVisible():
current_row = self.popup_widget.func_list_widget.currentRow()
if e.key() == Qt.Key_Down:
self.current_item_down(current_row)
return
if e.key() == Qt.Key_Up:
self.current_item_up(current_row)
return
if e.key() in (Qt.Key_Return, Qt.Key_Enter):
selected_word = self.popup_widget.func_list_widget.currentItem().text()
self.insert_func_name_signal.emit(completion_prefix, selected_word)
return
if e.key() in (Qt.Key_Return, Qt.Key_Enter):
self.parse_content()
is_shortcut = ((e.modifiers() & Qt.ControlModifier) and e.key() == Qt.Key_E) # shortcut key:ctrl + e
if is_shortcut:
self.cmp.update("", self.popup_widget)
self.update_popup_widget_position()
self.activateWindow()
return
if not self.cmp or not is_shortcut:
super(TextEdit, self).keyPressEvent(e)
评论列表
文章目录