From: dmv Date: Fri, 13 Nov 2009 11:42:28 +0000 (+0000) Subject: Correct implementation of maximum subshapes limiter X-Git-Tag: V5_1_3rc3~7 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=0bc45464bc2b9df024488628e9d465887dab82fb Correct implementation of maximum subshapes limiter --- diff --git a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx index ba9bd7e3e..65b99514e 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx @@ -82,7 +82,8 @@ StdMeshersGUI_SubShapeSelectorWdg ::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent ): QWidget( parent ), - myPreviewActor( 0 ) + myPreviewActor( 0 ), + myMaxSize( 0 ) { QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) ); @@ -105,7 +106,6 @@ StdMeshersGUI_SubShapeSelectorWdg setLayout( edgesLayout ); setMinimumWidth( 300 ); - myMaxSize = 1000; mySubShType = TopAbs_EDGE; init(); @@ -270,7 +270,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::onAdd() return; myListWidget->blockSignals( true ); - for (int i = 0; i < mySelectedIDs.size(); i++) { + for (int i = 0; i < mySelectedIDs.size() && (myMaxSize < 1 || myListOfIDs.size() < myMaxSize); i++) { if ( myListOfIDs.indexOf( mySelectedIDs.at(i) ) == -1 ) { QString anID = QString(" %1").arg( mySelectedIDs.at(i) ); @@ -281,11 +281,8 @@ void StdMeshersGUI_SubShapeSelectorWdg::onAdd() } } onListSelectionChanged(); - myListWidget->blockSignals( false ); - - if( myListOfIDs.size() >= myMaxSize ) - myAddButton->setEnabled( false ); + myAddButton->setEnabled( myListOfIDs.size() < myMaxSize ); } //=================================================================================