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 ?
Just for the record, as user @Lol4t0 didn't do it:
std::vector<unsigned char> c(bytes.constData(), bytes.constData() + bytes.size());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With