1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3#ifndef QPIEMODELMAPPER_H
4#define QPIEMODELMAPPER_H
5
6#include <QtCore/qobject.h>
7#include <QtGraphs/qgraphsglobal.h>
8#include <QtQmlIntegration/qqmlintegration.h>
9Q_MOC_INCLUDE(<QtGraphs / qpieseries.h>)
10Q_MOC_INCLUDE(<QtCore / qabstractitemmodel.h>)
11
12QT_BEGIN_NAMESPACE
13
14class QAbstractItemModel;
15class QPieModelMapperPrivate;
16class QPieSeries;
17
18class 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)
34public:
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);
58Q_SIGNALS:
59 void seriesChanged();
60 void modelChanged();
61 void valuesSectionChanged();
62 void labelsSectionChanged();
63 void firstChanged();
64 void countChanged();
65 void orientationChanged();
66
67public Q_SLOTS:
68 void onSliceLabelChanged();
69 void onSliceValueChanged();
70
71protected:
72 QPieModelMapper(QPieModelMapperPrivate &dd, QObject *parent = nullptr);
73
74 Q_DISABLE_COPY_MOVE(QPieModelMapper)
75};
76
77QT_END_NAMESPACE
78
79#endif // QPIEMODELMAPPER_H
80

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qtgraphs/src/graphs2d/piechart/qpiemodelmapper.h