From 49560f921d4dc4d9ec11c565b80891d68514464a Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Thu, 5 May 2022 22:12:42 +0200 Subject: [PATCH] Port away from copying QEvent when building with Qt6 Copying QEvent in Qt6 isn't allowed, instead use clone(). --- src/kitemviews/private/kitemlistsmoothscroller.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp index f77d3df58d..343399179b 100644 --- a/src/kitemviews/private/kitemlistsmoothscroller.cpp +++ b/src/kitemviews/private/kitemlistsmoothscroller.cpp @@ -186,9 +186,15 @@ void KItemListSmoothScroller::handleWheelEvent(QWheelEvent* event) m_smoothScrolling = true; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QWheelEvent *copy = event->clone(); + QApplication::sendEvent(m_scrollBar, copy); + event->setAccepted(copy->isAccepted()); +#else QWheelEvent copy = *event; QApplication::sendEvent(m_scrollBar, ©); event->setAccepted(copy.isAccepted()); +#endif m_smoothScrolling = previous; }