From 93ed31b34ee8468729519da9b4c64fbcb3515eab Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Wed, 1 Mar 2017 11:59:13 +0100 Subject: [PATCH] clear PyQt selection on close study --- .../SALOME_PYQT_ModuleLight.cxx | 2 ++ .../SALOME_PYQT_GUILight/SALOME_PYQT_Selector.cxx | 15 +++++++++++++++ .../SALOME_PYQT_GUILight/SALOME_PYQT_Selector.h | 1 + 3 files changed, 18 insertions(+) diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.cxx index 80f3e8ea0..9e53d0350 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_ModuleLight.cxx @@ -180,6 +180,8 @@ void SALOME_PYQT_ModuleLight::onModelClosed() { // call helper myHelper->modelClosed(application()->activeStudy()); + if (mySelector) + mySelector->clear(); LightApp_Module::onModelClosed(); } diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_Selector.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_Selector.cxx index 0a2d61f8f..84e6e641c 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_Selector.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_Selector.cxx @@ -51,6 +51,10 @@ SALOME_PYQT_Selector::SALOME_PYQT_Selector(SALOME_PYQT_ModuleLight* pymod, SUIT_ SUIT_Selector(mgr, pymod), myPyModule(pymod) { MESSAGE("constructor"); + myLocalEntries.clear(); + mySelectedList.clear(); + myEntries.clear(); + myModifiedTime = 0; if (myPyModule) { connect(myPyModule, SIGNAL(localSelectionChanged()), this, SLOT(onSelectionChanged())); @@ -66,6 +70,17 @@ SALOME_PYQT_Selector::~SALOME_PYQT_Selector() MESSAGE("destructor"); } +/*! + \brief Reset selection internally. Used on close study. + */ +void SALOME_PYQT_Selector::clear() +{ + MESSAGE("clear"); + myLocalEntries.clear(); + mySelectedList.clear(); + myEntries.clear(); +} + /*! \brief Get Python module interface instance. \return a pointer to the Python module interface instance. diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_Selector.h b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_Selector.h index 36ef872b5..97b894684 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_Selector.h +++ b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_Selector.h @@ -54,6 +54,7 @@ public: unsigned long getModifiedTime() const; void setModified(); void setLocalEntries(const QStringList& entries) { myLocalEntries = entries; }; + void clear(); private slots: void onSelectionChanged(); -- 2.39.2