summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/webview.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/webview.cpp b/src/webview.cpp
index 30acaefe..37e9783d 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -621,25 +621,26 @@ void WebView::keyPressEvent(QKeyEvent *event)
}
}
+ // vi-like navigation
if (event->key() == Qt::Key_J && event->modifiers() == Qt::NoModifier)
{
- QKeyEvent event1(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier);
- event = &event1;
+ event->accept();
+ event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier);
}
- if (event->key() == Qt::Key_K && event->modifiers() == Qt::NoModifier)
+ else if (event->key() == Qt::Key_K && event->modifiers() == Qt::NoModifier)
{
- QKeyEvent event1(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier);
- event = &event1;
+ event->accept();
+ event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier);
}
- if (event->key() == Qt::Key_L && event->modifiers() == Qt::NoModifier)
+ else if (event->key() == Qt::Key_L && event->modifiers() == Qt::NoModifier)
{
- QKeyEvent event1(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier);
- event = &event1;
+ event->accept();
+ event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier);
}
- if (event->key() == Qt::Key_H && event->modifiers() == Qt::NoModifier)
+ else if (event->key() == Qt::Key_H && event->modifiers() == Qt::NoModifier)
{
- QKeyEvent event1(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier);
- event = &event1;
+ event->accept();
+ event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier);
}
KWebView::keyPressEvent(event);