QObjectPtrList aObjects = aDisplayer->displayedObjects();
bool aHidden;
foreach(ObjectPtr aObj, aObjects) {
- //TODO: replace by redisplay event.
aHidden = !aObj->data() || !aObj->data()->isValid() ||
aObj->isDisabled() || (!aObj->isDisplayed());
if (!aHidden)
ObjectPtr aConstrObj;
ObjectPtr aResultObj;
std::set<ObjectPtr>::const_iterator aIt;
- std::string aObjType;
+ DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
ObjectPtr aObject = (*aIt);
- if ((!aResultObj.get()) && aObject->groupName() == ModelAPI_ResultBody::group())
+ if ((!aResultObj.get()) && (aObject->groupName() == ModelAPI_ResultBody::group())
+ && (aObject->document() != aRootDoc))
aResultObj = aObject;
- if ((!aConstrObj.get()) && aObject->groupName() == ModelAPI_ResultConstruction::group())
+ if ((!aConstrObj.get()) && (aObject->groupName() == ModelAPI_ResultConstruction::group())
+ && (aObject->document() != aRootDoc))
aConstrObj = aObject;
if (aResultObj.get() && aConstrObj.get())
break;
return findDocumentRootIndex(aSubDoc.get());
else {
// return first level of folder index
- int aFolderId = myXMLReader->subFolderId(aType);
+ int aFolderId = folderId(aType, aSubDoc.get());
// Items in a one row must have the same parent
return createIndex(aFolderId, 0, aSubDoc.get());
}
}
//******************************************************
-int XGUI_DataModel::folderId(std::string theType, ModelAPI_Document* theDoc)
+int XGUI_DataModel::folderId(std::string theType, ModelAPI_Document* theDoc) const
{
SessionPtr aSession = ModelAPI_Session::get();
ModelAPI_Document* aDoc = theDoc;
/// folders which can not be shown non empty
/// \param theType Type of the folder
/// \param theDoc a document which contains this folder
- int folderId(std::string theType, ModelAPI_Document* theDoc = 0);
+ int folderId(std::string theType, ModelAPI_Document* theDoc = 0) const;
/// Removes a row from branch of tree
/// \param theStart - start row to update indexes