@@ -26,7 +26,7 | |||
|
26 | 26 | #include <QTime> |
|
27 | 27 | |
|
28 | 28 | ChartView::ChartView(QChart* chart,QWidget* parent):QChartView(chart,parent), |
|
29 |
m_index( |
|
|
29 | m_index(-1),m_chart(chart) | |
|
30 | 30 | { |
|
31 | 31 | m_chart->setTitle("Charts presenter"); |
|
32 | 32 | QObject::connect(&m_timer,SIGNAL(timeout()),this,SLOT(handleTimeout())); |
@@ -78,15 +78,12 m_index(0),m_chart(chart) | |||
|
78 | 78 | m_titles<< m_chart->title()+": AreaChart"; |
|
79 | 79 | //![3] |
|
80 | 80 | |
|
81 | m_chart->addSeries(series0); | |
|
82 | m_chart->setTitle(m_titles.at(0)); | |
|
83 | ||
|
84 | 81 | //![4] |
|
85 | 82 | foreach (QSeries* series, m_series) { |
|
86 | 83 | QObject::connect(series,SIGNAL(clicked(const QPointF&)),this,SLOT(handlePointClicked(const QPointF&))); |
|
87 | 84 | } |
|
88 | 85 | //![4] |
|
89 | ||
|
86 | QTimer::singleShot(0,this,SLOT(handleTimeout())); | |
|
90 | 87 | m_timer.start(); |
|
91 | 88 | } |
|
92 | 89 | |
@@ -101,6 +98,7 ChartView::~ChartView() | |||
|
101 | 98 | void ChartView::handleTimeout() |
|
102 | 99 | { |
|
103 | 100 | if(m_series.size()==0) return; |
|
101 | if(m_index>=0) | |
|
104 | 102 | m_chart->removeSeries(m_series.at(m_index)); |
|
105 | 103 | m_index++; |
|
106 | 104 | m_index=m_index%m_series.size(); |
General Comments 0
You need to be logged in to leave comments.
Login now