Hide "Insert filter in viewer" and "Source" button group.
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
- myInitSourceWgOnApply( true )
+ myInitSourceWgOnApply( true ),
+ myInsertEnabled( true ),
+ myDiffSourcesEnabled( true )
{
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
mySelector = aViewWindow->GetSelector();
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
- myInitSourceWgOnApply( true )
+ myInitSourceWgOnApply( true ),
+ myInsertEnabled( true ),
+ myDiffSourcesEnabled( true )
{
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
mySelector = aViewWindow->GetSelector();
int rows = aLay->rowCount();
int cols = aLay->columnCount();
+ // This line looks strange when all additional parameters and mySetInViewer are hidden
QFrame* aLine = new QFrame(aGrp);
aLine->setFrameStyle(QFrame::HLine | QFrame::Sunken);
aLay->addWidget(aLine, rows++, 0, 1, cols);
myInitSourceWgOnApply = initOnApply;
}
+//=======================================================================
+//function : EnableFiltering
+//purpose : Enables "Insert filter in the viewer"
+// and different "Source"s (Mesh, Initial Selection, Current Group)
+//=======================================================================
+
+void SMESHGUI_FilterDlg::SetEnabled( bool setInViewer, bool diffSources )
+{
+ myInsertEnabled = setInViewer;
+ myDiffSourcesEnabled = diffSources;
+
+ mySetInViewer->setVisible( myInsertEnabled );
+ mySourceGrp->button(0)->parentWidget()->setVisible( myDiffSourcesEnabled );
+}
+
//=======================================================================
// name : SMESHGUI_FilterDlg::SetMesh
// Purpose : Set mesh
SMESH::ElementType anEntType = (SMESH::ElementType)myTable->GetType();
if (myFilter[ myTable->GetType() ]->_is_nil() ||
- myFilter[ myTable->GetType() ]->GetPredicate()->_is_nil() ||
- !mySetInViewer->isChecked()) {
+ myFilter[ myTable->GetType() ]->GetPredicate()->_is_nil() ||
+ !mySetInViewer->isChecked() ||
+ !myInsertEnabled )
+ {
SMESH::RemoveFilter(getFilterId(anEntType), aSelector);
}
else {
int aSourceId = mySourceGrp->checkedId();
- if (aSourceId == Mesh)
+ if (aSourceId == Mesh || !myDiffSourcesEnabled )
{
if (myMesh->_is_nil())
return;
void SetSelection();
void SetMesh (SMESH::SMESH_Mesh_var);
void SetSourceWg( QWidget*, const bool initOnApply = true );
+ void SetEnabled( bool setInViewer, bool diffSources );
static SMESH::Filter::Criterion createCriterion();
SVTK_Selector* mySelector;
SMESH::SMESH_Mesh_var myMesh;
bool myInitSourceWgOnApply;
+ bool myInsertEnabled;
+ bool myDiffSourcesEnabled;
QWidget* mySourceWg;
SALOME_DataMapOfIOMapOfInteger myIObjects;
mySMESHGUI->SetActiveDialogBox(this);
mySMESHGUI->SetState(800);
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( mySMESHGUI->application()->activeStudy() );
mySelectionMode = grpNoSelection;
- myMeshFilter = new SMESH_TypeFilter(SMESH::MESH);
+
+ myMeshFilter = new SMESH_TypeFilter(SMESH::MESH);
mySubMeshFilter = new SMESH_LogicalFilter(QList<SUIT_SelectionFilter*>(),
SMESH_LogicalFilter::LO_OR,
/*takeOwnership=*/true);
- myGroupFilter = new SMESH_LogicalFilter(QList<SUIT_SelectionFilter*>(),
- SMESH_LogicalFilter::LO_OR,
- /*takeOwnership=*/true);
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( mySMESHGUI->application()->activeStudy() );
- myGeomFilter = new GEOM_SelectionFilter( aStudy, true );
+ myGroupFilter = new SMESH_LogicalFilter(QList<SUIT_SelectionFilter*>(),
+ SMESH_LogicalFilter::LO_OR,
+ /*takeOwnership=*/true);
+ myGeomFilter = new GEOM_SelectionFilter( aStudy, true );
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onDeactivate()));
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject()));
//=================================================================================
// function : (onSelectGeomGroup)
-// purpose : Called when group type changed. on == "on group" or "on filter"
+// purpose : Called when group type changed. on == "on geometry" or "on filter"
//=================================================================================
void SMESHGUI_GroupDlg::onSelectGeomGroup(bool on)
{
else if (mySelectGroup->isChecked()) {
mySelectGroup->setChecked(false);
}
- if ( myGrpTypeId == 1 ) { // on group
+ if ( myGrpTypeId == 1 ) { // on geometry
myCurrentLineEdit = myGeomGroupLine;
updateGeomPopup();
}
myFilterDlg->Init( aType );
}
+ bool isStandalone = ( sender() == myFilterBtn );
+ myFilterDlg->SetEnabled( /*setInViewer=*/isStandalone,
+ /*diffSources=*/isStandalone );
myFilterDlg->SetMesh( myMesh );
myFilterDlg->SetSelection();
myFilterDlg->SetSourceWg( myElements, false );
+
myFilterDlg->show();
}