Qt 6.11 is out! See what's new in the release
blog
Qt gRPC - get return value of a call asyncronously
-
Hello all,
I have an RPC call (StartStream) defined here:
https://github.com/saleae/logic2-automation/blob/develop/proto/saleae/grpc/saleae.proto#L36it returns a StartCaptureReply.
The qtgrpcgen tool generates the following API:
QGrpcStatus StartCapture(const saleae::automation::StartCaptureRequest &arg, saleae::automation::StartCaptureReply *ret); std::shared_ptr<QGrpcCallReply> StartCapture(const saleae::automation::StartCaptureRequest &arg); Q_INVOKABLE void StartCapture(const saleae::automation::StartCaptureRequest &arg, const QObject *context, const std::function<void(std::shared_ptr<QGrpcCallReply>)> &callback);I use the following code to call the StartCapture:
auto reply = m_client->StartCapture(req); reply->subscribe(this, [this]() { finishExecution(true); }, [this](const QGrpcStatus &status) { grpcErrorOccurred(status); });Is there any way to get access to the StartCaptureReply in the slot attached to the QGrpcCallReply::finished signal (attached by the subscribe)?
-
Hi,
Since the callback is a lambda, why don't you pass the reply to it the same way you do for
this?