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 QQUICKBEHAVIOR_H |
5 | #define QQUICKBEHAVIOR_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 <private/qtquickglobal_p.h> |
19 | |
20 | #include <private/qqmlpropertyvalueinterceptor_p.h> |
21 | #include <private/qqmlengine_p.h> |
22 | #include <qqml.h> |
23 | #include <private/qqmlfinalizer_p.h> |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | class QQuickAbstractAnimation; |
28 | class QQuickBehaviorPrivate; |
29 | class Q_QUICK_PRIVATE_EXPORT QQuickBehavior : public QObject, public QQmlPropertyValueInterceptor, public QQmlFinalizerHook |
30 | { |
31 | Q_OBJECT |
32 | Q_INTERFACES(QQmlFinalizerHook) |
33 | Q_DECLARE_PRIVATE(QQuickBehavior) |
34 | |
35 | Q_INTERFACES(QQmlPropertyValueInterceptor) |
36 | Q_CLASSINFO("DefaultProperty", "animation") |
37 | Q_PROPERTY(QQuickAbstractAnimation *animation READ animation WRITE setAnimation FINAL) |
38 | Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged FINAL) |
39 | Q_PROPERTY(QVariant targetValue READ targetValue NOTIFY targetValueChanged REVISION(2, 13) FINAL) |
40 | Q_PROPERTY(QQmlProperty targetProperty READ targetProperty NOTIFY targetPropertyChanged REVISION(2, 15) FINAL) |
41 | Q_CLASSINFO("DeferredPropertyNames", "animation") |
42 | QML_NAMED_ELEMENT(Behavior) |
43 | QML_ADDED_IN_VERSION(2, 0) |
44 | |
45 | public: |
46 | QQuickBehavior(QObject *parent=nullptr); |
47 | ~QQuickBehavior(); |
48 | |
49 | void setTarget(const QQmlProperty &) override; |
50 | void write(const QVariant &value) override; |
51 | bool bindable(QUntypedBindable *untypedBindable, QUntypedBindable target) override; |
52 | |
53 | QQuickAbstractAnimation *animation(); |
54 | void setAnimation(QQuickAbstractAnimation *); |
55 | |
56 | bool enabled() const; |
57 | void setEnabled(bool enabled); |
58 | |
59 | QVariant targetValue() const; |
60 | |
61 | QQmlProperty targetProperty() const; |
62 | |
63 | void componentFinalized() override; |
64 | |
65 | Q_SIGNALS: |
66 | void enabledChanged(); |
67 | void targetValueChanged(); |
68 | void targetPropertyChanged(); |
69 | }; |
70 | |
71 | QT_END_NAMESPACE |
72 | |
73 | QML_DECLARE_TYPE(QQuickBehavior) |
74 | |
75 | #endif // QQUICKBEHAVIOR_H |
76 |