##// END OF EJS Templates
QBarSeries to QAbstractBarSeries
sauimone -
r1584:900775017aef
parent child
Show More
@@ -61,7 +61,7 void DeclarativeBarSet::setValues(QVariantList values)
61 }
61 }
62
62
63 DeclarativeBarSeries::DeclarativeBarSeries(QDeclarativeItem *parent) :
63 DeclarativeBarSeries::DeclarativeBarSeries(QDeclarativeItem *parent) :
64 QBarSeries(parent)
64 QAbstractBarSeries(parent)
65 {
65 {
66 connect(this, SIGNAL(barsetsAdded(QList<QBarSet*>)), this, SLOT(handleAdded(QList<QBarSet*>)));
66 connect(this, SIGNAL(barsetsAdded(QList<QBarSet*>)), this, SLOT(handleAdded(QList<QBarSet*>)));
67 connect(this, SIGNAL(barsetsRemoved(QList<QBarSet*>)), this, SLOT(handleRemoved(QList<QBarSet*>)));
67 connect(this, SIGNAL(barsetsRemoved(QList<QBarSet*>)), this, SLOT(handleRemoved(QList<QBarSet*>)));
@@ -91,7 +91,7 void DeclarativeBarSeries::componentComplete()
91 {
91 {
92 foreach(QObject *child, children()) {
92 foreach(QObject *child, children()) {
93 if (qobject_cast<DeclarativeBarSet *>(child)) {
93 if (qobject_cast<DeclarativeBarSet *>(child)) {
94 QBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
94 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
95 } else if (qobject_cast<QVBarModelMapper *>(child)) {
95 } else if (qobject_cast<QVBarModelMapper *>(child)) {
96 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
96 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
97 mapper->setSeries(this);
97 mapper->setSeries(this);
@@ -154,7 +154,7 DeclarativeBarSet *DeclarativeBarSeries::insert(int index, QString label, QVaria
154 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
154 DeclarativeBarSet *barset = new DeclarativeBarSet(this);
155 barset->setLabel(label);
155 barset->setLabel(label);
156 barset->setValues(values);
156 barset->setValues(values);
157 if (QBarSeries::insert(insertIndex, barset))
157 if (QAbstractBarSeries::insert(insertIndex, barset))
158 return barset;
158 return barset;
159 delete barset;
159 delete barset;
160 return 0;
160 return 0;
@@ -173,7 +173,7 void DeclarativeGroupedBarSeries::componentComplete()
173 {
173 {
174 foreach(QObject *child, children()) {
174 foreach(QObject *child, children()) {
175 if (qobject_cast<DeclarativeBarSet *>(child)) {
175 if (qobject_cast<DeclarativeBarSet *>(child)) {
176 QBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
176 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
177 } else if(qobject_cast<QVBarModelMapper *>(child)) {
177 } else if(qobject_cast<QVBarModelMapper *>(child)) {
178 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
178 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
179 mapper->setSeries(this);
179 mapper->setSeries(this);
@@ -249,7 +249,7 void DeclarativeStackedBarSeries::componentComplete()
249 {
249 {
250 foreach(QObject *child, children()) {
250 foreach(QObject *child, children()) {
251 if (qobject_cast<DeclarativeBarSet *>(child)) {
251 if (qobject_cast<DeclarativeBarSet *>(child)) {
252 QBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
252 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
253 } else if(qobject_cast<QVBarModelMapper *>(child)) {
253 } else if(qobject_cast<QVBarModelMapper *>(child)) {
254 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
254 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
255 mapper->setSeries(this);
255 mapper->setSeries(this);
@@ -325,7 +325,7 void DeclarativePercentBarSeries::componentComplete()
325 {
325 {
326 foreach(QObject *child, children()) {
326 foreach(QObject *child, children()) {
327 if (qobject_cast<DeclarativeBarSet *>(child)) {
327 if (qobject_cast<DeclarativeBarSet *>(child)) {
328 QBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
328 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
329 } else if(qobject_cast<QVBarModelMapper *>(child)) {
329 } else if(qobject_cast<QVBarModelMapper *>(child)) {
330 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
330 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
331 mapper->setSeries(this);
331 mapper->setSeries(this);
@@ -58,7 +58,7 private Q_SLOTS:
58 void handleCountChanged(int index, int count);
58 void handleCountChanged(int index, int count);
59 };
59 };
60
60
61 class DeclarativeBarSeries : public QBarSeries, public QDeclarativeParserStatus
61 class DeclarativeBarSeries : public QAbstractBarSeries, public QDeclarativeParserStatus
62 {
62 {
63 Q_OBJECT
63 Q_OBJECT
64 Q_INTERFACES(QDeclarativeParserStatus)
64 Q_INTERFACES(QDeclarativeParserStatus)
@@ -77,8 +77,8 public:
77 Q_INVOKABLE DeclarativeBarSet *at(int index);
77 Q_INVOKABLE DeclarativeBarSet *at(int index);
78 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
78 Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
79 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
79 Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
80 Q_INVOKABLE bool remove(QBarSet *barset) { return QBarSeries::remove(barset); }
80 Q_INVOKABLE bool remove(QBarSet *barset) { return QAbstractBarSeries::remove(barset); }
81 Q_INVOKABLE void clear() { return QBarSeries::clear(); }
81 Q_INVOKABLE void clear() { return QAbstractBarSeries::clear(); }
82
82
83 public: // from QDeclarativeParserStatus
83 public: // from QDeclarativeParserStatus
84 void classBegin();
84 void classBegin();
@@ -32,7 +32,7
32
32
33 QTCOMMERCIALCHART_BEGIN_NAMESPACE
33 QTCOMMERCIALCHART_BEGIN_NAMESPACE
34
34
35 BarChartItem::BarChartItem(QBarSeries *series, ChartPresenter *presenter) :
35 BarChartItem::BarChartItem(QAbstractBarSeries *series, ChartPresenter *presenter) :
36 ChartItem(presenter),
36 ChartItem(presenter),
37 m_series(series)
37 m_series(series)
38 {
38 {
@@ -46,7 +46,7 class BarChartItem : public ChartItem
46 {
46 {
47 Q_OBJECT
47 Q_OBJECT
48 public:
48 public:
49 BarChartItem(QBarSeries *series, ChartPresenter *presenter);
49 BarChartItem(QAbstractBarSeries *series, ChartPresenter *presenter);
50 virtual ~BarChartItem();
50 virtual ~BarChartItem();
51
51
52 public:
52 public:
@@ -79,7 +79,7 protected:
79 QVector<QRectF> m_layout;
79 QVector<QRectF> m_layout;
80
80
81 // Not owned.
81 // Not owned.
82 QBarSeries *m_series;
82 QAbstractBarSeries *m_series;
83 QList<Bar *> m_bars;
83 QList<Bar *> m_bars;
84 QList<QGraphicsSimpleTextItem *> m_labels;
84 QList<QGraphicsSimpleTextItem *> m_labels;
85 };
85 };
@@ -27,7 +27,7
27
27
28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29
29
30 GroupedBarChartItem::GroupedBarChartItem(QBarSeries *series, ChartPresenter *presenter) :
30 GroupedBarChartItem::GroupedBarChartItem(QAbstractBarSeries *series, ChartPresenter *presenter) :
31 BarChartItem(series, presenter)
31 BarChartItem(series, presenter)
32 {
32 {
33 }
33 }
@@ -41,7 +41,7 class GroupedBarChartItem : public BarChartItem
41 {
41 {
42 Q_OBJECT
42 Q_OBJECT
43 public:
43 public:
44 GroupedBarChartItem(QBarSeries *series, ChartPresenter *presenter);
44 GroupedBarChartItem(QAbstractBarSeries *series, ChartPresenter *presenter);
45
45
46 private:
46 private:
47 virtual QVector<QRectF> calculateLayout();
47 virtual QVector<QRectF> calculateLayout();
@@ -27,7 +27,7
27
27
28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29
29
30 PercentBarChartItem::PercentBarChartItem(QBarSeries *series, ChartPresenter *presenter) :
30 PercentBarChartItem::PercentBarChartItem(QAbstractBarSeries *series, ChartPresenter *presenter) :
31 BarChartItem(series, presenter)
31 BarChartItem(series, presenter)
32 {
32 {
33 }
33 }
@@ -36,13 +36,13
36
36
37 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37 QTCOMMERCIALCHART_BEGIN_NAMESPACE
38
38
39 class QBarSeries;
39 class QAbstractBarSeries;
40
40
41 class PercentBarChartItem : public BarChartItem
41 class PercentBarChartItem : public BarChartItem
42 {
42 {
43 Q_OBJECT
43 Q_OBJECT
44 public:
44 public:
45 PercentBarChartItem(QBarSeries *series, ChartPresenter *presenter);
45 PercentBarChartItem(QAbstractBarSeries *series, ChartPresenter *presenter);
46
46
47 private:
47 private:
48 virtual QVector<QRectF> calculateLayout();
48 virtual QVector<QRectF> calculateLayout();
@@ -60,13 +60,13 void QBarModelMapper::setModel(QAbstractItemModel *model)
60 connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
60 connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
61 }
61 }
62
62
63 QBarSeries* QBarModelMapper::series() const
63 QAbstractBarSeries* QBarModelMapper::series() const
64 {
64 {
65 Q_D(const QBarModelMapper);
65 Q_D(const QBarModelMapper);
66 return d->m_series;
66 return d->m_series;
67 }
67 }
68
68
69 void QBarModelMapper::setSeries(QBarSeries *series)
69 void QBarModelMapper::setSeries(QAbstractBarSeries *series)
70 {
70 {
71 Q_D(QBarModelMapper);
71 Q_D(QBarModelMapper);
72 if (d->m_series) {
72 if (d->m_series) {
@@ -29,7 +29,7 class QAbstractItemModel;
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30
30
31 class QBarModelMapperPrivate;
31 class QBarModelMapperPrivate;
32 class QBarSeries;
32 class QAbstractBarSeries;
33 class QChart;
33 class QChart;
34
34
35 class QTCOMMERCIALCHART_EXPORT QBarModelMapper : public QObject
35 class QTCOMMERCIALCHART_EXPORT QBarModelMapper : public QObject
@@ -42,8 +42,8 protected:
42 QAbstractItemModel* model() const;
42 QAbstractItemModel* model() const;
43 void setModel(QAbstractItemModel *model);
43 void setModel(QAbstractItemModel *model);
44
44
45 QBarSeries* series() const;
45 QAbstractBarSeries* series() const;
46 void setSeries(QBarSeries *series);
46 void setSeries(QAbstractBarSeries *series);
47
47
48 int first() const;
48 int first() const;
49 void setFirst(int first);
49 void setFirst(int first);
@@ -74,7 +74,7 private:
74 void blockSeriesSignals(bool block = true);
74 void blockSeriesSignals(bool block = true);
75
75
76 private:
76 private:
77 QBarSeries *m_series;
77 QAbstractBarSeries *m_series;
78 QList<QBarSet*> m_barSets;
78 QList<QBarSet*> m_barSets;
79 QAbstractItemModel *m_model;
79 QAbstractItemModel *m_model;
80 int m_first;
80 int m_first;
@@ -192,17 +192,17 QTCOMMERCIALCHART_BEGIN_NAMESPACE
192 Constructs empty QBarSeries.
192 Constructs empty QBarSeries.
193 QBarSeries is QObject which is a child of a \a parent.
193 QBarSeries is QObject which is a child of a \a parent.
194 */
194 */
195 QBarSeries::QBarSeries(QObject *parent) :
195 QAbstractBarSeries::QAbstractBarSeries(QObject *parent) :
196 QAbstractSeries(*new QBarSeriesPrivate(this),parent)
196 QAbstractSeries(*new QAbstractBarSeriesPrivate(this),parent)
197 {
197 {
198 }
198 }
199
199
200 /*!
200 /*!
201 Destructs barseries and owned barsets.
201 Destructs barseries and owned barsets.
202 */
202 */
203 QBarSeries::~QBarSeries()
203 QAbstractBarSeries::~QAbstractBarSeries()
204 {
204 {
205 Q_D(QBarSeries);
205 Q_D(QAbstractBarSeries);
206 if(d->m_dataset){
206 if(d->m_dataset){
207 d->m_dataset->removeSeries(this);
207 d->m_dataset->removeSeries(this);
208 }
208 }
@@ -211,7 +211,7 QBarSeries::~QBarSeries()
211 /*!
211 /*!
212 \internal
212 \internal
213 */
213 */
214 QBarSeries::QBarSeries(QBarSeriesPrivate &d, QObject *parent) :
214 QAbstractBarSeries::QAbstractBarSeries(QAbstractBarSeriesPrivate &d, QObject *parent) :
215 QAbstractSeries(d,parent)
215 QAbstractSeries(d,parent)
216 {
216 {
217 }
217 }
@@ -219,7 +219,7 QBarSeries::QBarSeries(QBarSeriesPrivate &d, QObject *parent) :
219 /*!
219 /*!
220 Returns the type of series. Derived classes override this.
220 Returns the type of series. Derived classes override this.
221 */
221 */
222 QAbstractSeries::SeriesType QBarSeries::type() const
222 QAbstractSeries::SeriesType QAbstractBarSeries::type() const
223 {
223 {
224 return QAbstractSeries::SeriesTypeBar;
224 return QAbstractSeries::SeriesTypeBar;
225 }
225 }
@@ -230,9 +230,9 QAbstractSeries::SeriesType QBarSeries::type() const
230 is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis.
230 is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis.
231 Note that with \link QGroupedBarSeries \endlink this value means the width of one group of bars instead of just one bar.
231 Note that with \link QGroupedBarSeries \endlink this value means the width of one group of bars instead of just one bar.
232 */
232 */
233 void QBarSeries::setBarWidth(qreal width)
233 void QAbstractBarSeries::setBarWidth(qreal width)
234 {
234 {
235 Q_D(QBarSeries);
235 Q_D(QAbstractBarSeries);
236 d->setBarWidth(width);
236 d->setBarWidth(width);
237 }
237 }
238
238
@@ -240,9 +240,9 void QBarSeries::setBarWidth(qreal width)
240 Returns the width of the bars of the series.
240 Returns the width of the bars of the series.
241 \sa setBarWidth()
241 \sa setBarWidth()
242 */
242 */
243 qreal QBarSeries::barWidth() const
243 qreal QAbstractBarSeries::barWidth() const
244 {
244 {
245 Q_D(const QBarSeries);
245 Q_D(const QAbstractBarSeries);
246 return d->barWidth();
246 return d->barWidth();
247 }
247 }
248
248
@@ -250,9 +250,9 qreal QBarSeries::barWidth() const
250 Adds a set of bars to series. Takes ownership of \a set. If the set is null or is already in series, it won't be appended.
250 Adds a set of bars to series. Takes ownership of \a set. If the set is null or is already in series, it won't be appended.
251 Returns true, if appending succeeded.
251 Returns true, if appending succeeded.
252 */
252 */
253 bool QBarSeries::append(QBarSet *set)
253 bool QAbstractBarSeries::append(QBarSet *set)
254 {
254 {
255 Q_D(QBarSeries);
255 Q_D(QAbstractBarSeries);
256 bool success = d->append(set);
256 bool success = d->append(set);
257 if (success) {
257 if (success) {
258 QList<QBarSet*> sets;
258 QList<QBarSet*> sets;
@@ -267,9 +267,9 bool QBarSeries::append(QBarSet *set)
267 Removes a set of bars from series. Releases ownership of \a set. Doesn't delete \a set.
267 Removes a set of bars from series. Releases ownership of \a set. Doesn't delete \a set.
268 Returns true, if set was removed.
268 Returns true, if set was removed.
269 */
269 */
270 bool QBarSeries::remove(QBarSet *set)
270 bool QAbstractBarSeries::remove(QBarSet *set)
271 {
271 {
272 Q_D(QBarSeries);
272 Q_D(QAbstractBarSeries);
273 bool success = d->remove(set);
273 bool success = d->remove(set);
274 if (success) {
274 if (success) {
275 QList<QBarSet*> sets;
275 QList<QBarSet*> sets;
@@ -286,9 +286,9 bool QBarSeries::remove(QBarSet *set)
286 nothing is appended and function returns false. If any of the sets is in list more than once, nothing is appended
286 nothing is appended and function returns false. If any of the sets is in list more than once, nothing is appended
287 and function returns false.
287 and function returns false.
288 */
288 */
289 bool QBarSeries::append(QList<QBarSet* > sets)
289 bool QAbstractBarSeries::append(QList<QBarSet* > sets)
290 {
290 {
291 Q_D(QBarSeries);
291 Q_D(QAbstractBarSeries);
292 bool success = d->append(sets);
292 bool success = d->append(sets);
293 if (success) {
293 if (success) {
294 emit barsetsAdded(sets);
294 emit barsetsAdded(sets);
@@ -302,9 +302,9 bool QBarSeries::append(QList<QBarSet* > sets)
302 Returns true, if inserting succeeded.
302 Returns true, if inserting succeeded.
303
303
304 */
304 */
305 bool QBarSeries::insert(int index, QBarSet *set)
305 bool QAbstractBarSeries::insert(int index, QBarSet *set)
306 {
306 {
307 Q_D(QBarSeries);
307 Q_D(QAbstractBarSeries);
308 bool success = d->insert(index, set);
308 bool success = d->insert(index, set);
309 if (success) {
309 if (success) {
310 QList<QBarSet*> sets;
310 QList<QBarSet*> sets;
@@ -318,9 +318,9 bool QBarSeries::insert(int index, QBarSet *set)
318 /*!
318 /*!
319 Removes all of the bar sets from the series
319 Removes all of the bar sets from the series
320 */
320 */
321 void QBarSeries::clear()
321 void QAbstractBarSeries::clear()
322 {
322 {
323 Q_D(QBarSeries);
323 Q_D(QAbstractBarSeries);
324 QList<QBarSet *> sets = barSets();
324 QList<QBarSet *> sets = barSets();
325 bool success = d->remove(sets);
325 bool success = d->remove(sets);
326 if (success) {
326 if (success) {
@@ -332,27 +332,27 void QBarSeries::clear()
332 /*!
332 /*!
333 Returns number of sets in series.
333 Returns number of sets in series.
334 */
334 */
335 int QBarSeries::count() const
335 int QAbstractBarSeries::count() const
336 {
336 {
337 Q_D(const QBarSeries);
337 Q_D(const QAbstractBarSeries);
338 return d->m_barSets.count();
338 return d->m_barSets.count();
339 }
339 }
340
340
341 /*!
341 /*!
342 Returns a list of sets in series. Keeps ownership of sets.
342 Returns a list of sets in series. Keeps ownership of sets.
343 */
343 */
344 QList<QBarSet*> QBarSeries::barSets() const
344 QList<QBarSet*> QAbstractBarSeries::barSets() const
345 {
345 {
346 Q_D(const QBarSeries);
346 Q_D(const QAbstractBarSeries);
347 return d->m_barSets;
347 return d->m_barSets;
348 }
348 }
349
349
350 /*!
350 /*!
351 Sets the visibility of labels in series to \a visible
351 Sets the visibility of labels in series to \a visible
352 */
352 */
353 void QBarSeries::setLabelsVisible(bool visible)
353 void QAbstractBarSeries::setLabelsVisible(bool visible)
354 {
354 {
355 Q_D(QBarSeries);
355 Q_D(QAbstractBarSeries);
356 if (d->m_labelsVisible != visible) {
356 if (d->m_labelsVisible != visible) {
357 d->setLabelsVisible(visible);
357 d->setLabelsVisible(visible);
358 emit labelsVisibleChanged();
358 emit labelsVisibleChanged();
@@ -362,15 +362,15 void QBarSeries::setLabelsVisible(bool visible)
362 /*!
362 /*!
363 Returns the visibility of labels
363 Returns the visibility of labels
364 */
364 */
365 bool QBarSeries::isLabelsVisible() const
365 bool QAbstractBarSeries::isLabelsVisible() const
366 {
366 {
367 Q_D(const QBarSeries);
367 Q_D(const QAbstractBarSeries);
368 return d->m_labelsVisible;
368 return d->m_labelsVisible;
369 }
369 }
370
370
371 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
371 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
372
372
373 QBarSeriesPrivate::QBarSeriesPrivate(QBarSeries *q) :
373 QAbstractBarSeriesPrivate::QAbstractBarSeriesPrivate(QAbstractBarSeries *q) :
374 QAbstractSeriesPrivate(q),
374 QAbstractSeriesPrivate(q),
375 m_barWidth(0.5), // Default value is 50% of category width
375 m_barWidth(0.5), // Default value is 50% of category width
376 m_labelsVisible(false),
376 m_labelsVisible(false),
@@ -378,7 +378,7 QBarSeriesPrivate::QBarSeriesPrivate(QBarSeries *q) :
378 {
378 {
379 }
379 }
380
380
381 int QBarSeriesPrivate::categoryCount() const
381 int QAbstractBarSeriesPrivate::categoryCount() const
382 {
382 {
383 // No categories defined. return count of longest set.
383 // No categories defined. return count of longest set.
384 int count = 0;
384 int count = 0;
@@ -391,7 +391,7 int QBarSeriesPrivate::categoryCount() const
391 return count;
391 return count;
392 }
392 }
393
393
394 void QBarSeriesPrivate::setBarWidth(qreal width)
394 void QAbstractBarSeriesPrivate::setBarWidth(qreal width)
395 {
395 {
396 if (width < 0.0) {
396 if (width < 0.0) {
397 width = 0.0;
397 width = 0.0;
@@ -400,29 +400,29 void QBarSeriesPrivate::setBarWidth(qreal width)
400 emit updatedBars();
400 emit updatedBars();
401 }
401 }
402
402
403 qreal QBarSeriesPrivate::barWidth() const
403 qreal QAbstractBarSeriesPrivate::barWidth() const
404 {
404 {
405 return m_barWidth;
405 return m_barWidth;
406 }
406 }
407
407
408 QBarSet* QBarSeriesPrivate::barsetAt(int index)
408 QBarSet* QAbstractBarSeriesPrivate::barsetAt(int index)
409 {
409 {
410 return m_barSets.at(index);
410 return m_barSets.at(index);
411 }
411 }
412
412
413 void QBarSeriesPrivate::setVisible(bool visible)
413 void QAbstractBarSeriesPrivate::setVisible(bool visible)
414 {
414 {
415 m_visible = visible;
415 m_visible = visible;
416 emit updatedBars();
416 emit updatedBars();
417 }
417 }
418
418
419 void QBarSeriesPrivate::setLabelsVisible(bool visible)
419 void QAbstractBarSeriesPrivate::setLabelsVisible(bool visible)
420 {
420 {
421 m_labelsVisible = visible;
421 m_labelsVisible = visible;
422 emit labelsVisibleChanged(visible);
422 emit labelsVisibleChanged(visible);
423 }
423 }
424
424
425 qreal QBarSeriesPrivate::min()
425 qreal QAbstractBarSeriesPrivate::min()
426 {
426 {
427 if (m_barSets.count() <= 0) {
427 if (m_barSets.count() <= 0) {
428 return 0;
428 return 0;
@@ -440,7 +440,7 qreal QBarSeriesPrivate::min()
440 return min;
440 return min;
441 }
441 }
442
442
443 qreal QBarSeriesPrivate::max()
443 qreal QAbstractBarSeriesPrivate::max()
444 {
444 {
445 if (m_barSets.count() <= 0) {
445 if (m_barSets.count() <= 0) {
446 return 0;
446 return 0;
@@ -459,7 +459,7 qreal QBarSeriesPrivate::max()
459 return max;
459 return max;
460 }
460 }
461
461
462 qreal QBarSeriesPrivate::valueAt(int set, int category)
462 qreal QAbstractBarSeriesPrivate::valueAt(int set, int category)
463 {
463 {
464 if ((set < 0) || (set >= m_barSets.count())) {
464 if ((set < 0) || (set >= m_barSets.count())) {
465 // No set, no value.
465 // No set, no value.
@@ -472,7 +472,7 qreal QBarSeriesPrivate::valueAt(int set, int category)
472 return m_barSets.at(set)->at(category);
472 return m_barSets.at(set)->at(category);
473 }
473 }
474
474
475 qreal QBarSeriesPrivate::percentageAt(int set, int category)
475 qreal QAbstractBarSeriesPrivate::percentageAt(int set, int category)
476 {
476 {
477 if ((set < 0) || (set >= m_barSets.count())) {
477 if ((set < 0) || (set >= m_barSets.count())) {
478 // No set, no value.
478 // No set, no value.
@@ -491,7 +491,7 qreal QBarSeriesPrivate::percentageAt(int set, int category)
491 return value / sum;
491 return value / sum;
492 }
492 }
493
493
494 qreal QBarSeriesPrivate::categorySum(int category)
494 qreal QAbstractBarSeriesPrivate::categorySum(int category)
495 {
495 {
496 qreal sum(0);
496 qreal sum(0);
497 int count = m_barSets.count(); // Count sets
497 int count = m_barSets.count(); // Count sets
@@ -502,7 +502,7 qreal QBarSeriesPrivate::categorySum(int category)
502 return sum;
502 return sum;
503 }
503 }
504
504
505 qreal QBarSeriesPrivate::absoluteCategorySum(int category)
505 qreal QAbstractBarSeriesPrivate::absoluteCategorySum(int category)
506 {
506 {
507 qreal sum(0);
507 qreal sum(0);
508 int count = m_barSets.count(); // Count sets
508 int count = m_barSets.count(); // Count sets
@@ -513,7 +513,7 qreal QBarSeriesPrivate::absoluteCategorySum(int category)
513 return sum;
513 return sum;
514 }
514 }
515
515
516 qreal QBarSeriesPrivate::maxCategorySum()
516 qreal QAbstractBarSeriesPrivate::maxCategorySum()
517 {
517 {
518 qreal max = INT_MIN;
518 qreal max = INT_MIN;
519 int count = categoryCount();
519 int count = categoryCount();
@@ -525,7 +525,7 qreal QBarSeriesPrivate::maxCategorySum()
525 return max;
525 return max;
526 }
526 }
527
527
528 qreal QBarSeriesPrivate::minX()
528 qreal QAbstractBarSeriesPrivate::minX()
529 {
529 {
530 if (m_barSets.count() <= 0) {
530 if (m_barSets.count() <= 0) {
531 return 0;
531 return 0;
@@ -543,7 +543,7 qreal QBarSeriesPrivate::minX()
543 return min;
543 return min;
544 }
544 }
545
545
546 qreal QBarSeriesPrivate::maxX()
546 qreal QAbstractBarSeriesPrivate::maxX()
547 {
547 {
548 if (m_barSets.count() <= 0) {
548 if (m_barSets.count() <= 0) {
549 return 0;
549 return 0;
@@ -563,7 +563,7 qreal QBarSeriesPrivate::maxX()
563 }
563 }
564
564
565
565
566 void QBarSeriesPrivate::scaleDomain(Domain& domain)
566 void QAbstractBarSeriesPrivate::scaleDomain(Domain& domain)
567 {
567 {
568 qreal minX(domain.minX());
568 qreal minX(domain.minX());
569 qreal minY(domain.minY());
569 qreal minY(domain.minY());
@@ -584,9 +584,9 void QBarSeriesPrivate::scaleDomain(Domain& domain)
584 domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount);
584 domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount);
585 }
585 }
586
586
587 Chart* QBarSeriesPrivate::createGraphics(ChartPresenter* presenter)
587 Chart* QAbstractBarSeriesPrivate::createGraphics(ChartPresenter* presenter)
588 {
588 {
589 Q_Q(QBarSeries);
589 Q_Q(QAbstractBarSeries);
590
590
591 BarChartItem* bar = new BarChartItem(q,presenter);
591 BarChartItem* bar = new BarChartItem(q,presenter);
592 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
592 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
@@ -597,9 +597,9 Chart* QBarSeriesPrivate::createGraphics(ChartPresenter* presenter)
597
597
598 }
598 }
599
599
600 QList<LegendMarker*> QBarSeriesPrivate::createLegendMarker(QLegend* legend)
600 QList<LegendMarker*> QAbstractBarSeriesPrivate::createLegendMarker(QLegend* legend)
601 {
601 {
602 Q_Q(QBarSeries);
602 Q_Q(QAbstractBarSeries);
603 QList<LegendMarker*> markers;
603 QList<LegendMarker*> markers;
604 foreach(QBarSet* set, q->barSets()) {
604 foreach(QBarSet* set, q->barSets()) {
605 BarLegendMarker* marker = new BarLegendMarker(q,set,legend);
605 BarLegendMarker* marker = new BarLegendMarker(q,set,legend);
@@ -609,19 +609,19 QList<LegendMarker*> QBarSeriesPrivate::createLegendMarker(QLegend* legend)
609 return markers;
609 return markers;
610 }
610 }
611
611
612 QAbstractAxis* QBarSeriesPrivate::createAxisX(QObject* parent)
612 QAbstractAxis* QAbstractBarSeriesPrivate::createAxisX(QObject* parent)
613 {
613 {
614 return new QCategoriesAxis(parent);
614 return new QCategoriesAxis(parent);
615 }
615 }
616
616
617 QAbstractAxis* QBarSeriesPrivate::createAxisY(QObject* parent)
617 QAbstractAxis* QAbstractBarSeriesPrivate::createAxisY(QObject* parent)
618 {
618 {
619 return new QValuesAxis(parent);
619 return new QValuesAxis(parent);
620 }
620 }
621
621
622 bool QBarSeriesPrivate::append(QBarSet *set)
622 bool QAbstractBarSeriesPrivate::append(QBarSet *set)
623 {
623 {
624 Q_Q(QBarSeries);
624 Q_Q(QAbstractBarSeries);
625 if ((m_barSets.contains(set)) || (set == 0)) {
625 if ((m_barSets.contains(set)) || (set == 0)) {
626 // Fail if set is already in list or set is null.
626 // Fail if set is already in list or set is null.
627 return false;
627 return false;
@@ -636,9 +636,9 bool QBarSeriesPrivate::append(QBarSet *set)
636 return true;
636 return true;
637 }
637 }
638
638
639 bool QBarSeriesPrivate::remove(QBarSet *set)
639 bool QAbstractBarSeriesPrivate::remove(QBarSet *set)
640 {
640 {
641 Q_Q(QBarSeries);
641 Q_Q(QAbstractBarSeries);
642 if (!m_barSets.contains(set)) {
642 if (!m_barSets.contains(set)) {
643 // Fail if set is not in list
643 // Fail if set is not in list
644 return false;
644 return false;
@@ -653,9 +653,9 bool QBarSeriesPrivate::remove(QBarSet *set)
653 return true;
653 return true;
654 }
654 }
655
655
656 bool QBarSeriesPrivate::append(QList<QBarSet* > sets)
656 bool QAbstractBarSeriesPrivate::append(QList<QBarSet* > sets)
657 {
657 {
658 Q_Q(QBarSeries);
658 Q_Q(QAbstractBarSeries);
659 foreach (QBarSet* set, sets) {
659 foreach (QBarSet* set, sets) {
660 if ((set == 0) || (m_barSets.contains(set))) {
660 if ((set == 0) || (m_barSets.contains(set))) {
661 // Fail if any of the sets is null or is already appended.
661 // Fail if any of the sets is null or is already appended.
@@ -679,9 +679,9 bool QBarSeriesPrivate::append(QList<QBarSet* > sets)
679 return true;
679 return true;
680 }
680 }
681
681
682 bool QBarSeriesPrivate::remove(QList<QBarSet* > sets)
682 bool QAbstractBarSeriesPrivate::remove(QList<QBarSet* > sets)
683 {
683 {
684 Q_Q(QBarSeries);
684 Q_Q(QAbstractBarSeries);
685 if (sets.count() == 0) {
685 if (sets.count() == 0) {
686 return false;
686 return false;
687 }
687 }
@@ -709,9 +709,9 bool QBarSeriesPrivate::remove(QList<QBarSet* > sets)
709 return true;
709 return true;
710 }
710 }
711
711
712 bool QBarSeriesPrivate::insert(int index, QBarSet *set)
712 bool QAbstractBarSeriesPrivate::insert(int index, QBarSet *set)
713 {
713 {
714 Q_Q(QBarSeries);
714 Q_Q(QAbstractBarSeries);
715 if ((m_barSets.contains(set)) || (set == 0)) {
715 if ((m_barSets.contains(set)) || (set == 0)) {
716 // Fail if set is already in list or set is null.
716 // Fail if set is already in list or set is null.
717 return false;
717 return false;
@@ -27,10 +27,10
27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28
28
29 class QBarSet;
29 class QBarSet;
30 class QBarSeriesPrivate;
30 class QAbstractBarSeriesPrivate;
31
31
32 // Container for series
32 // Container for series
33 class QTCOMMERCIALCHART_EXPORT QBarSeries : public QAbstractSeries
33 class QTCOMMERCIALCHART_EXPORT QAbstractBarSeries : public QAbstractSeries
34 {
34 {
35 Q_OBJECT
35 Q_OBJECT
36 Q_PROPERTY(qreal barWidth READ barWidth WRITE setBarWidth)
36 Q_PROPERTY(qreal barWidth READ barWidth WRITE setBarWidth)
@@ -38,8 +38,8 class QTCOMMERCIALCHART_EXPORT QBarSeries : public QAbstractSeries
38 Q_PROPERTY(bool labelsVisible READ isLabelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
38 Q_PROPERTY(bool labelsVisible READ isLabelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
39
39
40 public:
40 public:
41 explicit QBarSeries(QObject *parent = 0);
41 explicit QAbstractBarSeries(QObject *parent = 0);
42 virtual ~QBarSeries();
42 virtual ~QAbstractBarSeries();
43
43
44 QAbstractSeries::SeriesType type() const;
44 QAbstractSeries::SeriesType type() const;
45
45
@@ -58,7 +58,7 public:
58 bool isLabelsVisible() const;
58 bool isLabelsVisible() const;
59
59
60 protected:
60 protected:
61 explicit QBarSeries(QBarSeriesPrivate &d,QObject *parent = 0);
61 explicit QAbstractBarSeries(QAbstractBarSeriesPrivate &d,QObject *parent = 0);
62
62
63 Q_SIGNALS:
63 Q_SIGNALS:
64 void clicked(int index, QBarSet *barset);
64 void clicked(int index, QBarSet *barset);
@@ -70,7 +70,7 Q_SIGNALS:
70 void barsetsRemoved(QList<QBarSet*> sets);
70 void barsetsRemoved(QList<QBarSet*> sets);
71
71
72 protected:
72 protected:
73 Q_DECLARE_PRIVATE(QBarSeries)
73 Q_DECLARE_PRIVATE(QAbstractBarSeries)
74 friend class BarChartItem;
74 friend class BarChartItem;
75 friend class PercentBarChartItem;
75 friend class PercentBarChartItem;
76 friend class StackedBarChartItem;
76 friend class StackedBarChartItem;
@@ -39,11 +39,11 QTCOMMERCIALCHART_BEGIN_NAMESPACE
39
39
40 class QBarModelMapper;
40 class QBarModelMapper;
41
41
42 class QBarSeriesPrivate : public QAbstractSeriesPrivate
42 class QAbstractBarSeriesPrivate : public QAbstractSeriesPrivate
43 {
43 {
44 Q_OBJECT
44 Q_OBJECT
45 public:
45 public:
46 QBarSeriesPrivate(QBarSeries *parent);
46 QAbstractBarSeriesPrivate(QAbstractBarSeries *parent);
47 int categoryCount() const;
47 int categoryCount() const;
48
48
49 void setBarWidth(qreal width);
49 void setBarWidth(qreal width);
@@ -89,7 +89,7 protected:
89 bool m_visible;
89 bool m_visible;
90
90
91 private:
91 private:
92 Q_DECLARE_PUBLIC(QBarSeries)
92 Q_DECLARE_PUBLIC(QAbstractBarSeries)
93 };
93 };
94
94
95 QTCOMMERCIALCHART_END_NAMESPACE
95 QTCOMMERCIALCHART_END_NAMESPACE
@@ -104,7 +104,7 private:
104 friend class QBarSeries;
104 friend class QBarSeries;
105 friend class BarLegendMarker;
105 friend class BarLegendMarker;
106 friend class BarChartItem;
106 friend class BarChartItem;
107 friend class QBarSeriesPrivate;
107 friend class QAbstractBarSeriesPrivate;
108 friend class StackedBarChartItem;
108 friend class StackedBarChartItem;
109 friend class PercentBarChartItem;
109 friend class PercentBarChartItem;
110 friend class GroupedBarChartItem;
110 friend class GroupedBarChartItem;
@@ -60,7 +60,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
60 QGroupedBarSeries is QObject which is a child of a \a parent.
60 QGroupedBarSeries is QObject which is a child of a \a parent.
61 */
61 */
62 QGroupedBarSeries::QGroupedBarSeries(QObject *parent)
62 QGroupedBarSeries::QGroupedBarSeries(QObject *parent)
63 : QBarSeries(*new QGroupedBarSeriesPrivate(this), parent)
63 : QAbstractBarSeries(*new QGroupedBarSeriesPrivate(this), parent)
64 {
64 {
65 }
65 }
66
66
@@ -74,7 +74,7 QAbstractSeries::SeriesType QGroupedBarSeries::type() const
74
74
75 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
75 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
76
76
77 QGroupedBarSeriesPrivate::QGroupedBarSeriesPrivate(QGroupedBarSeries *q) : QBarSeriesPrivate(q)
77 QGroupedBarSeriesPrivate::QGroupedBarSeriesPrivate(QGroupedBarSeries *q) : QAbstractBarSeriesPrivate(q)
78 {
78 {
79
79
80 }
80 }
@@ -28,7 +28,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28
28
29 class QGroupedBarSeriesPrivate;
29 class QGroupedBarSeriesPrivate;
30
30
31 class QTCOMMERCIALCHART_EXPORT QGroupedBarSeries : public QBarSeries
31 class QTCOMMERCIALCHART_EXPORT QGroupedBarSeries : public QAbstractBarSeries
32 {
32 {
33 Q_OBJECT
33 Q_OBJECT
34 public:
34 public:
@@ -36,7 +36,7
36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37
37
38
38
39 class QGroupedBarSeriesPrivate: public QBarSeriesPrivate
39 class QGroupedBarSeriesPrivate: public QAbstractBarSeriesPrivate
40 {
40 {
41 public:
41 public:
42 QGroupedBarSeriesPrivate(QGroupedBarSeries* q);
42 QGroupedBarSeriesPrivate(QGroupedBarSeries* q);
@@ -179,12 +179,12 void QHBarModelMapper::setModel(QAbstractItemModel *model)
179 }
179 }
180 }
180 }
181
181
182 QBarSeries* QHBarModelMapper::series() const
182 QAbstractBarSeries* QHBarModelMapper::series() const
183 {
183 {
184 return QBarModelMapper::series();
184 return QBarModelMapper::series();
185 }
185 }
186
186
187 void QHBarModelMapper::setSeries(QBarSeries *series)
187 void QHBarModelMapper::setSeries(QAbstractBarSeries *series)
188 {
188 {
189 if (series != QBarModelMapper::series()) {
189 if (series != QBarModelMapper::series()) {
190 QBarModelMapper::setSeries(series);
190 QBarModelMapper::setSeries(series);
@@ -28,7 +28,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 class QTCOMMERCIALCHART_EXPORT QHBarModelMapper : public QBarModelMapper
28 class QTCOMMERCIALCHART_EXPORT QHBarModelMapper : public QBarModelMapper
29 {
29 {
30 Q_OBJECT
30 Q_OBJECT
31 Q_PROPERTY(QBarSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
31 Q_PROPERTY(QAbstractBarSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
32 Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
32 Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
33 Q_PROPERTY(int firstBarSetRow READ firstBarSetRow WRITE setFirstBarSetRow NOTIFY firstBarSetRowChanged)
33 Q_PROPERTY(int firstBarSetRow READ firstBarSetRow WRITE setFirstBarSetRow NOTIFY firstBarSetRowChanged)
34 Q_PROPERTY(int lastBarSetRow READ lastBarSetRow WRITE setLastBarSetRow NOTIFY lastBarSetRowChanged)
34 Q_PROPERTY(int lastBarSetRow READ lastBarSetRow WRITE setLastBarSetRow NOTIFY lastBarSetRowChanged)
@@ -41,8 +41,8 public:
41 QAbstractItemModel* model() const;
41 QAbstractItemModel* model() const;
42 void setModel(QAbstractItemModel *model);
42 void setModel(QAbstractItemModel *model);
43
43
44 QBarSeries* series() const;
44 QAbstractBarSeries* series() const;
45 void setSeries(QBarSeries *series);
45 void setSeries(QAbstractBarSeries *series);
46
46
47 int firstBarSetRow() const;
47 int firstBarSetRow() const;
48 void setFirstBarSetRow(int firstBarSetRow);
48 void setFirstBarSetRow(int firstBarSetRow);
@@ -60,7 +60,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
60 QPercentBarSeries is QObject which is a child of a \a parent.
60 QPercentBarSeries is QObject which is a child of a \a parent.
61 */
61 */
62 QPercentBarSeries::QPercentBarSeries(QObject *parent)
62 QPercentBarSeries::QPercentBarSeries(QObject *parent)
63 : QBarSeries(*new QPercentBarSeriesPrivate(this), parent)
63 : QAbstractBarSeries(*new QPercentBarSeriesPrivate(this), parent)
64 {
64 {
65 }
65 }
66
66
@@ -74,7 +74,7 QAbstractSeries::SeriesType QPercentBarSeries::type() const
74
74
75 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
75 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
76
76
77 QPercentBarSeriesPrivate::QPercentBarSeriesPrivate(QPercentBarSeries *q) : QBarSeriesPrivate(q)
77 QPercentBarSeriesPrivate::QPercentBarSeriesPrivate(QPercentBarSeries *q) : QAbstractBarSeriesPrivate(q)
78 {
78 {
79
79
80 }
80 }
@@ -28,7 +28,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28
28
29 class QPercentBarSeriesPrivate;
29 class QPercentBarSeriesPrivate;
30
30
31 class QTCOMMERCIALCHART_EXPORT QPercentBarSeries : public QBarSeries
31 class QTCOMMERCIALCHART_EXPORT QPercentBarSeries : public QAbstractBarSeries
32 {
32 {
33 Q_OBJECT
33 Q_OBJECT
34 public:
34 public:
@@ -36,7 +36,7
36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37
37
38
38
39 class QPercentBarSeriesPrivate: public QBarSeriesPrivate
39 class QPercentBarSeriesPrivate: public QAbstractBarSeriesPrivate
40 {
40 {
41 public:
41 public:
42 QPercentBarSeriesPrivate(QPercentBarSeries* q);
42 QPercentBarSeriesPrivate(QPercentBarSeries* q);
@@ -61,7 +61,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
61 QStackedBarSeries is QObject which is a child of a \a parent.
61 QStackedBarSeries is QObject which is a child of a \a parent.
62 */
62 */
63 QStackedBarSeries::QStackedBarSeries(QObject *parent)
63 QStackedBarSeries::QStackedBarSeries(QObject *parent)
64 : QBarSeries(*new QStackedBarSeriesPrivate(this), parent)
64 : QAbstractBarSeries(*new QStackedBarSeriesPrivate(this), parent)
65 {
65 {
66 }
66 }
67
67
@@ -75,7 +75,7 QAbstractSeries::SeriesType QStackedBarSeries::type() const
75
75
76 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
76 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
77
77
78 QStackedBarSeriesPrivate::QStackedBarSeriesPrivate(QStackedBarSeries *q) : QBarSeriesPrivate(q)
78 QStackedBarSeriesPrivate::QStackedBarSeriesPrivate(QStackedBarSeries *q) : QAbstractBarSeriesPrivate(q)
79 {
79 {
80
80
81 }
81 }
@@ -28,7 +28,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28
28
29 class QStackedBarSeriesPrivate;
29 class QStackedBarSeriesPrivate;
30
30
31 class QTCOMMERCIALCHART_EXPORT QStackedBarSeries : public QBarSeries
31 class QTCOMMERCIALCHART_EXPORT QStackedBarSeries : public QAbstractBarSeries
32 {
32 {
33 Q_OBJECT
33 Q_OBJECT
34 public:
34 public:
@@ -36,7 +36,7
36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37
37
38
38
39 class QStackedBarSeriesPrivate: public QBarSeriesPrivate
39 class QStackedBarSeriesPrivate: public QAbstractBarSeriesPrivate
40 {
40 {
41 public:
41 public:
42 QStackedBarSeriesPrivate(QStackedBarSeries* q);
42 QStackedBarSeriesPrivate(QStackedBarSeries* q);
@@ -178,12 +178,12 void QVBarModelMapper::setModel(QAbstractItemModel *model)
178 }
178 }
179 }
179 }
180
180
181 QBarSeries* QVBarModelMapper::series() const
181 QAbstractBarSeries* QVBarModelMapper::series() const
182 {
182 {
183 return QBarModelMapper::series();
183 return QBarModelMapper::series();
184 }
184 }
185
185
186 void QVBarModelMapper::setSeries(QBarSeries *series)
186 void QVBarModelMapper::setSeries(QAbstractBarSeries *series)
187 {
187 {
188 if (series != QBarModelMapper::series()) {
188 if (series != QBarModelMapper::series()) {
189 QBarModelMapper::setSeries(series);
189 QBarModelMapper::setSeries(series);
@@ -28,7 +28,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 class QTCOMMERCIALCHART_EXPORT QVBarModelMapper : public QBarModelMapper
28 class QTCOMMERCIALCHART_EXPORT QVBarModelMapper : public QBarModelMapper
29 {
29 {
30 Q_OBJECT
30 Q_OBJECT
31 Q_PROPERTY(QBarSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
31 Q_PROPERTY(QAbstractBarSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
32 Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
32 Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
33 Q_PROPERTY(int firstBarSetColumn READ firstBarSetColumn WRITE setFirstBarSetColumn NOTIFY firstBarSetColumnChanged)
33 Q_PROPERTY(int firstBarSetColumn READ firstBarSetColumn WRITE setFirstBarSetColumn NOTIFY firstBarSetColumnChanged)
34 Q_PROPERTY(int lastBarSetColumn READ lastBarSetColumn WRITE setLastBarSetColumn NOTIFY lastBarSetColumnChanged)
34 Q_PROPERTY(int lastBarSetColumn READ lastBarSetColumn WRITE setLastBarSetColumn NOTIFY lastBarSetColumnChanged)
@@ -41,8 +41,8 public:
41 QAbstractItemModel* model() const;
41 QAbstractItemModel* model() const;
42 void setModel(QAbstractItemModel *model);
42 void setModel(QAbstractItemModel *model);
43
43
44 QBarSeries* series() const;
44 QAbstractBarSeries* series() const;
45 void setSeries(QBarSeries *series);
45 void setSeries(QAbstractBarSeries *series);
46
46
47 int firstBarSetColumn() const;
47 int firstBarSetColumn() const;
48 void setFirstBarSetColumn(int firstBarSetColumn);
48 void setFirstBarSetColumn(int firstBarSetColumn);
@@ -27,7 +27,7
27
27
28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29
29
30 StackedBarChartItem::StackedBarChartItem(QBarSeries *series, ChartPresenter *presenter) :
30 StackedBarChartItem::StackedBarChartItem(QAbstractBarSeries *series, ChartPresenter *presenter) :
31 BarChartItem(series, presenter)
31 BarChartItem(series, presenter)
32 {
32 {
33 }
33 }
@@ -41,7 +41,7 class StackedBarChartItem : public BarChartItem
41 {
41 {
42 Q_OBJECT
42 Q_OBJECT
43 public:
43 public:
44 StackedBarChartItem(QBarSeries *series, ChartPresenter *presenter);
44 StackedBarChartItem(QAbstractBarSeries *series, ChartPresenter *presenter);
45
45
46 private:
46 private:
47 virtual QVector<QRectF> calculateLayout();
47 virtual QVector<QRectF> calculateLayout();
@@ -159,7 +159,7 void ChartTheme::decorate(QLineSeries *series,int index)
159 }
159 }
160 }
160 }
161
161
162 void ChartTheme::decorate(QBarSeries *series, int index)
162 void ChartTheme::decorate(QAbstractBarSeries *series, int index)
163 {
163 {
164 QBrush brush;
164 QBrush brush;
165 QPen pen;
165 QPen pen;
@@ -41,7 +41,7 class ChartItem;
41 class LineChartItem;
41 class LineChartItem;
42 class QLineSeries;
42 class QLineSeries;
43 class BarChartItem;
43 class BarChartItem;
44 class QBarSeries;
44 class QAbstractBarSeries;
45 class StackedBarChartItem;
45 class StackedBarChartItem;
46 class QStackedBarSeries;
46 class QStackedBarSeries;
47 class QPercentBarSeries;
47 class QPercentBarSeries;
@@ -72,7 +72,7 public:
72 QChart::ChartTheme id() const {return m_id;}
72 QChart::ChartTheme id() const {return m_id;}
73 void decorate(QChart *chart);
73 void decorate(QChart *chart);
74 void decorate(QLegend *legend);
74 void decorate(QLegend *legend);
75 void decorate(QBarSeries *series, int index);
75 void decorate(QAbstractBarSeries *series, int index);
76 void decorate(QLineSeries *series, int index);
76 void decorate(QLineSeries *series, int index);
77 void decorate(QAreaSeries *series, int index);
77 void decorate(QAreaSeries *series, int index);
78 void decorate(QScatterSeries *series, int index);
78 void decorate(QScatterSeries *series, int index);
@@ -177,7 +177,7 void AreaLegendMarker::updated()
177
177
178 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
178 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
179
179
180 BarLegendMarker::BarLegendMarker(QBarSeries *barseries,QBarSet *barset, QLegend *legend) : LegendMarker(barseries,legend),
180 BarLegendMarker::BarLegendMarker(QAbstractBarSeries *barseries,QBarSet *barset, QLegend *legend) : LegendMarker(barseries,legend),
181 m_barset(barset)
181 m_barset(barset)
182 {
182 {
183 //QObject::connect(this, SIGNAL(selected()),barset->d_ptr.data(), SIGNAL(selected()));
183 //QObject::connect(this, SIGNAL(selected()),barset->d_ptr.data(), SIGNAL(selected()));
@@ -43,7 +43,7 class QAbstractSeries;
43 class QAreaSeries;
43 class QAreaSeries;
44 class QXYSeries;
44 class QXYSeries;
45 class QBarSet;
45 class QBarSet;
46 class QBarSeries;
46 class QAbstractBarSeries;
47 class QPieSlice;
47 class QPieSlice;
48 class QLegend;
48 class QLegend;
49 class QPieSeries;
49 class QPieSeries;
@@ -123,7 +123,7 private:
123 class BarLegendMarker : public LegendMarker
123 class BarLegendMarker : public LegendMarker
124 {
124 {
125 public:
125 public:
126 BarLegendMarker(QBarSeries *barseries, QBarSet *barset,QLegend *legend);
126 BarLegendMarker(QAbstractBarSeries *barseries, QBarSet *barset,QLegend *legend);
127 protected:
127 protected:
128 void updated();
128 void updated();
129 private:
129 private:
@@ -136,7 +136,7 void tst_ChartDataSet::addSeries_data()
136 QAbstractSeries* scatter = new QScatterSeries(this);
136 QAbstractSeries* scatter = new QScatterSeries(this);
137 QAbstractSeries* spline = new QSplineSeries(this);
137 QAbstractSeries* spline = new QSplineSeries(this);
138 QAbstractSeries* pie = new QPieSeries(this);
138 QAbstractSeries* pie = new QPieSeries(this);
139 QAbstractSeries* bar = new QBarSeries(this);
139 QAbstractSeries* bar = new QAbstractBarSeries(this);
140 QAbstractSeries* percent = new QPercentBarSeries(this);
140 QAbstractSeries* percent = new QPercentBarSeries(this);
141 QAbstractSeries* stacked = new QStackedBarSeries(this);
141 QAbstractSeries* stacked = new QStackedBarSeries(this);
142
142
@@ -185,7 +185,7 void tst_ChartDataSet::setAxisX_data()
185 QAbstractSeries* scatter = new QScatterSeries(this);
185 QAbstractSeries* scatter = new QScatterSeries(this);
186 QAbstractSeries* spline = new QSplineSeries(this);
186 QAbstractSeries* spline = new QSplineSeries(this);
187 QAbstractSeries* pie = new QPieSeries(this);
187 QAbstractSeries* pie = new QPieSeries(this);
188 QAbstractSeries* bar = new QBarSeries(this);
188 QAbstractSeries* bar = new QAbstractBarSeries(this);
189 QAbstractSeries* percent = new QPercentBarSeries(this);
189 QAbstractSeries* percent = new QPercentBarSeries(this);
190 QAbstractSeries* stacked = new QStackedBarSeries(this);
190 QAbstractSeries* stacked = new QStackedBarSeries(this);
191
191
@@ -63,8 +63,8 private slots:
63 void clearWithAnimations();
63 void clearWithAnimations();
64
64
65 private:
65 private:
66 QBarSeries* m_barseries;
66 QAbstractBarSeries* m_barseries;
67 QBarSeries* m_barseries_with_sets;
67 QAbstractBarSeries* m_barseries_with_sets;
68
68
69 QList<QBarSet*> m_testSets;
69 QList<QBarSet*> m_testSets;
70
70
@@ -81,8 +81,8 void tst_QBarSeries::cleanupTestCase()
81
81
82 void tst_QBarSeries::init()
82 void tst_QBarSeries::init()
83 {
83 {
84 m_barseries = new QBarSeries();
84 m_barseries = new QAbstractBarSeries();
85 m_barseries_with_sets = new QBarSeries();
85 m_barseries_with_sets = new QAbstractBarSeries();
86
86
87 for (int i=0; i<5; i++) {
87 for (int i=0; i<5; i++) {
88 m_testSets.append(new QBarSet("testset"));
88 m_testSets.append(new QBarSet("testset"));
@@ -110,7 +110,7 void tst_QBarSeries::qbarseries_data()
110
110
111 void tst_QBarSeries::qbarseries()
111 void tst_QBarSeries::qbarseries()
112 {
112 {
113 QBarSeries *barseries = new QBarSeries();
113 QAbstractBarSeries *barseries = new QAbstractBarSeries();
114 QVERIFY(barseries != 0);
114 QVERIFY(barseries != 0);
115 }
115 }
116
116
@@ -316,7 +316,7 void tst_QBarSeries::mouseclicked_data()
316
316
317 void tst_QBarSeries::mouseclicked()
317 void tst_QBarSeries::mouseclicked()
318 {
318 {
319 QBarSeries* series = new QBarSeries();
319 QAbstractBarSeries* series = new QAbstractBarSeries();
320
320
321 QBarSet* set1 = new QBarSet(QString("set 1"));
321 QBarSet* set1 = new QBarSet(QString("set 1"));
322 // *set1 << QPointF(0,10) << QPointF(1,10) << QPointF(2,10);
322 // *set1 << QPointF(0,10) << QPointF(1,10) << QPointF(2,10);
@@ -454,7 +454,7 void tst_QBarSeries::mousehovered_data()
454
454
455 void tst_QBarSeries::mousehovered()
455 void tst_QBarSeries::mousehovered()
456 {
456 {
457 QBarSeries* series = new QBarSeries();
457 QAbstractBarSeries* series = new QAbstractBarSeries();
458
458
459 QBarSet* set1 = new QBarSet(QString("set 1"));
459 QBarSet* set1 = new QBarSet(QString("set 1"));
460 // *set1 << QPointF(0,10) << QPointF(1,10) << QPointF(2,10);
460 // *set1 << QPointF(0,10) << QPointF(1,10) << QPointF(2,10);
@@ -550,7 +550,7 void tst_QBarSeries::mousehovered()
550
550
551 void tst_QBarSeries::clearWithAnimations()
551 void tst_QBarSeries::clearWithAnimations()
552 {
552 {
553 QBarSeries* series = new QBarSeries();
553 QAbstractBarSeries* series = new QAbstractBarSeries();
554
554
555 QBarSet* set1 = new QBarSet(QString("set 1"));
555 QBarSet* set1 = new QBarSet(QString("set 1"));
556 // *set1 << QPointF(0,10) << QPointF(1,10) << QPointF(2,10);
556 // *set1 << QPointF(0,10) << QPointF(1,10) << QPointF(2,10);
@@ -177,7 +177,7 void tst_QChart::addSeries_data()
177 QAbstractSeries* series2 = new QScatterSeries(this);
177 QAbstractSeries* series2 = new QScatterSeries(this);
178 QAbstractSeries* series3 = new QSplineSeries(this);
178 QAbstractSeries* series3 = new QSplineSeries(this);
179 QAbstractSeries* series4 = new QPieSeries(this);
179 QAbstractSeries* series4 = new QPieSeries(this);
180 QAbstractSeries* series5 = new QBarSeries(this);
180 QAbstractSeries* series5 = new QAbstractBarSeries(this);
181 QAbstractSeries* series6 = new QPercentBarSeries(this);
181 QAbstractSeries* series6 = new QPercentBarSeries(this);
182 QAbstractSeries* series7 = new QStackedBarSeries(this);
182 QAbstractSeries* series7 = new QStackedBarSeries(this);
183
183
@@ -274,9 +274,9 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
274 QStringList labels = generateLabels(rowCount);
274 QStringList labels = generateLabels(rowCount);
275 foreach(QString label, labels)
275 foreach(QString label, labels)
276 category << label;
276 category << label;
277 QBarSeries* series = 0;
277 QAbstractBarSeries* series = 0;
278 if (seriesName == "Bar") {
278 if (seriesName == "Bar") {
279 series = new QBarSeries(this);
279 series = new QAbstractBarSeries(this);
280 QCategoriesAxis* axis = new QCategoriesAxis();
280 QCategoriesAxis* axis = new QCategoriesAxis();
281 axis->append(category);
281 axis->append(category);
282 m_chart->setAxisX(axis,series);
282 m_chart->setAxisX(axis,series);
General Comments 0
You need to be logged in to leave comments. Login now