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)
34public:
35 explicit QOpenXRActionMapper(QQuick3DObject *parent = nullptr);
36
92
93 void handleInput(InputAction id, const char *shortName, float value);
95
96 void classBegin() override;
97 void componentComplete() override;
98
100 void inputValueChange(InputAction id, QString shortName, float value);
101
102private:
103 QOpenXRController *m_controller = nullptr;
104
105 // Data structure: array of pointers, with overflow for the (rare) case of multiple actions for one id.
106
107 bool insertAction(QOpenXrInputAction *action, InputAction id);
108 void removeAction(QOpenXrInputAction *action);
110 quint64 m_actionMapOverflow = 0;
111 QList<QOpenXrInputAction *> m_extraActions;
112 void setOverflow(InputAction id) { m_actionMapOverflow |= (quint64(1) << id); }
113 void clearOverflow(InputAction id) { m_actionMapOverflow &= ~(quint64(1) << id); }
114 bool isOverflow(InputAction id) { return m_actionMapOverflow & (quint64(1) << id); }
115};
116
118{
121 QML_NAMED_ELEMENT(XrInputAction)
122
123 Q_PROPERTY(float value READ value NOTIFY valueChanged FINAL)
124 Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged FINAL)
127
128public:
130 float value() const;
131 void setValue(float newValue);
132 bool pressed() const;
133 void setPressed(bool newPressed);
134
135 QString actionName() const;
136 void setActionName(const QString &newActionName);
137
138 QList<QOpenXRActionMapper::InputAction> actionId() const;
139 void setActionId(const QList<QOpenXRActionMapper::InputAction> &newActionId);
140
141 void classBegin() override;
142 void componentComplete() override;
143
144signals:
147 void triggered();
148
151
152private:
153 QString m_actionName;
154 float m_value = 0;
155 bool m_pressed = false;
156
157 QList<QOpenXRActionMapper::InputAction> m_actionIds;
158};
159
161
162#endif // QOPENXRACTIONMAPPER_H
Definition qlist.h:75
\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)
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)
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 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