mirror of
https://github.com/simonbrunel/qtpromise.git
synced 2024-10-30 15:57:39 +08:00
1f30224578
Introduce a new `QtPromise::connect()` helper that allows to create a promise resolved from a single signal and optionally, rejected by another one (from a different object or not). The promise type is determined by the type of the first signal argument (other arguments are currently ignored). A `QPromise<void>` is returned if the resolve signal doesn't provide any argument. If the rejection is emitted before the promise is resolved, the promise will be rejected with the value of the first argument (other arguments being ignored). If the rejection signal doesn't provide any argument, the promise will be rejected with `QPromiseUndefinedException` if the signal is emitted. Additionally, the promise will be automatically rejected with `QPromiseContextException` if the source object is destroyed before the promise is resolved.
22 lines
1.3 KiB
Markdown
22 lines
1.3 KiB
Markdown
<a href="https://promisesaplus.com/" title="Promises/A+ 1.1"><img src="https://promisesaplus.com/assets/logo-small.png" alt="Promises/A+" align="right"/></a>
|
|
|
|
# QtPromise
|
|
|
|
[![qpm](https://img.shields.io/github/release/simonbrunel/qtpromise.svg?style=flat-square&label=qpm&colorB=4CAF50)](https://www.qpm.io/packages/com.github.simonbrunel.qtpromise/index.html) [![Travis](https://img.shields.io/travis/simonbrunel/qtpromise/master.svg?style=flat-square)](https://travis-ci.org/simonbrunel/qtpromise) [![coverage](https://img.shields.io/codecov/c/github/simonbrunel/qtpromise.svg?style=flat-square)](https://codecov.io/gh/simonbrunel/qtpromise)
|
|
|
|
[Promises/A+](https://promisesaplus.com/) implementation for [Qt/C++](https://www.qt.io/).
|
|
|
|
Requires [Qt 5.6](https://www.qt.io/download/) (or later) with [C++11 support enabled](https://wiki.qt.io/How_to_use_C++11_in_your_Qt_Projects).
|
|
|
|
## Documentation
|
|
|
|
* [Getting Started](https://qtpromise.netlify.com/qtpromise/getting-started.html)
|
|
* [Qt Concurrent](https://qtpromise.netlify.com/qtpromise/qtconcurrent.html)
|
|
* [Qt Signals](https://qtpromise.netlify.com/qtpromise/qtsignals.html)
|
|
* [Thread-Safety](https://qtpromise.netlify.com/qtpromise/thread-safety.html)
|
|
* [API Reference](https://qtpromise.netlify.com/qtpromise/api-reference.html)
|
|
|
|
## License
|
|
|
|
QtPromise is available under the [MIT license](LICENSE).
|