Libksysguard

FormatterPlugin.cpp
1/*
2 SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "FormatterPlugin.h"
8
9#include "FormatterWrapper.h"
10#include "Unit.h"
11
12#include <QQmlEngine>
13
14using namespace KSysGuard;
15
16void FormatterPlugin::registerTypes(const char *uri)
17{
18 Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.ksysguard.formatter"));
19
20 qRegisterMetaType<KSysGuard::Unit>();
21 qRegisterMetaType<KSysGuard::MetricPrefix>();
22 qmlRegisterSingletonType<KSysGuard::FormatterWrapper>(uri, 1, 0, "Formatter", [](QQmlEngine *, QJSEngine *) -> QObject * {
23 return new FormatterWrapper();
24 });
25 qmlRegisterUncreatableMetaObject(KSysGuard::staticMetaObject, uri, 1, 0, "Units", QStringLiteral("Contains unit enums"));
26}
Tiny helper class to make Formatter usable from QML.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:21:23 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.