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 * \qmltype SingleValueSource
17 * \inherits ChartDataSource
18 * \inqmlmodule org.kde.quickcharts
19 *
20 * \brief A data source that provides a single value as data.
21 */
22class QUICKCHARTS_EXPORT SingleValueSource : public ChartDataSource
23{
24 Q_OBJECT
25 QML_ELEMENT
26
27public:
28 explicit SingleValueSource(QObject *parent = nullptr);
29
30 int itemCount() const override;
31 QVariant item(int index) const override;
32 QVariant minimum() const override;
33 QVariant maximum() const override;
34
35 /*!
36 * \qmlproperty var SingleValueSource::value
37 */
38 Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY dataChanged)
39 QVariant value() const;
40 void setValue(const QVariant &value);
41
42private:
43 QVariant m_value;
44};
45
46#endif // SINGLEVALUESOURCE_H
47

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