I am creating a QPixMap from a QGraphicsScene. I then use the QPixMap in a QGraphicsPixMapItem in another QGraphicsScene. Here's the code used to create the QPixMap:

Qt Code:
  1. //
  2. // JSL - CreateQPixmap
  3. //
  4. QPixmap EDrawListView::createQPixmap()
  5. {
  6. unselectAll();
  7.  
  8. QRectF sourceRect = scene()->itemsBoundingRect();
  9. sourceRect.setX(sourceRect.x()-1);
  10. sourceRect.setY(sourceRect.y()-1);
  11. QRectF targetRect(0, 0, sourceRect.width()+2, sourceRect.height()+2);
  12. QPixmap thePixmap(sourceRect.width()+2, sourceRect.height()+2);
  13. thePixmap.fill(Qt::transparent);
  14. QPainter p(&thePixmap);
  15. scene()->render(&p, targetRect, sourceRect);
  16. p.end();
  17. return(thePixmap);
  18. }
To copy to clipboard, switch view to plain text mode 

The problem is that once the scene has been turned into a QPixMap, I still need to know where a certain item on that scene was in coordinates that relate to the QPixMap, not to the original Scene before the QPixmap was created. If I look at the pos value of the item as it was on the scene, it doesn't relate to the position of the image of the item on the QPixMap. (Because of the itemsBoundingRect code in the call above, I imagine.)
Now that I am writing this, I imagine that saving the itemsboundingRect might be the clue. If I save this rect, then I can use it to offset the pos of the item to find it's location on the QPixMap.

If anyone has any thoughts or suggestions, I would appreciate hearing them.

Thanks.