[Interest] How to use QNetworkDiskCache for QML ?

Gianluca gmaxera at gmail.com
Wed Oct 14 21:32:28 CEST 2015


Hello,
I would like to add some sort of caching to avoid to download every time Image with a remote URL.
Looking into documentation, I ended into QQmlNetworkAccessManagerFactory and QNetworkDiskCache.
So, I thought it would be easy … just create a QQmlNetworkAccessManagerFactory and implement the create method returning a QNetworkAccessManager with a QNetworkDiskCache configured as I want … but I noticed two comment into the documentation that creates my a lot of doubt about my idea:

The QQmlNetworkAccessManagerFactory::create says:
"This method must return a new QNetworkAccessManager instance each time it is called.”

And the QNetworkDiskCache says:
"Currently you cannot share the same cache files with more than one disk cache.”

So … this means my idea won’t works. Because I cannot return more instances of QNetworkAccessManager that use QNetworkDiskCache pointing to the same directory. :-(

Or can I share the same QNetworkDiskCache across all QNetworkAccessManager until it exists only one QNetworkDiskCache ?? Am I allowed to do it ?

Thanks,
Gianluca.




More information about the Interest mailing list