Unsolved QTimer timeout signal emit
-
Hi,
Connected signal finished of QNetworkReply for slot workedone,
and also same time one QTimer started and its timeout signal connected to slot UploadTimeOut.
In workedone slot i have stopped QTimer.
But sometime QNetworkReply finished signal emited at same time of QTimer timeout signal emited. So both signal emited.
I want to emit only one signal.
How can i do to stop to emit QTimer signal if QNetworkReply finished signal emited? -
Depends.
If you did a QTimer::SingleShot then you are out of luck.
If you created the timer and have a pointer to it then just call stop(). -
@Pavi said in QTimer timeout signal emit:
So both signal emited.
This is an edge case where whatever you are uploading finished along when the UploadTimeout timer fires off, so I'd say forget about the timeout signal since you were indeed able to upload the content (finished signal also received).
On the other hand, why do you need an upload timeout timer? are you indeed checking for network operation timeouts? If so, you may want to use QNetworkReply's error() signal instead, and check for a variety of network errors, QNetworkReply::TimeoutError among them.
Please be aware that QNetworkReply has a uplaodProgress() signal that you may want to use to monitor the advance of your upload operation.