aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp
index fa639c39a0..97ef6c4b68 100644
--- a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp
+++ b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp
@@ -78,10 +78,6 @@ void TextEditorWidget::setTextEditor(
});
m_textEditor->editorWidget()->installEventFilter(this);
- // do not call the eventfilter when the m_textEditor is gone
- connect(m_textEditor->editorWidget(), &QObject::destroyed, this, [this](QObject *) {
- m_textEditor->editorWidget()->removeEventFilter(this);
- });
}
}
@@ -206,6 +202,10 @@ void TextEditorWidget::setBlockCursorSelectionSynchronisation(bool b)
bool TextEditorWidget::eventFilter(QObject *, QEvent *event)
{
+ //do not call the eventfilter when the m_textEditor is gone
+ if (!TextEditor::TextEditorWidget::fromEditor(m_textEditor.get()))
+ return false;
+
static std::vector<int> overrideKeys = { Qt::Key_Delete, Qt::Key_Backspace, Qt::Key_Insert,
Qt::Key_Escape };