@@ -68,6 +68,30 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
68 | */ |
|
68 | */ | |
69 |
|
69 | |||
70 | /*! |
|
70 | /*! | |
|
71 | \fn void QBarModelMapper::seriesReplaced() | |||
|
72 | ||||
|
73 | Emitted when the series to which mapper is connected to has changed. | |||
|
74 | */ | |||
|
75 | ||||
|
76 | /*! | |||
|
77 | \fn void QBarModelMapper::modelReplaced() | |||
|
78 | ||||
|
79 | Emitted when the model to which mapper is connected to has changed. | |||
|
80 | */ | |||
|
81 | ||||
|
82 | /*! | |||
|
83 | \fn void QBarModelMapper::firstChanged() | |||
|
84 | ||||
|
85 | Emitted when the value for the first has changed. | |||
|
86 | */ | |||
|
87 | ||||
|
88 | /*! | |||
|
89 | \fn void QBarModelMapper::countChanged() | |||
|
90 | ||||
|
91 | Emitted when the value for the count has changed. | |||
|
92 | */ | |||
|
93 | ||||
|
94 | /*! | |||
71 | Constructs a mapper object which is a child of \a parent. |
|
95 | Constructs a mapper object which is a child of \a parent. | |
72 | */ |
|
96 | */ | |
73 | QBarModelMapper::QBarModelMapper(QObject *parent) : |
|
97 | QBarModelMapper::QBarModelMapper(QObject *parent) : | |
@@ -101,6 +125,8 void QBarModelMapper::setModel(QAbstractItemModel *model) | |||||
101 | connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int))); |
|
125 | connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int))); | |
102 | connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int))); |
|
126 | connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int))); | |
103 | connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int))); |
|
127 | connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int))); | |
|
128 | ||||
|
129 | emit modelReplaced(); | |||
104 | } |
|
130 | } | |
105 |
|
131 | |||
106 | QBarSeries* QBarModelMapper::series() const |
|
132 | QBarSeries* QBarModelMapper::series() const | |
@@ -124,6 +150,8 void QBarModelMapper::setSeries(QBarSeries *series) | |||||
124 | // connect the signals from the series |
|
150 | // connect the signals from the series | |
125 | connect(d->m_series, SIGNAL(barsetsAdded(QList<QBarSet*>)), d, SLOT(barSetsAdded(QList<QBarSet*>))); |
|
151 | connect(d->m_series, SIGNAL(barsetsAdded(QList<QBarSet*>)), d, SLOT(barSetsAdded(QList<QBarSet*>))); | |
126 | connect(d->m_series, SIGNAL(barsetsRemoved(QList<QBarSet*>)), d, SLOT(barSetsRemoved(QList<QBarSet*>))); |
|
152 | connect(d->m_series, SIGNAL(barsetsRemoved(QList<QBarSet*>)), d, SLOT(barSetsRemoved(QList<QBarSet*>))); | |
|
153 | ||||
|
154 | emit seriesReplaced(); | |||
127 | } |
|
155 | } | |
128 |
|
156 | |||
129 | int QBarModelMapper::first() const |
|
157 | int QBarModelMapper::first() const | |
@@ -135,8 +163,12 int QBarModelMapper::first() const | |||||
135 | void QBarModelMapper::setFirst(int first) |
|
163 | void QBarModelMapper::setFirst(int first) | |
136 | { |
|
164 | { | |
137 | Q_D(QBarModelMapper); |
|
165 | Q_D(QBarModelMapper); | |
138 | d->m_first = qMax(first, 0); |
|
166 | if (first != d->m_first) { | |
139 | d->initializeBarFromModel(); |
|
167 | d->m_first = qMax(first, 0); | |
|
168 | d->initializeBarFromModel(); | |||
|
169 | ||||
|
170 | emit firstChanged(); | |||
|
171 | } | |||
140 | } |
|
172 | } | |
141 |
|
173 | |||
142 | int QBarModelMapper::count() const |
|
174 | int QBarModelMapper::count() const | |
@@ -148,8 +180,12 int QBarModelMapper::count() const | |||||
148 | void QBarModelMapper::setCount(int count) |
|
180 | void QBarModelMapper::setCount(int count) | |
149 | { |
|
181 | { | |
150 | Q_D(QBarModelMapper); |
|
182 | Q_D(QBarModelMapper); | |
151 | d->m_count = qMax(count, -1); |
|
183 | if (count != d->m_count) { | |
152 | d->initializeBarFromModel(); |
|
184 | d->m_count = qMax(count, -1); | |
|
185 | d->initializeBarFromModel(); | |||
|
186 | ||||
|
187 | emit countChanged(); | |||
|
188 | } | |||
153 | } |
|
189 | } | |
154 |
|
190 | |||
155 | /*! |
|
191 | /*! |
@@ -35,10 +35,10 class QChart; | |||||
35 | class QTCOMMERCIALCHART_EXPORT QBarModelMapper : public QObject |
|
35 | class QTCOMMERCIALCHART_EXPORT QBarModelMapper : public QObject | |
36 | { |
|
36 | { | |
37 | Q_OBJECT |
|
37 | Q_OBJECT | |
38 | Q_PROPERTY(QBarSeries *series READ series WRITE setSeries) |
|
38 | Q_PROPERTY(QBarSeries *series READ series WRITE setSeries NOTIFY seriesReplaced) | |
39 | Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel) |
|
39 | Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced) | |
40 | Q_PROPERTY(int first READ first WRITE setFirst) |
|
40 | Q_PROPERTY(int first READ first WRITE setFirst NOTIFY firstChanged) | |
41 | Q_PROPERTY(int count READ count WRITE setCount) |
|
41 | Q_PROPERTY(int count READ count WRITE setCount NOTIFY countChanged) | |
42 | Q_ENUMS(Qt::Orientation) |
|
42 | Q_ENUMS(Qt::Orientation) | |
43 |
|
43 | |||
44 | protected: |
|
44 | protected: | |
@@ -69,6 +69,12 protected: | |||||
69 | Qt::Orientation orientation() const; |
|
69 | Qt::Orientation orientation() const; | |
70 | void setOrientation(Qt::Orientation orientation); |
|
70 | void setOrientation(Qt::Orientation orientation); | |
71 |
|
71 | |||
|
72 | Q_SIGNALS: | |||
|
73 | void seriesReplaced(); | |||
|
74 | void modelReplaced(); | |||
|
75 | void firstChanged(); | |||
|
76 | void countChanged(); | |||
|
77 | ||||
72 | protected: |
|
78 | protected: | |
73 | QBarModelMapperPrivate * const d_ptr; |
|
79 | QBarModelMapperPrivate * const d_ptr; | |
74 | Q_DECLARE_PRIVATE(QBarModelMapper) |
|
80 | Q_DECLARE_PRIVATE(QBarModelMapper) |
@@ -50,6 +50,18 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
50 | */ |
|
50 | */ | |
51 |
|
51 | |||
52 | /*! |
|
52 | /*! | |
|
53 | \fn void QHBarModelMapper::firstBarSetRowChanged() | |||
|
54 | ||||
|
55 | Emitted when the firstBarSetRow has changed. | |||
|
56 | */ | |||
|
57 | ||||
|
58 | /*! | |||
|
59 | \fn void QHBarModelMapper::lastBarSetRowChanged() | |||
|
60 | ||||
|
61 | Emitted when the lastBarSetRow has changed. | |||
|
62 | */ | |||
|
63 | ||||
|
64 | /*! | |||
53 | Constructs a mapper object which is a child of \a parent. |
|
65 | Constructs a mapper object which is a child of \a parent. | |
54 | */ |
|
66 | */ | |
55 | QHBarModelMapper::QHBarModelMapper(QObject *parent) : |
|
67 | QHBarModelMapper::QHBarModelMapper(QObject *parent) : | |
@@ -65,7 +77,10 int QHBarModelMapper::firstBarSetRow() const | |||||
65 |
|
77 | |||
66 | void QHBarModelMapper::setFirstBarSetRow(int firstBarSetRow) |
|
78 | void QHBarModelMapper::setFirstBarSetRow(int firstBarSetRow) | |
67 | { |
|
79 | { | |
68 | return QBarModelMapper::setFirstBarSetSection(firstBarSetRow); |
|
80 | if (firstBarSetRow != firstBarSetSection()) { | |
|
81 | return QBarModelMapper::setFirstBarSetSection(firstBarSetRow); | |||
|
82 | emit firstBarSetRowChanged(); | |||
|
83 | } | |||
69 | } |
|
84 | } | |
70 |
|
85 | |||
71 | int QHBarModelMapper::lastBarSetRow() const |
|
86 | int QHBarModelMapper::lastBarSetRow() const | |
@@ -75,7 +90,10 int QHBarModelMapper::lastBarSetRow() const | |||||
75 |
|
90 | |||
76 | void QHBarModelMapper::setLastBarSetRow(int lastBarSetRow) |
|
91 | void QHBarModelMapper::setLastBarSetRow(int lastBarSetRow) | |
77 | { |
|
92 | { | |
78 | return QBarModelMapper::setLastBarSetSection(lastBarSetRow); |
|
93 | if (lastBarSetRow != lastBarSetSection()) { | |
|
94 | return QBarModelMapper::setLastBarSetSection(lastBarSetRow); | |||
|
95 | emit lastBarSetRowChanged(); | |||
|
96 | } | |||
79 | } |
|
97 | } | |
80 |
|
98 | |||
81 | #include "moc_qhbarmodelmapper.cpp" |
|
99 | #include "moc_qhbarmodelmapper.cpp" |
@@ -28,8 +28,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
28 | class QTCOMMERCIALCHART_EXPORT QHBarModelMapper : public QBarModelMapper |
|
28 | class QTCOMMERCIALCHART_EXPORT QHBarModelMapper : public QBarModelMapper | |
29 | { |
|
29 | { | |
30 | Q_OBJECT |
|
30 | Q_OBJECT | |
31 | Q_PROPERTY(int firstBarSetRow READ firstBarSetRow WRITE setFirstBarSetRow) |
|
31 | Q_PROPERTY(int firstBarSetRow READ firstBarSetRow WRITE setFirstBarSetRow NOTIFY firstBarSetRowChanged) | |
32 | Q_PROPERTY(int lastBarSetRow READ lastBarSetRow WRITE setLastBarSetRow) |
|
32 | Q_PROPERTY(int lastBarSetRow READ lastBarSetRow WRITE setLastBarSetRow NOTIFY lastBarSetRowChanged) | |
33 |
|
33 | |||
34 | public: |
|
34 | public: | |
35 | explicit QHBarModelMapper(QObject *parent = 0); |
|
35 | explicit QHBarModelMapper(QObject *parent = 0); | |
@@ -39,6 +39,10 public: | |||||
39 |
|
39 | |||
40 | int lastBarSetRow() const; |
|
40 | int lastBarSetRow() const; | |
41 | void setLastBarSetRow(int lastBarSetRow); |
|
41 | void setLastBarSetRow(int lastBarSetRow); | |
|
42 | ||||
|
43 | Q_SIGNALS: | |||
|
44 | void firstBarSetRowChanged(); | |||
|
45 | void lastBarSetRowChanged(); | |||
42 | }; |
|
46 | }; | |
43 |
|
47 | |||
44 | QTCOMMERCIALCHART_END_NAMESPACE |
|
48 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -50,6 +50,18 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
50 | */ |
|
50 | */ | |
51 |
|
51 | |||
52 | /*! |
|
52 | /*! | |
|
53 | \fn void QVBarModelMapper::firstBarSetColumnChanged() | |||
|
54 | ||||
|
55 | Emitted when the firstBarSetColumn has changed. | |||
|
56 | */ | |||
|
57 | ||||
|
58 | /*! | |||
|
59 | \fn void QVBarModelMapper::lastBarSetColumnChanged() | |||
|
60 | ||||
|
61 | Emitted when the lastBarSetColumn has changed. | |||
|
62 | */ | |||
|
63 | ||||
|
64 | /*! | |||
53 | Constructs a mapper object which is a child of \a parent. |
|
65 | Constructs a mapper object which is a child of \a parent. | |
54 | */ |
|
66 | */ | |
55 | QVBarModelMapper::QVBarModelMapper(QObject *parent) : |
|
67 | QVBarModelMapper::QVBarModelMapper(QObject *parent) : | |
@@ -65,7 +77,10 int QVBarModelMapper::firstBarSetColumn() const | |||||
65 |
|
77 | |||
66 | void QVBarModelMapper::setFirstBarSetColumn(int firstBarSetColumn) |
|
78 | void QVBarModelMapper::setFirstBarSetColumn(int firstBarSetColumn) | |
67 | { |
|
79 | { | |
68 | return QBarModelMapper::setFirstBarSetSection(firstBarSetColumn); |
|
80 | if (firstBarSetColumn != firstBarSetSection()) { | |
|
81 | return QBarModelMapper::setFirstBarSetSection(firstBarSetColumn); | |||
|
82 | emit firstBarSetColumnChanged(); | |||
|
83 | } | |||
69 | } |
|
84 | } | |
70 |
|
85 | |||
71 | int QVBarModelMapper::lastBarSetColumn() const |
|
86 | int QVBarModelMapper::lastBarSetColumn() const | |
@@ -75,7 +90,10 int QVBarModelMapper::lastBarSetColumn() const | |||||
75 |
|
90 | |||
76 | void QVBarModelMapper::setLastBarSetColumn(int lastBarSetColumn) |
|
91 | void QVBarModelMapper::setLastBarSetColumn(int lastBarSetColumn) | |
77 | { |
|
92 | { | |
78 | return QBarModelMapper::setLastBarSetSection(lastBarSetColumn); |
|
93 | if (lastBarSetColumn != lastBarSetSection()) { | |
|
94 | return QBarModelMapper::setLastBarSetSection(lastBarSetColumn); | |||
|
95 | emit lastBarSetColumnChanged(); | |||
|
96 | } | |||
79 | } |
|
97 | } | |
80 |
|
98 | |||
81 | #include "moc_qvbarmodelmapper.cpp" |
|
99 | #include "moc_qvbarmodelmapper.cpp" |
@@ -28,8 +28,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
28 | class QTCOMMERCIALCHART_EXPORT QVBarModelMapper : public QBarModelMapper |
|
28 | class QTCOMMERCIALCHART_EXPORT QVBarModelMapper : public QBarModelMapper | |
29 | { |
|
29 | { | |
30 | Q_OBJECT |
|
30 | Q_OBJECT | |
31 | Q_PROPERTY(int firstBarSetColumn READ firstBarSetColumn WRITE setFirstBarSetColumn) |
|
31 | Q_PROPERTY(int firstBarSetColumn READ firstBarSetColumn WRITE setFirstBarSetColumn NOTIFY firstBarSetColumnChanged) | |
32 | Q_PROPERTY(int lastBarSetColumn READ lastBarSetColumn WRITE setLastBarSetColumn) |
|
32 | Q_PROPERTY(int lastBarSetColumn READ lastBarSetColumn WRITE setLastBarSetColumn NOTIFY lastBarSetColumnChanged) | |
33 |
|
33 | |||
34 | public: |
|
34 | public: | |
35 | explicit QVBarModelMapper(QObject *parent = 0); |
|
35 | explicit QVBarModelMapper(QObject *parent = 0); | |
@@ -39,6 +39,10 public: | |||||
39 |
|
39 | |||
40 | int lastBarSetColumn() const; |
|
40 | int lastBarSetColumn() const; | |
41 | void setLastBarSetColumn(int lastBarSetColumn); |
|
41 | void setLastBarSetColumn(int lastBarSetColumn); | |
|
42 | ||||
|
43 | Q_SIGNALS: | |||
|
44 | void firstBarSetColumnChanged(); | |||
|
45 | void lastBarSetColumnChanged(); | |||
42 | }; |
|
46 | }; | |
43 |
|
47 | |||
44 | QTCOMMERCIALCHART_END_NAMESPACE |
|
48 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now