From f374091b9f5f354136c2c9b9ba54e1df0f382349 Mon Sep 17 00:00:00 2001 From: Nicolas Mellado Date: Thu, 13 Jan 2022 16:09:57 +0100 Subject: [PATCH] [Gui] Propage Mouse events using Qt signals --- src/Gui/Viewer/Viewer.cpp | 3 +++ src/Gui/Viewer/Viewer.hpp | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/Gui/Viewer/Viewer.cpp b/src/Gui/Viewer/Viewer.cpp index 47c574367ce..999b0b43d22 100644 --- a/src/Gui/Viewer/Viewer.cpp +++ b/src/Gui/Viewer/Viewer.cpp @@ -541,11 +541,13 @@ void Viewer::mousePressEvent( QMouseEvent* event ) { m_depthUnderMouse = result.getDepth(); handleMousePressEvent( event, result ); + emit onMousePress( event ); emit needUpdate(); } void Viewer::mouseReleaseEvent( QMouseEvent* event ) { handleMouseReleaseEvent( event ); + emit onMouseRelease( event ); emit needUpdate(); } @@ -561,6 +563,7 @@ void Viewer::mouseMoveEvent( QMouseEvent* event ) { m_depthUnderMouse = result.getDepth(); handleMouseMoveEvent( event, result ); + emit onMouseMove( event ); emit needUpdate(); } diff --git a/src/Gui/Viewer/Viewer.hpp b/src/Gui/Viewer/Viewer.hpp index dd3400bbdcc..a9a3b45f9b7 100644 --- a/src/Gui/Viewer/Viewer.hpp +++ b/src/Gui/Viewer/Viewer.hpp @@ -181,6 +181,13 @@ class RA_GUI_API Viewer : public WindowQt, public KeyMappingManageable void needUpdate(); + /// Event sent after a mouse press event has been processed, but before emitting needUpdate() + void onMousePress( QMouseEvent* event ); + /// Event sent after a mouse release event has been processed, but before emitting needUpdate() + void onMouseRelease( QMouseEvent* event ); + /// Event sent after a mouse move event has been processed, but before emitting needUpdate() + void onMouseMove( QMouseEvent* event ); + public slots: /// Tell the renderer to reload all shaders. void reloadShaders();