QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ProgressState.h
Go to the documentation of this file.
1#pragma once
2
3#include "QGCState.h"
4
5#include <functional>
6
27class ProgressState : public QGCState
28{
29 Q_OBJECT
30 Q_DISABLE_COPY(ProgressState)
31
32public:
33 using ProgressCallback = std::function<float()>;
34 using Action = std::function<void()>;
35
41 ProgressState(const QString& stateName, QState* parent, float progress, Action action = nullptr);
42
48 ProgressState(const QString& stateName, QState* parent, ProgressCallback progressCallback, Action action = nullptr);
49
51 float progress() const;
52
54 void setProgress(float progress);
55
58
59signals:
62
63protected:
64 void onEnter() override;
65
66private:
67 float _fixedProgress = 0.0f;
68 ProgressCallback _progressCallback;
69 Action _action;
70 bool _useCallback = false;
71};
State that reports progress on entry.
void onEnter() override
Override to perform actions on state entry.
float progress() const
Get the current progress value.
void progressChanged(float progress)
Emitted when the state is entered with the current progress value.
std::function< void()> Action
void setProgress(float progress)
Set a fixed progress value.
void setProgressCallback(ProgressCallback callback)
Set a progress callback.
std::function< float()> ProgressCallback
QString stateName() const
Full-featured base class for QGroundControl state machine states.
Definition QGCState.h:23