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 INVOKEDSERVICES_P_H
5#define INVOKEDSERVICES_P_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 "qscxmlqmlglobals_p.h"
19
20#include <QtQml/qqmlparserstatus.h>
21#include <QtQml/qqmllist.h>
22#include <QtQml/qqml.h>
23#include <QtScxml/qscxmlstatemachine.h>
24#include <QtCore/qproperty.h>
25#include <private/qproperty_p.h>
26
27QT_BEGIN_NAMESPACE
28
29class Q_SCXMLQML_PRIVATE_EXPORT QScxmlInvokedServices : public QObject, public QQmlParserStatus
30{
31 Q_OBJECT
32 Q_PROPERTY(QScxmlStateMachine *stateMachine READ stateMachine WRITE setStateMachine
33 NOTIFY stateMachineChanged BINDABLE bindableStateMachine)
34 Q_PROPERTY(QVariantMap children READ children NOTIFY childrenChanged BINDABLE bindableChildren)
35 Q_PROPERTY(QQmlListProperty<QObject> qmlChildren READ qmlChildren)
36 Q_INTERFACES(QQmlParserStatus)
37 Q_CLASSINFO("DefaultProperty", "qmlChildren")
38 QML_NAMED_ELEMENT(InvokedServices)
39 QML_ADDED_IN_VERSION(5,8)
40
41public:
42 QScxmlInvokedServices(QObject *parent = nullptr);
43
44 QVariantMap children();
45 QBindable<QVariantMap> bindableChildren();
46
47 QScxmlStateMachine *stateMachine() const;
48 void setStateMachine(QScxmlStateMachine *stateMachine);
49 QBindable<QScxmlStateMachine*> bindableStateMachine();
50
51 QQmlListProperty<QObject> qmlChildren();
52
53Q_SIGNALS:
54 void childrenChanged();
55 void stateMachineChanged();
56
57private:
58 void classBegin() override;
59 void componentComplete() override;
60 QVariantMap childrenActualCalculation() const;
61
62 Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QScxmlInvokedServices, QScxmlStateMachine*, m_stateMachine,
63 &QScxmlInvokedServices::setStateMachine,
64 &QScxmlInvokedServices::stateMachineChanged, nullptr);
65 Q_OBJECT_COMPUTED_PROPERTY(QScxmlInvokedServices, QVariantMap,
66 m_children, &QScxmlInvokedServices::childrenActualCalculation);
67 QMetaObject::Connection m_serviceConnection;
68 QList<QObject *> m_qmlChildren;
69};
70
71QT_END_NAMESPACE
72
73#endif // INVOKEDSERVICES_P_H
74

source code of qtscxml/src/scxmlqml/invokedservices_p.h