]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
ptv, do not send mouse release event just after mouse double click
authorptv <ptv@opencascade.com>
Mon, 1 Aug 2005 04:25:15 +0000 (04:25 +0000)
committerptv <ptv@opencascade.com>
Mon, 1 Aug 2005 04:25:15 +0000 (04:25 +0000)
src/GLViewer/GLViewer_ViewPort2d.cxx
src/GLViewer/GLViewer_ViewPort2d.h

index cd505e7bad223991b0fbb81900a9530bb1fccea8..59604a176c370d66171f496466197eebc514c69a 100644 (file)
@@ -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 )
index de24386637d8da540979dfe9ed8f82b928a89ddd..a022b11b90d6b8026429ec5411c1170215176f63 100644 (file)
@@ -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