1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

WebView: Prevent handling input events twice

This fixes site info being opened twice when pressing Ctrl+I while
having focus in webview.

This makes the input events handling code very fragile, so let's hope
this won't break anything .. and QtWebEngine won't change the behavior
in following releases.
This commit is contained in:
David Rosca 2015-10-04 19:03:40 +02:00
parent 75cb70d049
commit 7a512918f8
3 changed files with 17 additions and 5 deletions

View File

@ -29,7 +29,6 @@
#include "adblockmanager.h"
#include "downloadmanager.h"
#include "mainapplication.h"
#include "browsinglibrary.h"
#include "clearprivatedata.h"
#include "qzsettings.h"

View File

@ -269,7 +269,6 @@ QString QupZillaSchemeReply::speeddialPage()
if (dPage.isEmpty()) {
dPage.append(QzTools::readAllFileContents(":html/speeddial.html"));
dPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
dPage.replace(QLatin1String("%IMG_PLUS%"), QLatin1String("qrc:html/plus.png"));
dPage.replace(QLatin1String("%IMG_CLOSE%"), QLatin1String("qrc:html/close.png"));
dPage.replace(QLatin1String("%IMG_EDIT%"), QLatin1String("qrc:html/edit.png"));

View File

@ -1054,9 +1054,7 @@ void WebView::_keyPressEvent(QKeyEvent *event)
return;
}
int eventKey = event->key();
switch (eventKey) {
switch (event->key()) {
case Qt::Key_ZoomIn:
zoomIn();
event->accept();
@ -1183,5 +1181,21 @@ bool WebView::eventFilter(QObject *obj, QEvent *event)
}
}
// Block already handled events
if (obj == this) {
switch (event->type()) {
case QEvent::KeyPress:
case QEvent::KeyRelease:
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseMove:
case QEvent::Wheel:
return true;
default:
break;
}
}
return QWebEngineView::eventFilter(obj, event);
}