我有 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,但它不起作用,应用程序崩溃