Your entire question presupposes that there is some natural meaning to "I need to convert originalPixmap to std::vector<unsigned char>." You can convert an image into a list of bytes in a near-infinite number of ways. Most of these will not be a "string" in the human readable sense . What exactly are you expecting to see in your array of bytes?
A QVariant of type QVariant::Pixmap is not a QVariant of type QVariant::ByteArray and cannot be magically converted.
In your second example there is no string, so what do you mean by "returns null string"? Line 11 is probably failing because you have not specified the format in which to save() (and there is no file name from which to infer one) but you do not check the return value so we cannot say.
Bookmarks