KTutorial
0.5.1
|
Waits for the activation of a step. More...
#include <WaitForStepActivation.h>
Public Member Functions | |
Q_INVOKABLE | WaitForStepActivation () |
Creates a new WaitForStepActivation. | |
WaitForStepActivation (const Tutorial *tutorial, const Step *step) | |
Creates a new WaitForStepActivation. | |
virtual | ~WaitForStepActivation () |
Destroys this WaitForStepActivation. | |
Q_INVOKABLE void | setStep (const Tutorial *tutorial, const Step *step) |
Sets the step to wait for its activation. | |
virtual bool | conditionMet () const |
Returns true if the step is being activated. |
Waits for the activation of a step.
When the step is activated, the wait ends.
The purpose of WaitForStepActivations is to be combined with one or more WaitForProperties using a WaitForAnd. If the properties have the expected value when the step is activated, the associated slot is executed or the next step is requested (depending on the Step::addWaitFor() method used). It can be used to set "preconditions" for a step, and change to another step if some things that should have been done before that step were not done yet.
Note that the condition is met only while the step is being activated. Once the step is active, the condition is no longer met (until the next time that the step is being activated again). Due to this, it only makes sense to use WaitForStepActivation with the same step that the WaitForStepActivation is going to be added to (if used to wait for the activation of another step, the WaitForStepActivation will always be inactive when that step is being activated).
Despite waiting for the step activation, WaitForStepActivation can be safely created and added to a step in its setup, and several WaitForStepActivation can be added to the same step without problems.
Definition at line 59 of file WaitForStepActivation.h.
Creates a new WaitForStepActivation.
This constructor is needed to dynamically create WaitForStepActivation objects in scripts using ScriptingModule::newWaitFor(const QString&). Method setStep(const Tutorial*, const Step*) must be called to finish setting up the object. For C++ tutorials, use WaitForStepActivation(const Tutorial*, const Step*) constructor instead of this one.
Definition at line 36 of file WaitForStepActivation.cpp.
References ktutorial::WaitForStepActivationPrivate::mDuringStepActivation.
ktutorial::WaitForStepActivation::WaitForStepActivation | ( | const Tutorial * | tutorial, |
const Step * | step | ||
) |
Creates a new WaitForStepActivation.
tutorial | The tutorial that contains the step. |
step | The step to wait for its activation. |
Definition at line 41 of file WaitForStepActivation.cpp.
References ktutorial::WaitForStepActivationPrivate::mDuringStepActivation, and setStep().
bool ktutorial::WaitForStepActivation::conditionMet | ( | ) | const [virtual] |
Returns true if the step is being activated.
Note that true is only returned during the step activation, but not once it is already active.
Implements ktutorial::WaitFor.
Definition at line 69 of file WaitForStepActivation.cpp.
References ktutorial::WaitForStepActivationPrivate::mDuringStepActivation.
void ktutorial::WaitForStepActivation::setStep | ( | const Tutorial * | tutorial, |
const Step * | step | ||
) |
Sets the step to wait for its activation.
This method can be invoked from a script.
In fact, you should only invoke this method from a script, and only once, to set up the object. For C++ tutorials, use WaitForStepActivation(const Tutorial*, const Step*) constructor when creating this WaitForStepActivation.
tutorial | The tutorial that contains the step. |
step | The step to wait for its activation. |
Definition at line 52 of file WaitForStepActivation.cpp.
Referenced by WaitForStepActivation().