@@ -62,6 +62,7 int main(int argc, char *argv[]) | |||||
62 | chart->addSeries(series); |
|
62 | chart->addSeries(series); | |
63 | chart->setTitle("Simple horizontal barchart example"); |
|
63 | chart->setTitle("Simple horizontal barchart example"); | |
64 | chart->createDefaultAxes(); |
|
64 | chart->createDefaultAxes(); | |
|
65 | chart->setAnimationOptions(QChart::SeriesAnimations); | |||
65 | //![3] |
|
66 | //![3] | |
66 |
|
67 | |||
67 | //![4] |
|
68 | //![4] |
@@ -39,11 +39,22 HorizontalBarAnimation::~HorizontalBarAnimation() | |||||
39 |
|
39 | |||
40 | QVariant HorizontalBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const |
|
40 | QVariant HorizontalBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const | |
41 | { |
|
41 | { | |
42 | // TODO: |
|
42 | QVector<QRectF> startVector = qVariantValue<QVector<QRectF> >(from); | |
43 | Q_UNUSED(from); |
|
43 | QVector<QRectF> endVector = qVariantValue<QVector<QRectF> >(to); | |
44 | Q_UNUSED(to); |
|
44 | QVector<QRectF> result; | |
45 | Q_UNUSED(progress); |
|
45 | ||
46 | return to; |
|
46 | Q_ASSERT(startVector.count() == endVector.count()); | |
|
47 | ||||
|
48 | for(int i = 0; i < startVector.count(); i++) { | |||
|
49 | qreal h = endVector[i].height(); | |||
|
50 | qreal w = startVector[i].width() + ((endVector[i].width() - startVector[i].width()) * progress); | |||
|
51 | qreal x = endVector[i].topLeft().x(); | |||
|
52 | qreal y = endVector[i].topLeft().y(); | |||
|
53 | ||||
|
54 | QRectF value(x,y,w,h); | |||
|
55 | result << value; | |||
|
56 | } | |||
|
57 | return qVariantFromValue(result); | |||
47 | } |
|
58 | } | |
48 |
|
59 | |||
49 | #include "moc_horizontalbaranimation_p.cpp" |
|
60 | #include "moc_horizontalbaranimation_p.cpp" |
General Comments 0
You need to be logged in to leave comments.
Login now