A QML wrapper of QFuture

version 1.0.0

To install:

❯ qpm install quick.future.pri

Quick Future

Build Status

QuickFuture is a QML wrapper of QFuture. It allows user to access and listen from a QFuture object generated by a QObject class. So that QML could respond to the result of a threaded calculation.


import Future 1.0


var future = FileActor.read(“tmp.txt”);
// FileActor is a C++ class registered as context property
// QFuture<QString> FileActor::read(const QString&file);
// It is not a part of the library

Future.onFinished(future, function(value) {
  // do something when it is finished.

Future.promise(future).then(function(value) {
  // Future.promise creates a promise object by using Quick Promise. 
  // It is useful when you have multiple tasks / asynchronuous pending.


Custom Type Registration

By default, QFuture is not a standard type recognized by QVariant. Therefore, it can not be used in QML. You have to register QFuture as a QMetaType per template type in order to get rid the error message.

The same rule applies in Quick Future too. Common types are pre-registered already. For your own custom type, you can register it by:

#include <QFFuture>


int main(int argc, char *argv[])



Pre-registered data type list: bool, int, qreal, QString, QByteArray, QVariantMap, void.


(More API will be added upon request)


Returns true if the asynchronous computation represented by this future has finished; otherwise returns false.

Future.onFinished(future, callback)

The callback will be invoked when the watched future finishes.


Create a promise object which will be resolved when the future has finished. It must have QuickPromise installed and setup properly before using this function.


Ben Lau

View on Github

License: APACHE_2_0

Today 0
This week 0
This month 1
This year 462
Total 462