[Qt-qml] Setting default behaviour to QNetworkRequest::PreferCache

Juha Turunen turunen at iki.fi
Fri Jul 15 09:55:53 CEST 2011


Hi,

> The default behaviour of qml when using Image { source: "http:// " ...}
> seems to be QNetworkRequest::PreferNetwork . I dont want thus behaviour,
> is there some way I can change this to QNetworkRequest::PreferCache, so
> that it applies to all qml http requests

- Inherit from QNetworkAccessManager and reimplement createRequest so
that it modifies the QNetworkRequest parameter's cache attribute to
the value you want and then calls the original implementation.
- Implement your own QDeclarativeNetworkAccessManagerFactory that
instantiates your QNetworkAccessManager inherited class and tell the
declarative engine to use it
(QDeclarativeEngine::setNetworkAccessManagerFactory)

Juha


More information about the Qt-qml mailing list