I can send and get QPixmap
by QByteArray
:
QPixmap pixmap1;
QByteArray rawPixels;
QBuffer buffer(&rawPixels);
buffer.open(QIODevice::WriteOnly);
pixmap1.save(&buffer, "PNG");
QPixmap pixmap2;
pixmap2.loadFromData(rawPixels,"PNG");
but I have to use std::vector<unsigned char>
to send my pixmap:
std::vector<unsigned char> vector;
int size = rawPixels.size();
char* temp = (char*) rawPixels.constData();
vector.resize(size);
for(int index = 0; index < size; index++)
{
vector.push_back(temp[index]);
}
Is there an easy way to get a QPixmap
from a std::vector<unsigned char>
?