@@ -32,7 +32,7 | |||||
32 |
|
32 | |||
33 | \snippet ../examples/presenterchart/chartview.cpp 3 |
|
33 | \snippet ../examples/presenterchart/chartview.cpp 3 | |
34 |
|
34 | |||
35 | In \c handleTimeout() slot we change currently displayed chart by removing previous series and adding next series from the \c m_series list. We also set proper title. |
|
35 | In \c handleTimeout() slot we change currently displayed chart by removing previous series and adding next series from the \c m_series list. We also set proper title and create the axes for the chart. | |
36 |
|
36 | |||
37 | \snippet ../examples/presenterchart/chartview.cpp 4 |
|
37 | \snippet ../examples/presenterchart/chartview.cpp 4 | |
38 | */ |
|
38 | */ |
@@ -25,8 +25,10 | |||||
25 | #include <QAreaSeries> |
|
25 | #include <QAreaSeries> | |
26 | #include <QTime> |
|
26 | #include <QTime> | |
27 |
|
27 | |||
28 |
ChartView::ChartView(QChart* chart,QWidget* parent): |
|
28 | ChartView::ChartView(QChart* chart,QWidget* parent): | |
29 | m_index(-1),m_chart(chart) |
|
29 | QChartView(chart,parent), | |
|
30 | m_index(-1), | |||
|
31 | m_chart(chart) | |||
30 | { |
|
32 | { | |
31 | m_chart->setTitle("Charts presenter"); |
|
33 | m_chart->setTitle("Charts presenter"); | |
32 | m_chart->setDropShadowEnabled(false); |
|
34 | m_chart->setDropShadowEnabled(false); | |
@@ -91,5 +93,6 void ChartView::handleTimeout() | |||||
91 | m_index=m_index%m_series.size(); |
|
93 | m_index = m_index % m_series.size(); | |
92 | m_chart->addSeries(m_series.at(m_index)); |
|
94 | m_chart->addSeries(m_series.at(m_index)); | |
93 | m_chart->setTitle(m_titles.at(m_index)); |
|
95 | m_chart->setTitle(m_titles.at(m_index)); | |
|
96 | m_chart->createDefaultAxes(); | |||
94 | } |
|
97 | } | |
95 | //![4] |
|
98 | //![4] |
General Comments 0
You need to be logged in to leave comments.
Login now