From: vsv Date: Mon, 23 Jul 2018 10:03:36 +0000 (+0300) Subject: Fix for sketcher rectangle X-Git-Tag: SHAPER_V9_1_0RC1~73^2~55 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b7a1c45c379d991c6e5ce45b3052e69d4bbd58eb;p=modules%2Fshaper.git Fix for sketcher rectangle --- diff --git a/src/PartSet/PartSet_TreeNodes.cpp b/src/PartSet/PartSet_TreeNodes.cpp index 4bff2cb95..c8f970d2a 100644 --- a/src/PartSet/PartSet_TreeNodes.cpp +++ b/src/PartSet/PartSet_TreeNodes.cpp @@ -134,7 +134,9 @@ QVariant PartSet_ObjectNode::data(int theColumn, int theRole) const Qt::ItemFlags PartSet_ObjectNode::flags(int theColumn) const { - if (!myObject->isDisabled()) { + if (myObject->isDisabled()) { + return (theColumn == 2) ? Qt::ItemIsSelectable : aNullFlag; + } else { DocumentPtr aDoc = myObject->document(); SessionPtr aSession = ModelAPI_Session::get(); if (aSession->activeDocument() == aDoc) @@ -362,11 +364,8 @@ QTreeNodesList PartSet_FeatureFolderNode::objectCreated(const QObjectPtrList& th // Process all folders ModuleBase_ITreeNode* aFoder = 0; foreach(ModuleBase_ITreeNode* aNode, myChildren) { - aFoder = dynamic_cast(aNode); - if (!aFoder) - aFoder = dynamic_cast(aNode); - - if (aFoder) { // aFolder node + if ((aNode->type() == PartSet_FolderNode::typeId()) || + (aNode->type() == PartSet_PartRootNode::typeId())) { // aFolder node QTreeNodesList aList = aNode->objectCreated(theObjects); if (aList.size() > 0) aResult.append(aList); @@ -381,14 +380,17 @@ QTreeNodesList PartSet_FeatureFolderNode::objectCreated(const QObjectPtrList& th if ((aObj->groupName() == ModelAPI_Feature::group()) || (aObj->groupName() == ModelAPI_Folder::group())){ ModuleBase_ITreeNode* aNode = createNode(aObj); - aIdx = aDoc->index(aObj, true) + aNb; - bool aHasObject = (aIdx < myChildren.size()) && (myChildren.at(aIdx)->object() == aObj); - if (!aHasObject) { - if (aIdx < myChildren.size()) - myChildren.insert(aIdx, aNode); - else - myChildren.append(aNode); - aResult.append(aNode); + aIdx = aDoc->index(aObj, true); + if (aIdx != -1) { + aIdx += aNb; + bool aHasObject = (aIdx < myChildren.size()) && (myChildren.at(aIdx)->object() == aObj); + if (!aHasObject) { + if (aIdx < myChildren.size()) + myChildren.insert(aIdx, aNode); + else + myChildren.append(aNode); + aResult.append(aNode); + } } } } @@ -429,7 +431,7 @@ QTreeNodesList PartSet_FeatureFolderNode::objectsDeleted(const DocumentPtr& theD aId++; if (aNode->object().get()) { aIndex = aDoc->index(aNode->object(), true); - if ((aIndex == -1) || (aId != aIndex)) + if ((aIndex == -1) || (aId != (aIndex + aNb))) aDelList.append(aNode); } } diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index de827fe49..e28d26a55 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -98,13 +98,15 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess bool aRebuildAll = false; for (aIt = aObjects.cbegin(); aIt != aObjects.cend(); aIt++) { ObjectPtr aObj = (*aIt); + if (!aObj->isInHistory()) + continue; + if (aObj->data()->isValid()) { if (aObj->groupName() == ModelAPI_Folder::group()) { aRebuildAll = true; break; } - if (aObj->isInHistory()) - aCreated.append(*aIt); + aCreated.append(*aIt); } } if (aRebuildAll) {