##// END OF EJS Templates
Refactor animator...
Michal Klocek -
r1735:0a19606ca1b1
parent child
Show More
@@ -3,7 +3,6 DEPENDPATH += $$PWD
3 3
4 4 SOURCES += \
5 5 $$PWD/axisanimation.cpp \
6 $$PWD/chartanimator.cpp \
7 6 $$PWD/xyanimation.cpp \
8 7 $$PWD/pieanimation.cpp \
9 8 $$PWD/piesliceanimation.cpp \
@@ -18,7 +17,6 SOURCES += \
18 17
19 18 PRIVATE_HEADERS += \
20 19 $$PWD/axisanimation_p.h \
21 $$PWD/chartanimator_p.h \
22 20 $$PWD/chartanimation_p.h \
23 21 $$PWD/xyanimation_p.h \
24 22 $$PWD/pieanimation_p.h \
@@ -35,7 +35,7 PieAnimation::~PieAnimation()
35 35 {
36 36 }
37 37
38 void PieAnimation::updateValue(PieSliceItem *sliceItem, const PieSliceData &sliceData)
38 ChartAnimation* PieAnimation::updateValue(PieSliceItem *sliceItem, const PieSliceData &sliceData)
39 39 {
40 40 PieSliceAnimation *animation = m_animations.value(sliceItem);
41 41 Q_ASSERT(animation);
@@ -45,10 +45,10 void PieAnimation::updateValue(PieSliceItem *sliceItem, const PieSliceData &slic
45 45 animation->setDuration(ChartAnimationDuration);
46 46 animation->setEasingCurve(QEasingCurve::OutQuart);
47 47
48 QTimer::singleShot(0, animation, SLOT(start()));
48 return animation;
49 49 }
50 50
51 void PieAnimation::addSlice(PieSliceItem *sliceItem, const PieSliceData &sliceData, bool startupAnimation)
51 ChartAnimation* PieAnimation::addSlice(PieSliceItem *sliceItem, const PieSliceData &sliceData, bool startupAnimation)
52 52 {
53 53 PieSliceAnimation *animation = new PieSliceAnimation(sliceItem);
54 54 m_animations.insert(sliceItem, animation);
@@ -64,10 +64,11 void PieAnimation::addSlice(PieSliceItem *sliceItem, const PieSliceData &sliceDa
64 64
65 65 animation->setDuration(ChartAnimationDuration);
66 66 animation->setEasingCurve(QEasingCurve::OutQuart);
67 QTimer::singleShot(0, animation, SLOT(start()));
67
68 return animation;
68 69 }
69 70
70 void PieAnimation::removeSlice(PieSliceItem *sliceItem)
71 ChartAnimation* PieAnimation::removeSlice(PieSliceItem *sliceItem)
71 72 {
72 73 PieSliceAnimation *animation = m_animations.value(sliceItem);
73 74 Q_ASSERT(animation);
@@ -87,7 +88,7 void PieAnimation::removeSlice(PieSliceItem *sliceItem)
87 88 connect(animation, SIGNAL(finished()), sliceItem, SLOT(deleteLater()));
88 89 m_animations.remove(sliceItem);
89 90
90 QTimer::singleShot(0, animation, SLOT(start()));
91 return animation;
91 92 }
92 93
93 94 void PieAnimation::updateCurrentValue(const QVariant &)
@@ -45,9 +45,9 class PieAnimation : public ChartAnimation
45 45 public:
46 46 PieAnimation(PieChartItem *item);
47 47 ~PieAnimation();
48 void updateValue(PieSliceItem *sliceItem, const PieSliceData &newValue);
49 void addSlice(PieSliceItem *sliceItem, const PieSliceData &endValue, bool startupAnimation);
50 void removeSlice(PieSliceItem *sliceItem);
48 ChartAnimation* updateValue(PieSliceItem *sliceItem, const PieSliceData &newValue);
49 ChartAnimation* addSlice(PieSliceItem *sliceItem, const PieSliceData &endValue, bool startupAnimation);
50 ChartAnimation* removeSlice(PieSliceItem *sliceItem);
51 51
52 52 public: // from QVariantAnimation
53 53 void updateCurrentValue(const QVariant &value);
@@ -58,7 +58,7 QBrush linearPos(QBrush start, QBrush end, qreal pos)
58 58 }
59 59
60 60 PieSliceAnimation::PieSliceAnimation(PieSliceItem *sliceItem)
61 :QVariantAnimation(sliceItem),
61 :ChartAnimation(sliceItem),
62 62 m_sliceItem(sliceItem)
63 63 {
64 64 }
@@ -30,14 +30,14
30 30 #ifndef PIESLICEANIMATION_P_H
31 31 #define PIESLICEANIMATION_P_H
32 32
33 #include <QVariantAnimation>
33 #include "chartanimation_p.h"
34 34 #include "piesliceitem_p.h"
35 35
36 36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37 37
38 38 class PieChartItem;
39 39
40 class PieSliceAnimation : public QVariantAnimation
40 class PieSliceAnimation : public ChartAnimation
41 41 {
42 42 public:
43 43 PieSliceAnimation(PieSliceItem *sliceItem);
@@ -26,7 +26,6
26 26 #include "domain_p.h"
27 27 #include "chartdataset_p.h"
28 28 #include "charttheme_p.h"
29 #include "chartanimator_p.h"
30 29 #include "qvaluesaxis.h"
31 30
32 31 QTCOMMERCIALCHART_BEGIN_NAMESPACE
@@ -363,10 +362,8 Chart* QAreaSeriesPrivate::createGraphics(ChartPresenter* presenter)
363 362
364 363 AreaChartItem* area = new AreaChartItem(q,presenter);
365 364 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
366 area->upperLineItem()->setAnimator(presenter->animator());
367 365 area->upperLineItem()->setAnimation(new XYAnimation(area->upperLineItem()));
368 366 if(q->lowerSeries()) {
369 area->lowerLineItem()->setAnimator(presenter->animator());
370 367 area->lowerLineItem()->setAnimation(new XYAnimation(area->lowerLineItem()));
371 368 }
372 369 }
@@ -22,7 +22,6
22 22 #include "qabstractaxis.h"
23 23 #include "qabstractaxis_p.h"
24 24 #include "chartpresenter_p.h"
25 #include "chartanimator_p.h"
26 25 #include "domain_p.h"
27 26 #include <qmath.h>
28 27 #include <QDateTime>
@@ -19,15 +19,13
19 19 ****************************************************************************/
20 20
21 21 #include "chartdatetimeaxisx_p.h"
22 #include "qabstractaxis.h"
23 22 #include "chartpresenter_p.h"
24 #include "chartanimator_p.h"
25 23 #include "qdatetimeaxis.h"
26 24 #include <QGraphicsLayout>
27 #include <QDebug>
28 #include <QFontMetrics>
29 #include <cmath>
30 25 #include <QDateTime>
26 #include <QFontMetrics>
27 #include <qmath.h>
28
31 29
32 30 static int label_padding = 5;
33 31
@@ -19,15 +19,13
19 19 ****************************************************************************/
20 20
21 21 #include "chartdatetimeaxisy_p.h"
22 #include "qabstractaxis.h"
23 22 #include "chartpresenter_p.h"
24 #include "chartanimator_p.h"
25 23 #include "qdatetimeaxis.h"
26 24 #include <QGraphicsLayout>
27 #include <QDebug>
28 25 #include <QFontMetrics>
29 #include <cmath>
30 26 #include <QDateTime>
27 #include <qmath.h>
28
31 29
32 30 static int label_padding = 5;
33 31
@@ -19,14 +19,12
19 19 ****************************************************************************/
20 20
21 21 #include "chartintervalsaxisx_p.h"
22 #include "qintervalsaxis.h"
22 23 #include "qabstractaxis.h"
23 24 #include "chartpresenter_p.h"
24 #include "chartanimator_p.h"
25 25 #include <QGraphicsLayout>
26 #include <QDebug>
27 26 #include <QFontMetrics>
28 #include <cmath>
29 #include <QIntervalsAxis>
27 #include <qmath.h>
30 28
31 29 static int label_padding = 5;
32 30
@@ -19,14 +19,13
19 19 ****************************************************************************/
20 20
21 21 #include "chartintervalsaxisy_p.h"
22 #include "qintervalsaxis.h"
22 23 #include "qabstractaxis.h"
23 24 #include "chartpresenter_p.h"
24 #include "chartanimator_p.h"
25 25 #include <QGraphicsLayout>
26 #include <QDebug>
27 26 #include <QFontMetrics>
28 #include <cmath>
29 #include <QIntervalsAxis>
27 #include <qmath.h>
28
30 29
31 30 static int label_padding = 5;
32 31
@@ -21,12 +21,10
21 21 #include "chartvaluesaxisx_p.h"
22 22 #include "qabstractaxis.h"
23 23 #include "chartpresenter_p.h"
24 #include "chartanimator_p.h"
25 24 #include "qvaluesaxis.h"
26 25 #include <QGraphicsLayout>
27 #include <QDebug>
28 26 #include <QFontMetrics>
29 #include <cmath>
27 #include <qmath.h>
30 28
31 29 static int label_padding = 5;
32 30
@@ -21,12 +21,10
21 21 #include "chartvaluesaxisy_p.h"
22 22 #include "qabstractaxis.h"
23 23 #include "chartpresenter_p.h"
24 #include "chartanimator_p.h"
25 24 #include "qvaluesaxis.h"
26 25 #include <QGraphicsLayout>
27 #include <QDebug>
28 26 #include <QFontMetrics>
29 #include <cmath>
27 #include <qmath.h>
30 28
31 29 static int label_padding = 5;
32 30
@@ -26,7 +26,7
26 26 #include "qabstractbarseries_p.h"
27 27 #include "qchart.h"
28 28 #include "chartpresenter_p.h"
29 #include "chartanimator_p.h"
29 #include "charttheme_p.h"
30 30 #include "abstractbaranimation_p.h"
31 31 #include "chartdataset_p.h"
32 32 #include <QPainter>
@@ -107,7 +107,6 Chart* QHorizontalBarSeriesPrivate::createGraphics(ChartPresenter* presenter)
107 107
108 108 HorizontalBarChartItem* bar = new HorizontalBarChartItem(q,presenter);
109 109 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
110 bar->setAnimator(presenter->animator());
111 110 bar->setAnimation(new HorizontalBarAnimation(bar));
112 111 }
113 112 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
@@ -55,7 +55,6 Chart* QHorizontalPercentBarSeriesPrivate::createGraphics(ChartPresenter* presen
55 55
56 56 HorizontalPercentBarChartItem* bar = new HorizontalPercentBarChartItem(q,presenter);
57 57 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
58 bar->setAnimator(presenter->animator());
59 58 bar->setAnimation(new HorizontalPercentBarAnimation(bar));
60 59 }
61 60 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
@@ -56,7 +56,6 Chart* QHorizontalStackedBarSeriesPrivate::createGraphics(ChartPresenter* presen
56 56
57 57 HorizontalStackedBarChartItem* bar = new HorizontalStackedBarChartItem(q,presenter);
58 58 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
59 bar->setAnimator(presenter->animator());
60 59 bar->setAnimation(new HorizontalStackedBarAnimation(bar));
61 60 }
62 61 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
@@ -23,7 +23,6
23 23 #include "barchartitem_p.h"
24 24 #include "chartdataset_p.h"
25 25 #include "charttheme_p.h"
26 #include "chartanimator_p.h"
27 26 #include "baranimation_p.h"
28 27 #include "qvaluesaxis.h"
29 28 #include "qbarcategoriesaxis.h"
@@ -111,7 +110,6 Chart* QBarSeriesPrivate::createGraphics(ChartPresenter* presenter)
111 110
112 111 BarChartItem* bar = new BarChartItem(q,presenter);
113 112 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
114 bar->setAnimator(presenter->animator());
115 113 bar->setAnimation(new BarAnimation(bar));
116 114 }
117 115 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
@@ -22,7 +22,6
22 22 #include "bar_p.h"
23 23 #include "qabstractbarseries_p.h"
24 24 #include "qbarset.h"
25 #include "chartanimator_p.h"
26 25 #include "qbarset_p.h"
27 26
28 27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
@@ -23,7 +23,6
23 23 #include "percentbarchartitem_p.h"
24 24 #include "chartdataset_p.h"
25 25 #include "charttheme_p.h"
26 #include "chartanimator_p.h"
27 26 #include "qvaluesaxis.h"
28 27 #include "percentbaranimation_p.h"
29 28
@@ -110,7 +109,6 Chart* QPercentBarSeriesPrivate::createGraphics(ChartPresenter* presenter)
110 109
111 110 PercentBarChartItem* bar = new PercentBarChartItem(q,presenter);
112 111 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
113 bar->setAnimator(presenter->animator());
114 112 bar->setAnimation(new PercentBarAnimation(bar));
115 113 }
116 114 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
@@ -23,7 +23,6
23 23 #include "stackedbarchartitem_p.h"
24 24 #include "chartdataset_p.h"
25 25 #include "charttheme_p.h"
26 #include "chartanimator_p.h"
27 26 #include "qvaluesaxis.h"
28 27 #include "stackedbaranimation_p.h"
29 28
@@ -111,7 +110,6 Chart* QStackedBarSeriesPrivate::createGraphics(ChartPresenter* presenter)
111 110
112 111 StackedBarChartItem* bar = new StackedBarChartItem(q,presenter);
113 112 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
114 bar->setAnimator(presenter->animator());
115 113 bar->setAnimation(new StackedBarAnimation(bar));
116 114 }
117 115 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
@@ -23,7 +23,6
23 23 #include "qbarset_p.h"
24 24 #include "qabstractbarseries_p.h"
25 25 #include "qbarset.h"
26 #include "chartanimator_p.h"
27 26
28 27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 28
@@ -25,23 +25,11
25 25 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 26
27 27 Chart::Chart(ChartPresenter *presenter):QObject(presenter),
28 m_animator(0),
29 28 m_presenter(presenter),
30 29 m_domain(0)
31 30 {
32 31 }
33 32
34 void Chart::setAnimator(ChartAnimator* animator)
35 {
36 m_animator=animator;
37 }
38
39 ChartAnimator* Chart::animator() const
40 {
41 return m_animator;
42 }
43
44
45 33 void Chart::setPresenter(ChartPresenter *presenter)
46 34 {
47 35 m_presenter=presenter;
@@ -51,17 +51,15 public Q_SLOTS:
51 51 virtual void handleGeometryChanged(const QRectF& rect);
52 52 virtual void handleDomainChanged(qreal minX,qreal maxX,qreal minY,qreal maxY);
53 53 virtual void handleDomainUpdated();
54 virtual ChartAnimation* animation() const { return 0; };
54 55
55 void setAnimator(ChartAnimator* animator);
56 ChartAnimator* animator() const;
57 56 void setPresenter(ChartPresenter *presenter);
58 57 ChartPresenter* presenter() const;
59 58 void setDomain(Domain *domain);
60 59 Domain* domain() const;
61 virtual ChartAnimation* animation() const { return 0; };
60
62 61
63 62 private:
64 ChartAnimator* m_animator;
65 63 ChartPresenter* m_presenter;
66 64 Domain* m_domain;
67 65 };
@@ -24,7 +24,6
24 24 #include "qabstractaxis_p.h"
25 25 #include "chartdataset_p.h"
26 26 #include "charttheme_p.h"
27 #include "chartanimator_p.h"
28 27 #include "chartanimation_p.h"
29 28 #include "qabstractseries_p.h"
30 29 #include "qareaseries.h"
@@ -40,7 +39,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
40 39
41 40 ChartPresenter::ChartPresenter(QChart* chart,ChartDataSet* dataset):QObject(chart),
42 41 m_chart(chart),
43 m_animator(0),
44 42 m_dataset(dataset),
45 43 m_chartTheme(0),
46 44 m_options(QChart::NoAnimation),
@@ -74,7 +72,6 void ChartPresenter::handleAxisAdded(QAbstractAxis* axis,Domain* domain)
74 72 item->setDomain(domain);
75 73
76 74 if(m_options.testFlag(QChart::GridAxisAnimations)){
77 item->setAnimator(m_animator);
78 75 item->setAnimation(new AxisAnimation(item));
79 76 }
80 77
@@ -98,7 +95,6 void ChartPresenter::handleAxisRemoved(QAbstractAxis* axis)
98 95 ChartAxis* item = m_axisItems.take(axis);
99 96 Q_ASSERT(item);
100 97 selectVisibleAxis();
101 if(m_animator) m_animator->removeAnimation(item);
102 98 item->hide();
103 99 item->disconnect();
104 100 QObject::disconnect(this,0,item,0);
@@ -125,16 +121,6 void ChartPresenter::handleSeriesRemoved(QAbstractSeries* series)
125 121 {
126 122 Chart* item = m_chartItems.take(series);
127 123 Q_ASSERT(item);
128 if(m_animator) {
129 //small hack to handle area animations
130 if(series->type() == QAbstractSeries::SeriesTypeArea){
131 QAreaSeries* areaSeries = static_cast<QAreaSeries*>(series);
132 AreaChartItem* area = static_cast<AreaChartItem*>(item);
133 m_animator->removeAnimation(area->upperLineItem());
134 if(areaSeries->lowerSeries()) m_animator->removeAnimation(area->lowerLineItem());
135 }else
136 m_animator->removeAnimation(item);
137 }
138 124 item->deleteLater();
139 125 }
140 126
@@ -211,12 +197,7 QChart::ChartTheme ChartPresenter::theme()
211 197 void ChartPresenter::setAnimationOptions(QChart::AnimationOptions options)
212 198 {
213 199 if(m_options!=options) {
214
215 200 m_options=options;
216
217 if(m_options!=QChart::NoAnimation && !m_animator) {
218 m_animator= new ChartAnimator(this);
219 }
220 201 resetAllElements();
221 202 }
222 203
@@ -77,7 +77,6 public:
77 77 ChartPresenter(QChart* chart,ChartDataSet *dataset);
78 78 virtual ~ChartPresenter();
79 79
80 ChartAnimator* animator() const { return m_animator; }
81 80 ChartTheme *chartTheme() const { return m_chartTheme; }
82 81 ChartDataSet *dataSet() const { return m_dataset; }
83 82 QGraphicsItem* rootItem() const { return m_chart; }
@@ -156,7 +155,6 Q_SIGNALS:
156 155
157 156 private:
158 157 QChart* m_chart;
159 ChartAnimator* m_animator;
160 158 ChartDataSet* m_dataset;
161 159 ChartTheme *m_chartTheme;
162 160 QMap<QAbstractSeries*, Chart*> m_chartItems;
@@ -23,7 +23,6
23 23 #include "linechartitem_p.h"
24 24 #include "chartdataset_p.h"
25 25 #include "charttheme_p.h"
26 #include "chartanimator_p.h"
27 26
28 27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 28
@@ -122,7 +121,6 Chart* QLineSeriesPrivate::createGraphics(ChartPresenter* presenter)
122 121 Q_Q(QLineSeries);
123 122 LineChartItem* line = new LineChartItem(q,presenter);
124 123 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
125 line->setAnimator(presenter->animator());
126 124 line->setAnimation(new XYAnimation(line));
127 125 }
128 126 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
@@ -26,7 +26,7
26 26 #include "qpieseries_p.h"
27 27 #include "chartpresenter_p.h"
28 28 #include "chartdataset_p.h"
29 #include "chartanimator_p.h"
29 #include "pieanimation_p.h"
30 30 #include <QPainter>
31 31 #include <QTimer>
32 32
@@ -34,7 +34,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
34 34
35 35 PieChartItem::PieChartItem(QPieSeries *series, ChartPresenter* presenter)
36 36 :ChartItem(presenter),
37 m_series(series)
37 m_series(series),
38 m_animation(0)
38 39 {
39 40 Q_ASSERT(series);
40 41
@@ -58,6 +59,16 PieChartItem::~PieChartItem()
58 59 // slices deleted automatically through QGraphicsItem
59 60 }
60 61
62 void PieChartItem::setAnimation(PieAnimation* animation)
63 {
64 m_animation=animation;
65 }
66
67 ChartAnimation* PieChartItem::animation() const
68 {
69 return m_animation;
70 }
71
61 72 void PieChartItem::handleGeometryChanged(const QRectF& rect)
62 73 {
63 74 prepareGeometryChange();
@@ -116,8 +127,9 void PieChartItem::updateLayout()
116 127 PieSliceItem *sliceItem = m_sliceItems.value(slice);
117 128 if (sliceItem) {
118 129 PieSliceData sliceData = updateSliceGeometry(slice);
119 if (animator())
120 animator()->updateAnimation(this, sliceItem, sliceData);
130 if (m_animation){
131 presenter()->startAnimation(m_animation->updateValue(sliceItem, sliceData));
132 }
121 133 else
122 134 sliceItem->setLayout(sliceData);
123 135 }
@@ -159,8 +171,8 void PieChartItem::handleSlicesAdded(QList<QPieSlice*> slices)
159 171 connect(sliceItem, SIGNAL(hovered(bool)), slice, SIGNAL(hovered(bool)));
160 172
161 173 PieSliceData sliceData = updateSliceGeometry(slice);
162 if (animator())
163 animator()->addAnimation(this, sliceItem, sliceData, startupAnimation);
174 if (m_animation)
175 presenter()->startAnimation(m_animation->addSlice(sliceItem, sliceData, startupAnimation));
164 176 else
165 177 sliceItem->setLayout(sliceData);
166 178 }
@@ -180,8 +192,8 void PieChartItem::handleSlicesRemoved(QList<QPieSlice*> slices)
180 192
181 193 m_sliceItems.remove(slice);
182 194
183 if (animator())
184 animator()->removeAnimation(this, sliceItem); // animator deletes the PieSliceItem
195 if (m_animation)
196 presenter()->startAnimation(m_animation->removeSlice(sliceItem)); // animator deletes the PieSliceItem
185 197 else
186 198 delete sliceItem;
187 199 }
@@ -198,8 +210,8 void PieChartItem::handleSliceChanged()
198 210
199 211 PieSliceItem *sliceItem = m_sliceItems.value(slice);
200 212 PieSliceData sliceData = updateSliceGeometry(slice);
201 if (animator())
202 animator()->updateAnimation(this, sliceItem, sliceData);
213 if (m_animation)
214 presenter()->startAnimation(m_animation->updateValue(sliceItem, sliceData));
203 215 else
204 216 sliceItem->setLayout(sliceData);
205 217
@@ -38,6 +38,7 class QGraphicsItem;
38 38 QTCOMMERCIALCHART_BEGIN_NAMESPACE
39 39 class QPieSlice;
40 40 class ChartPresenter;
41 class PieAnimation;
41 42
42 43 class PieChartItem : public ChartItem
43 44 {
@@ -64,6 +65,9 public Q_SLOTS:
64 65 void handleSliceChanged();
65 66 void handleSeriesVisibleChanged();
66 67
68 void setAnimation(PieAnimation* animation);
69 ChartAnimation* animation() const;
70
67 71 private:
68 72 PieSliceData updateSliceGeometry(QPieSlice *slice);
69 73
@@ -74,6 +78,8 private:
74 78 QPointF m_pieCenter;
75 79 qreal m_pieRadius;
76 80 qreal m_donutInnerRadius;
81 PieAnimation* m_animation;
82
77 83 };
78 84
79 85 QTCOMMERCIALCHART_END_NAMESPACE
@@ -25,9 +25,9
25 25 #include "pieslicedata_p.h"
26 26 #include "chartdataset_p.h"
27 27 #include "charttheme_p.h"
28 #include "chartanimator_p.h"
29 28 #include "legendmarker_p.h"
30 29 #include "qabstractaxis.h"
30 #include "pieanimation_p.h"
31 31
32 32 QTCOMMERCIALCHART_BEGIN_NAMESPACE
33 33
@@ -823,7 +823,7 Chart* QPieSeriesPrivate::createGraphics(ChartPresenter* presenter)
823 823 Q_Q(QPieSeries);
824 824 PieChartItem* pie = new PieChartItem(q,presenter);
825 825 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
826 presenter->animator()->addAnimation(pie);
826 pie->setAnimation(new PieAnimation(pie));
827 827 }
828 828 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
829 829 return pie;
@@ -23,7 +23,6
23 23 #include "scatterchartitem_p.h"
24 24 #include "chartdataset_p.h"
25 25 #include "charttheme_p.h"
26 #include "chartanimator_p.h"
27 26
28 27 /*!
29 28 \class QScatterSeries
@@ -252,7 +251,6 Chart* QScatterSeriesPrivate::createGraphics(ChartPresenter* presenter)
252 251 Q_Q(QScatterSeries);
253 252 ScatterChartItem *scatter = new ScatterChartItem(q,presenter);
254 253 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
255 scatter->setAnimator(presenter->animator());
256 254 scatter->setAnimation(new XYAnimation(scatter));
257 255 }
258 256 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
@@ -23,7 +23,7
23 23 #include "splinechartitem_p.h"
24 24 #include "chartdataset_p.h"
25 25 #include "charttheme_p.h"
26 #include "chartanimator_p.h"
26 #include "splineanimation_p.h"
27 27
28 28 /*!
29 29 \class QSplineSeries
@@ -222,7 +222,6 Chart* QSplineSeriesPrivate::createGraphics(ChartPresenter* presenter)
222 222 Q_Q(QSplineSeries);
223 223 SplineChartItem* spline = new SplineChartItem(q,presenter);
224 224 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
225 spline->setAnimator(presenter->animator());
226 225 spline->setAnimation(new SplineAnimation(spline));
227 226 }
228 227
@@ -21,7 +21,7
21 21 #include "splinechartitem_p.h"
22 22 #include "qsplineseries_p.h"
23 23 #include "chartpresenter_p.h"
24 #include "chartanimator_p.h"
24 #include "splineanimation_p.h"
25 25 #include <QPainter>
26 26 #include <QGraphicsSceneMouseEvent>
27 27
@@ -56,6 +56,11 void SplineChartItem::setAnimation(SplineAnimation* animation)
56 56 XYChart::setAnimation(animation);
57 57 }
58 58
59 ChartAnimation* SplineChartItem::animation() const
60 {
61 return m_animation;
62 }
63
59 64 void SplineChartItem::setControlGeometryPoints(QVector<QPointF>& points)
60 65 {
61 66 m_controlPoints=points;
@@ -32,10 +32,11
32 32
33 33 #include "qsplineseries.h"
34 34 #include "xychart_p.h"
35 #include "splineanimation_p.h"
36 35
37 36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
38 37
38 class SplineAnimation;
39
39 40 class SplineChartItem : public XYChart, public QGraphicsItem
40 41 {
41 42 Q_OBJECT
@@ -52,7 +53,7 public:
52 53 QVector<QPointF> controlGeometryPoints() const;
53 54
54 55 void setAnimation(SplineAnimation* animation);
55 ChartAnimation* animation() const { return m_animation; }
56 ChartAnimation* animation() const;
56 57
57 58 public Q_SLOTS:
58 59 void handleUpdated();
@@ -22,12 +22,11
22 22 #include "qxyseries.h"
23 23 #include "qxyseries_p.h"
24 24 #include "chartpresenter_p.h"
25 #include "chartanimator_p.h"
26 25 #include "domain_p.h"
26 #include "qxymodelmapper.h"
27 27 #include <QPainter>
28 28 #include <QAbstractItemModel>
29 #include "qxymodelmapper.h"
30 #include <QDebug>
29
31 30
32 31 QTCOMMERCIALCHART_BEGIN_NAMESPACE
33 32
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now