Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86725

Add support for automatic unwrapping QFuture inside of .then()

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 6.0
    • Core: QtConcurrent
    • None
    • All
    • 8
    • Team A Foundation Sprint 55

    Description

      When creating a Async pipeline sometimes QFuture.then() may return QFuture. It's useful to unwrap the returned QFuture such there's not QFuture<QFuture<T>>. For example:

      auto download = [](QUrl url) {
         ...
         return QList<Tile>({tile1, ..., tileX});
      }
      
      auto processTiles = [](QList<Tile> tiles) {
         QFuture<QImage> future = QtConcurrent::mappedReduced(tiles, 
                                                   processTile, //Map function
                                                   reduceTiles) //Reduce function
         return future;
      } 
      
      auto saveImage = [](QImage image) {
         image.save(...);
      }
      
      auto future = QtConcurrent::run(download, url)
                  .then(processTiles)
                  .then(saveImage)

      Things to consider when implementing unwrapped QFutures this:

      • Handling / propagating progress
      • Handling errors
      • Handling canceling and pausingĀ 

      Attachments

        For Gerrit Dashboard: QTBUG-86725
        # Subject Branch Project Status CR V

        Activity

          People

            sonakur Sona Kurazyan
            pschuchardt Philip Schuchardt
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes