[Qt-interest] qtconcurrent::run() virtual member methods?
Liam Staskawicz
lstask at gmail.com
Tue Jun 9 23:46:15 CEST 2009
Hi - I was taking the opportunity of adding timeout functionality to the
QNetworkAccessManager api to experiment with QtConcurrent a bit. Since
there doesn't seem to be a built-in way to specify a timeout per request, I
thought I'd run each request in a thread via QtConcurrent and call
waitForReadyRead with my appropriate timeout value. Code looks roughly
like:
QNetworkReply* reply = netAccess.get(QNetworkRequest(url));
QFuture<bool> future = QtConcurrent::run( reply,
&QNetworkReply::waitForReadyRead, REQUEST_TIMEOUT );
but I'm getting the following compile error:
error: no matching function for call to 'run(QNetworkReply*&, bool
(QIODevice::*)(int), int)'
just for fun, I tried passing a method defined explicitly by QNetworkReply -
::manager() - and that seemed to compile happily. Any chance this has
something to do with the fact that waitForReadyRead is provided by
QIODevice? The doc for QtConcurrent::run() is mostly based on a few
examples so I wasn't able to glean too much more from it.
Secondarily, any other better timeout strategies for QNetworkAccessManager
would also be welcome!
Thanks,
Liam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090609/8ca41d7f/attachment.html
More information about the Qt-interest-old
mailing list