c++ - Load pixmap from buffer in QT -
I currently have the following details about an image
int nBufSize; // buffer size in zero * lpBmpBuf; / / Pointer to the first byte of bitmap buffer
How do I get a QPixmap from it?
This is what I am doing so far
QByteArray b ((four *) lpBmpBuf, nBufSize); Bool t = pix.loadFromData (b, 0, Qt :: AutoColor);
However in this case T is wrong. Any suggestions?
Copy those bitmap buffers into a byte array, such as if you also have the length: < / P>
QPixmap :: loadFromData (and data, 0, QT :: autocar);
The data is QByteArray in my example.
In addition, if you know the extension / type of file, then you can:
loadFromData (and data, "BMP");
Comments
Post a Comment