I have 1 main QGraphicsView, that has 2 QGraphicsView children. Each of the children has one custom QGraphicsTextItem.
When I double click on one of the QGraphicsTextItems (whatever the one I am clicking on), I can type letters and they appear properly in it.
When I then double click the other QGraphicsTextItem, the first one gets the double-click event and the letters.
If I restart my app and first click on the second QGraphicsTextItem, then the first one will never get focus.

How can I ensure that the one I am clicking on gets the events ?

That's the code in each of the QGraphicsView children:
Qt Code:
  1. myQGraphicsTextItemClass *oneTextNode
  2. oneTextNode=new myQGraphicsTextItemClass(newNodeId,nodeName,this->geometry().width());
  3. oneTextNode->setPos(10,30);
  4. scene()->addItem(oneTextNode);
To copy to clipboard, switch view to plain text mode 

And the double click event of the QGraphicsTextItem:
Qt Code:
  1. void myQGraphicsTextItemClass::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *evt)
  2. {
  3. setTextInteractionFlags(Qt::TextEditorInteraction);
  4. QGraphicsTextItem::mouseDoubleClickEvent(evt);
  5. }
To copy to clipboard, switch view to plain text mode 

and my class definition:
Qt Code:
  1. class myQGraphicsTextItemClass : public QGraphicsTextItem
  2. {
  3. Q_OBJECT
  4. public:
  5. myQGraphicsTextItemClass(int nb,QString text, int parentWidthReceived, QGraphicsItem *parent=0);
  6. virtual ~myQGraphicsTextItemClass() {};
  7. protected:
  8. void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *evt);
  9. };
To copy to clipboard, switch view to plain text mode 

Thanks !