StdMeshersGUI_SubShapeSelectorWdg
::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent ):
QWidget( parent ),
- myPreviewActor( 0 )
+ myPreviewActor( 0 ),
+ myMaxSize( 0 )
{
QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
setLayout( edgesLayout );
setMinimumWidth( 300 );
- myMaxSize = 1000;
mySubShType = TopAbs_EDGE;
init();
QString aMainFatherEntry = "";
TopoDS_Shape shape;
if ( !CORBA::is_nil( aGeomFatherObj ) ) {
- // Get Main Shape
- GEOM::GEOM_Object_var aGeomMain = GetGeomObjectByEntry( myEntry );
- if ( !CORBA::is_nil( aGeomMain ) && aGeomMain->GetType() == 37 ) { // Main Shape is a Group
- GEOM::GEOM_Object_ptr aMainFatherObj = aGeomMain->GetMainShape();
- if ( !CORBA::is_nil( aMainFatherObj ) )
- aMainFatherEntry = aMainFatherObj->GetStudyEntry();
- }
- aFatherEntry = aGeomFatherObj->GetStudyEntry();
+ // Get Main Shape
+ GEOM::GEOM_Object_var aGeomMain = GetGeomObjectByEntry( myEntry );
+ if ( !CORBA::is_nil( aGeomMain ) && aGeomMain->GetType() == 37 ) { // Main Shape is a Group
+ GEOM::GEOM_Object_ptr aMainFatherObj = aGeomMain->GetMainShape();
+ if ( !CORBA::is_nil( aMainFatherObj ) )
+ aMainFatherEntry = aMainFatherObj->GetStudyEntry();
+ }
+ aFatherEntry = aGeomFatherObj->GetStudyEntry();
}
if ( aFatherEntry != "" && ( aFatherEntry == myEntry || aFatherEntry == aMainFatherEntry ) ) {
- if ( aGeomObj->GetType() == 37 /*GEOM_GROUP*/ ) { // Selected Group that belongs the main object
- GEOMBase::GetShape(aGeomObj, shape);
- if ( !shape.IsNull() ) {
- TopExp_Explorer exp( shape, mySubShType );
- for ( ; exp.More(); exp.Next() ) {
- int index = myPreviewActor->GetIndexByShape( exp.Current() );
- if ( index ) {
- mySelectedIDs.append( index );
- myPreviewActor->HighlightID( index );
- }
- }
- }
- } else if ( aGeomObj->GetType() == 28 /*GEOM_SUBSHAPE*/ ) {
- GEOMBase::GetShape(aGeomObj, shape);
- if ( !shape.IsNull() && shape.ShapeType() == mySubShType ) {
- int index = myPreviewActor->GetIndexByShape( shape );
- if ( index ) {
- mySelectedIDs.append( index );
- myPreviewActor->HighlightID( index );
- }
- }
- }
+ if ( aGeomObj->GetType() == 37 /*GEOM_GROUP*/ ) { // Selected Group that belongs the main object
+ GEOMBase::GetShape(aGeomObj, shape);
+ if ( !shape.IsNull() ) {
+ TopExp_Explorer exp( shape, mySubShType );
+ for ( ; exp.More(); exp.Next() ) {
+ int index = myPreviewActor->GetIndexByShape( exp.Current() );
+ if ( index ) {
+ mySelectedIDs.append( index );
+ myPreviewActor->HighlightID( index );
+ }
+ }
+ }
+ } else if ( aGeomObj->GetType() == 28 /*GEOM_SUBSHAPE*/ ) {
+ GEOMBase::GetShape(aGeomObj, shape);
+ if ( !shape.IsNull() && shape.ShapeType() == mySubShType ) {
+ int index = myPreviewActor->GetIndexByShape( shape );
+ if ( index ) {
+ mySelectedIDs.append( index );
+ myPreviewActor->HighlightID( index );
+ }
+ }
+ }
}
} else { // Selected Actor from Actor Collection
QString anEntry = IO->getEntry();
anEntry.remove(0, index+1);
int ind = anEntry.toInt();
if ( ind )
- mySelectedIDs.append( ind );
+ mySelectedIDs.append( ind );
}
}
}
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) );
}
}
onListSelectionChanged();
-
myListWidget->blockSignals( false );
-
- if( myListOfIDs.size() >= myMaxSize )
- myAddButton->setEnabled( false );
+ myAddButton->setEnabled( myListOfIDs.size() < myMaxSize );
}
-
+
//=================================================================================
// function : onRemove()
// purpose : Called when Remove Button Clicked
anArray->length( size );
if ( size ) {
for (int i = 0; i < size; i++) {
- anArray[i] = myListOfIDs.at(i);
+ anArray[i] = myListOfIDs.at(i);
}
}
return anArray;