Falkon Develop
Cross-platform Qt-based web browser
qmlmouseevent.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 <QMouseEvent>
21
25class QmlMouseEvent : public QObject
26{
27 Q_OBJECT
31 Q_PROPERTY(int button READ button CONSTANT)
35 Q_PROPERTY(int buttons READ buttons CONSTANT)
39 Q_PROPERTY(QPoint globalPos READ globalPos CONSTANT)
43 Q_PROPERTY(int globalX READ globalX CONSTANT)
47 Q_PROPERTY(int globalY READ globalY CONSTANT)
51 Q_PROPERTY(QPointF localPos READ localPos CONSTANT)
55 Q_PROPERTY(QPoint pos READ pos CONSTANT)
59 Q_PROPERTY(QPointF screenPos READ screenPos CONSTANT)
63 Q_PROPERTY(int source READ source CONSTANT)
67 Q_PROPERTY(QPointF windowPos READ windowPos CONSTANT)
71 Q_PROPERTY(int x READ x CONSTANT)
75 Q_PROPERTY(int y READ y CONSTANT)
76public:
77 explicit QmlMouseEvent(QMouseEvent *mouseEvent = nullptr, QObject *parent = nullptr);
78 int button() const;
79 int buttons() const;
80 QPoint globalPos() const;
81 int globalX() const;
82 int globalY() const;
83 QPointF localPos() const;
84 QPoint pos() const;
85 QPointF screenPos() const;
86 int source() const;
87 QPointF windowPos() const;
88 int x() const;
89 int y() const;
90
91 void clear();
92
93private:
94 QMouseEvent *m_mouseEvent = nullptr;
95};
The class exposing MouseEvent to QML.
Definition: qmlmouseevent.h:26
QPoint globalPos
global position of mouse cursor at the time of event
Definition: qmlmouseevent.h:39
QmlMouseEvent(QMouseEvent *mouseEvent=nullptr, QObject *parent=nullptr)
QPointF localPos
local position of mouse cursor at the time of event
Definition: qmlmouseevent.h:51
int buttons
button state associated with the event
Definition: qmlmouseevent.h:35
int button
button associated with the event
Definition: qmlmouseevent.h:31
int x
x position of mouse cursor at the time of event
Definition: qmlmouseevent.h:71
QPointF windowPos
window position of mouse cursor at the time of event
Definition: qmlmouseevent.h:67
int globalY
global y position of mouse cursor at the time of event
Definition: qmlmouseevent.h:47
QPoint pos
position of mouse cursor at the time of event
Definition: qmlmouseevent.h:55
int source
source of the event
Definition: qmlmouseevent.h:63
QPointF screenPos
screen position of mouse cursor at the time of event
Definition: qmlmouseevent.h:59
int globalX
global x position of mouse cursor at the time of event
Definition: qmlmouseevent.h:43
int y
y position of mouse cursor at the time of event
Definition: qmlmouseevent.h:75