#include "ModuleBase_Tools.h"
#include "ModuleBase_ViewerPrs.h"
+#include "XGUI_ObjectsBrowser.h"
#include "XGUI_SelectionMgr.h"
#include "XGUI_SelectionFilterType.h"
#include "XGUI_Tools.h"
myItems.clear();
// restore previous view of presentations
- bool isModified = redisplayObjects(myItemObjects, false);
+ bool isModified = redisplayObjects(myItemObjects);
std::set<std::shared_ptr<ModelAPI_Object> > aHiddenObjects = myHiddenObjects;
- isModified = displayHiddenObjects(aHiddenObjects, myHiddenObjects, false) || isModified;
+ isModified = displayHiddenObjects(aHiddenObjects, myHiddenObjects) || isModified;
if (isModified)// && isToFlushRedisplay) // flush signal immediatelly until container is filled
- Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+ flushRedisplay();
updateProcessedObjects(myItems, myItemObjects);
myHiddenObjects.clear();
ModelAPI_EventCreator::get()->sendUpdated(anObject, aDispEvent);
}
}
- if (isModified)
- {
+ if (isModified) {
updateProcessedObjects(myItems, myItemObjects);
- Events_Loop::loop()->flush(aDispEvent);
+ flushRedisplay();
}
}
isModified = true;
}
if (isModified) {
- bool isRedisplayed = redisplayObjects(aRestoredObjects, false);
- isRedisplayed = displayHiddenObjects(aRestoredObjects, myHiddenObjects, false)
+ bool isRedisplayed = redisplayObjects(aRestoredObjects);
+ isRedisplayed = displayHiddenObjects(aRestoredObjects, myHiddenObjects)
|| isRedisplayed;
if (isRedisplayed)
- Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+ flushRedisplay();
// should be after flush of redisplay to have items object to be updated
updateProcessedObjects(myItems, myItemObjects);
}
//********************************************************************
bool XGUI_FacesPanel::redisplayObjects(
- const std::set<std::shared_ptr<ModelAPI_Object> >& theObjects,
- const bool isToFlushRedisplay)
+ const std::set<std::shared_ptr<ModelAPI_Object> >& theObjects)
{
if (theObjects.empty())
return false;
ModelAPI_EventCreator::get()->sendUpdated(anObject, aDispEvent);
isModified = true;
}
- if (isModified && isToFlushRedisplay)
- Events_Loop::loop()->flush(aDispEvent);
return isModified;
}
//********************************************************************
bool XGUI_FacesPanel::displayHiddenObjects(
const std::set<std::shared_ptr<ModelAPI_Object> >& theObjects,
- std::set<std::shared_ptr<ModelAPI_Object> >& theHiddenObjects,
- const bool isToFlushRedisplay)
+ std::set<std::shared_ptr<ModelAPI_Object> >& theHiddenObjects)
{
if (theObjects.empty())
return false;
ModelAPI_EventCreator::get()->sendUpdated(anObject, aDispEvent);
isModified = true;
}
-
- if (isModified && isToFlushRedisplay)
- Events_Loop::loop()->flush(aDispEvent);
return isModified;
}
bool isModified = false;
if (useTransparency()) {
std::set<std::shared_ptr<ModelAPI_Object> > aHiddenObjects = myHiddenObjects;
- isModified = displayHiddenObjects(aHiddenObjects, myHiddenObjects, false);
+ isModified = displayHiddenObjects(aHiddenObjects, myHiddenObjects);
}
else
isModified = hideEmptyObjects();
- isModified = redisplayObjects(myItemObjects, false) || isModified;
+ isModified = redisplayObjects(myItemObjects) || isModified;
if (isModified)
- Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
-
+ flushRedisplay();
}
//********************************************************************
setActivePanel(false);
reset(true);
}
+
+//********************************************************************
+void XGUI_FacesPanel::flushRedisplay() const
+{
+ Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+ // Necessary for update visibility icons in ObjectBrowser
+ XGUI_ObjectsBrowser* anObjectBrowser = XGUI_Tools::workshop(myWorkshop)->objectBrowser();
+ if (anObjectBrowser)
+ anObjectBrowser->updateAllIndexes();
+}
private:
/// Redisplay objects.
/// \param theObjects container of objects
- /// \param isToFlushRedisplay flag if redisplay should be flushed immediatelly
/// \return true if some of objects was redisplayed
- static bool redisplayObjects(const std::set<std::shared_ptr<ModelAPI_Object> >& theObjects,
- const bool isToFlushRedisplay);
+ static bool redisplayObjects(const std::set<std::shared_ptr<ModelAPI_Object> >& theObjects);
/// Display objects if the objects are in a container of hidden by this pane.
/// \param theObjects container of objects
/// \param theHiddenObjects hidden objects, if object is in the container, it should be removed
- /// \param isToFlushRedisplay flag if redisplay should be flushed immediatelly
/// \return true if some of objects was redisplayed
static bool displayHiddenObjects(const std::set<std::shared_ptr<ModelAPI_Object> >& theObjects,
- std::set<std::shared_ptr<ModelAPI_Object> >& theHiddenObjects,
- const bool isToFlushRedisplay);
+ std::set<std::shared_ptr<ModelAPI_Object> >& theHiddenObjects);
/// Iterates by items and hide objects where all sub-shapes are hidden
/// \return true if some of objects was redisplayed
/// Closes faces panel restore all hidden faces by calling reset()
void onClosed();
+private:
+ /// Flushes redisplay event and perform update of object browser icons
+ /// (objects might be hidden/shown)
+ void flushRedisplay() const;
+
protected:
QCheckBox* myHiddenOrTransparent; ///< if checked - transparent, else hidden
ModuleBase_ListView* myListView; ///< list control of processed faces