Qt:将QPixmap保存到std :: vector <unsigned char> - 或将QByteArray转换为std :: vector <unsigned char>

Mis*_*tyD 5 c++ qt

我想将QPixmap转换为std :: vector.现在我正在做以下事情

     QPixmap pixmap;
     QByteArray bytes;
     QBuffer buffer(&bytes);
     buffer.open(QIODevice::WriteOnly);
     pixmap.save(&buffer, "JPG");
Run Code Online (Sandbox Code Playgroud)

但是我不知道如何转换QbyteArraystd::vector<unsigned char>

有什么建议 ?

kik*_*que 2

仅供记录,因为用户 @Lol4t0 没有这样做:

 std::vector<unsigned char> c(bytes.constData(), bytes.constData() + bytes.size());
Run Code Online (Sandbox Code Playgroud)