From: vsv Date: Thu, 29 Dec 2016 10:03:08 +0000 (+0300) Subject: Issue #1900: Clear cashed index on document closing X-Git-Tag: V_2.7.0~351^2~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8644d537dd64b34dbc042390f2fc3754c10eab9f;p=modules%2Fshaper.git Issue #1900: Clear cashed index on document closing --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index fc24193b8..a092bbe68 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -578,6 +578,7 @@ bool PartSet_Module::isSketchNeutralPointActivated() const void PartSet_Module::closeDocument() { + myActivePartIndex = QModelIndex(); clearViewer(); } @@ -1229,12 +1230,12 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess SessionPtr aMgr = ModelAPI_Session::get(); DocumentPtr aActiveDoc = aMgr->activeDocument(); - if (aActivePartIndex.isValid()) - aTreeView->setExpanded(aActivePartIndex, false); + if (myActivePartIndex.isValid()) + aTreeView->setExpanded(myActivePartIndex, false); XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel(); - aActivePartIndex = aDataModel->documentRootIndex(aActiveDoc); - if (aActivePartIndex.isValid()) - aTreeView->setExpanded(aActivePartIndex, true); + myActivePartIndex = aDataModel->documentRootIndex(aActiveDoc); + if (myActivePartIndex.isValid()) + aTreeView->setExpanded(myActivePartIndex, true); aLabel->setPalette(aPalet); aWorkshop->updateCommandStatus(); diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 06fdf458c..91338d132 100755 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -424,7 +424,7 @@ private: /// backup of the visible state to restore them by operation stop QMap myHasConstraintShown; - QModelIndex aActivePartIndex; + QModelIndex myActivePartIndex; }; #endif diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index 5a628eefe..6bf061dcf 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -77,6 +77,7 @@ XGUI_DataModel::XGUI_DataModel(QObject* theParent) : QAbstractItemModel(theParen XGUI_DataModel::~XGUI_DataModel() { + clear(); } //****************************************************** @@ -317,7 +318,8 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess //****************************************************** void XGUI_DataModel::clear() { - + beginResetModel(); + endResetModel(); } //******************************************************