Differential D18758 Diff 58398 kdevplatform/3rdparty/qtpromise/qtpromise-0.5.0/docs/qtpromise/helpers/resolve.md
Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/3rdparty/qtpromise/qtpromise-0.5.0/docs/qtpromise/helpers/resolve.md
- This file was added.
1 | --- | ||||
---|---|---|---|---|---|
2 | title: resolve | ||||
3 | --- | ||||
4 | | ||||
5 | # QtPromise::resolve | ||||
6 | | ||||
7 | *Since: 0.5.0* | ||||
8 | | ||||
9 | ``` | ||||
10 | QtPromise::resolve(T value) -> QPromise<R> | ||||
11 | ``` | ||||
12 | | ||||
13 | Similar to the [`QPromise<T>::resolve`](../qpromise/resolve.md) static method, creates a promise resolved from a given `value` but without the extra typing: | ||||
14 | | ||||
15 | ```cpp | ||||
16 | auto promise = QtPromise::resolve(); // QPromise<void> | ||||
17 | auto promise = QtPromise::resolve(42); // QPromise<int> | ||||
18 | auto promise = QtPromise::resolve(QString("foo")); // QPromise<QString> | ||||
19 | ``` | ||||
20 | | ||||
21 | This method also allows to convert `QFuture<T>` to `QPromise<T>`, delayed until the `QFuture` is finished ([read more](../qtconcurrent.md#convert)). |