]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Debug: #23 and modifications to forbid the selection of the node, when it is moved...
authormkr <mkr@opencascade.com>
Thu, 31 Jan 2008 15:37:34 +0000 (15:37 +0000)
committermkr <mkr@opencascade.com>
Thu, 31 Jan 2008 15:37:34 +0000 (15:37 +0000)
src/QxGraph/QxGraph_CanvasView.cxx
src/QxGraph/QxGraph_CanvasView.h

index d3873b8fb3085c79ca543264dccbbd4ea4b77861..be0d7dcbf7cfeacf8d2dfc47220dd281ad7f6427 100644 (file)
@@ -112,7 +112,8 @@ QxGraph_CanvasView::QxGraph_CanvasView(QxGraph_Canvas* theCanvas, QxGraph_ViewWi
   QCanvasView(theCanvas, theViewWindow, 0, Qt::WRepaintNoErase),
   myCurrentItem(0),
   myHilightedItem(0),
-  mySelectedItem(0)
+  mySelectedItem(0),
+  myMovingDone(false)
 {
   printf("Construct QxGraph_CanvasView\n");
   setName("QxGraph_CanvasView");
@@ -158,6 +159,11 @@ void QxGraph_CanvasView::contentsMousePressEvent(QMouseEvent* theEvent)
     return;
   }
 
+  if ( myOperation == WINDOWFIT )
+  { // Fit area
+    return;
+  }
+
   if ( theEvent->button() == Qt::LeftButton && theEvent->state() == Qt::ControlButton
        || 
        myOperation == ZOOMVIEW )
@@ -226,11 +232,13 @@ void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent)
     //draw new selected rectangle
     QPen pen(Qt::black,1,Qt::SolidLine);
     aRect1->setPen(pen);
-    aRect1->setZ(3);
+    aRect1->setZ(1E+6);
     aRect1->show();
 
     mySelectedRect = aRect1;
     canvas()->update();
+
+    return;
   }
 
   if ( myOperation == ZOOMVIEW )
@@ -261,6 +269,7 @@ void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent)
     if ( anActItem && anActItem->isResizing() )
     { // to resize items on canvas view
       anActItem->resize(aPoint);
+      myMovingDone = true;
       return;
     }
 
@@ -274,9 +283,10 @@ void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent)
     }
     myCurrentItem->moveBy(aPoint.x() - myPoint.x(), 
                          aPoint.y() - myPoint.y());
+    myMovingDone = true;
     myPoint = aPoint;
     canvas()->update();
-    
+
     // scroll contents if mouse is outside
     QRect r(contentsX(), contentsY(), visibleWidth(), visibleHeight());
     if (!r.contains(theEvent->pos())) {
@@ -525,7 +535,7 @@ void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent)
     }
   }
 
-  if ( theEvent->button() == LeftButton )
+  if ( theEvent->button() == LeftButton && !myMovingDone )
   {
     // Selection mechanism
     QCanvasItemList aList = canvas()->collisions(aPoint);
@@ -553,6 +563,8 @@ void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent)
       }
     }
   }
+
+  myMovingDone = false;
 }
 
 void QxGraph_CanvasView::contentsMouseDoubleClickEvent(QMouseEvent* theEvent)
index 36cac2201c058d2e887fe83a3aafdb475adbfae4..f14e1277e433be85654812520303bd904b829b80 100644 (file)
@@ -75,6 +75,7 @@ class QXGRAPH_EXPORT QxGraph_CanvasView : public QCanvasView {
   QCanvasItem*      myCurrentItem;
   QPoint            myPoint;
   QPoint            myGlobalPoint;
+  bool              myMovingDone;
   
   // for control toolbar actions
   OperationType     myOperation;