issue 22082 note 017956. Hide controls of Filter dialog useless for creating the Group on filter

Hide "Insert filter in viewer" and "Source" button group.
This commit is contained in:
eap 2014-08-14 18:56:38 +04:00
parent 7e9e8a237d
commit ce9a69a9b8
3 changed files with 43 additions and 13 deletions

View File

@ -2654,7 +2654,9 @@ SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( SMESHGUI* theModule,
: 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();
@ -2671,7 +2673,9 @@ SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( SMESHGUI* theModule,
: 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();
@ -2730,6 +2734,7 @@ QWidget* SMESHGUI_FilterDlg::createMainFrame (QWidget* theParent)
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);
@ -3215,6 +3220,21 @@ void SMESHGUI_FilterDlg::SetSourceWg (QWidget* theWg,
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
@ -3397,8 +3417,10 @@ void SMESHGUI_FilterDlg::insertFilterInViewer()
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 {
@ -3423,7 +3445,7 @@ void SMESHGUI_FilterDlg::filterSource (const int theType,
int aSourceId = mySourceGrp->checkedId();
if (aSourceId == Mesh)
if (aSourceId == Mesh || !myDiffSourcesEnabled )
{
if (myMesh->_is_nil())
return;

View File

@ -229,6 +229,7 @@ public:
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();
@ -297,6 +298,8 @@ private:
SVTK_Selector* mySelector;
SMESH::SMESH_Mesh_var myMesh;
bool myInitSourceWgOnApply;
bool myInsertEnabled;
bool myDiffSourcesEnabled;
QWidget* mySourceWg;
SALOME_DataMapOfIOMapOfInteger myIObjects;

View File

@ -447,16 +447,17 @@ void SMESHGUI_GroupDlg::initDialog( bool create)
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()));
@ -1648,7 +1649,7 @@ void SMESHGUI_GroupDlg::onSelectGroup(bool on)
//=================================================================================
// 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)
{
@ -1659,7 +1660,7 @@ 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();
}
@ -1747,10 +1748,14 @@ void SMESHGUI_GroupDlg::setFilters()
myFilterDlg->Init( aType );
}
bool isStandalone = ( sender() == myFilterBtn );
myFilterDlg->SetEnabled( /*setInViewer=*/isStandalone,
/*diffSources=*/isStandalone );
myFilterDlg->SetMesh( myMesh );
myFilterDlg->SetSelection();
myFilterDlg->SetSourceWg( myElements, false );
myFilterDlg->show();
}