1/****************************************************************************
2**
3** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt3D module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#include "qt3dquick3dinputplugin.h"
41
42#include <Qt3DInput/qabstractphysicaldevice.h>
43#include <Qt3DInput/qaction.h>
44#include <Qt3DInput/qactioninput.h>
45#include <Qt3DInput/qanalogaxisinput.h>
46#include <Qt3DInput/qaxis.h>
47#include <Qt3DInput/qaxisaccumulator.h>
48#include <Qt3DInput/qaxissetting.h>
49#include <Qt3DInput/qbuttonaxisinput.h>
50#include <Qt3DInput/qinputchord.h>
51#include <Qt3DInput/qinputsequence.h>
52#include <Qt3DInput/qinputsettings.h>
53#include <Qt3DInput/qkeyboarddevice.h>
54#include <Qt3DInput/qkeyboardhandler.h>
55#include <Qt3DInput/qkeyevent.h>
56#include <Qt3DInput/qlogicaldevice.h>
57#include <Qt3DInput/qmousedevice.h>
58#include <Qt3DInput/qmouseevent.h>
59#include <Qt3DInput/qmousehandler.h>
60#include <QtQml>
61
62#include <Qt3DInput/private/qgenericinputdevice_p.h>
63#include <Qt3DQuickInput/private/quick3daction_p.h>
64#include <Qt3DQuickInput/private/quick3daxis_p.h>
65#include <Qt3DQuickInput/private/quick3dinputchord_p.h>
66#include <Qt3DQuickInput/private/quick3dinputsequence_p.h>
67#include <Qt3DQuickInput/private/quick3dlogicaldevice_p.h>
68#include <Qt3DQuickInput/private/quick3dphysicaldevice_p.h>
69
70#ifdef HAVE_QGAMEPAD
71# include <Qt3DInput/private/qgamepadinput_p.h>
72#endif
73
74QT_BEGIN_NAMESPACE
75
76void Qt3DQuick3DInputPlugin::registerTypes(const char *uri)
77{
78 qmlRegisterUncreatableType<Qt3DInput::QKeyEvent>(uri, versionMajor: 2, versionMinor: 0, qmlName: "KeyEvent", QStringLiteral("Events cannot be created"));
79 qmlRegisterType<Qt3DInput::QKeyboardDevice>(uri, versionMajor: 2, versionMinor: 0, qmlName: "KeyboardDevice");
80 qmlRegisterType<Qt3DInput::QKeyboardHandler>(uri, versionMajor: 2, versionMinor: 0, qmlName: "KeyboardHandler");
81 qmlRegisterType<Qt3DInput::QInputSettings>(uri, versionMajor: 2, versionMinor: 0, qmlName: "InputSettings");
82
83 qmlRegisterUncreatableType<Qt3DInput::QMouseEvent>(uri, versionMajor: 2, versionMinor: 0, qmlName: "MouseEvent", QStringLiteral("Events cannot be created"));
84#if QT_CONFIG(wheelevent)
85 qmlRegisterUncreatableType<Qt3DInput::QWheelEvent>(uri, versionMajor: 2, versionMinor: 0, qmlName: "WheelEvent", QStringLiteral("Events cannot be created"));
86#endif
87 qmlRegisterType<Qt3DInput::QMouseHandler>(uri, versionMajor: 2, versionMinor: 0, qmlName: "MouseHandler");
88 qmlRegisterType<Qt3DInput::QMouseDevice>(uri, versionMajor: 2, versionMinor: 0, qmlName: "MouseDevice");
89 qmlRegisterType<Qt3DInput::QMouseDevice, 15>(uri, versionMajor: 2, versionMinor: 15, qmlName: "MouseDevice");
90
91 qmlRegisterExtendedType<Qt3DInput::QLogicalDevice, Qt3DInput::Input::Quick::Quick3DLogicalDevice>(uri, versionMajor: 2, versionMinor: 0, qmlName: "LogicalDevice");
92 qmlRegisterUncreatableType<Qt3DInput::QAbstractActionInput>(uri, versionMajor: 2, versionMinor: 0, qmlName: "AbstractActionInput", QStringLiteral("AbstractActionInput is abstract"));
93 qmlRegisterType<Qt3DInput::QActionInput>(uri, versionMajor: 2, versionMinor: 0, qmlName: "ActionInput");
94 qmlRegisterUncreatableType<Qt3DInput::QAbstractAxisInput>(uri, versionMajor: 2, versionMinor: 0, qmlName: "AbstractAxisInput", QStringLiteral("AbstractAxisInput is abstract"));
95 qmlRegisterType<Qt3DInput::QAxisSetting>(uri, versionMajor: 2, versionMinor: 0, qmlName: "AxisSetting");
96 qmlRegisterType<Qt3DInput::QAnalogAxisInput>(uri, versionMajor: 2, versionMinor: 0, qmlName: "AnalogAxisInput");
97 qmlRegisterType<Qt3DInput::QButtonAxisInput>(uri, versionMajor: 2, versionMinor: 0, qmlName: "ButtonAxisInput");
98 qmlRegisterExtendedType<Qt3DInput::QAxis, Qt3DInput::Input::Quick::Quick3DAxis>(uri, versionMajor: 2, versionMinor: 0, qmlName: "Axis");
99 qmlRegisterExtendedType<Qt3DInput::QAction, Qt3DInput::Input::Quick::Quick3DAction>(uri, versionMajor: 2, versionMinor: 0, qmlName: "Action");
100 qmlRegisterExtendedType<Qt3DInput::QInputSequence, Qt3DInput::Input::Quick::Quick3DInputSequence>(uri, versionMajor: 2, versionMinor: 0, qmlName: "InputSequence");
101 qmlRegisterExtendedType<Qt3DInput::QInputChord, Qt3DInput::Input::Quick::Quick3DInputChord>(uri, versionMajor: 2, versionMinor: 0, qmlName: "InputChord");
102 qmlRegisterExtendedUncreatableType<Qt3DInput::QAbstractPhysicalDevice, Qt3DInput::Input::Quick::Quick3DPhysicalDevice>(uri, versionMajor: 2, versionMinor: 0, qmlName: "QAbstractPhysicalDevice", QStringLiteral("QAbstractPhysicalDevice is abstract"));
103 qmlRegisterType<Qt3DInput::QAxisAccumulator>(uri, versionMajor: 2, versionMinor: 1, qmlName: "AxisAccumulator");
104
105#ifdef HAVE_QGAMEPAD
106 qmlRegisterType<Qt3DInput::QGamepadInput>(uri, versionMajor: 2, versionMinor: 0, qmlName: "GamepadInput");
107#endif
108
109 // Auto-increment the import to stay in sync with ALL future Qt minor versions
110 qmlRegisterModule(uri, versionMajor: 2, QT_VERSION_MINOR);
111}
112
113QT_END_NAMESPACE
114

source code of qt3d/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp