+ if (aObject->data()->isValid()) {
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
+ if (aFeature.get() && aFeature->firstResult().get()
+ && (aFeature->firstResult()->groupName() == ModelAPI_ResultField::group())) {
+ ResultFieldPtr aResult =
+ std::dynamic_pointer_cast<ModelAPI_ResultField>(aFeature->firstResult());
+ QModelIndex aIndex = objectIndex(aResult, 0);
+ removeRows(0, aResult->stepsSize(), aIndex);
+ } else {
+ QModelIndex aIndex = objectIndex(aObject, 0);
+ if (aIndex.isValid()) {
+ emit dataChanged(aIndex, aIndex);
+ }
+ }
+ } else {
+ rebuildDataTree();
+ break;
+ }
+ }
+ } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_ORDER_UPDATED)) {
+ std::shared_ptr<ModelAPI_OrderUpdatedMessage> aUpdMsg =
+ std::dynamic_pointer_cast<ModelAPI_OrderUpdatedMessage>(theMessage);
+ if (aUpdMsg->reordered().get()) {
+ DocumentPtr aDoc = aUpdMsg->reordered()->document();
+ std::string aGroup = aUpdMsg->reordered()->group();
+
+ QModelIndex aParent;
+ int aStartId = 0;
+ if (aDoc == aRootDoc) {
+ // Update a group under root
+ if (aGroup == myXMLReader->rootType()) // Update objects under root
+ aStartId = foldersCount();
+ else // Update objects in folder under root
+ aParent = createIndex(folderId(aGroup), 0, (void*)Q_NULLPTR);
+ } else {
+ // Update a sub-document
+ if (aGroup == myXMLReader->subType()) {
+ // Update sub-document root
+ aParent = findDocumentRootIndex(aDoc.get(), 0);
+ aStartId = foldersCount(aDoc.get());
+ } else
+ // update folder in sub-document
+ aParent = createIndex(folderId(aGroup, aDoc.get()), 0, aDoc.get());
+ }
+ int aChildNb = rowCount(aParent);
+ rebuildBranch(aStartId, aChildNb - aStartId, aParent);
+ } else {
+ rebuildDataTree();