QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCState.h
Go to the documentation of this file.
1#pragma once
2
3#include "QGCAbstractState.h"
4
5#include <QtCore/QLoggingCategory>
6
7Q_DECLARE_LOGGING_CATEGORY(QGCStateMachineLog)
8
10class Vehicle;
11
23{
24 Q_OBJECT
25 Q_DISABLE_COPY(QGCState)
26
27public:
28 QGCState(const QString& stateName, QState* parentState);
29
31 template <typename PointerToMemberFunction> QSignalTransition *addThisTransition(PointerToMemberFunction signal, QAbstractState *target)
32 { return QState::addTransition(this, signal, target); };
33
34 // -------------------------------------------------------------------------
35 // Error Handling
36 // -------------------------------------------------------------------------
37
40 void setLocalErrorState(QAbstractState* errorState);
41
43 QAbstractState* localErrorState() const { return _localErrorState; }
44
45 // -------------------------------------------------------------------------
46 // Property Assignment
47 // -------------------------------------------------------------------------
48
54 void setProperty(QObject* object, const char* name, const QVariant& value);
55
57 void setEnabled(QObject* object, bool enabled);
58
60 void setVisible(QObject* object, bool visible);
61
62private:
63 QAbstractState* _localErrorState = nullptr;
64};
Lightweight base class for simple states.
QString stateName() const
QGroundControl specific state machine with enhanced error handling.
Full-featured base class for QGroundControl state machine states.
Definition QGCState.h:23
QAbstractState * localErrorState() const
Get the per-state error state (nullptr if using global)
Definition QGCState.h:43
void setEnabled(QObject *object, bool enabled)
Convenience overload for setting enabled state on widgets/controls.
Definition QGCState.cc:25
void setVisible(QObject *object, bool visible)
Convenience overload for setting visible state on widgets/controls.
Definition QGCState.cc:30
QSignalTransition * addThisTransition(PointerToMemberFunction signal, QAbstractState *target)
Simpler version of QState::addTransition which assumes the sender is this.
Definition QGCState.h:31
void setProperty(QObject *object, const char *name, const QVariant &value)
Definition QGCState.cc:20
void setLocalErrorState(QAbstractState *errorState)
Definition QGCState.cc:11