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