-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
5.6.0
-
None
-
Qt 5.6 on iOS 9.2, Windows 8 and Android
When doing a network request with Qt 5.6 and networking is disabled in the device (eg. I turned off WiFi) the network cache is not queried and requests always fail. If network is enabled, requests query the cache as normal.
class NetworkAccessManagerFactory: public QQmlNetworkAccessManagerFactory
{
public:
QNetworkAccessManager *create(QObject *parent)
{
QNetworkAccessManager *manager = new QNetworkAccessManager(parent);
QNetworkDiskCache *diskCache = new QNetworkDiskCache(manager);
diskCache->setCacheDirectory(QStandardPaths::standardLocations(QStandardPaths::CacheLocation).value(0));
diskCache->setMaximumCacheSize(150 * 1024 * 1024); // 150 MiB
manager->setCache(diskCache);
return manager;
}
};
It seems the following line in qnetworkaccessmanager.cpp:1169 is responsible:
if (d->networkAccessible == NotAccessible && !isLocalFile) {
return new QDisabledNetworkReply(this, req, op);
}
I get the Network access is disabled error message for all requests, both C++ and loading eg. an Image in QML.
This used to work in Qt 5.5.