@@ -1,70 +1,69 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #ifndef QBARMODELMAPPER_H |
|
22 | 22 | #define QBARMODELMAPPER_H |
|
23 | 23 | |
|
24 | 24 | #include "qchartglobal.h" |
|
25 | 25 | #include <QObject> |
|
26 | 26 | |
|
27 | 27 | class QAbstractItemModel; |
|
28 | 28 | |
|
29 | 29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 30 | |
|
31 | 31 | class QBarModelMapperPrivate; |
|
32 | 32 | class QAbstractBarSeries; |
|
33 | class QChart; | |
|
34 | 33 | |
|
35 | 34 | class QTCOMMERCIALCHART_EXPORT QBarModelMapper : public QObject |
|
36 | 35 | { |
|
37 | 36 | Q_OBJECT |
|
38 | 37 | |
|
39 | 38 | protected: |
|
40 | 39 | explicit QBarModelMapper(QObject *parent = 0); |
|
41 | 40 | |
|
42 | 41 | QAbstractItemModel* model() const; |
|
43 | 42 | void setModel(QAbstractItemModel *model); |
|
44 | 43 | |
|
45 | 44 | QAbstractBarSeries* series() const; |
|
46 | 45 | void setSeries(QAbstractBarSeries *series); |
|
47 | 46 | |
|
48 | 47 | int first() const; |
|
49 | 48 | void setFirst(int first); |
|
50 | 49 | |
|
51 | 50 | int count() const; |
|
52 | 51 | void setCount(int count); |
|
53 | 52 | |
|
54 | 53 | int firstBarSetSection() const; |
|
55 | 54 | void setFirstBarSetSection(int firstBarSetSection); |
|
56 | 55 | |
|
57 | 56 | int lastBarSetSection() const; |
|
58 | 57 | void setLastBarSetSection(int lastBarSetSection); |
|
59 | 58 | |
|
60 | 59 | Qt::Orientation orientation() const; |
|
61 | 60 | void setOrientation(Qt::Orientation orientation); |
|
62 | 61 | |
|
63 | 62 | protected: |
|
64 | 63 | QBarModelMapperPrivate * const d_ptr; |
|
65 | 64 | Q_DECLARE_PRIVATE(QBarModelMapper) |
|
66 | 65 | }; |
|
67 | 66 | |
|
68 | 67 | QTCOMMERCIALCHART_END_NAMESPACE |
|
69 | 68 | |
|
70 | 69 | #endif // QBARMODELMAPPER_H |
@@ -1,97 +1,96 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | // W A R N I N G |
|
22 | 22 | // ------------- |
|
23 | 23 | // |
|
24 | 24 | // This file is not part of the QtCommercial Chart API. It exists purely as an |
|
25 | 25 | // implementation detail. This header file may change from version to |
|
26 | 26 | // version without notice, or even be removed. |
|
27 | 27 | // |
|
28 | 28 | // We mean it. |
|
29 | 29 | |
|
30 | 30 | #ifndef QBARMODELMAPPER_P_H |
|
31 | 31 | #define QBARMODELMAPPER_P_H |
|
32 | 32 | |
|
33 | #include "qchartglobal.h" | |
|
34 | 33 | #include <QObject> |
|
35 | 34 | #include "qbarmodelmapper.h" |
|
36 | 35 | |
|
37 | 36 | class QModelIndex; |
|
38 | 37 | |
|
39 | 38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
40 | 39 | |
|
41 | 40 | class QBarSet; |
|
42 | 41 | |
|
43 | 42 | class QBarModelMapperPrivate : public QObject |
|
44 | 43 | { |
|
45 | 44 | Q_OBJECT |
|
46 | 45 | public: |
|
47 | 46 | explicit QBarModelMapperPrivate(QBarModelMapper *q); |
|
48 | 47 | |
|
49 | 48 | public Q_SLOTS: |
|
50 | 49 | // for the model |
|
51 | 50 | void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight); |
|
52 | 51 | void modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last); |
|
53 | 52 | void modelRowsAdded(QModelIndex parent, int start, int end); |
|
54 | 53 | void modelRowsRemoved(QModelIndex parent, int start, int end); |
|
55 | 54 | void modelColumnsAdded(QModelIndex parent, int start, int end); |
|
56 | 55 | void modelColumnsRemoved(QModelIndex parent, int start, int end); |
|
57 | 56 | void handleModelDestroyed(); |
|
58 | 57 | |
|
59 | 58 | // for the series |
|
60 | 59 | void barSetsAdded(QList<QBarSet*> sets); |
|
61 | 60 | void barSetsRemoved(QList<QBarSet*> sets); |
|
62 | 61 | void valuesAdded(int index, int count); |
|
63 | 62 | void valuesRemoved(int index, int count); |
|
64 | 63 | void barLabelChanged(); |
|
65 | 64 | void barValueChanged(int index); |
|
66 | 65 | void handleSeriesDestroyed(); |
|
67 | 66 | |
|
68 | 67 | void initializeBarFromModel(); |
|
69 | 68 | |
|
70 | 69 | private: |
|
71 | 70 | QBarSet* barSet(QModelIndex index); |
|
72 | 71 | QModelIndex barModelIndex(int barSection, int posInBar); |
|
73 | 72 | void insertData(int start, int end); |
|
74 | 73 | void removeData(int start, int end); |
|
75 | 74 | void blockModelSignals(bool block = true); |
|
76 | 75 | void blockSeriesSignals(bool block = true); |
|
77 | 76 | |
|
78 | 77 | private: |
|
79 | 78 | QAbstractBarSeries *m_series; |
|
80 | 79 | QList<QBarSet*> m_barSets; |
|
81 | 80 | QAbstractItemModel *m_model; |
|
82 | 81 | int m_first; |
|
83 | 82 | int m_count; |
|
84 | 83 | Qt::Orientation m_orientation; |
|
85 | 84 | int m_firstBarSetSection; |
|
86 | 85 | int m_lastBarSetSection; |
|
87 | 86 | bool m_seriesSignalsBlock; |
|
88 | 87 | bool m_modelSignalsBlock; |
|
89 | 88 | |
|
90 | 89 | private: |
|
91 | 90 | QBarModelMapper *q_ptr; |
|
92 | 91 | Q_DECLARE_PUBLIC(QBarModelMapper) |
|
93 | 92 | }; |
|
94 | 93 | |
|
95 | 94 | QTCOMMERCIALCHART_END_NAMESPACE |
|
96 | 95 | |
|
97 | 96 | #endif // QBARMODELMAPPER_P_H |
@@ -1,69 +1,69 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #ifndef QPIEMODELMAPPER_H |
|
22 | 22 | #define QPIEMODELMAPPER_H |
|
23 | 23 | |
|
24 | 24 | #include "qchartglobal.h" |
|
25 | 25 | #include <QObject> |
|
26 | 26 | |
|
27 | 27 | class QAbstractItemModel; |
|
28 | 28 | |
|
29 | 29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 30 | |
|
31 | 31 | class QPieModelMapperPrivate; |
|
32 | 32 | class QPieSeries; |
|
33 | 33 | |
|
34 | 34 | class QTCOMMERCIALCHART_EXPORT QPieModelMapper : public QObject |
|
35 | 35 | { |
|
36 | 36 | Q_OBJECT |
|
37 | 37 | |
|
38 | 38 | protected: |
|
39 | QPieModelMapper(QObject *parent = 0); | |
|
39 | explicit QPieModelMapper(QObject *parent = 0); | |
|
40 | 40 | |
|
41 | 41 | QAbstractItemModel* model() const; |
|
42 | 42 | void setModel(QAbstractItemModel *model); |
|
43 | 43 | |
|
44 | 44 | QPieSeries* series() const; |
|
45 | 45 | void setSeries(QPieSeries *series); |
|
46 | 46 | |
|
47 | 47 | int first() const; |
|
48 | 48 | void setFirst(int first); |
|
49 | 49 | |
|
50 | 50 | int count() const; |
|
51 | 51 | void setCount(int count); |
|
52 | 52 | |
|
53 | 53 | int valuesSection() const; |
|
54 | 54 | void setValuesSection(int valuesSection); |
|
55 | 55 | |
|
56 | 56 | int labelsSection() const; |
|
57 | 57 | void setLabelsSection(int labelsSection); |
|
58 | 58 | |
|
59 | 59 | Qt::Orientation orientation() const; |
|
60 | 60 | void setOrientation(Qt::Orientation orientation); |
|
61 | 61 | |
|
62 | 62 | protected: |
|
63 | 63 | QPieModelMapperPrivate * const d_ptr; |
|
64 | 64 | Q_DECLARE_PRIVATE(QPieModelMapper) |
|
65 | 65 | }; |
|
66 | 66 | |
|
67 | 67 | QTCOMMERCIALCHART_END_NAMESPACE |
|
68 | 68 | |
|
69 | 69 | #endif // QPIEMODELMAPPER_H |
@@ -1,103 +1,99 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | // W A R N I N G |
|
22 | 22 | // ------------- |
|
23 | 23 | // |
|
24 | 24 | // This file is not part of the QtCommercial Chart API. It exists purely as an |
|
25 | 25 | // implementation detail. This header file may change from version to |
|
26 | 26 | // version without notice, or even be removed. |
|
27 | 27 | // |
|
28 | 28 | // We mean it. |
|
29 | 29 | |
|
30 | 30 | #ifndef QPIEMODELMAPPER_P_H |
|
31 | 31 | #define QPIEMODELMAPPER_P_H |
|
32 | 32 | |
|
33 | #include "qpiemodelmapper.h" | |
|
34 | 33 | #include <QObject> |
|
34 | #include "qpiemodelmapper.h" | |
|
35 | 35 | |
|
36 | 36 | class QModelIndex; |
|
37 | class QAbstractItemModel; | |
|
38 | 37 | |
|
39 | 38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
40 | 39 | |
|
41 | class QPieModelMapper; | |
|
42 | class QPieSeries; | |
|
43 | 40 | class QPieSlice; |
|
44 | 41 | |
|
45 | 42 | class QPieModelMapperPrivate : public QObject |
|
46 | 43 | { |
|
47 | 44 | Q_OBJECT |
|
48 | 45 | |
|
49 | 46 | public: |
|
50 | QPieModelMapperPrivate(QPieModelMapper *q); | |
|
47 | explicit QPieModelMapperPrivate(QPieModelMapper *q); | |
|
51 | 48 | |
|
52 | 49 | public Q_SLOTS: |
|
53 | 50 | // for the model |
|
54 | 51 | void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight); |
|
55 | 52 | void modelRowsAdded(QModelIndex parent, int start, int end); |
|
56 | 53 | void modelRowsRemoved(QModelIndex parent, int start, int end); |
|
57 | 54 | void modelColumnsAdded(QModelIndex parent, int start, int end); |
|
58 | 55 | void modelColumnsRemoved(QModelIndex parent, int start, int end); |
|
59 | 56 | void handleModelDestroyed(); |
|
60 | 57 | |
|
61 | 58 | // for the series |
|
62 | 59 | void slicesAdded(QList<QPieSlice*> slices); |
|
63 | 60 | void slicesRemoved(QList<QPieSlice*> slices); |
|
64 | 61 | void sliceLabelChanged(); |
|
65 | 62 | void sliceValueChanged(); |
|
66 | 63 | void handleSeriesDestroyed(); |
|
67 | 64 | |
|
68 | 65 | void initializePieFromModel(); |
|
69 | 66 | |
|
70 | 67 | private: |
|
71 | 68 | QPieSlice* pieSlice(QModelIndex index) const; |
|
72 | 69 | bool isLabelIndex(QModelIndex index) const; |
|
73 | 70 | bool isValueIndex(QModelIndex index) const; |
|
74 | 71 | QModelIndex valueModelIndex(int slicePos); |
|
75 | 72 | QModelIndex labelModelIndex(int slicePos); |
|
76 | 73 | void insertData(int start, int end); |
|
77 | 74 | void removeData(int start, int end); |
|
78 | 75 | |
|
79 | 76 | void blockModelSignals(bool block = true); |
|
80 | 77 | void blockSeriesSignals(bool block = true); |
|
81 | 78 | |
|
82 | 79 | private: |
|
83 | 80 | QPieSeries *m_series; |
|
84 | 81 | QList<QPieSlice*> m_slices; |
|
85 | 82 | QAbstractItemModel *m_model; |
|
86 | 83 | int m_first; |
|
87 | 84 | int m_count; |
|
88 | 85 | Qt::Orientation m_orientation; |
|
89 | 86 | int m_valuesSection; |
|
90 | 87 | int m_labelsSection; |
|
91 | 88 | bool m_seriesSignalsBlock; |
|
92 | 89 | bool m_modelSignalsBlock; |
|
93 | 90 | |
|
94 | 91 | private: |
|
95 | 92 | |
|
96 | 93 | QPieModelMapper *q_ptr; |
|
97 | 94 | Q_DECLARE_PUBLIC(QPieModelMapper) |
|
98 | friend class QPieSeriesPrivate; | |
|
99 | 95 | }; |
|
100 | 96 | |
|
101 | 97 | QTCOMMERCIALCHART_END_NAMESPACE |
|
102 | 98 | |
|
103 | 99 | #endif // QPIEMODELMAPPER_P_H |
General Comments 0
You need to be logged in to leave comments.
Login now