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

时间:2013-12-01 07:43:59

标签: c++ qt

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

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

但我不知道如何将QbyteArray转换为std::vector<unsigned char>

有什么建议吗?

1 个答案:

答案 0 :(得分:2)

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

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