If you want Qt to decode and/or encode it, the format should be on this list.
If you just need the data from an image file, QFile::readAll() should be enough. If you want to encode the image in memory, you need the following:
writer.write(image);
QBuffer buffer;
QImageWriter writer(&buffer, "PNG");
writer.write(image);
QByteArray data = buffer.data();
To copy to clipboard, switch view to plain text mode
To decode:
QByteArray array = variant.toByteArray();
QBuffer buffer(&array);
QImageReader reader(&buffer, "PNG");
QImage image = reader.read();
To copy to clipboard, switch view to plain text mode
I'm assuming you know how to insert the QByteArray into the database and get it out, but If you any clarification, just ask.
Bookmarks