File indexing completed on 2024-09-01 13:28:52
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/ModelHistorySource.h" 0028 #include "datasource/ModelSource.h" 0029 #include "datasource/SingleValueSource.h" 0030 #include "datasource/ValueHistorySource.h" 0031 0032 #include "quickcharts_export.h" 0033 0034 QuickChartsPlugin::QuickChartsPlugin(QObject *parent) 0035 : QQmlExtensionPlugin(parent) 0036 { 0037 } 0038 0039 void QuickChartsPlugin::registerTypes(const char *uri) 0040 { 0041 Q_ASSERT(QString::fromLatin1(uri) == QLatin1String("org.kde.quickcharts")); 0042 0043 Q_INIT_RESOURCE(shaders); 0044 0045 qmlRegisterAnonymousType<QAbstractItemModel>(uri, 1); 0046 0047 qmlRegisterType<PieChart>(uri, 1, 0, "PieChart"); 0048 qmlRegisterType<LineChart>(uri, 1, 0, "LineChart"); 0049 qmlRegisterType<BarChart>(uri, 1, 0, "BarChart"); 0050 qmlRegisterUncreatableType<XYChart>(uri, 1, 0, "XYChart", QStringLiteral("Just a base class")); 0051 qmlRegisterUncreatableType<Chart>(uri, 1, 0, "Chart", QStringLiteral("Just a base class")); 0052 0053 qmlRegisterUncreatableType<ChartDataSource>(uri, 1, 0, "ChartDataSource", QStringLiteral("Just a base class")); 0054 qmlRegisterType<ModelSource>(uri, 1, 0, "ModelSource"); 0055 qmlRegisterType<SingleValueSource>(uri, 1, 0, "SingleValueSource"); 0056 qmlRegisterType<ArraySource>(uri, 1, 0, "ArraySource"); 0057 qmlRegisterType<ChartAxisSource>(uri, 1, 0, "ChartAxisSource"); 0058 qmlRegisterType<ColorGradientSource>(uri, 1, 0, "ColorGradientSource"); 0059 qmlRegisterType<MapProxySource>(uri, 1, 0, "MapProxySource"); 0060 qmlRegisterType<HistoryProxySource>(uri, 1, 0, "HistoryProxySource"); 0061 0062 #if QUICKCHARTS_BUILD_DEPRECATED_SINCE(5, 78) 0063 qmlRegisterType<ModelHistorySource>(uri, 1, 0, "ModelHistorySource"); 0064 qmlRegisterType<ValueHistorySource>(uri, 1, 0, "ValueHistorySource"); 0065 #else 0066 qmlRegisterTypeNotAvailable(uri, 1, 0, "ModelHistorySource", QStringLiteral("ModelHistorySource is deprecated, use HistoryProxySource instead")); 0067 qmlRegisterTypeNotAvailable(uri, 1, 0, "ValueHistorySource", QStringLiteral("ValueHistorySource is deprecated, use HistoryProxySource instead")); 0068 #endif 0069 0070 qmlRegisterUncreatableType<RangeGroup>(uri, 1, 0, "Range", QStringLiteral("Used as a grouped property")); 0071 0072 qmlRegisterType<GridLines>(uri, 1, 0, "GridLines"); 0073 qmlRegisterUncreatableType<LinePropertiesGroup>(uri, 1, 0, "LinePropertiesGroup", QStringLiteral("Used as a grouped property")); 0074 qmlRegisterType<AxisLabels>(uri, 1, 0, "AxisLabels"); 0075 qmlRegisterUncreatableType<AxisLabelsAttached>(uri, 1, 0, "AxisLabelsAttached", QStringLiteral("Attached property")); 0076 qmlRegisterType<LegendModel>(uri, 1, 0, "LegendModel"); 0077 qmlRegisterType<LegendLayout>(uri, 1, 0, "LegendLayout"); 0078 } 0079 0080 #include "moc_ChartsPlugin.cpp"