Hi all,
I've a strange problem setting a QPixmap on a QLabel. I call a thread which sets the QPixmap on the QLabel. That's the code I'm using:

Qt Code:
  1. QPixmap *pxm = new QPixmap((QString("C:/image.jpg")));
  2. if(!pxm->isNull())
  3. {
  4. printf("Pixmap isn't null! %dx%d\n", this->width(), pxm->height());
  5. this->a->w->imageLabel->setImage(this->pxm);
  6. }
  7. else
  8. {
  9. printf("Pixmap is null!\n");
  10. }
To copy to clipboard, switch view to plain text mode 


If I put it in the run() function of the thread, it clears the image that the imageLabel was showing before (you see a gray background). If I put it in the costructor of the thread instead, it works. But in both it prints:
"Pixmap isn't null! 320x274
I set the image. 320x274 32 (183, 175, 172)"

Thats the method setImage of imageLabel:
Qt Code:
  1. void G2_ImageLabel::setImage(QPixmap *pxm)
  2. {
  3. QImage img = pxm->toImage();
  4. QRgb px = img.pixel(10, 10);
  5. printf("I set the image. %dx%d %d (%d, %d, %d)\n", pxm->width(), pxm->height(), pxm->depth(), qRed(px), qGreen(px), qBlue(px));
  6. this->setPixmap(*pxm);
  7. }
To copy to clipboard, switch view to plain text mode 

I don't know what I'm doing wrong. Please help me!

Thank you, Dario

(sorry for my english)