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

I wanted to convert QPixmap to std :: vector. So far I am doing the following

     QPixmap pixmap;
     QByteArray bytes;
     QBuffer buffer(&bytes);
     buffer.open(QIODevice::WriteOnly);
     pixmap.save(&buffer, "JPG");

However, I do not know how to convert QbyteArraytostd::vector<unsigned char>

any suggestions?

+4
source share
1 answer

Just for the record, as user @ Lol4t0 did not:

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

All Articles