Here's my implementation of mousePressEvent:

Qt Code:
  1. void Node::mousePressEvent(QGraphicsSceneMouseEvent *event)
  2. {
  3. if(event->button()==Qt::RightButton){
  4. Owner owner(id);
  5. owner.exec();
  6. }
  7.  
  8. if(event->button()==Qt::LeftButton){
  9. if(color == Qt::blue) color = Qt::red;
  10. else color = Qt::blue;
  11. }
  12. }
To copy to clipboard, switch view to plain text mode 

Owner inherits QInputDialog and Node inherits QGraphicsItem.

The problem is that when I click on the first item, everything is just fine. The item that was hit changes color and I make some input.
But when I click on any other item it doesn't change color. The first one does instead.

What could cause the trouble?