PDA

View Full Version : QStateMachine



piotr.dobrogost
31st July 2009, 19:21
I'm trying to use QStateMachine with QWebPage and I'm stuck in the middle of nowhere.

I'm using qwebpage to load and navigate through a site. During this navigation I have to make a series of actions like connect, login, query, logout, login, query, query, logout, disconnect. So I have my class Session modeling this with abstract methods login, query, logout etc. I also created a state machine inside this class using QStateMachine class. Loading each page is signaled by emitting loadFinished(bool) signal by qwebpage. I have to make sure the next action is not taken until after the previous page is loaded (what means waiting for loadFinished(bool) signal).

What should I do inside loadFinished(bool) and in my methods so that they make use of a state machine to control what actions are made in what moments?

lyuts
26th August 2009, 14:13
You have to implement your slot, which will be connected to loadFinished. Once the page is loaded completely the signal will be emitted and your slot will start execution.

MarkoSan
6th December 2009, 07:42
How can be checked in which state is statemachine, I cannot get this info form docs ...?

wysota
6th December 2009, 08:17
Listen for entered() signal from the states.