4#include <QtCore/QMetaObject>
8 , _predicate(std::move(predicate))
9 , _action(std::move(action))
11 connect(
this, &QState::entered,
this, &ConditionalState::_onEntered);
14void ConditionalState::_onEntered()
16 if (_predicate && _predicate()) {
17 qCDebug(QGCStateMachineLog) <<
"Condition met, executing" <<
stateName();
24 qCDebug(QGCStateMachineLog) <<
"Condition not met, skipping" <<
stateName();
ConditionalState(const QString &stateName, QState *parent, Predicate predicate, Action action=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