How to get a picture from QString in Qt
-
I don't see how it will help to write QByteArray to json. Again, I can write Qstring to json. It remains only to learn how to safely translate from Qstring to QByteArray .
@mikeeeeee do you actually want a qbytearray as a value to a key inside your son file ?
-
So it turns QString into a picture to translate
QString AppCore::getImage(QString addressFile) { QImage myImage(addressFile); QByteArray bArray; QBuffer buffer(&bArray); buffer.open(QIODevice::WriteOnly); myImage.save(&buffer, "JPEG"); QString image("data:image/jpg;base64,"); image.append(QString::fromLatin1(bArray.toBase64().data())); QImage testImage(image); qDebug()<<"myImage.size() : "<<myImage.size(); return image; }