67 template<
typename Func>
70 _completionConnection = connect(sender, signal,
this, [
this]() {
77 template<
typename Func,
typename Slot>
78 void connectToCompletion(
typename QtPrivate::FunctionPointer<Func>::Object* sender, Func signal, Slot slot)
80 _completionConnection = connect(sender, signal,
this, slot);
105 QMetaObject::Connection _completionConnection;
106 bool _wasSkipped =
false;
QString stateName() const
std::function< void()> SkipAction
void connectToCompletion(typename QtPrivate::FunctionPointer< Func >::Object *sender, Func signal)
void setSkipAction(SkipAction skipAction)
Set the skip action.
void setSkipPredicate(SkipPredicate predicate)
Set the skip predicate.
void skipped()
Emitted when skip predicate returns true and the state is skipped.
std::function< bool()> SkipPredicate
void onWaitEntered() override
Called when the state is entered - subclasses should call base implementation.
void complete()
Call this to signal that the async operation has completed successfully.
std::function< void(SkippableAsyncState *state)> SetupFunction
void fail()
Call this to signal that the async operation has failed.
SkippableAsyncState(const QString &stateName, QState *parent, SkipPredicate skipPredicate, SetupFunction setupFunc, SkipAction skipAction=nullptr, int timeoutMsecs=0)
void setSetupFunction(SetupFunction setupFunc)
Set the setup function.
void connectWaitSignal() override
Subclasses override to set up their signal connections.
void connectToCompletion(typename QtPrivate::FunctionPointer< Func >::Object *sender, Func signal, Slot slot)
void disconnectWaitSignal() override
Subclasses override to tear down their signal connections.
WaitStateBase(const QString &stateName, QState *parent, int timeoutMsecs=0)