I think the only (real) way to do this is to recalculate the position for your text element in each frame. To do this, simply subclass QGraphicsView, override paintEvent and use QGraphicsView :: mapToScene () to calculate the new position. Something like:
void MyGraphicsView::paintEvent(QPaintEvent*) { QPointF scenePos = mapToScene(0,0);
I have done this many times and it worked very well.
Of course, you could just create a normal QLabel, as Arnold Spence mentions in his answer. However, this will not work in many situations (for example, if you really want to place the label on top of the graphical representation and you use the OpenGL-accelerated viewport).
user544511
source share