File indexing completed on 2024-06-09 05:31:00
0001 /* 0002 SPDX-FileCopyrightText: 2014-2015 Eike Hein <hein@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QPointer> 0010 #include <QQuickItem> 0011 0012 class WheelInterceptor : public QQuickItem 0013 { 0014 Q_OBJECT 0015 0016 Q_PROPERTY(QQuickItem *destination READ destination WRITE setDestination NOTIFY destinationChanged) 0017 0018 public: 0019 explicit WheelInterceptor(QQuickItem *parent = nullptr); 0020 ~WheelInterceptor() override; 0021 0022 QQuickItem *destination() const; 0023 void setDestination(QQuickItem *destination); 0024 0025 Q_INVOKABLE QQuickItem *findWheelArea(QQuickItem *parent) const; 0026 0027 Q_SIGNALS: 0028 void destinationChanged() const; 0029 void wheelMoved(QPoint delta) const; 0030 0031 protected: 0032 void wheelEvent(QWheelEvent *event) override; 0033 0034 private: 0035 QPointer<QQuickItem> m_destination; 0036 };