[SOLVED]How to add an icon(image) to QImage and update the image
General and Desktop
4
Posts
2
Posters
3.6k
Views
1
Watching
-
Think that; I have a button, it creates a QImage and display it in a QLabel.
@QRgb value;
myImage = new QImage(col, row, QImage::Format_RGB32);for( int i = 0; i < row; i++ )
{
for( int j = 0; j < col; j++ )
{
value = qRgb(myData[i][j].intensity *.3,myData[i][j].intensity *.59,myData[i][j].intensity *.11);
myImage->setPixel(j,i,value);
}
}
imageLabel->setPixmap(QPixmap::fromImage(*myImage));
@
Now I add another button and it must add an icon to the QImage and update the displayed image.
@ QPixmap p("abc.png");
QPixmap pixmap = QPixmap::fromImage(*myImage);
QPainter painter(&pixmap);
painter.drawPixmap(100,100, p);
@
I did like this, the program executes the code but does not display the icon.
How can I fix it?