Hello , I have a problem, that QGraphicsItem doesn't update, when I'm calling update(). This is what I'm doing:
CircleItem.cpp
Qt Code:
  1. void CircleItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
  2. {
  3. RectItem->SetBackGround();
  4. QGraphicsItem::mouseMoveEvent( event );
  5. }
To copy to clipboard, switch view to plain text mode 

RoundRectItem.cpp
Qt Code:
  1. void RoundRectItem::SetBackGround()
  2. {
  3. ChangeBackground = true;
  4. update();
  5. }
  6.  
  7. void RoundRectItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
  8. {
  9. QRectF rec = QRectF( QPoint( 0,0 ), boundingRect().size() / 2 );
  10.  
  11. roundRect = QRectF(rec.adjusted(-rec.height() / 2, 0, rec.height()/2, 0));
  12.  
  13. roundRect.moveTo( boundingRect().center().x() - roundRect.width() / 2,
  14. boundingRect().center().y() - roundRect.height() / 2 );
  15.  
  16. if( !ChangeBackground )
  17. painter->setBrush( backBrush );
  18. else
  19. painter->setBrush( QBrush( Qt::blue ) );
  20.  
  21. painter->setPen( QColor( 255,255,255 ) );
  22.  
  23. painter->drawRoundedRect(roundRect, roundRect.height() / 2, roundRect.height() / 2 );
  24.  
  25. }
To copy to clipboard, switch view to plain text mode 
And after this, roundrect doesn't update its background.