QSignalMapper and QHash can help.
QSignalMapper and QHash can help.
Alir3z4 (20th February 2012)
Yes, first thing came to my head was using QHash, QSignalMapper, but what should i keep in the QHash?
pointer or reference?
pointer like this?
if pointers, what happen when i add new download and re-initialize *reply*, *file, or something like that? // or maybe i shouldn't use *reply*, *file and just make pointers add them to hash on the fly?Qt Code:
To copy to clipboard, switch view to plain text mode
or i have to keep ref in it?
Last edited by Alir3z4; 20th February 2012 at 16:26.
...یه مرد هیچوقت زمین نمیخوره
Pointers and file/replay aren't getting overwritten since you store it in the hash. Use QHash<QNetworkReply*, QFile*>. Just make sure you delete the pointers after the downloads are finished.
Alir3z4 (20th February 2012)
You can also not store the reply pointer at all and use the QNetworkAccessManager::finished() signal, which passes the QNetworkReply object that finished. This is really only suitable for smaller files where the entire content is easily stored in memory and progress indication is not important.
Bookmarks