samedi 18 juin 2016

Qt asynchronous action sequence

In a C++/Qt program I need to run a few asynchronous tasks with "done" signals (for example network downloads, QProcess, etc.) in sequence, each after the last finishes.

The only ways I can think of are to have a separate state class for each step (extremely verbose, like having a separate class for each line in a synchronous program), or to have one big class with a state enum and fields to hold all possible objects needed for the different steps (inflexible, difficult to maintain). Are there any good solutions for this? It seems like it should be a common problem, but I'm having trouble finding anything.

Aucun commentaire:

Enregistrer un commentaire