| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the QtScxml module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #ifndef QSCXMLEVENT_H |
| 41 | #define QSCXMLEVENT_H |
| 42 | |
| 43 | #include <QtScxml/qscxmlglobals.h> |
| 44 | |
| 45 | #include <QtCore/qstringlist.h> |
| 46 | #include <QtCore/qvariant.h> |
| 47 | |
| 48 | QT_BEGIN_NAMESPACE |
| 49 | |
| 50 | class QScxmlEventPrivate; |
| 51 | |
| 52 | class Q_SCXML_EXPORT QScxmlEvent |
| 53 | { |
| 54 | Q_GADGET |
| 55 | Q_PROPERTY(QString name READ name WRITE setName) |
| 56 | Q_PROPERTY(EventType eventType READ eventType WRITE setEventType) |
| 57 | Q_PROPERTY(QString scxmlType READ scxmlType) |
| 58 | Q_PROPERTY(QString sendId READ sendId WRITE setSendId) |
| 59 | Q_PROPERTY(QString origin READ origin WRITE setOrigin) |
| 60 | Q_PROPERTY(QString originType READ originType WRITE setOriginType) |
| 61 | Q_PROPERTY(QString invokeId READ invokeId WRITE setInvokeId) |
| 62 | Q_PROPERTY(int delay READ delay WRITE setDelay) |
| 63 | Q_PROPERTY(QVariant data READ data WRITE setData) |
| 64 | Q_PROPERTY(bool errorEvent READ isErrorEvent) |
| 65 | Q_PROPERTY(QString errorMessage READ errorMessage WRITE setErrorMessage) |
| 66 | |
| 67 | public: |
| 68 | QScxmlEvent(); |
| 69 | ~QScxmlEvent(); |
| 70 | |
| 71 | QScxmlEvent &operator=(const QScxmlEvent &other); |
| 72 | QScxmlEvent(const QScxmlEvent &other); |
| 73 | |
| 74 | enum EventType { |
| 75 | PlatformEvent, |
| 76 | InternalEvent, |
| 77 | ExternalEvent |
| 78 | }; |
| 79 | Q_ENUM(EventType) |
| 80 | |
| 81 | QString name() const; |
| 82 | void setName(const QString &name); |
| 83 | |
| 84 | EventType eventType() const; |
| 85 | void setEventType(const EventType &type); |
| 86 | |
| 87 | QString scxmlType() const; |
| 88 | |
| 89 | QString sendId() const; |
| 90 | void setSendId(const QString &sendId); |
| 91 | |
| 92 | QString origin() const; |
| 93 | void setOrigin(const QString &origin); |
| 94 | |
| 95 | QString originType() const; |
| 96 | void setOriginType(const QString &originType); |
| 97 | |
| 98 | QString invokeId() const; |
| 99 | void setInvokeId(const QString &invokeId); |
| 100 | |
| 101 | int delay() const; |
| 102 | void setDelay(int delayInMiliSecs); |
| 103 | |
| 104 | Q_INVOKABLE void clear(); |
| 105 | |
| 106 | QVariant data() const; |
| 107 | void setData(const QVariant &data); |
| 108 | |
| 109 | bool isErrorEvent() const; |
| 110 | QString errorMessage() const; |
| 111 | void setErrorMessage(const QString &message); |
| 112 | |
| 113 | private: |
| 114 | QScxmlEventPrivate *d; |
| 115 | |
| 116 | }; |
| 117 | |
| 118 | QT_END_NAMESPACE |
| 119 | |
| 120 | Q_DECLARE_METATYPE(QScxmlEvent) |
| 121 | |
| 122 | #endif // QSCXMLEVENT_H |
| 123 | |