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