Falkon Develop
Cross-platform Qt-based web browser
qmlwheelevent.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2018 Anmol Gautam <tarptaeya@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#pragma once
19
20#include <QWheelEvent>
21#include <QObject>
22
26class QmlWheelEvent : public QObject
27{
28 Q_OBJECT
32 Q_PROPERTY(QPoint angleDelta READ angleDelta CONSTANT)
36 Q_PROPERTY(int buttons READ buttons CONSTANT)
40 Q_PROPERTY(QPoint globalPos READ globalPos CONSTANT)
44 Q_PROPERTY(QPointF globalPosF READ globalPosF CONSTANT)
48 Q_PROPERTY(int globalX READ globalX CONSTANT)
52 Q_PROPERTY(int globalY READ globalY CONSTANT)
56 Q_PROPERTY(bool inverted READ inverted CONSTANT)
60 Q_PROPERTY(int phase READ phase CONSTANT)
64 Q_PROPERTY(QPoint pixelDelta READ pixelDelta CONSTANT)
68 Q_PROPERTY(QPoint pos READ pos CONSTANT)
72 Q_PROPERTY(QPointF posF READ posF CONSTANT)
76 Q_PROPERTY(int source READ source CONSTANT)
80 Q_PROPERTY(int x READ x CONSTANT)
84 Q_PROPERTY(int y READ y CONSTANT)
85public:
86 explicit QmlWheelEvent(QWheelEvent *wheelEvent = nullptr, QObject *parent = nullptr);
87 QPoint angleDelta() const;
88 int buttons() const;
89 QPoint globalPos() const;
90 QPointF globalPosF() const;
91 int globalX() const;
92 int globalY() const;
93 bool inverted() const;
94 int phase() const;
95 QPoint pixelDelta() const;
96 QPoint pos() const;
97 QPointF posF() const;
98 int source() const;
99 int x() const;
100 int y() const;
101
102 void clear();
103private:
104 QWheelEvent *m_wheelEvent = nullptr;
105};
The class exposing WheelEvent to QML.
Definition: qmlwheelevent.h:27
int source
source of the event
Definition: qmlwheelevent.h:76
int x
x position of mouse cursor at the time of event
Definition: qmlwheelevent.h:80
int globalX
global x position of mouse cursor at the time of event
Definition: qmlwheelevent.h:48
QmlWheelEvent(QWheelEvent *wheelEvent=nullptr, QObject *parent=nullptr)
QPointF posF
position of mouse cursor at the time of event
Definition: qmlwheelevent.h:72
int globalY
global y position of mouse cursor at the time of event
Definition: qmlwheelevent.h:52
QPoint pixelDelta
scrolling distance in pixels on screen
Definition: qmlwheelevent.h:64
QPointF globalPosF
global position of mouse cursor at the time of event
Definition: qmlwheelevent.h:44
int y
y position of mouse cursor at the time of event
Definition: qmlwheelevent.h:84
QPoint globalPos
global position of mouse cursor at the time of event
Definition: qmlwheelevent.h:40
QPoint pos
position of mouse cursor at the time of event
Definition: qmlwheelevent.h:68
bool inverted
checks if the delta values delivered with the event are inverted
Definition: qmlwheelevent.h:56
int phase
scrolling phase of this wheel event
Definition: qmlwheelevent.h:60
QPoint angleDelta
the distance that the wheel is rotated, in eighths of a degree
Definition: qmlwheelevent.h:32
int buttons
mouse state at the time of event
Definition: qmlwheelevent.h:36