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 SINGLEVALUESOURCE_H
9#define SINGLEVALUESOURCE_H
10
11#include <QVariant>
12
13#include "ChartDataSource.h"
14
15/**
16 * A data source that provides a single value as data.
17 */
18class QUICKCHARTS_EXPORT SingleValueSource : public ChartDataSource
19{
20 Q_OBJECT
21 QML_ELEMENT
22
23public:
24 explicit SingleValueSource(QObject *parent = nullptr);
25
26 virtual int itemCount() const override;
27 virtual QVariant item(int index) const override;
28 QVariant minimum() const override;
29 QVariant maximum() const override;
30
31 Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY dataChanged)
32 QVariant value() const;
33 void setValue(const QVariant &value);
34
35private:
36 QVariant m_value;
37};
38
39#endif // SINGLEVALUESOURCE_H
40

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