Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlmoduleregistration.cpp
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
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 <QtQml/private/qqmlmetatype_p.h>
5#include <QtQml/qqmlmoduleregistration.h>
6#include <QtCore/qversionnumber.h>
7
8QT_BEGIN_NAMESPACE
9
10struct QQmlModuleRegistrationPrivate
11{
12 const QString uri;
13};
14
15QQmlModuleRegistration::QQmlModuleRegistration(const char *uri, void (*registerFunction)()) :
16 d(new QQmlModuleRegistrationPrivate { QString::fromUtf8(uri) })
17{
18 QQmlMetaType::qmlInsertModuleRegistration(d->uri, registerFunction);
19}
20
21#if QT_DEPRECATED_SINCE(6, 0)
22QQmlModuleRegistration::QQmlModuleRegistration(
23 const char *uri, int majorVersion, void (*registerFunction)()) :
24 QQmlModuleRegistration(uri, registerFunction)
25{
26 Q_UNUSED(majorVersion);
27}
28#endif
29
30QQmlModuleRegistration::~QQmlModuleRegistration()
31{
32 QQmlMetaType::qmlRemoveModuleRegistration(d->uri);
33 delete d;
34}
35
36QT_END_NAMESPACE