| 1 | // Copyright (C) 2016 Ford Motor Company |
|---|---|
| 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 STATE_H |
| 5 | #define STATE_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 "qstatemachineqmlglobals_p.h" |
| 19 | #include "childrenprivate_p.h" |
| 20 | |
| 21 | #include <QtCore/qproperty.h> |
| 22 | #include <QtStateMachine/QState> |
| 23 | #include <QtQml/QQmlParserStatus> |
| 24 | #include <QtQml/QQmlListProperty> |
| 25 | #include <QtQml/qqml.h> |
| 26 | |
| 27 | QT_BEGIN_NAMESPACE |
| 28 | |
| 29 | class Q_STATEMACHINEQML_EXPORT State : public QState, public QQmlParserStatus |
| 30 | { |
| 31 | Q_OBJECT |
| 32 | Q_INTERFACES(QQmlParserStatus) |
| 33 | Q_PROPERTY(QQmlListProperty<QObject> children READ children |
| 34 | NOTIFY childrenChanged BINDABLE bindableChildren) |
| 35 | Q_CLASSINFO("DefaultProperty", "children") |
| 36 | QML_ELEMENT |
| 37 | QML_ADDED_IN_VERSION(1, 0) |
| 38 | |
| 39 | public: |
| 40 | explicit State(QState *parent = 0); |
| 41 | |
| 42 | void classBegin() override {} |
| 43 | void componentComplete() override; |
| 44 | |
| 45 | QQmlListProperty<QObject> children(); |
| 46 | QBindable<QQmlListProperty<QObject>> bindableChildren() const; |
| 47 | |
| 48 | Q_SIGNALS: |
| 49 | void childrenChanged(); |
| 50 | |
| 51 | private: |
| 52 | // See the childrenActualCalculation for the mutable explanation |
| 53 | mutable ChildrenPrivate<State, ChildrenMode::StateOrTransition> m_children; |
| 54 | friend ChildrenPrivate<State, ChildrenMode::StateOrTransition>; |
| 55 | void childrenContentChanged(); |
| 56 | QQmlListProperty<QObject> childrenActualCalculation() const; |
| 57 | Q_OBJECT_COMPUTED_PROPERTY(State, QQmlListProperty<QObject>, m_childrenComputedProperty, |
| 58 | &State::childrenActualCalculation); |
| 59 | }; |
| 60 | |
| 61 | QT_END_NAMESPACE |
| 62 | |
| 63 | #endif |
| 64 |
