14 return promise.
future().result();
22 [callback = std::move(callback),
weakRef =
weakRef()](
const QFuture<CVariant> &reply) {
23 const auto lock =
weakRef.lock();
24 if (lock) { callback(reply.result()); }
A promise-based interface to QFuture, similar to std::promise for std::future.
QFuture< T > future()
Return a future that can be used to access the result.
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
QWeakPointer< const CActiveObserver > weakRef() const
Get a QWeakPointer pointing to this object.
void requestAsync(const CVariant ¶m, std::function< void(const CVariant &)> callback)
Send a request and receive an asynchronous reply. The callback will not be called if the reply is rec...
void requestPosted(const swift::misc::CVariant ¶m, swift::misc::CPromise< swift::misc::CVariant > o_reply)
Emitted by request and requestAsync.
CVariant request(const CVariant ¶m)
Send a request and receive a synchronous reply.
Utilities for sharing state between multiple objects.
void doAfter(QFuture< T > future, QObject *context, F &&func)
Connect a slot or function to be invoked in the given context when a QFuture is finished.