1/*
2 * This file is part of KQuickCharts
3 * SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl>
4 *
5 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6 */
7
8#ifndef DATASOURCE_H
9#define DATASOURCE_H
10
11#include <QObject>
12#include <qqmlregistration.h>
13
14#include "quickcharts_export.h"
15
16/**
17 * Abstract base class for data sources.
18 */
19class QUICKCHARTS_EXPORT ChartDataSource : public QObject
20{
21 Q_OBJECT
22 QML_NAMED_ELEMENT(DataSource)
23 QML_UNCREATABLE("Abstract Base Class")
24
25public:
26 explicit ChartDataSource(QObject *parent = nullptr);
27 virtual ~ChartDataSource() = default;
28
29 virtual int itemCount() const = 0;
30 virtual QVariant item(int index) const = 0;
31 virtual QVariant minimum() const = 0;
32 virtual QVariant maximum() const = 0;
33
34 virtual QVariant first() const;
35
36 Q_SIGNAL void dataChanged();
37
38protected:
39 static bool variantCompare(const QVariant &lhs, const QVariant &rhs);
40};
41
42#endif // DATASOURCE_H
43

source code of kquickcharts/src/datasource/ChartDataSource.h