Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using


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 ?

share|improve this question
up vote 0 down vote accepted

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.

share|improve this answer
Many Thanks jef, that worked ;) – QgisTn Jun 19 '12 at 7:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.