【发布时间】:2019-06-14 05:16:34
【问题描述】:
我有 MainWindow 类,它有 qscintilla 编辑器,我想在编辑器 mousePressEvent 中添加监听器
class MainWindow(QtWidgets.QMainWindow, gui.Ui_MainWindow):
def __init__(self):
super().__init__()
self.setupUi(self)
self.editor.mousePressEvent = self.on_editor_click
def on_editor_click(self, QMouseEvent):
// here i want add my code
return QsciScintilla.mousePressEvent(self, QMouseEvent)
如果我覆盖 mousePressEvent - 编辑器将损坏(鼠标单击将不起作用)。我尝试调用初始 mousePressEvent,但它不起作用,应用程序崩溃
【问题讨论】:
-
QsciScintilla.mousePressEvent(self.editor, QMouseEvent) -
谢谢,我测试过了,它崩溃了
标签: python pyqt5 qscintilla