┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmad Samir <[email protected]>2022-05-05 22:12:42 +0200
committerAhmad Samir <[email protected]>2022-05-31 14:25:13 +0000
commit49560f921d4dc4d9ec11c565b80891d68514464a (patch)
treecc62dc9c63348fe7c6b8048dec2070f4d16a5426
parent5d3774aa17c8e04df928e37fc4d1e197c3e3ae68 (diff)
Port away from copying QEvent when building with Qt6
Copying QEvent in Qt6 isn't allowed, instead use clone().
-rw-r--r--src/kitemviews/private/kitemlistsmoothscroller.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp
index f77d3df58..343399179 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, &copy);
event->setAccepted(copy.isAccepted());
+#endif
m_smoothScrolling = previous;
}