There's definitely a QImage somewhere, I just don't have direct access to it. I'm just asking if I have to write the networking code to fetch the image again, or if I can reach into the cache somehow and get it directly. In this case it's always going to be a cache hit, as the image was originally loaded by a QML Image item.
On Thu, Jan 13, 2011 at 4:34 PM, Jason H <[email protected]> wrote: > > 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 <[email protected]> > To: [email protected] > 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? > > > _______________________________________________ Qt-qml mailing list [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt-qml
