}
}
+//******************************************************
+bool XGUI_DataModel::hasHiddenState(const QModelIndex& theIndex)
+{
+ return getVisibilityState(theIndex) == Hidden;
+}
+
//******************************************************
int XGUI_DataModel::folderId(std::string theType, ModelAPI_Document* theDoc) const
{
/// 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();
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)
{
/// \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);
#include <ModelAPI_Data.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Document.h>
+#include <ModelAPI_ResultCompSolid.h>
#include <ModelAPI_Tools.h>
#include <ModuleBase_Tools.h>
if (aResObj.get()) {
std::set<ObjectPtr> 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);
}
//**************************************************************
bool XGUI_Workshop::prepareForDisplay(const std::set<ObjectPtr>& theObjects) const
{
+ if (facesPanel()->isEmpty())
+ return true;
+
// generate container of objects taking into account sub elments of compsolid
std::set<ObjectPtr> anAllProcessedObjects;
for (std::set<ObjectPtr>::const_iterator anObjectsIt = theObjects.begin();
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(