From: asl Date: Wed, 22 Nov 2017 12:27:05 +0000 (+0300) Subject: new method clearItems() to clear the scene X-Git-Tag: V8_5_0b1^2~10^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fcd77cf38426d3ba7c02ff4aef089adca1781317;p=modules%2Fgui.git new method clearItems() to clear the scene --- diff --git a/src/GraphicsView/GraphicsView_ViewPort.cxx b/src/GraphicsView/GraphicsView_ViewPort.cxx index 1c4739bcf..627a30cdd 100644 --- a/src/GraphicsView/GraphicsView_ViewPort.cxx +++ b/src/GraphicsView/GraphicsView_ViewPort.cxx @@ -312,6 +312,15 @@ void GraphicsView_ViewPort::removeItem( QGraphicsItem* theItem ) onBoundingRectChanged(); } +void GraphicsView_ViewPort::clearItems() +{ + myHighlightedObject = 0; + mySelectedObjects.clear(); + myObjects.clear(); + myScene->clear(); + onBoundingRectChanged(); +} + //================================================================ // Function : getObjects // Purpose : diff --git a/src/GraphicsView/GraphicsView_ViewPort.h b/src/GraphicsView/GraphicsView_ViewPort.h index f6b440bc0..7617e347b 100644 --- a/src/GraphicsView/GraphicsView_ViewPort.h +++ b/src/GraphicsView/GraphicsView_ViewPort.h @@ -84,6 +84,7 @@ public: void addItem( QGraphicsItem* theItem ); bool isItemAdded( QGraphicsItem* theItem ); void removeItem( QGraphicsItem* theItem ); + void clearItems(); enum SortType { NoSorting, SelectedFirst, SortByZLevel }; GraphicsView_ObjectList getObjects( SortType theSortType = NoSorting ) const;