1 | // Copyright (C) 2017 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QWAYLANDMOUSETRACKER_P_H |
5 | #define QWAYLANDMOUSETRACKER_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtQuick/private/qquickmousearea_p.h> |
19 | |
20 | #include <QtWaylandCompositor/qtwaylandcompositorglobal.h> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | class QWaylandMouseTrackerPrivate; |
25 | |
26 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandMouseTracker : public QQuickItem |
27 | { |
28 | Q_OBJECT |
29 | Q_DECLARE_PRIVATE(QWaylandMouseTracker) |
30 | Q_PROPERTY(qreal mouseX READ mouseX NOTIFY mouseXChanged) |
31 | Q_PROPERTY(qreal mouseY READ mouseY NOTIFY mouseYChanged) |
32 | Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged) |
33 | |
34 | Q_PROPERTY(bool windowSystemCursorEnabled READ windowSystemCursorEnabled WRITE setWindowSystemCursorEnabled NOTIFY windowSystemCursorEnabledChanged) |
35 | QML_NAMED_ELEMENT(WaylandMouseTracker) |
36 | QML_ADDED_IN_VERSION(1, 0) |
37 | public: |
38 | QWaylandMouseTracker(QQuickItem *parent = nullptr); |
39 | |
40 | qreal mouseX() const; |
41 | qreal mouseY() const; |
42 | |
43 | void setWindowSystemCursorEnabled(bool enable); |
44 | bool windowSystemCursorEnabled() const; |
45 | bool hovered() const; |
46 | |
47 | signals: |
48 | void mouseXChanged(); |
49 | void mouseYChanged(); |
50 | void windowSystemCursorEnabledChanged(); |
51 | void hoveredChanged(); |
52 | |
53 | protected: |
54 | bool childMouseEventFilter(QQuickItem *item, QEvent *event) override; |
55 | void mouseMoveEvent(QMouseEvent *event) override; |
56 | void hoverMoveEvent(QHoverEvent *event) override; |
57 | void hoverEnterEvent(QHoverEvent *event) override; |
58 | void hoverLeaveEvent(QHoverEvent *event) override; |
59 | }; |
60 | |
61 | QT_END_NAMESPACE |
62 | |
63 | #endif /*QWAYLANDMOUSETRACKER_P_H*/ |
64 |