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 QEVENTTRANSITION_H
5#define QEVENTTRANSITION_H
6
7#include <QtCore/qcoreevent.h>
8#include <QtStateMachine/qabstracttransition.h>
9
10QT_REQUIRE_CONFIG(qeventtransition);
11
12QT_BEGIN_NAMESPACE
13
14class QEventTransitionPrivate;
15class Q_STATEMACHINE_EXPORT QEventTransition : public QAbstractTransition
16{
17 Q_OBJECT
18 Q_PROPERTY(QObject* eventSource READ eventSource WRITE setEventSource
19 BINDABLE bindableEventSource)
20 Q_PROPERTY(QEvent::Type eventType READ eventType WRITE setEventType
21 BINDABLE bindableEventType)
22public:
23 QEventTransition(QState *sourceState = nullptr);
24 QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = nullptr);
25 ~QEventTransition();
26
27 QObject *eventSource() const;
28 void setEventSource(QObject *object);
29 QBindable<QObject*> bindableEventSource();
30
31 QEvent::Type eventType() const;
32 void setEventType(QEvent::Type type);
33 QBindable<QEvent::Type> bindableEventType();
34
35protected:
36 bool eventTest(QEvent *event) override;
37 void onTransition(QEvent *event) override;
38
39 bool event(QEvent *e) override;
40
41protected:
42 QEventTransition(QEventTransitionPrivate &dd, QState *parent);
43 QEventTransition(QEventTransitionPrivate &dd, QObject *object,
44 QEvent::Type type, QState *parent);
45
46private:
47 Q_DISABLE_COPY(QEventTransition)
48 Q_DECLARE_PRIVATE(QEventTransition)
49};
50
51QT_END_NAMESPACE
52
53#endif
54

source code of qtscxml/src/statemachine/qeventtransition.h