From: mpv Date: Wed, 27 May 2015 15:43:26 +0000 (+0300) Subject: Issue #547 fix: not null data, even for the action features X-Git-Tag: V_1.2.0~47 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7609663e2c64c56d63a327159033778ba24778e5;p=modules%2Fshaper.git Issue #547 fix: not null data, even for the action features --- diff --git a/src/Model/Model_Data.cpp b/src/Model/Model_Data.cpp index 2c973fa3f..0fff37fd7 100644 --- a/src/Model/Model_Data.cpp +++ b/src/Model/Model_Data.cpp @@ -415,3 +415,8 @@ std::shared_ptr Model_Data::invalidPtr() { return kInvalid; } + +std::shared_ptr Model_Data::invalidData() +{ + return kInvalid; +} diff --git a/src/Model/Model_Data.h b/src/Model/Model_Data.h index cf90469ba..38733fb72 100644 --- a/src/Model/Model_Data.h +++ b/src/Model/Model_Data.h @@ -189,6 +189,9 @@ class Model_Data : public ModelAPI_Data /// Returns the invalid data pointer (to avoid working with NULL shared ptrs in swig) MODEL_EXPORT virtual std::shared_ptr invalidPtr(); + /// Returns the invalid data pointer: static method + static std::shared_ptr invalidData(); + protected: /// Returns true if "is in history" custom behaviors is defined for the feature MODEL_EXPORT virtual bool isInHistory(); diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index c53cdc23f..6bab4002b 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -126,6 +126,8 @@ void Model_Objects::addFeature(FeaturePtr theFeature, const FeaturePtr theAfterT 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()); } } diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 7f95d0893..563bd786c 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -657,8 +657,6 @@ void PartSet_Module::customizeObjectBrowser(QWidget* theObjectBrowser) 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&))); } @@ -758,14 +756,8 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess 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(aObj); if (!aPart.get()) { // Probably this is Feature @@ -775,7 +767,7 @@ void PartSet_Module::onTreeViewDoubleClick(const QModelIndex& theIndex) } } if (aPart.get()) { // if this is a part - + SessionPtr aMgr = ModelAPI_Session::get(); if (aPart->partDoc() == aMgr->activeDocument()) { aMgr->setActiveDocument(aMgr->moduleDocument()); } else {