If your design allows, rather than objects inheriting from QGraphicsItem, inherit from QGraphicsObject, which will allow you to use the standard QObject::installEventFilter.
Otherwise, you would need to have class 'X' inherit from QGraphicsItem.
Then, you can install an event filter from one GraphicsItem to another through the QGraphicsScene. This is detailed in the Qt Documentation here.
To filter another item's events, install this item as an event filter for the other item.
Example:
QGraphicsScene scene;
QGraphicsEllipseItem *ellipse = scene.addEllipse(QRectF(-10, -10, 20, 20));
QGraphicsLineItem *line = scene.addLine(QLineF(-10, -10, 20, 20));
line->installSceneEventFilter(ellipse);
// line's events are filtered by ellipse's sceneEventFilter() function.
ellipse->installSceneEventFilter(line);
// ellipse's events are filtered by line's sceneEventFilter() function.