File indexing completed on 2024-05-12 05:37:08

0001 /*
0002     SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "wheelforwarder.h"
0008 
0009 #include <QCoreApplication>
0010 #include <QQuickItem>
0011 
0012 void WheelForwarder::interceptWheelEvent(QQuickItem *from)
0013 {
0014     from->installEventFilter(this);
0015 }
0016 
0017 bool WheelForwarder::eventFilter(QObject *, QEvent *event)
0018 {
0019     if (event->type() != QEvent::Wheel) {
0020         return false;
0021     }
0022     QCoreApplication::sendEvent(m_toItem, event);
0023     return true;
0024 }