From 5404985dba6b53ee9d0daaa37232159be3c40bf2 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sat, 11 Oct 2014 11:42:07 +0200 Subject: [PATCH] Do not force keyboard text navigation in editable elements Keyboard text navigation is handled automatically by QtWebKit in editable elements. This fixes issue in some custom html code editors. Closes #1489 --- src/lib/webkit/webview.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/webkit/webview.cpp b/src/lib/webkit/webview.cpp index c7cf75196..c5dcb4014 100644 --- a/src/lib/webkit/webview.cpp +++ b/src/lib/webkit/webview.cpp @@ -1380,6 +1380,12 @@ void WebView::keyPressEvent(QKeyEvent* event) } } + // Text navigation is handled automatically in editable elements + const QString js = QSL("document.activeElement.contentEditable==='true'||typeof document.activeElement.value != 'undefined'"); + QWebFrame* frame = page()->currentFrame(); + if (frame && frame->evaluateJavaScript(js).toBool()) + return QWebView::keyPressEvent(event); + switch (eventKey) { case Qt::Key_C: if (event->modifiers() == Qt::ControlModifier) {