diff --git a/widgets/glWidget/QtGLGraphicsScene.cc b/widgets/glWidget/QtGLGraphicsScene.cc index 359dd9fc3f64fdcf77eddf6470b39e4f117d0a7f..587ea7400f97ce46fecffca545d4acd218a09b6c 100644 --- a/widgets/glWidget/QtGLGraphicsScene.cc +++ b/widgets/glWidget/QtGLGraphicsScene.cc @@ -178,8 +178,6 @@ glViewer* QtGLGraphicsScene::findView (const QPointF &_p, bool _setActive) void QtGLGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent* _e) { - if (cursorPainter_) - cursorPainter_->updateCursorPosition (_e->scenePos ()); QGraphicsScene::mouseMoveEvent(_e); if (_e->isAccepted()) return; @@ -189,8 +187,6 @@ void QtGLGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent* _e) return; v->mouseMoveEvent(_e); - - update (); } //----------------------------------------------------------------------------- @@ -213,6 +209,13 @@ bool QtGLGraphicsScene::event(QEvent *_event) cursorPainter_->setMouseIn (false); update (); } + else if (cursorPainter_ && _event->type() == QEvent::GraphicsSceneMouseMove) + { + QGraphicsSceneMouseEvent *e = static_cast(_event); + cursorPainter_->updateCursorPosition (e->scenePos ()); + update (); + } + return QGraphicsScene::event (_event); } diff --git a/widgets/glWidget/simpleGLGraphicsScene.cc b/widgets/glWidget/simpleGLGraphicsScene.cc index 3508d47a49aa3d67741b5f08a4abc81aa5ce03f8..99157264cdaf0efdf7601f0e2081f8f856d94952 100644 --- a/widgets/glWidget/simpleGLGraphicsScene.cc +++ b/widgets/glWidget/simpleGLGraphicsScene.cc @@ -127,16 +127,12 @@ void SimpleGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_re void SimpleGLGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent* _e) { - cursorPainter_->updateCursorPosition (_e->scenePos ()); - QGraphicsScene::mouseMoveEvent(_e); if (_e->isAccepted()) return; if (view_) view_->mouseMoveEvent(_e); - - update (); } void SimpleGLGraphicsScene::setView(glViewer * _view) @@ -158,6 +154,12 @@ bool SimpleGLGraphicsScene::event(QEvent *_event) cursorPainter_->setMouseIn (false); update (); } + else if (cursorPainter_ && _event->type() == QEvent::GraphicsSceneMouseMove) + { + QGraphicsSceneMouseEvent *e = static_cast(_event); + cursorPainter_->updateCursorPosition (e->scenePos ()); + update (); + } return QGraphicsScene::event (_event); }