diff options
author | Pierre Rossi <pierre.rossi@gmail.com> | 2011-06-28 17:05:13 +0200 |
---|---|---|
committer | Pierre Rossi <pierre.rossi@gmail.com> | 2011-06-28 19:25:53 +0200 |
commit | e27351218ec760df32050083ab4493507a9fbfe1 (patch) | |
tree | d2cef8957862226a90f8925402072a6e188d9891 /src | |
parent | This should fix "border" protocols handling like apt. (diff) | |
download | rekonq-e27351218ec760df32050083ab4493507a9fbfe1.tar.xz |
Fixup for vi style navigation event handling.
Reviewed-by: TrustMe
Diffstat (limited to 'src')
-rw-r--r-- | src/webview.cpp | 23 |
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); |