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// Qt-Security score:significant reason:default
4
5
6#ifndef QQUICK3DXRACTIONMAPPER_H
7#define QQUICK3DXRACTIONMAPPER_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QObject>
21#include <QQmlEngine>
22#include <QQuick3DObject>
23#include <QMultiHash>
24#include <QPointer>
26
28
29class QQuick3DXrController;
32
34{
35 Q_OBJECT
36 Q_INTERFACES(QQmlParserStatus)
39
45
48
49public:
50
51 // Same values as XrController and XrHandModel enums
60 Q_ENUM(Controller)
61
96 Q_ENUM(Action)
97
98 explicit QQuick3DXrInputAction(QObject *parent = nullptr);
100 float value() const;
101 void setValue(float newValue);
102 bool pressed() const;
103 void setPressed(bool newPressed);
104
105 QString actionName() const;
106 void setActionName(const QString &newActionName);
107
108 QList<Action> actionId() const;
109 void setActionId(const QList<Action> &newActionId);
110
111 void classBegin() override;
113
114 Controller hand() const;
115 void setHand(Controller newHand);
116
117 bool enabled() const;
118 void setEnabled(bool newEnabled);
119
120 Controller controller() const;
121 void setController(Controller newController);
122
126 void triggered();
127
130
132
134
136
137private:
138 QString m_actionName;
139 float m_value = 0;
140 bool m_pressed = false;
141 bool m_componentComplete = false;
142 bool m_enabled = true;
143 Controller m_controller;
144
145 QList<Action> m_actionIds;
146};
147
149{
150 Q_OBJECT
151 Q_INTERFACES(QQmlParserStatus)
154
159
160public:
161
162 // Same values as XrController and XrHandModel enums
168 Q_ENUM(Controller)
169
170 enum class Condition : quint8 {
173 };
174 Q_ENUM(Condition)
175
176 explicit QQuick3DXrHapticFeedback(QObject *parent = nullptr);
178
179 void classBegin() override;
181
183 void setHapticEffect(QQuick3DXrAbstractHapticEffect *newHapticEffect);
184
185 Controller controller() const;
186 void setController(Controller newController);
187
188 bool trigger();
189 void setTrigger(bool newTrigger);
190
191 enum Condition condition() const;
192 void setCondition(enum Condition newCondition);
193
194 bool testAndClear();
195
201
202public Q_SLOTS:
203 void start();
204 void stop();
205
206private:
207 QMetaObject::Connection m_triggerConnection;
208 Controller m_controller = Controller::UnknownController;
209 Condition m_condition = Condition::RisingEdge;
210 QPointer<QQuick3DXrAbstractHapticEffect> m_hapticEffect;
211 bool m_trigger = false;
212 bool m_componentComplete = false;
213 bool m_pending = false;
214};
215
217{
219public:
221
222 static QList<QPointer<QQuick3DXrHapticFeedback>> getHapticEffects(QQuick3DXrInputAction::Controller hand);
223
224 static void handleInput(QQuick3DXrInputAction::Action id, QQuick3DXrInputAction::Controller hand, const char *shortName, float value);
225 static void registerAction(QQuick3DXrInputAction *action);
227 static void removeAction(QQuick3DXrInputAction *action);
228 static void removeHapticEffect(QQuick3DXrHapticFeedback *action);
229
230private:
231 explicit QQuick3DXrActionMapper(QObject *parent = nullptr);
232
233 struct HapticData
234 {
235 QList<QPointer<QQuick3DXrHapticFeedback>> m_hapticEffects;
236 } m_hapticData[2];
237
238 QMultiHash<quint32, QQuick3DXrInputAction *> m_actions;
239 QMultiHash<QString, QQuick3DXrInputAction *> m_customActions;
240};
241
242QT_END_NAMESPACE
243
244#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()
Combined button and popup list for selecting options.
static QMatrix4x4 transformMatrix(const QVector3D &position, const QQuaternion &rotation)