/// Returns the invalid data pointer (to avoid working with NULL shared ptrs in swig)
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Data> invalidPtr();
+ /// Returns the invalid data pointer: static method
+ static std::shared_ptr<ModelAPI_Data> invalidData();
+
protected:
/// Returns true if "is in history" custom behaviors is defined for the feature
MODEL_EXPORT virtual bool isInHistory();
ModelAPI_EventCreator::get()->sendUpdated(theFeature, anEvent);
theFeature->setDisabled(false); // by default created feature is enabled
updateHistory(ModelAPI_Feature::group());
+ } else { // make feature has not-null data anyway
+ theFeature->setData(Model_Data::invalidData());
}
}
aOB->treeView()->setExpandsOnDoubleClick(false);
connect(aOB->treeView(), SIGNAL(doubleClicked(const QModelIndex&)),
SLOT(onTreeViewDoubleClick(const QModelIndex&)));
- connect(aOB, SIGNAL(headerMouseDblClicked(const QModelIndex&)),
- SLOT(onTreeViewDoubleClick(const QModelIndex&)));
connect(aOB->treeView(), SIGNAL(doubleClicked(const QModelIndex&)),
myDataModel, SLOT(onMouseDoubleClick(const QModelIndex&)));
}
void PartSet_Module::onTreeViewDoubleClick(const QModelIndex& theIndex)
{
- SessionPtr aMgr = ModelAPI_Session::get();
- if (!theIndex.isValid()) {
- aMgr->setActiveDocument(aMgr->moduleDocument());
- return;
- }
if (theIndex.column() != 0) // Use only first column
return;
-
ObjectPtr aObj = myDataModel->object(theIndex);
ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
if (!aPart.get()) { // Probably this is Feature
}
}
if (aPart.get()) { // if this is a part
-
+ SessionPtr aMgr = ModelAPI_Session::get();
if (aPart->partDoc() == aMgr->activeDocument()) {
aMgr->setActiveDocument(aMgr->moduleDocument());
} else {