From 5cf4510da5509d05d1d638461af6b09a72a55d7d Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 15 Mar 2022 15:42:01 +0100 Subject: [PATCH] Fix context menu of snippet editor The snippet editor is a TextEditorWidget, but the special context menu of that doesn't make sense in the context of the snippet settings. Get the default context menu back. Fixes: QTCREATORBUG-27176 Change-Id: I9681482f83fe32d15be0b1386e2fb26870b955e2 Reviewed-by: Reviewed-by: David Schulz --- src/plugins/texteditor/snippets/snippeteditor.cpp | 5 +++++ src/plugins/texteditor/snippets/snippeteditor.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/plugins/texteditor/snippets/snippeteditor.cpp b/src/plugins/texteditor/snippets/snippeteditor.cpp index 63ca32273a9..01e3757182d 100644 --- a/src/plugins/texteditor/snippets/snippeteditor.cpp +++ b/src/plugins/texteditor/snippets/snippeteditor.cpp @@ -61,4 +61,9 @@ void SnippetEditorWidget::focusOutEvent(QFocusEvent *event) TextEditorWidget::focusOutEvent(event); } +void SnippetEditorWidget::contextMenuEvent(QContextMenuEvent *e) +{ + QPlainTextEdit::contextMenuEvent(e); +} + } // namespace diff --git a/src/plugins/texteditor/snippets/snippeteditor.h b/src/plugins/texteditor/snippets/snippeteditor.h index 8bb972cf685..f422c09bb5f 100644 --- a/src/plugins/texteditor/snippets/snippeteditor.h +++ b/src/plugins/texteditor/snippets/snippeteditor.h @@ -42,6 +42,7 @@ signals: protected: void focusOutEvent(QFocusEvent *event) override; + void contextMenuEvent(QContextMenuEvent *e) override; int extraAreaWidth(int * /* markWidthPtr */ = nullptr) const override { return 0; } };