Warning, file /frameworks/kquickcharts/src/datasource/ChartAxisSource.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 CHARTAXISSOURCE_H
0009 #define CHARTAXISSOURCE_H
0010 
0011 #include "ChartDataSource.h"
0012 
0013 class XYChart;
0014 
0015 /**
0016  * A data source that provides values from a chart's axis as data.
0017  */
0018 class ChartAxisSource : public ChartDataSource
0019 {
0020     Q_OBJECT
0021     Q_PROPERTY(XYChart *chart READ chart WRITE setChart NOTIFY chartChanged)
0022     Q_PROPERTY(ChartAxisSource::Axis axis READ axis WRITE setAxis NOTIFY axisChanged)
0023     Q_PROPERTY(int itemCount READ itemCount WRITE setItemCount NOTIFY itemCountChanged)
0024 
0025 public:
0026     enum class Axis { XAxis, YAxis };
0027     Q_ENUM(Axis)
0028 
0029     /**
0030      * Constructor
0031      *
0032      * @param parent TODO
0033      */
0034     ChartAxisSource(QObject *parent = nullptr);
0035 
0036     virtual QVariant item(int index) const override;
0037     QVariant minimum() const override;
0038     QVariant maximum() const override;
0039 
0040     XYChart *chart() const;
0041     Q_SLOT void setChart(XYChart *newChart);
0042     Q_SIGNAL void chartChanged();
0043 
0044     ChartAxisSource::Axis axis() const;
0045     Q_SLOT void setAxis(ChartAxisSource::Axis newAxis);
0046     Q_SIGNAL void axisChanged();
0047 
0048     virtual int itemCount() const override;
0049     Q_SLOT void setItemCount(int newItemCount);
0050     Q_SIGNAL void itemCountChanged();
0051 
0052 private:
0053     XYChart *m_chart = nullptr;
0054     Axis m_axis = Axis::XAxis;
0055     int m_itemCount = 2;
0056 };
0057 
0058 #endif // ARRAYSOURCE_H