diff --git a/demos/qmlchart/qml/qmlchart/View2.qml b/demos/qmlchart/qml/qmlchart/View2.qml index 71f7731..a0f750a 100644 --- a/demos/qmlchart/qml/qmlchart/View2.qml +++ b/demos/qmlchart/qml/qmlchart/View2.qml @@ -28,6 +28,7 @@ Rectangle { title: "Line&Spline" anchors.fill: parent theme: Chart.ChartThemeBrownSand + animationOptions: Chart.NoAnimation LineSeries { name: "Line" diff --git a/qmlplugin/declarativechart.cpp b/qmlplugin/declarativechart.cpp index eb6f2ff..2506707 100644 --- a/qmlplugin/declarativechart.cpp +++ b/qmlplugin/declarativechart.cpp @@ -36,11 +36,6 @@ DeclarativeChart::~DeclarativeChart() delete m_chart; } -QChart::ChartTheme DeclarativeChart::theme() -{ - return m_chart->theme(); -} - void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { Q_UNUSED(oldGeometry) @@ -61,6 +56,23 @@ void DeclarativeChart::paint(QPainter *painter, const QStyleOptionGraphicsItem * painter->setRenderHint(QPainter::Antialiasing, true); } +void DeclarativeChart::setAnimationOptions(QChart::AnimationOption animations) +{ + m_chart->setAnimationOptions(animations); +} + +QChart::AnimationOption DeclarativeChart::animationOptions() +{ + if (m_chart->animationOptions().testFlag(QChart::AllAnimations)) + return QChart::AllAnimations; + else if (m_chart->animationOptions().testFlag(QChart::GridAxisAnimations)) + return QChart::GridAxisAnimations; + else if (m_chart->animationOptions().testFlag(QChart::SeriesAnimations)) + return QChart::SeriesAnimations; + else + return QChart::NoAnimation; +} + #include "moc_declarativechart.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/qmlplugin/declarativechart.h b/qmlplugin/declarativechart.h index 125271d..45ad501 100644 --- a/qmlplugin/declarativechart.h +++ b/qmlplugin/declarativechart.h @@ -34,6 +34,7 @@ class DeclarativeChart : public QDeclarativeItem { Q_OBJECT Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme) + Q_PROPERTY(QChart::AnimationOption animationOptions READ animationOptions WRITE setAnimationOptions) Q_PROPERTY(QString title READ title WRITE setTitle) public: @@ -46,7 +47,9 @@ public: // From QDeclarativeItem/QGraphicsItem public: void setTheme(QChart::ChartTheme theme) {m_chart->setTheme(theme);} - QChart::ChartTheme theme(); + QChart::ChartTheme theme() {return m_chart->theme();} + void setAnimationOptions(QChart::AnimationOption animations); + QChart::AnimationOption animationOptions(); void setTitle(QString title) {m_chart->setTitle(title);} QString title() { return m_chart->title();} diff --git a/src/qchart.h b/src/qchart.h index 433d8bc..d1494d2 100644 --- a/src/qchart.h +++ b/src/qchart.h @@ -38,6 +38,7 @@ class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsWidget { Q_OBJECT Q_ENUMS(ChartTheme) + Q_ENUMS(AnimationOption) public: enum ChartTheme {