1 | // Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QT3DINPUT_QMOUSEHANDLER_H |
5 | #define QT3DINPUT_QMOUSEHANDLER_H |
6 | |
7 | #include <Qt3DInput/qt3dinput_global.h> |
8 | #include <Qt3DInput/qmouseevent.h> |
9 | #include <Qt3DInput/qmousedevice.h> |
10 | #include <Qt3DCore/qcomponent.h> |
11 | |
12 | QT_BEGIN_NAMESPACE |
13 | |
14 | namespace Qt3DInput { |
15 | |
16 | class QMouseHandlerPrivate; |
17 | |
18 | class Q_3DINPUTSHARED_EXPORT QMouseHandler : public Qt3DCore::QComponent |
19 | { |
20 | Q_OBJECT |
21 | Q_PROPERTY(Qt3DInput::QMouseDevice *sourceDevice READ sourceDevice WRITE setSourceDevice NOTIFY sourceDeviceChanged) |
22 | Q_PROPERTY(bool containsMouse READ containsMouse NOTIFY containsMouseChanged) |
23 | |
24 | public: |
25 | explicit QMouseHandler(QNode *parent = nullptr); |
26 | ~QMouseHandler(); |
27 | |
28 | QMouseDevice *sourceDevice() const; |
29 | bool containsMouse() const; |
30 | |
31 | public Q_SLOTS: |
32 | void setSourceDevice(QMouseDevice *mouseDevice); |
33 | |
34 | Q_SIGNALS: |
35 | void sourceDeviceChanged(QMouseDevice *mouseDevice); |
36 | void containsMouseChanged(bool containsMouse); |
37 | |
38 | void clicked(Qt3DInput::QMouseEvent *mouse); |
39 | void doubleClicked(Qt3DInput::QMouseEvent *mouse); |
40 | |
41 | void entered(); |
42 | void exited(); |
43 | |
44 | void pressed(Qt3DInput::QMouseEvent *mouse); |
45 | void released(Qt3DInput::QMouseEvent *mouse); |
46 | void pressAndHold(Qt3DInput::QMouseEvent *mouse); |
47 | void positionChanged(Qt3DInput::QMouseEvent *mouse); |
48 | |
49 | #if QT_CONFIG(wheelevent) |
50 | void wheel(Qt3DInput::QWheelEvent *wheel); |
51 | #endif |
52 | |
53 | protected: |
54 | void setContainsMouse(bool contains); |
55 | |
56 | private: |
57 | Q_DECLARE_PRIVATE(QMouseHandler) |
58 | }; |
59 | |
60 | } // namespace Qt3DInput |
61 | |
62 | QT_END_NAMESPACE |
63 | |
64 | #endif // QT3DINPUT_QMOUSEHANDLER_H |
65 |