File indexing completed on 2025-03-23 03:42:18
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 SINGLEVALUESOURCE_H 0009 #define SINGLEVALUESOURCE_H 0010 0011 #include <QVariant> 0012 0013 #include "ChartDataSource.h" 0014 0015 /** 0016 * A data source that provides a single value as data. 0017 */ 0018 class QUICKCHARTS_EXPORT SingleValueSource : public ChartDataSource 0019 { 0020 Q_OBJECT 0021 QML_ELEMENT 0022 0023 public: 0024 explicit SingleValueSource(QObject *parent = nullptr); 0025 0026 virtual int itemCount() const override; 0027 virtual QVariant item(int index) const override; 0028 QVariant minimum() const override; 0029 QVariant maximum() const override; 0030 0031 Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY dataChanged) 0032 QVariant value() const; 0033 void setValue(const QVariant &value); 0034 0035 private: 0036 QVariant m_value; 0037 }; 0038 0039 #endif // SINGLEVALUESOURCE_H