@@ -76,7 +76,6 | |||||
76 | <ul> |
|
76 | <ul> | |
77 | <li><a href="qpieseries.html">QPieSeries</a></li> |
|
77 | <li><a href="qpieseries.html">QPieSeries</a></li> | |
78 | <li><a href="qpieslice.html">QPieSlice</a></li> |
|
78 | <li><a href="qpieslice.html">QPieSlice</a></li> | |
79 | <li><a href="qpiemodelmapper.html">QPieModelMapper</a></li> |
|
|||
80 | <li><a href="qhpiemodelmapper.html">QHPieModelMapper</a></li> |
|
79 | <li><a href="qhpiemodelmapper.html">QHPieModelMapper</a></li> | |
81 | <li><a href="qvpiemodelmapper.html">QVPieModelMapper</a></li> |
|
80 | <li><a href="qvpiemodelmapper.html">QVPieModelMapper</a></li> | |
82 | </ul> |
|
81 | </ul> |
@@ -24,7 +24,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
24 |
|
24 | |||
25 | /*! |
|
25 | /*! | |
26 | \class QHPieModelMapper |
|
26 | \class QHPieModelMapper | |
27 | \brief part of QtCommercial chart API. |
|
|||
28 | \mainclass |
|
27 | \mainclass | |
29 |
|
28 | |||
30 | Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series. |
|
29 | Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series. | |
@@ -34,6 +33,19 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
34 | */ |
|
33 | */ | |
35 |
|
34 | |||
36 | /*! |
|
35 | /*! | |
|
36 | \property QHPieModelMapper::series | |||
|
37 | \brief Defines the QPieSeries object that is used by the mapper. | |||
|
38 | ||||
|
39 | All the data in the series is discarded when it is set to the mapper. | |||
|
40 | When new series is specified the old series is disconnected (it preserves its data) | |||
|
41 | */ | |||
|
42 | ||||
|
43 | /*! | |||
|
44 | \property QHPieModelMapper::model | |||
|
45 | \brief Defines the model that is used by the mapper. | |||
|
46 | */ | |||
|
47 | ||||
|
48 | /*! | |||
37 | \property QHPieModelMapper::valuesRow |
|
49 | \property QHPieModelMapper::valuesRow | |
38 | \brief Defines which row of the model is kept in sync with the values of the pie's slices |
|
50 | \brief Defines which row of the model is kept in sync with the values of the pie's slices | |
39 |
|
51 | |||
@@ -70,6 +82,18 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
70 | */ |
|
82 | */ | |
71 |
|
83 | |||
72 | /*! |
|
84 | /*! | |
|
85 | \fn void QHPieModelMapper::seriesReplaced() | |||
|
86 | ||||
|
87 | Emitted when the series to which mapper is connected to has changed. | |||
|
88 | */ | |||
|
89 | ||||
|
90 | /*! | |||
|
91 | \fn void QHPieModelMapper::modelReplaced() | |||
|
92 | ||||
|
93 | Emitted when the model to which mapper is connected to has changed. | |||
|
94 | */ | |||
|
95 | ||||
|
96 | /*! | |||
73 | \fn void QHPieModelMapper::valuesRowChanged() |
|
97 | \fn void QHPieModelMapper::valuesRowChanged() | |
74 |
|
98 | |||
75 | Emitted when the valuesRow has changed. |
|
99 | Emitted when the valuesRow has changed. | |
@@ -100,6 +124,32 QHPieModelMapper::QHPieModelMapper(QObject *parent) : | |||||
100 | setOrientation(Qt::Horizontal); |
|
124 | setOrientation(Qt::Horizontal); | |
101 | } |
|
125 | } | |
102 |
|
126 | |||
|
127 | QAbstractItemModel* QHPieModelMapper::model() const | |||
|
128 | { | |||
|
129 | return QPieModelMapper::model(); | |||
|
130 | } | |||
|
131 | ||||
|
132 | void QHPieModelMapper::setModel(QAbstractItemModel *model) | |||
|
133 | { | |||
|
134 | if (model != QPieModelMapper::model()) { | |||
|
135 | QPieModelMapper::setModel(model); | |||
|
136 | emit modelReplaced(); | |||
|
137 | } | |||
|
138 | } | |||
|
139 | ||||
|
140 | QPieSeries* QHPieModelMapper::series() const | |||
|
141 | { | |||
|
142 | return QPieModelMapper::series(); | |||
|
143 | } | |||
|
144 | ||||
|
145 | void QHPieModelMapper::setSeries(QPieSeries *series) | |||
|
146 | { | |||
|
147 | if (series != QPieModelMapper::series()) { | |||
|
148 | QPieModelMapper::setSeries(series); | |||
|
149 | emit seriesReplaced(); | |||
|
150 | } | |||
|
151 | } | |||
|
152 | ||||
103 | /*! |
|
153 | /*! | |
104 | Returns which row of the model is kept in sync with the values of the pie's slices |
|
154 | Returns which row of the model is kept in sync with the values of the pie's slices | |
105 | */ |
|
155 | */ |
@@ -28,6 +28,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
28 | class QTCOMMERCIALCHART_EXPORT QHPieModelMapper : public QPieModelMapper |
|
28 | class QTCOMMERCIALCHART_EXPORT QHPieModelMapper : public QPieModelMapper | |
29 | { |
|
29 | { | |
30 | Q_OBJECT |
|
30 | Q_OBJECT | |
|
31 | Q_PROPERTY(QPieSeries *series READ series WRITE setSeries NOTIFY seriesReplaced) | |||
|
32 | Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced) | |||
31 | Q_PROPERTY(int valuesRow READ valuesRow WRITE setValuesRow NOTIFY valuesRowChanged) |
|
33 | Q_PROPERTY(int valuesRow READ valuesRow WRITE setValuesRow NOTIFY valuesRowChanged) | |
32 | Q_PROPERTY(int labelsRow READ labelsRow WRITE setLabelsRow NOTIFY labelsRowChanged) |
|
34 | Q_PROPERTY(int labelsRow READ labelsRow WRITE setLabelsRow NOTIFY labelsRowChanged) | |
33 | Q_PROPERTY(int firstColumn READ firstColumn WRITE setFirstColumn NOTIFY firstColumnChanged) |
|
35 | Q_PROPERTY(int firstColumn READ firstColumn WRITE setFirstColumn NOTIFY firstColumnChanged) | |
@@ -36,6 +38,12 class QTCOMMERCIALCHART_EXPORT QHPieModelMapper : public QPieModelMapper | |||||
36 | public: |
|
38 | public: | |
37 | explicit QHPieModelMapper(QObject *parent = 0); |
|
39 | explicit QHPieModelMapper(QObject *parent = 0); | |
38 |
|
40 | |||
|
41 | QAbstractItemModel* model() const; | |||
|
42 | void setModel(QAbstractItemModel *model); | |||
|
43 | ||||
|
44 | QPieSeries* series() const; | |||
|
45 | void setSeries(QPieSeries *series); | |||
|
46 | ||||
39 | int valuesRow() const; |
|
47 | int valuesRow() const; | |
40 | void setValuesRow(int valuesRow); |
|
48 | void setValuesRow(int valuesRow); | |
41 |
|
49 | |||
@@ -49,6 +57,8 public: | |||||
49 | void setColumnCount(int columnCount); |
|
57 | void setColumnCount(int columnCount); | |
50 |
|
58 | |||
51 | Q_SIGNALS: |
|
59 | Q_SIGNALS: | |
|
60 | void seriesReplaced(); | |||
|
61 | void modelReplaced(); | |||
52 | void valuesRowChanged(); |
|
62 | void valuesRowChanged(); | |
53 | void labelsRowChanged(); |
|
63 | void labelsRowChanged(); | |
54 | void firstColumnChanged(); |
|
64 | void firstColumnChanged(); |
@@ -26,45 +26,6 | |||||
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
28 | |||
29 | /*! |
|
|||
30 | \class QPieModelMapper |
|
|||
31 | \brief part of QtCommercial chart API. |
|
|||
32 | \mainclass |
|
|||
33 |
|
||||
34 | Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series. |
|
|||
35 | The instance of this class cannot be created directly. QHPieModelMapper of QVPieModelMapper should be used instead. This class is used to create a connection between QPieSeries and QAbstractItemModel derived model object. |
|
|||
36 | It is possible to use both QAbstractItemModel and QPieSeries model API. QPieModelMapper makes sure that Pie and the model are kept in sync. |
|
|||
37 | NOTE: used model has to support adding/removing rows/columns and modifying the data of the cells. |
|
|||
38 | */ |
|
|||
39 |
|
||||
40 | /*! |
|
|||
41 | \property QPieModelMapper::series |
|
|||
42 | \brief Defines the QPieSeries object that is used by the mapper. |
|
|||
43 |
|
||||
44 | All the data in the series is discarded when it is set to the mapper. |
|
|||
45 | When new series is specified the old series is disconnected (it preserves its data) |
|
|||
46 | */ |
|
|||
47 |
|
||||
48 | /*! |
|
|||
49 | \property QPieModelMapper::model |
|
|||
50 | \brief Defines the model that is used by the mapper. |
|
|||
51 | */ |
|
|||
52 |
|
||||
53 | /*! |
|
|||
54 | \fn void QPieModelMapper::seriesReplaced() |
|
|||
55 |
|
||||
56 | Emitted when the series to which mapper is connected to has changed. |
|
|||
57 | */ |
|
|||
58 |
|
||||
59 | /*! |
|
|||
60 | \fn void QPieModelMapper::modelReplaced() |
|
|||
61 |
|
||||
62 | Emitted when the model to which mapper is connected to has changed. |
|
|||
63 | */ |
|
|||
64 |
|
||||
65 | /*! |
|
|||
66 | Constructs a mapper object which is a child of \a parent. |
|
|||
67 | */ |
|
|||
68 | QPieModelMapper::QPieModelMapper(QObject *parent) : |
|
29 | QPieModelMapper::QPieModelMapper(QObject *parent) : | |
69 | QObject(parent), |
|
30 | QObject(parent), | |
70 | d_ptr(new QPieModelMapperPrivate(this)) |
|
31 | d_ptr(new QPieModelMapperPrivate(this)) | |
@@ -95,8 +56,6 void QPieModelMapper::setModel(QAbstractItemModel *model) | |||||
95 | connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int))); |
|
56 | connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int))); | |
96 | connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int))); |
|
57 | connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int))); | |
97 | connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int))); |
|
58 | connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int))); | |
98 |
|
||||
99 | emit modelReplaced(); |
|
|||
100 | } |
|
59 | } | |
101 |
|
60 | |||
102 | QPieSeries* QPieModelMapper::series() const |
|
61 | QPieSeries* QPieModelMapper::series() const | |
@@ -120,8 +79,6 void QPieModelMapper::setSeries(QPieSeries *series) | |||||
120 | // connect the signals from the series |
|
79 | // connect the signals from the series | |
121 | connect(d->m_series, SIGNAL(added(QList<QPieSlice*>)), d, SLOT(slicesAdded(QList<QPieSlice*>))); |
|
80 | connect(d->m_series, SIGNAL(added(QList<QPieSlice*>)), d, SLOT(slicesAdded(QList<QPieSlice*>))); | |
122 | connect(d->m_series, SIGNAL(removed(QList<QPieSlice*>)), d, SLOT(slicesRemoved(QList<QPieSlice*>))); |
|
81 | connect(d->m_series, SIGNAL(removed(QList<QPieSlice*>)), d, SLOT(slicesRemoved(QList<QPieSlice*>))); | |
123 |
|
||||
124 | emit seriesReplaced(); |
|
|||
125 | } |
|
82 | } | |
126 |
|
83 | |||
127 | /*! |
|
84 | /*! | |
@@ -229,19 +186,6 void QPieModelMapper::setLabelsSection(int labelsSection) | |||||
229 | d->initializePieFromModel(); |
|
186 | d->initializePieFromModel(); | |
230 | } |
|
187 | } | |
231 |
|
188 | |||
232 | /*! |
|
|||
233 | Resets the QPieModelMapper to the default state. |
|
|||
234 | first: 0; count: -1; valuesSection: -1; labelsSection: -1; |
|
|||
235 | */ |
|
|||
236 | void QPieModelMapper::reset() |
|
|||
237 | { |
|
|||
238 | Q_D(QPieModelMapper); |
|
|||
239 | d->m_first = 0; |
|
|||
240 | d->m_count = -1; |
|
|||
241 | d->m_valuesSection = -1; |
|
|||
242 | d->m_labelsSection = -1; |
|
|||
243 | } |
|
|||
244 |
|
||||
245 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
189 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
246 |
|
190 | |||
247 | QPieModelMapperPrivate::QPieModelMapperPrivate(QPieModelMapper *q) : |
|
191 | QPieModelMapperPrivate::QPieModelMapperPrivate(QPieModelMapper *q) : |
@@ -34,23 +34,16 class QPieSeries; | |||||
34 | class QTCOMMERCIALCHART_EXPORT QPieModelMapper : public QObject |
|
34 | class QTCOMMERCIALCHART_EXPORT QPieModelMapper : public QObject | |
35 | { |
|
35 | { | |
36 | Q_OBJECT |
|
36 | Q_OBJECT | |
37 | Q_PROPERTY(QPieSeries *series READ series WRITE setSeries NOTIFY seriesReplaced) |
|
|||
38 | Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced) |
|
|||
39 | Q_ENUMS(Qt::Orientation) |
|
|||
40 |
|
37 | |||
41 | protected: |
|
38 | protected: | |
42 | QPieModelMapper(QObject *parent = 0); |
|
39 | QPieModelMapper(QObject *parent = 0); | |
43 |
|
40 | |||
44 | public: |
|
|||
45 | QAbstractItemModel* model() const; |
|
41 | QAbstractItemModel* model() const; | |
46 | void setModel(QAbstractItemModel *model); |
|
42 | void setModel(QAbstractItemModel *model); | |
47 |
|
43 | |||
48 | QPieSeries* series() const; |
|
44 | QPieSeries* series() const; | |
49 | void setSeries(QPieSeries *series); |
|
45 | void setSeries(QPieSeries *series); | |
50 |
|
46 | |||
51 | void reset(); |
|
|||
52 |
|
||||
53 | protected: |
|
|||
54 | int first() const; |
|
47 | int first() const; | |
55 | void setFirst(int first); |
|
48 | void setFirst(int first); | |
56 |
|
49 | |||
@@ -66,10 +59,6 protected: | |||||
66 | Qt::Orientation orientation() const; |
|
59 | Qt::Orientation orientation() const; | |
67 | void setOrientation(Qt::Orientation orientation); |
|
60 | void setOrientation(Qt::Orientation orientation); | |
68 |
|
61 | |||
69 | Q_SIGNALS: |
|
|||
70 | void seriesReplaced(); |
|
|||
71 | void modelReplaced(); |
|
|||
72 |
|
||||
73 | protected: |
|
62 | protected: | |
74 | QPieModelMapperPrivate * const d_ptr; |
|
63 | QPieModelMapperPrivate * const d_ptr; | |
75 | Q_DECLARE_PRIVATE(QPieModelMapper) |
|
64 | Q_DECLARE_PRIVATE(QPieModelMapper) |
@@ -24,7 +24,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
24 |
|
24 | |||
25 | /*! |
|
25 | /*! | |
26 | \class QVPieModelMapper |
|
26 | \class QVPieModelMapper | |
27 | \brief part of QtCommercial chart API. |
|
|||
28 | \mainclass |
|
27 | \mainclass | |
29 |
|
28 | |||
30 | Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series. |
|
29 | Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series. | |
@@ -34,6 +33,19 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
34 | */ |
|
33 | */ | |
35 |
|
34 | |||
36 | /*! |
|
35 | /*! | |
|
36 | \property QVPieModelMapper::series | |||
|
37 | \brief Defines the QPieSeries object that is used by the mapper. | |||
|
38 | ||||
|
39 | All the data in the series is discarded when it is set to the mapper. | |||
|
40 | When new series is specified the old series is disconnected (it preserves its data) | |||
|
41 | */ | |||
|
42 | ||||
|
43 | /*! | |||
|
44 | \property QVPieModelMapper::model | |||
|
45 | \brief Defines the model that is used by the mapper. | |||
|
46 | */ | |||
|
47 | ||||
|
48 | /*! | |||
37 | \property QVPieModelMapper::valuesColumn |
|
49 | \property QVPieModelMapper::valuesColumn | |
38 | \brief Defines which column of the model is kept in sync with the values of the pie's slices |
|
50 | \brief Defines which column of the model is kept in sync with the values of the pie's slices | |
39 |
|
51 | |||
@@ -70,6 +82,18 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
70 | */ |
|
82 | */ | |
71 |
|
83 | |||
72 | /*! |
|
84 | /*! | |
|
85 | \fn void QVPieModelMapper::seriesReplaced() | |||
|
86 | ||||
|
87 | Emitted when the series to which mapper is connected to has changed. | |||
|
88 | */ | |||
|
89 | ||||
|
90 | /*! | |||
|
91 | \fn void QVPieModelMapper::modelReplaced() | |||
|
92 | ||||
|
93 | Emitted when the model to which mapper is connected to has changed. | |||
|
94 | */ | |||
|
95 | ||||
|
96 | /*! | |||
73 | \fn void QVPieModelMapper::valuesColumnChanged() |
|
97 | \fn void QVPieModelMapper::valuesColumnChanged() | |
74 |
|
98 | |||
75 | Emitted when the valuesColumn has changed. |
|
99 | Emitted when the valuesColumn has changed. | |
@@ -100,6 +124,32 QVPieModelMapper::QVPieModelMapper(QObject *parent) : | |||||
100 | QPieModelMapper::setOrientation(Qt::Vertical); |
|
124 | QPieModelMapper::setOrientation(Qt::Vertical); | |
101 | } |
|
125 | } | |
102 |
|
126 | |||
|
127 | QAbstractItemModel* QVPieModelMapper::model() const | |||
|
128 | { | |||
|
129 | return QPieModelMapper::model(); | |||
|
130 | } | |||
|
131 | ||||
|
132 | void QVPieModelMapper::setModel(QAbstractItemModel *model) | |||
|
133 | { | |||
|
134 | if (model != QPieModelMapper::model()) { | |||
|
135 | QPieModelMapper::setModel(model); | |||
|
136 | emit modelReplaced(); | |||
|
137 | } | |||
|
138 | } | |||
|
139 | ||||
|
140 | QPieSeries* QVPieModelMapper::series() const | |||
|
141 | { | |||
|
142 | return QPieModelMapper::series(); | |||
|
143 | } | |||
|
144 | ||||
|
145 | void QVPieModelMapper::setSeries(QPieSeries *series) | |||
|
146 | { | |||
|
147 | if (series != QPieModelMapper::series()) { | |||
|
148 | QPieModelMapper::setSeries(series); | |||
|
149 | emit seriesReplaced(); | |||
|
150 | } | |||
|
151 | } | |||
|
152 | ||||
103 | /*! |
|
153 | /*! | |
104 | Returns which column of the model is kept in sync with the values of the pie's slices |
|
154 | Returns which column of the model is kept in sync with the values of the pie's slices | |
105 | */ |
|
155 | */ |
@@ -28,6 +28,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
28 | class QTCOMMERCIALCHART_EXPORT QVPieModelMapper : public QPieModelMapper |
|
28 | class QTCOMMERCIALCHART_EXPORT QVPieModelMapper : public QPieModelMapper | |
29 | { |
|
29 | { | |
30 | Q_OBJECT |
|
30 | Q_OBJECT | |
|
31 | Q_PROPERTY(QPieSeries *series READ series WRITE setSeries NOTIFY seriesReplaced) | |||
|
32 | Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced) | |||
31 | Q_PROPERTY(int valuesColumn READ valuesColumn WRITE setValuesColumn NOTIFY valuesColumnChanged) |
|
33 | Q_PROPERTY(int valuesColumn READ valuesColumn WRITE setValuesColumn NOTIFY valuesColumnChanged) | |
32 | Q_PROPERTY(int labelsColumn READ labelsColumn WRITE setLabelsColumn NOTIFY labelsColumnChanged) |
|
34 | Q_PROPERTY(int labelsColumn READ labelsColumn WRITE setLabelsColumn NOTIFY labelsColumnChanged) | |
33 | Q_PROPERTY(int firstRow READ firstRow WRITE setFirstRow NOTIFY firstRowChanged) |
|
35 | Q_PROPERTY(int firstRow READ firstRow WRITE setFirstRow NOTIFY firstRowChanged) | |
@@ -36,6 +38,12 class QTCOMMERCIALCHART_EXPORT QVPieModelMapper : public QPieModelMapper | |||||
36 | public: |
|
38 | public: | |
37 | explicit QVPieModelMapper(QObject *parent = 0); |
|
39 | explicit QVPieModelMapper(QObject *parent = 0); | |
38 |
|
40 | |||
|
41 | QAbstractItemModel* model() const; | |||
|
42 | void setModel(QAbstractItemModel *model); | |||
|
43 | ||||
|
44 | QPieSeries* series() const; | |||
|
45 | void setSeries(QPieSeries *series); | |||
|
46 | ||||
39 | int valuesColumn() const; |
|
47 | int valuesColumn() const; | |
40 | void setValuesColumn(int valuesColumn); |
|
48 | void setValuesColumn(int valuesColumn); | |
41 |
|
49 | |||
@@ -49,6 +57,8 public: | |||||
49 | void setRowCount(int rowCount); |
|
57 | void setRowCount(int rowCount); | |
50 |
|
58 | |||
51 | Q_SIGNALS: |
|
59 | Q_SIGNALS: | |
|
60 | void seriesReplaced(); | |||
|
61 | void modelReplaced(); | |||
52 | void valuesColumnChanged(); |
|
62 | void valuesColumnChanged(); | |
53 | void labelsColumnChanged(); |
|
63 | void labelsColumnChanged(); | |
54 | void firstRowChanged(); |
|
64 | void firstRowChanged(); |
General Comments 0
You need to be logged in to leave comments.
Login now