From 7312e565f0d975f59104ada13d04720eae3332b0 2012-04-04 08:31:44 From: Michal Klocek Date: 2012-04-04 08:31:44 Subject: [PATCH] Updates preseter example --- diff --git a/examples/presenterchart/chartview.cpp b/examples/presenterchart/chartview.cpp index ae1bb67..5c72c68 100644 --- a/examples/presenterchart/chartview.cpp +++ b/examples/presenterchart/chartview.cpp @@ -26,7 +26,7 @@ #include ChartView::ChartView(QChart* chart,QWidget* parent):QChartView(chart,parent), -m_index(0),m_chart(chart) +m_index(-1),m_chart(chart) { m_chart->setTitle("Charts presenter"); QObject::connect(&m_timer,SIGNAL(timeout()),this,SLOT(handleTimeout())); @@ -78,15 +78,12 @@ m_index(0),m_chart(chart) m_titles<< m_chart->title()+": AreaChart"; //![3] - m_chart->addSeries(series0); - m_chart->setTitle(m_titles.at(0)); - //![4] foreach (QSeries* series, m_series) { QObject::connect(series,SIGNAL(clicked(const QPointF&)),this,SLOT(handlePointClicked(const QPointF&))); } //![4] - + QTimer::singleShot(0,this,SLOT(handleTimeout())); m_timer.start(); } @@ -101,6 +98,7 @@ ChartView::~ChartView() void ChartView::handleTimeout() { if(m_series.size()==0) return; + if(m_index>=0) m_chart->removeSeries(m_series.at(m_index)); m_index++; m_index=m_index%m_series.size();