Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qopenxractionmapper_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 QOPENXRACTIONMAPPER_H
5#define QOPENXRACTIONMAPPER_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
23
26class QOpenXrActionMapper;
27
28// Maybe combine this with controller?
30{
33 QML_NAMED_ELEMENT(XrActionMapper)
35public:
36 explicit QOpenXRActionMapper(QQuick3DObject *parent = nullptr);
37
73
74 void handleInput(InputAction id, const char *shortName, float value);
76
77 void classBegin() override;
78 void componentComplete() override;
79
81 void inputValueChange(InputAction id, QString shortName, float value);
82
83private:
84 QOpenXRController *m_controller = nullptr;
85
86 // Data structure: array of pointers, with overflow for the (rare) case of multiple actions for one id.
87
88 bool insertAction(QOpenXrInputAction *action, InputAction id);
89 void removeAction(QOpenXrInputAction *action);
91 quint64 m_actionMapOverflow = 0;
92 QList<QOpenXrInputAction *> m_extraActions;
93 void setOverflow(InputAction id) { m_actionMapOverflow |= (quint64(1) << id); }
94 void clearOverflow(InputAction id) { m_actionMapOverflow &= ~(quint64(1) << id); }
95 bool isOverflow(InputAction id) { return m_actionMapOverflow & (quint64(1) << id); }
96};
97
99{
102 QML_NAMED_ELEMENT(XrInputAction)
104
105 Q_PROPERTY(float value READ value NOTIFY valueChanged FINAL)
106 Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged FINAL)
109
110public:
112 float value() const;
113 void setValue(float newValue);
114 bool pressed() const;
115 void setPressed(bool newPressed);
116
117 QString actionName() const;
118 void setActionName(const QString &newActionName);
119
120 QList<QOpenXRActionMapper::InputAction> actionId() const;
121 void setActionId(const QList<QOpenXRActionMapper::InputAction> &newActionId);
122
123 void classBegin() override;
124 void componentComplete() override;
125
126signals:
129 void triggered();
130
133
134private:
135 QString m_actionName;
136 float m_value = 0;
137 bool m_pressed = false;
138
139 QList<QOpenXRActionMapper::InputAction> m_actionIds;
140};
141
143
144#endif // QOPENXRACTIONMAPPER_H
Definition qlist.h:76
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
void handleInput(InputAction id, const char *shortName, float value)
void inputValueChange(InputAction id, QString shortName, float value)
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
QOpenXRActionMapper(QQuick3DObject *parent=nullptr)
\qmltype XrActionMapper \inherits Object3D \inqmlmodule QtQuick3D.Xr
void registerAction(QOpenXrInputAction *action)
void classBegin() override
Invoked after class creation, but before any properties have been set.
QList< QOpenXRActionMapper::InputAction > actionId
void setValue(float newValue)
\qmlsignal XrActionMapper::inputValueChange(InputAction id, QString shortName, float value)
void classBegin() override
Invoked after class creation, but before any properties have been set.
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void setActionName(const QString &newActionName)
void setActionId(const QList< QOpenXRActionMapper::InputAction > &newActionId)
void setPressed(bool newPressed)
The QQmlParserStatus class provides updates on the QML parser state.
\qmltype Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DObject \inherits QtObject
QQuick3DObject * parent
\qmlproperty Object3D QtQuick3D::Object3D::parent This property holds the parent of the Object3D in a...
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLuint id
[7]
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INTERFACES(x)
#define signals
#define Q_SIGNALS
unsigned long long quint64
Definition qtypes.h:61
#define explicit