##// 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 39 mCategory.insert(i, category);
40 40 }
41 41
42 void BarChartModel::removeCategory(int i)
43 {
44 mCategory.removeAt(i);
45 }
46
42 47 QBarSet* BarChartModel::setAt(int index)
43 48 {
44 49 return mDataModel.at(index);
@@ -24,6 +24,7 public:
24 24 void removeBarSet(QBarSet *set);
25 25 void insertBarSet(int i, QBarSet *set);
26 26 void insertCategory(int i, QString category);
27 void removeCategory(int i);
27 28 QBarSet *setAt(int index);
28 29 QList<QBarSet*> barSets();
29 30
@@ -80,6 +80,11 void QBarSeries::insertCategory(int i, QString category)
80 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 89 Returns number of sets in series.
85 90 */
@@ -343,9 +348,14 void QBarSeries::modelDataAdded(QModelIndex /*parent*/, int start, int /*end*/)
343 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 361 void QBarSeries::barsetChanged()
@@ -23,6 +23,7 public:
23 23 void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set
24 24 void insertBarSet(int i, QBarSet *set);
25 25 void insertCategory(int i, QString category);
26 void removeCategory(int i);
26 27 int barsetCount();
27 28 int categoryCount();
28 29 QList<QBarSet*> barSets();
@@ -91,6 +91,11 void QBarSet::insertValue(int i, qreal value)
91 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 100 Returns count of values in set.
96 101 */
@@ -17,6 +17,7 public:
17 17 QString name();
18 18 QBarSet& operator << (const qreal &value); // appends new value to set
19 19 void insertValue(int i, qreal value);
20 void removeValue(int i);
20 21
21 22 // TODO: remove indices eventually. Use as internal?
22 23 int count(); // count of values in set
General Comments 0
You need to be logged in to leave comments. Login now