From 68834d3f578b8e91147bcb20f75bf8d7adcf5bd7 Mon Sep 17 00:00:00 2001 From: sln Date: Mon, 24 Dec 2007 13:57:27 +0000 Subject: [PATCH] removeItem method redefined for calling corresponding itemRemoved methods of CanvasViews (IPAL18424) --- src/QxGraph/QxGraph_Canvas.cxx | 28 +++++++++++++++++++++++++++- src/QxGraph/QxGraph_Canvas.h | 9 +++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/QxGraph/QxGraph_Canvas.cxx b/src/QxGraph/QxGraph_Canvas.cxx index 8eb1afe63..f39c5f6b4 100644 --- a/src/QxGraph/QxGraph_Canvas.cxx +++ b/src/QxGraph/QxGraph_Canvas.cxx @@ -27,6 +27,7 @@ #include #include +#include /*! Constructor @@ -67,8 +68,33 @@ QxGraph_Canvas::~QxGraph_Canvas() */ void QxGraph_Canvas::addView(QCanvasView* theView) { + myViews.append( theView ); QCanvas::addView(theView); - theView->setPaletteBackgroundColor(backgroundColor().light(120)); + theView->setPaletteBackgroundColor(backgroundColor().light(120)); +} + +/*! + Remove view +*/ +void QxGraph_Canvas::removeView( QCanvasView* theView ) +{ + myViews.remove( theView ); +} + +/*! + Remove item +*/ +void QxGraph_Canvas::removeItem( QCanvasItem* theItem ) +{ + QValueList< QCanvasView* >::iterator anIter; + for ( anIter = myViews.begin(); anIter != myViews.end(); ++anIter ) + { + QxGraph_CanvasView* aView = dynamic_cast( *anIter ); + if ( aView ) + aView->itemRemoved( theItem ); + } + + QCanvas::removeItem( theItem ); } /*! diff --git a/src/QxGraph/QxGraph_Canvas.h b/src/QxGraph/QxGraph_Canvas.h index a41ea829e..9dd6e2c10 100644 --- a/src/QxGraph/QxGraph_Canvas.h +++ b/src/QxGraph/QxGraph_Canvas.h @@ -38,13 +38,18 @@ class QXGRAPH_EXPORT QxGraph_Canvas : public QCanvas { QxGraph_Canvas(SUIT_ResourceMgr*); virtual ~QxGraph_Canvas(); - void addView(QCanvasView* theView); + virtual void addView(QCanvasView* theView); + virtual void removeView(QCanvasView*); QPtrList getPrsList() const { return myPrsList; } QxGraph_Prs* getPrs(int theIndex = 0); void addPrs(QxGraph_Prs* thePrs) { myPrsList.append(thePrs); } - private: + virtual void removeItem( QCanvasItem* ); + +private: + + QValueList< QCanvasView* > myViews; QPtrList myPrsList; }; -- 2.39.2