1// Copyright (C) 2014 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 "qt3dquick3dinputplugin.h"
5
6#include <Qt3DInput/qabstractphysicaldevice.h>
7#include <Qt3DInput/qaction.h>
8#include <Qt3DInput/qactioninput.h>
9#include <Qt3DInput/qanalogaxisinput.h>
10#include <Qt3DInput/qaxis.h>
11#include <Qt3DInput/qaxisaccumulator.h>
12#include <Qt3DInput/qaxissetting.h>
13#include <Qt3DInput/qbuttonaxisinput.h>
14#include <Qt3DInput/qinputchord.h>
15#include <Qt3DInput/qinputsequence.h>
16#include <Qt3DInput/qinputsettings.h>
17#include <Qt3DInput/qkeyboarddevice.h>
18#include <Qt3DInput/qkeyboardhandler.h>
19#include <Qt3DInput/qkeyevent.h>
20#include <Qt3DInput/qlogicaldevice.h>
21#include <Qt3DInput/qmousedevice.h>
22#include <Qt3DInput/qmouseevent.h>
23#include <Qt3DInput/qmousehandler.h>
24#include <QtQml>
25
26#include <Qt3DInput/private/qgenericinputdevice_p.h>
27#include <Qt3DQuickInput/private/quick3daction_p.h>
28#include <Qt3DQuickInput/private/quick3daxis_p.h>
29#include <Qt3DQuickInput/private/quick3dinputchord_p.h>
30#include <Qt3DQuickInput/private/quick3dinputsequence_p.h>
31#include <Qt3DQuickInput/private/quick3dlogicaldevice_p.h>
32#include <Qt3DQuickInput/private/quick3dphysicaldevice_p.h>
33
34#ifdef HAVE_QGAMEPAD
35# include <Qt3DInput/private/qgamepadinput_p.h>
36#endif
37
38QT_BEGIN_NAMESPACE
39
40void Qt3DQuick3DInputPlugin::registerTypes(const char *uri)
41{
42 qmlRegisterUncreatableType<Qt3DInput::QKeyEvent>(uri, versionMajor: 2, versionMinor: 0, qmlName: "KeyEvent", QStringLiteral("Events cannot be created"));
43 qmlRegisterType<Qt3DInput::QKeyboardDevice>(uri, versionMajor: 2, versionMinor: 0, qmlName: "KeyboardDevice");
44 qmlRegisterType<Qt3DInput::QKeyboardHandler>(uri, versionMajor: 2, versionMinor: 0, qmlName: "KeyboardHandler");
45 qmlRegisterType<Qt3DInput::QInputSettings>(uri, versionMajor: 2, versionMinor: 0, qmlName: "InputSettings");
46
47 qmlRegisterUncreatableType<Qt3DInput::QMouseEvent>(uri, versionMajor: 2, versionMinor: 0, qmlName: "MouseEvent", QStringLiteral("Events cannot be created"));
48#if QT_CONFIG(wheelevent)
49 qmlRegisterUncreatableType<Qt3DInput::QWheelEvent>(uri, versionMajor: 2, versionMinor: 0, qmlName: "WheelEvent", QStringLiteral("Events cannot be created"));
50#endif
51 qmlRegisterType<Qt3DInput::QMouseHandler>(uri, versionMajor: 2, versionMinor: 0, qmlName: "MouseHandler");
52 qmlRegisterType<Qt3DInput::QMouseDevice>(uri, versionMajor: 2, versionMinor: 0, qmlName: "MouseDevice");
53 qmlRegisterType<Qt3DInput::QMouseDevice, 15>(uri, versionMajor: 2, versionMinor: 15, qmlName: "MouseDevice");
54
55 qmlRegisterExtendedType<Qt3DInput::QLogicalDevice, Qt3DInput::Input::Quick::Quick3DLogicalDevice>(uri, versionMajor: 2, versionMinor: 0, qmlName: "LogicalDevice");
56 qmlRegisterUncreatableType<Qt3DInput::QAbstractActionInput>(uri, versionMajor: 2, versionMinor: 0, qmlName: "AbstractActionInput", QStringLiteral("AbstractActionInput is abstract"));
57 qmlRegisterType<Qt3DInput::QActionInput>(uri, versionMajor: 2, versionMinor: 0, qmlName: "ActionInput");
58 qmlRegisterUncreatableType<Qt3DInput::QAbstractAxisInput>(uri, versionMajor: 2, versionMinor: 0, qmlName: "AbstractAxisInput", QStringLiteral("AbstractAxisInput is abstract"));
59 qmlRegisterType<Qt3DInput::QAxisSetting>(uri, versionMajor: 2, versionMinor: 0, qmlName: "AxisSetting");
60 qmlRegisterType<Qt3DInput::QAnalogAxisInput>(uri, versionMajor: 2, versionMinor: 0, qmlName: "AnalogAxisInput");
61 qmlRegisterType<Qt3DInput::QButtonAxisInput>(uri, versionMajor: 2, versionMinor: 0, qmlName: "ButtonAxisInput");
62 qmlRegisterExtendedType<Qt3DInput::QAxis, Qt3DInput::Input::Quick::Quick3DAxis>(uri, versionMajor: 2, versionMinor: 0, qmlName: "Axis");
63 qmlRegisterExtendedType<Qt3DInput::QAction, Qt3DInput::Input::Quick::Quick3DAction>(uri, versionMajor: 2, versionMinor: 0, qmlName: "Action");
64 qmlRegisterExtendedType<Qt3DInput::QInputSequence, Qt3DInput::Input::Quick::Quick3DInputSequence>(uri, versionMajor: 2, versionMinor: 0, qmlName: "InputSequence");
65 qmlRegisterExtendedType<Qt3DInput::QInputChord, Qt3DInput::Input::Quick::Quick3DInputChord>(uri, versionMajor: 2, versionMinor: 0, qmlName: "InputChord");
66 qmlRegisterExtendedUncreatableType<Qt3DInput::QAbstractPhysicalDevice, Qt3DInput::Input::Quick::Quick3DPhysicalDevice>(uri, versionMajor: 2, versionMinor: 0, qmlName: "QAbstractPhysicalDevice", QStringLiteral("QAbstractPhysicalDevice is abstract"));
67 qmlRegisterType<Qt3DInput::QAxisAccumulator>(uri, versionMajor: 2, versionMinor: 1, qmlName: "AxisAccumulator");
68
69#ifdef HAVE_QGAMEPAD
70 qmlRegisterType<Qt3DInput::QGamepadInput>(uri, 2, 0, "GamepadInput");
71#endif
72
73 // The minor version used to be the current Qt 5 minor. For compatibility it is the last
74 // Qt 5 release.
75 qmlRegisterModule(uri, versionMajor: 2, versionMinor: 15);
76}
77
78QT_END_NAMESPACE
79
80#include "moc_qt3dquick3dinputplugin.cpp"
81

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