1 | // Copyright (C) 2016 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 QT3DRENDER_QOBJECTPICKER_P_H |
5 | #define QT3DRENDER_QOBJECTPICKER_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 for the convenience |
12 | // of other Qt classes. 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 <Qt3DCore/private/qcomponent_p.h> |
19 | #include <Qt3DCore/qnodeid.h> |
20 | #include <Qt3DRender/private/qt3drender_global_p.h> |
21 | #include <Qt3DRender/private/objectpicker_p.h> |
22 | |
23 | QT_BEGIN_NAMESPACE |
24 | |
25 | namespace Qt3DRender { |
26 | |
27 | /*! |
28 | \internal |
29 | */ |
30 | class Q_3DRENDERSHARED_PRIVATE_EXPORT QObjectPickerPrivate : public Qt3DCore::QComponentPrivate |
31 | { |
32 | public: |
33 | QObjectPickerPrivate() |
34 | : QComponentPrivate() |
35 | , m_hoverEnabled(false) |
36 | , m_dragEnabled(false) |
37 | , m_pressed(false) |
38 | , m_containsMouse(false) |
39 | , m_acceptedLastPressedEvent(true) |
40 | , m_priority(0) |
41 | { |
42 | m_shareable = false; |
43 | } |
44 | |
45 | Q_DECLARE_PUBLIC(QObjectPicker) |
46 | bool m_hoverEnabled; |
47 | bool m_dragEnabled; |
48 | bool m_pressed; |
49 | bool m_containsMouse; |
50 | bool m_acceptedLastPressedEvent; |
51 | int m_priority; |
52 | |
53 | enum EventType { |
54 | Pressed, |
55 | Released, |
56 | Clicked, |
57 | Moved |
58 | }; |
59 | |
60 | void propagateEvent(QPickEvent *event, EventType type); |
61 | |
62 | void pressedEvent(QPickEvent *event); |
63 | void clickedEvent(QPickEvent *event); |
64 | void movedEvent(QPickEvent *event); |
65 | void releasedEvent(QPickEvent *event); |
66 | |
67 | void setPressed(bool pressed); |
68 | void setContainsMouse(bool containsMouse); |
69 | }; |
70 | |
71 | struct QObjectPickerEvent |
72 | { |
73 | QPickEventPtr event; |
74 | Qt3DCore::QNodeId viewportNodeId; |
75 | }; |
76 | |
77 | } // namespace Qt3DRender |
78 | |
79 | QT_END_NAMESPACE |
80 | |
81 | Q_DECLARE_METATYPE(Qt3DRender::QObjectPickerEvent); |
82 | |
83 | #endif // QT3DRENDER_QOBJECTPICKER_P_H |
84 | |