@@ -1,458 +1,478 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
1 | 21 | #include "qbarmodelmapper.h" |
|
2 | 22 | #include "qbarmodelmapper_p.h" |
|
3 | 23 | #include "qbarseries.h" |
|
4 | 24 | #include "qbarset.h" |
|
5 | 25 | #include "qchart.h" |
|
6 | 26 | #include "qaxis.h" |
|
7 | 27 | #include <QAbstractItemModel> |
|
8 | 28 | |
|
9 | 29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
10 | 30 | |
|
11 | 31 | /*! |
|
12 | 32 | \property QBarModelMapper::series |
|
13 | 33 | \brief Defines the QPieSeries object that is used by the mapper. |
|
14 | 34 | |
|
15 | 35 | All the data in the series in the series is discarded when it is set to the mapper. |
|
16 | 36 | When new series is specified the old series is disconnected (it preserves its data) |
|
17 | 37 | */ |
|
18 | 38 | |
|
19 | 39 | /*! |
|
20 | 40 | \property QBarModelMapper::model |
|
21 | 41 | \brief Defines the model that is used by the mapper. |
|
22 | 42 | */ |
|
23 | 43 | |
|
24 | 44 | /*! |
|
25 | 45 | \property QBarModelMapper::first |
|
26 | 46 | \brief Defines which item of the model's row/column should be mapped as the value of the first QBarSet in the series. |
|
27 | 47 | |
|
28 | 48 | Minimal and default value is: 0 |
|
29 | 49 | */ |
|
30 | 50 | |
|
31 | 51 | /*! |
|
32 | 52 | \property QBarModelMapper::count |
|
33 | 53 | \brief Defines the number of rows/columns of the model that are mapped as the data for QBarSeries |
|
34 | 54 | |
|
35 | 55 | Minimal and default value is: -1 (count limited by the number of rows/columns in the model) |
|
36 | 56 | */ |
|
37 | 57 | |
|
38 | 58 | /*! |
|
39 | 59 | \class QBarModelMapper |
|
40 | 60 | \brief part of QtCommercial chart API. |
|
41 | 61 | \mainclass |
|
42 | 62 | |
|
43 | 63 | The instance of this class cannot be created directly. QHBarModelMapper of QVBarModelMapper should be used instead. This class is used to create a connection between QBarSeries and QAbstractItemModel derived model object. |
|
44 | 64 | Curently it is NOT possible to use both QAbstractItemModel and QXYSeries model API. |
|
45 | 65 | When the series is set to the mapper the QBarSeries and QBarSet API that affect the data (append, setValue, remove) should not be used. |
|
46 | 66 | The model and the QBarSeries won't be kept in sync. Model API should be used to insert,remove,modify BarSets. |
|
47 | 67 | NOTE: used model has to support adding/removing rows/columns and modifying the data of the cells. |
|
48 | 68 | */ |
|
49 | 69 | |
|
50 | 70 | /*! |
|
51 | 71 | Constructs a mapper object which is a child of \a parent. |
|
52 | 72 | */ |
|
53 | 73 | QBarModelMapper::QBarModelMapper(QObject *parent) : |
|
54 | 74 | QObject(parent), |
|
55 | 75 | d_ptr(new QBarModelMapperPrivate(this)) |
|
56 | 76 | { |
|
57 | 77 | } |
|
58 | 78 | |
|
59 | 79 | QAbstractItemModel* QBarModelMapper::model() const |
|
60 | 80 | { |
|
61 | 81 | Q_D(const QBarModelMapper); |
|
62 | 82 | return d->m_model; |
|
63 | 83 | } |
|
64 | 84 | |
|
65 | 85 | void QBarModelMapper::setModel(QAbstractItemModel *model) |
|
66 | 86 | { |
|
67 | 87 | if (model == 0) |
|
68 | 88 | return; |
|
69 | 89 | |
|
70 | 90 | Q_D(QBarModelMapper); |
|
71 | 91 | if (d->m_model) { |
|
72 | 92 | disconnect(d->m_model, 0, d, 0); |
|
73 | 93 | } |
|
74 | 94 | |
|
75 | 95 | d->m_model = model; |
|
76 | 96 | d->initializeBarFromModel(); |
|
77 | 97 | // connect signals from the model |
|
78 | 98 | connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex))); |
|
79 | 99 | connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int))); |
|
80 | 100 | connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int))); |
|
81 | 101 | connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int))); |
|
82 | 102 | connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int))); |
|
83 | 103 | } |
|
84 | 104 | |
|
85 | 105 | QBarSeries* QBarModelMapper::series() const |
|
86 | 106 | { |
|
87 | 107 | Q_D(const QBarModelMapper); |
|
88 | 108 | return d->m_series; |
|
89 | 109 | } |
|
90 | 110 | |
|
91 | 111 | void QBarModelMapper::setSeries(QBarSeries *series) |
|
92 | 112 | { |
|
93 | 113 | Q_D(QBarModelMapper); |
|
94 | 114 | if (d->m_series) { |
|
95 | 115 | disconnect(d->m_series, 0, d, 0); |
|
96 | 116 | } |
|
97 | 117 | |
|
98 | 118 | if (series == 0) |
|
99 | 119 | return; |
|
100 | 120 | |
|
101 | 121 | d->m_series = series; |
|
102 | 122 | d->initializeBarFromModel(); |
|
103 | 123 | // connect the signals from the series |
|
104 | 124 | // connect(d->m_series, SIGNAL(pointAdded(int)), d, SLOT(handlePointAdded(int))); |
|
105 | 125 | // connect(d->m_series, SIGNAL(pointRemoved(int)), d, SLOT(handlePointRemoved(int))); |
|
106 | 126 | // connect(d->m_series, SIGNAL(pointReplaced(int)), d, SLOT(handlePointReplaced(int))); |
|
107 | 127 | } |
|
108 | 128 | |
|
109 | 129 | int QBarModelMapper::first() const |
|
110 | 130 | { |
|
111 | 131 | Q_D(const QBarModelMapper); |
|
112 | 132 | return d->m_first; |
|
113 | 133 | } |
|
114 | 134 | |
|
115 | 135 | void QBarModelMapper::setFirst(int first) |
|
116 | 136 | { |
|
117 | 137 | Q_D(QBarModelMapper); |
|
118 | 138 | d->m_first = qMax(first, 0); |
|
119 | 139 | d->initializeBarFromModel(); |
|
120 | 140 | } |
|
121 | 141 | |
|
122 | 142 | int QBarModelMapper::count() const |
|
123 | 143 | { |
|
124 | 144 | Q_D(const QBarModelMapper); |
|
125 | 145 | return d->m_count; |
|
126 | 146 | } |
|
127 | 147 | |
|
128 | 148 | void QBarModelMapper::setCount(int count) |
|
129 | 149 | { |
|
130 | 150 | Q_D(QBarModelMapper); |
|
131 | 151 | d->m_count = qMax(count, -1); |
|
132 | 152 | d->initializeBarFromModel(); |
|
133 | 153 | } |
|
134 | 154 | |
|
135 | 155 | /*! |
|
136 | 156 | Returns the orientation that is used when QBarModelMapper accesses the model. |
|
137 | 157 | This mean whether the consecutive values of the bar set are read from row (Qt::Horizontal) |
|
138 | 158 | or from columns (Qt::Vertical) |
|
139 | 159 | */ |
|
140 | 160 | Qt::Orientation QBarModelMapper::orientation() const |
|
141 | 161 | { |
|
142 | 162 | Q_D(const QBarModelMapper); |
|
143 | 163 | return d->m_orientation; |
|
144 | 164 | } |
|
145 | 165 | |
|
146 | 166 | /*! |
|
147 | 167 | Returns the \a orientation that is used when QBarModelMapper accesses the model. |
|
148 | 168 | This mean whether the consecutive values of the pie are read from row (Qt::Horizontal) |
|
149 | 169 | or from columns (Qt::Vertical) |
|
150 | 170 | */ |
|
151 | 171 | void QBarModelMapper::setOrientation(Qt::Orientation orientation) |
|
152 | 172 | { |
|
153 | 173 | Q_D(QBarModelMapper); |
|
154 | 174 | d->m_orientation = orientation; |
|
155 | 175 | d->initializeBarFromModel(); |
|
156 | 176 | } |
|
157 | 177 | |
|
158 | 178 | /*! |
|
159 | 179 | Returns which section of the model is used as the data source for the first bar set |
|
160 | 180 | */ |
|
161 | 181 | int QBarModelMapper::firstBarSetSection() const |
|
162 | 182 | { |
|
163 | 183 | Q_D(const QBarModelMapper); |
|
164 | 184 | return d->m_firstBarSetSection; |
|
165 | 185 | } |
|
166 | 186 | |
|
167 | 187 | /*! |
|
168 | 188 | Sets the model section that is used as the data source for the first bar set |
|
169 | 189 | Parameter \a firstBarSetSection specifies the section of the model. |
|
170 | 190 | */ |
|
171 | 191 | void QBarModelMapper::setFirstBarSetSection(int firstBarSetSection) |
|
172 | 192 | { |
|
173 | 193 | Q_D(QBarModelMapper); |
|
174 | 194 | d->m_firstBarSetSection = firstBarSetSection; |
|
175 | 195 | d->initializeBarFromModel(); |
|
176 | 196 | } |
|
177 | 197 | |
|
178 | 198 | /*! |
|
179 | 199 | Returns which section of the model is used as the data source for the last bar set |
|
180 | 200 | */ |
|
181 | 201 | int QBarModelMapper::lastBarSetSection() const |
|
182 | 202 | { |
|
183 | 203 | Q_D(const QBarModelMapper); |
|
184 | 204 | return d->m_lastBarSetSection; |
|
185 | 205 | } |
|
186 | 206 | |
|
187 | 207 | /*! |
|
188 | 208 | Sets the model section that is used as the data source for the last bar set |
|
189 | 209 | Parameter \a lastBarSetSection specifies the section of the model. |
|
190 | 210 | */ |
|
191 | 211 | void QBarModelMapper::setLastBarSetSection(int lastBarSetSection) |
|
192 | 212 | { |
|
193 | 213 | Q_D(QBarModelMapper); |
|
194 | 214 | d->m_lastBarSetSection = lastBarSetSection; |
|
195 | 215 | d->initializeBarFromModel(); |
|
196 | 216 | } |
|
197 | 217 | |
|
198 | 218 | /*! |
|
199 | 219 | Resets the QBarModelMapper to the default state. |
|
200 | 220 | first: 0; count: -1; firstBarSetSection: -1; lastBarSetSection: -1; categoriesSection: -1 |
|
201 | 221 | */ |
|
202 | 222 | void QBarModelMapper::reset() |
|
203 | 223 | { |
|
204 | 224 | Q_D(QBarModelMapper); |
|
205 | 225 | d->m_first = 0; |
|
206 | 226 | d->m_count = -1; |
|
207 | 227 | d->m_firstBarSetSection = -1; |
|
208 | 228 | d->m_lastBarSetSection = -1; |
|
209 | 229 | d->initializeBarFromModel(); |
|
210 | 230 | } |
|
211 | 231 | |
|
212 | 232 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
213 | 233 | |
|
214 | 234 | QBarModelMapperPrivate::QBarModelMapperPrivate(QBarModelMapper *q) : |
|
215 | 235 | m_series(0), |
|
216 | 236 | m_model(0), |
|
217 | 237 | m_first(0), |
|
218 | 238 | m_count(-1), |
|
219 | 239 | m_orientation(Qt::Vertical), |
|
220 | 240 | m_firstBarSetSection(-1), |
|
221 | 241 | m_lastBarSetSection(-1), |
|
222 | 242 | m_seriesSignalsBlock(false), |
|
223 | 243 | m_modelSignalsBlock(false), |
|
224 | 244 | q_ptr(q) |
|
225 | 245 | { |
|
226 | 246 | } |
|
227 | 247 | |
|
228 | 248 | void QBarModelMapperPrivate::blockModelSignals(bool block) |
|
229 | 249 | { |
|
230 | 250 | m_modelSignalsBlock = block; |
|
231 | 251 | } |
|
232 | 252 | |
|
233 | 253 | void QBarModelMapperPrivate::blockSeriesSignals(bool block) |
|
234 | 254 | { |
|
235 | 255 | m_seriesSignalsBlock = block; |
|
236 | 256 | } |
|
237 | 257 | |
|
238 | 258 | QBarSet* QBarModelMapperPrivate::barSet(QModelIndex index) |
|
239 | 259 | { |
|
240 | 260 | if (!index.isValid()) |
|
241 | 261 | return 0; |
|
242 | 262 | |
|
243 | 263 | if (m_orientation == Qt::Vertical && index.column() >= m_firstBarSetSection && index.column() <= m_lastBarSetSection) { |
|
244 | 264 | if (index.row() >= m_first && (m_count == - 1 || index.row() < m_first + m_count)) { |
|
245 | 265 | // if (m_model->index(index.row(), m_valuesSection).isValid() && m_model->index(index.row(), m_labelsSection).isValid()) |
|
246 | 266 | return m_series->barSets().at(index.column() - m_firstBarSetSection); |
|
247 | 267 | // else |
|
248 | 268 | // return 0; |
|
249 | 269 | } |
|
250 | 270 | } else if (m_orientation == Qt::Horizontal && index.row() >= m_firstBarSetSection && index.row() <= m_lastBarSetSection) { |
|
251 | 271 | if (index.column() >= m_first && (m_count == - 1 || index.column() < m_first + m_count)) |
|
252 | 272 | return m_series->barSets().at(index.row() - m_firstBarSetSection); |
|
253 | 273 | } |
|
254 | 274 | return 0; // This part of model has not been mapped to any slice |
|
255 | 275 | } |
|
256 | 276 | |
|
257 | 277 | QModelIndex QBarModelMapperPrivate::barModelIndex(int barSection, int posInBar) |
|
258 | 278 | { |
|
259 | 279 | if (m_count != -1 && posInBar >= m_count) |
|
260 | 280 | return QModelIndex(); // invalid |
|
261 | 281 | |
|
262 | 282 | if (barSection < m_firstBarSetSection || barSection > m_lastBarSetSection) |
|
263 | 283 | return QModelIndex(); // invalid |
|
264 | 284 | |
|
265 | 285 | if (m_orientation == Qt::Vertical) |
|
266 | 286 | return m_model->index(posInBar + m_first, barSection); |
|
267 | 287 | else |
|
268 | 288 | return m_model->index(barSection, posInBar + m_first); |
|
269 | 289 | } |
|
270 | 290 | |
|
271 | 291 | void QBarModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) |
|
272 | 292 | { |
|
273 | 293 | Q_UNUSED(topLeft) |
|
274 | 294 | Q_UNUSED(bottomRight) |
|
275 | 295 | |
|
276 | 296 | if (m_model == 0 || m_series == 0) |
|
277 | 297 | return; |
|
278 | 298 | |
|
279 | 299 | if (m_modelSignalsBlock) |
|
280 | 300 | return; |
|
281 | 301 | |
|
282 | 302 | blockSeriesSignals(); |
|
283 | 303 | QModelIndex index; |
|
284 | 304 | for (int row = topLeft.row(); row <= bottomRight.row(); row++) { |
|
285 | 305 | for (int column = topLeft.column(); column <= bottomRight.column(); column++) { |
|
286 | 306 | index = topLeft.sibling(row, column); |
|
287 | 307 | QBarSet* bar = barSet(index); |
|
288 | 308 | if (bar) { |
|
289 | 309 | if (m_orientation == Qt::Vertical) |
|
290 | 310 | bar->replace(row - m_first, m_model->data(index).toReal()); |
|
291 | 311 | else |
|
292 | 312 | bar->replace(column - m_first, m_model->data(index).toReal()); |
|
293 | 313 | } |
|
294 | 314 | } |
|
295 | 315 | } |
|
296 | 316 | blockSeriesSignals(false); |
|
297 | 317 | } |
|
298 | 318 | |
|
299 | 319 | void QBarModelMapperPrivate::modelRowsAdded(QModelIndex parent, int start, int end) |
|
300 | 320 | { |
|
301 | 321 | Q_UNUSED(parent); |
|
302 | 322 | Q_UNUSED(end) |
|
303 | 323 | if (m_modelSignalsBlock) |
|
304 | 324 | return; |
|
305 | 325 | |
|
306 | 326 | blockSeriesSignals(); |
|
307 | 327 | if (m_orientation == Qt::Vertical) |
|
308 | 328 | // insertData(start, end); |
|
309 | 329 | initializeBarFromModel(); |
|
310 | 330 | else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection) // if the changes affect the map - reinitialize |
|
311 | 331 | initializeBarFromModel(); |
|
312 | 332 | blockSeriesSignals(false); |
|
313 | 333 | } |
|
314 | 334 | |
|
315 | 335 | void QBarModelMapperPrivate::modelRowsRemoved(QModelIndex parent, int start, int end) |
|
316 | 336 | { |
|
317 | 337 | Q_UNUSED(parent); |
|
318 | 338 | Q_UNUSED(end) |
|
319 | 339 | if (m_modelSignalsBlock) |
|
320 | 340 | return; |
|
321 | 341 | |
|
322 | 342 | blockSeriesSignals(); |
|
323 | 343 | if (m_orientation == Qt::Vertical) |
|
324 | 344 | // removeData(start, end); |
|
325 | 345 | initializeBarFromModel(); |
|
326 | 346 | else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection) // if the changes affect the map - reinitialize |
|
327 | 347 | initializeBarFromModel(); |
|
328 | 348 | blockSeriesSignals(false); |
|
329 | 349 | } |
|
330 | 350 | |
|
331 | 351 | void QBarModelMapperPrivate::modelColumnsAdded(QModelIndex parent, int start, int end) |
|
332 | 352 | { |
|
333 | 353 | Q_UNUSED(parent); |
|
334 | 354 | Q_UNUSED(end) |
|
335 | 355 | if (m_modelSignalsBlock) |
|
336 | 356 | return; |
|
337 | 357 | |
|
338 | 358 | blockSeriesSignals(); |
|
339 | 359 | if (m_orientation == Qt::Horizontal) |
|
340 | 360 | // insertData(start, end); |
|
341 | 361 | initializeBarFromModel(); |
|
342 | 362 | else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection) // if the changes affect the map - reinitialize |
|
343 | 363 | initializeBarFromModel(); |
|
344 | 364 | blockSeriesSignals(false); |
|
345 | 365 | } |
|
346 | 366 | |
|
347 | 367 | void QBarModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end) |
|
348 | 368 | { |
|
349 | 369 | Q_UNUSED(parent); |
|
350 | 370 | Q_UNUSED(end) |
|
351 | 371 | if (m_modelSignalsBlock) |
|
352 | 372 | return; |
|
353 | 373 | |
|
354 | 374 | blockSeriesSignals(); |
|
355 | 375 | if (m_orientation == Qt::Horizontal) |
|
356 | 376 | // removeData(start, end); |
|
357 | 377 | initializeBarFromModel(); |
|
358 | 378 | else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection) // if the changes affect the map - reinitialize |
|
359 | 379 | initializeBarFromModel(); |
|
360 | 380 | blockSeriesSignals(false); |
|
361 | 381 | } |
|
362 | 382 | |
|
363 | 383 | void QBarModelMapperPrivate::insertData(int start, int end) |
|
364 | 384 | { |
|
365 | 385 | Q_UNUSED(end) |
|
366 | 386 | if (m_model == 0 || m_series == 0) |
|
367 | 387 | return; |
|
368 | 388 | |
|
369 | 389 | if (m_count != -1 && start >= m_first + m_count) { |
|
370 | 390 | return; |
|
371 | 391 | } /*else { |
|
372 | 392 | int addedCount = end - start + 1; |
|
373 | 393 | if (m_count != -1 && addedCount > m_count) |
|
374 | 394 | addedCount = m_count; |
|
375 | 395 | int first = qMax(start, m_first); |
|
376 | 396 | int last = qMin(first + addedCount - 1, m_orientation == Qt::Vertical ? m_model->rowCount() - 1 : m_model->columnCount() - 1); |
|
377 | 397 | for (int k = 0; k < m_series->barSets().count(); k++) { |
|
378 | 398 | for (int i = first; i <= last; i++) { |
|
379 | 399 | QBar point; |
|
380 | 400 | point.setX(m_model->data(xModelIndex(i - m_first), Qt::DisplayRole).toDouble()); |
|
381 | 401 | point.setY(m_model->data(yModelIndex(i - m_first), Qt::DisplayRole).toDouble()); |
|
382 | 402 | m_series->insert(i - m_first, point); |
|
383 | 403 | } |
|
384 | 404 | >>>>>>> Stashed changes |
|
385 | 405 | } |
|
386 | 406 | |
|
387 | 407 | // remove excess of slices (abouve m_count) |
|
388 | 408 | if (m_count != -1 && m_series->points().size() > m_count) |
|
389 | 409 | for (int i = m_series->points().size() - 1; i >= m_count; i--) { |
|
390 | 410 | m_series->remove(m_series->points().at(i)); |
|
391 | 411 | } |
|
392 | 412 | }*/ |
|
393 | 413 | } |
|
394 | 414 | |
|
395 | 415 | void QBarModelMapperPrivate::removeData(int start, int end) |
|
396 | 416 | { |
|
397 | 417 | Q_UNUSED(end) |
|
398 | 418 | if (m_model == 0 || m_series == 0) |
|
399 | 419 | return; |
|
400 | 420 | |
|
401 | 421 | // int removedCount = end - start + 1; |
|
402 | 422 | if (m_count != -1 && start >= m_first + m_count) { |
|
403 | 423 | return; |
|
404 | 424 | } /*else { |
|
405 | 425 | int toRemove = qMin(m_series->count(), removedCount); // first find how many items can actually be removed |
|
406 | 426 | int first = qMax(start, m_first); // get the index of the first item that will be removed. |
|
407 | 427 | int last = qMin(first + toRemove - 1, m_series->count() + m_first - 1); // get the index of the last item that will be removed. |
|
408 | 428 | for (int i = last; i >= first; i--) { |
|
409 | 429 | m_series->remove(m_series->points().at(i - m_first)); |
|
410 | 430 | } |
|
411 | 431 | |
|
412 | 432 | if (m_count != -1) { |
|
413 | 433 | int itemsAvailable; // check how many are available to be added |
|
414 | 434 | if (m_orientation == Qt::Vertical) |
|
415 | 435 | itemsAvailable = m_model->rowCount() - m_first - m_series->count(); |
|
416 | 436 | else |
|
417 | 437 | itemsAvailable = m_model->columnCount() - m_first - m_series->count(); |
|
418 | 438 | int toBeAdded = qMin(itemsAvailable, m_count - m_series->count()); // add not more items than there is space left to be filled. |
|
419 | 439 | int currentSize = m_series->count(); |
|
420 | 440 | if (toBeAdded > 0) |
|
421 | 441 | for (int i = m_series->count(); i < currentSize + toBeAdded; i++) { |
|
422 | 442 | QPointF point; |
|
423 | 443 | point.setX(m_model->data(xModelIndex(i), Qt::DisplayRole).toDouble()); |
|
424 | 444 | point.setY(m_model->data(yModelIndex(i), Qt::DisplayRole).toDouble()); |
|
425 | 445 | m_series->insert(i, point); |
|
426 | 446 | } |
|
427 | 447 | } |
|
428 | 448 | }*/ |
|
429 | 449 | } |
|
430 | 450 | |
|
431 | 451 | void QBarModelMapperPrivate::initializeBarFromModel() |
|
432 | 452 | { |
|
433 | 453 | if (m_model == 0 || m_series == 0) |
|
434 | 454 | return; |
|
435 | 455 | |
|
436 | 456 | blockSeriesSignals(); |
|
437 | 457 | // clear current content |
|
438 | 458 | m_series->clear(); |
|
439 | 459 | |
|
440 | 460 | // create the initial bar sets |
|
441 | 461 | for (int i = m_firstBarSetSection; i <= m_lastBarSetSection; i++) { |
|
442 | 462 | int posInBar = 0; |
|
443 | 463 | QModelIndex barIndex = barModelIndex(i, posInBar); |
|
444 | 464 | QBarSet *barSet = new QBarSet(m_model->headerData(i, Qt::Horizontal).toString()); |
|
445 | 465 | while (barIndex.isValid()) { |
|
446 | 466 | barSet->append(m_model->data(barIndex, Qt::DisplayRole).toDouble()); |
|
447 | 467 | posInBar++; |
|
448 | 468 | barIndex = barModelIndex(i, posInBar); |
|
449 | 469 | } |
|
450 | 470 | m_series->append(barSet); |
|
451 | 471 | } |
|
452 | 472 | blockSeriesSignals(false); |
|
453 | 473 | } |
|
454 | 474 | |
|
455 | 475 | #include "moc_qbarmodelmapper.cpp" |
|
456 | 476 | #include "moc_qbarmodelmapper_p.cpp" |
|
457 | 477 | |
|
458 | 478 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,59 +1,79 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
1 | 21 | #ifndef QBARMODELMAPPER_H |
|
2 | 22 | #define QBARMODELMAPPER_H |
|
3 | 23 | |
|
4 | 24 | #include "qchartglobal.h" |
|
5 | 25 | #include <QObject> |
|
6 | 26 | |
|
7 | 27 | class QAbstractItemModel; |
|
8 | 28 | |
|
9 | 29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
10 | 30 | |
|
11 | 31 | class QBarModelMapperPrivate; |
|
12 | 32 | class QBarSeries; |
|
13 | 33 | class QChart; |
|
14 | 34 | |
|
15 | 35 | class QTCOMMERCIALCHART_EXPORT QBarModelMapper : public QObject |
|
16 | 36 | { |
|
17 | 37 | Q_OBJECT |
|
18 | 38 | Q_PROPERTY(QBarSeries *series READ series WRITE setSeries) |
|
19 | 39 | Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel) |
|
20 | 40 | Q_PROPERTY(int first READ first WRITE setFirst) |
|
21 | 41 | Q_PROPERTY(int count READ count WRITE setCount) |
|
22 | 42 | Q_ENUMS(Qt::Orientation) |
|
23 | 43 | |
|
24 | 44 | protected: |
|
25 | 45 | explicit QBarModelMapper(QObject *parent = 0); |
|
26 | 46 | |
|
27 | 47 | public: |
|
28 | 48 | QAbstractItemModel* model() const; |
|
29 | 49 | void setModel(QAbstractItemModel *model); |
|
30 | 50 | |
|
31 | 51 | QBarSeries* series() const; |
|
32 | 52 | void setSeries(QBarSeries *series); |
|
33 | 53 | |
|
34 | 54 | int first() const; |
|
35 | 55 | void setFirst(int first); |
|
36 | 56 | |
|
37 | 57 | int count() const; |
|
38 | 58 | void setCount(int count); |
|
39 | 59 | |
|
40 | 60 | void reset(); |
|
41 | 61 | |
|
42 | 62 | protected: |
|
43 | 63 | int firstBarSetSection() const; |
|
44 | 64 | void setFirstBarSetSection(int firstBarSetSection); |
|
45 | 65 | |
|
46 | 66 | int lastBarSetSection() const; |
|
47 | 67 | void setLastBarSetSection(int lastBarSetSection); |
|
48 | 68 | |
|
49 | 69 | Qt::Orientation orientation() const; |
|
50 | 70 | void setOrientation(Qt::Orientation orientation); |
|
51 | 71 | |
|
52 | 72 | protected: |
|
53 | 73 | QBarModelMapperPrivate * const d_ptr; |
|
54 | 74 | Q_DECLARE_PRIVATE(QBarModelMapper) |
|
55 | 75 | }; |
|
56 | 76 | |
|
57 | 77 | QTCOMMERCIALCHART_END_NAMESPACE |
|
58 | 78 | |
|
59 | 79 | #endif // QBARMODELMAPPER_H |
@@ -1,61 +1,90 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
1 | 30 | #ifndef QBARMODELMAPPER_P_H |
|
2 | 31 | #define QBARMODELMAPPER_P_H |
|
3 | 32 | |
|
4 | 33 | #include "qchartglobal.h" |
|
5 | 34 | #include <QObject> |
|
6 | 35 | #include "qbarmodelmapper.h" |
|
7 | 36 | |
|
8 | 37 | class QModelIndex; |
|
9 | 38 | |
|
10 | 39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
11 | 40 | |
|
12 | 41 | class QBarSet; |
|
13 | 42 | |
|
14 | 43 | class QBarModelMapperPrivate : public QObject |
|
15 | 44 | { |
|
16 | 45 | Q_OBJECT |
|
17 | 46 | public: |
|
18 | 47 | explicit QBarModelMapperPrivate(QBarModelMapper *q); |
|
19 | 48 | |
|
20 | 49 | public Q_SLOTS: |
|
21 | 50 | // for the model |
|
22 | 51 | void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight); |
|
23 | 52 | void modelRowsAdded(QModelIndex parent, int start, int end); |
|
24 | 53 | void modelRowsRemoved(QModelIndex parent, int start, int end); |
|
25 | 54 | void modelColumnsAdded(QModelIndex parent, int start, int end); |
|
26 | 55 | void modelColumnsRemoved(QModelIndex parent, int start, int end); |
|
27 | 56 | |
|
28 | 57 | // // for the series |
|
29 | 58 | // void handlePointAdded(int pointPos); |
|
30 | 59 | // void handlePointRemoved(int pointPos); |
|
31 | 60 | // void handlePointReplaced(int pointPos); |
|
32 | 61 | |
|
33 | 62 | void initializeBarFromModel(); |
|
34 | 63 | |
|
35 | 64 | private: |
|
36 | 65 | QBarSet* barSet(QModelIndex index); |
|
37 | 66 | QModelIndex barModelIndex(int barSection, int posInBar); |
|
38 | 67 | void insertData(int start, int end); |
|
39 | 68 | void removeData(int start, int end); |
|
40 | 69 | void blockModelSignals(bool block = true); |
|
41 | 70 | void blockSeriesSignals(bool block = true); |
|
42 | 71 | |
|
43 | 72 | private: |
|
44 | 73 | QBarSeries *m_series; |
|
45 | 74 | QAbstractItemModel *m_model; |
|
46 | 75 | int m_first; |
|
47 | 76 | int m_count; |
|
48 | 77 | Qt::Orientation m_orientation; |
|
49 | 78 | int m_firstBarSetSection; |
|
50 | 79 | int m_lastBarSetSection; |
|
51 | 80 | bool m_seriesSignalsBlock; |
|
52 | 81 | bool m_modelSignalsBlock; |
|
53 | 82 | |
|
54 | 83 | private: |
|
55 | 84 | QBarModelMapper *q_ptr; |
|
56 | 85 | Q_DECLARE_PUBLIC(QBarModelMapper) |
|
57 | 86 | }; |
|
58 | 87 | |
|
59 | 88 | QTCOMMERCIALCHART_END_NAMESPACE |
|
60 | 89 | |
|
61 | 90 | #endif // QBARMODELMAPPER_P_H |
@@ -1,58 +1,78 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
1 | 21 | #include "qhbarmodelmapper.h" |
|
2 | 22 | |
|
3 | 23 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
4 | 24 | |
|
5 | 25 | /*! |
|
6 | 26 | \class QHBarModelMapper |
|
7 | 27 | \brief part of QtCommercial chart API. |
|
8 | 28 | \mainclass |
|
9 | 29 | |
|
10 | 30 | Nothing here yet |
|
11 | 31 | */ |
|
12 | 32 | |
|
13 | 33 | /*! |
|
14 | 34 | \property QHBarModelMapper::firstBarSetRow |
|
15 | 35 | \brief Defines which column of the model is used as the data source for the first bar set |
|
16 | 36 | |
|
17 | 37 | Default value is: -1 (invalid mapping) |
|
18 | 38 | */ |
|
19 | 39 | |
|
20 | 40 | /*! |
|
21 | 41 | \property QHBarModelMapper::lastBarSetRow |
|
22 | 42 | \brief Defines which column of the model is used as the data source for the last bar set |
|
23 | 43 | |
|
24 | 44 | Default value is: -1 (invalid mapping) |
|
25 | 45 | */ |
|
26 | 46 | |
|
27 | 47 | /*! |
|
28 | 48 | Constructs a mapper object which is a child of \a parent. |
|
29 | 49 | */ |
|
30 | 50 | QHBarModelMapper::QHBarModelMapper(QObject *parent) : |
|
31 | 51 | QBarModelMapper(parent) |
|
32 | 52 | { |
|
33 | 53 | QBarModelMapper::setOrientation(Qt::Horizontal); |
|
34 | 54 | } |
|
35 | 55 | |
|
36 | 56 | int QHBarModelMapper::firstBarSetRow() const |
|
37 | 57 | { |
|
38 | 58 | return QBarModelMapper::firstBarSetSection(); |
|
39 | 59 | } |
|
40 | 60 | |
|
41 | 61 | void QHBarModelMapper::setFirstBarSetRow(int firstBarSetRow) |
|
42 | 62 | { |
|
43 | 63 | return QBarModelMapper::setFirstBarSetSection(firstBarSetRow); |
|
44 | 64 | } |
|
45 | 65 | |
|
46 | 66 | int QHBarModelMapper::lastBarSetRow() const |
|
47 | 67 | { |
|
48 | 68 | return QBarModelMapper::lastBarSetSection(); |
|
49 | 69 | } |
|
50 | 70 | |
|
51 | 71 | void QHBarModelMapper::setLastBarSetRow(int lastBarSetRow) |
|
52 | 72 | { |
|
53 | 73 | return QBarModelMapper::setLastBarSetSection(lastBarSetRow); |
|
54 | 74 | } |
|
55 | 75 | |
|
56 | 76 | #include "moc_qhbarmodelmapper.cpp" |
|
57 | 77 | |
|
58 | 78 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,26 +1,46 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
1 | 21 | #ifndef QHBARMODELMAPPER_H |
|
2 | 22 | #define QHBARMODELMAPPER_H |
|
3 | 23 | |
|
4 | 24 | #include <QBarModelMapper> |
|
5 | 25 | |
|
6 | 26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
7 | 27 | |
|
8 | 28 | class QTCOMMERCIALCHART_EXPORT QHBarModelMapper : public QBarModelMapper |
|
9 | 29 | { |
|
10 | 30 | Q_OBJECT |
|
11 | 31 | Q_PROPERTY(int firstBarSetRow READ firstBarSetRow WRITE setFirstBarSetRow) |
|
12 | 32 | Q_PROPERTY(int lastBarSetRow READ lastBarSetRow WRITE setLastBarSetRow) |
|
13 | 33 | |
|
14 | 34 | public: |
|
15 | 35 | explicit QHBarModelMapper(QObject *parent = 0); |
|
16 | 36 | |
|
17 | 37 | int firstBarSetRow() const; |
|
18 | 38 | void setFirstBarSetRow(int firstBarSetRow); |
|
19 | 39 | |
|
20 | 40 | int lastBarSetRow() const; |
|
21 | 41 | void setLastBarSetRow(int lastBarSetRow); |
|
22 | 42 | }; |
|
23 | 43 | |
|
24 | 44 | QTCOMMERCIALCHART_END_NAMESPACE |
|
25 | 45 | |
|
26 | 46 | #endif // QHBARMODELMAPPER_H |
@@ -1,58 +1,78 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
1 | 21 | #include "qvbarmodelmapper.h" |
|
2 | 22 | |
|
3 | 23 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
4 | 24 | |
|
5 | 25 | /*! |
|
6 | 26 | \class QVBarModelMapper |
|
7 | 27 | \brief part of QtCommercial chart API. |
|
8 | 28 | \mainclass |
|
9 | 29 | |
|
10 | 30 | Nothing here yet |
|
11 | 31 | */ |
|
12 | 32 | |
|
13 | 33 | /*! |
|
14 | 34 | \property QVBarModelMapper::firstBarSetColumn |
|
15 | 35 | \brief Defines which column of the model is used as the data source for the first bar set |
|
16 | 36 | |
|
17 | 37 | Default value is: -1 (invalid mapping) |
|
18 | 38 | */ |
|
19 | 39 | |
|
20 | 40 | /*! |
|
21 | 41 | \property QVBarModelMapper::lastBarSetColumn |
|
22 | 42 | \brief Defines which column of the model is used as the data source for the last bar set |
|
23 | 43 | |
|
24 | 44 | Default value is: -1 (invalid mapping) |
|
25 | 45 | */ |
|
26 | 46 | |
|
27 | 47 | /*! |
|
28 | 48 | Constructs a mapper object which is a child of \a parent. |
|
29 | 49 | */ |
|
30 | 50 | QVBarModelMapper::QVBarModelMapper(QObject *parent) : |
|
31 | 51 | QBarModelMapper(parent) |
|
32 | 52 | { |
|
33 | 53 | QBarModelMapper::setOrientation(Qt::Vertical); |
|
34 | 54 | } |
|
35 | 55 | |
|
36 | 56 | int QVBarModelMapper::firstBarSetColumn() const |
|
37 | 57 | { |
|
38 | 58 | return QBarModelMapper::firstBarSetSection(); |
|
39 | 59 | } |
|
40 | 60 | |
|
41 | 61 | void QVBarModelMapper::setFirstBarSetColumn(int firstBarSetColumn) |
|
42 | 62 | { |
|
43 | 63 | return QBarModelMapper::setFirstBarSetSection(firstBarSetColumn); |
|
44 | 64 | } |
|
45 | 65 | |
|
46 | 66 | int QVBarModelMapper::lastBarSetColumn() const |
|
47 | 67 | { |
|
48 | 68 | return QBarModelMapper::lastBarSetSection(); |
|
49 | 69 | } |
|
50 | 70 | |
|
51 | 71 | void QVBarModelMapper::setLastBarSetColumn(int lastBarSetColumn) |
|
52 | 72 | { |
|
53 | 73 | return QBarModelMapper::setLastBarSetSection(lastBarSetColumn); |
|
54 | 74 | } |
|
55 | 75 | |
|
56 | 76 | #include "moc_qvbarmodelmapper.cpp" |
|
57 | 77 | |
|
58 | 78 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,26 +1,46 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
1 | 21 | #ifndef QVBARMODELMAPPER_H |
|
2 | 22 | #define QVBARMODELMAPPER_H |
|
3 | 23 | |
|
4 | 24 | #include <QBarModelMapper> |
|
5 | 25 | |
|
6 | 26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
7 | 27 | |
|
8 | 28 | class QTCOMMERCIALCHART_EXPORT QVBarModelMapper : public QBarModelMapper |
|
9 | 29 | { |
|
10 | 30 | Q_OBJECT |
|
11 | 31 | Q_PROPERTY(int firstBarSetColumn READ firstBarSetColumn WRITE setFirstBarSetColumn) |
|
12 | 32 | Q_PROPERTY(int lastBarSetColumn READ lastBarSetColumn WRITE setLastBarSetColumn) |
|
13 | 33 | |
|
14 | 34 | public: |
|
15 | 35 | explicit QVBarModelMapper(QObject *parent = 0); |
|
16 | 36 | |
|
17 | 37 | int firstBarSetColumn() const; |
|
18 | 38 | void setFirstBarSetColumn(int firstBarSetColumn); |
|
19 | 39 | |
|
20 | 40 | int lastBarSetColumn() const; |
|
21 | 41 | void setLastBarSetColumn(int lastBarSetColumn); |
|
22 | 42 | }; |
|
23 | 43 | |
|
24 | 44 | QTCOMMERCIALCHART_END_NAMESPACE |
|
25 | 45 | |
|
26 | 46 | #endif // QVBARMODELMAPPER_H |
@@ -1,57 +1,77 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
1 | 21 | #include "qhxymodelmapper.h" |
|
2 | 22 | |
|
3 | 23 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
4 | 24 | |
|
5 | 25 | /*! |
|
6 | 26 | \class QHXYModelMapper |
|
7 | 27 | \brief part of QtCommercial chart API. |
|
8 | 28 | \mainclass |
|
9 | 29 | |
|
10 | 30 | Nothing here yet |
|
11 | 31 | */ |
|
12 | 32 | |
|
13 | 33 | /*! |
|
14 | 34 | \property QHXYModelMapper::xRow |
|
15 | 35 | \brief Defines which row of the model is kept in sync with the x values of the QXYSeries |
|
16 | 36 | Default value is: -1 (invalid mapping) |
|
17 | 37 | */ |
|
18 | 38 | |
|
19 | 39 | /*! |
|
20 | 40 | \property QHXYModelMapper::yRow |
|
21 | 41 | \brief Defines which row of the model is kept in sync with the y values of the QXYSeries |
|
22 | 42 | |
|
23 | 43 | Default value is: -1 (invalid mapping) |
|
24 | 44 | */ |
|
25 | 45 | |
|
26 | 46 | /*! |
|
27 | 47 | Constructs a mapper object which is a child of \a parent. |
|
28 | 48 | */ |
|
29 | 49 | QHXYModelMapper::QHXYModelMapper(QObject *parent) : |
|
30 | 50 | QXYModelMapper(parent) |
|
31 | 51 | { |
|
32 | 52 | QXYModelMapper::setOrientation(Qt::Horizontal); |
|
33 | 53 | } |
|
34 | 54 | |
|
35 | 55 | int QHXYModelMapper::xRow() const |
|
36 | 56 | { |
|
37 | 57 | return QXYModelMapper::xSection(); |
|
38 | 58 | } |
|
39 | 59 | |
|
40 | 60 | void QHXYModelMapper::setXRow(int xRow) |
|
41 | 61 | { |
|
42 | 62 | return QXYModelMapper::setXSection(xRow); |
|
43 | 63 | } |
|
44 | 64 | |
|
45 | 65 | int QHXYModelMapper::yRow() const |
|
46 | 66 | { |
|
47 | 67 | return QXYModelMapper::ySection(); |
|
48 | 68 | } |
|
49 | 69 | |
|
50 | 70 | void QHXYModelMapper::setYRow(int yRow) |
|
51 | 71 | { |
|
52 | 72 | return QXYModelMapper::setYSection(yRow); |
|
53 | 73 | } |
|
54 | 74 | |
|
55 | 75 | #include "moc_qhxymodelmapper.cpp" |
|
56 | 76 | |
|
57 | 77 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,27 +1,47 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
1 | 21 | #ifndef QHXYMODELMAPPER_H |
|
2 | 22 | #define QHXYMODELMAPPER_H |
|
3 | 23 | |
|
4 | 24 | #include <QXYModelMapper> |
|
5 | 25 | |
|
6 | 26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
7 | 27 | |
|
8 | 28 | class QTCOMMERCIALCHART_EXPORT QHXYModelMapper : public QXYModelMapper |
|
9 | 29 | { |
|
10 | 30 | Q_OBJECT |
|
11 | 31 | Q_PROPERTY(int xRow READ xRow WRITE setXRow) |
|
12 | 32 | Q_PROPERTY(int yRow READ yRow WRITE setYRow) |
|
13 | 33 | |
|
14 | 34 | public: |
|
15 | 35 | explicit QHXYModelMapper(QObject *parent = 0); |
|
16 | 36 | |
|
17 | 37 | int xRow() const; |
|
18 | 38 | void setXRow(int xRow); |
|
19 | 39 | |
|
20 | 40 | int yRow() const; |
|
21 | 41 | void setYRow(int yRow); |
|
22 | 42 | |
|
23 | 43 | }; |
|
24 | 44 | |
|
25 | 45 | QTCOMMERCIALCHART_END_NAMESPACE |
|
26 | 46 | |
|
27 | 47 | #endif // QHXYMODELMAPPER_H |
@@ -1,58 +1,78 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
1 | 21 | #include "qvxymodelmapper.h" |
|
2 | 22 | |
|
3 | 23 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
4 | 24 | |
|
5 | 25 | /*! |
|
6 | 26 | \class QVXYModelMapper |
|
7 | 27 | \brief part of QtCommercial chart API. |
|
8 | 28 | \mainclass |
|
9 | 29 | |
|
10 | 30 | Nothing here yet |
|
11 | 31 | */ |
|
12 | 32 | |
|
13 | 33 | /*! |
|
14 | 34 | \property QVXYModelMapper::xColumn |
|
15 | 35 | \brief Defines which column of the model is kept in sync with the x values of QXYSeries |
|
16 | 36 | |
|
17 | 37 | Default value is: -1 (invalid mapping) |
|
18 | 38 | */ |
|
19 | 39 | |
|
20 | 40 | /*! |
|
21 | 41 | \property QVXYModelMapper::yColumn |
|
22 | 42 | \brief Defines which column of the model is kept in sync with the y values of QXYSeries |
|
23 | 43 | |
|
24 | 44 | Default value is: -1 (invalid mapping) |
|
25 | 45 | */ |
|
26 | 46 | |
|
27 | 47 | /*! |
|
28 | 48 | Constructs a mapper object which is a child of \a parent. |
|
29 | 49 | */ |
|
30 | 50 | QVXYModelMapper::QVXYModelMapper(QObject *parent) : |
|
31 | 51 | QXYModelMapper(parent) |
|
32 | 52 | { |
|
33 | 53 | QXYModelMapper::setOrientation(Qt::Vertical); |
|
34 | 54 | } |
|
35 | 55 | |
|
36 | 56 | int QVXYModelMapper::xColumn() const |
|
37 | 57 | { |
|
38 | 58 | return QXYModelMapper::xSection(); |
|
39 | 59 | } |
|
40 | 60 | |
|
41 | 61 | void QVXYModelMapper::setXColumn(int xColumn) |
|
42 | 62 | { |
|
43 | 63 | return QXYModelMapper::setXSection(xColumn); |
|
44 | 64 | } |
|
45 | 65 | |
|
46 | 66 | int QVXYModelMapper::yColumn() const |
|
47 | 67 | { |
|
48 | 68 | return QXYModelMapper::ySection(); |
|
49 | 69 | } |
|
50 | 70 | |
|
51 | 71 | void QVXYModelMapper::setYColumn(int yColumn) |
|
52 | 72 | { |
|
53 | 73 | return QXYModelMapper::setYSection(yColumn); |
|
54 | 74 | } |
|
55 | 75 | |
|
56 | 76 | #include "moc_qvxymodelmapper.cpp" |
|
57 | 77 | |
|
58 | 78 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,27 +1,47 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
1 | 21 | #ifndef QVXYMODELMAPPER_H |
|
2 | 22 | #define QVXYMODELMAPPER_H |
|
3 | 23 | |
|
4 | 24 | #include <QXYModelMapper> |
|
5 | 25 | |
|
6 | 26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
7 | 27 | |
|
8 | 28 | class QTCOMMERCIALCHART_EXPORT QVXYModelMapper : public QXYModelMapper |
|
9 | 29 | { |
|
10 | 30 | Q_OBJECT |
|
11 | 31 | Q_PROPERTY(int xColumn READ xColumn WRITE setXColumn) |
|
12 | 32 | Q_PROPERTY(int yColumn READ yColumn WRITE setYColumn) |
|
13 | 33 | |
|
14 | 34 | public: |
|
15 | 35 | explicit QVXYModelMapper(QObject *parent = 0); |
|
16 | 36 | |
|
17 | 37 | int xColumn() const; |
|
18 | 38 | void setXColumn(int xColumn); |
|
19 | 39 | |
|
20 | 40 | int yColumn() const; |
|
21 | 41 | void setYColumn(int yColumn); |
|
22 | 42 | |
|
23 | 43 | }; |
|
24 | 44 | |
|
25 | 45 | QTCOMMERCIALCHART_END_NAMESPACE |
|
26 | 46 | |
|
27 | 47 | #endif // QVXYMODELMAPPER_H |
@@ -1,501 +1,521 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
1 | 21 | #include "qxymodelmapper.h" |
|
2 | 22 | #include "qxymodelmapper_p.h" |
|
3 | 23 | #include "qxyseries.h" |
|
4 | 24 | #include <QAbstractItemModel> |
|
5 | 25 | |
|
6 | 26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
7 | 27 | |
|
8 | 28 | /*! |
|
9 | 29 | \property QXYModelMapper::series |
|
10 | 30 | \brief Defines the QPieSeries object that is used by the mapper. |
|
11 | 31 | |
|
12 | 32 | All the data in the series in the series is discarded when it is set to the mapper. |
|
13 | 33 | When new series is specified the old series is disconnected (it preserves its data) |
|
14 | 34 | */ |
|
15 | 35 | |
|
16 | 36 | /*! |
|
17 | 37 | \property QXYModelMapper::model |
|
18 | 38 | \brief Defines the model that is used by the mapper. |
|
19 | 39 | */ |
|
20 | 40 | |
|
21 | 41 | /*! |
|
22 | 42 | \property QXYModelMapper::first |
|
23 | 43 | \brief Defines which item of the model's row/column should be mapped as the first x/y pair |
|
24 | 44 | |
|
25 | 45 | Minimal and default value is: 0 |
|
26 | 46 | */ |
|
27 | 47 | |
|
28 | 48 | /*! |
|
29 | 49 | \property QXYModelMapper::count |
|
30 | 50 | \brief Defines the number of rows/columns of the model that are mapped as the data for QXYSeries |
|
31 | 51 | |
|
32 | 52 | Minimal and default value is: -1 (count limited by the number of rows/columns in the model) |
|
33 | 53 | */ |
|
34 | 54 | |
|
35 | 55 | /*! |
|
36 | 56 | \class QXYModelMapper |
|
37 | 57 | \brief part of QtCommercial chart API. |
|
38 | 58 | \mainclass |
|
39 | 59 | |
|
40 | 60 | The instance of this class cannot be created directly. QHXYModelMapper of QVXYModelMapper should be used instead. This class is used to create a connection between QXYSeries and QAbstractItemModel derived model object. |
|
41 | 61 | It is possible to use both QAbstractItemModel and QXYSeries model API. QXYModelMapper makes sure that QXYSeries and the model are kept in sync. |
|
42 | 62 | NOTE: used model has to support adding/removing rows/columns and modifying the data of the cells. |
|
43 | 63 | */ |
|
44 | 64 | |
|
45 | 65 | /*! |
|
46 | 66 | Constructs a mapper object which is a child of \a parent. |
|
47 | 67 | */ |
|
48 | 68 | QXYModelMapper::QXYModelMapper(QObject *parent): |
|
49 | 69 | QObject(parent), |
|
50 | 70 | d_ptr(new QXYModelMapperPrivate(this)) |
|
51 | 71 | { |
|
52 | 72 | } |
|
53 | 73 | |
|
54 | 74 | QAbstractItemModel* QXYModelMapper::model() const |
|
55 | 75 | { |
|
56 | 76 | Q_D(const QXYModelMapper); |
|
57 | 77 | return d->m_model; |
|
58 | 78 | } |
|
59 | 79 | |
|
60 | 80 | void QXYModelMapper::setModel(QAbstractItemModel *model) |
|
61 | 81 | { |
|
62 | 82 | if (model == 0) |
|
63 | 83 | return; |
|
64 | 84 | |
|
65 | 85 | Q_D(QXYModelMapper); |
|
66 | 86 | if (d->m_model) { |
|
67 | 87 | disconnect(d->m_model, 0, d, 0); |
|
68 | 88 | } |
|
69 | 89 | |
|
70 | 90 | d->m_model = model; |
|
71 | 91 | d->initializeXYFromModel(); |
|
72 | 92 | // connect signals from the model |
|
73 | 93 | connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex))); |
|
74 | 94 | connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int))); |
|
75 | 95 | connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int))); |
|
76 | 96 | connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int))); |
|
77 | 97 | connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int))); |
|
78 | 98 | } |
|
79 | 99 | |
|
80 | 100 | QXYSeries* QXYModelMapper::series() const |
|
81 | 101 | { |
|
82 | 102 | Q_D(const QXYModelMapper); |
|
83 | 103 | return d->m_series; |
|
84 | 104 | } |
|
85 | 105 | |
|
86 | 106 | void QXYModelMapper::setSeries(QXYSeries *series) |
|
87 | 107 | { |
|
88 | 108 | Q_D(QXYModelMapper); |
|
89 | 109 | if (d->m_series) { |
|
90 | 110 | disconnect(d->m_series, 0, d, 0); |
|
91 | 111 | } |
|
92 | 112 | |
|
93 | 113 | if (series == 0) |
|
94 | 114 | return; |
|
95 | 115 | |
|
96 | 116 | d->m_series = series; |
|
97 | 117 | d->initializeXYFromModel(); |
|
98 | 118 | // connect the signals from the series |
|
99 | 119 | connect(d->m_series, SIGNAL(pointAdded(int)), d, SLOT(handlePointAdded(int))); |
|
100 | 120 | connect(d->m_series, SIGNAL(pointRemoved(int)), d, SLOT(handlePointRemoved(int))); |
|
101 | 121 | connect(d->m_series, SIGNAL(pointReplaced(int)), d, SLOT(handlePointReplaced(int))); |
|
102 | 122 | } |
|
103 | 123 | |
|
104 | 124 | int QXYModelMapper::first() const |
|
105 | 125 | { |
|
106 | 126 | Q_D(const QXYModelMapper); |
|
107 | 127 | return d->m_first; |
|
108 | 128 | } |
|
109 | 129 | |
|
110 | 130 | void QXYModelMapper::setFirst(int first) |
|
111 | 131 | { |
|
112 | 132 | Q_D(QXYModelMapper); |
|
113 | 133 | d->m_first = qMax(first, 0); |
|
114 | 134 | d->initializeXYFromModel(); |
|
115 | 135 | } |
|
116 | 136 | |
|
117 | 137 | int QXYModelMapper::count() const |
|
118 | 138 | { |
|
119 | 139 | Q_D(const QXYModelMapper); |
|
120 | 140 | return d->m_count; |
|
121 | 141 | } |
|
122 | 142 | |
|
123 | 143 | void QXYModelMapper::setCount(int count) |
|
124 | 144 | { |
|
125 | 145 | Q_D(QXYModelMapper); |
|
126 | 146 | d->m_count = qMax(count, -1); |
|
127 | 147 | d->initializeXYFromModel(); |
|
128 | 148 | } |
|
129 | 149 | |
|
130 | 150 | /*! |
|
131 | 151 | Returns the orientation that is used when QXYModelMapper accesses the model. |
|
132 | 152 | This mean whether the consecutive x/y values of the QXYSeries are read from rows (Qt::Horizontal) |
|
133 | 153 | or from columns (Qt::Vertical) |
|
134 | 154 | */ |
|
135 | 155 | Qt::Orientation QXYModelMapper::orientation() const |
|
136 | 156 | { |
|
137 | 157 | Q_D(const QXYModelMapper); |
|
138 | 158 | return d->m_orientation; |
|
139 | 159 | } |
|
140 | 160 | |
|
141 | 161 | /*! |
|
142 | 162 | Returns the \a orientation that is used when QXYModelMapper accesses the model. |
|
143 | 163 | This mean whether the consecutive x/y values of the QXYSeries are read from rows (Qt::Horizontal) |
|
144 | 164 | or from columns (Qt::Vertical) |
|
145 | 165 | */ |
|
146 | 166 | void QXYModelMapper::setOrientation(Qt::Orientation orientation) |
|
147 | 167 | { |
|
148 | 168 | Q_D(QXYModelMapper); |
|
149 | 169 | d->m_orientation = orientation; |
|
150 | 170 | d->initializeXYFromModel(); |
|
151 | 171 | } |
|
152 | 172 | |
|
153 | 173 | /*! |
|
154 | 174 | Returns which section of the model is kept in sync with the x values of the QXYSeries |
|
155 | 175 | */ |
|
156 | 176 | int QXYModelMapper::xSection() const |
|
157 | 177 | { |
|
158 | 178 | Q_D(const QXYModelMapper); |
|
159 | 179 | return d->m_xSection; |
|
160 | 180 | } |
|
161 | 181 | |
|
162 | 182 | /*! |
|
163 | 183 | Sets the model section that is kept in sync with the x values of the QXYSeries. |
|
164 | 184 | Parameter \a xSection specifies the section of the model. |
|
165 | 185 | */ |
|
166 | 186 | void QXYModelMapper::setXSection(int xSection) |
|
167 | 187 | { |
|
168 | 188 | Q_D(QXYModelMapper); |
|
169 | 189 | d->m_xSection = qMax(-1, xSection); |
|
170 | 190 | d->initializeXYFromModel(); |
|
171 | 191 | } |
|
172 | 192 | |
|
173 | 193 | /*! |
|
174 | 194 | Returns which section of the model is kept in sync with the y values of the QXYSeries |
|
175 | 195 | */ |
|
176 | 196 | int QXYModelMapper::ySection() const |
|
177 | 197 | { |
|
178 | 198 | Q_D(const QXYModelMapper); |
|
179 | 199 | return d->m_ySection; |
|
180 | 200 | } |
|
181 | 201 | |
|
182 | 202 | /*! |
|
183 | 203 | Sets the model section that is kept in sync with the y values of the QXYSeries. |
|
184 | 204 | Parameter \a ySection specifies the section of the model. |
|
185 | 205 | */ |
|
186 | 206 | void QXYModelMapper::setYSection(int ySection) |
|
187 | 207 | { |
|
188 | 208 | Q_D(QXYModelMapper); |
|
189 | 209 | d->m_ySection = qMax(-1, ySection); |
|
190 | 210 | d->initializeXYFromModel(); |
|
191 | 211 | } |
|
192 | 212 | |
|
193 | 213 | /*! |
|
194 | 214 | Resets the QXYModelMapper to the default state. |
|
195 | 215 | first: 0; count: -1; xSection: -1; ySection: -1; |
|
196 | 216 | */ |
|
197 | 217 | void QXYModelMapper::reset() |
|
198 | 218 | { |
|
199 | 219 | Q_D(QXYModelMapper); |
|
200 | 220 | d->m_first = 0; |
|
201 | 221 | d->m_count = -1; |
|
202 | 222 | d->m_orientation = Qt::Vertical; |
|
203 | 223 | d->m_xSection = -1; |
|
204 | 224 | d->m_ySection = -1; |
|
205 | 225 | d->initializeXYFromModel(); |
|
206 | 226 | } |
|
207 | 227 | |
|
208 | 228 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
209 | 229 | |
|
210 | 230 | QXYModelMapperPrivate::QXYModelMapperPrivate(QXYModelMapper *q) : |
|
211 | 231 | m_series(0), |
|
212 | 232 | m_model(0), |
|
213 | 233 | m_first(0), |
|
214 | 234 | m_count(-1), |
|
215 | 235 | m_orientation(Qt::Vertical), |
|
216 | 236 | m_xSection(-1), |
|
217 | 237 | m_ySection(-1), |
|
218 | 238 | m_seriesSignalsBlock(false), |
|
219 | 239 | m_modelSignalsBlock(false), |
|
220 | 240 | q_ptr(q) |
|
221 | 241 | { |
|
222 | 242 | } |
|
223 | 243 | |
|
224 | 244 | void QXYModelMapperPrivate::blockModelSignals(bool block) |
|
225 | 245 | { |
|
226 | 246 | m_modelSignalsBlock = block; |
|
227 | 247 | } |
|
228 | 248 | |
|
229 | 249 | void QXYModelMapperPrivate::blockSeriesSignals(bool block) |
|
230 | 250 | { |
|
231 | 251 | m_seriesSignalsBlock = block; |
|
232 | 252 | } |
|
233 | 253 | |
|
234 | 254 | QModelIndex QXYModelMapperPrivate::xModelIndex(int xPos) |
|
235 | 255 | { |
|
236 | 256 | if (m_count != -1 && xPos >= m_count) |
|
237 | 257 | return QModelIndex(); // invalid |
|
238 | 258 | |
|
239 | 259 | if (m_orientation == Qt::Vertical) |
|
240 | 260 | return m_model->index(xPos + m_first, m_xSection); |
|
241 | 261 | else |
|
242 | 262 | return m_model->index(m_xSection, xPos + m_first); |
|
243 | 263 | } |
|
244 | 264 | |
|
245 | 265 | QModelIndex QXYModelMapperPrivate::yModelIndex(int yPos) |
|
246 | 266 | { |
|
247 | 267 | if (m_count != -1 && yPos >= m_count) |
|
248 | 268 | return QModelIndex(); // invalid |
|
249 | 269 | |
|
250 | 270 | if (m_orientation == Qt::Vertical) |
|
251 | 271 | return m_model->index(yPos + m_first, m_ySection); |
|
252 | 272 | else |
|
253 | 273 | return m_model->index(m_ySection, yPos + m_first); |
|
254 | 274 | } |
|
255 | 275 | |
|
256 | 276 | void QXYModelMapperPrivate::handlePointAdded(int pointPos) |
|
257 | 277 | { |
|
258 | 278 | if (m_seriesSignalsBlock) |
|
259 | 279 | return; |
|
260 | 280 | |
|
261 | 281 | if (m_count != -1) |
|
262 | 282 | m_count += 1; |
|
263 | 283 | |
|
264 | 284 | blockModelSignals(); |
|
265 | 285 | if (m_orientation == Qt::Vertical) |
|
266 | 286 | m_model->insertRows(pointPos + m_first, 1); |
|
267 | 287 | else |
|
268 | 288 | m_model->insertColumns(pointPos + m_first, 1); |
|
269 | 289 | |
|
270 | 290 | m_model->setData(xModelIndex(pointPos), m_series->points().at(pointPos).x()); |
|
271 | 291 | m_model->setData(yModelIndex(pointPos), m_series->points().at(pointPos).y()); |
|
272 | 292 | blockModelSignals(false); |
|
273 | 293 | } |
|
274 | 294 | |
|
275 | 295 | void QXYModelMapperPrivate::handlePointRemoved(int pointPos) |
|
276 | 296 | { |
|
277 | 297 | if (m_seriesSignalsBlock) |
|
278 | 298 | return; |
|
279 | 299 | |
|
280 | 300 | if (m_count != -1) |
|
281 | 301 | m_count -= 1; |
|
282 | 302 | |
|
283 | 303 | blockModelSignals(); |
|
284 | 304 | if (m_orientation == Qt::Vertical) |
|
285 | 305 | m_model->removeRow(pointPos + m_first); |
|
286 | 306 | else |
|
287 | 307 | m_model->removeColumn(pointPos + m_first); |
|
288 | 308 | blockModelSignals(false); |
|
289 | 309 | } |
|
290 | 310 | |
|
291 | 311 | void QXYModelMapperPrivate::handlePointReplaced(int pointPos) |
|
292 | 312 | { |
|
293 | 313 | if (m_seriesSignalsBlock) |
|
294 | 314 | return; |
|
295 | 315 | |
|
296 | 316 | blockModelSignals(); |
|
297 | 317 | m_model->setData(xModelIndex(pointPos), m_series->points().at(pointPos).x()); |
|
298 | 318 | m_model->setData(yModelIndex(pointPos), m_series->points().at(pointPos).y()); |
|
299 | 319 | blockModelSignals(false); |
|
300 | 320 | } |
|
301 | 321 | |
|
302 | 322 | void QXYModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) |
|
303 | 323 | { |
|
304 | 324 | if (m_model == 0 || m_series == 0) |
|
305 | 325 | return; |
|
306 | 326 | |
|
307 | 327 | if (m_modelSignalsBlock) |
|
308 | 328 | return; |
|
309 | 329 | |
|
310 | 330 | blockSeriesSignals(); |
|
311 | 331 | QModelIndex index; |
|
312 | 332 | QPointF oldPoint; |
|
313 | 333 | QPointF newPoint; |
|
314 | 334 | for (int row = topLeft.row(); row <= bottomRight.row(); row++) { |
|
315 | 335 | for (int column = topLeft.column(); column <= bottomRight.column(); column++) { |
|
316 | 336 | index = topLeft.sibling(row, column); |
|
317 | 337 | if (m_orientation == Qt::Vertical && (index.column() == m_xSection || index.column() == m_ySection)) { |
|
318 | 338 | if (index.row() >= m_first && (m_count == - 1 || index.row() < m_first + m_count)) { |
|
319 | 339 | QModelIndex xIndex = xModelIndex(index.row() - m_first); |
|
320 | 340 | QModelIndex yIndex = yModelIndex(index.row() - m_first); |
|
321 | 341 | if (xIndex.isValid() && yIndex.isValid()) { |
|
322 | 342 | oldPoint = m_series->points().at(index.row() - m_first); |
|
323 | 343 | newPoint.setX(m_model->data(xIndex).toReal()); |
|
324 | 344 | newPoint.setY(m_model->data(yIndex).toReal()); |
|
325 | 345 | } |
|
326 | 346 | } |
|
327 | 347 | } else if (m_orientation == Qt::Horizontal && (index.row() == m_xSection || index.row() == m_ySection)) { |
|
328 | 348 | if (index.column() >= m_first && (m_count == - 1 || index.column() < m_first + m_count)) { |
|
329 | 349 | QModelIndex xIndex = xModelIndex(index.column() - m_first); |
|
330 | 350 | QModelIndex yIndex = yModelIndex(index.column() - m_first); |
|
331 | 351 | if (xIndex.isValid() && yIndex.isValid()) { |
|
332 | 352 | oldPoint = m_series->points().at(index.column() - m_first); |
|
333 | 353 | newPoint.setX(m_model->data(xIndex).toReal()); |
|
334 | 354 | newPoint.setY(m_model->data(yIndex).toReal()); |
|
335 | 355 | } |
|
336 | 356 | } |
|
337 | 357 | } else { |
|
338 | 358 | continue; |
|
339 | 359 | } |
|
340 | 360 | m_series->replace(oldPoint, newPoint); |
|
341 | 361 | } |
|
342 | 362 | } |
|
343 | 363 | blockSeriesSignals(false); |
|
344 | 364 | } |
|
345 | 365 | |
|
346 | 366 | void QXYModelMapperPrivate::modelRowsAdded(QModelIndex parent, int start, int end) |
|
347 | 367 | { |
|
348 | 368 | Q_UNUSED(parent); |
|
349 | 369 | if (m_modelSignalsBlock) |
|
350 | 370 | return; |
|
351 | 371 | |
|
352 | 372 | blockSeriesSignals(); |
|
353 | 373 | if (m_orientation == Qt::Vertical) |
|
354 | 374 | insertData(start, end); |
|
355 | 375 | else if (start <= m_xSection || start <= m_ySection) // if the changes affect the map - reinitialize the xy |
|
356 | 376 | initializeXYFromModel(); |
|
357 | 377 | blockSeriesSignals(false); |
|
358 | 378 | } |
|
359 | 379 | |
|
360 | 380 | void QXYModelMapperPrivate::modelRowsRemoved(QModelIndex parent, int start, int end) |
|
361 | 381 | { |
|
362 | 382 | Q_UNUSED(parent); |
|
363 | 383 | if (m_modelSignalsBlock) |
|
364 | 384 | return; |
|
365 | 385 | |
|
366 | 386 | blockSeriesSignals(); |
|
367 | 387 | if (m_orientation == Qt::Vertical) |
|
368 | 388 | removeData(start, end); |
|
369 | 389 | else if (start <= m_xSection || start <= m_ySection) // if the changes affect the map - reinitialize the xy |
|
370 | 390 | initializeXYFromModel(); |
|
371 | 391 | blockSeriesSignals(false); |
|
372 | 392 | } |
|
373 | 393 | |
|
374 | 394 | void QXYModelMapperPrivate::modelColumnsAdded(QModelIndex parent, int start, int end) |
|
375 | 395 | { |
|
376 | 396 | Q_UNUSED(parent); |
|
377 | 397 | if (m_modelSignalsBlock) |
|
378 | 398 | return; |
|
379 | 399 | |
|
380 | 400 | blockSeriesSignals(); |
|
381 | 401 | if (m_orientation == Qt::Horizontal) |
|
382 | 402 | insertData(start, end); |
|
383 | 403 | else if (start <= m_xSection || start <= m_ySection) // if the changes affect the map - reinitialize the xy |
|
384 | 404 | initializeXYFromModel(); |
|
385 | 405 | blockSeriesSignals(false); |
|
386 | 406 | } |
|
387 | 407 | |
|
388 | 408 | void QXYModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end) |
|
389 | 409 | { |
|
390 | 410 | Q_UNUSED(parent); |
|
391 | 411 | if (m_modelSignalsBlock) |
|
392 | 412 | return; |
|
393 | 413 | |
|
394 | 414 | blockSeriesSignals(); |
|
395 | 415 | if (m_orientation == Qt::Horizontal) |
|
396 | 416 | removeData(start, end); |
|
397 | 417 | else if (start <= m_xSection || start <= m_ySection) // if the changes affect the map - reinitialize the xy |
|
398 | 418 | initializeXYFromModel(); |
|
399 | 419 | blockSeriesSignals(false); |
|
400 | 420 | } |
|
401 | 421 | |
|
402 | 422 | void QXYModelMapperPrivate::insertData(int start, int end) |
|
403 | 423 | { |
|
404 | 424 | if (m_model == 0 || m_series == 0) |
|
405 | 425 | return; |
|
406 | 426 | |
|
407 | 427 | if (m_count != -1 && start >= m_first + m_count) { |
|
408 | 428 | return; |
|
409 | 429 | } else { |
|
410 | 430 | int addedCount = end - start + 1; |
|
411 | 431 | if (m_count != -1 && addedCount > m_count) |
|
412 | 432 | addedCount = m_count; |
|
413 | 433 | int first = qMax(start, m_first); |
|
414 | 434 | int last = qMin(first + addedCount - 1, m_orientation == Qt::Vertical ? m_model->rowCount() - 1 : m_model->columnCount() - 1); |
|
415 | 435 | for (int i = first; i <= last; i++) { |
|
416 | 436 | QPointF point; |
|
417 | 437 | QModelIndex xIndex = xModelIndex(i - m_first); |
|
418 | 438 | QModelIndex yIndex = yModelIndex(i - m_first); |
|
419 | 439 | if (xIndex.isValid() && yIndex.isValid()) { |
|
420 | 440 | point.setX(m_model->data(xIndex, Qt::DisplayRole).toDouble()); |
|
421 | 441 | point.setY(m_model->data(yIndex, Qt::DisplayRole).toDouble()); |
|
422 | 442 | m_series->insert(i - m_first, point); |
|
423 | 443 | } |
|
424 | 444 | } |
|
425 | 445 | |
|
426 | 446 | // remove excess of slices (abouve m_count) |
|
427 | 447 | if (m_count != -1 && m_series->points().size() > m_count) |
|
428 | 448 | for (int i = m_series->points().size() - 1; i >= m_count; i--) { |
|
429 | 449 | m_series->remove(m_series->points().at(i)); |
|
430 | 450 | } |
|
431 | 451 | } |
|
432 | 452 | } |
|
433 | 453 | |
|
434 | 454 | void QXYModelMapperPrivate::removeData(int start, int end) |
|
435 | 455 | { |
|
436 | 456 | if (m_model == 0 || m_series == 0) |
|
437 | 457 | return; |
|
438 | 458 | |
|
439 | 459 | int removedCount = end - start + 1; |
|
440 | 460 | if (m_count != -1 && start >= m_first + m_count) { |
|
441 | 461 | return; |
|
442 | 462 | } else { |
|
443 | 463 | int toRemove = qMin(m_series->count(), removedCount); // first find how many items can actually be removed |
|
444 | 464 | int first = qMax(start, m_first); // get the index of the first item that will be removed. |
|
445 | 465 | int last = qMin(first + toRemove - 1, m_series->count() + m_first - 1); // get the index of the last item that will be removed. |
|
446 | 466 | for (int i = last; i >= first; i--) { |
|
447 | 467 | m_series->remove(m_series->points().at(i - m_first)); |
|
448 | 468 | } |
|
449 | 469 | |
|
450 | 470 | if (m_count != -1) { |
|
451 | 471 | int itemsAvailable; // check how many are available to be added |
|
452 | 472 | if (m_orientation == Qt::Vertical) |
|
453 | 473 | itemsAvailable = m_model->rowCount() - m_first - m_series->count(); |
|
454 | 474 | else |
|
455 | 475 | itemsAvailable = m_model->columnCount() - m_first - m_series->count(); |
|
456 | 476 | int toBeAdded = qMin(itemsAvailable, m_count - m_series->count()); // add not more items than there is space left to be filled. |
|
457 | 477 | int currentSize = m_series->count(); |
|
458 | 478 | if (toBeAdded > 0) |
|
459 | 479 | for (int i = m_series->count(); i < currentSize + toBeAdded; i++) { |
|
460 | 480 | QPointF point; |
|
461 | 481 | QModelIndex xIndex = xModelIndex(i); |
|
462 | 482 | QModelIndex yIndex = yModelIndex(i); |
|
463 | 483 | if (xIndex.isValid() && yIndex.isValid()) { |
|
464 | 484 | point.setX(m_model->data(xIndex, Qt::DisplayRole).toDouble()); |
|
465 | 485 | point.setY(m_model->data(yIndex, Qt::DisplayRole).toDouble()); |
|
466 | 486 | m_series->insert(i, point); |
|
467 | 487 | } |
|
468 | 488 | } |
|
469 | 489 | } |
|
470 | 490 | } |
|
471 | 491 | } |
|
472 | 492 | |
|
473 | 493 | void QXYModelMapperPrivate::initializeXYFromModel() |
|
474 | 494 | { |
|
475 | 495 | if (m_model == 0 || m_series == 0) |
|
476 | 496 | return; |
|
477 | 497 | |
|
478 | 498 | blockSeriesSignals(); |
|
479 | 499 | // clear current content |
|
480 | 500 | m_series->clear(); |
|
481 | 501 | |
|
482 | 502 | // create the initial slices set |
|
483 | 503 | int pointPos = 0; |
|
484 | 504 | QModelIndex xIndex = xModelIndex(pointPos); |
|
485 | 505 | QModelIndex yIndex = yModelIndex(pointPos); |
|
486 | 506 | while (xIndex.isValid() && yIndex.isValid()) { |
|
487 | 507 | QPointF point; |
|
488 | 508 | point.setX(m_model->data(xIndex, Qt::DisplayRole).toDouble()); |
|
489 | 509 | point.setY(m_model->data(yIndex, Qt::DisplayRole).toDouble()); |
|
490 | 510 | m_series->append(point); |
|
491 | 511 | pointPos++; |
|
492 | 512 | xIndex = xModelIndex(pointPos); |
|
493 | 513 | yIndex = yModelIndex(pointPos); |
|
494 | 514 | } |
|
495 | 515 | blockSeriesSignals(false); |
|
496 | 516 | } |
|
497 | 517 | |
|
498 | 518 | #include "moc_qxymodelmapper.cpp" |
|
499 | 519 | #include "moc_qxymodelmapper_p.cpp" |
|
500 | 520 | |
|
501 | 521 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,57 +1,78 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
1 | 21 | #ifndef QXYMODELMAPPER_H |
|
2 | 22 | #define QXYMODELMAPPER_H |
|
3 | 23 | |
|
4 | 24 | #include "qchartglobal.h" |
|
5 | 25 | #include <QObject> |
|
6 | 26 | |
|
7 | 27 | class QAbstractItemModel; |
|
8 | 28 | |
|
9 | 29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
10 | 30 | |
|
11 | 31 | class QXYModelMapperPrivate; |
|
12 | 32 | class QXYSeries; |
|
13 | 33 | |
|
14 | 34 | class QTCOMMERCIALCHART_EXPORT QXYModelMapper : public QObject |
|
15 | 35 | { |
|
16 | 36 | Q_OBJECT |
|
17 | 37 | Q_PROPERTY(QXYSeries *series READ series WRITE setSeries) |
|
18 | 38 | Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel) |
|
19 | 39 | Q_PROPERTY(int first READ first WRITE setFirst) |
|
20 | 40 | Q_PROPERTY(int count READ count WRITE setCount) |
|
21 | 41 | Q_ENUMS(Qt::Orientation) |
|
22 | 42 | |
|
43 | protected: | |
|
44 | explicit QXYModelMapper(QObject *parent = 0); | |
|
45 | ||
|
23 | 46 | public: |
|
24 | 47 | QAbstractItemModel* model() const; |
|
25 | 48 | void setModel(QAbstractItemModel *model); |
|
26 | 49 | |
|
27 | 50 | QXYSeries* series() const; |
|
28 | 51 | void setSeries(QXYSeries *series); |
|
29 | 52 | |
|
30 | 53 | int first() const; |
|
31 | 54 | void setFirst(int first); |
|
32 | 55 | |
|
33 | 56 | int count() const; |
|
34 | 57 | void setCount(int count); |
|
35 | 58 | |
|
36 | 59 | void reset(); |
|
37 | 60 | |
|
38 | 61 | protected: |
|
39 | explicit QXYModelMapper(QObject *parent = 0); | |
|
40 | ||
|
41 | 62 | Qt::Orientation orientation() const; |
|
42 | 63 | void setOrientation(Qt::Orientation orientation); |
|
43 | 64 | |
|
44 | 65 | int xSection() const; |
|
45 | 66 | void setXSection(int xSection); |
|
46 | 67 | |
|
47 | 68 | int ySection() const; |
|
48 | 69 | void setYSection(int ySection); |
|
49 | 70 | |
|
50 | 71 | protected: |
|
51 | 72 | QXYModelMapperPrivate * const d_ptr; |
|
52 | 73 | Q_DECLARE_PRIVATE(QXYModelMapper) |
|
53 | 74 | }; |
|
54 | 75 | |
|
55 | 76 | QTCOMMERCIALCHART_END_NAMESPACE |
|
56 | 77 | |
|
57 | 78 | #endif // QXYMODELMAPPER_H |
@@ -1,64 +1,93 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | // W A R N I N G | |
|
22 | // ------------- | |
|
23 | // | |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
25 | // implementation detail. This header file may change from version to | |
|
26 | // version without notice, or even be removed. | |
|
27 | // | |
|
28 | // We mean it. | |
|
29 | ||
|
1 | 30 | #ifndef QXYMODELMAPPER_P_H |
|
2 | 31 | #define QXYMODELMAPPER_P_H |
|
3 | 32 | |
|
4 | 33 | #include "qxymodelmapper.h" |
|
5 | 34 | #include <QObject> |
|
6 | 35 | |
|
7 | 36 | class QModelIndex; |
|
8 | 37 | class QAbstractItemModel; |
|
9 | 38 | class QPointF; |
|
10 | 39 | |
|
11 | 40 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
12 | 41 | |
|
13 | 42 | class QXYModelMapper; |
|
14 | 43 | class QXYSeries; |
|
15 | 44 | |
|
16 | 45 | class QXYModelMapperPrivate : public QObject |
|
17 | 46 | { |
|
18 | 47 | Q_OBJECT |
|
19 | 48 | |
|
20 | 49 | public: |
|
21 | 50 | QXYModelMapperPrivate(QXYModelMapper *q); |
|
22 | 51 | |
|
23 | 52 | public Q_SLOTS: |
|
24 | 53 | // for the model |
|
25 | 54 | void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight); |
|
26 | 55 | void modelRowsAdded(QModelIndex parent, int start, int end); |
|
27 | 56 | void modelRowsRemoved(QModelIndex parent, int start, int end); |
|
28 | 57 | void modelColumnsAdded(QModelIndex parent, int start, int end); |
|
29 | 58 | void modelColumnsRemoved(QModelIndex parent, int start, int end); |
|
30 | 59 | |
|
31 | 60 | // for the series |
|
32 | 61 | void handlePointAdded(int pointPos); |
|
33 | 62 | void handlePointRemoved(int pointPos); |
|
34 | 63 | void handlePointReplaced(int pointPos); |
|
35 | 64 | |
|
36 | 65 | void initializeXYFromModel(); |
|
37 | 66 | |
|
38 | 67 | private: |
|
39 | 68 | QModelIndex xModelIndex(int xPos); |
|
40 | 69 | QModelIndex yModelIndex(int yPos); |
|
41 | 70 | void insertData(int start, int end); |
|
42 | 71 | void removeData(int start, int end); |
|
43 | 72 | void blockModelSignals(bool block = true); |
|
44 | 73 | void blockSeriesSignals(bool block = true); |
|
45 | 74 | |
|
46 | 75 | private: |
|
47 | 76 | QXYSeries *m_series; |
|
48 | 77 | QAbstractItemModel *m_model; |
|
49 | 78 | int m_first; |
|
50 | 79 | int m_count; |
|
51 | 80 | Qt::Orientation m_orientation; |
|
52 | 81 | int m_xSection; |
|
53 | 82 | int m_ySection; |
|
54 | 83 | bool m_seriesSignalsBlock; |
|
55 | 84 | bool m_modelSignalsBlock; |
|
56 | 85 | |
|
57 | 86 | private: |
|
58 | 87 | QXYModelMapper *q_ptr; |
|
59 | 88 | Q_DECLARE_PUBLIC(QXYModelMapper) |
|
60 | 89 | }; |
|
61 | 90 | |
|
62 | 91 | QTCOMMERCIALCHART_END_NAMESPACE |
|
63 | 92 | |
|
64 | 93 | #endif // QXYMODELMAPPER_P_H |
General Comments 0
You need to be logged in to leave comments.
Login now