From fcd77cf38426d3ba7c02ff4aef089adca1781317 Mon Sep 17 00:00:00 2001 From: asl Date: Wed, 22 Nov 2017 15:27:05 +0300 Subject: [PATCH] new method clearItems() to clear the scene --- src/GraphicsView/GraphicsView_ViewPort.cxx | 9 +++++++++ src/GraphicsView/GraphicsView_ViewPort.h | 1 + 2 files changed, 10 insertions(+) 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; -- 2.39.2