[Qt-interest] QStateMachine API and design?
Stephen Kelly
steveire at gmail.com
Thu Nov 4 13:26:00 CET 2010
Hi,
After figuring out how to use QStateMachine to do what I want I have some
questions. I'm sure it's all deliberate, but I can't figure out why some
things are the way they are.
* Why is there no 'current state'? There is a configuration() which gives me
a set of QStates, but it doesn't tell me which one is the current one. To
get that I iterate over the set and analyse the parent() until I get the
'most extended' state.
* Why is there no notification when the 'current state' is changed?
My usecase is to create a state machine and expose it to QML so that I can
change the ui state on change of the application state. Approximately:
Item {
State {
when : application.state == "connecting"
PropertyChanges { target : myText; text : "Please wait" }
}
}
I have that working by wrapping the statemachine and creating a
NotifyingStateMachine. I just wonder what the right way to do it is and why
there is no notification in QStateMachine. Am I missing the obvious way to
make application state available to QML through QStateMachine?
All the best,
Steve.
More information about the Qt-interest-old
mailing list