KDeclarative

kcoreaddonsplugin.cpp
1 /*
2  SPDX-FileCopyrightText: 2014 Bhushan Shah <[email protected]>
3  SPDX-FileCopyrightText: 2014 David Edmundson <[email protected]>
4 
5  SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
6 */
7 
8 #include "kcoreaddonsplugin.h"
9 
10 #include <QtQml>
11 
12 #include "formats.h"
13 #include "kuserproxy.h"
14 
15 #include <KFormat>
16 
17 static QObject *formats_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
18 {
19  Q_UNUSED(engine)
20  Q_UNUSED(scriptEngine)
21 
22  return new Formats();
23 }
24 
25 void KCoreAddonsPlugin::registerTypes(const char *uri)
26 {
27  Q_ASSERT(QString::fromLatin1(uri) == QLatin1String("org.kde.kcoreaddons"));
28 
29  qmlRegisterSingletonType<Formats>(uri, 1, 0, "Format", formats_singletontype_provider);
30  qRegisterMetaType<QLocale::FormatType>();
31 
32  qmlRegisterUncreatableType<KFormat>(uri, 1, 0, "FormatTypes", QString());
33 
34  qmlRegisterType<KUserProxy>(uri, 1, 0, "KUser");
35 }
QString fromLatin1(const char *str, int size)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 22:44:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.