]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Small correction for 'immediate selection' mode
authorouv <ouv@opencascade.com>
Tue, 7 Dec 2010 15:07:02 +0000 (15:07 +0000)
committerouv <ouv@opencascade.com>
Tue, 7 Dec 2010 15:07:02 +0000 (15:07 +0000)
src/GraphicsView/GraphicsView_Viewer.cxx

index faa4ff7f24e31a64ee21b79be19982602deee507..d09ed715ab07fcd56bffc045ada96feda9ced84e 100644 (file)
@@ -280,11 +280,6 @@ void GraphicsView_Viewer::handleMousePress( QGraphicsSceneMouseEvent* e )
     else if ( bs == GraphicsView_ViewTransformer::panButton() )
       activateTransform( Pan );
   }
-  else if ( e->button() == Qt::RightButton && isImmediateSelectionEnabled() )
-  {
-    bool append = bool ( e->modifiers() & GraphicsView_Selector::getAppendKey() );
-    getSelector()->select( QRectF(), append );
-  }
   else // checking for other operations before selection in release event
     startOperations( e );
 }
@@ -384,6 +379,17 @@ void GraphicsView_Viewer::startOperations( QGraphicsSceneMouseEvent* e )
 {
   GraphicsView_ViewPort* aViewPort = getActiveViewPort();
 
+  // If the 'immediate selection' mode is enabled,
+  // try to perform selection before invoking context menu
+  if( e->button() == Qt::RightButton &&
+      isImmediateSelectionEnabled() &&
+      aViewPort->nbSelected() < 1 )
+  {
+    bool append = bool ( e->modifiers() & GraphicsView_Selector::getAppendKey() );
+    getSelector()->select( QRectF(), append );
+    return;
+  }
+
   // Try to start pulling if rectangular selection is performed
   if( e->button() == Qt::LeftButton &&
       !aViewPort->isSelectByRect() &&