From 4d7299ff9bd4592d6689ceb3388b03453033dbf7 Mon Sep 17 00:00:00 2001 From: sln Date: Mon, 24 Dec 2007 13:56:13 +0000 Subject: [PATCH] itemRemoved method added for calling from QxGraph_Canvas::removeItem method. In this method CanvasView clear its internal fields accordingly (IPAL18424) --- src/QxGraph/QxGraph_CanvasView.cxx | 32 ++++++++++++++++++++++++++++++ src/QxGraph/QxGraph_CanvasView.h | 5 +++++ 2 files changed, 37 insertions(+) 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(); -- 2.39.2