| 1 | // Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include "qinputdeviceintegration_p.h" |
| 5 | #include "qinputdeviceintegration_p_p.h" |
| 6 | |
| 7 | #include <Qt3DInput/QInputAspect> |
| 8 | |
| 9 | QT_BEGIN_NAMESPACE |
| 10 | |
| 11 | namespace Qt3DInput { |
| 12 | |
| 13 | QInputDeviceIntegrationPrivate::QInputDeviceIntegrationPrivate() |
| 14 | : QObjectPrivate() |
| 15 | , m_aspect(nullptr) |
| 16 | { |
| 17 | } |
| 18 | |
| 19 | /*! |
| 20 | \class Qt3DInput::QInputDeviceIntegration |
| 21 | \inmodule Qt3DInput |
| 22 | \since 5.5 |
| 23 | \brief Abstract base class used to define new input methods such as game controllers. |
| 24 | |
| 25 | */ |
| 26 | |
| 27 | /*! |
| 28 | Creates a new QInputDeviceIntegration with \a parent. |
| 29 | */ |
| 30 | QInputDeviceIntegration::QInputDeviceIntegration(QObject *parent) |
| 31 | : QObject(*new QInputDeviceIntegrationPrivate, parent) |
| 32 | { |
| 33 | } |
| 34 | |
| 35 | /*! \internal */ |
| 36 | QInputDeviceIntegration::QInputDeviceIntegration(QInputDeviceIntegrationPrivate &dd, QObject *parent) |
| 37 | : QObject(dd, parent) |
| 38 | { |
| 39 | } |
| 40 | |
| 41 | /*! |
| 42 | Registers a corresponding backend class for this front end implementation |
| 43 | with \a metaObject and \a functor. |
| 44 | */ |
| 45 | void QInputDeviceIntegration::registerBackendType(const QMetaObject &metaObject, const Qt3DCore::QBackendNodeMapperPtr &functor) |
| 46 | { |
| 47 | Q_D(QInputDeviceIntegration); |
| 48 | d->m_aspect->registerBackendType(obj: metaObject, functor); |
| 49 | } |
| 50 | |
| 51 | /*! |
| 52 | Called by the InputAspect object after the integration has been created with \a aspect. |
| 53 | */ |
| 54 | void QInputDeviceIntegration::initialize(QInputAspect *aspect) |
| 55 | { |
| 56 | Q_D(QInputDeviceIntegration); |
| 57 | d->m_aspect = aspect; |
| 58 | onInitialize(); |
| 59 | } |
| 60 | |
| 61 | /*! |
| 62 | * \brief QInputDeviceIntegration::inputAspect |
| 63 | * \return the Input Aspect associated with the InputDeviceIntegration |
| 64 | */ |
| 65 | QInputAspect *QInputDeviceIntegration::inputAspect() const |
| 66 | { |
| 67 | Q_D(const QInputDeviceIntegration); |
| 68 | return d->m_aspect; |
| 69 | } |
| 70 | |
| 71 | } // namespace Qt3DInput |
| 72 | |
| 73 | /*! |
| 74 | \fn Qt3DInput::QInputDeviceIntegration::createPhysicalDevice(const QString &name) |
| 75 | |
| 76 | Create the Physical device identified by \a name. |
| 77 | |
| 78 | If not recognized return nullptr |
| 79 | */ |
| 80 | |
| 81 | /*! |
| 82 | \fn Qt3DInput::QInputDeviceIntegration::physicalDevices() const |
| 83 | |
| 84 | Returns the list of node ids for physical devices associated with this QInputDeviceIntegration. |
| 85 | */ |
| 86 | |
| 87 | /*! |
| 88 | \fn Qt3DInput::QInputDeviceIntegration::physicalDevice(Qt3DCore::QNodeId id) const |
| 89 | |
| 90 | Returns the QAbstractPhysicalDevice identified by the given \a id if it is related to this QInputDeviceIntegration. |
| 91 | */ |
| 92 | |
| 93 | QT_END_NAMESPACE |
| 94 | |
| 95 | #include "moc_qinputdeviceintegration_p.cpp" |
| 96 | |