Will this thread be useful to you ??
Will this thread be useful to you ??
I m usng the following to create image from the uchar *......
bool QImage::loadFromData ( const uchar * data, int len, const char * format = 0 )
When i check this return vaue it is coming out to be true and when I m checking that....
if(image.isNull()) then it is returning false that is it is creating image but when i m setting that image in the pixmap using..
image=image.scaled(100,100); QPixmap pixmap;
pixmap.fromImage(image,Qt::AutoColor);
and showing that in the QListWidget it is not showing the image I m using the following code
listWidget->setViewMode(QListView::IconMode);
QListWidgetItem *LWidgetItem=new QListWidgetItem(pixmap,"HI",listWidget,0);
But it is showing the text HI not the image.
If any body knows why then plz help me again.
Thanks.
QPixmap::fromImage() is a static method returning the pixmap:
Hi,
Are you sure that you are not destructing the memory data buffer?
In the QImage contructor you can read this:
"The buffer must remain valid throughout the life of the QImage. The image does not delete the buffer at destruction."
So, I think that you have to mantain the data buffer into memory. Try to execute "bool bOK = image.isNull();" just after "loadFromData" call.
Òscar Llarch i Galán
Thanks to all of you.
Now I m able to do that.
Bookmarks