##// END OF EJS Templates
Removing data from BarSeries through model added
Marek Rosa -
r663:9af75e8e0281
parent child
Show More
@@ -39,6 +39,11 void BarChartModel::insertCategory(int i, QString category)
39 mCategory.insert(i, category);
39 mCategory.insert(i, category);
40 }
40 }
41
41
42 void BarChartModel::removeCategory(int i)
43 {
44 mCategory.removeAt(i);
45 }
46
42 QBarSet* BarChartModel::setAt(int index)
47 QBarSet* BarChartModel::setAt(int index)
43 {
48 {
44 return mDataModel.at(index);
49 return mDataModel.at(index);
@@ -24,6 +24,7 public:
24 void removeBarSet(QBarSet *set);
24 void removeBarSet(QBarSet *set);
25 void insertBarSet(int i, QBarSet *set);
25 void insertBarSet(int i, QBarSet *set);
26 void insertCategory(int i, QString category);
26 void insertCategory(int i, QString category);
27 void removeCategory(int i);
27 QBarSet *setAt(int index);
28 QBarSet *setAt(int index);
28 QList<QBarSet*> barSets();
29 QList<QBarSet*> barSets();
29
30
@@ -80,6 +80,11 void QBarSeries::insertCategory(int i, QString category)
80 mModel->insertCategory(i, category);
80 mModel->insertCategory(i, category);
81 }
81 }
82
82
83 void QBarSeries::removeCategory(int i)
84 {
85 mModel->removeCategory(i);
86 }
87
83 /*!
88 /*!
84 Returns number of sets in series.
89 Returns number of sets in series.
85 */
90 */
@@ -343,9 +348,14 void QBarSeries::modelDataAdded(QModelIndex /*parent*/, int start, int /*end*/)
343 emit restructuredBar(1);
348 emit restructuredBar(1);
344 }
349 }
345
350
346 void QBarSeries::modelDataRemoved(QModelIndex /*parent*/, int /*start*/, int /*end*/)
351 void QBarSeries::modelDataRemoved(QModelIndex /*parent*/, int start, int /*end*/)
347 {
352 {
348 //
353 removeCategory(start);
354 for (int i = 0; i <= m_mapBarTop - m_mapBarBottom; i++)
355 {
356 barsetAt(i)->removeValue(start);
357 }
358 emit restructuredBar(1);
349 }
359 }
350
360
351 void QBarSeries::barsetChanged()
361 void QBarSeries::barsetChanged()
@@ -23,6 +23,7 public:
23 void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set
23 void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set
24 void insertBarSet(int i, QBarSet *set);
24 void insertBarSet(int i, QBarSet *set);
25 void insertCategory(int i, QString category);
25 void insertCategory(int i, QString category);
26 void removeCategory(int i);
26 int barsetCount();
27 int barsetCount();
27 int categoryCount();
28 int categoryCount();
28 QList<QBarSet*> barSets();
29 QList<QBarSet*> barSets();
@@ -91,6 +91,11 void QBarSet::insertValue(int i, qreal value)
91 mValues.insert(i, value);
91 mValues.insert(i, value);
92 }
92 }
93
93
94 void QBarSet::removeValue(int i)
95 {
96 mValues.removeAt(i);
97 }
98
94 /*!
99 /*!
95 Returns count of values in set.
100 Returns count of values in set.
96 */
101 */
@@ -17,6 +17,7 public:
17 QString name();
17 QString name();
18 QBarSet& operator << (const qreal &value); // appends new value to set
18 QBarSet& operator << (const qreal &value); // appends new value to set
19 void insertValue(int i, qreal value);
19 void insertValue(int i, qreal value);
20 void removeValue(int i);
20
21
21 // TODO: remove indices eventually. Use as internal?
22 // TODO: remove indices eventually. Use as internal?
22 int count(); // count of values in set
23 int count(); // count of values in set
General Comments 0
You need to be logged in to leave comments. Login now