From: sln Date: Mon, 24 Dec 2007 13:56:13 +0000 (+0000) Subject: itemRemoved method added for calling from QxGraph_Canvas::removeItem method. In this... X-Git-Tag: for_M2008_07022008~23 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4d7299ff9bd4592d6689ceb3388b03453033dbf7;p=modules%2Fgui.git itemRemoved method added for calling from QxGraph_Canvas::removeItem method. In this method CanvasView clear its internal fields accordingly (IPAL18424) --- diff --git a/src/QxGraph/QxGraph_CanvasView.cxx b/src/QxGraph/QxGraph_CanvasView.cxx index 4e0f848a8..d3873b8fb 100644 --- a/src/QxGraph/QxGraph_CanvasView.cxx +++ b/src/QxGraph/QxGraph_CanvasView.cxx @@ -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( 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) { } } } + + + diff --git a/src/QxGraph/QxGraph_CanvasView.h b/src/QxGraph/QxGraph_CanvasView.h index 5bd14f740..36cac2201 100644 --- a/src/QxGraph/QxGraph_CanvasView.h +++ b/src/QxGraph/QxGraph_CanvasView.h @@ -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();