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#include <QtQuick3DXr/private/qtquick3dxrglobal_p.h>
27
29
30class QQuick3DXrController;
33
35{
36 Q_OBJECT
37 Q_INTERFACES(QQmlParserStatus)
40
46
49
50public:
51
62 Q_ENUM(Controller)
63
98 Q_ENUM(Action)
99
100 explicit QQuick3DXrInputAction(QObject *parent = nullptr);
102 float value() const;
103 void setValue(float newValue);
104 bool pressed() const;
105 void setPressed(bool newPressed);
106
107 QString actionName() const;
108 void setActionName(const QString &newActionName);
109
110 QList<Action> actionId() const;
111 void setActionId(const QList<Action> &newActionId);
112
113 void classBegin() override;
115
116 Controller hand() const;
117 void setHand(Controller newHand);
118
119 bool enabled() const;
120 void setEnabled(bool newEnabled);
121
122 Controller controller() const;
123 void setController(Controller newController);
124
128 void triggered();
129
132
134
136
138
139private:
140 QString m_actionName;
141 float m_value = 0;
142 bool m_pressed = false;
143 bool m_componentComplete = false;
144 bool m_enabled = true;
145 Controller m_controller;
146
147 QList<Action> m_actionIds;
148};
149
151{
152 Q_OBJECT
153 Q_INTERFACES(QQmlParserStatus)
156
161
162public:
163
164 // Values here must match the QtQuick3DXr::Controller enum
175 Q_ENUM(Controller)
176
177 enum class Condition : quint8 {
180 };
181 Q_ENUM(Condition)
182
183 explicit QQuick3DXrHapticFeedback(QObject *parent = nullptr);
185
186 void classBegin() override;
188
190 void setHapticEffect(QQuick3DXrAbstractHapticEffect *newHapticEffect);
191
192 Controller controller() const;
193 void setController(Controller newController);
194
195 bool trigger();
196 void setTrigger(bool newTrigger);
197
198 enum Condition condition() const;
199 void setCondition(enum Condition newCondition);
200
201 bool testAndClear();
202
208
209public Q_SLOTS:
210 void start();
211 void stop();
212
213private:
214 QMetaObject::Connection m_triggerConnection;
215 Controller m_controller = Controller::UnknownController;
216 Condition m_condition = Condition::RisingEdge;
217 QPointer<QQuick3DXrAbstractHapticEffect> m_hapticEffect;
218 bool m_trigger = false;
219 bool m_componentComplete = false;
220 bool m_pending = false;
221};
222
224{
226public:
228
229 static QList<QPointer<QQuick3DXrHapticFeedback>> getHapticEffects(QtQuick3DXr::Controller controller);
230
231 static void handleInput(QQuick3DXrInputAction::Action id, QtQuick3DXr::Controller controller, const char *shortName, float value);
232 static void registerAction(QQuick3DXrInputAction *action);
234 static void removeAction(QQuick3DXrInputAction *action);
235 static void removeHapticEffect(QQuick3DXrHapticFeedback *action);
236
237private:
238 explicit QQuick3DXrActionMapper(QObject *parent = nullptr);
239
240 struct HapticData
241 {
242 QList<QPointer<QQuick3DXrHapticFeedback>> m_hapticEffects;
243 } m_hapticData[2];
244
245 QMultiHash<quint32, QQuick3DXrInputAction *> m_actions;
246 QMultiHash<QString, QQuick3DXrInputAction *> m_customActions;
247};
248
249QT_END_NAMESPACE
250
251#endif // QQUICK3DXRACTIONMAPPER_H
static void registerAction(QQuick3DXrInputAction *action)
static QList< QPointer< QQuick3DXrHapticFeedback > > getHapticEffects(QtQuick3DXr::Controller controller)
static void registerHapticEffect(QPointer< QQuick3DXrHapticFeedback >)
static void removeHapticEffect(QQuick3DXrHapticFeedback *action)
static void handleInput(QQuick3DXrInputAction::Action id, QtQuick3DXr::Controller controller, const char *shortName, float value)
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)
bool isPoseInUse(Handedness handedness, HandPoseSpace poseSpace)
void init(XrInstance instance, XrSession session)
XrHandJointVelocityEXT jointVelocities[2][XR_HAND_JOINT_COUNT_EXT]
void updatePoses(XrTime predictedDisplayTime, XrSpace appSpace)
PFN_xrDestroyHandTrackerEXT xrDestroyHandTrackerEXT_
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)
XrSpace handSpace(Handedness handedness, HandPoseSpace poseSpace)
PFN_xrCreateHandTrackerEXT xrCreateHandTrackerEXT_
QQuick3DXrHandInput * leftHandInput() const
XrHandJointLocationEXT jointLocations[2][XR_HAND_JOINT_COUNT_EXT]
bool isHandTrackerActive(Handedness handedness)
void setPosePositionAndRotation(Handedness handedness, HandPoseSpace poseSpace, const QVector3D &position, const QQuaternion &rotation)
void unregisterController(QQuick3DXrController *controller)
bool isHandActive(Handedness handedness)
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)