Debian Codegraph @

src/imports/Test/plugin/testplugin.cpp

raw
1 /*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 #include "testplugin.h"
18
19 #include <QtQml/QtQml>
20 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
21 #include <LomiriToolkit-Qt6/private/mousetouchadaptor_p.h>
22 #else
23 #include <LomiriToolkit/private/mousetouchadaptor_p.h>
24 #endif
25
26 #include "uctestextras.h"
27
28 UT_USE_NAMESPACE
29
30 static QObject *registerExtras(QQmlEngine *engine, QJSEngine *scriptEngine)
31 {
32 Q_UNUSED(engine)
33 Q_UNUSED(scriptEngine)
34
35 return new UCTestExtras;
36 }
37
38 void TestPlugin::registerTypes(const char *uri)
39 {
40 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
41 qmlRegisterModule(uri, 2, 0);
42 qmlRegisterSingletonType<UCTestExtras>(uri, 2, 0, "TestExtras", registerExtras);
43 qmlRegisterSingletonType<MouseTouchAdaptor>(uri, 2, 0, "MouseTouchAdaptor", MouseTouchAdaptor::registerQmlSingleton);
44 #else
45 qmlRegisterModule(uri, 0, 1);
46 qmlRegisterSingletonType<UCTestExtras>(uri, 1, 0, "TestExtras", registerExtras);
47 qmlRegisterSingletonType<MouseTouchAdaptor>(uri, 1, 0, "MouseTouchAdaptor", MouseTouchAdaptor::registerQmlSingleton);
48 #endif
49 }