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

Commit af7e9c8

Browse files
committed
Fix mouse back/forward buttons triggering on both press and release
Changed MouseButtonPress to MouseButtonRelease for back/forward button handling in desktop mode to prevent double navigation. Also added return true after invoking goBack/goForward to properly consume the event. Fixes #1115
1 parent 146c065 commit af7e9c8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/ui/EventFilter.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,24 @@ bool EventFilter::eventFilter(QObject* watched, QEvent* event)
101101
}
102102
}
103103

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

108108
if (mouseEvent) {
109109
QQuickItem* webView = window->findChild<QQuickItem*>("web");
110110

111111
if (mouseEvent->button() == Qt::BackButton)
112+
{
112113
QMetaObject::invokeMethod(webView, "goBack");
114+
return true;
115+
}
113116

114117
if (mouseEvent->button() == Qt::ForwardButton)
118+
{
115119
QMetaObject::invokeMethod(webView, "goForward");
120+
return true;
121+
}
116122
}
117123
}
118124

0 commit comments

Comments
 (0)