From d845053c3ca948c9d5a48798e2b2a5af78d37a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 7 Aug 2009 06:01:18 +0000 Subject: [PATCH] Dennis: Catch all mouse events. git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6803 383ad7c9-94d9-4d36-a494-682f7c89f535 --- widgets/glWidget/QtGLGraphicsScene.cc | 11 +++++++---- widgets/glWidget/simpleGLGraphicsScene.cc | 10 ++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/widgets/glWidget/QtGLGraphicsScene.cc b/widgets/glWidget/QtGLGraphicsScene.cc index 359dd9fc..587ea740 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 3508d47a..99157264 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); } -- GitLab