Hello

I wonder if you can assist. I'm running Qt Creator 2.7.0 based on Qt 5.0.2 using a Windows 7 Enterprise Intel Core 2 Duo E7200.

I'm a complete Newbie so please forgive my somewhat trivial query.

My aim is to superpose two .jpg images into a QPixmap.

However, I have followed others' suggestions (on this board) for an identical problem, and using their suggestions, I have tried the following code:




Qt Code:
  1. //....................................................................................................................................
  2.  
  3. // LOAD IMAGE
  4. if (!fileName.isEmpty()) {
  5. QImage image(fileName);
  6. if (image.isNull()) {
  7. QMessageBox::information(this, tr("Mammogram Viewer"),
  8. tr("Cannot load %1.").arg(fileName));
  9. return;
  10. }
  11.  
  12. //....................................................................................................................................
  13. QImage BottomMammogram(fileName);
  14. BottomMammogram= BottomMammogram.convertToFormat(QImage::Format_ARGB32);
  15. image.fill(qRgba(0,0,0,0));
  16.  
  17. QImage TopMammogram("C:/TopMammogram");
  18. TopMammogram= TopMammogram.convertToFormat(QImage::Format_ARGB32);
  19. image.fill(qRgba(0,0,0,0));
  20.  
  21. painter1 = new QPainter;
  22. img = new QPixmap(500, 500);
  23.  
  24. painter1->begin(img);
  25. painter1->fillRect(img->rect(), Qt::transparent);
  26. painter1->drawImage(0, 0, BottomMammogram); // puts BottomMammogram image into img
  27. painter1->drawImage(50, 50, TopMammogram); // puts TopMammogram image into img
  28. painter1->end();
  29.  
  30. imageLabel->setPixmap(*img);
  31. imageLabel->show();
To copy to clipboard, switch view to plain text mode 



I have had no success with the above code, since the top Picture is completely opaque.

Any help would be gratefully appreciated.

Thank you in advance.


NotQuiteFeynman