1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | // W A R N I N G |
5 | // ------------- |
6 | // |
7 | // This file is not part of the Qt Chart API. It exists purely as an |
8 | // implementation detail. This header file may change from version to |
9 | // version without notice, or even be removed. |
10 | // |
11 | // We mean it. |
12 | |
13 | #ifndef QBARMODELMAPPER_P_H |
14 | #define QBARMODELMAPPER_P_H |
15 | |
16 | #include <QtCore/QObject> |
17 | #include <QtCharts/QBarModelMapper> |
18 | #include <QtCharts/private/qchartglobal_p.h> |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | class QModelIndex; |
22 | QT_END_NAMESPACE |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | class QBarSet; |
27 | |
28 | class Q_CHARTS_PRIVATE_EXPORT QBarModelMapperPrivate : public QObject |
29 | { |
30 | Q_OBJECT |
31 | public: |
32 | explicit QBarModelMapperPrivate(QBarModelMapper *q); |
33 | |
34 | public Q_SLOTS: |
35 | // for the model |
36 | void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight); |
37 | void (Qt::Orientation orientation, int first, int last); |
38 | void modelRowsAdded(QModelIndex parent, int start, int end); |
39 | void modelRowsRemoved(QModelIndex parent, int start, int end); |
40 | void modelColumnsAdded(QModelIndex parent, int start, int end); |
41 | void modelColumnsRemoved(QModelIndex parent, int start, int end); |
42 | void handleModelDestroyed(); |
43 | |
44 | // for the series |
45 | void barSetsAdded(const QList<QBarSet *> &sets); |
46 | void barSetsRemoved(const QList<QBarSet *> &sets); |
47 | void valuesAdded(int index, int count); |
48 | void valuesRemoved(int index, int count); |
49 | void barLabelChanged(); |
50 | void barValueChanged(int index); |
51 | void handleSeriesDestroyed(); |
52 | |
53 | void initializeBarFromModel(); |
54 | |
55 | private: |
56 | QBarSet *barSet(QModelIndex index); |
57 | QModelIndex barModelIndex(int barSection, int posInBar); |
58 | void insertData(int start, int end); |
59 | void removeData(int start, int end); |
60 | void blockModelSignals(bool block = true); |
61 | void blockSeriesSignals(bool block = true); |
62 | |
63 | private: |
64 | QAbstractBarSeries *m_series; |
65 | QList<QBarSet *> m_barSets; |
66 | QAbstractItemModel *m_model; |
67 | int m_first; |
68 | int m_count; |
69 | Qt::Orientation m_orientation; |
70 | int m_firstBarSetSection; |
71 | int m_lastBarSetSection; |
72 | bool m_seriesSignalsBlock; |
73 | bool m_modelSignalsBlock; |
74 | |
75 | private: |
76 | QBarModelMapper *q_ptr; |
77 | Q_DECLARE_PUBLIC(QBarModelMapper) |
78 | }; |
79 | |
80 | QT_END_NAMESPACE |
81 | |
82 | #endif // QBARMODELMAPPER_P_H |
83 | |