From: vsv Date: Tue, 22 May 2018 15:22:08 +0000 (+0300) Subject: Issue #2482: Process compsolids for hiding faces, do not process the same selected... X-Git-Tag: V8_5_0rc2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e6d80bfe0fbb4134680850dcac93998b42a31507;p=modules%2Fshaper.git Issue #2482: Process compsolids for hiding faces, do not process the same selected faces --- diff --git a/src/ModuleBase/ModuleBase_ListView.cpp b/src/ModuleBase/ModuleBase_ListView.cpp index 03a884d3a..d1dc0158a 100644 --- a/src/ModuleBase/ModuleBase_ListView.cpp +++ b/src/ModuleBase/ModuleBase_ListView.cpp @@ -179,4 +179,10 @@ void ModuleBase_ListView::onListSelection() QList aItems = myListControl->selectedItems(); myCopyAction->setEnabled(!aItems.isEmpty()); myDeleteAction->setEnabled(!aItems.isEmpty()); -} \ No newline at end of file +} + +//******************************************************************** +bool ModuleBase_ListView::hasItem(const QString& theTextValue) const +{ + return myListControl->findItems(theTextValue, Qt::MatchExactly).length() > 0; +} diff --git a/src/ModuleBase/ModuleBase_ListView.h b/src/ModuleBase/ModuleBase_ListView.h index 27c22622d..9fd0f578a 100644 --- a/src/ModuleBase/ModuleBase_ListView.h +++ b/src/ModuleBase/ModuleBase_ListView.h @@ -56,6 +56,10 @@ public: /// \param theIndex an item internal index void addItem(const QString& theTextValue, const int theIndex); + /// Returns True if the control already contains an item with the given text + /// \param theTextValue tex of item to find + bool hasItem(const QString& theTextValue) const; + /// Returns list of internal list view item indices /// \param theIndices an output container for indices void getSelectedIndices(std::set& theIndices); diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index 7c855b33b..cb422bf9a 100755 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -233,6 +233,7 @@ void ModuleBase_ResultPrs::collectSubShapes(BRep_Builder& theBuilder, const NCollection_List& theHiddenSubShapes) { switch (theShape.ShapeType()) { + case TopAbs_COMPSOLID: case TopAbs_COMPOUND: { for (TopoDS_Iterator aChildIter (theShape); aChildIter.More(); aChildIter.Next()) collectSubShapes(theBuilder, theCompound, aChildIter.Value(), theHiddenSubShapes); diff --git a/src/XGUI/XGUI_FacesPanel.cpp b/src/XGUI/XGUI_FacesPanel.cpp index 01211ae75..729c96761 100644 --- a/src/XGUI/XGUI_FacesPanel.cpp +++ b/src/XGUI/XGUI_FacesPanel.cpp @@ -232,9 +232,12 @@ void XGUI_FacesPanel::processSelection() aPrs->interactive()); if (aResultPrs.IsNull()) continue; + QString aItemName = generateName(aPrs); + if (myListView->hasItem(aItemName)) + return; myItems.insert(myLastItemIndex, aPrs); - myListView->addItem(generateName(aPrs), myLastItemIndex); + myListView->addItem(aItemName, myLastItemIndex); myLastItemIndex++; isModified = true;