File indexing completed on 2024-10-06 03:40:53

0001 /*
0002  * This file is part of KQuickCharts
0003  * SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006  */
0007 
0008 #include "ChartsPlugin.h"
0009 
0010 #include "BarChart.h"
0011 #include "Chart.h"
0012 #include "LineChart.h"
0013 #include "PieChart.h"
0014 #include "RangeGroup.h"
0015 #include "XYChart.h"
0016 
0017 #include "decorations/AxisLabels.h"
0018 #include "decorations/GridLines.h"
0019 #include "decorations/LegendModel.h"
0020 #include "decorations/LegendLayout.h"
0021 
0022 #include "datasource/ArraySource.h"
0023 #include "datasource/ChartAxisSource.h"
0024 #include "datasource/ColorGradientSource.h"
0025 #include "datasource/HistoryProxySource.h"
0026 #include "datasource/MapProxySource.h"
0027 #include "datasource/ModelSource.h"
0028 #include "datasource/SingleValueSource.h"
0029 
0030 #include "quickcharts_export.h"
0031 
0032 QuickChartsPlugin::QuickChartsPlugin(QObject *parent)
0033     : QQmlExtensionPlugin(parent)
0034 {
0035 }
0036 
0037 void QuickChartsPlugin::registerTypes(const char *uri)
0038 {
0039     Q_ASSERT(QString::fromLatin1(uri) == QLatin1String("org.kde.quickcharts"));
0040 
0041     qmlRegisterAnonymousType<QAbstractItemModel>(uri, 1);
0042 
0043     qmlRegisterType<PieChart>(uri, 1, 0, "PieChart");
0044     qmlRegisterType<LineChart>(uri, 1, 0, "LineChart");
0045     qmlRegisterType<BarChart>(uri, 1, 0, "BarChart");
0046     qmlRegisterUncreatableType<XYChart>(uri, 1, 0, "XYChart", QStringLiteral("Just a base class"));
0047     qmlRegisterUncreatableType<Chart>(uri, 1, 0, "Chart", QStringLiteral("Just a base class"));
0048 
0049     qmlRegisterUncreatableType<ChartDataSource>(uri, 1, 0, "ChartDataSource", QStringLiteral("Just a base class"));
0050     qmlRegisterType<ModelSource>(uri, 1, 0, "ModelSource");
0051     qmlRegisterType<SingleValueSource>(uri, 1, 0, "SingleValueSource");
0052     qmlRegisterType<ArraySource>(uri, 1, 0, "ArraySource");
0053     qmlRegisterType<ChartAxisSource>(uri, 1, 0, "ChartAxisSource");
0054     qmlRegisterType<ColorGradientSource>(uri, 1, 0, "ColorGradientSource");
0055     qmlRegisterType<MapProxySource>(uri, 1, 0, "MapProxySource");
0056     qmlRegisterType<HistoryProxySource>(uri, 1, 0, "HistoryProxySource");
0057 
0058     qmlRegisterUncreatableType<RangeGroup>(uri, 1, 0, "Range", QStringLiteral("Used as a grouped property"));
0059 
0060     qmlRegisterType<GridLines>(uri, 1, 0, "GridLines");
0061     qmlRegisterUncreatableType<LinePropertiesGroup>(uri, 1, 0, "LinePropertiesGroup", QStringLiteral("Used as a grouped property"));
0062     qmlRegisterType<AxisLabels>(uri, 1, 0, "AxisLabels");
0063     qmlRegisterUncreatableType<AxisLabelsAttached>(uri, 1, 0, "AxisLabelsAttached", QStringLiteral("Attached property"));
0064     qmlRegisterType<LegendModel>(uri, 1, 0, "LegendModel");
0065     qmlRegisterType<LegendLayout>(uri, 1, 0, "LegendLayout");
0066 }
0067 
0068 #include "moc_ChartsPlugin.cpp"