here is the code i ended up with:
uint iWidth = 640;
uint iHeight = 480;
uint iSize = iWidth * iHeight;
uchar *imgData = new uchar[iSize*4];
uint j=0;
for(uint i=0; i<iSize; i++)
{
imgData[j] = 255; // R
imgData[j+1] = 128; // G
imgData[j+2] = 128; // B
imgData[j+3] = 255; // A
j += 4;
}
for (unsigned int y = 0; y < iHeight; y++)
{
for(unsigned int x = 0; x < iWidth; x++)
{
int s = y*iWidth + x*4;
QColor color
(imgData
[s
], imgData
[s
+1], imgData
[s
+2], imgData
[s
+3]);
image.setPixel(x, y, color.rgba());
}
}
*m_pm = m_pm->fromImage(image);
uint iWidth = 640;
uint iHeight = 480;
uint iSize = iWidth * iHeight;
uchar *imgData = new uchar[iSize*4];
uint j=0;
for(uint i=0; i<iSize; i++)
{
imgData[j] = 255; // R
imgData[j+1] = 128; // G
imgData[j+2] = 128; // B
imgData[j+3] = 255; // A
j += 4;
}
QImage image(iWidth, iHeight, QImage::Format_ARGB32);
for (unsigned int y = 0; y < iHeight; y++)
{
for(unsigned int x = 0; x < iWidth; x++)
{
int s = y*iWidth + x*4;
QColor color(imgData[s], imgData[s+1], imgData[s+2], imgData[s+3]);
image.setPixel(x, y, color.rgba());
}
}
m_pm = new QPixmap();
*m_pm = m_pm->fromImage(image);
To copy to clipboard, switch view to plain text mode
It works as expected. I'm not sure though if everything is done correctly. Please comment on the above code 
thanks
Bookmarks