31 #include <QNetworkAccessManager>
32 #if QT_VERSION < 0x050000
33 #include <QDeclarativeEngine>
45 #
if QT_VERSION < 0x050000
46 QDeclarativeEngine *engine)
51 , CacheSizeGetter_ (getter)
54 engine->setNetworkAccessManagerFactory (
this);
59 auto nam =
new QNetworkAccessManager (parent);
62 cache->setMaximumCacheSize (CacheSizeGetter_ ());
63 nam->setCache (cache);
A thread-safe garbage-collected network disk cache.
StandardNAMFactory(const QString &subpath, CacheSizeGetter_f getter, QDeclarativeEngine *engine=nullptr)
Constructs a new StandardNAMFactory.
QNetworkAccessManager * create(QObject *parent)
Creates the network access manager with the given parent.
std::function< int()> CacheSizeGetter_f
The type of the function used to query the cache size by the factory.