##// END OF EJS Templates
Fix ownership handling: if object has a parent do not delete it
Michal Klocek -
r444:7fb10659b976
parent child
Show More
@@ -11,15 +11,15 m_index(0)
11 QTime now = QTime::currentTime();
11 QTime now = QTime::currentTime();
12 qsrand((uint)now.msec());
12 qsrand((uint)now.msec());
13
13
14 QLineSeries* series0 = new QLineSeries();
14 QLineSeries* series0 = new QLineSeries(this);
15 QPen blue(Qt::blue);
15 QPen blue(Qt::blue);
16 blue.setWidth(3);
16 blue.setWidth(3);
17 series0->setPen(blue);
17 series0->setPen(blue);
18 QLineSeries* series1 = new QLineSeries();
18 QLineSeries* series1 = new QLineSeries(this);
19 QPen red(Qt::red);
19 QPen red(Qt::red);
20 red.setWidth(3);
20 red.setWidth(3);
21 series1->setPen(red);
21 series1->setPen(red);
22 QLineSeries* series2 = new QLineSeries();
22 QLineSeries* series2 = new QLineSeries(this);
23 QPen green(Qt::green);
23 QPen green(Qt::green);
24 green.setWidth(3);
24 green.setWidth(3);
25 series2->setPen(green);
25 series2->setPen(green);
@@ -91,6 +91,12 void ChartDataSet::removeSeries(QSeries* series)
91 if(i==-1){
91 if(i==-1){
92 Domain* domain = m_axisDomainMap.take(axis);
92 Domain* domain = m_axisDomainMap.take(axis);
93 emit axisRemoved(axis);
93 emit axisRemoved(axis);
94 if(axis!=axisY()){
95 if(axis->parent()==this){
96 delete axis;
97 axis=0;
98 }
99 }
94 delete domain;
100 delete domain;
95 }
101 }
96
102
@@ -275,8 +281,13 Domain* ChartDataSet::domain(QSeries* series) const
275
281
276 Domain* ChartDataSet::domain(QChartAxis* axis) const
282 Domain* ChartDataSet::domain(QChartAxis* axis) const
277 {
283 {
284 if(axis==axisX()) {
285 return m_axisDomainMap.value(axisY());
286 }
287 else {
278 return m_axisDomainMap.value(axis);
288 return m_axisDomainMap.value(axis);
279 }
289 }
290 }
280
291
281 QChartAxis* ChartDataSet::axis(QSeries* series) const
292 QChartAxis* ChartDataSet::axis(QSeries* series) const
282 {
293 {
General Comments 0
You need to be logged in to leave comments. Login now