| 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_P_H |
| 5 | #define QPROPERTYANIMATION_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include "qpropertyanimation.h" |
| 19 | |
| 20 | #include "private/qvariantanimation_p.h" |
| 21 | #include "private/qproperty_p.h" |
| 22 | |
| 23 | QT_REQUIRE_CONFIG(animation); |
| 24 | |
| 25 | QT_BEGIN_NAMESPACE |
| 26 | |
| 27 | class QPropertyAnimationPrivate : public QVariantAnimationPrivate |
| 28 | { |
| 29 | Q_DECLARE_PUBLIC(QPropertyAnimation) |
| 30 | public: |
| 31 | QPropertyAnimationPrivate() : propertyType(0), propertyIndex(-1) { } |
| 32 | ~QPropertyAnimationPrivate() override; |
| 33 | |
| 34 | void setTargetObjectForwarder(QObject *target) { q_func()->setTargetObject(target); } |
| 35 | Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QPropertyAnimationPrivate, QObject *, targetObject, |
| 36 | &QPropertyAnimationPrivate::setTargetObjectForwarder, |
| 37 | nullptr) |
| 38 | void targetObjectDestroyed() |
| 39 | { |
| 40 | // stop() has to be called before targetObject is set to nullptr. |
| 41 | // targetObject must not be nullptr in states unequal to "Stopped". |
| 42 | q_func()->stop(); |
| 43 | targetObject.setValueBypassingBindings(nullptr); |
| 44 | targetObject.notify(); |
| 45 | } |
| 46 | |
| 47 | //for the QProperty |
| 48 | int propertyType; |
| 49 | int propertyIndex; |
| 50 | |
| 51 | void setPropertyName(const QByteArray &propertyName) |
| 52 | { |
| 53 | q_func()->setPropertyName(propertyName); |
| 54 | } |
| 55 | Q_OBJECT_COMPAT_PROPERTY(QPropertyAnimationPrivate, QByteArray, propertyName, |
| 56 | &QPropertyAnimationPrivate::setPropertyName) |
| 57 | void updateProperty(const QVariant &); |
| 58 | void updateMetaProperty(); |
| 59 | }; |
| 60 | |
| 61 | QT_END_NAMESPACE |
| 62 | |
| 63 | #endif //QPROPERTYANIMATION_P_H |
| 64 |
