문제

I have a QGraphicsScene. I have a video running on the scene. On top of video I add a zooming window which is a QGraphicsItem. I drag and drop this window using drag events of QGraphicsScene. This works fine. I have to show the scene co ordinates everytime the mouse moves. For this I use a QGraphicsTextItem in MouseMoveEvent of graphics scene. The problem is when I write the MouseMoveEvent the drag and drop events stop responding.

Why does this happen?

Thank You

도움이 되었습니까?

해결책

You likely forgot to call the base class's method:

void MyScene::mouseMoveEvent(QGraphicsSceneMouseEvent * ev) {
  QGraphicsScene::mouseMoveEvent(ev);
  // do your own processing
}

Another possible factor is your coordinate item being in the way of the drop - you could simply move it down a pixel or two so that it's below the mouse pointer's hot spot.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top