##// END OF EJS Templates
Added NOTIFY to XYModelMapper properties
Marek Rosa -
r1477:6fa77806900a
parent child
Show More
@@ -47,6 +47,18 QTCOMMERCIALCHART_BEGIN_NAMESPACE
47 */
47 */
48
48
49 /*!
49 /*!
50 \fn void QHXYModelMapper::xRowChanged()
51
52 Emitted when the xRow has changed.
53 */
54
55 /*!
56 \fn void QHXYModelMapper::yRowChanged()
57
58 Emitted when the yRow has changed.
59 */
60
61 /*!
50 Constructs a mapper object which is a child of \a parent.
62 Constructs a mapper object which is a child of \a parent.
51 */
63 */
52 QHXYModelMapper::QHXYModelMapper(QObject *parent) :
64 QHXYModelMapper::QHXYModelMapper(QObject *parent) :
@@ -62,7 +74,10 int QHXYModelMapper::xRow() const
62
74
63 void QHXYModelMapper::setXRow(int xRow)
75 void QHXYModelMapper::setXRow(int xRow)
64 {
76 {
77 if (xRow != xSection()) {
65 return QXYModelMapper::setXSection(xRow);
78 return QXYModelMapper::setXSection(xRow);
79 emit xRowChanged();
80 }
66 }
81 }
67
82
68 int QHXYModelMapper::yRow() const
83 int QHXYModelMapper::yRow() const
@@ -72,7 +87,10 int QHXYModelMapper::yRow() const
72
87
73 void QHXYModelMapper::setYRow(int yRow)
88 void QHXYModelMapper::setYRow(int yRow)
74 {
89 {
90 if (yRow != ySection()) {
75 return QXYModelMapper::setYSection(yRow);
91 return QXYModelMapper::setYSection(yRow);
92 emit yRowChanged();
93 }
76 }
94 }
77
95
78 #include "moc_qhxymodelmapper.cpp"
96 #include "moc_qhxymodelmapper.cpp"
@@ -28,8 +28,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 class QTCOMMERCIALCHART_EXPORT QHXYModelMapper : public QXYModelMapper
28 class QTCOMMERCIALCHART_EXPORT QHXYModelMapper : public QXYModelMapper
29 {
29 {
30 Q_OBJECT
30 Q_OBJECT
31 Q_PROPERTY(int xRow READ xRow WRITE setXRow)
31 Q_PROPERTY(int xRow READ xRow WRITE setXRow NOTIFY xRowChanged)
32 Q_PROPERTY(int yRow READ yRow WRITE setYRow)
32 Q_PROPERTY(int yRow READ yRow WRITE setYRow NOTIFY yRowChanged)
33
33
34 public:
34 public:
35 explicit QHXYModelMapper(QObject *parent = 0);
35 explicit QHXYModelMapper(QObject *parent = 0);
@@ -39,6 +39,10 public:
39
39
40 int yRow() const;
40 int yRow() const;
41 void setYRow(int yRow);
41 void setYRow(int yRow);
42
43 Q_SIGNALS:
44 void xRowChanged();
45 void yRowChanged();
42 };
46 };
43
47
44 QTCOMMERCIALCHART_END_NAMESPACE
48 QTCOMMERCIALCHART_END_NAMESPACE
@@ -48,6 +48,18 QTCOMMERCIALCHART_BEGIN_NAMESPACE
48 */
48 */
49
49
50 /*!
50 /*!
51 \fn void QVXYModelMapper::xColumnChanged()
52
53 Emitted when the xColumn has changed.
54 */
55
56 /*!
57 \fn void QVXYModelMapper::yColumnChanged()
58
59 Emitted when the yColumn has changed.
60 */
61
62 /*!
51 Constructs a mapper object which is a child of \a parent.
63 Constructs a mapper object which is a child of \a parent.
52 */
64 */
53 QVXYModelMapper::QVXYModelMapper(QObject *parent) :
65 QVXYModelMapper::QVXYModelMapper(QObject *parent) :
@@ -63,7 +75,10 int QVXYModelMapper::xColumn() const
63
75
64 void QVXYModelMapper::setXColumn(int xColumn)
76 void QVXYModelMapper::setXColumn(int xColumn)
65 {
77 {
78 if (xColumn != xSection()) {
66 return QXYModelMapper::setXSection(xColumn);
79 return QXYModelMapper::setXSection(xColumn);
80 emit xColumnChanged();
81 }
67 }
82 }
68
83
69 int QVXYModelMapper::yColumn() const
84 int QVXYModelMapper::yColumn() const
@@ -73,7 +88,10 int QVXYModelMapper::yColumn() const
73
88
74 void QVXYModelMapper::setYColumn(int yColumn)
89 void QVXYModelMapper::setYColumn(int yColumn)
75 {
90 {
91 if (yColumn != ySection()) {
76 return QXYModelMapper::setYSection(yColumn);
92 return QXYModelMapper::setYSection(yColumn);
93 emit yColumnChanged();
94 }
77 }
95 }
78
96
79 #include "moc_qvxymodelmapper.cpp"
97 #include "moc_qvxymodelmapper.cpp"
@@ -28,8 +28,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 class QTCOMMERCIALCHART_EXPORT QVXYModelMapper : public QXYModelMapper
28 class QTCOMMERCIALCHART_EXPORT QVXYModelMapper : public QXYModelMapper
29 {
29 {
30 Q_OBJECT
30 Q_OBJECT
31 Q_PROPERTY(int xColumn READ xColumn WRITE setXColumn)
31 Q_PROPERTY(int xColumn READ xColumn WRITE setXColumn NOTIFY xColumnChanged)
32 Q_PROPERTY(int yColumn READ yColumn WRITE setYColumn)
32 Q_PROPERTY(int yColumn READ yColumn WRITE setYColumn NOTIFY yColumnChanged)
33
33
34 public:
34 public:
35 explicit QVXYModelMapper(QObject *parent = 0);
35 explicit QVXYModelMapper(QObject *parent = 0);
@@ -39,6 +39,10 public:
39
39
40 int yColumn() const;
40 int yColumn() const;
41 void setYColumn(int yColumn);
41 void setYColumn(int yColumn);
42
43 Q_SIGNALS:
44 void xColumnChanged();
45 void yColumnChanged();
42 };
46 };
43
47
44 QTCOMMERCIALCHART_END_NAMESPACE
48 QTCOMMERCIALCHART_END_NAMESPACE
@@ -64,6 +64,30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
64 */
64 */
65
65
66 /*!
66 /*!
67 \fn void QXYModelMapper::seriesReplaced()
68
69 Emitted when the series to which mapper is connected to has changed.
70 */
71
72 /*!
73 \fn void QXYModelMapper::modelReplaced()
74
75 Emitted when the model to which mapper is connected to has changed.
76 */
77
78 /*!
79 \fn void QXYModelMapper::firstChanged()
80
81 Emitted when the value for the first has changed.
82 */
83
84 /*!
85 \fn void QXYModelMapper::countChanged()
86
87 Emitted when the value for the count has changed.
88 */
89
90 /*!
67 Constructs a mapper object which is a child of \a parent.
91 Constructs a mapper object which is a child of \a parent.
68 */
92 */
69 QXYModelMapper::QXYModelMapper(QObject *parent):
93 QXYModelMapper::QXYModelMapper(QObject *parent):
@@ -96,6 +120,8 void QXYModelMapper::setModel(QAbstractItemModel *model)
96 connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
120 connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
97 connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
121 connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
98 connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
122 connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
123
124 emit modelReplaced();
99 }
125 }
100
126
101 QXYSeries* QXYModelMapper::series() const
127 QXYSeries* QXYModelMapper::series() const
@@ -120,6 +146,8 void QXYModelMapper::setSeries(QXYSeries *series)
120 connect(d->m_series, SIGNAL(pointAdded(int)), d, SLOT(handlePointAdded(int)));
146 connect(d->m_series, SIGNAL(pointAdded(int)), d, SLOT(handlePointAdded(int)));
121 connect(d->m_series, SIGNAL(pointRemoved(int)), d, SLOT(handlePointRemoved(int)));
147 connect(d->m_series, SIGNAL(pointRemoved(int)), d, SLOT(handlePointRemoved(int)));
122 connect(d->m_series, SIGNAL(pointReplaced(int)), d, SLOT(handlePointReplaced(int)));
148 connect(d->m_series, SIGNAL(pointReplaced(int)), d, SLOT(handlePointReplaced(int)));
149
150 emit seriesReplaced();
123 }
151 }
124
152
125 int QXYModelMapper::first() const
153 int QXYModelMapper::first() const
@@ -131,8 +159,12 int QXYModelMapper::first() const
131 void QXYModelMapper::setFirst(int first)
159 void QXYModelMapper::setFirst(int first)
132 {
160 {
133 Q_D(QXYModelMapper);
161 Q_D(QXYModelMapper);
162 if (first != d->m_first) {
134 d->m_first = qMax(first, 0);
163 d->m_first = qMax(first, 0);
135 d->initializeXYFromModel();
164 d->initializeXYFromModel();
165
166 emit firstChanged();
167 }
136 }
168 }
137
169
138 int QXYModelMapper::count() const
170 int QXYModelMapper::count() const
@@ -144,8 +176,12 int QXYModelMapper::count() const
144 void QXYModelMapper::setCount(int count)
176 void QXYModelMapper::setCount(int count)
145 {
177 {
146 Q_D(QXYModelMapper);
178 Q_D(QXYModelMapper);
179 if (count != d->m_count) {
147 d->m_count = qMax(count, -1);
180 d->m_count = qMax(count, -1);
148 d->initializeXYFromModel();
181 d->initializeXYFromModel();
182
183 emit countChanged();
184 }
149 }
185 }
150
186
151 /*!
187 /*!
@@ -34,10 +34,10 class QXYSeries;
34 class QTCOMMERCIALCHART_EXPORT QXYModelMapper : public QObject
34 class QTCOMMERCIALCHART_EXPORT QXYModelMapper : public QObject
35 {
35 {
36 Q_OBJECT
36 Q_OBJECT
37 Q_PROPERTY(QXYSeries *series READ series WRITE setSeries)
37 Q_PROPERTY(QXYSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
38 Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel)
38 Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
39 Q_PROPERTY(int first READ first WRITE setFirst)
39 Q_PROPERTY(int first READ first WRITE setFirst NOTIFY firstChanged)
40 Q_PROPERTY(int count READ count WRITE setCount)
40 Q_PROPERTY(int count READ count WRITE setCount NOTIFY countChanged)
41 Q_ENUMS(Qt::Orientation)
41 Q_ENUMS(Qt::Orientation)
42
42
43 protected:
43 protected:
@@ -68,6 +68,12 protected:
68 int ySection() const;
68 int ySection() const;
69 void setYSection(int ySection);
69 void setYSection(int ySection);
70
70
71 Q_SIGNALS:
72 void seriesReplaced();
73 void modelReplaced();
74 void firstChanged();
75 void countChanged();
76
71 protected:
77 protected:
72 QXYModelMapperPrivate * const d_ptr;
78 QXYModelMapperPrivate * const d_ptr;
73 Q_DECLARE_PRIVATE(QXYModelMapper)
79 Q_DECLARE_PRIVATE(QXYModelMapper)
General Comments 0
You need to be logged in to leave comments. Login now