1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QGRAPHICSITEMANIMATION_H
5#define QGRAPHICSITEMANIMATION_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtCore/qobject.h>
9
10QT_REQUIRE_CONFIG(graphicsview);
11
12QT_BEGIN_NAMESPACE
13
14class QGraphicsItem;
15class QPointF;
16class QTimeLine;
17class QTransform;
18
19class QGraphicsItemAnimationPrivate;
20class Q_WIDGETS_EXPORT QGraphicsItemAnimation : public QObject
21{
22 Q_OBJECT
23public:
24 QGraphicsItemAnimation(QObject *parent = nullptr);
25 virtual ~QGraphicsItemAnimation();
26
27 QGraphicsItem *item() const;
28 void setItem(QGraphicsItem *item);
29
30 QTimeLine *timeLine() const;
31 void setTimeLine(QTimeLine *timeLine);
32
33 QPointF posAt(qreal step) const;
34 QList<QPair<qreal, QPointF> > posList() const;
35 void setPosAt(qreal step, const QPointF &pos);
36
37 QTransform transformAt(qreal step) const;
38
39 qreal rotationAt(qreal step) const;
40 QList<QPair<qreal, qreal> > rotationList() const;
41 void setRotationAt(qreal step, qreal angle);
42
43 qreal xTranslationAt(qreal step) const;
44 qreal yTranslationAt(qreal step) const;
45 QList<QPair<qreal, QPointF> > translationList() const;
46 void setTranslationAt(qreal step, qreal dx, qreal dy);
47
48 qreal verticalScaleAt(qreal step) const;
49 qreal horizontalScaleAt(qreal step) const;
50 QList<QPair<qreal, QPointF> > scaleList() const;
51 void setScaleAt(qreal step, qreal sx, qreal sy);
52
53 qreal verticalShearAt(qreal step) const;
54 qreal horizontalShearAt(qreal step) const;
55 QList<QPair<qreal, QPointF> > shearList() const;
56 void setShearAt(qreal step, qreal sh, qreal sv);
57
58 void clear();
59
60public Q_SLOTS:
61 void setStep(qreal x);
62
63protected:
64 virtual void beforeAnimationStep(qreal step);
65 virtual void afterAnimationStep(qreal step);
66
67private:
68 Q_DISABLE_COPY(QGraphicsItemAnimation)
69 QGraphicsItemAnimationPrivate *d;
70};
71
72QT_END_NAMESPACE
73
74#endif
75

source code of qtbase/src/widgets/graphicsview/qgraphicsitemanimation.h