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 QQUICKANIMATIONCONTROLLER_H |
5 | #define QQUICKANIMATIONCONTROLLER_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 <qqml.h> |
19 | #include <private/qqmlfinalizer_p.h> |
20 | #include "qquickanimation_p.h" |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | class QQuickAnimationControllerPrivate; |
25 | class Q_QUICK_PRIVATE_EXPORT QQuickAnimationController : public QObject, public QQmlFinalizerHook |
26 | { |
27 | Q_OBJECT |
28 | Q_DISABLE_COPY_MOVE(QQuickAnimationController) |
29 | Q_INTERFACES(QQmlFinalizerHook) |
30 | |
31 | Q_DECLARE_PRIVATE(QQuickAnimationController) |
32 | Q_CLASSINFO("DefaultProperty", "animation") |
33 | QML_NAMED_ELEMENT(AnimationController) |
34 | QML_ADDED_IN_VERSION(2, 0) |
35 | |
36 | Q_PROPERTY(qreal progress READ progress WRITE setProgress NOTIFY progressChanged FINAL) |
37 | Q_PROPERTY(QQuickAbstractAnimation *animation READ animation WRITE setAnimation NOTIFY animationChanged FINAL) |
38 | |
39 | public: |
40 | QQuickAnimationController(QObject *parent=nullptr); |
41 | ~QQuickAnimationController(); |
42 | |
43 | qreal progress() const; |
44 | void setProgress(qreal progress); |
45 | |
46 | QQuickAbstractAnimation *animation() const; |
47 | void setAnimation(QQuickAbstractAnimation *animation); |
48 | |
49 | void componentFinalized() override; |
50 | Q_SIGNALS: |
51 | void progressChanged(); |
52 | void animationChanged(); |
53 | public Q_SLOTS: |
54 | void reload(); |
55 | void completeToBeginning(); |
56 | void completeToEnd(); |
57 | private Q_SLOTS: |
58 | void updateProgress(); |
59 | }; |
60 | |
61 | QT_END_NAMESPACE |
62 | |
63 | QML_DECLARE_TYPE(QQuickAnimationController) |
64 | |
65 | #endif // QQUICKANIMATIONCONTROLLER_H |
66 |