Correct implementation of Max Subshape limiter.

This commit is contained in:
dmv 2010-03-01 14:00:46 +00:00
parent 99c3d13441
commit 12cb4bfcdd

View File

@ -83,7 +83,7 @@ StdMeshersGUI_SubShapeSelectorWdg
::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent ): ::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent ):
QWidget( parent ), QWidget( parent ),
myPreviewActor( 0 ), myPreviewActor( 0 ),
myMaxSize( 0 ) myMaxSize( -1 )
{ {
QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) ); QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
@ -270,7 +270,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::onAdd()
return; return;
myListWidget->blockSignals( true ); myListWidget->blockSignals( true );
for (int i = 0; i < mySelectedIDs.size() && (myMaxSize < 1 || myListOfIDs.size() < myMaxSize); i++) { for (int i = 0; i < mySelectedIDs.size() && (myMaxSize == -1 || myListOfIDs.size() < myMaxSize); i++) {
if ( myListOfIDs.indexOf( mySelectedIDs.at(i) ) == -1 ) { if ( myListOfIDs.indexOf( mySelectedIDs.at(i) ) == -1 ) {
QString anID = QString(" %1").arg( mySelectedIDs.at(i) ); QString anID = QString(" %1").arg( mySelectedIDs.at(i) );
@ -282,7 +282,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::onAdd()
} }
onListSelectionChanged(); onListSelectionChanged();
myListWidget->blockSignals( false ); myListWidget->blockSignals( false );
myAddButton->setEnabled( myListOfIDs.size() < myMaxSize ); myAddButton->setEnabled( myMaxSize == -1 || myListOfIDs.size() < myMaxSize );
} }
//================================================================================= //=================================================================================