@@ -25,13 +25,13 Q_DECLARE_METATYPE(QVector<qreal>) | |||||
25 | QT_CHARTS_BEGIN_NAMESPACE |
|
25 | QT_CHARTS_BEGIN_NAMESPACE | |
26 |
|
26 | |||
27 |
|
27 | |||
28 | AxisAnimation::AxisAnimation(ChartAxisElement *axis) |
|
28 | AxisAnimation::AxisAnimation(ChartAxisElement *axis, int duration, QEasingCurve &curve) | |
29 | : ChartAnimation(axis), |
|
29 | : ChartAnimation(axis), | |
30 | m_axis(axis), |
|
30 | m_axis(axis), | |
31 | m_type(DefaultAnimation) |
|
31 | m_type(DefaultAnimation) | |
32 | { |
|
32 | { | |
33 |
setDuration( |
|
33 | setDuration(duration); | |
34 |
setEasingCurve( |
|
34 | setEasingCurve(curve); | |
35 | } |
|
35 | } | |
36 |
|
36 | |||
37 | AxisAnimation::~AxisAnimation() |
|
37 | AxisAnimation::~AxisAnimation() |
@@ -39,7 +39,7 class AxisAnimation: public ChartAnimation | |||||
39 | { |
|
39 | { | |
40 | public: |
|
40 | public: | |
41 | enum Animation { DefaultAnimation, ZoomOutAnimation, ZoomInAnimation, MoveForwardAnimation, MoveBackwordAnimation}; |
|
41 | enum Animation { DefaultAnimation, ZoomOutAnimation, ZoomInAnimation, MoveForwardAnimation, MoveBackwordAnimation}; | |
42 | AxisAnimation(ChartAxisElement *axis); |
|
42 | AxisAnimation(ChartAxisElement *axis, int duration, QEasingCurve &curve); | |
43 | ~AxisAnimation(); |
|
43 | ~AxisAnimation(); | |
44 | void setAnimationType(Animation type); |
|
44 | void setAnimationType(Animation type); | |
45 | void setAnimationPoint(const QPointF &point); |
|
45 | void setAnimationPoint(const QPointF &point); |
@@ -23,12 +23,12 Q_DECLARE_METATYPE(QVector<QRectF>) | |||||
23 |
|
23 | |||
24 | QT_CHARTS_BEGIN_NAMESPACE |
|
24 | QT_CHARTS_BEGIN_NAMESPACE | |
25 |
|
25 | |||
26 | BarAnimation::BarAnimation(AbstractBarChartItem *item) |
|
26 | BarAnimation::BarAnimation(AbstractBarChartItem *item, int duration, QEasingCurve &curve) | |
27 | : ChartAnimation(item), |
|
27 | : ChartAnimation(item), | |
28 | m_item(item) |
|
28 | m_item(item) | |
29 | { |
|
29 | { | |
30 |
setDuration( |
|
30 | setDuration(duration); | |
31 |
setEasingCurve( |
|
31 | setEasingCurve(curve); | |
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 | BarAnimation::~BarAnimation() |
|
34 | BarAnimation::~BarAnimation() |
@@ -39,7 +39,7 class BarAnimation : public ChartAnimation | |||||
39 | Q_OBJECT |
|
39 | Q_OBJECT | |
40 |
|
40 | |||
41 | public: |
|
41 | public: | |
42 | BarAnimation(AbstractBarChartItem *item); |
|
42 | BarAnimation(AbstractBarChartItem *item, int duration, QEasingCurve &curve); | |
43 | ~BarAnimation(); |
|
43 | ~BarAnimation(); | |
44 |
|
44 | |||
45 | public: // from QVariantAnimation |
|
45 | public: // from QVariantAnimation |
@@ -23,9 +23,11 | |||||
23 |
|
23 | |||
24 | QT_CHARTS_BEGIN_NAMESPACE |
|
24 | QT_CHARTS_BEGIN_NAMESPACE | |
25 |
|
25 | |||
26 | BoxPlotAnimation::BoxPlotAnimation(BoxPlotChartItem *item) |
|
26 | BoxPlotAnimation::BoxPlotAnimation(BoxPlotChartItem *item, int duration, QEasingCurve &curve) | |
27 | : QObject(item), |
|
27 | : QObject(item), | |
28 | m_item(item) |
|
28 | m_item(item), | |
|
29 | m_animationDuration(duration), | |||
|
30 | m_animationCurve(curve) | |||
29 | { |
|
31 | { | |
30 | } |
|
32 | } | |
31 |
|
33 | |||
@@ -37,7 +39,7 void BoxPlotAnimation::addBox(BoxWhiskers *box) | |||||
37 | { |
|
39 | { | |
38 | BoxWhiskersAnimation *animation = m_animations.value(box); |
|
40 | BoxWhiskersAnimation *animation = m_animations.value(box); | |
39 | if (!animation) { |
|
41 | if (!animation) { | |
40 | animation = new BoxWhiskersAnimation(box, this); |
|
42 | animation = new BoxWhiskersAnimation(box, this, m_animationDuration, m_animationCurve); | |
41 | m_animations.insert(box, animation); |
|
43 | m_animations.insert(box, animation); | |
42 | BoxWhiskersData start; |
|
44 | BoxWhiskersData start; | |
43 | start.m_lowerExtreme = box->m_data.m_median; |
|
45 | start.m_lowerExtreme = box->m_data.m_median; | |
@@ -46,6 +48,7 void BoxPlotAnimation::addBox(BoxWhiskers *box) | |||||
46 | start.m_upperQuartile = box->m_data.m_median; |
|
48 | start.m_upperQuartile = box->m_data.m_median; | |
47 | start.m_upperExtreme = box->m_data.m_median; |
|
49 | start.m_upperExtreme = box->m_data.m_median; | |
48 | animation->setup(start, box->m_data); |
|
50 | animation->setup(start, box->m_data); | |
|
51 | ||||
49 | } else { |
|
52 | } else { | |
50 | animation->stop(); |
|
53 | animation->stop(); | |
51 | animation->setEndData(box->m_data); |
|
54 | animation->setEndData(box->m_data); |
@@ -41,7 +41,7 class BoxPlotAnimation : public QObject | |||||
41 | { |
|
41 | { | |
42 | Q_OBJECT |
|
42 | Q_OBJECT | |
43 | public: |
|
43 | public: | |
44 | BoxPlotAnimation(BoxPlotChartItem *item); |
|
44 | BoxPlotAnimation(BoxPlotChartItem *item, int duration, QEasingCurve &curve); | |
45 | ~BoxPlotAnimation(); |
|
45 | ~BoxPlotAnimation(); | |
46 |
|
46 | |||
47 | void addBox(BoxWhiskers *box); |
|
47 | void addBox(BoxWhiskers *box); | |
@@ -55,6 +55,8 public: | |||||
55 | protected: |
|
55 | protected: | |
56 | BoxPlotChartItem *m_item; |
|
56 | BoxPlotChartItem *m_item; | |
57 | QHash<BoxWhiskers *, BoxWhiskersAnimation *> m_animations; |
|
57 | QHash<BoxWhiskers *, BoxWhiskersAnimation *> m_animations; | |
|
58 | int m_animationDuration; | |||
|
59 | QEasingCurve m_animationCurve; | |||
58 | }; |
|
60 | }; | |
59 |
|
61 | |||
60 | QT_CHARTS_END_NAMESPACE |
|
62 | QT_CHARTS_END_NAMESPACE |
@@ -27,14 +27,15 Q_DECLARE_METATYPE(qreal) | |||||
27 |
|
27 | |||
28 | QT_CHARTS_BEGIN_NAMESPACE |
|
28 | QT_CHARTS_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 |
BoxWhiskersAnimation::BoxWhiskersAnimation(BoxWhiskers *box, BoxPlotAnimation *boxPlotAnimation |
|
30 | BoxWhiskersAnimation::BoxWhiskersAnimation(BoxWhiskers *box, BoxPlotAnimation *boxPlotAnimation, | |
|
31 | int duration, QEasingCurve &curve) | |||
31 | : ChartAnimation(box), |
|
32 | : ChartAnimation(box), | |
32 | m_box(box), |
|
33 | m_box(box), | |
33 | m_changeAnimation(false), |
|
34 | m_changeAnimation(false), | |
34 | m_boxPlotAnimation(boxPlotAnimation) |
|
35 | m_boxPlotAnimation(boxPlotAnimation) | |
35 | { |
|
36 | { | |
36 |
setDuration( |
|
37 | setDuration(duration); | |
37 |
setEasingCurve( |
|
38 | setEasingCurve(curve); | |
38 | } |
|
39 | } | |
39 |
|
40 | |||
40 | BoxWhiskersAnimation::~BoxWhiskersAnimation() |
|
41 | BoxWhiskersAnimation::~BoxWhiskersAnimation() |
@@ -42,7 +42,8 class BoxWhiskersAnimation : public ChartAnimation | |||||
42 | Q_OBJECT |
|
42 | Q_OBJECT | |
43 |
|
43 | |||
44 | public: |
|
44 | public: | |
45 |
BoxWhiskersAnimation(BoxWhiskers *box, BoxPlotAnimation *boxPlotAnimation |
|
45 | BoxWhiskersAnimation(BoxWhiskers *box, BoxPlotAnimation *boxPlotAnimation, int duration, | |
|
46 | QEasingCurve &curve); | |||
46 | ~BoxWhiskersAnimation(); |
|
47 | ~BoxWhiskersAnimation(); | |
47 |
|
48 | |||
48 | public: // from QVariantAnimation |
|
49 | public: // from QVariantAnimation |
@@ -22,9 +22,11 | |||||
22 |
|
22 | |||
23 | QT_CHARTS_BEGIN_NAMESPACE |
|
23 | QT_CHARTS_BEGIN_NAMESPACE | |
24 |
|
24 | |||
25 | PieAnimation::PieAnimation(PieChartItem *item) |
|
25 | PieAnimation::PieAnimation(PieChartItem *item, int duration, QEasingCurve &curve) | |
26 | : ChartAnimation(item), |
|
26 | : ChartAnimation(item), | |
27 | m_item(item) |
|
27 | m_item(item), | |
|
28 | m_animationDuration(duration), | |||
|
29 | m_animationCurve(curve) | |||
28 | { |
|
30 | { | |
29 | } |
|
31 | } | |
30 |
|
32 | |||
@@ -37,14 +39,14 ChartAnimation *PieAnimation::updateValue(PieSliceItem *sliceItem, const PieSlic | |||||
37 | PieSliceAnimation *animation = m_animations.value(sliceItem); |
|
39 | PieSliceAnimation *animation = m_animations.value(sliceItem); | |
38 | if (!animation) { |
|
40 | if (!animation) { | |
39 | animation = new PieSliceAnimation(sliceItem); |
|
41 | animation = new PieSliceAnimation(sliceItem); | |
|
42 | animation->setDuration(m_animationDuration); | |||
|
43 | animation->setEasingCurve(m_animationCurve); | |||
40 | m_animations.insert(sliceItem, animation); |
|
44 | m_animations.insert(sliceItem, animation); | |
41 | } else { |
|
45 | } else { | |
42 | animation->stop(); |
|
46 | animation->stop(); | |
43 | } |
|
47 | } | |
44 |
|
48 | |||
45 | animation->updateValue(sliceData); |
|
49 | animation->updateValue(sliceData); | |
46 | animation->setDuration(ChartAnimationDuration); |
|
|||
47 | animation->setEasingCurve(QEasingCurve::OutQuart); |
|
|||
48 |
|
50 | |||
49 | return animation; |
|
51 | return animation; | |
50 | } |
|
52 | } | |
@@ -52,6 +54,8 ChartAnimation *PieAnimation::updateValue(PieSliceItem *sliceItem, const PieSlic | |||||
52 | ChartAnimation *PieAnimation::addSlice(PieSliceItem *sliceItem, const PieSliceData &sliceData, bool startupAnimation) |
|
54 | ChartAnimation *PieAnimation::addSlice(PieSliceItem *sliceItem, const PieSliceData &sliceData, bool startupAnimation) | |
53 | { |
|
55 | { | |
54 | PieSliceAnimation *animation = new PieSliceAnimation(sliceItem); |
|
56 | PieSliceAnimation *animation = new PieSliceAnimation(sliceItem); | |
|
57 | animation->setDuration(m_animationDuration); | |||
|
58 | animation->setEasingCurve(m_animationCurve); | |||
55 | m_animations.insert(sliceItem, animation); |
|
59 | m_animations.insert(sliceItem, animation); | |
56 |
|
60 | |||
57 | PieSliceData startValue = sliceData; |
|
61 | PieSliceData startValue = sliceData; | |
@@ -66,8 +70,6 ChartAnimation *PieAnimation::addSlice(PieSliceItem *sliceItem, const PieSliceDa | |||||
66 | startValue.m_radius = sliceData.m_holeRadius; |
|
70 | startValue.m_radius = sliceData.m_holeRadius; | |
67 |
|
71 | |||
68 | animation->setValue(startValue, sliceData); |
|
72 | animation->setValue(startValue, sliceData); | |
69 | animation->setDuration(ChartAnimationDuration); |
|
|||
70 | animation->setEasingCurve(QEasingCurve::OutQuart); |
|
|||
71 |
|
73 | |||
72 | return animation; |
|
74 | return animation; | |
73 | } |
|
75 | } | |
@@ -88,8 +90,6 ChartAnimation *PieAnimation::removeSlice(PieSliceItem *sliceItem) | |||||
88 | endValue.m_isLabelVisible = false; |
|
90 | endValue.m_isLabelVisible = false; | |
89 |
|
91 | |||
90 | animation->updateValue(endValue); |
|
92 | animation->updateValue(endValue); | |
91 | animation->setDuration(ChartAnimationDuration); |
|
|||
92 | animation->setEasingCurve(QEasingCurve::OutQuart); |
|
|||
93 |
|
93 | |||
94 | // PieSliceItem is the parent of PieSliceAnimation so the animation will be deleted as well.. |
|
94 | // PieSliceItem is the parent of PieSliceAnimation so the animation will be deleted as well.. | |
95 | connect(animation, SIGNAL(finished()), sliceItem, SLOT(deleteLater())); |
|
95 | connect(animation, SIGNAL(finished()), sliceItem, SLOT(deleteLater())); |
@@ -41,7 +41,7 class PieAnimation : public ChartAnimation | |||||
41 | Q_OBJECT |
|
41 | Q_OBJECT | |
42 |
|
42 | |||
43 | public: |
|
43 | public: | |
44 | PieAnimation(PieChartItem *item); |
|
44 | PieAnimation(PieChartItem *item, int duration, QEasingCurve &curve); | |
45 | ~PieAnimation(); |
|
45 | ~PieAnimation(); | |
46 | ChartAnimation *updateValue(PieSliceItem *sliceItem, const PieSliceData &newValue); |
|
46 | ChartAnimation *updateValue(PieSliceItem *sliceItem, const PieSliceData &newValue); | |
47 | ChartAnimation *addSlice(PieSliceItem *sliceItem, const PieSliceData &endValue, bool startupAnimation); |
|
47 | ChartAnimation *addSlice(PieSliceItem *sliceItem, const PieSliceData &endValue, bool startupAnimation); | |
@@ -53,6 +53,8 public: // from QVariantAnimation | |||||
53 | private: |
|
53 | private: | |
54 | PieChartItem *m_item; |
|
54 | PieChartItem *m_item; | |
55 | QHash<PieSliceItem *, PieSliceAnimation *> m_animations; |
|
55 | QHash<PieSliceItem *, PieSliceAnimation *> m_animations; | |
|
56 | int m_animationDuration; | |||
|
57 | QEasingCurve m_animationCurve; | |||
56 | }; |
|
58 | }; | |
57 |
|
59 | |||
58 | QT_CHARTS_END_NAMESPACE |
|
60 | QT_CHARTS_END_NAMESPACE |
@@ -22,8 +22,8 | |||||
22 |
|
22 | |||
23 | QT_CHARTS_BEGIN_NAMESPACE |
|
23 | QT_CHARTS_BEGIN_NAMESPACE | |
24 |
|
24 | |||
25 | ScatterAnimation::ScatterAnimation(ScatterChartItem *item) |
|
25 | ScatterAnimation::ScatterAnimation(ScatterChartItem *item, int duration, QEasingCurve &curve) | |
26 | : XYAnimation(item) |
|
26 | : XYAnimation(item, duration, curve) | |
27 | { |
|
27 | { | |
28 | } |
|
28 | } | |
29 |
|
29 |
@@ -36,7 +36,7 class ScatterChartItem; | |||||
36 | class ScatterAnimation : public XYAnimation |
|
36 | class ScatterAnimation : public XYAnimation | |
37 | { |
|
37 | { | |
38 | public: |
|
38 | public: | |
39 | ScatterAnimation(ScatterChartItem *item); |
|
39 | ScatterAnimation(ScatterChartItem *item, int duration, QEasingCurve &curve); | |
40 | ~ScatterAnimation(); |
|
40 | ~ScatterAnimation(); | |
41 |
|
41 | |||
42 | protected: |
|
42 | protected: |
@@ -25,8 +25,8 Q_DECLARE_METATYPE(SplineVector) | |||||
25 |
|
25 | |||
26 | QT_CHARTS_BEGIN_NAMESPACE |
|
26 | QT_CHARTS_BEGIN_NAMESPACE | |
27 |
|
27 | |||
28 | SplineAnimation::SplineAnimation(SplineChartItem *item) |
|
28 | SplineAnimation::SplineAnimation(SplineChartItem *item, int duration, QEasingCurve &curve) | |
29 | : XYAnimation(item), |
|
29 | : XYAnimation(item, duration, curve), | |
30 | m_item(item), |
|
30 | m_item(item), | |
31 | m_valid(false) |
|
31 | m_valid(false) | |
32 | { |
|
32 | { |
@@ -39,7 +39,7 class SplineChartItem; | |||||
39 | class SplineAnimation : public XYAnimation |
|
39 | class SplineAnimation : public XYAnimation | |
40 | { |
|
40 | { | |
41 | public: |
|
41 | public: | |
42 | SplineAnimation(SplineChartItem *item); |
|
42 | SplineAnimation(SplineChartItem *item, int duration, QEasingCurve &curve); | |
43 | ~SplineAnimation(); |
|
43 | ~SplineAnimation(); | |
44 | void setup(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, QVector<QPointF> &oldContorlPoints, QVector<QPointF> &newControlPoints, int index = -1); |
|
44 | void setup(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, QVector<QPointF> &oldContorlPoints, QVector<QPointF> &newControlPoints, int index = -1); | |
45 |
|
45 |
@@ -24,15 +24,15 Q_DECLARE_METATYPE(QVector<QPointF>) | |||||
24 |
|
24 | |||
25 | QT_CHARTS_BEGIN_NAMESPACE |
|
25 | QT_CHARTS_BEGIN_NAMESPACE | |
26 |
|
26 | |||
27 | XYAnimation::XYAnimation(XYChart *item) |
|
27 | XYAnimation::XYAnimation(XYChart *item, int duration, QEasingCurve &curve) | |
28 | : ChartAnimation(item), |
|
28 | : ChartAnimation(item), | |
29 | m_type(NewAnimation), |
|
29 | m_type(NewAnimation), | |
30 | m_dirty(false), |
|
30 | m_dirty(false), | |
31 | m_index(-1), |
|
31 | m_index(-1), | |
32 | m_item(item) |
|
32 | m_item(item) | |
33 | { |
|
33 | { | |
34 |
setDuration( |
|
34 | setDuration(duration); | |
35 |
setEasingCurve( |
|
35 | setEasingCurve(curve); | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 | XYAnimation::~XYAnimation() |
|
38 | XYAnimation::~XYAnimation() |
@@ -40,7 +40,7 class XYAnimation : public ChartAnimation | |||||
40 | protected: |
|
40 | protected: | |
41 | enum Animation { AddPointAnimation, RemovePointAnimation, ReplacePointAnimation, NewAnimation }; |
|
41 | enum Animation { AddPointAnimation, RemovePointAnimation, ReplacePointAnimation, NewAnimation }; | |
42 | public: |
|
42 | public: | |
43 | XYAnimation(XYChart *item); |
|
43 | XYAnimation(XYChart *item, int duration, QEasingCurve &curve); | |
44 | ~XYAnimation(); |
|
44 | ~XYAnimation(); | |
45 | void setup(const QVector<QPointF> &oldPoints, const QVector<QPointF> &newPoints, int index = -1); |
|
45 | void setup(const QVector<QPointF> &oldPoints, const QVector<QPointF> &newPoints, int index = -1); | |
46 | Animation animationType() const { return m_type; }; |
|
46 | Animation animationType() const { return m_type; }; |
@@ -620,7 +620,8 void QAreaSeriesPrivate::initializeGraphics(QGraphicsItem* parent) | |||||
620 | m_item.reset(area); |
|
620 | m_item.reset(area); | |
621 | QAbstractSeriesPrivate::initializeGraphics(parent); |
|
621 | QAbstractSeriesPrivate::initializeGraphics(parent); | |
622 | } |
|
622 | } | |
623 |
void QAreaSeriesPrivate::initializeAnimations(QChart::AnimationOptions options |
|
623 | void QAreaSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, | |
|
624 | QEasingCurve &curve) | |||
624 | { |
|
625 | { | |
625 | Q_Q(QAreaSeries); |
|
626 | Q_Q(QAreaSeries); | |
626 | AreaChartItem *area = static_cast<AreaChartItem *>(m_item.data()); |
|
627 | AreaChartItem *area = static_cast<AreaChartItem *>(m_item.data()); | |
@@ -631,16 +632,18 void QAreaSeriesPrivate::initializeAnimations(QChart::AnimationOptions options) | |||||
631 | area->lowerLineItem()->animation()->stopAndDestroyLater(); |
|
632 | area->lowerLineItem()->animation()->stopAndDestroyLater(); | |
632 |
|
633 | |||
633 | if (options.testFlag(QChart::SeriesAnimations)) { |
|
634 | if (options.testFlag(QChart::SeriesAnimations)) { | |
634 |
area->upperLineItem()->setAnimation(new XYAnimation(area->upperLineItem() |
|
635 | area->upperLineItem()->setAnimation(new XYAnimation(area->upperLineItem(), duration, | |
|
636 | curve)); | |||
635 | if (q->lowerSeries()) |
|
637 | if (q->lowerSeries()) | |
636 |
area->lowerLineItem()->setAnimation(new XYAnimation(area->lowerLineItem() |
|
638 | area->lowerLineItem()->setAnimation(new XYAnimation(area->lowerLineItem(), duration, | |
|
639 | curve)); | |||
637 | } else { |
|
640 | } else { | |
638 | if (q->upperSeries()) |
|
641 | if (q->upperSeries()) | |
639 | area->upperLineItem()->setAnimation(0); |
|
642 | area->upperLineItem()->setAnimation(0); | |
640 | if (q->lowerSeries()) |
|
643 | if (q->lowerSeries()) | |
641 | area->lowerLineItem()->setAnimation(0); |
|
644 | area->lowerLineItem()->setAnimation(0); | |
642 | } |
|
645 | } | |
643 | QAbstractSeriesPrivate::initializeAnimations(options); |
|
646 | QAbstractSeriesPrivate::initializeAnimations(options, duration, curve); | |
644 | } |
|
647 | } | |
645 |
|
648 | |||
646 | QList<QLegendMarker*> QAreaSeriesPrivate::createLegendMarkers(QLegend* legend) |
|
649 | QList<QLegendMarker*> QAreaSeriesPrivate::createLegendMarkers(QLegend* legend) |
@@ -46,7 +46,8 public: | |||||
46 | void initializeAxes(); |
|
46 | void initializeAxes(); | |
47 | void initializeGraphics(QGraphicsItem* parent); |
|
47 | void initializeGraphics(QGraphicsItem* parent); | |
48 | void initializeTheme(int index, ChartTheme* theme, bool forced = false); |
|
48 | void initializeTheme(int index, ChartTheme* theme, bool forced = false); | |
49 |
void initializeAnimations(QChart::AnimationOptions options |
|
49 | void initializeAnimations(QChart::AnimationOptions options, int duration, | |
|
50 | QEasingCurve &curve); | |||
50 |
|
51 | |||
51 | QList<QLegendMarker *> createLegendMarkers(QLegend *legend); |
|
52 | QList<QLegendMarker *> createLegendMarkers(QLegend *legend); | |
52 |
|
53 |
@@ -1018,7 +1018,8 void QAbstractAxisPrivate::initializeGraphics(QGraphicsItem* parent) | |||||
1018 | Q_UNUSED(parent); |
|
1018 | Q_UNUSED(parent); | |
1019 | } |
|
1019 | } | |
1020 |
|
1020 | |||
1021 |
void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options |
|
1021 | void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, | |
|
1022 | QEasingCurve &curve) | |||
1022 | { |
|
1023 | { | |
1023 | ChartAxisElement *axis = m_item.data(); |
|
1024 | ChartAxisElement *axis = m_item.data(); | |
1024 | Q_ASSERT(axis); |
|
1025 | Q_ASSERT(axis); | |
@@ -1026,7 +1027,7 void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options | |||||
1026 | axis->animation()->stopAndDestroyLater(); |
|
1027 | axis->animation()->stopAndDestroyLater(); | |
1027 |
|
1028 | |||
1028 | if (options.testFlag(QChart::GridAxisAnimations)) |
|
1029 | if (options.testFlag(QChart::GridAxisAnimations)) | |
1029 | axis->setAnimation(new AxisAnimation(axis)); |
|
1030 | axis->setAnimation(new AxisAnimation(axis, duration, curve)); | |
1030 | else |
|
1031 | else | |
1031 | axis->setAnimation(0); |
|
1032 | axis->setAnimation(0); | |
1032 | } |
|
1033 | } |
@@ -61,7 +61,8 public: | |||||
61 | virtual void initializeDomain(AbstractDomain *domain) = 0; |
|
61 | virtual void initializeDomain(AbstractDomain *domain) = 0; | |
62 | virtual void initializeGraphics(QGraphicsItem *parent) = 0; |
|
62 | virtual void initializeGraphics(QGraphicsItem *parent) = 0; | |
63 | virtual void initializeTheme(ChartTheme* theme, bool forced = false); |
|
63 | virtual void initializeTheme(ChartTheme* theme, bool forced = false); | |
64 |
virtual void initializeAnimations(QChart::AnimationOptions options |
|
64 | virtual void initializeAnimations(QChart::AnimationOptions options, int duration, | |
|
65 | QEasingCurve &curve); | |||
65 |
|
66 | |||
66 | //interface for manipulating range form base class |
|
67 | //interface for manipulating range form base class | |
67 | virtual void setMin(const QVariant &min) = 0; |
|
68 | virtual void setMin(const QVariant &min) = 0; |
@@ -1072,7 +1072,8 void QAbstractBarSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bo | |||||
1072 | emit updatedBars(); |
|
1072 | emit updatedBars(); | |
1073 | } |
|
1073 | } | |
1074 |
|
1074 | |||
1075 |
void QAbstractBarSeriesPrivate::initializeAnimations(QChart::AnimationOptions options |
|
1075 | void QAbstractBarSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, | |
|
1076 | QEasingCurve &curve) | |||
1076 | { |
|
1077 | { | |
1077 | AbstractBarChartItem *bar = static_cast<AbstractBarChartItem *>(m_item.data()); |
|
1078 | AbstractBarChartItem *bar = static_cast<AbstractBarChartItem *>(m_item.data()); | |
1078 | Q_ASSERT(bar); |
|
1079 | Q_ASSERT(bar); | |
@@ -1080,10 +1081,10 void QAbstractBarSeriesPrivate::initializeAnimations(QChart::AnimationOptions op | |||||
1080 | bar->animation()->stopAndDestroyLater(); |
|
1081 | bar->animation()->stopAndDestroyLater(); | |
1081 |
|
1082 | |||
1082 | if (options.testFlag(QChart::SeriesAnimations)) |
|
1083 | if (options.testFlag(QChart::SeriesAnimations)) | |
1083 | bar->setAnimation(new BarAnimation(bar)); |
|
1084 | bar->setAnimation(new BarAnimation(bar, duration, curve)); | |
1084 | else |
|
1085 | else | |
1085 | bar->setAnimation(0); |
|
1086 | bar->setAnimation(0); | |
1086 | QAbstractSeriesPrivate::initializeAnimations(options); |
|
1087 | QAbstractSeriesPrivate::initializeAnimations(options, duration, curve); | |
1087 | } |
|
1088 | } | |
1088 |
|
1089 | |||
1089 | #include "moc_qabstractbarseries.cpp" |
|
1090 | #include "moc_qabstractbarseries.cpp" |
@@ -54,7 +54,7 public: | |||||
54 |
|
54 | |||
55 | void initializeDomain(); |
|
55 | void initializeDomain(); | |
56 | void initializeAxes(); |
|
56 | void initializeAxes(); | |
57 | void initializeAnimations(QChart::AnimationOptions options); |
|
57 | void initializeAnimations(QChart::AnimationOptions options, int duration, QEasingCurve &curve); | |
58 | void initializeTheme(int index, ChartTheme* theme, bool forced = false); |
|
58 | void initializeTheme(int index, ChartTheme* theme, bool forced = false); | |
59 |
|
59 | |||
60 | QList<QLegendMarker*> createLegendMarkers(QLegend *legend); |
|
60 | QList<QLegendMarker*> createLegendMarkers(QLegend *legend); |
@@ -485,7 +485,8 void QBoxPlotSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool f | |||||
485 | } |
|
485 | } | |
486 | } |
|
486 | } | |
487 |
|
487 | |||
488 |
void QBoxPlotSeriesPrivate::initializeAnimations(QChart::AnimationOptions options |
|
488 | void QBoxPlotSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, | |
|
489 | QEasingCurve &curve) | |||
489 | { |
|
490 | { | |
490 | BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.data()); |
|
491 | BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.data()); | |
491 | Q_ASSERT(item); |
|
492 | Q_ASSERT(item); | |
@@ -493,12 +494,15 void QBoxPlotSeriesPrivate::initializeAnimations(QChart::AnimationOptions option | |||||
493 | item->animation()->stopAndDestroyLater(); |
|
494 | item->animation()->stopAndDestroyLater(); | |
494 |
|
495 | |||
495 | if (options.testFlag(QChart::SeriesAnimations)) |
|
496 | if (options.testFlag(QChart::SeriesAnimations)) | |
496 | m_animation = new BoxPlotAnimation(item); |
|
497 | m_animation = new BoxPlotAnimation(item, duration, curve); | |
497 | else |
|
498 | else | |
498 | m_animation = 0; |
|
499 | m_animation = 0; | |
499 | item->setAnimation(m_animation); |
|
500 | item->setAnimation(m_animation); | |
500 |
|
501 | |||
501 | QAbstractSeriesPrivate::initializeAnimations(options); |
|
502 | QAbstractSeriesPrivate::initializeAnimations(options, duration, curve); | |
|
503 | ||||
|
504 | // Make BoxPlotChartItem to instantiate box & whisker items | |||
|
505 | item->handleDataStructureChanged(); | |||
502 | } |
|
506 | } | |
503 |
|
507 | |||
504 | QList<QLegendMarker*> QBoxPlotSeriesPrivate::createLegendMarkers(QLegend *legend) |
|
508 | QList<QLegendMarker*> QBoxPlotSeriesPrivate::createLegendMarkers(QLegend *legend) |
@@ -48,7 +48,7 public: | |||||
48 | void initializeGraphics(QGraphicsItem *parent); |
|
48 | void initializeGraphics(QGraphicsItem *parent); | |
49 | void initializeDomain(); |
|
49 | void initializeDomain(); | |
50 | void initializeAxes(); |
|
50 | void initializeAxes(); | |
51 | void initializeAnimations(QChart::AnimationOptions options); |
|
51 | void initializeAnimations(QChart::AnimationOptions options, int duration, QEasingCurve &curve); | |
52 | void initializeTheme(int index, ChartTheme *theme, bool forced = false); |
|
52 | void initializeTheme(int index, ChartTheme *theme, bool forced = false); | |
53 |
|
53 | |||
54 | QList<QLegendMarker*> createLegendMarkers(QLegend *legend); |
|
54 | QList<QLegendMarker*> createLegendMarkers(QLegend *legend); |
@@ -39,6 +39,8 ChartPresenter::ChartPresenter(QChart *chart, QChart::ChartType type) | |||||
39 | : QObject(chart), |
|
39 | : QObject(chart), | |
40 | m_chart(chart), |
|
40 | m_chart(chart), | |
41 | m_options(QChart::NoAnimation), |
|
41 | m_options(QChart::NoAnimation), | |
|
42 | m_animationDuration(ChartAnimationDuration), | |||
|
43 | m_animationCurve(QEasingCurve::OutQuart), | |||
42 | m_state(ShowState), |
|
44 | m_state(ShowState), | |
43 | m_background(0), |
|
45 | m_background(0), | |
44 | m_plotAreaBackground(0), |
|
46 | m_plotAreaBackground(0), | |
@@ -77,7 +79,7 QRectF ChartPresenter::geometry() const | |||||
77 | void ChartPresenter::handleAxisAdded(QAbstractAxis *axis) |
|
79 | void ChartPresenter::handleAxisAdded(QAbstractAxis *axis) | |
78 | { |
|
80 | { | |
79 | axis->d_ptr->initializeGraphics(rootItem()); |
|
81 | axis->d_ptr->initializeGraphics(rootItem()); | |
80 | axis->d_ptr->initializeAnimations(m_options); |
|
82 | axis->d_ptr->initializeAnimations(m_options, m_animationDuration, m_animationCurve); | |
81 | ChartAxisElement *item = axis->d_ptr->axisItem(); |
|
83 | ChartAxisElement *item = axis->d_ptr->axisItem(); | |
82 | item->setPresenter(this); |
|
84 | item->setPresenter(this); | |
83 | item->setThemeManager(m_chart->d_ptr->m_themeManager); |
|
85 | item->setThemeManager(m_chart->d_ptr->m_themeManager); | |
@@ -101,7 +103,7 void ChartPresenter::handleAxisRemoved(QAbstractAxis *axis) | |||||
101 | void ChartPresenter::handleSeriesAdded(QAbstractSeries *series) |
|
103 | void ChartPresenter::handleSeriesAdded(QAbstractSeries *series) | |
102 | { |
|
104 | { | |
103 | series->d_ptr->initializeGraphics(rootItem()); |
|
105 | series->d_ptr->initializeGraphics(rootItem()); | |
104 | series->d_ptr->initializeAnimations(m_options); |
|
106 | series->d_ptr->initializeAnimations(m_options, m_animationDuration, m_animationCurve); | |
105 | series->d_ptr->setPresenter(this); |
|
107 | series->d_ptr->setPresenter(this); | |
106 | ChartItem *chart = series->d_ptr->chartItem(); |
|
108 | ChartItem *chart = series->d_ptr->chartItem(); | |
107 | chart->setPresenter(this); |
|
109 | chart->setPresenter(this); | |
@@ -134,16 +136,41 void ChartPresenter::setAnimationOptions(QChart::AnimationOptions options) | |||||
134 | m_options = options; |
|
136 | m_options = options; | |
135 | if (options.testFlag(QChart::SeriesAnimations) != oldOptions.testFlag(QChart::SeriesAnimations)) { |
|
137 | if (options.testFlag(QChart::SeriesAnimations) != oldOptions.testFlag(QChart::SeriesAnimations)) { | |
136 | foreach (QAbstractSeries *series, m_series) |
|
138 | foreach (QAbstractSeries *series, m_series) | |
137 |
series->d_ptr->initializeAnimations(m_options |
|
139 | series->d_ptr->initializeAnimations(m_options, m_animationDuration, | |
|
140 | m_animationCurve); | |||
138 | } |
|
141 | } | |
139 | if (options.testFlag(QChart::GridAxisAnimations) != oldOptions.testFlag(QChart::GridAxisAnimations)) { |
|
142 | if (options.testFlag(QChart::GridAxisAnimations) != oldOptions.testFlag(QChart::GridAxisAnimations)) { | |
140 | foreach (QAbstractAxis *axis, m_axes) |
|
143 | foreach (QAbstractAxis *axis, m_axes) | |
141 | axis->d_ptr->initializeAnimations(m_options); |
|
144 | axis->d_ptr->initializeAnimations(m_options, m_animationDuration, m_animationCurve); | |
142 | } |
|
145 | } | |
143 | m_layout->invalidate(); // So that existing animations don't just stop halfway |
|
146 | m_layout->invalidate(); // So that existing animations don't just stop halfway | |
144 | } |
|
147 | } | |
145 | } |
|
148 | } | |
146 |
|
149 | |||
|
150 | void ChartPresenter::setAnimationDuration(int msecs) | |||
|
151 | { | |||
|
152 | if (m_animationDuration != msecs) { | |||
|
153 | m_animationDuration = msecs; | |||
|
154 | foreach (QAbstractSeries *series, m_series) | |||
|
155 | series->d_ptr->initializeAnimations(m_options, m_animationDuration, m_animationCurve); | |||
|
156 | foreach (QAbstractAxis *axis, m_axes) | |||
|
157 | axis->d_ptr->initializeAnimations(m_options, m_animationDuration, m_animationCurve); | |||
|
158 | m_layout->invalidate(); // So that existing animations don't just stop halfway | |||
|
159 | } | |||
|
160 | } | |||
|
161 | ||||
|
162 | void ChartPresenter::setAnimationEasingCurve(const QEasingCurve &curve) | |||
|
163 | { | |||
|
164 | if (m_animationCurve != curve) { | |||
|
165 | m_animationCurve = curve; | |||
|
166 | foreach (QAbstractSeries *series, m_series) | |||
|
167 | series->d_ptr->initializeAnimations(m_options, m_animationDuration, m_animationCurve); | |||
|
168 | foreach (QAbstractAxis *axis, m_axes) | |||
|
169 | axis->d_ptr->initializeAnimations(m_options, m_animationDuration, m_animationCurve); | |||
|
170 | m_layout->invalidate(); // So that existing animations don't just stop halfway | |||
|
171 | } | |||
|
172 | } | |||
|
173 | ||||
147 | void ChartPresenter::setState(State state,QPointF point) |
|
174 | void ChartPresenter::setState(State state,QPointF point) | |
148 | { |
|
175 | { | |
149 | m_state=state; |
|
176 | m_state=state; |
@@ -137,6 +137,10 public: | |||||
137 |
|
137 | |||
138 | void setAnimationOptions(QChart::AnimationOptions options); |
|
138 | void setAnimationOptions(QChart::AnimationOptions options); | |
139 | QChart::AnimationOptions animationOptions() const; |
|
139 | QChart::AnimationOptions animationOptions() const; | |
|
140 | void setAnimationDuration(int msecs); | |||
|
141 | int animationDuration() const { return m_animationDuration; } | |||
|
142 | void setAnimationEasingCurve(const QEasingCurve &curve); | |||
|
143 | QEasingCurve animationEasingCurve() const { return m_animationCurve; } | |||
140 |
|
144 | |||
141 | void startAnimation(ChartAnimation *animation); |
|
145 | void startAnimation(ChartAnimation *animation); | |
142 |
|
146 | |||
@@ -177,6 +181,8 private: | |||||
177 | QList<QAbstractSeries *> m_series; |
|
181 | QList<QAbstractSeries *> m_series; | |
178 | QList<QAbstractAxis *> m_axes; |
|
182 | QList<QAbstractAxis *> m_axes; | |
179 | QChart::AnimationOptions m_options; |
|
183 | QChart::AnimationOptions m_options; | |
|
184 | int m_animationDuration; | |||
|
185 | QEasingCurve m_animationCurve; | |||
180 | State m_state; |
|
186 | State m_state; | |
181 | QPointF m_statePoint; |
|
187 | QPointF m_statePoint; | |
182 | AbstractChartLayout *m_layout; |
|
188 | AbstractChartLayout *m_layout; |
@@ -932,7 +932,8 void QPieSeriesPrivate::initializeGraphics(QGraphicsItem* parent) | |||||
932 | QAbstractSeriesPrivate::initializeGraphics(parent); |
|
932 | QAbstractSeriesPrivate::initializeGraphics(parent); | |
933 | } |
|
933 | } | |
934 |
|
934 | |||
935 |
void QPieSeriesPrivate::initializeAnimations(QtCharts::QChart::AnimationOptions options |
|
935 | void QPieSeriesPrivate::initializeAnimations(QtCharts::QChart::AnimationOptions options, | |
|
936 | int duration, QEasingCurve &curve) | |||
936 | { |
|
937 | { | |
937 | PieChartItem *item = static_cast<PieChartItem *>(m_item.data()); |
|
938 | PieChartItem *item = static_cast<PieChartItem *>(m_item.data()); | |
938 | Q_ASSERT(item); |
|
939 | Q_ASSERT(item); | |
@@ -940,10 +941,10 void QPieSeriesPrivate::initializeAnimations(QtCharts::QChart::AnimationOptions | |||||
940 | item->animation()->stopAndDestroyLater(); |
|
941 | item->animation()->stopAndDestroyLater(); | |
941 |
|
942 | |||
942 | if (options.testFlag(QChart::SeriesAnimations)) |
|
943 | if (options.testFlag(QChart::SeriesAnimations)) | |
943 | item->setAnimation(new PieAnimation(item)); |
|
944 | item->setAnimation(new PieAnimation(item, duration, curve)); | |
944 | else |
|
945 | else | |
945 | item->setAnimation(0); |
|
946 | item->setAnimation(0); | |
946 | QAbstractSeriesPrivate::initializeAnimations(options); |
|
947 | QAbstractSeriesPrivate::initializeAnimations(options, duration, curve); | |
947 | } |
|
948 | } | |
948 |
|
949 | |||
949 | QList<QLegendMarker*> QPieSeriesPrivate::createLegendMarkers(QLegend* legend) |
|
950 | QList<QLegendMarker*> QPieSeriesPrivate::createLegendMarkers(QLegend* legend) |
@@ -45,7 +45,8 public: | |||||
45 | void initializeDomain(); |
|
45 | void initializeDomain(); | |
46 | void initializeAxes(); |
|
46 | void initializeAxes(); | |
47 | void initializeGraphics(QGraphicsItem* parent); |
|
47 | void initializeGraphics(QGraphicsItem* parent); | |
48 |
void initializeAnimations(QtCharts::QChart::AnimationOptions options |
|
48 | void initializeAnimations(QtCharts::QChart::AnimationOptions options, int duration, | |
|
49 | QEasingCurve &curve); | |||
49 | void initializeTheme(int index, ChartTheme* theme, bool forced = false); |
|
50 | void initializeTheme(int index, ChartTheme* theme, bool forced = false); | |
50 |
|
51 | |||
51 | QList<QLegendMarker *> createLegendMarkers(QLegend *legend); |
|
52 | QList<QLegendMarker *> createLegendMarkers(QLegend *legend); |
@@ -312,9 +312,12 void QAbstractSeriesPrivate::initializeGraphics(QGraphicsItem* parent) | |||||
312 | QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated())); |
|
312 | QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated())); | |
313 | } |
|
313 | } | |
314 |
|
314 | |||
315 |
void QAbstractSeriesPrivate::initializeAnimations(QChart::AnimationOptions options |
|
315 | void QAbstractSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, | |
|
316 | QEasingCurve &curve) | |||
316 | { |
|
317 | { | |
317 | Q_UNUSED(options); |
|
318 | Q_UNUSED(options); | |
|
319 | Q_UNUSED(duration); | |||
|
320 | Q_UNUSED(curve); | |||
318 | } |
|
321 | } | |
319 |
|
322 | |||
320 | bool QAbstractSeriesPrivate::reverseXAxis() |
|
323 | bool QAbstractSeriesPrivate::reverseXAxis() |
@@ -61,7 +61,8 public: | |||||
61 | virtual void initializeAxes() = 0; |
|
61 | virtual void initializeAxes() = 0; | |
62 | virtual void initializeTheme(int index, ChartTheme* theme, bool forced = false) = 0; |
|
62 | virtual void initializeTheme(int index, ChartTheme* theme, bool forced = false) = 0; | |
63 | virtual void initializeGraphics(QGraphicsItem* parent) = 0; |
|
63 | virtual void initializeGraphics(QGraphicsItem* parent) = 0; | |
64 |
virtual void initializeAnimations(QChart::AnimationOptions options |
|
64 | virtual void initializeAnimations(QChart::AnimationOptions options, int duration, | |
|
65 | QEasingCurve &curve) = 0; | |||
65 |
|
66 | |||
66 | virtual QList<QLegendMarker*> createLegendMarkers(QLegend* legend) = 0; |
|
67 | virtual QList<QLegendMarker*> createLegendMarkers(QLegend* legend) = 0; | |
67 |
|
68 |
@@ -85,6 +85,16 QT_CHARTS_BEGIN_NAMESPACE | |||||
85 | */ |
|
85 | */ | |
86 |
|
86 | |||
87 | /*! |
|
87 | /*! | |
|
88 | \property QChart::animationDuration | |||
|
89 | The duration of the animation for the chart. | |||
|
90 | */ | |||
|
91 | ||||
|
92 | /*! | |||
|
93 | \property QChart::animationEasingCurve | |||
|
94 | The easing curve of the animation for the chart. | |||
|
95 | */ | |||
|
96 | ||||
|
97 | /*! | |||
88 | \property QChart::backgroundVisible |
|
98 | \property QChart::backgroundVisible | |
89 | Specifies whether the chart background is visible or not. |
|
99 | Specifies whether the chart background is visible or not. | |
90 | \sa setBackgroundBrush(), setBackgroundPen(), plotAreaBackgroundVisible |
|
100 | \sa setBackgroundBrush(), setBackgroundPen(), plotAreaBackgroundVisible | |
@@ -595,6 +605,26 QChart::AnimationOptions QChart::animationOptions() const | |||||
595 | return d_ptr->m_presenter->animationOptions(); |
|
605 | return d_ptr->m_presenter->animationOptions(); | |
596 | } |
|
606 | } | |
597 |
|
607 | |||
|
608 | void QChart::setAnimationDuration(int msecs) | |||
|
609 | { | |||
|
610 | d_ptr->m_presenter->setAnimationDuration(msecs); | |||
|
611 | } | |||
|
612 | ||||
|
613 | int QChart::animationDuration() const | |||
|
614 | { | |||
|
615 | return d_ptr->m_presenter->animationDuration(); | |||
|
616 | } | |||
|
617 | ||||
|
618 | void QChart::setAnimationEasingCurve(const QEasingCurve &curve) | |||
|
619 | { | |||
|
620 | d_ptr->m_presenter->setAnimationEasingCurve(curve); | |||
|
621 | } | |||
|
622 | ||||
|
623 | QEasingCurve QChart::animationEasingCurve() const | |||
|
624 | { | |||
|
625 | return d_ptr->m_presenter->animationEasingCurve(); | |||
|
626 | } | |||
|
627 | ||||
598 | /*! |
|
628 | /*! | |
599 | Scrolls the visible area of the chart by the distance defined in the \a dx and \a dy. |
|
629 | Scrolls the visible area of the chart by the distance defined in the \a dx and \a dy. | |
600 |
|
630 |
@@ -45,6 +45,8 class QT_CHARTS_EXPORT QChart : public QGraphicsWidget | |||||
45 | Q_PROPERTY(bool dropShadowEnabled READ isDropShadowEnabled WRITE setDropShadowEnabled) |
|
45 | Q_PROPERTY(bool dropShadowEnabled READ isDropShadowEnabled WRITE setDropShadowEnabled) | |
46 | Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness) |
|
46 | Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness) | |
47 | Q_PROPERTY(QChart::AnimationOptions animationOptions READ animationOptions WRITE setAnimationOptions) |
|
47 | Q_PROPERTY(QChart::AnimationOptions animationOptions READ animationOptions WRITE setAnimationOptions) | |
|
48 | Q_PROPERTY(int animationDuration READ animationDuration WRITE setAnimationDuration) | |||
|
49 | Q_PROPERTY(QEasingCurve animationEasingCurve READ animationEasingCurve WRITE setAnimationEasingCurve) | |||
48 | Q_PROPERTY(QMargins margins READ margins WRITE setMargins) |
|
50 | Q_PROPERTY(QMargins margins READ margins WRITE setMargins) | |
49 | Q_PROPERTY(QChart::ChartType chartType READ chartType) |
|
51 | Q_PROPERTY(QChart::ChartType chartType READ chartType) | |
50 | Q_PROPERTY(bool plotAreaBackgroundVisible READ isPlotAreaBackgroundVisible WRITE setPlotAreaBackgroundVisible) |
|
52 | Q_PROPERTY(bool plotAreaBackgroundVisible READ isPlotAreaBackgroundVisible WRITE setPlotAreaBackgroundVisible) | |
@@ -125,8 +127,13 public: | |||||
125 | bool isDropShadowEnabled() const; |
|
127 | bool isDropShadowEnabled() const; | |
126 | void setBackgroundRoundness(qreal diameter); |
|
128 | void setBackgroundRoundness(qreal diameter); | |
127 | qreal backgroundRoundness() const; |
|
129 | qreal backgroundRoundness() const; | |
|
130 | ||||
128 | void setAnimationOptions(AnimationOptions options); |
|
131 | void setAnimationOptions(AnimationOptions options); | |
129 | AnimationOptions animationOptions() const; |
|
132 | AnimationOptions animationOptions() const; | |
|
133 | void setAnimationDuration(int msecs); | |||
|
134 | int animationDuration() const; | |||
|
135 | void setAnimationEasingCurve(const QEasingCurve &curve); | |||
|
136 | QEasingCurve animationEasingCurve() const; | |||
130 |
|
137 | |||
131 | void zoomIn(); |
|
138 | void zoomIn(); | |
132 | void zoomOut(); |
|
139 | void zoomOut(); |
@@ -311,7 +311,8 void QScatterSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool f | |||||
311 | } |
|
311 | } | |
312 | } |
|
312 | } | |
313 |
|
313 | |||
314 |
void QScatterSeriesPrivate::initializeAnimations(QChart::AnimationOptions options |
|
314 | void QScatterSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, | |
|
315 | QEasingCurve &curve) | |||
315 | { |
|
316 | { | |
316 | ScatterChartItem *item = static_cast<ScatterChartItem *>(m_item.data()); |
|
317 | ScatterChartItem *item = static_cast<ScatterChartItem *>(m_item.data()); | |
317 | Q_ASSERT(item); |
|
318 | Q_ASSERT(item); | |
@@ -320,11 +321,11 void QScatterSeriesPrivate::initializeAnimations(QChart::AnimationOptions option | |||||
320 | item->animation()->stopAndDestroyLater(); |
|
321 | item->animation()->stopAndDestroyLater(); | |
321 |
|
322 | |||
322 | if (options.testFlag(QChart::SeriesAnimations)) |
|
323 | if (options.testFlag(QChart::SeriesAnimations)) | |
323 | item->setAnimation(new ScatterAnimation(item)); |
|
324 | item->setAnimation(new ScatterAnimation(item, duration, curve)); | |
324 | else |
|
325 | else | |
325 | item->setAnimation(0); |
|
326 | item->setAnimation(0); | |
326 |
|
327 | |||
327 | QAbstractSeriesPrivate::initializeAnimations(options); |
|
328 | QAbstractSeriesPrivate::initializeAnimations(options, duration, curve); | |
328 | } |
|
329 | } | |
329 |
|
330 | |||
330 | #include "moc_qscatterseries.cpp" |
|
331 | #include "moc_qscatterseries.cpp" |
@@ -38,7 +38,8 public: | |||||
38 | QScatterSeriesPrivate(QScatterSeries *q); |
|
38 | QScatterSeriesPrivate(QScatterSeries *q); | |
39 | void initializeGraphics(QGraphicsItem* parent); |
|
39 | void initializeGraphics(QGraphicsItem* parent); | |
40 | void initializeTheme(int index, ChartTheme* theme, bool forced = false); |
|
40 | void initializeTheme(int index, ChartTheme* theme, bool forced = false); | |
41 |
void initializeAnimations(QtCharts::QChart::AnimationOptions options |
|
41 | void initializeAnimations(QtCharts::QChart::AnimationOptions options, int duration, | |
|
42 | QEasingCurve &curve); | |||
42 |
|
43 | |||
43 | private: |
|
44 | private: | |
44 | QScatterSeries::MarkerShape m_shape; |
|
45 | QScatterSeries::MarkerShape m_shape; |
@@ -143,7 +143,8 void QSplineSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool fo | |||||
143 | } |
|
143 | } | |
144 | } |
|
144 | } | |
145 |
|
145 | |||
146 |
void QSplineSeriesPrivate::initializeAnimations(QtCharts::QChart::AnimationOptions options |
|
146 | void QSplineSeriesPrivate::initializeAnimations(QtCharts::QChart::AnimationOptions options, | |
|
147 | int duration, QEasingCurve &curve) | |||
147 | { |
|
148 | { | |
148 | SplineChartItem *item = static_cast<SplineChartItem *>(m_item.data()); |
|
149 | SplineChartItem *item = static_cast<SplineChartItem *>(m_item.data()); | |
149 | Q_ASSERT(item); |
|
150 | Q_ASSERT(item); | |
@@ -151,10 +152,10 void QSplineSeriesPrivate::initializeAnimations(QtCharts::QChart::AnimationOptio | |||||
151 | item->animation()->stopAndDestroyLater(); |
|
152 | item->animation()->stopAndDestroyLater(); | |
152 |
|
153 | |||
153 | if (options.testFlag(QChart::SeriesAnimations)) |
|
154 | if (options.testFlag(QChart::SeriesAnimations)) | |
154 | item->setAnimation(new SplineAnimation(item)); |
|
155 | item->setAnimation(new SplineAnimation(item, duration, curve)); | |
155 | else |
|
156 | else | |
156 | item->setAnimation(0); |
|
157 | item->setAnimation(0); | |
157 | QAbstractSeriesPrivate::initializeAnimations(options); |
|
158 | QAbstractSeriesPrivate::initializeAnimations(options, duration, curve); | |
158 | } |
|
159 | } | |
159 |
|
160 | |||
160 | #include "moc_qsplineseries.cpp" |
|
161 | #include "moc_qsplineseries.cpp" |
@@ -41,7 +41,8 public: | |||||
41 |
|
41 | |||
42 | void initializeTheme(int index, ChartTheme* theme, bool forced = false); |
|
42 | void initializeTheme(int index, ChartTheme* theme, bool forced = false); | |
43 | void initializeGraphics(QGraphicsItem* parent); |
|
43 | void initializeGraphics(QGraphicsItem* parent); | |
44 |
void initializeAnimations(QtCharts::QChart::AnimationOptions options |
|
44 | void initializeAnimations(QtCharts::QChart::AnimationOptions options, int duration, | |
|
45 | QEasingCurve &curve); | |||
45 |
|
46 | |||
46 | private: |
|
47 | private: | |
47 | Q_DECLARE_PUBLIC(QSplineSeries) |
|
48 | Q_DECLARE_PUBLIC(QSplineSeries) |
@@ -830,7 +830,8 QAbstractAxis* QXYSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) | |||||
830 | return new QValueAxis; |
|
830 | return new QValueAxis; | |
831 | } |
|
831 | } | |
832 |
|
832 | |||
833 |
void QXYSeriesPrivate::initializeAnimations(QtCharts::QChart::AnimationOptions options |
|
833 | void QXYSeriesPrivate::initializeAnimations(QtCharts::QChart::AnimationOptions options, | |
|
834 | int duration, QEasingCurve &curve) | |||
834 | { |
|
835 | { | |
835 | XYChart *item = static_cast<XYChart *>(m_item.data()); |
|
836 | XYChart *item = static_cast<XYChart *>(m_item.data()); | |
836 | Q_ASSERT(item); |
|
837 | Q_ASSERT(item); | |
@@ -838,10 +839,10 void QXYSeriesPrivate::initializeAnimations(QtCharts::QChart::AnimationOptions o | |||||
838 | item->animation()->stopAndDestroyLater(); |
|
839 | item->animation()->stopAndDestroyLater(); | |
839 |
|
840 | |||
840 | if (options.testFlag(QChart::SeriesAnimations)) |
|
841 | if (options.testFlag(QChart::SeriesAnimations)) | |
841 | item->setAnimation(new XYAnimation(item)); |
|
842 | item->setAnimation(new XYAnimation(item, duration, curve)); | |
842 | else |
|
843 | else | |
843 | item->setAnimation(0); |
|
844 | item->setAnimation(0); | |
844 | QAbstractSeriesPrivate::initializeAnimations(options); |
|
845 | QAbstractSeriesPrivate::initializeAnimations(options, duration, curve); | |
845 | } |
|
846 | } | |
846 |
|
847 | |||
847 | void QXYSeriesPrivate::drawSeriesPointLabels(QPainter *painter, const QVector<QPointF> &points, |
|
848 | void QXYSeriesPrivate::drawSeriesPointLabels(QPainter *painter, const QVector<QPointF> &points, |
@@ -44,7 +44,8 public: | |||||
44 |
|
44 | |||
45 | void initializeDomain(); |
|
45 | void initializeDomain(); | |
46 | void initializeAxes(); |
|
46 | void initializeAxes(); | |
47 |
void initializeAnimations(QtCharts::QChart::AnimationOptions options |
|
47 | void initializeAnimations(QtCharts::QChart::AnimationOptions options, int duration, | |
|
48 | QEasingCurve &curve); | |||
48 |
|
49 | |||
49 | QList<QLegendMarker*> createLegendMarkers(QLegend* legend); |
|
50 | QList<QLegendMarker*> createLegendMarkers(QLegend* legend); | |
50 |
|
51 |
@@ -81,6 +81,15 QT_CHARTS_BEGIN_NAMESPACE | |||||
81 | */ |
|
81 | */ | |
82 |
|
82 | |||
83 | /*! |
|
83 | /*! | |
|
84 | \qmlproperty int ChartView::animationDuration | |||
|
85 | The duration of the animation for the chart. | |||
|
86 | */ | |||
|
87 | ||||
|
88 | /*! | |||
|
89 | \qmlproperty easing ChartView::animationEasingCurve | |||
|
90 | The easing curve of the animation for the chart. | |||
|
91 | ||||
|
92 | /*! | |||
84 | \qmlproperty Font ChartView::titleFont |
|
93 | \qmlproperty Font ChartView::titleFont | |
85 | The title font of the chart. |
|
94 | The title font of the chart. | |
86 |
|
95 | |||
@@ -673,6 +682,32 DeclarativeChart::Animation DeclarativeChart::animationOptions() | |||||
673 | return DeclarativeChart::NoAnimation; |
|
682 | return DeclarativeChart::NoAnimation; | |
674 | } |
|
683 | } | |
675 |
|
684 | |||
|
685 | void DeclarativeChart::setAnimationDuration(int msecs) | |||
|
686 | { | |||
|
687 | if (msecs != m_chart->animationDuration()) { | |||
|
688 | m_chart->setAnimationDuration(msecs); | |||
|
689 | emit animationDurationChanged(msecs); | |||
|
690 | } | |||
|
691 | } | |||
|
692 | ||||
|
693 | int DeclarativeChart::animationDuration() const | |||
|
694 | { | |||
|
695 | return m_chart->animationDuration(); | |||
|
696 | } | |||
|
697 | ||||
|
698 | void DeclarativeChart::setAnimationEasingCurve(const QEasingCurve &curve) | |||
|
699 | { | |||
|
700 | if (curve != m_chart->animationEasingCurve()) { | |||
|
701 | m_chart->setAnimationEasingCurve(curve); | |||
|
702 | emit animationEasingCurveChanged(curve); | |||
|
703 | } | |||
|
704 | } | |||
|
705 | ||||
|
706 | QEasingCurve DeclarativeChart::animationEasingCurve() const | |||
|
707 | { | |||
|
708 | return m_chart->animationEasingCurve(); | |||
|
709 | } | |||
|
710 | ||||
676 | void DeclarativeChart::setTitle(QString title) |
|
711 | void DeclarativeChart::setTitle(QString title) | |
677 | { |
|
712 | { | |
678 | if (title != m_chart->title()) |
|
713 | if (title != m_chart->title()) |
@@ -39,6 +39,8 class DeclarativeChart : public QQuickPaintedItem | |||||
39 | Q_OBJECT |
|
39 | Q_OBJECT | |
40 | Q_PROPERTY(Theme theme READ theme WRITE setTheme) |
|
40 | Q_PROPERTY(Theme theme READ theme WRITE setTheme) | |
41 | Q_PROPERTY(Animation animationOptions READ animationOptions WRITE setAnimationOptions) |
|
41 | Q_PROPERTY(Animation animationOptions READ animationOptions WRITE setAnimationOptions) | |
|
42 | Q_PROPERTY(int animationDuration READ animationDuration WRITE setAnimationDuration NOTIFY animationDurationChanged REVISION 5) | |||
|
43 | Q_PROPERTY(QEasingCurve animationEasingCurve READ animationEasingCurve WRITE setAnimationEasingCurve NOTIFY animationEasingCurveChanged REVISION 5) | |||
42 | Q_PROPERTY(QString title READ title WRITE setTitle) |
|
44 | Q_PROPERTY(QString title READ title WRITE setTitle) | |
43 | Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont) |
|
45 | Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont) | |
44 | Q_PROPERTY(QColor titleColor READ titleColor WRITE setTitleColor NOTIFY titleColorChanged) |
|
46 | Q_PROPERTY(QColor titleColor READ titleColor WRITE setTitleColor NOTIFY titleColorChanged) | |
@@ -116,6 +118,10 public: | |||||
116 | DeclarativeChart::Theme theme(); |
|
118 | DeclarativeChart::Theme theme(); | |
117 | void setAnimationOptions(DeclarativeChart::Animation animations); |
|
119 | void setAnimationOptions(DeclarativeChart::Animation animations); | |
118 | DeclarativeChart::Animation animationOptions(); |
|
120 | DeclarativeChart::Animation animationOptions(); | |
|
121 | void setAnimationDuration(int msecs); | |||
|
122 | int animationDuration() const; | |||
|
123 | void setAnimationEasingCurve(const QEasingCurve &curve); | |||
|
124 | QEasingCurve animationEasingCurve() const; | |||
119 | void setTitle(QString title); |
|
125 | void setTitle(QString title); | |
120 | QString title(); |
|
126 | QString title(); | |
121 | QLegend *legend(); |
|
127 | QLegend *legend(); | |
@@ -190,6 +196,8 Q_SIGNALS: | |||||
190 | Q_REVISION(3) void backgroundRoundnessChanged(qreal diameter); |
|
196 | Q_REVISION(3) void backgroundRoundnessChanged(qreal diameter); | |
191 | Q_REVISION(4) void localizeNumbersChanged(); |
|
197 | Q_REVISION(4) void localizeNumbersChanged(); | |
192 | Q_REVISION(4) void localeChanged(); |
|
198 | Q_REVISION(4) void localeChanged(); | |
|
199 | Q_REVISION(5) void animationDurationChanged(int msecs); | |||
|
200 | Q_REVISION(5) void animationEasingCurveChanged(QEasingCurve curve); | |||
193 |
|
201 | |||
194 | private Q_SLOTS: |
|
202 | private Q_SLOTS: | |
195 | void changeMargins(int top, int bottom, int left, int right); |
|
203 | void changeMargins(int top, int bottom, int left, int right); |
@@ -994,6 +994,8 Module { | |||||
994 | Property { name: "axes"; revision: 2; type: "QAbstractAxis"; isList: true; isReadonly: true } |
|
994 | Property { name: "axes"; revision: 2; type: "QAbstractAxis"; isList: true; isReadonly: true } | |
995 | Property { name: "localizeNumbers"; revision: 4; type: "bool" } |
|
995 | Property { name: "localizeNumbers"; revision: 4; type: "bool" } | |
996 | Property { name: "locale"; revision: 4; type: "QLocale" } |
|
996 | Property { name: "locale"; revision: 4; type: "QLocale" } | |
|
997 | Property { name: "animationDuration"; revision: 5; type: "int" } | |||
|
998 | Property { name: "animationEasingCurve"; revision: 5; type: "QEasingCurve" } | |||
997 | Signal { name: "axisLabelsChanged" } |
|
999 | Signal { name: "axisLabelsChanged" } | |
998 | Signal { |
|
1000 | Signal { | |
999 | name: "titleColorChanged" |
|
1001 | name: "titleColorChanged" | |
@@ -1024,6 +1026,16 Module { | |||||
1024 | } |
|
1026 | } | |
1025 | Signal { name: "localizeNumbersChanged"; revision: 4 } |
|
1027 | Signal { name: "localizeNumbersChanged"; revision: 4 } | |
1026 | Signal { name: "localeChanged"; revision: 4 } |
|
1028 | Signal { name: "localeChanged"; revision: 4 } | |
|
1029 | Signal { | |||
|
1030 | name: "animationDurationChanged" | |||
|
1031 | revision: 5 | |||
|
1032 | Parameter { name: "msecs"; type: "int" } | |||
|
1033 | } | |||
|
1034 | Signal { | |||
|
1035 | name: "animationEasingCurveChanged" | |||
|
1036 | revision: 5 | |||
|
1037 | Parameter { name: "curve"; type: "QEasingCurve" } | |||
|
1038 | } | |||
1027 | Method { |
|
1039 | Method { | |
1028 | name: "series" |
|
1040 | name: "series" | |
1029 | type: "QAbstractSeries*" |
|
1041 | type: "QAbstractSeries*" |
@@ -59,6 +59,9 private slots: | |||||
59 | void addSeries(); |
|
59 | void addSeries(); | |
60 | void animationOptions_data(); |
|
60 | void animationOptions_data(); | |
61 | void animationOptions(); |
|
61 | void animationOptions(); | |
|
62 | void animationDuration(); | |||
|
63 | void animationCurve_data(); | |||
|
64 | void animationCurve(); | |||
62 | void axisX_data(); |
|
65 | void axisX_data(); | |
63 | void axisX(); |
|
66 | void axisX(); | |
64 | void axisY_data(); |
|
67 | void axisY_data(); | |
@@ -160,6 +163,8 void tst_QChart::qchart() | |||||
160 | QVERIFY(m_chart->legend()->isVisible()); |
|
163 | QVERIFY(m_chart->legend()->isVisible()); | |
161 |
|
164 | |||
162 | QCOMPARE(m_chart->animationOptions(), QChart::NoAnimation); |
|
165 | QCOMPARE(m_chart->animationOptions(), QChart::NoAnimation); | |
|
166 | QCOMPARE(m_chart->animationDuration(), 1000); | |||
|
167 | QCOMPARE(m_chart->animationEasingCurve(), QEasingCurve(QEasingCurve::OutQuart)); | |||
163 | QVERIFY(!m_chart->axisX()); |
|
168 | QVERIFY(!m_chart->axisX()); | |
164 | QVERIFY(!m_chart->axisY()); |
|
169 | QVERIFY(!m_chart->axisY()); | |
165 | QVERIFY(m_chart->backgroundBrush()!=QBrush()); |
|
170 | QVERIFY(m_chart->backgroundBrush()!=QBrush()); | |
@@ -258,6 +263,30 void tst_QChart::animationOptions() | |||||
258 | QCOMPARE(m_chart->animationOptions(), animationOptions); |
|
263 | QCOMPARE(m_chart->animationOptions(), animationOptions); | |
259 | } |
|
264 | } | |
260 |
|
265 | |||
|
266 | void tst_QChart::animationDuration() | |||
|
267 | { | |||
|
268 | createTestData(); | |||
|
269 | m_chart->setAnimationDuration(2000); | |||
|
270 | QVERIFY(m_chart->animationDuration() == 2000); | |||
|
271 | } | |||
|
272 | ||||
|
273 | void tst_QChart::animationCurve_data() | |||
|
274 | { | |||
|
275 | QTest::addColumn<QEasingCurve>("animationCurve"); | |||
|
276 | QTest::newRow("Linear") << QEasingCurve(QEasingCurve::Linear); | |||
|
277 | QTest::newRow("InCubic") << QEasingCurve(QEasingCurve::InCubic); | |||
|
278 | QTest::newRow("OutSine") << QEasingCurve(QEasingCurve::OutSine); | |||
|
279 | QTest::newRow("OutInBack") << QEasingCurve(QEasingCurve::OutInBack); | |||
|
280 | } | |||
|
281 | ||||
|
282 | void tst_QChart::animationCurve() | |||
|
283 | { | |||
|
284 | createTestData(); | |||
|
285 | QFETCH(QEasingCurve, animationCurve); | |||
|
286 | m_chart->setAnimationEasingCurve(animationCurve); | |||
|
287 | QCOMPARE(m_chart->animationEasingCurve(), animationCurve); | |||
|
288 | } | |||
|
289 | ||||
261 | void tst_QChart::axisX_data() |
|
290 | void tst_QChart::axisX_data() | |
262 | { |
|
291 | { | |
263 |
|
292 |
@@ -31,6 +31,8 Rectangle { | |||||
31 |
|
31 | |||
32 | function test_chartViewProperties() { |
|
32 | function test_chartViewProperties() { | |
33 | compare(chartView.animationOptions, ChartView.NoAnimation, "ChartView.animationOptions"); |
|
33 | compare(chartView.animationOptions, ChartView.NoAnimation, "ChartView.animationOptions"); | |
|
34 | compare(chartView.animationDuration, 1000, "ChartView.animationDuration"); | |||
|
35 | compare(chartView.animationEasingCurve.type, Easing.OutQuart, "ChartView.animationEasingCurve"); | |||
34 | verify(chartView.backgroundColor != undefined); |
|
36 | verify(chartView.backgroundColor != undefined); | |
35 | verify(chartView.margins.bottom > 0, "ChartView.margins.bottom"); |
|
37 | verify(chartView.margins.bottom > 0, "ChartView.margins.bottom"); | |
36 | verify(chartView.margins.top > 0, "ChartView.margins.top"); |
|
38 | verify(chartView.margins.top > 0, "ChartView.margins.top"); |
@@ -17,7 +17,7 | |||||
17 | ****************************************************************************/ |
|
17 | ****************************************************************************/ | |
18 |
|
18 | |||
19 | import QtQuick 2.0 |
|
19 | import QtQuick 2.0 | |
20 |
import QtCharts 2. |
|
20 | import QtCharts 2.1 | |
21 |
|
21 | |||
22 | ChartView { |
|
22 | ChartView { | |
23 | id: chartView |
|
23 | id: chartView | |
@@ -45,7 +45,11 ChartView { | |||||
45 | onBackgroundRoundnessChanged: console.log("chart.onBackgroundRoundnessChanged: " + diameter); |
|
45 | onBackgroundRoundnessChanged: console.log("chart.onBackgroundRoundnessChanged: " + diameter); | |
46 | onSeriesAdded: console.log("chart.onSeriesAdded: " + series.name); |
|
46 | onSeriesAdded: console.log("chart.onSeriesAdded: " + series.name); | |
47 | onSeriesRemoved: console.log("chart.onSeriesRemoved: " + series.name); |
|
47 | onSeriesRemoved: console.log("chart.onSeriesRemoved: " + series.name); | |
48 |
onPlotAreaColorChanged: console.log("chart. |
|
48 | onPlotAreaColorChanged: console.log("chart.onPlotAreaColorChanged: " + chart.plotAreaColor); | |
|
49 | onAnimationDurationChanged: console.log("chart.onAnimationDurationChanged: " | |||
|
50 | + chart.animationDuration); | |||
|
51 | onAnimationEasingCurveChanged: console.log("chart.onAnimationEasingCurveChanged: " | |||
|
52 | + chart.animationEasingCurve.type); | |||
49 |
|
53 | |||
50 | legend.onVisibleChanged: console.log("legend.onVisibleChanged: " + chart.legend.visible); |
|
54 | legend.onVisibleChanged: console.log("legend.onVisibleChanged: " + chart.legend.visible); | |
51 | legend.onBackgroundVisibleChanged: console.log("legend.onBackgroundVisibleChanged: " + visible); |
|
55 | legend.onBackgroundVisibleChanged: console.log("legend.onBackgroundVisibleChanged: " + visible); |
@@ -21,8 +21,16 import QtQuick 2.0 | |||||
21 | Flow { |
|
21 | Flow { | |
22 | anchors.fill: parent |
|
22 | anchors.fill: parent | |
23 | property variant chart |
|
23 | property variant chart | |
|
24 | property variant easingTypes: [Easing.Linear, Easing.InCubic, Easing.OutSine, Easing.OutInBack] | |||
|
25 | property int easingTypeIndex: 0 | |||
24 | flow: Flow.TopToBottom |
|
26 | flow: Flow.TopToBottom | |
25 | spacing: 5 |
|
27 | spacing: 5 | |
|
28 | ||||
|
29 | function nextEasingType() { | |||
|
30 | easingTypeIndex++; | |||
|
31 | return easingTypes[easingTypeIndex % easingTypes.length]; | |||
|
32 | } | |||
|
33 | ||||
26 | Button { |
|
34 | Button { | |
27 | text: "visible" |
|
35 | text: "visible" | |
28 | onClicked: chart.visible = !chart.visible; |
|
36 | onClicked: chart.visible = !chart.visible; | |
@@ -44,6 +52,18 Flow { | |||||
44 | onClicked: chart.animationOptions--; |
|
52 | onClicked: chart.animationOptions--; | |
45 | } |
|
53 | } | |
46 | Button { |
|
54 | Button { | |
|
55 | text: "animation duration +" | |||
|
56 | onClicked: chart.animationDuration = chart.animationDuration + 1000; | |||
|
57 | } | |||
|
58 | Button { | |||
|
59 | text: "animation duration -" | |||
|
60 | onClicked: chart.animationDuration = chart.animationDuration - 1000; | |||
|
61 | } | |||
|
62 | Button { | |||
|
63 | text: "animation curve" | |||
|
64 | onClicked: chart.animationEasingCurve.type = nextEasingType(); | |||
|
65 | } | |||
|
66 | Button { | |||
47 | text: "background color" |
|
67 | text: "background color" | |
48 | onClicked: chart.backgroundColor = main.nextColor(); |
|
68 | onClicked: chart.backgroundColor = main.nextColor(); | |
49 | } |
|
69 | } |
General Comments 0
You need to be logged in to leave comments.
Login now