> Hi All
> 
> My app is some kind of special flickr viewer and is nearly fully done in QML. 
> I want to let user to be able to save some Images to the device. Right now I 
> am passing the Image's URL to the C++ side and download the image using 
> QNetworkManager.
> 
> That, however, means that in almost all cases C++ side is going to download 
> the very same file already downloaded on QML side (by setting Image.source 
> property).
> 
> Is there a way to avoid double download and pass the Image's data to C++ side 
> to further saving as JPG or PNG (JPG is the original format if it matters).
> 
> Best regards,
> Artem.
> 

Hi,
You can use QNetworkDiskCache in C++ side:

 QNetworkAccessManager *manager = new QNetworkAccessManager(this);
 QNetworkDiskCache *diskCache = new QNetworkDiskCache(this);
 diskCache->setCacheDirectory("cacheDir");
 manager->setCache(diskCache);

 // do a request preferred from cache
 QNetworkRequest request(QUrl(QString("http://qt.nokia.com";)));
 request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, 
QNetworkRequest::PreferCache);
 manager->get(request);


-Niko

_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to