| 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 QPROPERTYANIMATION_H |
| 5 | #define QPROPERTYANIMATION_H |
| 6 | |
| 7 | #include <QtCore/qvariantanimation.h> |
| 8 | |
| 9 | QT_REQUIRE_CONFIG(animation); |
| 10 | |
| 11 | QT_BEGIN_NAMESPACE |
| 12 | |
| 13 | class QPropertyAnimationPrivate; |
| 14 | class Q_CORE_EXPORT QPropertyAnimation : public QVariantAnimation |
| 15 | { |
| 16 | Q_OBJECT |
| 17 | Q_PROPERTY(QByteArray propertyName READ propertyName WRITE setPropertyName |
| 18 | BINDABLE bindablePropertyName) |
| 19 | Q_PROPERTY(QObject* targetObject READ targetObject WRITE setTargetObject |
| 20 | BINDABLE bindableTargetObject) |
| 21 | |
| 22 | public: |
| 23 | QPropertyAnimation(QObject *parent = nullptr); |
| 24 | QPropertyAnimation(QObject *target, const QByteArray &propertyName, QObject *parent = nullptr); |
| 25 | ~QPropertyAnimation(); |
| 26 | |
| 27 | QObject *targetObject() const; |
| 28 | void setTargetObject(QObject *target); |
| 29 | QBindable<QObject *> bindableTargetObject(); |
| 30 | |
| 31 | QByteArray propertyName() const; |
| 32 | void setPropertyName(const QByteArray &propertyName); |
| 33 | QBindable<QByteArray> bindablePropertyName(); |
| 34 | |
| 35 | protected: |
| 36 | bool event(QEvent *event) override; |
| 37 | void updateCurrentValue(const QVariant &value) override; |
| 38 | void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override; |
| 39 | |
| 40 | private: |
| 41 | Q_DISABLE_COPY(QPropertyAnimation) |
| 42 | Q_DECLARE_PRIVATE(QPropertyAnimation) |
| 43 | }; |
| 44 | |
| 45 | QT_END_NAMESPACE |
| 46 | |
| 47 | #endif // QPROPERTYANIMATION_H |
| 48 |
