[Qt-qml] Can you access the Image element's cached QImage/QPixmap from C++ code?

Jason H scorp1us at yahoo.com
Thu Jan 13 22:34:12 CET 2011


I'm not sure what you mean. If there is a QImage, then it has an image, and you 
can call QImage::save(). The cache itself is maintained by QNetworkAccessManager 
and QNetworkDiskCache. If it is cached, then you could ask for it by URL and 
would get the cached version. If not, then it has to go get it again anyway...

I'm not sure I understood you though.





________________________________
From: T C <teeceeare97 at gmail.com>
To: qt-qml at qt.nokia.com
Sent: Thu, January 13, 2011 3:23:13 PM
Subject: [Qt-qml] Can you access the Image element's cached QImage/QPixmap from 
C++ code?

Say your QML gui has a section with an Image element whose source points to some 
internet image (http://somwhere/myphoto.jpg for example).  When the Image item 
is instantiated the default image provider retrieves it (in the background 
maybe) and then it is painted when ready.  The QImage is then cached somewhere 
by the image provider using the source url as the key.  Later on I would like my 
C++ code to be able to save this image to permanent storage, if the user chooses 
to do so.  Is there a way to do this by directly accessing the cached QImage?

I understand that I can write a custom image provider and plug that in to the 
QML app context, but I really don't want to redo all the stuff that loads remote 
images in background threads if I don't have to.   Is there an easier way?


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110113/3ae009d1/attachment.html 


More information about the Qt-qml mailing list