From: jfa Date: Fri, 25 May 2007 13:09:01 +0000 (+0000) Subject: Fix bug 16041: IOLS. Regression with selection. X-Git-Tag: V4_0~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=05b41b48ecb1c9289d69d626ea1ced64444d6788;p=modules%2Fvisu.git Fix bug 16041: IOLS. Regression with selection. --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 36251fa5..95c9fa52 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -2694,7 +2694,6 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); SALOME_ListIO aListIO; aSelectionMgr->selectedObjects(aListIO); - mySelectedObjects = aListIO; if (aListIO.Extent() < 1) return; @@ -3358,13 +3357,6 @@ VisuGUI return myScalarBarsMap; } -void -VisuGUI -::selectedObjects( SALOME_ListIO& theList ) const -{ - theList = mySelectedObjects; -} - LightApp_Displayer* VisuGUI::displayer() { if( !myDisplayer ) diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 8205d4e2..c0c9834d 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -77,8 +77,6 @@ public: VISU::TViewToPrs3d& getScalarBarsMap(); - - void selectedObjects( SALOME_ListIO& theList ) const; public slots: virtual bool deactivateModule( SUIT_Study* ); @@ -185,7 +183,6 @@ private: private: LightApp_Displayer* myDisplayer; - SALOME_ListIO mySelectedObjects; VISU::TViewToPrs3d myScalarBarsMap; }; diff --git a/src/VISUGUI/VisuGUI_InputPane.cxx b/src/VISUGUI/VisuGUI_InputPane.cxx index fb1c77d4..1ee34f36 100644 --- a/src/VISUGUI/VisuGUI_InputPane.cxx +++ b/src/VISUGUI/VisuGUI_InputPane.cxx @@ -84,7 +84,9 @@ VisuGUI_InputPane::VisuGUI_InputPane( VISU::VISUType theType, { setFrameStyle( QFrame::NoFrame ); - connect( VISU::GetSelectionMgr( theModule ), SIGNAL( selectionChanged() ), SLOT( onSelectionChanged() ) ); + LightApp_SelectionMgr* aSelectionMgr = VISU::GetSelectionMgr(theModule); + + connect( aSelectionMgr, SIGNAL( selectionChanged() ), SLOT( onSelectionChanged() ) ); QGridLayout* aMainLayout = new QGridLayout( this, 1, 1, 11, 6 ); @@ -202,6 +204,9 @@ VisuGUI_InputPane::VisuGUI_InputPane( VISU::VISUType theType, connect( myAddButton, SIGNAL(clicked()), this, SLOT(onAdd())); connect( myRemoveButton, SIGNAL(clicked()), this, SLOT(onRemove())); + // Save current selection (to be restored in destructor) + aSelectionMgr->selectedObjects(mySavedSelection); + onTypeChanged(); onSelectionChanged(); @@ -214,11 +219,16 @@ VisuGUI_InputPane::VisuGUI_InputPane( VISU::VISUType theType, //--------------------------------------------------------------- VisuGUI_InputPane::~VisuGUI_InputPane() { - if( myFieldFilter ) + LightApp_SelectionMgr* aSelectionMgr = VISU::GetSelectionMgr(myModule); + + if (myFieldFilter) { - VISU::GetSelectionMgr( myModule )->removeFilter( myFieldFilter ); + aSelectionMgr->removeFilter(myFieldFilter); delete myFieldFilter; } + + // Restore initial selection + aSelectionMgr->setSelectedObjects(mySavedSelection); } diff --git a/src/VISUGUI/VisuGUI_InputPane.h b/src/VISUGUI/VisuGUI_InputPane.h index e5e3fb30..47a0cf8c 100644 --- a/src/VISUGUI/VisuGUI_InputPane.h +++ b/src/VISUGUI/VisuGUI_InputPane.h @@ -30,6 +30,8 @@ #include "VISUConfig.hh" +#include "SALOME_ListIO.hxx" + #include class QCheckBox; @@ -103,6 +105,7 @@ private: int myEntity; VisuGUI_FieldFilter* myFieldFilter; + SALOME_ListIO mySavedSelection; }; #endif diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index 0ae3d9d1..abf4cdb9 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -85,7 +85,6 @@ namespace VISU QApplication::restoreOverrideCursor(); } delete aDlg; - RestoreSelection(theModule); } } @@ -289,11 +288,10 @@ namespace VISU if (!GetViewWindow(theModule)) return; - TPrs3d_i* aPrs3d = CreateAndEditPrs3d + //TPrs3d_i* aPrs3d = + CreateAndEditPrs3d (theModule,theTimeStampSObj,thePublishInStudyMode); - RestoreSelection(theModule); - theModule->application()->putInfo(QObject::tr("INF_DONE")); } diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index a4246b58..97bbd189 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -418,24 +418,6 @@ namespace VISU theSelectionMgr->setSelectedObjects(aNewListIO); } - //------------------------------------------------------------ - //! Restores selection after presentation creating and editing - void - RestoreSelection(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d) - { - SALOME_ListIO aList; - theModule->selectedObjects(aList); - - if( thePrs3d ) - { - Handle(SALOME_InteractiveObject) anIO = thePrs3d->GetIO(); - aList.Append(anIO); - } - - LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule); - aSelectionMgr->setSelectedObjects(aList); - } - /*! * \brief Check, if "Delete" popup-menu can be put on current selection * diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index 901e4d21..b1e55a5f 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -130,8 +130,6 @@ namespace VISU void Remove(LightApp_SelectionMgr* theSelectionMgr, const Handle(SALOME_InteractiveObject)& theIO); - void RestoreSelection(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d = NULL); - bool IsRemovableSelected(const SalomeApp_Module* theModule); void DeleteSObject(VisuGUI* theModule,