i has the following problem:
I have a Foo class that encapsulates web-api. The interface has the following functions:
Foo :: addItem (QString id)
Foo :: updateItem (QString id)
both functions initiate a QNetworkRequest with the same URL, but the data usage is different. Therefore, I need to know in the slot function Foo :: replyFinished (QNetworkReply * wf_reply) where QNetworkRequest came from.
How would you solve this?
I could use a variable to save the QNetworkRequest address, to compare it later with wf_reply-> request (), but it seems hacked to me. Given that you can call addItem () or updateItem () a hundred times before replyFinished () is executed for the first time. A better way would be to add sting or integer to a QNetworkRequest that contains the function name or identifier.
source
share