File indexing completed on 2025-03-23 03:42:18
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 #ifndef ARRAYSOURCE_H 0009 #define ARRAYSOURCE_H 0010 0011 #include <QVariantList> 0012 0013 #include "ChartDataSource.h" 0014 0015 /** 0016 * A data source that provides entries of an array as data. 0017 */ 0018 class QUICKCHARTS_EXPORT ArraySource : public ChartDataSource 0019 { 0020 Q_OBJECT 0021 QML_ELEMENT 0022 0023 public: 0024 /** 0025 * Constructor 0026 * 0027 * @param parent TODO 0028 */ 0029 explicit ArraySource(QObject *parent = nullptr); 0030 0031 virtual int itemCount() const override; 0032 virtual QVariant item(int index) const override; 0033 QVariant minimum() const override; 0034 QVariant maximum() const override; 0035 0036 Q_PROPERTY(QVariantList array READ array WRITE setArray NOTIFY dataChanged) 0037 QVariantList array() const; 0038 void setArray(const QVariantList &array); 0039 0040 Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY dataChanged) 0041 bool wrap() const; 0042 void setWrap(bool wrap); 0043 0044 private: 0045 QVariantList m_array; 0046 bool m_wrap = false; 0047 }; 0048 0049 #endif // ARRAYSOURCE_H