| 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 | |
| 10 | QT_REQUIRE_CONFIG(graphicsview); |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | class QGraphicsItem; |
| 15 | class QPointF; |
| 16 | class QTimeLine; |
| 17 | class QTransform; |
| 18 | |
| 19 | class QGraphicsItemAnimationPrivate; |
| 20 | class Q_WIDGETS_EXPORT QGraphicsItemAnimation : public QObject |
| 21 | { |
| 22 | Q_OBJECT |
| 23 | public: |
| 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<std::pair<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<std::pair<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<std::pair<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<std::pair<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<std::pair<qreal, QPointF> > shearList() const; |
| 56 | void setShearAt(qreal step, qreal sh, qreal sv); |
| 57 | |
| 58 | void clear(); |
| 59 | |
| 60 | public Q_SLOTS: |
| 61 | void setStep(qreal x); |
| 62 | |
| 63 | protected: |
| 64 | virtual void beforeAnimationStep(qreal step); |
| 65 | virtual void afterAnimationStep(qreal step); |
| 66 | |
| 67 | private: |
| 68 | Q_DISABLE_COPY(QGraphicsItemAnimation) |
| 69 | QGraphicsItemAnimationPrivate *d; |
| 70 | }; |
| 71 | |
| 72 | QT_END_NAMESPACE |
| 73 | |
| 74 | #endif |
| 75 | |