##// END OF EJS Templates
Added animation configuration to QML chart api
Tero Ahola -
r1094:1573ff98f497
parent child
Show More
@@ -28,6 +28,7 Rectangle {
28 28 title: "Line&Spline"
29 29 anchors.fill: parent
30 30 theme: Chart.ChartThemeBrownSand
31 animationOptions: Chart.NoAnimation
31 32
32 33 LineSeries {
33 34 name: "Line"
@@ -36,11 +36,6 DeclarativeChart::~DeclarativeChart()
36 36 delete m_chart;
37 37 }
38 38
39 QChart::ChartTheme DeclarativeChart::theme()
40 {
41 return m_chart->theme();
42 }
43
44 39 void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
45 40 {
46 41 Q_UNUSED(oldGeometry)
@@ -61,6 +56,23 void DeclarativeChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *
61 56 painter->setRenderHint(QPainter::Antialiasing, true);
62 57 }
63 58
59 void DeclarativeChart::setAnimationOptions(QChart::AnimationOption animations)
60 {
61 m_chart->setAnimationOptions(animations);
62 }
63
64 QChart::AnimationOption DeclarativeChart::animationOptions()
65 {
66 if (m_chart->animationOptions().testFlag(QChart::AllAnimations))
67 return QChart::AllAnimations;
68 else if (m_chart->animationOptions().testFlag(QChart::GridAxisAnimations))
69 return QChart::GridAxisAnimations;
70 else if (m_chart->animationOptions().testFlag(QChart::SeriesAnimations))
71 return QChart::SeriesAnimations;
72 else
73 return QChart::NoAnimation;
74 }
75
64 76 #include "moc_declarativechart.cpp"
65 77
66 78 QTCOMMERCIALCHART_END_NAMESPACE
@@ -34,6 +34,7 class DeclarativeChart : public QDeclarativeItem
34 34 {
35 35 Q_OBJECT
36 36 Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme)
37 Q_PROPERTY(QChart::AnimationOption animationOptions READ animationOptions WRITE setAnimationOptions)
37 38 Q_PROPERTY(QString title READ title WRITE setTitle)
38 39
39 40 public:
@@ -46,7 +47,9 public: // From QDeclarativeItem/QGraphicsItem
46 47
47 48 public:
48 49 void setTheme(QChart::ChartTheme theme) {m_chart->setTheme(theme);}
49 QChart::ChartTheme theme();
50 QChart::ChartTheme theme() {return m_chart->theme();}
51 void setAnimationOptions(QChart::AnimationOption animations);
52 QChart::AnimationOption animationOptions();
50 53 void setTitle(QString title) {m_chart->setTitle(title);}
51 54 QString title() { return m_chart->title();}
52 55
@@ -38,6 +38,7 class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsWidget
38 38 {
39 39 Q_OBJECT
40 40 Q_ENUMS(ChartTheme)
41 Q_ENUMS(AnimationOption)
41 42
42 43 public:
43 44 enum ChartTheme {
General Comments 0
You need to be logged in to leave comments. Login now