1// Copyright (C) 2019 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 QQUICKBOUNDARYRULE_H
5#define QQUICKBOUNDARYRULE_H
6
7#include "qqmlanimationglobal_p.h"
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <private/qtquickglobal_p.h>
21
22#include <private/qqmlpropertyvalueinterceptor_p.h>
23#include <qqml.h>
24
25QT_BEGIN_NAMESPACE
26
27class QQuickAbstractAnimation;
28class QQuickBoundaryRulePrivate;
29class Q_LABSANIMATION_PRIVATE_EXPORT QQuickBoundaryRule : public QObject, public QQmlPropertyValueInterceptor, public QQmlParserStatus
30{
31 Q_OBJECT
32 Q_INTERFACES(QQmlParserStatus)
33 Q_DECLARE_PRIVATE(QQuickBoundaryRule)
34
35 Q_INTERFACES(QQmlPropertyValueInterceptor)
36 Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged FINAL)
37 Q_PROPERTY(qreal minimum READ minimum WRITE setMinimum NOTIFY minimumChanged FINAL)
38 Q_PROPERTY(qreal minimumOvershoot READ minimumOvershoot WRITE setMinimumOvershoot NOTIFY minimumOvershootChanged FINAL)
39 Q_PROPERTY(qreal maximum READ maximum WRITE setMaximum NOTIFY maximumChanged FINAL)
40 Q_PROPERTY(qreal maximumOvershoot READ maximumOvershoot WRITE setMaximumOvershoot NOTIFY maximumOvershootChanged FINAL)
41 Q_PROPERTY(qreal overshootScale READ overshootScale WRITE setOvershootScale NOTIFY overshootScaleChanged FINAL)
42 Q_PROPERTY(qreal currentOvershoot READ currentOvershoot NOTIFY currentOvershootChanged FINAL)
43 Q_PROPERTY(qreal peakOvershoot READ peakOvershoot NOTIFY peakOvershootChanged FINAL)
44 Q_PROPERTY(OvershootFilter overshootFilter READ overshootFilter WRITE setOvershootFilter NOTIFY overshootFilterChanged FINAL)
45 Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged FINAL)
46 Q_PROPERTY(int returnDuration READ returnDuration WRITE setReturnDuration NOTIFY returnDurationChanged FINAL)
47 QML_NAMED_ELEMENT(BoundaryRule)
48 QML_ADDED_IN_VERSION(1, 0)
49
50public:
51 enum OvershootFilter {
52 None,
53 Peak
54 };
55 Q_ENUM(OvershootFilter)
56
57 QQuickBoundaryRule(QObject *parent=nullptr);
58 ~QQuickBoundaryRule();
59
60 void setTarget(const QQmlProperty &) override;
61 void write(const QVariant &value) override;
62
63 bool enabled() const;
64 void setEnabled(bool enabled);
65
66 qreal minimum() const;
67 void setMinimum(qreal minimum);
68 qreal minimumOvershoot() const;
69 void setMinimumOvershoot(qreal minimum);
70
71 qreal maximum() const;
72 void setMaximum(qreal maximum);
73 qreal maximumOvershoot() const;
74 void setMaximumOvershoot(qreal maximum);
75
76 qreal overshootScale() const;
77 void setOvershootScale(qreal scale);
78
79 qreal currentOvershoot() const;
80 qreal peakOvershoot() const;
81
82 OvershootFilter overshootFilter() const;
83 void setOvershootFilter(OvershootFilter overshootFilter);
84
85 Q_INVOKABLE bool returnToBounds();
86
87 QEasingCurve easing() const;
88 void setEasing(const QEasingCurve &easing);
89
90 int returnDuration() const;
91 void setReturnDuration(int duration);
92
93 // QQmlParserStatus interface
94 void classBegin() override;
95 void componentComplete() override;
96
97Q_SIGNALS:
98 void enabledChanged();
99 void minimumChanged();
100 void minimumOvershootChanged();
101 void maximumChanged();
102 void maximumOvershootChanged();
103 void overshootScaleChanged();
104 void currentOvershootChanged();
105 void peakOvershootChanged();
106 void overshootFilterChanged();
107 void easingChanged();
108 void returnDurationChanged();
109 void returnedToBounds();
110};
111
112QT_END_NAMESPACE
113
114QML_DECLARE_TYPE(QQuickBoundaryRule)
115
116#endif // QQUICKBOUNDARYRULE_H
117

source code of qtdeclarative/src/labs/animation/qquickboundaryrule_p.h