| 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 QQUICKSTATEGROUP_H |
| 5 | #define QQUICKSTATEGROUP_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 "qquickstate_p.h" |
| 19 | |
| 20 | QT_BEGIN_NAMESPACE |
| 21 | |
| 22 | class QQuickStateGroupPrivate; |
| 23 | class Q_QUICK_EXPORT QQuickStateGroup : public QObject, public QQmlParserStatus |
| 24 | { |
| 25 | Q_OBJECT |
| 26 | Q_INTERFACES(QQmlParserStatus) |
| 27 | Q_DECLARE_PRIVATE(QQuickStateGroup) |
| 28 | |
| 29 | Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged) |
| 30 | Q_PROPERTY(QQmlListProperty<QQuickState> states READ statesProperty DESIGNABLE false) |
| 31 | Q_PROPERTY(QQmlListProperty<QQuickTransition> transitions READ transitionsProperty DESIGNABLE false) |
| 32 | QML_NAMED_ELEMENT(StateGroup) |
| 33 | QML_ADDED_IN_VERSION(2, 0) |
| 34 | |
| 35 | public: |
| 36 | QQuickStateGroup(QObject * = nullptr); |
| 37 | virtual ~QQuickStateGroup(); |
| 38 | |
| 39 | QString state() const; |
| 40 | void setState(const QString &); |
| 41 | |
| 42 | QQmlListProperty<QQuickState> statesProperty(); |
| 43 | QList<QQuickState *> states() const; |
| 44 | |
| 45 | QQmlListProperty<QQuickTransition> transitionsProperty(); |
| 46 | |
| 47 | QQuickState *findState(const QString &name) const; |
| 48 | void removeState(QQuickState *state); |
| 49 | |
| 50 | void classBegin() override; |
| 51 | void componentComplete() override; |
| 52 | Q_SIGNALS: |
| 53 | void stateChanged(const QString &); |
| 54 | |
| 55 | private: |
| 56 | friend class QQuickState; |
| 57 | friend class QQuickStatePrivate; |
| 58 | bool updateAutoState(); |
| 59 | void stateAboutToComplete(); |
| 60 | }; |
| 61 | |
| 62 | QT_END_NAMESPACE |
| 63 | |
| 64 | #endif // QQUICKSTATEGROUP_H |
| 65 | |