##// END OF EJS Templates
Fix piechartdrilldown bug. Chart was deleting the series from us.
Jani Honkonen -
r617:fd7ce4629ee8
parent child
Show More
@@ -47,6 +47,8 public:
47 47
48 48 void changeSeries(QSeries* series)
49 49 {
50 // NOTE: if the series is owned by the chart it will be deleted
51 // here the "window" owns the series...
50 52 if (m_currentSeries)
51 53 removeSeries(m_currentSeries);
52 54 m_currentSeries = series;
@@ -77,7 +79,7 int main(int argc, char *argv[])
77 79 drilldownChart->setRenderHint(QPainter::Antialiasing);
78 80 drilldownChart->setChartTheme(QChart::ChartThemeVanilla);
79 81
80 QPieSeries* yearSeries = new QPieSeries(drilldownChart);
82 QPieSeries* yearSeries = new QPieSeries(&window);
81 83 yearSeries->setTitle("Sales by year - All");
82 84
83 85 QList<QString> months;
@@ -86,7 +88,7 int main(int argc, char *argv[])
86 88 names << "Jane" << "John" << "Axel" << "Mary" << "Samantha" << "Bob";
87 89
88 90 foreach (QString name, names) {
89 QPieSeries* series = new QPieSeries(drilldownChart);
91 QPieSeries* series = new QPieSeries(&window);
90 92 series->setTitle("Sales by month - " + name);
91 93
92 94 foreach (QString month, months)
@@ -102,7 +104,7 int main(int argc, char *argv[])
102 104 drilldownChart->changeSeries(yearSeries);
103 105
104 106 window.setCentralWidget(drilldownChart);
105 window.resize(600, 600);
107 window.resize(800, 600);
106 108 window.show();
107 109
108 110 return a.exec();
General Comments 0
You need to be logged in to leave comments. Login now