QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
MachineEventTransition.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <QtCore/QString>
7#include <functional>
8
15{
16 Q_OBJECT
17 Q_DISABLE_COPY(MachineEventTransition)
18
19public:
20 using Guard = std::function<bool(const QGCStateMachineEvent*)>;
21
25 MachineEventTransition(const QString& eventName, QAbstractState* target);
26
31 MachineEventTransition(const QString& eventName, QAbstractState* target, Guard guard);
32
33 QString eventName() const { return _eventName; }
34
36 QVariant eventData() const { return _lastEventData; }
37
38protected:
39 bool eventTest(QEvent* event) override;
40 void onTransition(QEvent* event) override;
41
42private:
43 QString _eventName;
44 Guard _guard;
45 QVariant _lastEventData;
46};
Transition that fires when a named event is posted to the state machine.
QVariant eventData() const
Access the event data from the last matched event.
bool eventTest(QEvent *event) override
std::function< bool(const QGCStateMachineEvent *)> Guard
void onTransition(QEvent *event) override
Base class for custom transitions that need access to QGCStateMachine and Vehicle.
Custom event for QGCStateMachine delayed/scheduled events.