From 71daf7def31a174482d718270af45d16eff156b3 Mon Sep 17 00:00:00 2001 From: ptv Date: Mon, 1 Aug 2005 04:25:15 +0000 Subject: [PATCH] ptv, do not send mouse release event just after mouse double click --- src/GLViewer/GLViewer_ViewPort2d.cxx | 18 +++++++++++++++++- src/GLViewer/GLViewer_ViewPort2d.h | 3 +++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/GLViewer/GLViewer_ViewPort2d.cxx b/src/GLViewer/GLViewer_ViewPort2d.cxx index cd505e7ba..59604a176 100644 --- a/src/GLViewer/GLViewer_ViewPort2d.cxx +++ b/src/GLViewer/GLViewer_ViewPort2d.cxx @@ -48,7 +48,8 @@ GLViewer_ViewPort2d::GLViewer_ViewPort2d( QWidget* parent, GLViewer_ViewFrame* t GLViewer_ViewPort( parent ), myMargin( MARGIN ), myWidth( WIDTH ), myHeight( HEIGHT ), myXScale( 1.0 ), myYScale( 1.0 ), myXOldScale( 1.0 ), myYOldScale( 1.0 ), - myXPan( 0.0 ), myYPan( 0.0 ) + myXPan( 0.0 ), myYPan( 0.0 ), + myIsMouseReleaseBlock( false ) { if( theViewFrame == NULL ) myViewFrame = ( GLViewer_ViewFrame* )parent; @@ -331,6 +332,13 @@ void GLViewer_ViewPort2d::mouseMoveEvent( QMouseEvent* e ) */ void GLViewer_ViewPort2d::mouseReleaseEvent( QMouseEvent* e ) { + if ( myIsMouseReleaseBlock ) + { + // skip mouse release after double click + myIsMouseReleaseBlock = false; + return; + } + /* show popup menu */ if ( e->button() == Qt::RightButton ) { @@ -374,6 +382,14 @@ void GLViewer_ViewPort2d::mouseReleaseEvent( QMouseEvent* e ) } } +void GLViewer_ViewPort2d::mouseDoubleClickEvent( QMouseEvent * e ) +{ + //redefined to block mouse release after mouse double click + myIsMouseReleaseBlock = true; + // invoke base implementation + GLViewer_ViewPort::mouseDoubleClickEvent( e ); +} + void GLViewer_ViewPort2d::turnCompass( GLboolean on ) { if( on ) diff --git a/src/GLViewer/GLViewer_ViewPort2d.h b/src/GLViewer/GLViewer_ViewPort2d.h index de2438663..a022b11b9 100644 --- a/src/GLViewer/GLViewer_ViewPort2d.h +++ b/src/GLViewer/GLViewer_ViewPort2d.h @@ -146,6 +146,7 @@ protected: virtual void mouseMoveEvent( QMouseEvent *); virtual void mousePressEvent( QMouseEvent *); virtual void mouseReleaseEvent( QMouseEvent *); + virtual void mouseDoubleClickEvent( QMouseEvent *); virtual void paintEvent( QPaintEvent* ); virtual void resizeEvent( QResizeEvent* ); @@ -215,6 +216,8 @@ protected: //GLViewer_ObjectTip* myObjectTip; QtxToolTip* myObjectTip; + //! flag to block mouse release event just after mouse double-click + bool myIsMouseReleaseBlock; }; #ifdef WNT -- 2.39.2