#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_ResultParameters.h>
#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_ResultGroup.h>
#include <QIcon>
#include <QBrush>
return aObject->data()->name().c_str();
}
break;
+ //case GroupsFolder:
+ // return tr("Groups") + QString(" (%1)").arg(rowCount(theIndex));
+ //case GroupObject: {
+ // DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+ // ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultGroup::group(),
+ // theIndex.row());
+ // if (aObject)
+ // return aObject->data()->name().c_str();
+ //}
+ // break;
}
break;
return QIcon(":pictures/constr_folder.png");
case ConstructObject:
return QIcon(":pictures/constr_object.png");
+ //case GroupsFolder:
+ // return QIcon(":pictures/constr_folder.png");
}
}
break;
int XGUI_TopDataModel::rowCount(const QModelIndex& theParent) const
{
if (!theParent.isValid())
- return 2;
+ return 2; // In case of groups using it has to be +1
DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
if (theParent.internalId() == ParamsFolder)
if (theParent.internalId() == ConstructFolder)
return aRootDoc->size(ModelAPI_ResultConstruction::group());
+ //if (theParent.internalId() == GroupsFolder)
+ // return aRootDoc->size(ModelAPI_ResultGroup::group());
+
return 0;
}
return createIndex(theRow, theColumn, (qint32) ParamsFolder);
case 1:
return createIndex(theRow, theColumn, (qint32) ConstructFolder);
+ //case 2:
+ // return createIndex(theRow, theColumn, (qint32) GroupsFolder);
}
} else {
if (theParent.internalId() == ParamsFolder)
if (theParent.internalId() == ConstructFolder)
return createIndex(theRow, theColumn, (qint32) ConstructObject);
+
+ //if (theParent.internalId() == GroupsFolder)
+ // return createIndex(theRow, theColumn, (qint32) GroupObject);
}
return QModelIndex();
}
switch (aId) {
case ParamsFolder:
case ConstructFolder:
+ //case GroupsFolder:
return QModelIndex();
case ParamObject:
return createIndex(0, 0, (qint32) ParamsFolder);
case ConstructObject:
return createIndex(1, 0, (qint32) ConstructFolder);
+ //case GroupObject:
+ // return createIndex(2, 0, (qint32) GroupsFolder);
}
return QModelIndex();
}
DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
return aRootDoc->object(ModelAPI_ResultConstruction::group(), theIndex.row());
}
+ //case GroupObject: {
+ // DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+ // return aRootDoc->object(ModelAPI_ResultGroup::group(), theIndex.row());
+ //}
}
return ObjectPtr();
}
return createIndex(0, 0, (qint32) ParamsFolder);
if (theGroup == ModelAPI_ResultConstruction::group())
return createIndex(1, 0, (qint32) ConstructFolder);
+ //if (theGroup == ModelAPI_ResultGroup::group())
+ // return createIndex(2, 0, (qint32) ConstructFolder);
return QModelIndex();
}
return createIndex(aRow, 0, (qint32) ParamObject);
if (aGroup == ModelAPI_ResultConstruction::group())
return createIndex(aRow, 0, (qint32) ConstructObject);
+ //if (aGroup == ModelAPI_ResultGroup::group())
+ // return createIndex(aRow, 0, (qint32) GroupObject);
}
}
return aIndex;
return tr("Constructions") + QString(" (%1)").arg(rowCount(theIndex));
case BodiesFolder:
return tr("Bodies") + QString(" (%1)").arg(rowCount(theIndex));
+ case GroupsFolder:
+ return tr("Groups") + QString(" (%1)").arg(rowCount(theIndex));
case ParamObject: {
ObjectPtr aObject = partDocument()->object(ModelAPI_ResultParameters::group(),
theIndex.row());
if (aObject)
return boost::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
}
+ break;
case ConstructObject: {
ObjectPtr aObject = partDocument()->object(ModelAPI_ResultConstruction::group(),
theIndex.row());
if (aObject)
return boost::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
}
+ break;
case BodiesObject: {
ObjectPtr aObject = partDocument()->object(ModelAPI_ResultBody::group(), theIndex.row());
if (aObject)
return aObject->data()->name().c_str();
+ }
+ break;
+ case GroupObject: {
+ ObjectPtr aObject = partDocument()->object(ModelAPI_ResultGroup::group(), theIndex.row());
+ if (aObject)
+ return aObject->data()->name().c_str();
}
case HistoryObject: {
- ObjectPtr aObject = partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - 3);
+ ObjectPtr aObject = partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - 4);
if (aObject)
return aObject->data()->name().c_str();
}
case ConstructFolder:
case BodiesFolder:
return QIcon(":pictures/constr_folder.png");
+ case GroupsFolder:
+ return QIcon(":pictures/constr_folder.png");
case ConstructObject:
+ case GroupObject:
case BodiesObject: {
std::string aGroup = theIndex.internalId() == ConstructObject ?
ModelAPI_ResultConstruction::group() : ModelAPI_ResultBody::group();
return QIcon(":pictures/constr_object.png");
}
case HistoryObject: {
- ObjectPtr aObject = partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - 3);
+ ObjectPtr aObject = partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - 4);
FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
if (aFeature)
return QIcon(XGUI_Workshop::featureIcon(aFeature->getKind()));
{
DocumentPtr aDoc = partDocument();
if (aDoc)
- return 3 + aDoc->size(ModelAPI_Feature::group());
+ return 4 + aDoc->size(ModelAPI_Feature::group());
else
return 0;
}
return partDocument()->size(ModelAPI_ResultConstruction::group());
case BodiesFolder:
return partDocument()->size(ModelAPI_ResultBody::group());
+ case GroupsFolder:
+ return partDocument()->size(ModelAPI_ResultGroup::group());
}
return 0;
}
case MyRoot:
switch (theRow) {
case 0:
- return createIndex(0, 0, (qint32) ParamsFolder);
+ return createIndex(theRow, 0, (qint32) ParamsFolder);
case 1:
- return createIndex(1, 0, (qint32) ConstructFolder);
+ return createIndex(theRow, 0, (qint32) ConstructFolder);
case 2:
- return createIndex(2, 0, (qint32) BodiesFolder);
+ return createIndex(theRow, 0, (qint32) BodiesFolder);
+ case 3:
+ return createIndex(theRow, 0, (qint32) GroupsFolder);
default:
return createIndex(theRow, theColumn, (qint32) HistoryObject);
}
return createIndex(theRow, 0, (qint32) ConstructObject);
case BodiesFolder:
return createIndex(theRow, 0, (qint32) BodiesObject);
+ case GroupsFolder:
+ return createIndex(theRow, 0, (qint32) GroupObject);
}
return QModelIndex();
}
case ParamsFolder:
case ConstructFolder:
case BodiesFolder:
+ case GroupsFolder:
case HistoryObject:
return createIndex(0, 0, (qint32) MyRoot);
+
case ParamObject:
return createIndex(0, 0, (qint32) ParamsFolder);
case ConstructObject:
return createIndex(1, 0, (qint32) ConstructFolder);
case BodiesObject:
return createIndex(2, 0, (qint32) BodiesFolder);
+ case GroupObject:
+ return createIndex(3, 0, (qint32) GroupsFolder);
}
return QModelIndex();
}
case ParamsFolder:
case ConstructFolder:
case BodiesFolder:
+ case GroupsFolder:
return ObjectPtr();
+
case ParamObject:
return partDocument()->object(ModelAPI_ResultParameters::group(), theIndex.row());
case ConstructObject:
return partDocument()->object(ModelAPI_ResultConstruction::group(), theIndex.row());
case BodiesObject:
return partDocument()->object(ModelAPI_ResultBody::group(), theIndex.row());
+ case GroupObject:
+ return partDocument()->object(ModelAPI_ResultGroup::group(), theIndex.row());
case HistoryObject:
- return partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - 3);
+ return partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - 4);
}
return ObjectPtr();
}
return createIndex(1, 0, (qint32) ConstructFolder);
if (theGroup.compare(ModelAPI_ResultBody::group()) == 0)
return createIndex(2, 0, (qint32) BodiesFolder);
+ if (theGroup.compare(ModelAPI_ResultGroup::group()) == 0)
+ return createIndex(3, 0, (qint32) GroupsFolder);
return QModelIndex();
}
return createIndex(aRow, 0, (qint32) ConstructObject);
else if (aGroup == ModelAPI_ResultBody::group())
return createIndex(aRow, 0, (qint32) BodiesObject);
+ else if (aGroup == ModelAPI_ResultGroup::group())
+ return createIndex(aRow, 0, (qint32) GroupObject);
else
- return createIndex(aRow + 3, 0, (qint32) HistoryObject);
+ return createIndex(aRow + 4, 0, (qint32) HistoryObject);
}
return aIndex;
}