KQuickCharts

SingleValueSource.cpp
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
10SingleValueSource::SingleValueSource(QObject *parent)
11 : ChartDataSource(parent)
12{
13}
14
15QVariant SingleValueSource::item(int index) const
16{
17 Q_UNUSED(index);
18 return m_value;
19}
20
21int SingleValueSource::itemCount() const
22{
23 return 1;
24}
25
26QVariant SingleValueSource::minimum() const
27{
28 return m_value;
29}
30
31QVariant SingleValueSource::maximum() const
32{
33 return m_value;
34}
35
36QVariant SingleValueSource::value() const
37{
38 return m_value;
39}
40
41void 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"
Abstract base class for data sources.
Q_EMITQ_EMIT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:53 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.