to add a QGraphicsTextItem to the map canvas. The problem is that when I use the pan tool to move the display the added QGraphicsTextItem is not moving !
How can I make it update its position whenever the pan tool is used on the map ?
You need to align the position of the item to the new canvas extent. Either connect to the QgsMapCanvas::extentsChanged() signal and update the
QGraphicsTextItem from there. Or derive a class from QgsMapCanvasItem and implement a
paint method that takes the current map canvas extent into account (QgsMapCanvasItem has some methods in that direction).
QgsTextAnnotationItem might also fit your needs or at least be an example how to implement your class.