Commit 0e70a54b authored by Alexander Semke's avatar Alexander Semke
Browse files

Leave the markdown cell in the edit mode if the the user hits the

cancel/escape button. This allows to leave the cell after an
accidential/unwanted entry via a double-click without evaluating
the cell and without setting the project to "changed".
parent 5ee27816
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <QBuffer> #include <QBuffer>
#include <KLocalizedString> #include <KLocalizedString>
#include <QDebug> #include <QDebug>
#include <QKeyEvent>
#include <QStandardPaths> #include <QStandardPaths>
#include <QDir> #include <QDir>
#include <QFileDialog> #include <QFileDialog>
...@@ -467,6 +468,16 @@ bool MarkdownEntry::eventFilter(QObject* object, QEvent* event) ...@@ -467,6 +468,16 @@ bool MarkdownEntry::eventFilter(QObject* object, QEvent* event)
} }
} }
} }
else if (event->type() == QEvent::KeyPress)
{
auto* key_event = static_cast<QKeyEvent*>(event);
if (key_event->matches(QKeySequence::Cancel))
{
setRenderedHtml(html);
rendered = true;
return true;
}
}
} }
return false; return false;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment