myListBox->setSelectionMode( QListBox::Extended );
myListBox->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding) );
// myListBox->setColumnMode( QListBox::FitToHeight );
+ myListBox->installEventFilter( this );
myFilterBtn = new QPushButton( tr( "FILTER" ) , aFrame );
myAddBtn = new QPushButton( tr( "ADD" ) , aFrame );
// name : SMESHGUI_MultiEditDlg::isValid
// Purpose : Verify validity of input data
//=======================================================================
-bool SMESHGUI_MultiEditDlg::isValid( const bool /*theMess*/ ) const
+bool SMESHGUI_MultiEditDlg::isValid( const bool /*theMess*/ )
{
+ SMESH::long_array_var anIds = getIds();
return (!myMesh->_is_nil() &&
- (myListBox->count() > 0 || (myToAllChk->isChecked() && myActor)));
+ (myListBox->count() > 0 || (myToAllChk->isChecked() && myActor)) && anIds->length() > 0);
}
//=======================================================================
}
}
+//=======================================================================
+// name : SMESHGUI_MultiEditDlg::eventFilter
+// Purpose : event filter
+//=======================================================================
+bool SMESHGUI_MultiEditDlg::eventFilter( QObject* object, QEvent* event )
+{
+ if ( object == myListBox && event->type() == QEvent::KeyPress ) {
+ QKeyEvent* ke = (QKeyEvent*)event;
+ if ( ke->key() == Key_Delete )
+ onRemoveBtn();
+ }
+ return QDialog::eventFilter( object, event );
+}
+
//=======================================================================
// name : SMESHGUI_MultiEditDlg::Init
// Purpose : Init dialog fields, connect signals and slots, show dialog
connect( myListBox, SIGNAL( selectionChanged() ), SLOT( onListSelectionChanged() ) );
- onSelectionDone();
+ int nbSel = mySelection->IObjectCount();
+ if ( nbSel == 1 )
+ myIO = mySelection->firstIObject();
// set selection mode
setSelectionMode();
+
+ // process selection
+ //onSelectionDone();
+
updateButtons();
}
if ( nbSel == 1 ) {
myActor = SMESH::FindActorByEntry(mySelection->firstIObject()->getEntry());
- if ( !myActor && !myMesh->_is_nil() )
- myActor = SMESH::FindActorByObject( myMesh );
+ //if ( !myActor && !myMesh->_is_nil() )
+ // myActor = SMESH::FindActorByObject( myMesh );
VTKViewer_InteractorStyleSALOME* aStyle = SMESH::GetInteractorStyle();
Handle(VTKViewer_Filter) aFilter = aStyle->GetFilter( myFilterType );
- if ( !aFilter.IsNull() && myActor ) {
- aFilter->SetActor( myActor );
- //SMESH::SetPickable( myActor );
+ if ( myActor ) {
+ if ( !aFilter.IsNull() ) {
+ aFilter->SetActor( myActor );
+ //SMESH::SetPickable( myActor );
+ myIO = myActor->getIO();
+ }
+ }
+ else {
+ myIO.Nullify();
}
}
myBusy = false;
emit ListContensChanged();
- updateButtons();
setSelectionMode();
- if ( myActor )
- mySelection->AddIObject( myActor->getIO(), true );
+ //if ( !myIO.IsNull() )
+ //mySelection->AddIObject( myIO, true );
+ updateButtons();
}
else
SMESH::SetFilter( new SMESHGUI_FacesFilter() );
}
+ if ( !myIO.IsNull() )
+ mySelection->AddIObject( myIO, true );
}
//=======================================================================
emit ListContensChanged();
- updateButtons();
-
if ( type )
myFilterType = SMESHGUI_VolumeFilter;
else
myFilterType = SMESHGUI_FaceFilter;
setSelectionMode();
- myActor = 0;
+ updateButtons();
+
+ //myActor = 0;
}
}
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
-class QCloseEvent;
class SMESHGUI_FilterDlg;
class QCheckBox;
class QGroupBox;
class SMESH_Actor;
class SALOME_Actor;
class QButtonGroup;
+class QObject;
/*
Class : SMESHGUI_MultiEditDlg
void Init( SALOME_Selection* ) ;
+ bool eventFilter( QObject* object, QEvent* event );
+
signals:
void ListContensChanged();
void hideEvent ( QHideEvent * ); /* ESC key */
QFrame* createButtonFrame( QWidget* );
QFrame* createMainFrame ( QWidget*, const bool );
- bool isValid( const bool ) const;
+ bool isValid( const bool );
SMESH::long_array_var getIds();
void updateButtons();
void setSelectionMode();
Handle(SMESH_TypeFilter) myGroupFilter;
bool myBusy;
int myEntityType;
+ Handle(SALOME_InteractiveObject) myIO;
};
/*