@@ -65,8 +65,8 TableWidget::TableWidget(QWidget *parent) | |||||
65 | QVBarModelMapper *mapper = new QVBarModelMapper(this); |
|
65 | QVBarModelMapper *mapper = new QVBarModelMapper(this); | |
66 | mapper->setFirstBarSetColumn(1); |
|
66 | mapper->setFirstBarSetColumn(1); | |
67 | mapper->setLastBarSetColumn(4); |
|
67 | mapper->setLastBarSetColumn(4); | |
68 | mapper->setFirst(first); |
|
68 | mapper->setFirstRow(first); | |
69 | mapper->setCount(count); |
|
69 | mapper->setRowCount(count); | |
70 | mapper->setSeries(series); |
|
70 | mapper->setSeries(series); | |
71 | mapper->setModel(model); |
|
71 | mapper->setModel(model); | |
72 | chart->addSeries(series); |
|
72 | chart->addSeries(series); |
@@ -71,28 +71,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
71 | */ |
|
71 | */ | |
72 |
|
72 | |||
73 | /*! |
|
73 | /*! | |
74 | \property QBarModelMapper::first |
|
|||
75 | \brief Defines which item of the model's row/column should be mapped as the value of the first QBarSet in the series. |
|
|||
76 | Minimal and default value is: 0 |
|
|||
77 | */ |
|
|||
78 | /*! |
|
|||
79 | \qmlproperty int BarModelMapper::first |
|
|||
80 | Defines which item of the model's row/column should be mapped as the value of the first QBarSet in the series. |
|
|||
81 | The default value is 0. |
|
|||
82 | */ |
|
|||
83 |
|
||||
84 | /*! |
|
|||
85 | \property QBarModelMapper::count |
|
|||
86 | \brief Defines the number of rows/columns of the model that are mapped as the data for QBarSeries |
|
|||
87 | Minimal and default value is: -1 (count limited by the number of rows/columns in the model) |
|
|||
88 | */ |
|
|||
89 | /*! |
|
|||
90 | \qmlproperty int BarModelMapper::count |
|
|||
91 | Defines the number of rows/columns of the model that are mapped as the data for QBarSeries. The default value is |
|
|||
92 | -1 (count limited by the number of rows/columns in the model) |
|
|||
93 | */ |
|
|||
94 |
|
||||
95 | /*! |
|
|||
96 | \fn void QBarModelMapper::seriesReplaced() |
|
74 | \fn void QBarModelMapper::seriesReplaced() | |
97 | Emitted when the series to which mapper is connected to has changed. |
|
75 | Emitted when the series to which mapper is connected to has changed. | |
98 | */ |
|
76 | */ | |
@@ -103,16 +81,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
103 | */ |
|
81 | */ | |
104 |
|
82 | |||
105 | /*! |
|
83 | /*! | |
106 | \fn void QBarModelMapper::firstChanged() |
|
|||
107 | Emitted when the value for the first has changed. |
|
|||
108 | */ |
|
|||
109 |
|
||||
110 | /*! |
|
|||
111 | \fn void QBarModelMapper::countChanged() |
|
|||
112 | Emitted when the value for the count has changed. |
|
|||
113 | */ |
|
|||
114 |
|
||||
115 | /*! |
|
|||
116 | Constructs a mapper object which is a child of \a parent. |
|
84 | Constructs a mapper object which is a child of \a parent. | |
117 | */ |
|
85 | */ | |
118 | QBarModelMapper::QBarModelMapper(QObject *parent) : |
|
86 | QBarModelMapper::QBarModelMapper(QObject *parent) : | |
@@ -175,38 +143,46 void QBarModelMapper::setSeries(QBarSeries *series) | |||||
175 | emit seriesReplaced(); |
|
143 | emit seriesReplaced(); | |
176 | } |
|
144 | } | |
177 |
|
145 | |||
|
146 | /*! | |||
|
147 | Returns which row/column of the model contains the first values of the QBarSets in the series. | |||
|
148 | The default value is 0. | |||
|
149 | */ | |||
178 | int QBarModelMapper::first() const |
|
150 | int QBarModelMapper::first() const | |
179 | { |
|
151 | { | |
180 | Q_D(const QBarModelMapper); |
|
152 | Q_D(const QBarModelMapper); | |
181 | return d->m_first; |
|
153 | return d->m_first; | |
182 | } |
|
154 | } | |
183 |
|
155 | |||
|
156 | /*! | |||
|
157 | Sets which row of the model contains the \a first values of the QBarSets in the series. | |||
|
158 | The default value is 0. | |||
|
159 | */ | |||
184 | void QBarModelMapper::setFirst(int first) |
|
160 | void QBarModelMapper::setFirst(int first) | |
185 | { |
|
161 | { | |
186 | Q_D(QBarModelMapper); |
|
162 | Q_D(QBarModelMapper); | |
187 | if (first != d->m_first) { |
|
|||
188 |
|
|
163 | d->m_first = qMax(first, 0); | |
189 |
|
|
164 | d->initializeBarFromModel(); | |
190 |
|
||||
191 | emit firstChanged(); |
|
|||
192 | } |
|
|||
193 | } |
|
165 | } | |
194 |
|
166 | |||
|
167 | /*! | |||
|
168 | Returns the number of rows/columns of the model that are mapped as the data for QBarSeries | |||
|
169 | Minimal and default value is: -1 (count limited by the number of rows/columns in the model) | |||
|
170 | */ | |||
195 | int QBarModelMapper::count() const |
|
171 | int QBarModelMapper::count() const | |
196 | { |
|
172 | { | |
197 | Q_D(const QBarModelMapper); |
|
173 | Q_D(const QBarModelMapper); | |
198 | return d->m_count; |
|
174 | return d->m_count; | |
199 | } |
|
175 | } | |
200 |
|
176 | |||
|
177 | /*! | |||
|
178 | Sets the \a count of rows/columns of the model that are mapped as the data for QBarSeries | |||
|
179 | Minimal and default value is: -1 (count limited by the number of rows/columns in the model) | |||
|
180 | */ | |||
201 | void QBarModelMapper::setCount(int count) |
|
181 | void QBarModelMapper::setCount(int count) | |
202 | { |
|
182 | { | |
203 | Q_D(QBarModelMapper); |
|
183 | Q_D(QBarModelMapper); | |
204 | if (count != d->m_count) { |
|
|||
205 |
|
|
184 | d->m_count = qMax(count, -1); | |
206 |
|
|
185 | d->initializeBarFromModel(); | |
207 |
|
||||
208 | emit countChanged(); |
|
|||
209 | } |
|
|||
210 | } |
|
186 | } | |
211 |
|
187 | |||
212 | /*! |
|
188 | /*! |
@@ -37,8 +37,6 class QTCOMMERCIALCHART_EXPORT QBarModelMapper : public QObject | |||||
37 | Q_OBJECT |
|
37 | Q_OBJECT | |
38 | Q_PROPERTY(QBarSeries *series READ series WRITE setSeries NOTIFY seriesReplaced) |
|
38 | Q_PROPERTY(QBarSeries *series READ series WRITE setSeries NOTIFY seriesReplaced) | |
39 | Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced) |
|
39 | Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced) | |
40 | Q_PROPERTY(int first READ first WRITE setFirst NOTIFY firstChanged) |
|
|||
41 | Q_PROPERTY(int count READ count WRITE setCount NOTIFY countChanged) |
|
|||
42 | Q_ENUMS(Qt::Orientation) |
|
40 | Q_ENUMS(Qt::Orientation) | |
43 |
|
41 | |||
44 | protected: |
|
42 | protected: | |
@@ -51,15 +49,15 public: | |||||
51 | QBarSeries* series() const; |
|
49 | QBarSeries* series() const; | |
52 | void setSeries(QBarSeries *series); |
|
50 | void setSeries(QBarSeries *series); | |
53 |
|
51 | |||
|
52 | void reset(); | |||
|
53 | ||||
|
54 | protected: | |||
54 | int first() const; |
|
55 | int first() const; | |
55 | void setFirst(int first); |
|
56 | void setFirst(int first); | |
56 |
|
57 | |||
57 | int count() const; |
|
58 | int count() const; | |
58 | void setCount(int count); |
|
59 | void setCount(int count); | |
59 |
|
60 | |||
60 | void reset(); |
|
|||
61 |
|
||||
62 | protected: |
|
|||
63 | int firstBarSetSection() const; |
|
61 | int firstBarSetSection() const; | |
64 | void setFirstBarSetSection(int firstBarSetSection); |
|
62 | void setFirstBarSetSection(int firstBarSetSection); | |
65 |
|
63 | |||
@@ -72,8 +70,6 protected: | |||||
72 | Q_SIGNALS: |
|
70 | Q_SIGNALS: | |
73 | void seriesReplaced(); |
|
71 | void seriesReplaced(); | |
74 | void modelReplaced(); |
|
72 | void modelReplaced(); | |
75 | void firstChanged(); |
|
|||
76 | void countChanged(); |
|
|||
77 |
|
73 | |||
78 | protected: |
|
74 | protected: | |
79 | QBarModelMapperPrivate * const d_ptr; |
|
75 | QBarModelMapperPrivate * const d_ptr; |
@@ -69,6 +69,28 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
69 | */ |
|
69 | */ | |
70 |
|
70 | |||
71 | /*! |
|
71 | /*! | |
|
72 | \property QHBarModelMapper::firstColumn | |||
|
73 | \brief Defines which column of the model contains the first values of the QBarSets in the series. | |||
|
74 | Minimal and default value is: 0 | |||
|
75 | */ | |||
|
76 | /*! | |||
|
77 | \qmlproperty int BarModelMapper::first | |||
|
78 | Defines which column of the model contains the first values of the QBarSets in the series. | |||
|
79 | The default value is 0. | |||
|
80 | */ | |||
|
81 | ||||
|
82 | /*! | |||
|
83 | \property QHBarModelMapper::columnCount | |||
|
84 | \brief Defines the number of rows of the model that are mapped as the data for QBarSeries | |||
|
85 | Minimal and default value is: -1 (count limited by the number of rows in the model) | |||
|
86 | */ | |||
|
87 | /*! | |||
|
88 | \qmlproperty int BarModelMapper::count | |||
|
89 | Defines the number of rows of the model that are mapped as the data for QBarSeries. The default value is | |||
|
90 | -1 (count limited by the number of rows in the model) | |||
|
91 | */ | |||
|
92 | ||||
|
93 | /*! | |||
72 | \fn void QHBarModelMapper::firstBarSetRowChanged() |
|
94 | \fn void QHBarModelMapper::firstBarSetRowChanged() | |
73 |
|
95 | |||
74 | Emitted when the firstBarSetRow has changed. |
|
96 | Emitted when the firstBarSetRow has changed. | |
@@ -81,6 +103,16 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
81 | */ |
|
103 | */ | |
82 |
|
104 | |||
83 | /*! |
|
105 | /*! | |
|
106 | \fn void QHBarModelMapper::firstColumnChanged() | |||
|
107 | Emitted when the firstColumn has changed. | |||
|
108 | */ | |||
|
109 | ||||
|
110 | /*! | |||
|
111 | \fn void QHBarModelMapper::columnCountChanged() | |||
|
112 | Emitted when the columnCount has changed. | |||
|
113 | */ | |||
|
114 | ||||
|
115 | /*! | |||
84 | Constructs a mapper object which is a child of \a parent. |
|
116 | Constructs a mapper object which is a child of \a parent. | |
85 | */ |
|
117 | */ | |
86 | QHBarModelMapper::QHBarModelMapper(QObject *parent) : |
|
118 | QHBarModelMapper::QHBarModelMapper(QObject *parent) : | |
@@ -97,7 +129,7 int QHBarModelMapper::firstBarSetRow() const | |||||
97 | void QHBarModelMapper::setFirstBarSetRow(int firstBarSetRow) |
|
129 | void QHBarModelMapper::setFirstBarSetRow(int firstBarSetRow) | |
98 | { |
|
130 | { | |
99 | if (firstBarSetRow != firstBarSetSection()) { |
|
131 | if (firstBarSetRow != firstBarSetSection()) { | |
100 |
|
|
132 | QBarModelMapper::setFirstBarSetSection(firstBarSetRow); | |
101 | emit firstBarSetRowChanged(); |
|
133 | emit firstBarSetRowChanged(); | |
102 | } |
|
134 | } | |
103 | } |
|
135 | } | |
@@ -110,11 +142,37 int QHBarModelMapper::lastBarSetRow() const | |||||
110 | void QHBarModelMapper::setLastBarSetRow(int lastBarSetRow) |
|
142 | void QHBarModelMapper::setLastBarSetRow(int lastBarSetRow) | |
111 | { |
|
143 | { | |
112 | if (lastBarSetRow != lastBarSetSection()) { |
|
144 | if (lastBarSetRow != lastBarSetSection()) { | |
113 |
|
|
145 | QBarModelMapper::setLastBarSetSection(lastBarSetRow); | |
114 | emit lastBarSetRowChanged(); |
|
146 | emit lastBarSetRowChanged(); | |
115 | } |
|
147 | } | |
116 | } |
|
148 | } | |
117 |
|
149 | |||
|
150 | int QHBarModelMapper::firstColumn() const | |||
|
151 | { | |||
|
152 | return QBarModelMapper::first(); | |||
|
153 | } | |||
|
154 | ||||
|
155 | void QHBarModelMapper::setFirstColumn(int firstColumn) | |||
|
156 | { | |||
|
157 | if (firstColumn != first()) { | |||
|
158 | QBarModelMapper::setFirst(firstColumn); | |||
|
159 | emit firstColumnChanged(); | |||
|
160 | } | |||
|
161 | } | |||
|
162 | ||||
|
163 | int QHBarModelMapper::columnCount() const | |||
|
164 | { | |||
|
165 | return QBarModelMapper::count(); | |||
|
166 | } | |||
|
167 | ||||
|
168 | void QHBarModelMapper::setColumnCount(int columnCount) | |||
|
169 | { | |||
|
170 | if (columnCount != count()) { | |||
|
171 | QBarModelMapper::setCount(columnCount); | |||
|
172 | emit firstColumnChanged(); | |||
|
173 | } | |||
|
174 | } | |||
|
175 | ||||
118 | #include "moc_qhbarmodelmapper.cpp" |
|
176 | #include "moc_qhbarmodelmapper.cpp" | |
119 |
|
177 | |||
120 | QTCOMMERCIALCHART_END_NAMESPACE |
|
178 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -30,6 +30,8 class QTCOMMERCIALCHART_EXPORT QHBarModelMapper : public QBarModelMapper | |||||
30 | Q_OBJECT |
|
30 | Q_OBJECT | |
31 | Q_PROPERTY(int firstBarSetRow READ firstBarSetRow WRITE setFirstBarSetRow NOTIFY firstBarSetRowChanged) |
|
31 | Q_PROPERTY(int firstBarSetRow READ firstBarSetRow WRITE setFirstBarSetRow NOTIFY firstBarSetRowChanged) | |
32 | Q_PROPERTY(int lastBarSetRow READ lastBarSetRow WRITE setLastBarSetRow NOTIFY lastBarSetRowChanged) |
|
32 | Q_PROPERTY(int lastBarSetRow READ lastBarSetRow WRITE setLastBarSetRow NOTIFY lastBarSetRowChanged) | |
|
33 | Q_PROPERTY(int firstColumn READ firstColumn WRITE setFirstColumn NOTIFY firstColumnChanged) | |||
|
34 | Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged) | |||
33 |
|
35 | |||
34 | public: |
|
36 | public: | |
35 | explicit QHBarModelMapper(QObject *parent = 0); |
|
37 | explicit QHBarModelMapper(QObject *parent = 0); | |
@@ -40,9 +42,17 public: | |||||
40 | int lastBarSetRow() const; |
|
42 | int lastBarSetRow() const; | |
41 | void setLastBarSetRow(int lastBarSetRow); |
|
43 | void setLastBarSetRow(int lastBarSetRow); | |
42 |
|
44 | |||
|
45 | int firstColumn() const; | |||
|
46 | void setFirstColumn(int firstColumn); | |||
|
47 | ||||
|
48 | int columnCount() const; | |||
|
49 | void setColumnCount(int columnCount); | |||
|
50 | ||||
43 | Q_SIGNALS: |
|
51 | Q_SIGNALS: | |
44 | void firstBarSetRowChanged(); |
|
52 | void firstBarSetRowChanged(); | |
45 | void lastBarSetRowChanged(); |
|
53 | void lastBarSetRowChanged(); | |
|
54 | void firstColumnChanged(); | |||
|
55 | void columnCountChanged(); | |||
46 | }; |
|
56 | }; | |
47 |
|
57 | |||
48 | QTCOMMERCIALCHART_END_NAMESPACE |
|
58 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -77,6 +77,28 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
77 | */ |
|
77 | */ | |
78 |
|
78 | |||
79 | /*! |
|
79 | /*! | |
|
80 | \property QVBarModelMapper::firstRow | |||
|
81 | \brief Defines which row of the model contains the first values of the QBarSets in the series. | |||
|
82 | Minimal and default value is: 0 | |||
|
83 | */ | |||
|
84 | /*! | |||
|
85 | \qmlproperty int BarModelMapper::first | |||
|
86 | Defines which row of the model contains the first values of the QBarSets in the series. | |||
|
87 | The default value is 0. | |||
|
88 | */ | |||
|
89 | ||||
|
90 | /*! | |||
|
91 | \property QVBarModelMapper::rowCount | |||
|
92 | \brief Defines the number of rows of the model that are mapped as the data for QBarSeries | |||
|
93 | Minimal and default value is: -1 (count limited by the number of rows in the model) | |||
|
94 | */ | |||
|
95 | /*! | |||
|
96 | \qmlproperty int BarModelMapper::count | |||
|
97 | Defines the number of rows of the model that are mapped as the data for QBarSeries. The default value is | |||
|
98 | -1 (count limited by the number of rows in the model) | |||
|
99 | */ | |||
|
100 | ||||
|
101 | /*! | |||
80 | \fn void QVBarModelMapper::firstBarSetColumnChanged() |
|
102 | \fn void QVBarModelMapper::firstBarSetColumnChanged() | |
81 | Emitted when the firstBarSetColumn has changed. |
|
103 | Emitted when the firstBarSetColumn has changed. | |
82 | */ |
|
104 | */ | |
@@ -87,6 +109,16 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
87 | */ |
|
109 | */ | |
88 |
|
110 | |||
89 | /*! |
|
111 | /*! | |
|
112 | \fn void QVBarModelMapper::firstRowChanged() | |||
|
113 | Emitted when the firstRow has changed. | |||
|
114 | */ | |||
|
115 | ||||
|
116 | /*! | |||
|
117 | \fn void QVBarModelMapper::rowCountChanged() | |||
|
118 | Emitted when the rowCount has changed. | |||
|
119 | */ | |||
|
120 | ||||
|
121 | /*! | |||
90 | Constructs a mapper object which is a child of \a parent. |
|
122 | Constructs a mapper object which is a child of \a parent. | |
91 | */ |
|
123 | */ | |
92 | QVBarModelMapper::QVBarModelMapper(QObject *parent) : |
|
124 | QVBarModelMapper::QVBarModelMapper(QObject *parent) : | |
@@ -103,7 +135,7 int QVBarModelMapper::firstBarSetColumn() const | |||||
103 | void QVBarModelMapper::setFirstBarSetColumn(int firstBarSetColumn) |
|
135 | void QVBarModelMapper::setFirstBarSetColumn(int firstBarSetColumn) | |
104 | { |
|
136 | { | |
105 | if (firstBarSetColumn != firstBarSetSection()) { |
|
137 | if (firstBarSetColumn != firstBarSetSection()) { | |
106 |
|
|
138 | QBarModelMapper::setFirstBarSetSection(firstBarSetColumn); | |
107 | emit firstBarSetColumnChanged(); |
|
139 | emit firstBarSetColumnChanged(); | |
108 | } |
|
140 | } | |
109 | } |
|
141 | } | |
@@ -116,11 +148,37 int QVBarModelMapper::lastBarSetColumn() const | |||||
116 | void QVBarModelMapper::setLastBarSetColumn(int lastBarSetColumn) |
|
148 | void QVBarModelMapper::setLastBarSetColumn(int lastBarSetColumn) | |
117 | { |
|
149 | { | |
118 | if (lastBarSetColumn != lastBarSetSection()) { |
|
150 | if (lastBarSetColumn != lastBarSetSection()) { | |
119 |
|
|
151 | QBarModelMapper::setLastBarSetSection(lastBarSetColumn); | |
120 | emit lastBarSetColumnChanged(); |
|
152 | emit lastBarSetColumnChanged(); | |
121 | } |
|
153 | } | |
122 | } |
|
154 | } | |
123 |
|
155 | |||
|
156 | int QVBarModelMapper::firstRow() const | |||
|
157 | { | |||
|
158 | return QBarModelMapper::first(); | |||
|
159 | } | |||
|
160 | ||||
|
161 | void QVBarModelMapper::setFirstRow(int firstRow) | |||
|
162 | { | |||
|
163 | if (firstRow != first()) { | |||
|
164 | QBarModelMapper::setFirst(firstRow); | |||
|
165 | emit firstRowChanged(); | |||
|
166 | } | |||
|
167 | } | |||
|
168 | ||||
|
169 | int QVBarModelMapper::rowCount() const | |||
|
170 | { | |||
|
171 | return QBarModelMapper::count(); | |||
|
172 | } | |||
|
173 | ||||
|
174 | void QVBarModelMapper::setRowCount(int rowCount) | |||
|
175 | { | |||
|
176 | if (rowCount != count()) { | |||
|
177 | QBarModelMapper::setCount(rowCount); | |||
|
178 | emit firstRowChanged(); | |||
|
179 | } | |||
|
180 | } | |||
|
181 | ||||
124 | #include "moc_qvbarmodelmapper.cpp" |
|
182 | #include "moc_qvbarmodelmapper.cpp" | |
125 |
|
183 | |||
126 | QTCOMMERCIALCHART_END_NAMESPACE |
|
184 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -30,6 +30,8 class QTCOMMERCIALCHART_EXPORT QVBarModelMapper : public QBarModelMapper | |||||
30 | Q_OBJECT |
|
30 | Q_OBJECT | |
31 | Q_PROPERTY(int firstBarSetColumn READ firstBarSetColumn WRITE setFirstBarSetColumn NOTIFY firstBarSetColumnChanged) |
|
31 | Q_PROPERTY(int firstBarSetColumn READ firstBarSetColumn WRITE setFirstBarSetColumn NOTIFY firstBarSetColumnChanged) | |
32 | Q_PROPERTY(int lastBarSetColumn READ lastBarSetColumn WRITE setLastBarSetColumn NOTIFY lastBarSetColumnChanged) |
|
32 | Q_PROPERTY(int lastBarSetColumn READ lastBarSetColumn WRITE setLastBarSetColumn NOTIFY lastBarSetColumnChanged) | |
|
33 | Q_PROPERTY(int firstRow READ firstRow WRITE setFirstRow NOTIFY firstRowChanged) | |||
|
34 | Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged) | |||
33 |
|
35 | |||
34 | public: |
|
36 | public: | |
35 | explicit QVBarModelMapper(QObject *parent = 0); |
|
37 | explicit QVBarModelMapper(QObject *parent = 0); | |
@@ -40,9 +42,17 public: | |||||
40 | int lastBarSetColumn() const; |
|
42 | int lastBarSetColumn() const; | |
41 | void setLastBarSetColumn(int lastBarSetColumn); |
|
43 | void setLastBarSetColumn(int lastBarSetColumn); | |
42 |
|
44 | |||
|
45 | int firstRow() const; | |||
|
46 | void setFirstRow(int firstRow); | |||
|
47 | ||||
|
48 | int rowCount() const; | |||
|
49 | void setRowCount(int rowCount); | |||
|
50 | ||||
43 | Q_SIGNALS: |
|
51 | Q_SIGNALS: | |
44 | void firstBarSetColumnChanged(); |
|
52 | void firstBarSetColumnChanged(); | |
45 | void lastBarSetColumnChanged(); |
|
53 | void lastBarSetColumnChanged(); | |
|
54 | void firstRowChanged(); | |||
|
55 | void rowCountChanged(); | |||
46 | }; |
|
56 | }; | |
47 |
|
57 | |||
48 | QTCOMMERCIALCHART_END_NAMESPACE |
|
58 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -223,8 +223,8 void tst_qbarmodelmapper::verticalMapperCustomMapping() | |||||
223 | mapper->setLastBarSetColumn(1); |
|
223 | mapper->setLastBarSetColumn(1); | |
224 | mapper->setModel(m_model); |
|
224 | mapper->setModel(m_model); | |
225 | mapper->setSeries(m_series); |
|
225 | mapper->setSeries(m_series); | |
226 | mapper->setFirst(first); |
|
226 | mapper->setFirstRow(first); | |
227 | mapper->setCount(countLimit); |
|
227 | mapper->setRowCount(countLimit); | |
228 | m_chart->addSeries(m_series); |
|
228 | m_chart->addSeries(m_series); | |
229 |
|
229 | |||
230 | QCOMPARE(m_series->count(), expectedBarSetCount); |
|
230 | QCOMPARE(m_series->count(), expectedBarSetCount); | |
@@ -313,8 +313,8 void tst_qbarmodelmapper::horizontalMapperCustomMapping() | |||||
313 | mapper->setLastBarSetRow(1); |
|
313 | mapper->setLastBarSetRow(1); | |
314 | mapper->setModel(m_model); |
|
314 | mapper->setModel(m_model); | |
315 | mapper->setSeries(m_series); |
|
315 | mapper->setSeries(m_series); | |
316 | mapper->setFirst(first); |
|
316 | mapper->setFirstColumn(first); | |
317 | mapper->setCount(countLimit); |
|
317 | mapper->setColumnCount(countLimit); | |
318 | m_chart->addSeries(m_series); |
|
318 | m_chart->addSeries(m_series); | |
319 |
|
319 | |||
320 | QCOMPARE(m_series->count(), expectedBarSetCount); |
|
320 | QCOMPARE(m_series->count(), expectedBarSetCount); | |
@@ -337,15 +337,15 void tst_qbarmodelmapper::seriesUpdated() | |||||
337 | // setup the mapper |
|
337 | // setup the mapper | |
338 | createVerticalMapper(); |
|
338 | createVerticalMapper(); | |
339 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount); |
|
339 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount); | |
340 |
QCOMPARE(m_vMapper-> |
|
340 | QCOMPARE(m_vMapper->rowCount(), -1); | |
341 |
|
341 | |||
342 | m_series->barSets().first()->append(123); |
|
342 | m_series->barSets().first()->append(123); | |
343 | QCOMPARE(m_model->rowCount(), m_modelRowCount + 1); |
|
343 | QCOMPARE(m_model->rowCount(), m_modelRowCount + 1); | |
344 |
QCOMPARE(m_vMapper-> |
|
344 | QCOMPARE(m_vMapper->rowCount(), -1); // the value should not change as it indicates 'all' items there are in the model | |
345 |
|
345 | |||
346 | m_series->barSets().last()->remove(0, m_modelRowCount); |
|
346 | m_series->barSets().last()->remove(0, m_modelRowCount); | |
347 | QCOMPARE(m_model->rowCount(), 1); |
|
347 | QCOMPARE(m_model->rowCount(), 1); | |
348 |
QCOMPARE(m_vMapper-> |
|
348 | QCOMPARE(m_vMapper->rowCount(), -1); // the value should not change as it indicates 'all' items there are in the model | |
349 |
|
349 | |||
350 | m_series->barSets().first()->replace(0, 444.0); |
|
350 | m_series->barSets().first()->replace(0, 444.0); | |
351 | QCOMPARE(m_model->data(m_model->index(0, 0)).toReal(), 444.0); |
|
351 | QCOMPARE(m_model->data(m_model->index(0, 0)).toReal(), 444.0); | |
@@ -389,7 +389,7 void tst_qbarmodelmapper::verticalModelInsertRows() | |||||
389 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + insertCount); |
|
389 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + insertCount); | |
390 |
|
390 | |||
391 | int first = 3; |
|
391 | int first = 3; | |
392 | m_vMapper->setFirst(3); |
|
392 | m_vMapper->setFirstRow(3); | |
393 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); |
|
393 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); | |
394 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + insertCount - first); |
|
394 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + insertCount - first); | |
395 |
|
395 | |||
@@ -398,7 +398,7 void tst_qbarmodelmapper::verticalModelInsertRows() | |||||
398 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + 2 * insertCount - first); |
|
398 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + 2 * insertCount - first); | |
399 |
|
399 | |||
400 | int countLimit = 6; |
|
400 | int countLimit = 6; | |
401 | m_vMapper->setCount(countLimit); |
|
401 | m_vMapper->setRowCount(countLimit); | |
402 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); |
|
402 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); | |
403 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 2 * insertCount - first)); |
|
403 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 2 * insertCount - first)); | |
404 |
|
404 | |||
@@ -406,11 +406,11 void tst_qbarmodelmapper::verticalModelInsertRows() | |||||
406 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); |
|
406 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); | |
407 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 3 * insertCount - first)); |
|
407 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 3 * insertCount - first)); | |
408 |
|
408 | |||
409 | m_vMapper->setFirst(0); |
|
409 | m_vMapper->setFirstRow(0); | |
410 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); |
|
410 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); | |
411 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 3 * insertCount)); |
|
411 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount + 3 * insertCount)); | |
412 |
|
412 | |||
413 | m_vMapper->setCount(-1); |
|
413 | m_vMapper->setRowCount(-1); | |
414 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); |
|
414 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); | |
415 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + 3 * insertCount); |
|
415 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount + 3 * insertCount); | |
416 | } |
|
416 | } | |
@@ -429,7 +429,7 void tst_qbarmodelmapper::verticalModelRemoveRows() | |||||
429 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - removeCount); |
|
429 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - removeCount); | |
430 |
|
430 | |||
431 | int first = 1; |
|
431 | int first = 1; | |
432 | m_vMapper->setFirst(first); |
|
432 | m_vMapper->setFirstRow(first); | |
433 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); |
|
433 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); | |
434 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - removeCount - first); |
|
434 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - removeCount - first); | |
435 |
|
435 | |||
@@ -438,7 +438,7 void tst_qbarmodelmapper::verticalModelRemoveRows() | |||||
438 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - 2 * removeCount - first); |
|
438 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - 2 * removeCount - first); | |
439 |
|
439 | |||
440 | int countLimit = 3; |
|
440 | int countLimit = 3; | |
441 | m_vMapper->setCount(countLimit); |
|
441 | m_vMapper->setRowCount(countLimit); | |
442 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); |
|
442 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); | |
443 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 2 * removeCount - first)); |
|
443 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 2 * removeCount - first)); | |
444 |
|
444 | |||
@@ -446,11 +446,11 void tst_qbarmodelmapper::verticalModelRemoveRows() | |||||
446 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); |
|
446 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); | |
447 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 3 * removeCount - first)); |
|
447 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 3 * removeCount - first)); | |
448 |
|
448 | |||
449 | m_vMapper->setFirst(0); |
|
449 | m_vMapper->setFirstRow(0); | |
450 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); |
|
450 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); | |
451 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 3 * removeCount)); |
|
451 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelRowCount - 3 * removeCount)); | |
452 |
|
452 | |||
453 | m_vMapper->setCount(-1); |
|
453 | m_vMapper->setRowCount(-1); | |
454 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); |
|
454 | QCOMPARE(m_series->count(), m_vMapper->lastBarSetColumn() - m_vMapper->firstBarSetColumn() + 1); | |
455 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - 3 * removeCount); |
|
455 | QCOMPARE(m_series->barSets().first()->count(), m_modelRowCount - 3 * removeCount); | |
456 | } |
|
456 | } | |
@@ -533,7 +533,7 void tst_qbarmodelmapper::horizontalModelInsertColumns() | |||||
533 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + insertCount); |
|
533 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + insertCount); | |
534 |
|
534 | |||
535 | int first = 3; |
|
535 | int first = 3; | |
536 | m_hMapper->setFirst(3); |
|
536 | m_hMapper->setFirstColumn(3); | |
537 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); |
|
537 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); | |
538 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + insertCount - first); |
|
538 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + insertCount - first); | |
539 |
|
539 | |||
@@ -542,7 +542,7 void tst_qbarmodelmapper::horizontalModelInsertColumns() | |||||
542 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + 2 * insertCount - first); |
|
542 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + 2 * insertCount - first); | |
543 |
|
543 | |||
544 | int countLimit = 6; |
|
544 | int countLimit = 6; | |
545 | m_hMapper->setCount(countLimit); |
|
545 | m_hMapper->setColumnCount(countLimit); | |
546 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); |
|
546 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); | |
547 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 2 * insertCount - first)); |
|
547 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 2 * insertCount - first)); | |
548 |
|
548 | |||
@@ -550,11 +550,11 void tst_qbarmodelmapper::horizontalModelInsertColumns() | |||||
550 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); |
|
550 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); | |
551 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 3 * insertCount - first)); |
|
551 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 3 * insertCount - first)); | |
552 |
|
552 | |||
553 | m_hMapper->setFirst(0); |
|
553 | m_hMapper->setFirstColumn(0); | |
554 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); |
|
554 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); | |
555 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 3 * insertCount)); |
|
555 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount + 3 * insertCount)); | |
556 |
|
556 | |||
557 | m_hMapper->setCount(-1); |
|
557 | m_hMapper->setColumnCount(-1); | |
558 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); |
|
558 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); | |
559 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + 3 * insertCount); |
|
559 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount + 3 * insertCount); | |
560 | } |
|
560 | } | |
@@ -573,7 +573,7 void tst_qbarmodelmapper::horizontalModelRemoveColumns() | |||||
573 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - removeCount); |
|
573 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - removeCount); | |
574 |
|
574 | |||
575 | int first = 1; |
|
575 | int first = 1; | |
576 | m_hMapper->setFirst(first); |
|
576 | m_hMapper->setFirstColumn(first); | |
577 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); |
|
577 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); | |
578 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - removeCount - first); |
|
578 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - removeCount - first); | |
579 |
|
579 | |||
@@ -582,7 +582,7 void tst_qbarmodelmapper::horizontalModelRemoveColumns() | |||||
582 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - 2 * removeCount - first); |
|
582 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - 2 * removeCount - first); | |
583 |
|
583 | |||
584 | int countLimit = 3; |
|
584 | int countLimit = 3; | |
585 | m_hMapper->setCount(countLimit); |
|
585 | m_hMapper->setColumnCount(countLimit); | |
586 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); |
|
586 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); | |
587 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 2 * removeCount - first)); |
|
587 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 2 * removeCount - first)); | |
588 |
|
588 | |||
@@ -590,11 +590,11 void tst_qbarmodelmapper::horizontalModelRemoveColumns() | |||||
590 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); |
|
590 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); | |
591 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 3 * removeCount - first)); |
|
591 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 3 * removeCount - first)); | |
592 |
|
592 | |||
593 | m_hMapper->setFirst(0); |
|
593 | m_hMapper->setFirstColumn(0); | |
594 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); |
|
594 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); | |
595 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 3 * removeCount)); |
|
595 | QCOMPARE(m_series->barSets().first()->count(), qMin(countLimit, m_modelColumnCount - 3 * removeCount)); | |
596 |
|
596 | |||
597 | m_hMapper->setCount(-1); |
|
597 | m_hMapper->setColumnCount(-1); | |
598 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); |
|
598 | QCOMPARE(m_series->count(), m_hMapper->lastBarSetRow() - m_hMapper->firstBarSetRow() + 1); | |
599 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - 3 * removeCount); |
|
599 | QCOMPARE(m_series->barSets().first()->count(), m_modelColumnCount - 3 * removeCount); | |
600 | } |
|
600 | } |
General Comments 0
You need to be logged in to leave comments.
Login now