From d2d5f8ed98a6f6f6366474b0358c87c104d1c25e Mon Sep 17 00:00:00 2001 From: ouv Date: Tue, 7 Dec 2010 15:07:02 +0000 Subject: [PATCH] Small correction for 'immediate selection' mode --- src/GraphicsView/GraphicsView_Viewer.cxx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/GraphicsView/GraphicsView_Viewer.cxx b/src/GraphicsView/GraphicsView_Viewer.cxx index faa4ff7f2..d09ed715a 100644 --- a/src/GraphicsView/GraphicsView_Viewer.cxx +++ b/src/GraphicsView/GraphicsView_Viewer.cxx @@ -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() && -- 2.39.2