youre right:

i had change it to:

customItem.cpp
here ist the member variable for the center: mCenter for the ellipse
Qt Code:
  1. void customItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
  2. {
  3. QRectF ellipse = boundingRect();
  4.  
  5. mCenter = ellipse.center();
  6.  
  7. qDebug() << "mCenter: " << mCenter;
  8.  
  9. if(Pressed)
  10. {
  11. QPen pen(Qt::red, 3);
  12. painter->setPen(pen);
  13. painter->drawEllipse(ellipse);
  14. }
  15. else
  16. {
  17. QPen pen(Qt::black, 3);
  18. painter->setPen(pen);
  19. painter->drawEllipse(ellipse);
  20. }
  21. }
  22.  
  23.  
  24. void customItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
  25. {
  26. Pressed = false;
  27.  
  28.  
  29.  
  30. if(startOrEnd == false)
  31. {
  32. line->line().setP1(mCenter);
  33. }
  34.  
  35.  
  36. if(startOrEnd == true)
  37. {
  38. line->line().setP2(mCenter);
  39. }
  40.  
  41.  
  42. update();
  43. QGraphicsItem::mouseReleaseEvent(event);
  44. }
To copy to clipboard, switch view to plain text mode 

but the line do not move