Skip to content
This repository was archived by the owner on Mar 28, 2026. It is now read-only.

Commit 21875fe

Browse files
committed
Block MouseBottonPress additionally to prevent the long press behaviour
1 parent af7e9c8 commit 21875fe

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/ui/EventFilter.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,24 +101,23 @@ bool EventFilter::eventFilter(QObject* watched, QEvent* event)
101101
}
102102
}
103103

104-
if (event->type() == QEvent::MouseButtonRelease)
104+
if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease)
105105
{
106106
QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent*>(event);
107107

108-
if (mouseEvent) {
109-
QQuickItem* webView = window->findChild<QQuickItem*>("web");
110-
111-
if (mouseEvent->button() == Qt::BackButton)
108+
if (mouseEvent && (mouseEvent->button() == Qt::BackButton || mouseEvent->button() == Qt::ForwardButton)) {
109+
// Only trigger navigation on release, but block both press and release
110+
// to prevent WebEngine from interpreting press-without-release as a long-press
111+
if (event->type() == QEvent::MouseButtonRelease)
112112
{
113-
QMetaObject::invokeMethod(webView, "goBack");
114-
return true;
115-
}
113+
QQuickItem* webView = window->findChild<QQuickItem*>("web");
116114

117-
if (mouseEvent->button() == Qt::ForwardButton)
118-
{
119-
QMetaObject::invokeMethod(webView, "goForward");
120-
return true;
115+
if (mouseEvent->button() == Qt::BackButton)
116+
QMetaObject::invokeMethod(webView, "goBack");
117+
else
118+
QMetaObject::invokeMethod(webView, "goForward");
121119
}
120+
return true;
122121
}
123122
}
124123

0 commit comments

Comments
 (0)