mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-14 11:02:19 +01:00
WebView: Better HANDLE_EVENT macro
This commit is contained in:
parent
e93c3fe58d
commit
bcf50f9343
|
@ -1139,34 +1139,34 @@ bool WebView::eventFilter(QObject *obj, QEvent *event)
|
||||||
|
|
||||||
// Forward events to WebView
|
// Forward events to WebView
|
||||||
if (obj == m_rwhvqt) {
|
if (obj == m_rwhvqt) {
|
||||||
bool ret = false;
|
#define HANDLE_EVENT(f, t) \
|
||||||
bool wasAccepted = event->isAccepted();
|
{ \
|
||||||
|
bool wasAccepted = event->isAccepted(); \
|
||||||
#define HANDLE_EVENT(x) \
|
|
||||||
event->setAccepted(false); \
|
event->setAccepted(false); \
|
||||||
(x); \
|
f(static_cast<t*>(event)); \
|
||||||
ret = event->isAccepted(); \
|
bool ret = event->isAccepted(); \
|
||||||
event->setAccepted(wasAccepted); \
|
event->setAccepted(wasAccepted); \
|
||||||
return ret
|
return ret; \
|
||||||
|
}
|
||||||
|
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
case QEvent::KeyPress:
|
case QEvent::KeyPress:
|
||||||
HANDLE_EVENT(_keyPressEvent(static_cast<QKeyEvent*>(event)));
|
HANDLE_EVENT(_keyPressEvent, QKeyEvent);
|
||||||
|
|
||||||
case QEvent::KeyRelease:
|
case QEvent::KeyRelease:
|
||||||
HANDLE_EVENT(_keyReleaseEvent(static_cast<QKeyEvent*>(event)));
|
HANDLE_EVENT(_keyReleaseEvent, QKeyEvent);
|
||||||
|
|
||||||
case QEvent::MouseButtonPress:
|
case QEvent::MouseButtonPress:
|
||||||
HANDLE_EVENT(_mousePressEvent(static_cast<QMouseEvent*>(event)));
|
HANDLE_EVENT(_mousePressEvent, QMouseEvent);
|
||||||
|
|
||||||
case QEvent::MouseButtonRelease:
|
case QEvent::MouseButtonRelease:
|
||||||
HANDLE_EVENT(_mouseReleaseEvent(static_cast<QMouseEvent*>(event)));
|
HANDLE_EVENT(_mouseReleaseEvent, QMouseEvent);
|
||||||
|
|
||||||
case QEvent::MouseMove:
|
case QEvent::MouseMove:
|
||||||
HANDLE_EVENT(_mouseMoveEvent(static_cast<QMouseEvent*>(event)));
|
HANDLE_EVENT(_mouseMoveEvent, QMouseEvent);
|
||||||
|
|
||||||
case QEvent::Wheel:
|
case QEvent::Wheel:
|
||||||
HANDLE_EVENT(_wheelEvent(static_cast<QWheelEvent*>(event)));
|
HANDLE_EVENT(_wheelEvent, QWheelEvent);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user