Good afternoon,
I am doing some refactoring toward using a QStateMachine for an existing application. So far that process is going well but I do have a few questions.
a. How can I define a QHistoryState state that applies to the entire state machine. For example, the operator can elects to close the application at any time, but our SW requirements stipulate that a confirmation is required. I was thinking of using a history state (to be used as an interrupt), request the confirmation from the operator, and then restore to the current state when the operator declines to close the application. Or should I simply leave the handling of the 'Close Application' signal outside the state machine and post the appropriate event when the application is to be closed.
b. I get a compilation error when trying to declare a transition based on a signal emitted from an object ScriptThread (which is derived from QThread).
error: no matching function for call to ‘QState::addTransition(ScriptThread*&, const char [12], QState*&)’
acquisitionState->addTransition( m_scriptThread, SIGNAL( finished()), acquisitionCompletedState);
However, the original code had a 'connect' using the same signal as the one listed above. This code compiles and executes properly.
connect( m_scriptThread, SIGNAL( finished()), this, SLOT( scriptFinished()), Qt::QueuedConnection);
connect( m_scriptThread, SIGNAL( finished()), this, SLOT( scriptFinished()), Qt::QueuedConnection);
To copy to clipboard, switch view to plain text mode
As I said, ScriptThread is derived from QThread. I can rework around this using postEvent() in a SLOT handling the finished() signal. But I am curious about this compilation error.
Thanks in advance
Daniel
Bookmarks