Hi all,

I have three images of QImage type, all the three images to be placed one on top of each and transparency should be enabled to see all the images. (I am using QLabel to place my image)

Out of three two will be a static images i.e it remains as constant image.

The third image which is the top of all will be changed at a certain rate. so i need to update the third one at some milliseconds period.

How do i enable transparency of all images and update only the top image. That is only in timer update i need to update or paint the top one and the other images will be there as constant

I tried composition modes, overlay gives transparency but the update of the static image is not perfect as it skips some updates while painting.

Qt Code:
  1. /**********Creating a image and all the images to be drawn into it********************/
  2.  
  3. QImage resultImage;
  4. resultImage = QImage(resultSize,QImage::Format_ARGB32_Premultiplied);
  5. QPainter painter(&resultImage);
  6.  
  7. /*************************Top Image ****************************************************/
  8.  
  9. QImage image_Radar(get_bmap,512,512,QImage::Format_ARGB32_Premultiplied);
  10. painter.drawImage(162,68,image_Radar);
  11.  
  12. painter.setCompositionMode(QPainter::CompositionMode_Overlay);
  13.  
  14. /************************Middle Image **************************************/
  15. painter.setPen(QPen(Qt::yellow,3,Qt::SolidLine));
  16. painter.drawEllipse(646,538,90,90);
  17. painter.setPen(QPen(Qt::magenta,3,Qt::SolidLine));
  18. painter.drawEllipse(586,478,210,210);
  19. painter.setPen(QPen(Qt::darkGray,3,Qt::SolidLine));
  20. painter.drawEllipse(526,418,340,340);
  21. painter.setPen(QPen(Qt::green,3,Qt::SolidLine));
  22. painter.drawEllipse(466,358,460,460);
  23. painter.setPen(QPen(Qt::blue,3,Qt::SolidLine));
  24. painter.drawEllipse(406, 298,580,580);
  25. painter.setPen(QPen(Qt::cyan,3,Qt::SolidLine));
  26. painter.drawEllipse(346,238,700,700);
  27. painter.setPen(QPen(Qt::lightGray,3,Qt::SolidLine));
  28. painter.drawEllipse(286,178,820,820);
  29. painter.setPen(QPen(Qt::darkRed,3,Qt::SolidLine));
  30. painter.drawEllipse(226,118,940,940);
  31. painter.setPen(QPen(Qt::green,3,Qt::SolidLine));
  32. painter.drawEllipse(166,58,1060,1060);
  33. painter.setPen(QPen(Qt::red,3,Qt::SolidLine));
  34. painter.drawEllipse(106,-2,1180,1180);
  35.  
  36.  
  37. /**********************Bottom Image **********************************/
  38. QImage image_src;
  39. image_src.load("/aegean-60km.bmp");
  40. painter.drawImage(0, 0, image_src);
  41. /******************************************************************/
  42. painter.end();
  43.  
  44. label->setBackgroundRole(QPalette::Base);
  45. label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
  46. label->setPixmap(QPixmap::fromImage(resultImage));
  47. label->setScaledContents(true); */
To copy to clipboard, switch view to plain text mode