From 6e3ba68d48c3b613ad4aa5802e2d1d2986e343b9 Mon Sep 17 00:00:00 2001 From: ouv Date: Fri, 15 Jul 2011 14:19:02 +0000 Subject: [PATCH] Minor change (interaction flags) --- src/GraphicsView/GraphicsView_ViewPort.cxx | 8 ++++---- src/GraphicsView/GraphicsView_ViewPort.h | 11 +++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/GraphicsView/GraphicsView_ViewPort.cxx b/src/GraphicsView/GraphicsView_ViewPort.cxx index a92833b6b..ac08bd0e1 100644 --- a/src/GraphicsView/GraphicsView_ViewPort.cxx +++ b/src/GraphicsView/GraphicsView_ViewPort.cxx @@ -146,7 +146,7 @@ GraphicsView_ViewPort::GraphicsView_ViewPort( QWidget* theParent ) myIsTraceBoundingRectEnabled = true; // interaction flags - myInteractionFlags = All; + myInteractionFlags = AllFlags; // background setBackgroundBrush( QBrush( Qt::white ) ); @@ -1378,7 +1378,7 @@ void GraphicsView_ViewPort::onMouseEvent( QGraphicsSceneMouseEvent* e ) { case QEvent::GraphicsSceneMousePress: { - if( nbSelected() ) + if( testInteractionFlags( EditFlags ) && nbSelected() ) for( initSelected(); moreSelected() && !anIsHandled; nextSelected() ) if( GraphicsView_Object* anObject = selectedObject() ) anIsHandled = anObject->handleMousePress( e ); @@ -1396,7 +1396,7 @@ void GraphicsView_ViewPort::onMouseEvent( QGraphicsSceneMouseEvent* e ) } case QEvent::GraphicsSceneMouseMove: { - if( nbSelected() ) + if( testInteractionFlags( EditFlags ) && nbSelected() ) for( initSelected(); moreSelected() && !anIsHandled; nextSelected() ) if( GraphicsView_Object* anObject = selectedObject() ) anIsHandled = anObject->handleMousePress( e ); @@ -1407,7 +1407,7 @@ void GraphicsView_ViewPort::onMouseEvent( QGraphicsSceneMouseEvent* e ) } case QEvent::GraphicsSceneMouseRelease: { - if( nbSelected() ) + if( testInteractionFlags( EditFlags ) && nbSelected() ) for( initSelected(); moreSelected() && !anIsHandled; nextSelected() ) if( GraphicsView_Object* anObject = selectedObject() ) anIsHandled = anObject->handleMousePress( e ); diff --git a/src/GraphicsView/GraphicsView_ViewPort.h b/src/GraphicsView/GraphicsView_ViewPort.h index c384ecabc..c94154bf1 100644 --- a/src/GraphicsView/GraphicsView_ViewPort.h +++ b/src/GraphicsView/GraphicsView_ViewPort.h @@ -48,10 +48,13 @@ public: enum InteractionFlags { - Dragging = 0x0001, - Pulling = 0x0002, - WheelScaling = 0x0004, - All = Dragging | Pulling | WheelScaling + Highlighting = 0x0001, // not implemented yet + Selecting = 0x0002, // not implemented yet + Dragging = 0x0004, + Pulling = 0x0008, + WheelScaling = 0x0010, + EditFlags = Dragging | Pulling | WheelScaling, + AllFlags = Highlighting | Selecting | Dragging | Pulling | WheelScaling }; enum BlockStatus -- 2.39.2