From: nds Date: Tue, 16 May 2017 12:15:13 +0000 (+0300) Subject: Issue #2154 Multiselection field is cleared when trying to add another object X-Git-Tag: V_2.7.1~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e48a505218bd60c250c279e91203df627928ef9a;p=modules%2Fshaper.git Issue #2154 Multiselection field is cleared when trying to add another object 1. EVENT_UPDATE_BY_WIDGET_SELECTION should be flushed after ObjectBrowser updateCommandStatus 2. Synchronization should also happens in ObjectBrowser. Not implemented: deselection of result in Object Browser if an operation is active --- diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 9e9111591..4f1901472 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -275,17 +275,6 @@ bool ModuleBase_WidgetMultiSelector::setSelection(QList //emit valuesChanged(); //} - // Restore selection in the viewer by the attribute selection list - // it is possible that diring selection attribute filling, selection in Object Browser - // is changed(some items were removed/added) and as result, selection in the viewer - // differs from the selection come to this method. By next rows, we restore selection - // in the viewer according to content of selection attribute. Case is Edge selection in Group - myIsSetSelectionBlocked = true; - static Events_ID anEvent = Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION); - ModelAPI_EventCreator::get()->sendUpdated(myFeature, anEvent); - Events_Loop::loop()->flush(anEvent); - myIsSetSelectionBlocked = false; - if (aSelectionListAttr.get()) aSelectionListAttr->cashValues(false); @@ -479,6 +468,29 @@ void ModuleBase_WidgetMultiSelector::updateSelectionName() { } +//******************************************************************** +void ModuleBase_WidgetMultiSelector::updateOnSelectionChanged(const bool theDone) +{ + if (myIsSetSelectionBlocked) + return; + ModuleBase_WidgetSelector::updateOnSelectionChanged(theDone); + + // according to #2154 we need to update OB selection when selection in the viewer happens + // it is important to flush sinchronize selection signal after flush of Update/Create/Delete. + // because we need that Object Browser has been already updated when synchronize happens. + + // Restore selection in the viewer by the attribute selection list + // it is possible that diring selection attribute filling, selection in Object Browser + // is changed(some items were removed/added) and as result, selection in the viewer + // differs from the selection come to this method. By next rows, we restore selection + // in the viewer according to content of selection attribute. Case is Edge selection in Group + myIsSetSelectionBlocked = true; + static Events_ID anEvent = Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION); + ModelAPI_EventCreator::get()->sendUpdated(myFeature, anEvent); + Events_Loop::loop()->flush(anEvent); + myIsSetSelectionBlocked = false; +} + //******************************************************************** QIntList ModuleBase_WidgetMultiSelector::shapeTypes() const { diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index e7713928a..1e28d62ef 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -119,6 +119,10 @@ protected: /// Computes and updates name of selected object in the widget virtual void updateSelectionName(); + /// Emits model changed info, updates the current control by selection change + /// \param theDone a state whether the selection is set + virtual void updateOnSelectionChanged(const bool theDone); + /// Retunrs a list of possible shape types /// \return a list of shapes virtual QIntList shapeTypes() const; diff --git a/src/XGUI/XGUI_ModuleConnector.cpp b/src/XGUI/XGUI_ModuleConnector.cpp index 51358f13c..53cc4a919 100644 --- a/src/XGUI/XGUI_ModuleConnector.cpp +++ b/src/XGUI/XGUI_ModuleConnector.cpp @@ -123,6 +123,8 @@ void XGUI_ModuleConnector::setSelected(const QList& the myWorkshop->selector()->clearSelection(); } else { aDisp->setSelected(theValues); + // according to #2154 we need to update OB selection when selection in the viewer happens + myWorkshop->selector()->onViewerSelection(); } } diff --git a/src/XGUI/XGUI_SelectionMgr.h b/src/XGUI/XGUI_SelectionMgr.h index e13818587..32344dec7 100644 --- a/src/XGUI/XGUI_SelectionMgr.h +++ b/src/XGUI/XGUI_SelectionMgr.h @@ -58,7 +58,7 @@ signals: //! Emited when selection in a one of viewers was changed void selectionChanged(); - private slots: + public slots: /// Reaction on selectio0n in Object browser void onObjectBrowserSelection();