From 0bc45464bc2b9df024488628e9d465887dab82fb Mon Sep 17 00:00:00 2001 From: dmv Date: Fri, 13 Nov 2009 11:42:28 +0000 Subject: [PATCH] Correct implementation of maximum subshapes limiter --- .../StdMeshersGUI_SubShapeSelectorWdg.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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 ); } //================================================================================= -- 2.39.2