☰ Menu
CLI Open source 6 installs/mo

qcoro6 for Mac

qcoro6

QCoro - Coroutines for Qt

qcoro6 — overview

QCoro - Coroutines for Qt

The QCoro library provides set of tools to make use of C++20 coroutines with Qt.

Take a look at the example below to see what an amazing thing coroutines are:

It requires a compiler with support for the couroutines TS, see documentation for a list of supported compilers and versions.

Documentation

? ? Documentation

Supported Qt Types

QCoro provides the tools necessary to make easy use of C++20 coroutines with Qt. The cornerstone of the library is QCoro::Task, which represents an executed coroutine and allows the result of the coroutine to be asynchronously awaited by its caller. Additionally, QCoro provides a set of wrappers for common Qt types, such as QTimer, QNetworkReply, QDBusPendingCall, QFuture and others, that allow to co_await their asynchronous operations directly.

Additionally, there's a magical qCoro() function that can wrap many native Qt functions and types to make them coroutine-friendly.

Go check the documentation for a full list of all supported features and Qt types.

QDBusPendingCall

QCoro can wait for an asynchronous D-Bus call to finish. There's no need to use QDBusPendingCallWatcher with QCoro - just co_await the result instead. While co_awaiting, the Qt event loop runs as usual.

? Full documentation here.

QFuture

QFuture represents a result of an asynchronous task. Normally you have to use QFutureWatcher to get notified when the future is ready. With QCoro, you can just co_await it!

? Full documentation here.

QNetworkReply

Doing network requests with Qt can be tedious - the signal/slot approach breaks the flow of your code. Chaining requests and error handling quickly become mess and your code is broken into numerous functions. But not with QCoro, where you can simply co_await the QNetworkReply to finish:

? Full documentation here.

QTimer

Maybe you want to delay executing your code for a second, maybe you want to execute some code in repeated interval. This becomes super-trivial with co_await:

? Full documentation here.

...and more!

Go check the full documentation to learn more.

.then() continuations

Sometimes it's not possible to use co_await to handle result of a coroutine - usually when interfacing with a 3rd party code that does not support coroutines. In those scenarios it's possible to chain a continuation callback to the coroutine which will get invoked asynchronously when the coroutine finishes.

The continuation callback can also be a coroutine and the result of the entire expression is Task where T is the return type of the continuation. Thanks to that it's possible to co_await the entire chain, or chain multiple .then() continuations.

? Full documentation here.

Generators

Generator is a coroutine that lazily produces multiple values. While there's nothing Qt-specific, QCoro provides the necessary tools for users to create custom generators in their Qt applications.

Details

C Qt 的协程

How to install qcoro6

  1. Open Terminal (press ⌘ + Space and type “Terminal”).
  2. If Homebrew is not installed yet, run the command below first.
  3. Run this command:

Latest 10 releases

Last updated 2026-02-13; current version v0.13.0, with the latest 10 releases listed.

VersionReleasedTypeSizemacOSWindowsLinux
v0.13.02026-02-13Stable————
v0.12.02025-04-03Stable————
v0.11.02024-10-04Stable————
v0.10.02023-12-05Stable————
v0.9.02023-04-27Stable————
v0.8.02023-01-31Stable————
v0.7.02022-11-19Stable————
v0.6.02022-07-09Stable————
v0.5.12022-04-27Stable————
v0.5.02022-04-25Stable————

Data from GitHub Releases; stable releases first, each group sorted newest first.

Compared with similar apps

Only public metadata is compared, with no subjective recommendation; see the compare pages for field-by-field comparisons.

Compared with similar apps
AppVersionLicenseArchitecture30-day installs
qcoro6v0.13.0MITCLI6
openssl@4openssl-4.1.0Apache-2.0CLI494,798
xzv5.8.40BSD AND GPL-2.0-or-laterCLI346,605
pkgconfpkgconf-3.0.10ISCCLI311,054

Similar apps: Command-line Tools

Leave a comment

评论表单加载中…