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 | #include "SingleValueSource.h" |
9 | |
10 | SingleValueSource::SingleValueSource(QObject *parent) |
11 | : ChartDataSource(parent) |
12 | { |
13 | } |
14 | |
15 | QVariant SingleValueSource::item(int index) const |
16 | { |
17 | Q_UNUSED(index); |
18 | return m_value; |
19 | } |
20 | |
21 | int SingleValueSource::itemCount() const |
22 | { |
23 | return 1; |
24 | } |
25 | |
26 | QVariant SingleValueSource::minimum() const |
27 | { |
28 | return m_value; |
29 | } |
30 | |
31 | QVariant SingleValueSource::maximum() const |
32 | { |
33 | return m_value; |
34 | } |
35 | |
36 | QVariant SingleValueSource::value() const |
37 | { |
38 | return m_value; |
39 | } |
40 | |
41 | void SingleValueSource::setValue(const QVariant &value) |
42 | { |
43 | if (m_value == value) { |
44 | return; |
45 | } |
46 | |
47 | m_value = value; |
48 | Q_EMIT dataChanged(); |
49 | } |
50 | |
51 | #include "moc_SingleValueSource.cpp" |
52 |