##// END OF EJS Templates
Added NOTIFY to PieModelMapper class properties
Marek Rosa -
r1474:99b2f41bb95e
parent child
Show More
@@ -70,7 +70,10 int QHPieModelMapper::valuesRow() const
70 70 */
71 71 void QHPieModelMapper::setValuesRow(int valuesRow)
72 72 {
73 if (valuesRow != valuesSection()) {
73 74 QPieModelMapper::setValuesSection(valuesRow);
75 emit valuesRowChanged();
76 }
74 77 }
75 78
76 79 /*!
@@ -87,7 +90,10 int QHPieModelMapper::labelsRow() const
87 90 */
88 91 void QHPieModelMapper::setLabelsRow(int labelsRow)
89 92 {
93 if (labelsRow != labelsSection()) {
90 94 QPieModelMapper::setLabelsSection(labelsRow);
95 emit labelsRowChanged();
96 }
91 97 }
92 98
93 99 #include "moc_qhpiemodelmapper.cpp"
@@ -28,8 +28,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 28 class QTCOMMERCIALCHART_EXPORT QHPieModelMapper : public QPieModelMapper
29 29 {
30 30 Q_OBJECT
31 Q_PROPERTY(int valuesRow READ valuesRow WRITE setValuesRow)
32 Q_PROPERTY(int labelsRow READ labelsRow WRITE setLabelsRow)
31 Q_PROPERTY(int valuesRow READ valuesRow WRITE setValuesRow NOTIFY valuesRowChanged)
32 Q_PROPERTY(int labelsRow READ labelsRow WRITE setLabelsRow NOTIFY labelsRowChanged)
33 33
34 34 public:
35 35 explicit QHPieModelMapper(QObject *parent = 0);
@@ -39,6 +39,10 public:
39 39
40 40 int labelsRow() const;
41 41 void setLabelsRow(int labelsRow);
42
43 Q_SIGNALS:
44 void valuesRowChanged();
45 void labelsRowChanged();
42 46 };
43 47
44 48 QTCOMMERCIALCHART_END_NAMESPACE
@@ -97,6 +97,8 void QPieModelMapper::setModel(QAbstractItemModel *model)
97 97 connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
98 98 connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
99 99 connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
100
101 emit modelReplaced();
100 102 }
101 103
102 104 QPieSeries* QPieModelMapper::series() const
@@ -120,6 +122,8 void QPieModelMapper::setSeries(QPieSeries *series)
120 122 // connect the signals from the series
121 123 connect(d->m_series, SIGNAL(added(QList<QPieSlice*>)), d, SLOT(slicesAdded(QList<QPieSlice*>)));
122 124 connect(d->m_series, SIGNAL(removed(QList<QPieSlice*>)), d, SLOT(slicesRemoved(QList<QPieSlice*>)));
125
126 emit seriesReplaced();
123 127 }
124 128
125 129 int QPieModelMapper::first() const
@@ -131,8 +135,12 int QPieModelMapper::first() const
131 135 void QPieModelMapper::setFirst(int first)
132 136 {
133 137 Q_D(QPieModelMapper);
138 if (first != d->m_first) {
134 139 d->m_first = qMax(first, 0);
135 140 d->initializePieFromModel();
141
142 emit firstChanged();
143 }
136 144 }
137 145
138 146 int QPieModelMapper::count() const
@@ -144,8 +152,12 int QPieModelMapper::count() const
144 152 void QPieModelMapper::setCount(int count)
145 153 {
146 154 Q_D(QPieModelMapper);
155 if (count != d->m_count) {
147 156 d->m_count = qMax(count, -1);
148 157 d->initializePieFromModel();
158
159 emit countChanged();
160 }
149 161 }
150 162
151 163 /*!
@@ -34,10 +34,10 class QPieSeries;
34 34 class QTCOMMERCIALCHART_EXPORT QPieModelMapper : public QObject
35 35 {
36 36 Q_OBJECT
37 Q_PROPERTY(QPieSeries *series READ series WRITE setSeries)
38 Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel)
39 Q_PROPERTY(int first READ first WRITE setFirst)
40 Q_PROPERTY(int count READ count WRITE setCount)
37 Q_PROPERTY(QPieSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
38 Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
39 Q_PROPERTY(int first READ first WRITE setFirst NOTIFY firstChanged)
40 Q_PROPERTY(int count READ count WRITE setCount NOTIFY countChanged)
41 41 Q_ENUMS(Qt::Orientation)
42 42
43 43 protected:
@@ -68,6 +68,12 protected:
68 68 Qt::Orientation orientation() const;
69 69 void setOrientation(Qt::Orientation orientation);
70 70
71 Q_SIGNALS:
72 void seriesReplaced();
73 void modelReplaced();
74 void firstChanged();
75 void countChanged();
76
71 77 protected:
72 78 QPieModelMapperPrivate * const d_ptr;
73 79 Q_DECLARE_PRIVATE(QPieModelMapper)
@@ -70,7 +70,10 int QVPieModelMapper::valuesColumn() const
70 70 */
71 71 void QVPieModelMapper::setValuesColumn(int valuesColumn)
72 72 {
73 if (valuesColumn != valuesSection()) {
73 74 QPieModelMapper::setValuesSection(valuesColumn);
75 emit valuesColumnChanged();
76 }
74 77 }
75 78
76 79 /*!
@@ -87,7 +90,10 int QVPieModelMapper::labelsColumn() const
87 90 */
88 91 void QVPieModelMapper::setLabelsColumn(int labelsColumn)
89 92 {
93 if (labelsColumn != labelsSection()) {
90 94 QPieModelMapper::setLabelsSection(labelsColumn);
95 emit labelsColumnChanged();
96 }
91 97 }
92 98
93 99 #include "moc_qvpiemodelmapper.cpp"
@@ -28,8 +28,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 28 class QTCOMMERCIALCHART_EXPORT QVPieModelMapper : public QPieModelMapper
29 29 {
30 30 Q_OBJECT
31 Q_PROPERTY(int valuesColumn READ valuesColumn WRITE setValuesColumn)
32 Q_PROPERTY(int labelsColumn READ labelsColumn WRITE setLabelsColumn)
31 Q_PROPERTY(int valuesColumn READ valuesColumn WRITE setValuesColumn NOTIFY valuesColumnChanged)
32 Q_PROPERTY(int labelsColumn READ labelsColumn WRITE setLabelsColumn NOTIFY labelsColumnChanged)
33 33
34 34 public:
35 35 explicit QVPieModelMapper(QObject *parent = 0);
@@ -39,6 +39,10 public:
39 39
40 40 int labelsColumn() const;
41 41 void setLabelsColumn(int labelsColumn);
42
43 Q_SIGNALS:
44 void valuesColumnChanged();
45 void labelsColumnChanged();
42 46 };
43 47
44 48 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now