From e579fb20c7759f38531919a096886e9589eb4d8e Mon Sep 17 00:00:00 2001 From: L-Super <40905056+L-Super@users.noreply.github.com> Date: Sat, 9 Sep 2023 21:21:44 +0800 Subject: [PATCH] fixed:press the shift key to support horizontal scrolling --- src/details/QCefViewPrivate.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/details/QCefViewPrivate.cpp b/src/details/QCefViewPrivate.cpp index 5bb690c6..53a50c4c 100644 --- a/src/details/QCefViewPrivate.cpp +++ b/src/details/QCefViewPrivate.cpp @@ -916,8 +916,12 @@ QCefViewPrivate::onViewWheelEvent(QWheelEvent* event) e.x = p.x(); e.y = p.y(); + + // angleDelta().y() provides the angle through which the common vertical mouse wheel was rotated since the previous + // event. angleDelta().x() provides the angle through which the horizontal mouse wheel was rotated, if the mouse has + // a horizontal wheel; otherwise it stays at zero. pCefBrowser_->GetHost()->SendMouseWheelEvent( - e, m & Qt::ShiftModifier ? d.x() : 0, m & Qt::ShiftModifier ? d.y() : 0); + e, m & Qt::ShiftModifier ? d.x() : 0, m & Qt::ShiftModifier ? d.y() : d.y()); } }