1 | // Copyright (C) 2024 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #include "qquick3dxrinputmanager_p.h" |
5 | |
6 | #if defined(Q_OS_VISIONOS) |
7 | # include "visionos/qquick3dxrinputmanager_visionos_p.h" |
8 | #else |
9 | # include "openxr/qopenxrinputmanager_p.h" |
10 | #endif |
11 | |
12 | #include "qquick3dxrcontroller_p.h" |
13 | |
14 | QT_BEGIN_NAMESPACE |
15 | |
16 | QQuick3DXrInputManager *QQuick3DXrInputManager::instance() |
17 | { |
18 | static QQuick3DXrInputManager instance; |
19 | return &instance; |
20 | } |
21 | |
22 | QQuick3DXrHandInput *QQuick3DXrInputManager::leftHandInput() const |
23 | { |
24 | Q_D(const QQuick3DXrInputManager); |
25 | return d->leftHandInput(); |
26 | } |
27 | |
28 | QQuick3DXrHandInput *QQuick3DXrInputManager::rightHandInput() const |
29 | { |
30 | Q_D(const QQuick3DXrInputManager); |
31 | return d->rightHandInput(); |
32 | } |
33 | |
34 | void QQuick3DXrInputManager::registerController(QQuick3DXrController *controller) |
35 | { |
36 | Q_D(QQuick3DXrInputManager); |
37 | |
38 | connect(sender: controller, signal: &QObject::destroyed, context: this, slot: [this](QObject *obj) { unregisterController(controller: static_cast<QQuick3DXrController *>(obj)); }); |
39 | |
40 | d->registerController(controller); |
41 | } |
42 | |
43 | void QQuick3DXrInputManager::unregisterController(QQuick3DXrController *controller) |
44 | { |
45 | Q_D(QQuick3DXrInputManager); |
46 | d->unregisterController(controller); |
47 | } |
48 | |
49 | bool QQuick3DXrInputManager::isValid() const |
50 | { |
51 | Q_D(const QQuick3DXrInputManager); |
52 | return d->isValid(); |
53 | } |
54 | |
55 | QQuick3DXrInputManager::QQuick3DXrInputManager(QObject *parent) |
56 | : QObject(parent) |
57 | , d_ptr(new QQuick3DXrInputManagerPrivate(*this)) |
58 | { |
59 | |
60 | } |
61 | |
62 | QQuick3DXrInputManager::~QQuick3DXrInputManager() |
63 | { |
64 | |
65 | } |
66 | |
67 | QT_END_NAMESPACE |
68 |