| 1 | // Copyright (C) 2024 The Qt Company Ltd. |
|---|---|
| 2 | |
| 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 4 | #ifndef QTGRAPHS_QXYMODELMAPPER_H |
| 5 | #define QTGRAPHS_QXYMODELMAPPER_H |
| 6 | #include <QtCore/qobject.h> |
| 7 | #include <QtGraphs/qgraphsglobal.h> |
| 8 | #include <QtQmlIntegration/qqmlintegration.h> |
| 9 | |
| 10 | Q_MOC_INCLUDE(<QtGraphs / qxyseries.h>) |
| 11 | Q_MOC_INCLUDE(<QtCore / qabstractitemmodel.h>) |
| 12 | |
| 13 | QT_BEGIN_NAMESPACE |
| 14 | |
| 15 | class QXYModelMapperPrivate; |
| 16 | class QXYSeries; |
| 17 | class QAbstractItemModel; |
| 18 | |
| 19 | class Q_GRAPHS_EXPORT QXYModelMapper : public QObject |
| 20 | { |
| 21 | Q_OBJECT |
| 22 | Q_PROPERTY(QXYSeries *series READ series WRITE setSeries NOTIFY seriesChanged FINAL) |
| 23 | Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelChanged FINAL) |
| 24 | Q_PROPERTY(qsizetype xSection READ xSection WRITE setXSection NOTIFY xSectionChanged FINAL) |
| 25 | Q_PROPERTY(qsizetype ySection READ ySection WRITE setYSection NOTIFY ySectionChanged FINAL) |
| 26 | Q_PROPERTY(qsizetype first READ first WRITE setFirst NOTIFY firstChanged FINAL) |
| 27 | Q_PROPERTY(qsizetype count READ count WRITE setCount NOTIFY countChanged FINAL) |
| 28 | Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY |
| 29 | orientationChanged FINAL) |
| 30 | QML_NAMED_ELEMENT(XYModelMapper) |
| 31 | Q_DECLARE_PRIVATE(QXYModelMapper) |
| 32 | public: |
| 33 | explicit QXYModelMapper(QObject *parent = nullptr); |
| 34 | ~QXYModelMapper() override; |
| 35 | |
| 36 | QAbstractItemModel *model() const; |
| 37 | void setModel(QAbstractItemModel *model); |
| 38 | |
| 39 | QXYSeries *series() const; |
| 40 | void setSeries(QXYSeries *series); |
| 41 | |
| 42 | qsizetype first() const; |
| 43 | void setFirst(qsizetype first); |
| 44 | |
| 45 | qsizetype count() const; |
| 46 | void setCount(qsizetype count); |
| 47 | |
| 48 | Qt::Orientation orientation() const; |
| 49 | void setOrientation(Qt::Orientation orientation); |
| 50 | |
| 51 | qsizetype xSection() const; |
| 52 | void setXSection(qsizetype xSection); |
| 53 | |
| 54 | qsizetype ySection() const; |
| 55 | void setYSection(qsizetype ySection); |
| 56 | Q_SIGNALS: |
| 57 | void seriesChanged(); |
| 58 | void modelChanged(); |
| 59 | void xSectionChanged(); |
| 60 | void ySectionChanged(); |
| 61 | void firstChanged(); |
| 62 | void countChanged(); |
| 63 | void orientationChanged(); |
| 64 | |
| 65 | protected: |
| 66 | QXYModelMapper(QXYModelMapperPrivate &dd, QObject *parent = nullptr); |
| 67 | |
| 68 | Q_DISABLE_COPY_MOVE(QXYModelMapper) |
| 69 | }; |
| 70 | |
| 71 | QT_END_NAMESPACE |
| 72 | |
| 73 | #endif // QTGRAPHS_QXYMODELMAPPER_H |
| 74 |
