Well, I think I found the basis of the problem, but I don't know how I could solve it.

The item is the blue line, it's a QGraphicsPixmapItem.



This is the rotated item (45º). The angle is kept into its member variable m_iAngle.



But, when the next code is executed:
Qt Code:
  1. //Set the item to angle zero in order to write its true position to the Xml file. Later, rotate it again.
  2.  
  3. float xx= myItem->pixmap().width() / 2;
  4. float yy = myItem->pixmap().height() / 2;
  5. myItem->setTransform(QTransform().translate(-xx, -yy).rotate(0).translate(xx, yy));
  6.  
  7.  
  8.  
  9. xmlWriter.writeStartElement("x");
  10. xmlWriter.writeCharacters(QString::number(myItem->scenePos().x()));
  11. xmlWriter.writeEndElement();
  12. xmlWriter.writeStartElement("y");
  13. xmlWriter.writeCharacters(QString::number(myItem->scenePos().y()));
  14. xmlWriter.writeEndElement();
  15.  
  16. myItem->setTransform(QTransform().translate(-xx, -yy).rotate(myItem->getAngle()).translate(xx, yy));
To copy to clipboard, switch view to plain text mode 


But my item now appears:


Maybe I should stop using its width and height... but it worked well so far :S

Do you know what should I use instead? or should I renounce to rotate from its center?