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.