Warning, file /frameworks/kquickcharts/src/datasource/MapProxySource.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #pragma once 0008 0009 #include "ChartDataSource.h" 0010 0011 #include <QVariant> 0012 0013 /** 0014 * A source that uses the values of another source to produce values from a map. 0015 * 0016 * This source reads values from another source, then uses those as an index to 0017 * a map of different values and returns the appropriate value from that map. 0018 * This source's itemCount matches that of the other source. 0019 * 0020 * @since 5.71 0021 */ 0022 class MapProxySource : public ChartDataSource 0023 { 0024 Q_OBJECT 0025 /** 0026 * A ChartDataSource that is used as map indexes. 0027 */ 0028 Q_PROPERTY(ChartDataSource *source READ source WRITE setSource NOTIFY sourceChanged) 0029 /** 0030 * The map to index for values. 0031 */ 0032 Q_PROPERTY(QVariantMap map READ map WRITE setMap NOTIFY mapChanged) 0033 0034 public: 0035 MapProxySource(QObject *parent = nullptr); 0036 0037 virtual int itemCount() const override; 0038 virtual QVariant item(int index) const override; 0039 0040 virtual QVariant minimum() const override; 0041 virtual QVariant maximum() const override; 0042 0043 ChartDataSource *source() const; 0044 void setSource(ChartDataSource *newSource); 0045 Q_SIGNAL void sourceChanged(); 0046 0047 QVariantMap map() const; 0048 void setMap(const QVariantMap &newMap); 0049 Q_SIGNAL void mapChanged(); 0050 0051 private: 0052 ChartDataSource *m_source = nullptr; 0053 QVariantMap m_map; 0054 };