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
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
24
28
30{
33 QML_NAMED_ELEMENT(XrInputAction)
35
36 Q_PROPERTY(float value READ value NOTIFY valueChanged FINAL)
37 Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged FINAL)
40
41 Q_PROPERTY(Hand hand READ hand WRITE setHand NOTIFY handChanged FINAL)
42
43public:
44
45 // Same values as XrController and XrHandModel enums
52
88
89 explicit QQuick3DXrInputAction(QObject *parent = nullptr);
90 float value() const;
91 void setValue(float newValue);
92 bool pressed() const;
93 void setPressed(bool newPressed);
94
95 QString actionName() const;
96 void setActionName(const QString &newActionName);
97
98 QList<Action> actionId() const;
99 void setActionId(const QList<Action> &newActionId);
100
101 void classBegin() override;
102 void componentComplete() override;
103
104 Hand hand() const;
105 void setHand(Hand newHand);
106
107signals:
110 void triggered();
111
114
116
117private:
118 QString m_actionName;
119 float m_value = 0;
120 bool m_pressed = false;
121 bool m_componentComplete = false;
122 Hand m_hand;
123
124 QList<Action> m_actionIds;
125};
126
128{
130public:
132
133 static void handleInput(QQuick3DXrInputAction::Action id, QQuick3DXrInputAction::Hand hand, const char *shortName, float value);
134 static void registerAction(QQuick3DXrInputAction *action);
135 static void removeAction(QQuick3DXrInputAction *action);
136
138 void inputValueChange(QQuick3DXrInputAction::Action id, QString shortName, float value); //### This needs to be on a public class/type
139
140private:
141 explicit QQuick3DXrActionMapper(QObject *parent = nullptr);
142
143 QMultiHash<quint32, QQuick3DXrInputAction *> m_actions;
144 QMultiHash<QString, QQuick3DXrInputAction *> m_customActions;
145};
146
148
149#endif // QQUICK3DXRACTIONMAPPER_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
The QQmlParserStatus class provides updates on the QML parser state.
static void registerAction(QQuick3DXrInputAction *action)
void inputValueChange(QQuick3DXrInputAction::Action id, QString shortName, float value)
static void handleInput(QQuick3DXrInputAction::Action id, QQuick3DXrInputAction::Hand hand, const char *shortName, float value)
static QQuick3DXrActionMapper * instance()
static void removeAction(QQuick3DXrInputAction *action)
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void classBegin() override
Invoked after class creation, but before any properties have been set.
void setPressed(bool newPressed)
void setActionId(const QList< Action > &newActionId)
void setActionName(const QString &newActionName)
QQuick3DXrInputAction(QObject *parent=nullptr)
void setValue(float newValue)
\qmltype XrInputAction \inherits Item \inqmlmodule QtQuick3D.Xr
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#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
short qint16
Definition qtypes.h:47
unsigned char quint8
Definition qtypes.h:46