From: nds Date: Thu, 14 Dec 2017 14:34:00 +0000 (+0300) Subject: Issue #2355 hide all faces then show solid problem X-Git-Tag: V_2.10.0RC~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3e6b2df389653eb72de9e0639b87fc4511754611;p=modules%2Fshaper.git Issue #2355 hide all faces then show solid problem --- diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index d428a2c50..baf49e20b 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -1059,6 +1059,12 @@ QModelIndex XGUI_DataModel::lastHistoryIndex() const } } +//****************************************************** +bool XGUI_DataModel::hasHiddenState(const QModelIndex& theIndex) +{ + return getVisibilityState(theIndex) == Hidden; +} + //****************************************************** int XGUI_DataModel::folderId(std::string theType, ModelAPI_Document* theDoc) const { diff --git a/src/XGUI/XGUI_DataModel.h b/src/XGUI/XGUI_DataModel.h index d20679f79..e89546161 100644 --- a/src/XGUI/XGUI_DataModel.h +++ b/src/XGUI/XGUI_DataModel.h @@ -142,6 +142,11 @@ public: /// Do not processing anymore events of model loop //bool blockEventsProcessing(const bool theState); + /// Returns true if the data model item has Hidden visual state + /// \param theIndex a tree model item + /// \return boolean value + bool hasHiddenState(const QModelIndex& theIndex); + signals: /// Signal about tree had been rebuilt void treeRebuilt(); diff --git a/src/XGUI/XGUI_FacesPanel.cpp b/src/XGUI/XGUI_FacesPanel.cpp index a5deb6d14..a815c49ec 100644 --- a/src/XGUI/XGUI_FacesPanel.cpp +++ b/src/XGUI/XGUI_FacesPanel.cpp @@ -96,6 +96,12 @@ void XGUI_FacesPanel::reset(const bool isToFlushRedisplay) myLastItemIndex = 0; // it should be after redisplay as flag used in customize } +//******************************************************************** +bool XGUI_FacesPanel::isEmpty() const +{ + return myItems.size() == 0; +} + //******************************************************************** void XGUI_FacesPanel::selectionModes(QIntList& theModes) { diff --git a/src/XGUI/XGUI_FacesPanel.h b/src/XGUI/XGUI_FacesPanel.h index fdb08cc51..ad98a4e55 100644 --- a/src/XGUI/XGUI_FacesPanel.h +++ b/src/XGUI/XGUI_FacesPanel.h @@ -77,6 +77,10 @@ public: /// \param isToFlushRedisplay flag if redisplay should be flushed immediatelly virtual void reset(const bool isToFlushRedisplay); + /// Returns whether faces panel contains elements + /// \return boolean value + bool isEmpty() const; + /// Fills container with the panel selection mode: FACE // \param theModes [out] a container of modes void selectionModes(QIntList& theModes); diff --git a/src/XGUI/XGUI_ObjectsBrowser.cpp b/src/XGUI/XGUI_ObjectsBrowser.cpp index 983f4c37e..f3f539626 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.cpp +++ b/src/XGUI/XGUI_ObjectsBrowser.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -239,10 +240,14 @@ void XGUI_DataTree::processEyeClick(const QModelIndex& theIndex) if (aResObj.get()) { std::set anObjects; anObjects.insert(aResObj); - if (aObjBrowser && !aResObj->isDisplayed() && - !aObjBrowser->workshop()->prepareForDisplay(anObjects)) + + bool hasHiddenState = aModel->hasHiddenState(theIndex); + if (aObjBrowser && hasHiddenState && !aObjBrowser->workshop()->prepareForDisplay(anObjects)) return; - aResObj->setDisplayed(!aResObj->isDisplayed()); + if (hasHiddenState) // #issue 2335(hide all faces then show solid problem) + aResObj->setDisplayed(true); + else + aResObj->setDisplayed(!aResObj->isDisplayed()); Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); update(theIndex); } diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 7e9b3a97a..94dce62bb 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1595,6 +1595,9 @@ void XGUI_Workshop::activateObjectsSelection(const QObjectPtrList& theList) //************************************************************** bool XGUI_Workshop::prepareForDisplay(const std::set& theObjects) const { + if (facesPanel()->isEmpty()) + return true; + // generate container of objects taking into account sub elments of compsolid std::set anAllProcessedObjects; for (std::set::const_iterator anObjectsIt = theObjects.begin(); @@ -1625,7 +1628,7 @@ bool XGUI_Workshop::prepareForDisplay(const std::set& theObjects) con aHiddenObjects.insert(*anObjectsIt); aHiddenObjectNames.append((*anObjectsIt)->data()->name().c_str()); } - if (aHiddenObjects.empty()) + if (aHiddenObjects.empty()) // in parameter objects there are no hidden objects in hide face return true; int anAnswer = QMessageBox::question(