]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
removeItem method redefined for calling corresponding itemRemoved methods of CanvasVi...
authorsln <sln@opencascade.com>
Mon, 24 Dec 2007 13:57:27 +0000 (13:57 +0000)
committersln <sln@opencascade.com>
Mon, 24 Dec 2007 13:57:27 +0000 (13:57 +0000)
src/QxGraph/QxGraph_Canvas.cxx
src/QxGraph/QxGraph_Canvas.h

index 8eb1afe632746635d69273c2a7b909ff1d938ca0..f39c5f6b43461b2e44edaf49424ce55133f0258b 100644 (file)
@@ -27,6 +27,7 @@
 #include <SUIT_ResourceMgr.h>
 
 #include <qobjectlist.h>
+#include <QxGraph_CanvasView.h>
 
 /*!
   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<QxGraph_CanvasView*>( *anIter );
+    if ( aView )
+      aView->itemRemoved( theItem );
+  }
+
+  QCanvas::removeItem( theItem );
 }
 
 /*!
index a41ea829e16c49c53fd16127693e79768b7883ef..9dd6e2c10e818f144ebbe30e80c05283b77fadee 100644 (file)
@@ -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<QxGraph_Prs> 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<QxGraph_Prs> myPrsList;
 
 };