QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ConditionalState.h
Go to the documentation of this file.
1#pragma once
2
3#include "QGCState.h"
4
5#include <functional>
6
10{
11 Q_OBJECT
12 Q_DISABLE_COPY(ConditionalState)
13
14public:
15 using Predicate = std::function<bool()>;
16 using Action = std::function<void()>;
17
22 ConditionalState(const QString& stateName, QState* parent, Predicate predicate, Action action = Action());
23
25 void setPredicate(Predicate predicate) { _predicate = std::move(predicate); }
26
28 void setAction(Action action) { _action = std::move(action); }
29
30signals:
32 void skipped();
33
34private slots:
35 void _onEntered();
36
37private:
38 Predicate _predicate;
39 Action _action;
40};
void setPredicate(Predicate predicate)
Set the predicate.
void setAction(Action action)
Set the action.
void skipped()
Emitted when the predicate returns false and the state is skipped.
std::function< void()> Action
std::function< bool()> Predicate
QString stateName() const