X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FStdMeshersGUI%2FStdMeshersGUI_SubShapeSelectorWdg.cxx;h=d58a631c61efa44eb8e43c6e1356732cf74e94b8;hp=03eeb40826441d93012ab4ab671c4542983a4bb7;hb=HEAD;hpb=a1920ff31054e2c882bd94d4f3c04abe53980ce0 diff --git a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx index 03eeb4082..5033645c5 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -74,7 +74,8 @@ StdMeshersGUI_SubShapeSelectorWdg ::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent, TopAbs_ShapeEnum subShType, const bool toShowList, - const bool toShowActivateBtn ): + const bool toShowActivateBtn, + const int minListWidth ): QWidget( parent ), myMaxSize( -1 ), myPreviewActor( 0 ) @@ -93,8 +94,8 @@ StdMeshersGUI_SubShapeSelectorWdg myAddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), this ); myRemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this ); myListWidget->setSelectionMode( QListWidget::ExtendedSelection ); - myListWidget->setMinimumWidth(300); - myListWidget->setWrapping(true); + myListWidget->setMinimumWidth( minListWidth ); + myListWidget->setWrapping( true ); myActivateButton->setCheckable( true ); } else @@ -254,6 +255,20 @@ void StdMeshersGUI_SubShapeSelectorWdg::ShowPreview( bool visible) } } +//================================================================================ +/*! + * \brief Connect selection slots + * \param other - another StdMeshersGUI_ObjectReferenceParamWdg + */ +//================================================================================ + +void StdMeshersGUI_SubShapeSelectorWdg:: +AvoidSimultaneousSelection ( StdMeshersGUI_SubShapeSelectorWdg* other) +{ + connect(other, SIGNAL(selectionActivated()), this, SLOT(deactivateSelection())); + connect(this, SIGNAL(selectionActivated()), other, SLOT(deactivateSelection())); +} + //================================================================================ /*! * \brief Connect/disconnect to change of selection @@ -275,7 +290,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::ActivateSelection( bool toActivate ) if ( toActivate ) { - connect( mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(selectionIntoArgument())); + connect( mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(selectionIntoArgument())); } else { @@ -284,6 +299,9 @@ void StdMeshersGUI_SubShapeSelectorWdg::ActivateSelection( bool toActivate ) if ( sender() == myActivateButton ) ShowPreview( toActivate ); + + if ( toActivate ) + emit selectionActivated(); } //================================================================================ @@ -387,6 +405,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::selectionIntoArgument() myAddButton->setEnabled(( myListWidget->count() < myMaxSize || myMaxSize == -1 ) && ( mySelectedIDs.size() > 0 ) && ( mySelectedIDs.size() <= myMaxSize || myMaxSize == -1 ) ); + myRemoveButton->setEnabled( mySelectedIDs.size() > 0 ); //Connect Selected Ids in viewer and dialog's Ids list bool signalsBlocked = myListWidget->blockSignals( true ); @@ -577,16 +596,12 @@ void StdMeshersGUI_SubShapeSelectorWdg::updateState() GEOM::GEOM_Object_var StdMeshersGUI_SubShapeSelectorWdg::GetGeomObjectByEntry( const QString& theEntry ) { GEOM::GEOM_Object_var aGeomObj; - SALOMEDS::Study_var aStudy = SMESHGUI::GetSMESHGen()->GetCurrentStudy(); - if ( !aStudy->_is_nil() ) + SALOMEDS::SObject_var aSObj = SMESH_Gen_i::GetSMESHGen()->getStudyServant()->FindObjectID( theEntry.toUtf8().data() ); + if (!aSObj->_is_nil() ) { - SALOMEDS::SObject_var aSObj = aStudy->FindObjectID( theEntry.toLatin1().data() ); - if (!aSObj->_is_nil() ) - { - CORBA::Object_var obj = aSObj->GetObject(); - aGeomObj = GEOM::GEOM_Object::_narrow(obj); - aSObj->UnRegister(); - } + CORBA::Object_var obj = aSObj->GetObject(); + aGeomObj = GEOM::GEOM_Object::_narrow(obj); + aSObj->UnRegister(); } return aGeomObj._retn(); }