Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquicktransition_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKTRANSITION_H
6#define QQUICKTRANSITION_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include "qquickstate_p.h"
20#include <private/qabstractanimationjob_p.h>
21#include <private/qqmlguard_p.h>
22#include <qqml.h>
23
24#include <QtCore/qobject.h>
25
27
28class QQuickAbstractAnimation;
30class QQuickTransitionManager;
31class QQuickTransition;
32
34{
35public:
36 QQuickTransitionInstance(QQuickTransition *transition, QAbstractAnimationJob *anim);
38
39 void start();
40 void stop();
41 void complete();
42
43 bool isRunning() const;
44
45protected:
46 void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State, QAbstractAnimationJob::State) override;
47
49 {
50 m_anim->removeAnimationChangeListener(this, QAbstractAnimationJob::StateChange);
51 }
52
53private:
54 QQmlGuard<QQuickTransition> m_transition;
55 QAbstractAnimationJob *m_anim;
56 friend class QQuickTransition;
57};
58
59class Q_QUICK_EXPORT QQuickTransition : public QObject
60{
61 Q_OBJECT
62 Q_DECLARE_PRIVATE(QQuickTransition)
63
64 Q_PROPERTY(QString from READ fromState WRITE setFromState NOTIFY fromChanged)
65 Q_PROPERTY(QString to READ toState WRITE setToState NOTIFY toChanged)
66 Q_PROPERTY(bool reversible READ reversible WRITE setReversible NOTIFY reversibleChanged)
67 Q_PROPERTY(bool running READ running NOTIFY runningChanged)
68 Q_PROPERTY(QQmlListProperty<QQuickAbstractAnimation> animations READ animations)
69 Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
70 Q_CLASSINFO("DefaultProperty", "animations")
71 Q_CLASSINFO("DeferredPropertyNames", "animations")
72 QML_NAMED_ELEMENT(Transition)
73 QML_ADDED_IN_VERSION(2, 0)
74
75public:
76 QQuickTransition(QObject *parent=nullptr);
77 ~QQuickTransition();
78
79 QString fromState() const;
80 void setFromState(const QString &);
81
82 QString toState() const;
83 void setToState(const QString &);
84
85 bool reversible() const;
86 void setReversible(bool);
87
88 bool enabled() const;
89 void setEnabled(bool enabled);
90
91 bool running() const;
92
93 QQmlListProperty<QQuickAbstractAnimation> animations();
94
95 QQuickTransitionInstance *prepare(QQuickStateOperation::ActionList &actions,
96 QList<QQmlProperty> &after,
97 QQuickTransitionManager *end,
98 QObject *defaultTarget);
99
100 void setReversed(bool r);
101
102Q_SIGNALS:
103 void fromChanged();
104 void toChanged();
105 void reversibleChanged();
106 void enabledChanged();
107 void runningChanged();
108};
109
110QT_END_NAMESPACE
111
112#endif // QQUICKTRANSITION_H
static qsizetype count_transitions(QQmlListProperty< QQuickTransition > *list)
static void clear_states(QQmlListProperty< QQuickState > *list)
static void replace_states(QQmlListProperty< QQuickState > *list, qsizetype index, QQuickState *state)
static void removeLast_states(QQmlListProperty< QQuickState > *list)
void setCurrentStateInternal(const QString &state, bool=false)
static QQuickTransition * at_transition(QQmlListProperty< QQuickTransition > *list, qsizetype index)
static QQuickState * at_state(QQmlListProperty< QQuickState > *list, qsizetype index)
static void clear_transitions(QQmlListProperty< QQuickTransition > *list)
static void append_transition(QQmlListProperty< QQuickTransition > *list, QQuickTransition *state)
QQuickTransition * findTransition(const QString &from, const QString &to)
static qsizetype count_state(QQmlListProperty< QQuickState > *list)
static void append_state(QQmlListProperty< QQuickState > *list, QQuickState *state)
QList< QQuickTransition * > transitions
QList< QQuickState * > states
QQuickTransitionInstance(QQuickTransition *transition, QAbstractAnimationJob *anim)
void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State, QAbstractAnimationJob::State) override