Que?Ok my question is really just how to read/get the return value if the function is ran by connect(),
I only know how to get it using data = emit signal() but I can't emit finished() cause it's not mine.
From the trusty documentation we get the unequivocal:
Frankly, you seem very confused. If you want to know that a network request has finished then you have no choice but to listen for the finished() signal from the QNetworkReply or QNetworkAccessManager. If you busy-wait on the request like you suggest then your application will not function: the request will not be sent until a Qt event loop is running again. You can use QEventLoop (connect reply->finished() to loop exit()) to block and maintain some responsiveness but a blocking design is really not the Qt way.Signals are automatically generated by the moc and must not be implemented in the .cpp file. They can never have return types (i.e. use void).
When the request is successful then the data from the response can be read from the QNetworkReply. What you do with it then has nothing to do with the QNetworkReply signal/slot connection. You can choose to expose that data through an interface on your class, or send it on to another QObject(s) by emitting a signal of your own which can, as anda_skoa pointed out, happily carry a QByteArray payload.




Reply With Quote
Bookmarks