]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
itemRemoved method added for calling from QxGraph_Canvas::removeItem method. In this...
authorsln <sln@opencascade.com>
Mon, 24 Dec 2007 13:56:13 +0000 (13:56 +0000)
committersln <sln@opencascade.com>
Mon, 24 Dec 2007 13:56:13 +0000 (13:56 +0000)
src/QxGraph/QxGraph_CanvasView.cxx
src/QxGraph/QxGraph_CanvasView.h

index 4e0f848a8581a3f50d0047e6e3ec5b509f11836a..d3873b8fb3085c79ca543264dccbbd4ea4b77861 100644 (file)
@@ -365,6 +365,35 @@ void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent)
   }
 }
 
+/*!
+  This method is called by QxGraph_Canvas when item is removed. 
+  QxGraph_CanvasView updates its own data accordingly
+*/
+void QxGraph_CanvasView::itemRemoved( QCanvasItem* theItem )
+{
+  if ( myCurrentItem == theItem )
+    myCurrentItem = 0;
+
+  QxGraph_ActiveItem* anActiveItem = dynamic_cast<QxGraph_ActiveItem*>( theItem );
+  if ( anActiveItem )
+  {
+    if ( myHilightedItem == anActiveItem )
+      myHilightedItem = 0;
+    if ( mySelectedItem == anActiveItem )
+      mySelectedItem = 0;
+  }
+}
+
+void QxGraph_CanvasView::setSelectedItem( QxGraph_ActiveItem* theItem )
+{
+  mySelectedItem = theItem;
+}
+
+QxGraph_ActiveItem* QxGraph_CanvasView::getSelectedItem() const
+{
+  return mySelectedItem;
+}
+
 void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent)
 {
   QPoint aPoint = inverseWorldMatrix().map(theEvent->pos());
@@ -678,3 +707,6 @@ void QxGraph_ToolTip::maybeTip(const QPoint& theMousePos) {
       }
   }
 }
+
+
+
index 5bd14f7404f1dc120c4c24e56df9b07323da1da2..36cac2201c058d2e887fe83a3aafdb475adbfae4 100644 (file)
@@ -53,6 +53,11 @@ class QXGRAPH_EXPORT QxGraph_CanvasView : public QCanvasView {
   void activateGlobalPanning();
   void activateReset();
 
+  void itemRemoved( QCanvasItem* );
+
+  void setSelectedItem( QxGraph_ActiveItem* theItem );
+  QxGraph_ActiveItem* getSelectedItem() const;
+
  public slots:
   void onTimeout();
    //void changeBackground();