[Qt-interest] Initializing application modules in sequence
Mandeep Sandhu
mandeepsandhu.chd at gmail.com
Tue Apr 26 14:58:28 CEST 2011
> This seems like a hack to achieve what the SM provides naturally.
I wouldn't call it a hack...just a "lesser capable" (but simpler)
version of the SM and multi-threaded (what Frank suggested) approach!
:)
>
>> With this approach I can also give out some sort of 'x percentage
>> completed' signal to a user who might want to show the init progress.
>
> You can also do this easily with the SM approach. Just emit a progress
> signal at suitable points in the controller states/transitions.
Not w/o knowing what are the total number of steps/states under the
top-level init state. So, either I already know what the total number
of steps are, eg when I designed the init-SM i'll know how many
sub-states are there, or try to figure it out by counting the number
of flat states under the top-level init state.
So doable, but not as straight-forward as say counting the number of
items in a list (a list of init routines)! :)
>
>>> Hope that helps but feel free to come back with more questions if
>>> anything is not clear from those ramblings ;-)
>>
>> Your 'ramblings' are very valuable (my understanding of QSM was made
>> easy by you and others on this list). Thanks again for your input!
>
> No problem. Glad to be of any little help. I really think that the
> QtStateMachine framework is one of the most under-valued parts of Qt. It
> makes certain types of problems very trivial. It just requires a little
> shift in mindset but the learning curve is well worth the reward -
> especially when you come to maintain something 12 months from now. ;-)
Agreed. Though sometimes I dither on certain things like - how
'granular' should my SM states be? Should it represent every little
action/transition in my app, or should it have a more 'higher-level'
representation of logical states in my app. I guess one has to have
trade-off between the 2 extremes (and one develops a sixth sense after
enough exp! :)).
Thanks,
-mandeep
More information about the Qt-interest-old
mailing list