From 8644d537dd64b34dbc042390f2fc3754c10eab9f Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 29 Dec 2016 13:03:08 +0300 Subject: [PATCH] Issue #1900: Clear cashed index on document closing --- src/PartSet/PartSet_Module.cpp | 11 ++++++----- src/PartSet/PartSet_Module.h | 2 +- src/XGUI/XGUI_DataModel.cpp | 4 +++- 3 files changed, 10 insertions(+), 7 deletions(-) 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(); } //****************************************************** -- 2.30.2