@@ -0,0 +1,79 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | #include "percentbaranimation_p.h" | |
|
22 | #include "percentbarchartitem_p.h" | |
|
23 | #include <QTimer> | |
|
24 | ||
|
25 | Q_DECLARE_METATYPE(QVector<QRectF>) | |
|
26 | ||
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
|
28 | ||
|
29 | PercentBarAnimation::PercentBarAnimation(BarChartItem *item) | |
|
30 | :ChartAnimation(item), | |
|
31 | m_item(item) | |
|
32 | { | |
|
33 | setEasingCurve(QEasingCurve::OutQuart); | |
|
34 | } | |
|
35 | ||
|
36 | PercentBarAnimation::~PercentBarAnimation() | |
|
37 | { | |
|
38 | } | |
|
39 | ||
|
40 | QVariant PercentBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const | |
|
41 | { | |
|
42 | QVector<QRectF> startVector = qVariantValue<QVector<QRectF> >(from); | |
|
43 | QVector<QRectF> endVector = qVariantValue<QVector<QRectF> >(to); | |
|
44 | QVector<QRectF> result; | |
|
45 | ||
|
46 | Q_ASSERT(startVector.count() == endVector.count()); | |
|
47 | ||
|
48 | qreal zeroPos = ((m_item->geometry().height() + m_item->geometry().y()) * (1 - progress)); | |
|
49 | ||
|
50 | for(int i = 0; i < startVector.count(); i++) { | |
|
51 | qreal w = endVector[i].width(); | |
|
52 | qreal h = startVector[i].height() + ((endVector[i].height() - startVector[i].height()) * progress); | |
|
53 | qreal x = endVector[i].topLeft().x(); | |
|
54 | qreal y = startVector[i].topLeft().y() + ((endVector[i].topLeft().y() - startVector[i].topLeft().y()) * progress) | |
|
55 | + zeroPos; | |
|
56 | ||
|
57 | QRectF value(x,y,w,h); | |
|
58 | result << value; | |
|
59 | } | |
|
60 | return qVariantFromValue(result); | |
|
61 | } | |
|
62 | ||
|
63 | void PercentBarAnimation::updateCurrentValue(const QVariant &value) | |
|
64 | { | |
|
65 | QVector<QRectF> layout = qVariantValue<QVector<QRectF> >(value); | |
|
66 | m_item->setLayout(layout); | |
|
67 | } | |
|
68 | ||
|
69 | void PercentBarAnimation::updateLayout(const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout) | |
|
70 | { | |
|
71 | setDuration(ChartAnimationDuration); | |
|
72 | setKeyValueAt(0.0, qVariantFromValue(oldLayout)); | |
|
73 | setKeyValueAt(1.0, qVariantFromValue(newLayout)); | |
|
74 | QTimer::singleShot(0, this, SLOT(start())); | |
|
75 | } | |
|
76 | ||
|
77 | #include "moc_percentbaranimation_p.cpp" | |
|
78 | ||
|
79 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -0,0 +1,43 | |||
|
1 | // W A R N I N G | |
|
2 | // ------------- | |
|
3 | // | |
|
4 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
5 | // implementation detail. This header file may change from version to | |
|
6 | // version without notice, or even be removed. | |
|
7 | // | |
|
8 | // We mean it. | |
|
9 | ||
|
10 | #ifndef PERCENTBARANIMATION_P_H | |
|
11 | #define PERCENTBARANIMATION_P_H | |
|
12 | ||
|
13 | #include "chartanimation_p.h" | |
|
14 | #include "barchartitem_p.h" | |
|
15 | ||
|
16 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
|
17 | ||
|
18 | class PercentBarChartItem; | |
|
19 | class QBarSet; | |
|
20 | class BarSetAnimation; | |
|
21 | ||
|
22 | class PercentBarAnimation : public ChartAnimation | |
|
23 | { | |
|
24 | Q_OBJECT | |
|
25 | public: | |
|
26 | PercentBarAnimation(BarChartItem *item); | |
|
27 | ~PercentBarAnimation(); | |
|
28 | ||
|
29 | public: | |
|
30 | virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const; | |
|
31 | virtual void updateCurrentValue(const QVariant &value); | |
|
32 | ||
|
33 | void updateLayout(const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout); | |
|
34 | ||
|
35 | private: | |
|
36 | BarChartItem *m_item; | |
|
37 | QHash<QBarSet *, BarSetAnimation *> m_animations; | |
|
38 | ||
|
39 | }; | |
|
40 | ||
|
41 | QTCOMMERCIALCHART_END_NAMESPACE | |
|
42 | ||
|
43 | #endif // PERCENTBARANIMATION_P_H |
@@ -0,0 +1,79 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | #include "stackedbaranimation_p.h" | |
|
22 | #include "stackedbarchartitem_p.h" | |
|
23 | #include <QTimer> | |
|
24 | ||
|
25 | Q_DECLARE_METATYPE(QVector<QRectF>) | |
|
26 | ||
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
|
28 | ||
|
29 | StackedBarAnimation::StackedBarAnimation(BarChartItem *item) | |
|
30 | :ChartAnimation(item), | |
|
31 | m_item(item) | |
|
32 | { | |
|
33 | setEasingCurve(QEasingCurve::OutQuart); | |
|
34 | } | |
|
35 | ||
|
36 | StackedBarAnimation::~StackedBarAnimation() | |
|
37 | { | |
|
38 | } | |
|
39 | ||
|
40 | QVariant StackedBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const | |
|
41 | { | |
|
42 | QVector<QRectF> startVector = qVariantValue<QVector<QRectF> >(from); | |
|
43 | QVector<QRectF> endVector = qVariantValue<QVector<QRectF> >(to); | |
|
44 | QVector<QRectF> result; | |
|
45 | ||
|
46 | Q_ASSERT(startVector.count() == endVector.count()); | |
|
47 | ||
|
48 | qreal zeroPos = ((m_item->geometry().height() + m_item->geometry().y()) * (1 - progress)); | |
|
49 | ||
|
50 | for(int i = 0; i < startVector.count(); i++) { | |
|
51 | qreal w = endVector[i].width(); | |
|
52 | qreal h = startVector[i].height() + ((endVector[i].height() - startVector[i].height()) * progress); | |
|
53 | qreal x = endVector[i].topLeft().x(); | |
|
54 | qreal y = startVector[i].topLeft().y() + ((endVector[i].topLeft().y() - startVector[i].topLeft().y()) * progress) | |
|
55 | + zeroPos; | |
|
56 | ||
|
57 | QRectF value(x,y,w,h); | |
|
58 | result << value; | |
|
59 | } | |
|
60 | return qVariantFromValue(result); | |
|
61 | } | |
|
62 | ||
|
63 | void StackedBarAnimation::updateCurrentValue(const QVariant &value) | |
|
64 | { | |
|
65 | QVector<QRectF> layout = qVariantValue<QVector<QRectF> >(value); | |
|
66 | m_item->setLayout(layout); | |
|
67 | } | |
|
68 | ||
|
69 | ||
|
70 | void StackedBarAnimation::updateLayout(const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout) | |
|
71 | { | |
|
72 | setDuration(ChartAnimationDuration); | |
|
73 | setKeyValueAt(0.0, qVariantFromValue(oldLayout)); | |
|
74 | setKeyValueAt(1.0, qVariantFromValue(newLayout)); | |
|
75 | QTimer::singleShot(0, this, SLOT(start())); | |
|
76 | } | |
|
77 | #include "moc_stackedbaranimation_p.cpp" | |
|
78 | ||
|
79 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -0,0 +1,43 | |||
|
1 | // W A R N I N G | |
|
2 | // ------------- | |
|
3 | // | |
|
4 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
|
5 | // implementation detail. This header file may change from version to | |
|
6 | // version without notice, or even be removed. | |
|
7 | // | |
|
8 | // We mean it. | |
|
9 | ||
|
10 | #ifndef STACKEDBARANIMATION_P_H | |
|
11 | #define STACKEDBARANIMATION_P_H | |
|
12 | ||
|
13 | #include "chartanimation_p.h" | |
|
14 | #include "barchartitem_p.h" | |
|
15 | ||
|
16 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
|
17 | ||
|
18 | class StackedBarChartItem; | |
|
19 | class QBarSet; | |
|
20 | class BarSetAnimation; | |
|
21 | ||
|
22 | class StackedBarAnimation : public ChartAnimation | |
|
23 | { | |
|
24 | Q_OBJECT | |
|
25 | public: | |
|
26 | StackedBarAnimation(BarChartItem *item); | |
|
27 | ~StackedBarAnimation(); | |
|
28 | ||
|
29 | public: | |
|
30 | virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const; | |
|
31 | virtual void updateCurrentValue(const QVariant &value); | |
|
32 | ||
|
33 | void updateLayout(const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout); | |
|
34 | ||
|
35 | private: | |
|
36 | BarChartItem *m_item; | |
|
37 | QHash<QBarSet *, BarSetAnimation *> m_animations; | |
|
38 | ||
|
39 | }; | |
|
40 | ||
|
41 | QTCOMMERCIALCHART_END_NAMESPACE | |
|
42 | ||
|
43 | #endif // STACKEDBARANIMATION_P_H |
@@ -8,7 +8,9 SOURCES += \ | |||
|
8 | 8 | $$PWD/pieanimation.cpp \ |
|
9 | 9 | $$PWD/piesliceanimation.cpp \ |
|
10 | 10 | $$PWD/splineanimation.cpp \ |
|
11 | $$PWD/baranimation.cpp | |
|
11 | $$PWD/baranimation.cpp \ | |
|
12 | $$PWD/stackedbaranimation.cpp \ | |
|
13 | $$PWD/percentbaranimation.cpp | |
|
12 | 14 | |
|
13 | 15 | |
|
14 | 16 | |
@@ -20,5 +22,6 PRIVATE_HEADERS += \ | |||
|
20 | 22 | $$PWD/pieanimation_p.h \ |
|
21 | 23 | $$PWD/piesliceanimation_p.h \ |
|
22 | 24 | $$PWD/splineanimation_p.h \ |
|
23 | $$PWD/baranimation_p.h | |
|
24 | ||
|
25 | $$PWD/baranimation_p.h \ | |
|
26 | $$PWD/stackedbaranimation_p.h \ | |
|
27 | $$PWD/percentbaranimation_p.h |
@@ -20,12 +20,9 | |||
|
20 | 20 | |
|
21 | 21 | #include "baranimation_p.h" |
|
22 | 22 | #include "barchartitem_p.h" |
|
23 | #include <QParallelAnimationGroup> | |
|
24 | 23 | #include <QTimer> |
|
25 | 24 | |
|
26 | 25 | Q_DECLARE_METATYPE(QVector<QRectF>) |
|
27 | //Q_DECLARE_METATYPE(BarLayout) // TODO? | |
|
28 | ||
|
29 | 26 | |
|
30 | 27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | 28 | |
@@ -33,6 +30,7 BarAnimation::BarAnimation(BarChartItem *item) | |||
|
33 | 30 | :ChartAnimation(item), |
|
34 | 31 | m_item(item) |
|
35 | 32 | { |
|
33 | setEasingCurve(QEasingCurve::OutQuart); | |
|
36 | 34 | } |
|
37 | 35 | |
|
38 | 36 | BarAnimation::~BarAnimation() |
@@ -53,9 +51,7 QVariant BarAnimation::interpolated(const QVariant &from, const QVariant &to, qr | |||
|
53 | 51 | qreal x = endVector[i].topLeft().x(); |
|
54 | 52 | qreal y = endVector[i].topLeft().y() + endVector[i].height() - h; |
|
55 | 53 | |
|
56 |
Q |
|
|
57 | QSizeF size(w,h); | |
|
58 | QRectF value(topLeft,size); | |
|
54 | QRectF value(x,y,w,h); | |
|
59 | 55 | result << value; |
|
60 | 56 | } |
|
61 | 57 | return qVariantFromValue(result); |
@@ -67,6 +63,14 void BarAnimation::updateCurrentValue(const QVariant &value) | |||
|
67 | 63 | m_item->setLayout(layout); |
|
68 | 64 | } |
|
69 | 65 | |
|
66 | void BarAnimation::updateLayout(const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout) | |
|
67 | { | |
|
68 | setDuration(ChartAnimationDuration); | |
|
69 | setKeyValueAt(0.0, qVariantFromValue(oldLayout)); | |
|
70 | setKeyValueAt(1.0, qVariantFromValue(newLayout)); | |
|
71 | QTimer::singleShot(0, this, SLOT(start())); | |
|
72 | } | |
|
73 | ||
|
70 | 74 | #include "moc_baranimation_p.cpp" |
|
71 | 75 | |
|
72 | 76 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -51,11 +51,10 public: // from QVariantAnimation | |||
|
51 | 51 | virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const; |
|
52 | 52 | virtual void updateCurrentValue(const QVariant &value); |
|
53 | 53 | |
|
54 | public Q_SLOTS: | |
|
54 | void updateLayout(const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout); | |
|
55 | 55 | |
|
56 | 56 | private: |
|
57 | 57 | BarChartItem *m_item; |
|
58 | QHash<QBarSet *, BarSetAnimation *> m_animations; | |
|
59 | 58 | }; |
|
60 | 59 | |
|
61 | 60 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -26,6 +26,10 | |||
|
26 | 26 | #include "pieanimation_p.h" |
|
27 | 27 | #include "baranimation_p.h" |
|
28 | 28 | #include "barchartitem_p.h" |
|
29 | #include "stackedbaranimation_p.h" | |
|
30 | #include "stackedbarchartitem_p.h" | |
|
31 | #include "percentbaranimation_p.h" | |
|
32 | #include "percentbarchartitem_p.h" | |
|
29 | 33 | #include "areachartitem_p.h" |
|
30 | 34 | #include "splinechartitem_p.h" |
|
31 | 35 | #include "scatterchartitem_p.h" |
@@ -59,6 +63,7 void ChartAnimator::addAnimation(PieChartItem *item) | |||
|
59 | 63 | |
|
60 | 64 | void ChartAnimator::addAnimation(BarChartItem *item) |
|
61 | 65 | { |
|
66 | // This can handle also GroupedBarChartItem because bars are side by side | |
|
62 | 67 | ChartAnimation *animation = m_animations.value(item); |
|
63 | 68 | |
|
64 | 69 | if (!animation) { |
@@ -69,6 +74,29 void ChartAnimator::addAnimation(BarChartItem *item) | |||
|
69 | 74 | item->setAnimator(this); |
|
70 | 75 | } |
|
71 | 76 | |
|
77 | void ChartAnimator::addAnimation(StackedBarChartItem *item) | |
|
78 | { | |
|
79 | ChartAnimation *animation = m_animations.value(item); | |
|
80 | ||
|
81 | if (!animation) { | |
|
82 | animation = new StackedBarAnimation(item); | |
|
83 | m_animations.insert(item, animation); | |
|
84 | } | |
|
85 | ||
|
86 | item->setAnimator(this); | |
|
87 | } | |
|
88 | ||
|
89 | void ChartAnimator::addAnimation(PercentBarChartItem *item) | |
|
90 | { | |
|
91 | ChartAnimation *animation = m_animations.value(item); | |
|
92 | ||
|
93 | if (!animation) { | |
|
94 | animation = new PercentBarAnimation(item); | |
|
95 | m_animations.insert(item, animation); | |
|
96 | } | |
|
97 | ||
|
98 | item->setAnimator(this); | |
|
99 | } | |
|
72 | 100 | |
|
73 | 101 | void ChartAnimator::removeAnimation(Chart *item) |
|
74 | 102 | { |
@@ -100,19 +128,41 void ChartAnimator::updateAnimation(PieChartItem *item, PieSliceItem *sliceItem, | |||
|
100 | 128 | void ChartAnimator::updateLayout(BarChartItem *item, const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout) |
|
101 | 129 | { |
|
102 | 130 | BarAnimation *animation = static_cast<BarAnimation *>(m_animations.value(item)); |
|
103 | m_animations.remove(item); | |
|
104 | 131 | if (animation) { |
|
132 | m_animations.remove(item); | |
|
105 | 133 | animation->deleteLater(); |
|
106 | 134 | animation = 0; |
|
107 | } | |
|
108 | 135 | addAnimation(item); |
|
136 | } | |
|
109 | 137 | animation = static_cast<BarAnimation *>(m_animations.value(item)); |
|
110 | animation->setDuration(ChartAnimationDuration); | |
|
111 | animation->setKeyValueAt(0.0, qVariantFromValue(oldLayout)); | |
|
112 | animation->setKeyValueAt(1.0, qVariantFromValue(newLayout)); | |
|
113 | QTimer::singleShot(0, animation, SLOT(start())); | |
|
138 | animation->updateLayout(oldLayout,newLayout); | |
|
139 | } | |
|
140 | ||
|
141 | void ChartAnimator::updateLayout(StackedBarChartItem *item, const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout) | |
|
142 | { | |
|
143 | StackedBarAnimation *animation = static_cast<StackedBarAnimation *>(m_animations.value(item)); | |
|
144 | if (animation) { | |
|
145 | m_animations.remove(item); | |
|
146 | animation->deleteLater(); | |
|
147 | animation = 0; | |
|
148 | addAnimation(item); | |
|
149 | } | |
|
150 | animation = static_cast<StackedBarAnimation *>(m_animations.value(item)); | |
|
151 | animation->updateLayout(oldLayout,newLayout); | |
|
114 | 152 | } |
|
115 | 153 | |
|
154 | void ChartAnimator::updateLayout(PercentBarChartItem *item, const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout) | |
|
155 | { | |
|
156 | PercentBarAnimation *animation = static_cast<PercentBarAnimation *>(m_animations.value(item)); | |
|
157 | if (animation) { | |
|
158 | m_animations.remove(item); | |
|
159 | animation->deleteLater(); | |
|
160 | animation = 0; | |
|
161 | addAnimation(item); | |
|
162 | } | |
|
163 | animation = static_cast<PercentBarAnimation *>(m_animations.value(item)); | |
|
164 | animation->updateLayout(oldLayout,newLayout); | |
|
165 | } | |
|
116 | 166 | #include "moc_chartanimator_p.cpp" |
|
117 | 167 | |
|
118 | 168 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -55,7 +55,9 public: | |||
|
55 | 55 | virtual ~ChartAnimator(); |
|
56 | 56 | |
|
57 | 57 | void addAnimation(PieChartItem *item); |
|
58 | void addAnimation(BarChartItem *item); | |
|
58 | void addAnimation(BarChartItem *item); // This can handle also grouped bar chart. | |
|
59 | void addAnimation(StackedBarChartItem *item); | |
|
60 | void addAnimation(PercentBarChartItem *item); | |
|
59 | 61 | void removeAnimation(Chart *item); |
|
60 | 62 | |
|
61 | 63 | void addAnimation(PieChartItem *item, PieSliceItem *sliceItem, const PieSliceData &sliceData, bool isEmpty); |
@@ -63,6 +65,8 public: | |||
|
63 | 65 | void updateAnimation(PieChartItem *item, PieSliceItem *sliceItem, const PieSliceData &sliceData); |
|
64 | 66 | |
|
65 | 67 | void updateLayout(BarChartItem *item, const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout); |
|
68 | void updateLayout(StackedBarChartItem *item, const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout); | |
|
69 | void updateLayout(PercentBarChartItem *item, const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout); | |
|
66 | 70 | |
|
67 | 71 | private: |
|
68 | 72 | QMap<Chart *, ChartAnimation *> m_animations; |
@@ -19,7 +19,6 | |||
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #include "bar_p.h" |
|
22 | #include <QDebug> | |
|
23 | 22 | #include <QPainter> |
|
24 | 23 | #include <QGraphicsSceneEvent> |
|
25 | 24 |
@@ -54,7 +54,7 public: | |||
|
54 | 54 | QRectF boundingRect() const; |
|
55 | 55 | |
|
56 | 56 | virtual QVector<QRectF> calculateLayout(); |
|
57 | void applyLayout(const QVector<QRectF> &layout); | |
|
57 | virtual void applyLayout(const QVector<QRectF> &layout); | |
|
58 | 58 | void setLayout(const QVector<QRectF> &layout); |
|
59 | 59 | void updateLayout(const QVector<QRectF> &layout); |
|
60 | 60 |
@@ -22,7 +22,7 | |||
|
22 | 22 | #include "bar_p.h" |
|
23 | 23 | #include "qbarseries_p.h" |
|
24 | 24 | #include "qbarset.h" |
|
25 | #include <QDebug> | |
|
25 | #include "chartanimator_p.h" | |
|
26 | 26 | |
|
27 | 27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | 28 | |
@@ -92,6 +92,15 QVector<QRectF> PercentBarChartItem::calculateLayout() | |||
|
92 | 92 | return layout; |
|
93 | 93 | } |
|
94 | 94 | |
|
95 | void PercentBarChartItem::applyLayout(const QVector<QRectF> &layout) | |
|
96 | { | |
|
97 | if (animator()) { | |
|
98 | animator()->updateLayout(this, m_layout, layout); | |
|
99 | } else { | |
|
100 | setLayout(layout); | |
|
101 | update(); | |
|
102 | } | |
|
103 | } | |
|
95 | 104 | #include "moc_percentbarchartitem_p.cpp" |
|
96 | 105 | |
|
97 | 106 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -46,6 +46,7 public: | |||
|
46 | 46 | |
|
47 | 47 | private: |
|
48 | 48 | virtual QVector<QRectF> calculateLayout(); |
|
49 | virtual void applyLayout(const QVector<QRectF> &layout); | |
|
49 | 50 | }; |
|
50 | 51 | |
|
51 | 52 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -23,6 +23,7 | |||
|
23 | 23 | #include "qbarset_p.h" |
|
24 | 24 | #include "qbarseries_p.h" |
|
25 | 25 | #include "qbarset.h" |
|
26 | #include "chartanimator_p.h" | |
|
26 | 27 | |
|
27 | 28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | 29 | |
@@ -85,6 +86,16 QVector<QRectF> StackedBarChartItem::calculateLayout() | |||
|
85 | 86 | return layout; |
|
86 | 87 | } |
|
87 | 88 | |
|
89 | void StackedBarChartItem::applyLayout(const QVector<QRectF> &layout) | |
|
90 | { | |
|
91 | if (animator()) { | |
|
92 | animator()->updateLayout(this, m_layout, layout); | |
|
93 | } else { | |
|
94 | setLayout(layout); | |
|
95 | update(); | |
|
96 | } | |
|
97 | } | |
|
98 | ||
|
88 | 99 | #include "moc_stackedbarchartitem_p.cpp" |
|
89 | 100 | |
|
90 | 101 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now