سؤال

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