File indexing completed on 2024-12-08 09:43:07
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 #ifndef DATASOURCE_H 0009 #define DATASOURCE_H 0010 0011 #include <QObject> 0012 0013 /** 0014 * Abstract base class for data sources. 0015 */ 0016 class ChartDataSource : public QObject 0017 { 0018 Q_OBJECT 0019 0020 public: 0021 explicit ChartDataSource(QObject *parent = nullptr); 0022 virtual ~ChartDataSource() = default; 0023 0024 virtual int itemCount() const = 0; 0025 virtual QVariant item(int index) const = 0; 0026 virtual QVariant minimum() const = 0; 0027 virtual QVariant maximum() const = 0; 0028 0029 virtual QVariant first() const; 0030 0031 Q_SIGNAL void dataChanged(); 0032 0033 protected: 0034 static bool variantCompare(const QVariant &lhs, const QVariant &rhs); 0035 }; 0036 0037 #endif // DATASOURCE_H