From 60a835c16d0ae58e1fed8fe933dad752c4e03a5d Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 16 May 2015 10:18:11 +0200 Subject: [PATCH] stop script editor from eating undo/redo shortcuts (Fixes #2506) --- apps/opencs/view/world/scriptedit.cpp | 13 +++++++++++++ apps/opencs/view/world/scriptedit.hpp | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/apps/opencs/view/world/scriptedit.cpp b/apps/opencs/view/world/scriptedit.cpp index b4f4234f1..2e05fa110 100644 --- a/apps/opencs/view/world/scriptedit.cpp +++ b/apps/opencs/view/world/scriptedit.cpp @@ -25,6 +25,19 @@ CSVWorld::ScriptEdit::ChangeLock::~ChangeLock() --mEdit.mChangeLocked; } +bool CSVWorld::ScriptEdit::event (QEvent *event) +{ + // ignore undo and redo shortcuts + if (event->type()==QEvent::ShortcutOverride) + { + QKeyEvent *keyEvent = static_cast (event); + + if (keyEvent->matches (QKeySequence::Undo) || keyEvent->matches (QKeySequence::Redo)) + return true; + } + + return QPlainTextEdit::event (event); +} CSVWorld::ScriptEdit::ScriptEdit (const CSMDoc::Document& document, ScriptHighlighter::Mode mode, QWidget* parent) diff --git a/apps/opencs/view/world/scriptedit.hpp b/apps/opencs/view/world/scriptedit.hpp index a19cee486..fb577e60e 100644 --- a/apps/opencs/view/world/scriptedit.hpp +++ b/apps/opencs/view/world/scriptedit.hpp @@ -53,6 +53,10 @@ namespace CSVWorld QFont mDefaultFont; QFont mMonoFont; + protected: + + bool event (QEvent *event); + public: ScriptEdit (const CSMDoc::Document& document, ScriptHighlighter::Mode mode,