How to store a QPixmap in JSON, via QByteArray?
问题 I have a QByteArray , which I want to save in a JSON file using Qt and also be able to read from it again. Since JSON natively can't store raw data, I think the best way would probably be a string? The goal is to save a QPixmap this way: { "format" : "jpg", "data" : "...jibberish..." } How do I achieve this and how do I read from this JSON Object again (I am using Qt5)? What I have right now looks this way: QPixmap p; ... QByteArray ba; QBuffer buffer(&ba); buffer.open(QIODevice::WriteOnly);