Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquick3dxractionmapper_p.h
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QQUICK3DXRACTIONMAPPER_H
5#define QQUICK3DXRACTIONMAPPER_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 <QObject>
19#include <QQmlEngine>
20#include <QQuick3DObject>
21#include <QMultiHash>
22#include <QPointer>
24
26
27class QQuick3DXrController;
30
32{
33 Q_OBJECT
34 Q_INTERFACES(QQmlParserStatus)
37
43
46
47public:
48
49 // Same values as XrController and XrHandModel enums
58 Q_ENUM(Controller)
59
94 Q_ENUM(Action)
95
96 explicit QQuick3DXrInputAction(QObject *parent = nullptr);
98 float value() const;
99 void setValue(float newValue);
100 bool pressed() const;
101 void setPressed(bool newPressed);
102
103 QString actionName() const;
104 void setActionName(const QString &newActionName);
105
106 QList<Action> actionId() const;
107 void setActionId(const QList<Action> &newActionId);
108
109 void classBegin() override;
111
112 Controller hand() const;
113 void setHand(Controller newHand);
114
115 bool enabled() const;
116 void setEnabled(bool newEnabled);
117
118 Controller controller() const;
119 void setController(Controller newController);
120
124 void triggered();
125
128
130
132
134
135private:
136 QString m_actionName;
137 float m_value = 0;
138 bool m_pressed = false;
139 bool m_componentComplete = false;
140 bool m_enabled = true;
141 Controller m_controller;
142
143 QList<Action> m_actionIds;
144};
145
147{
148 Q_OBJECT
149 Q_INTERFACES(QQmlParserStatus)
152
157
158public:
159
160 // Same values as XrController and XrHandModel enums
166 Q_ENUM(Controller)
167
168 enum class Condition : quint8 {
171 };
172 Q_ENUM(Condition)
173
174 explicit QQuick3DXrHapticFeedback(QObject *parent = nullptr);
176
177 void classBegin() override;
179
181 void setHapticEffect(QQuick3DXrAbstractHapticEffect *newHapticEffect);
182
183 Controller controller() const;
184 void setController(Controller newController);
185
186 bool trigger();
187 void setTrigger(bool newTrigger);
188
189 enum Condition condition() const;
190 void setCondition(enum Condition newCondition);
191
192 bool testAndClear();
193
199
200public Q_SLOTS:
201 void start();
202 void stop();
203
204private:
205 QMetaObject::Connection m_triggerConnection;
206 Controller m_controller = Controller::UnknownController;
207 Condition m_condition = Condition::RisingEdge;
208 QPointer<QQuick3DXrAbstractHapticEffect> m_hapticEffect;
209 bool m_trigger = false;
210 bool m_componentComplete = false;
211 bool m_pending = false;
212};
213
215{
217public:
219
220 static QList<QPointer<QQuick3DXrHapticFeedback>> getHapticEffects(QQuick3DXrInputAction::Controller hand);
221
222 static void handleInput(QQuick3DXrInputAction::Action id, QQuick3DXrInputAction::Controller hand, const char *shortName, float value);
223 static void registerAction(QQuick3DXrInputAction *action);
225 static void removeAction(QQuick3DXrInputAction *action);
226 static void removeHapticEffect(QQuick3DXrHapticFeedback *action);
227
228private:
229 explicit QQuick3DXrActionMapper(QObject *parent = nullptr);
230
231 struct HapticData
232 {
233 QList<QPointer<QQuick3DXrHapticFeedback>> m_hapticEffects;
234 } m_hapticData[2];
235
236 QMultiHash<quint32, QQuick3DXrInputAction *> m_actions;
237 QMultiHash<QString, QQuick3DXrInputAction *> m_customActions;
238};
239
240QT_END_NAMESPACE
241
242#endif // QQUICK3DXRACTIONMAPPER_H
static void registerAction(QQuick3DXrInputAction *action)
static void handleInput(QQuick3DXrInputAction::Action id, QQuick3DXrInputAction::Controller hand, const char *shortName, float value)
static QList< QPointer< QQuick3DXrHapticFeedback > > getHapticEffects(QQuick3DXrInputAction::Controller hand)
static void registerHapticEffect(QPointer< QQuick3DXrHapticFeedback >)
static void removeHapticEffect(QQuick3DXrHapticFeedback *action)
static void removeAction(QQuick3DXrInputAction *action)
void classBegin() override
Invoked after class creation, but before any properties have been set.
void setCondition(enum Condition newCondition)
void setController(Controller newController)
enum Condition condition() const
\qmlproperty enumeration QtQuick3D.Xr::XrHapticFeedback::condition
void stop()
\qmlmethod void XrHapticFeedback::stop
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void setHapticEffect(QQuick3DXrAbstractHapticEffect *newHapticEffect)
QQuick3DXrAbstractHapticEffect * hapticEffect() const
\qmlproperty XrHapticEffect XrHapticFeedback::hapticEffect
Controller controller() const
\qmlproperty enumeration QtQuick3D.Xr::XrHapticFeedback::controller
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
bool pressed() const
\qmlproperty bool XrInputAction::pressed
void classBegin() override
Invoked after class creation, but before any properties have been set.
Controller controller() const
\qmlproperty enumeration QtQuick3D.Xr::XrInputAction::controller
void setPressed(bool newPressed)
QList< Action > actionId() const
\qmlproperty List<enumeration> XrInputAction::actionId
void setActionId(const QList< Action > &newActionId)
bool enabled() const
\qmlproperty bool XrInputAction::enabled
void setActionName(const QString &newActionName)
QString actionName() const
\qmlproperty string XrInputAction::actionName
float value() const
\qmlproperty real XrInputAction::value
void setEnabled(bool newEnabled)
void setController(Controller newController)
Controller hand() const
\qmlproperty enumeration QtQuick3D.Xr::XrInputAction::hand
void setValue(float newValue)
\qmltype XrInputAction \inherits QtObject \inqmlmodule QtQuick3D.Xr
void setHand(Controller newHand)
void init(XrInstance instance, XrSession session)
XrHandJointVelocityEXT jointVelocities[2][XR_HAND_JOINT_COUNT_EXT]
bool isPoseInUse(Hand hand, HandPoseSpace poseSpace)
void updatePoses(XrTime predictedDisplayTime, XrSpace appSpace)
PFN_xrDestroyHandTrackerEXT xrDestroyHandTrackerEXT_
void setPosePositionAndRotation(Hand hand, HandPoseSpace poseSpace, const QVector3D &position, const QQuaternion &rotation)
QQuick3DXrHandInput * rightHandInput() const
static QQuick3DXrInputManagerPrivate * get(QQuick3DXrInputManager *inputManager)
void updateHandtracking(XrTime predictedDisplayTime, XrSpace appSpace, bool aimExtensionEnabled)
QQuick3DXrInputManagerPrivate(QQuick3DXrInputManager &manager)
void setupHandModel(QQuick3DXrHandModel *model)
void registerController(QQuick3DXrController *controller)
PFN_xrCreateHandTrackerEXT xrCreateHandTrackerEXT_
QQuick3DXrHandInput * leftHandInput() const
XrHandJointLocationEXT jointLocations[2][XR_HAND_JOINT_COUNT_EXT]
void unregisterController(QQuick3DXrController *controller)
XrSpace handSpace(Hand hand, HandPoseSpace poseSpace)
PFN_xrLocateHandJointsEXT xrLocateHandJointsEXT_
void registerController(QQuick3DXrController *controller)
void unregisterController(QQuick3DXrController *controller)
QQuick3DXrHandInput * leftHandInput() const
QQuick3DXrHandInput * rightHandInput() const
static QQuick3DXrInputManager * instance()
static QMatrix4x4 transformMatrix(const QVector3D &position, const QQuaternion &rotation)