- case Qt::DisplayRole:
- if (aFeature)
- return aFeature->data()->name().c_str();
- else
- return QVariant();
- case Qt::DecorationRole:
- return QIcon(XGUI_Workshop::featureIcon(aFeature->getKind()));
- case Qt::ToolTipRole:
- return tr("Feature object");
- case Qt::ForegroundRole:
- if (myActivePart)
- return QBrush(PASSIVE_COLOR);
- else
- return QBrush(ACTIVE_COLOR);
- default:
- return QVariant();
- }
- }
- break;
- }
+ case Qt::DisplayRole:
+ return tr("Parts") + QString(" (%1)").arg(rowCount(theIndex));
+ case Qt::DecorationRole:
+ return QIcon(":pictures/constr_folder.png");
+ case Qt::ToolTipRole:
+ return tr("Parts folder");
+ case Qt::ForegroundRole:
+ if (myActivePart)
+ return QBrush(PASSIVE_COLOR);
+ else
+ return QBrush(ACTIVE_COLOR);
+ default:
+ return QVariant();
+ }
+ break;
+ case HistoryNode:
+ {
+ int aOffset = historyOffset();
+ DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+ ObjectPtr aObj = aRootDoc->object(ModelAPI_Feature::group(), theIndex.row() - aOffset);
+ FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+ if (!aFeature)
+ return QVariant();
+ switch (theRole) {
+ case Qt::DisplayRole:
+ if (aFeature)
+ return aFeature->data()->name().c_str();
+ else
+ return QVariant();
+ case Qt::DecorationRole:
+ return QIcon(XGUI_Workshop::featureIcon(aFeature->getKind()));
+ case Qt::ToolTipRole:
+ return tr("Feature object");
+ case Qt::ForegroundRole:
+ if (myActivePart)
+ return QBrush(PASSIVE_COLOR);
+ else
+ return QBrush(ACTIVE_COLOR);
+ default:
+ return QVariant();
+ }
+ }
+ break;
+ }