2
votes

I use a QLabel to display a pseudo-video stream. Since I have extensive calculation to do on the pixels, I use the QImage bits() function and then convert it to a pixmap to show it on the QLabel. So far I was using:

for(...)
{
    computeImage(&myImage);
    myLabel->setPixmap(QPixmap::fromImage(myImage));
}

However, since QPixmap::fromImage(...) function always create a new QPixmap object, I tried the following who should be more efficient:

QPixmap myPixmap;
for(...)
{ 
    computeImage(&myImage);
    bool b = myPixmap.convertFromImage(myImage);
    myLabel->setPixmap(myPixmap);
}

It work fine for the first display but it doesn't refresh after that. The "b" variable is always true so the conversion worked well. I even tried to repaint() or update() the label, but it doesn't work. The label still display the very first image forever.

1
did you ever figure this out? I have the exact same problem...daaxix

1 Answers

1
votes

What is your frames per second (fps)? Can you try putting some intervals between images? I think update() is also needed.