In qml, i am using xml file to get some information from server. In this xml file there is a field as < image>iVBORw0KGgoAAAANSUhEUgAAA2AAAALKCAYAAABUYjK........< /image>. I am using XmlListModel and ListView for other field but how can i convert this code to png image.
I didn't try myself, but if QML supports the data URI scheme (http://en.wikipedia.org/wiki/Data_URI_scheme), try
Image {
source: "data:image/png;base64," + model.imageData
}
I would implement a custom QDeclarativeImageProvider
, which creates an image from the encoded data.
Then you can do something like this in your delegate:
// ...
Image {
source: "image://encodedimage/" + model.imageData
}
// ...
Have a look at this example, it might be a starting point for your implementation.
If the image is base64 encoded, then you can create an image like that (not tested):
QByteArray ba = QByteArray::fromBase64(imageDataString.toAscii());
QImage image = QImage::fromData(ba, "PNG");