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 "keyboardmousegenericdeviceintegration_p.h"
5
6#include <Qt3DInput/private/inputhandler_p.h>
7#include <Qt3DInput/private/inputmanagers_p.h>
8
9QT_BEGIN_NAMESPACE
10
11namespace Qt3DInput {
12
13namespace Input {
14
15KeyboardMouseGenericDeviceIntegration::KeyboardMouseGenericDeviceIntegration(InputHandler *handler)
16 : Qt3DInput::QInputDeviceIntegration()
17 , m_handler(handler)
18{
19}
20
21KeyboardMouseGenericDeviceIntegration::~KeyboardMouseGenericDeviceIntegration()
22{
23}
24
25void KeyboardMouseGenericDeviceIntegration::onInitialize()
26{
27}
28
29std::vector<Qt3DCore::QAspectJobPtr> KeyboardMouseGenericDeviceIntegration::jobsToExecute(qint64 time)
30{
31 Q_UNUSED(time);
32 return {};
33}
34
35QAbstractPhysicalDevice *KeyboardMouseGenericDeviceIntegration::createPhysicalDevice(const QString &name)
36{
37 Q_UNUSED(name);
38 return nullptr;
39}
40
41QList<Qt3DCore::QNodeId> KeyboardMouseGenericDeviceIntegration::physicalDevices() const
42{
43 // TO DO: could return the ids of active KeyboardDevice/MouseDevice
44 return { };
45}
46
47QAbstractPhysicalDeviceBackendNode *KeyboardMouseGenericDeviceIntegration::physicalDevice(Qt3DCore::QNodeId id) const
48{
49 QAbstractPhysicalDeviceBackendNode *device = m_handler->keyboardDeviceManager()->lookupResource(id);
50 if (!device)
51 device = m_handler->mouseDeviceManager()->lookupResource(id);
52 if (!device)
53 device = m_handler->genericDeviceBackendNodeManager()->lookupResource(id);
54 return device;
55}
56
57QStringList KeyboardMouseGenericDeviceIntegration::deviceNames() const
58{
59 return QStringList() << tr(s: "Keyboard") << tr(s: "Mouse");
60}
61
62} // Input
63
64} // Qt3DInput
65
66QT_END_NAMESPACE
67
68#include "moc_keyboardmousegenericdeviceintegration_p.cpp"
69

source code of qt3d/src/input/backend/keyboardmousegenericdeviceintegration.cpp