#include <ModelAPI_Attribute.h>
#include <ModelAPI_AttributeRefAttr.h>
#include <ModelAPI_ResultParameter.h>
+#include <ModelAPI_Tools.h>
#include <GeomDataAPI_Point2D.h>
#include <Events_Error.h>
return TopAbs_SHAPE;
}
-void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter)
+void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter, bool& hasSubFeature)
{
hasResult = false;
hasFeature = false;
hasParameter = false;
+ hasSubFeature = false;
foreach(ObjectPtr aObj, theObjects) {
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
hasResult = (aResult.get() != NULL);
hasFeature = (aFeature.get() != NULL);
hasParameter = (aConstruction.get() != NULL);
- if (hasFeature && hasResult && hasParameter)
+ if (hasFeature)
+ hasSubFeature = (ModelAPI_Tools::compositeOwner(aFeature) != NULL);
+ if (hasFeature && hasResult && hasParameter && hasSubFeature)
break;
}
}
\param hasResult will be set to true if list contains Result objects
\param hasFeature will be set to true if list contains Feature objects
\param hasParameter will be set to true if list contains Parameter objects
+\param hasSubFeature will be set to true if list contains Sub-Feature objects
*/
-MODULEBASE_EXPORT void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter);
+MODULEBASE_EXPORT void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter, bool& hasSubFeature);
}
#endif
{
if (theIndex.column() != 1)
return;
+ if (flags(theIndex) == 0)
+ return;
QTreeView* aTreeView = dynamic_cast<QTreeView*>(sender());
if ((theIndex.internalId() >= PartsFolder) && (theIndex.internalId() <= PartResult)) {
if (myActivePartModel)
bool hasResult = false;
bool hasFeature = false;
bool hasParameter = false;
- ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter);
+ bool hasSubFeature = false;
+ ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter, hasSubFeature);
ObjectPtr aObject = aObjects.first();
if (aObject) {
Qt::ItemFlags PartSet_PartDataModel::flags(const QModelIndex& theIndex) const
{
+ // Disable sub-features at column 1
+ if ((theIndex.column() == 1) && (theIndex.internalId() >= 0))
+ return 0;
+
Qt::ItemFlags aFlags = Qt::ItemIsSelectable;
if (object(theIndex)) {
aFlags |= Qt::ItemIsEditable;
}
+
if (theIndex.internalId() == HistoryObject) {
if (theIndex.row() <= lastHistoryRow() || (theIndex.column() == 1))
aFlags |= Qt::ItemIsEnabled;
bool hasResult = false;
bool hasFeature = false;
bool hasParameter = false;
- ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter);
+ bool hasSubFeature = false;
+ ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter, hasSubFeature);
//Process Feature
if (aSelected == 1) {
action("WIREFRAME_CMD")->setEnabled(true);
}
}
- if (hasFeature || hasParameter)
- action("DELETE_CMD")->setEnabled(true);
+ if (!hasSubFeature) {
+ if (hasFeature || hasParameter)
+ action("DELETE_CMD")->setEnabled(true);
+ }
}
if (myWorkshop->canChangeColor())
action("COLOR_CMD")->setEnabled(true);
bool hasResult = false;
bool hasFeature = false;
bool hasParameter = false;
- ModuleBase_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter);
+ bool hasSubFeature = false;
+ ModuleBase_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter, hasSubFeature);
if (!(hasFeature || hasParameter))
return;