File indexing completed on 2024-05-05 16:16:41

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 #include "SingleValueSource.h"
0009 
0010 SingleValueSource::SingleValueSource(QObject *parent)
0011     : ChartDataSource(parent)
0012 {
0013 }
0014 
0015 QVariant SingleValueSource::item(int index) const
0016 {
0017     Q_UNUSED(index);
0018     return m_value;
0019 }
0020 
0021 int SingleValueSource::itemCount() const
0022 {
0023     return 1;
0024 }
0025 
0026 QVariant SingleValueSource::minimum() const
0027 {
0028     return m_value;
0029 }
0030 
0031 QVariant SingleValueSource::maximum() const
0032 {
0033     return m_value;
0034 }
0035 
0036 QVariant SingleValueSource::value() const
0037 {
0038     return m_value;
0039 }
0040 
0041 void SingleValueSource::setValue(const QVariant &value)
0042 {
0043     if (m_value == value) {
0044         return;
0045     }
0046 
0047     m_value = value;
0048     Q_EMIT dataChanged();
0049 }
0050 
0051 #include "moc_SingleValueSource.cpp"