Qt: save QPixmap to std::vector<unsigned char> - or convert QByteArray to std::vector<unsigned char>

c++, qt

Solution

Just for the record, as user @Lol4t0 didn't do it:

 std::vector<unsigned char> c(bytes.constData(), bytes.constData() + bytes.size());

Problem

I wanted to convert a QPixmap to std::vector . For now I am doing the following ``` QPixmap pixmap; QByteArray bytes; QBuffer buffer(&bytes); buffer.open(QIODevice::WriteOnly); pixmap.save(&buffer, "JPG"); ``` However I donot know how to convert `QbyteArray` to `std::vector<unsigned char>` any suggestions ?

Original source