From: vsv Date: Wed, 26 Aug 2015 12:34:41 +0000 (+0300) Subject: Issue #834: Show prefix "Not loaded" for not loaded parts. X-Git-Tag: V_1.4.0_beta4~239 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0df40de2e7a7abc2a0f13b222c30bdcb26fbda5d;p=modules%2Fshaper.git Issue #834: Show prefix "Not loaded" for not loaded parts. --- diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index 7ca9f562c..075317acb 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -338,14 +338,24 @@ QVariant XGUI_DataModel::data(const QModelIndex& theIndex, int theRole) const ModelAPI_Object* aObj = (ModelAPI_Object*)theIndex.internalPointer(); switch (theRole) { case Qt::DisplayRole: - if (aObj->groupName() == ModelAPI_ResultParameter::group()) { - ModelAPI_ResultParameter* aParam = dynamic_cast(aObj); - AttributeDoublePtr aValueAttribute = aParam->data()->real(ModelAPI_ResultParameter::VALUE()); - QString aVal = QString::number(aValueAttribute->value()); - QString aTitle = QString(aObj->data()->name().c_str()); - return aTitle + " = " + aVal; + { + if (aObj->groupName() == ModelAPI_ResultParameter::group()) { + ModelAPI_ResultParameter* aParam = dynamic_cast(aObj); + AttributeDoublePtr aValueAttribute = aParam->data()->real(ModelAPI_ResultParameter::VALUE()); + QString aVal = QString::number(aValueAttribute->value()); + QString aTitle = QString(aObj->data()->name().c_str()); + return aTitle + " = " + aVal; + } + QString aPrefix; + if (aObj->groupName() == myXMLReader.subType()) { + ResultPartPtr aPartRes = getPartResult(aObj); + if (aPartRes.get()) { + if (aPartRes->partDoc().get() == NULL) + aPrefix = "Not loaded "; + } + } + return aPrefix + aObj->data()->name().c_str(); } - return aObj->data()->name().c_str(); case Qt::DecorationRole: return ModuleBase_IconFactory::get()->getIcon(object(theIndex)); } @@ -401,6 +411,9 @@ int XGUI_DataModel::rowCount(const QModelIndex& theParent) const ResultPartPtr aPartRes = getPartResult(aObj); if (aPartRes.get()) { DocumentPtr aSubDoc = aPartRes->partDoc(); + if (!aSubDoc.get()) + return 0; + int aNbSubFolders = foldersCount(aSubDoc.get()); int aNbSubItems = 0; std::string aSubType = myXMLReader.subType();