But How implement waiting ?
Qt Code:
if(allModelsReady) { doSomething(); ... } else { waitToReady }To copy to clipboard, switch view to plain text mode
But How implement waiting ?
Qt Code:
if(allModelsReady) { doSomething(); ... } else { waitToReady }To copy to clipboard, switch view to plain text mode
Last edited by updaterr; 4th July 2014 at 12:31.
event driven programs usually don't wait, they react on changes.
You could react to the change of the new property
Qt Code:
onAllModelsReadyChanged: { if(allModelReady) { } }To copy to clipboard, switch view to plain text mode
But you should also examine if some of the things you want to do can't also be handled declaratively, i.e. depend on the value of allModelsReady directly.
Can you give some examples of what you do when all models have reached the ready state?
Cheers,
_
I have two XmlListModel: TitleListModel, CostListModel. Sometimes I use function to reload that, merge data to one ListModel, and do some other stuff. But usually CostListModel had faster status=Ready than TitleListModel. I need:
1. Reload TitleListModel
2. Reload CostListModel
3. Wait to TitleListModel.status=Ready and CostListModel.status=Ready <- I have proble with this
4. When status are ready, do some functions;
5. When status are'nt ready, drop some error strings
Waiting is implicit, you don't have to do anything.
The properties will change by themselves, you only need to react to the change.
For your point 5 it looks like, additional to the allModelsReady property, you will also want an anyModelError property, something like
Qt Code:
readonly property bool anyModelHasError: titleModel.status == XmlListModel.Error | costModel.status == XmlListModel.ErrorTo copy to clipboard, switch view to plain text mode
Cheers,
_
updaterr (5th July 2014)
Bookmarks