From: vsr Date: Fri, 20 Feb 2009 15:11:22 +0000 (+0000) Subject: Issue 0019938 - fix problem with wrong filter selection (ptv) X-Git-Tag: V5_1_1a2~24 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7ce6ef7ee96d7287440bfb25bfc82f24fdcb4c06;p=modules%2Fsmesh.git Issue 0019938 - fix problem with wrong filter selection (ptv) --- diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx index a8cffc9e3..a9af10b76 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx @@ -166,8 +166,8 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod ElementsLineEdit = new QLineEdit(GroupArguments); ElementsLineEdit->setValidator(myIdValidator); - QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); - connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); + myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); + connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); // Controls for the whole mesh selection MeshCheck = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments); @@ -276,7 +276,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod GroupArgumentsLayout->addWidget(ElementsLab, 0, 0); GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); GroupArgumentsLayout->addWidget(ElementsLineEdit, 0, 2); - GroupArgumentsLayout->addWidget(filterBtn, 0, 3); + GroupArgumentsLayout->addWidget(myFilterBtn, 0, 3); GroupArgumentsLayout->addWidget(MeshCheck, 1, 0, 1, 4); GroupArgumentsLayout->addWidget(PathGrp, 2, 0, 1, 4); GroupArgumentsLayout->addWidget(BasePointGrp, 3, 0, 1, 4); @@ -1136,6 +1136,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::onSelectMesh() ElementsLineEdit->setValidator(toSelectMesh ? 0 : myIdValidator); ElementsLab->setText(toSelectMesh ? tr("SMESH_NAME") : tr("SMESH_ID_ELEMENTS")); ElementsLineEdit->clear(); + myFilterBtn->setEnabled(!toSelectMesh); SetEditCurrentArgument(SelectElementsButton); } @@ -1237,6 +1238,12 @@ void SMESHGUI_ExtrusionAlongPathDlg::keyPressEvent( QKeyEvent* e ) //================================================================================= void SMESHGUI_ExtrusionAlongPathDlg::setFilters() { + if(myMesh->_is_nil()) { + SUIT_MessageBox::critical(this, + tr("SMESH_ERROR"), + tr("NO_MESH_SELECTED")); + return; + } if ( !myFilterDlg ) { QList types; diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h index 4e1cbcb9c..5d70d6306 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h @@ -140,6 +140,7 @@ private: QString myHelpFileName; + QPushButton* myFilterBtn; SMESHGUI_FilterDlg* myFilterDlg; protected slots: diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx index 0626e4575..8eac1b9eb 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx @@ -164,8 +164,8 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule) LineEditElements = new QLineEdit(GroupArguments); LineEditElements->setValidator(myIdValidator); - QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); - connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); + myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); + connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); // Control for the whole mesh selection CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments); @@ -207,7 +207,7 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule) GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 5); - GroupArgumentsLayout->addWidget(filterBtn, 0, 7); + GroupArgumentsLayout->addWidget(myFilterBtn, 0, 7); GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 8); GroupArgumentsLayout->addWidget(TextLabelDistance, 2, 0); GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2); @@ -784,6 +784,7 @@ void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh) TextLabelElements->setText(tr("SMESH_NAME")); else TextLabelElements->setText(tr("SMESH_ID_ELEMENTS")); + myFilterBtn->setEnabled(!toSelectMesh); if (myEditCurrentArgument != LineEditElements) { LineEditElements->clear(); @@ -850,6 +851,12 @@ void SMESHGUI_ExtrusionDlg::keyPressEvent( QKeyEvent* e ) //================================================================================= void SMESHGUI_ExtrusionDlg::setFilters() { + if(myMesh->_is_nil()) { + SUIT_MessageBox::critical(this, + tr("SMESH_ERROR"), + tr("NO_MESH_SELECTED")); + return; + } if ( !myFilterDlg ) { QList types; diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h index 99468eaa7..8e8a1f9bd 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h @@ -131,6 +131,7 @@ private: QString myHelpFileName; + QPushButton* myFilterBtn; SMESHGUI_FilterDlg* myFilterDlg; private slots: diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index 366af734d..1655c06d8 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -2057,7 +2057,8 @@ SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( SMESHGUI* theModule, const QList& theTypes ) : QDialog( SMESH::GetDesktop( theModule ) ), mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), + myInitSourceWgOnApply( true ) { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) mySelector = aViewWindow->GetSelector(); @@ -2073,7 +2074,8 @@ SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( SMESHGUI* theModule, const int theType ) : QDialog( SMESH::GetDesktop( theModule ) ), mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), + myInitSourceWgOnApply( true ) { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) mySelector = aViewWindow->GetSelector(); @@ -2609,9 +2611,11 @@ bool SMESHGUI_FilterDlg::isValid() const // Purpose : Set widget of parent dialog containing idsto be filtered if // user select corresponding source radio button //======================================================================= -void SMESHGUI_FilterDlg::SetSourceWg (QWidget* theWg) +void SMESHGUI_FilterDlg::SetSourceWg (QWidget* theWg, + const bool initOnApply) { mySourceWg = theWg; + myInitSourceWgOnApply = initOnApply; } //======================================================================= @@ -2637,7 +2641,7 @@ void SMESHGUI_FilterDlg::SetSelection() if (mySelectionMgr) { myIObjects.Clear(); - const SALOME_ListIO& anObjs = mySelector->StoredIObjects(); + const SALOME_ListIO& anObjs = mySelector->StoredIObjects(); SALOME_ListIteratorOfListIO anIter (anObjs); for ( ; anIter.More(); anIter.Next()) { TColStd_IndexedMapOfInteger aMap; @@ -2674,9 +2678,11 @@ bool SMESHGUI_FilterDlg::onApply() if (!myFilter[ aCurrType ]->GetPredicate()->_is_nil()) { QList aResultIds; filterSource(aCurrType, aResultIds); + // select in viewer selectInViewer(aCurrType, aResultIds); } + myInsertState[ aCurrType ] = mySetInViewer->isChecked(); myApplyToState[ aCurrType ] = mySourceGrp->checkedId(); } @@ -2792,10 +2798,10 @@ void SMESHGUI_FilterDlg::filterSource (const int theType, for (anIter = aDialogIds.begin(); anIter != aDialogIds.end(); ++ anIter) if (aPred->IsSatisfy(*anIter)) theResIds.append(*anIter); - - // set ids to the dialog - setIdsToWg(mySourceWg, theResIds); } + // set ids to the dialog + if (myInitSourceWgOnApply || aSourceId == Dialog) + setIdsToWg(mySourceWg, theResIds); } //======================================================================= diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.h b/src/SMESHGUI/SMESHGUI_FilterDlg.h index ed1c95e9d..4380d54d8 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.h +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.h @@ -223,7 +223,7 @@ public: void SetSelection(); void SetMesh (SMESH::SMESH_Mesh_var); - void SetSourceWg( QWidget* ); + void SetSourceWg( QWidget*, const bool initOnApply = true ); static SMESH::Filter::Criterion createCriterion(); @@ -285,6 +285,7 @@ private: LightApp_SelectionMgr* mySelectionMgr; SVTK_Selector* mySelector; SMESH::SMESH_Mesh_var myMesh; + bool myInitSourceWgOnApply; QWidget* mySourceWg; SALOME_DataMapOfIOMapOfInteger myIObjects; diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index 352215c95..63b5d3956 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -1395,6 +1395,13 @@ void SMESHGUI_GroupDlg::setCurrentSelection() //================================================================================= void SMESHGUI_GroupDlg::setFilters() { + if(myMesh->_is_nil()) { + SUIT_MessageBox::critical(this, + tr("SMESH_ERROR"), + tr("NO_MESH_SELECTED")); + return; + } + SMESH::ElementType aType = SMESH::ALL; switch ( myTypeId ) { @@ -1415,7 +1422,7 @@ void SMESHGUI_GroupDlg::setFilters() myFilterDlg->SetSelection(); myFilterDlg->SetMesh( myMesh ); - myFilterDlg->SetSourceWg( myElements ); + myFilterDlg->SetSourceWg( myElements, false ); myFilterDlg->show(); } diff --git a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx index 118d2d17c..7986c2d63 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx @@ -507,6 +507,12 @@ void SMESHGUI_RemoveElementsDlg::keyPressEvent( QKeyEvent* e ) //================================================================================= void SMESHGUI_RemoveElementsDlg::setFilters() { + if(myMesh->_is_nil()) { + SUIT_MessageBox::critical(this, + tr("SMESH_ERROR"), + tr("NO_MESH_SELECTED")); + return; + } if ( !myFilterDlg ) myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL ); diff --git a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx index bf218290a..c511dbae4 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx @@ -514,6 +514,12 @@ void SMESHGUI_RemoveNodesDlg::keyPressEvent( QKeyEvent* e ) //================================================================================= void SMESHGUI_RemoveNodesDlg::setFilters() { + if(myMesh->_is_nil()) { + SUIT_MessageBox::critical(this, + tr("SMESH_ERROR"), + tr("NO_MESH_SELECTED")); + return; + } if ( !myFilterDlg ) myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::NODE ); diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx index 355e01ec3..6003776fb 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx @@ -144,8 +144,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) LineEditElements = new QLineEdit(GroupArguments); LineEditElements->setValidator(myIdValidator); - QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); - connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); + myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); + connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); // Control for the whole mesh selection CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments); @@ -238,7 +238,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); GroupArgumentsLayout->addWidget(LineEditElements, 0, 2); - GroupArgumentsLayout->addWidget(filterBtn, 0, 3); + GroupArgumentsLayout->addWidget(myFilterBtn, 0, 3); GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4); GroupArgumentsLayout->addWidget(GroupAxis, 2, 0, 1, 4); GroupArgumentsLayout->addWidget(GroupAngleBox, 3, 0, 1, 4); @@ -932,6 +932,7 @@ void SMESHGUI_RevolutionDlg::onSelectMesh (bool toSelectMesh) TextLabelElements->setText(tr("SMESH_NAME")); else TextLabelElements->setText(tr("SMESH_ID_ELEMENTS")); + myFilterBtn->setEnabled(!toSelectMesh); if (myEditCurrentArgument != LineEditElements) { LineEditElements->clear(); @@ -1144,6 +1145,12 @@ void SMESHGUI_RevolutionDlg::onSelectVectorMenu( QAction* action){ //================================================================================= void SMESHGUI_RevolutionDlg::setFilters() { + if(myMesh->_is_nil()) { + SUIT_MessageBox::critical(this, + tr("SMESH_ERROR"), + tr("NO_MESH_SELECTED")); + return; + } if ( !myFilterDlg ) { QList types; diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.h b/src/SMESHGUI/SMESHGUI_RevolutionDlg.h index a4c3fc111..028817e98 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.h +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.h @@ -153,6 +153,7 @@ private: QString myHelpFileName; + QPushButton* myFilterBtn; SMESHGUI_FilterDlg* myFilterDlg; private slots: diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx index 1e7010974..4f122537b 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx @@ -133,8 +133,8 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule ) SelectElementsButton->setIcon(image1); LineEditElements = new QLineEdit(GroupArguments); LineEditElements->setValidator(myIdValidator); - QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); - connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); + myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); + connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); // Control for the whole mesh selection CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments); @@ -215,7 +215,7 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule ) GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 1); - GroupArgumentsLayout->addWidget(filterBtn, 0, 3); + GroupArgumentsLayout->addWidget(myFilterBtn, 0, 3); GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4); GroupArgumentsLayout->addWidget(GroupAxis, 2, 0, 1, 4); GroupArgumentsLayout->addWidget(TextLabelAngle, 3, 0, 1, 2); @@ -845,6 +845,7 @@ void SMESHGUI_RotationDlg::onSelectMesh (bool toSelectMesh) TextLabelElements->setText(tr("SMESH_NAME")); else TextLabelElements->setText(tr("SMESH_ID_ELEMENTS")); + myFilterBtn->setEnabled(!toSelectMesh); if (myEditCurrentArgument != LineEditElements) { LineEditElements->clear(); @@ -974,6 +975,12 @@ void SMESHGUI_RotationDlg::keyPressEvent( QKeyEvent* e ) //================================================================================= void SMESHGUI_RotationDlg::setFilters() { + if(myMesh->_is_nil()) { + SUIT_MessageBox::critical(this, + tr("SMESH_ERROR"), + tr("NO_MESH_SELECTED")); + return; + } if ( !myFilterDlg ) myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL ); diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.h b/src/SMESHGUI/SMESHGUI_RotationDlg.h index 4dd572f29..bb743746f 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.h +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.h @@ -131,6 +131,7 @@ private: QString myHelpFileName; + QPushButton* myFilterBtn; SMESHGUI_FilterDlg* myFilterDlg; private slots: diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx index c2144b1f4..955f00795 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx @@ -137,8 +137,8 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) LineEditElements = new QLineEdit(GroupArguments); LineEditElements->setValidator(myIdValidator); - QPushButton* filterElemBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); - connect(filterElemBtn, SIGNAL(clicked()), this, SLOT(setElemFilters())); + myElemFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); + connect(myElemFilterBtn, SIGNAL(clicked()), this, SLOT(setElemFilters())); // Control for the whole mesh selection CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments); @@ -175,7 +175,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); GroupArgumentsLayout->addWidget(LineEditElements, 0, 2); - GroupArgumentsLayout->addWidget(filterElemBtn, 0, 3); + GroupArgumentsLayout->addWidget(myElemFilterBtn, 0, 3); GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4); GroupArgumentsLayout->addWidget(TextLabelNodes, 2, 0); GroupArgumentsLayout->addWidget(SelectNodesButton, 2, 1); @@ -727,6 +727,7 @@ void SMESHGUI_SmoothingDlg::onSelectMesh (bool toSelectMesh) TextLabelElements->setText(tr("SMESH_NAME")); else TextLabelElements->setText(tr("SMESH_ID_ELEMENTS")); + myElemFilterBtn->setEnabled(!toSelectMesh); if (myEditCurrentArgument != LineEditElements && myEditCurrentArgument != LineEditNodes) { @@ -779,6 +780,12 @@ void SMESHGUI_SmoothingDlg::keyPressEvent( QKeyEvent* e ) //================================================================================= void SMESHGUI_SmoothingDlg::setFilters( const bool theIsElem ) { + if(myMesh->_is_nil()) { + SUIT_MessageBox::critical(this, + tr("SMESH_ERROR"), + tr("NO_MESH_SELECTED")); + return; + } if ( !myFilterDlg ) { QList types; diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.h b/src/SMESHGUI/SMESHGUI_SmoothingDlg.h index 40b8170a3..6def01cae 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.h +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.h @@ -116,7 +116,8 @@ private: QCheckBox* CheckBoxParametric; QString myHelpFileName; - + + QPushButton* myElemFilterBtn; SMESHGUI_FilterDlg* myFilterDlg; private slots: diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx index ed49f5217..750ada81d 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx @@ -144,8 +144,8 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule ) SelectElementsButton->setIcon(image3); LineEditElements = new QLineEdit(GroupArguments); LineEditElements->setValidator(myIdValidator); - QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); - connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); + myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); + connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); // Control for the whole mesh selection CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments); @@ -224,7 +224,7 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule ) GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 1); - GroupArgumentsLayout->addWidget(filterBtn, 0, 3); + GroupArgumentsLayout->addWidget(myFilterBtn, 0, 3); GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4); GroupArgumentsLayout->addWidget(GroupMirror, 2, 0, 1, 4); GroupArgumentsLayout->addWidget(ActionBox, 3, 0, 3, 3); @@ -931,6 +931,7 @@ void SMESHGUI_SymmetryDlg::onSelectMesh (bool toSelectMesh) TextLabelElements->setText(tr("SMESH_NAME")); else TextLabelElements->setText(tr("SMESH_ID_ELEMENTS")); + myFilterBtn->setEnabled(!toSelectMesh); if (myEditCurrentArgument != LineEditElements) { LineEditElements->clear(); @@ -1073,6 +1074,12 @@ void SMESHGUI_SymmetryDlg::keyPressEvent( QKeyEvent* e ) //================================================================================= void SMESHGUI_SymmetryDlg::setFilters() { + if(myMesh->_is_nil()) { + SUIT_MessageBox::critical(this, + tr("SMESH_ERROR"), + tr("NO_MESH_SELECTED")); + return; + } if ( !myFilterDlg ) myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL ); diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.h b/src/SMESHGUI/SMESHGUI_SymmetryDlg.h index c56317d0b..1d763eb2e 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.h +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.h @@ -133,6 +133,7 @@ private: QString myHelpFileName; + QPushButton* myFilterBtn; SMESHGUI_FilterDlg* myFilterDlg; private slots: diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx index 091446d10..ff605c657 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx @@ -156,8 +156,8 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule ) SelectElementsButton->setIcon(image2); LineEditElements = new QLineEdit(GroupArguments); LineEditElements->setValidator(myIdValidator); - QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); - connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); + myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); + connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); // Control for the whole mesh selection CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments); @@ -214,7 +214,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule ) GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 5); - GroupArgumentsLayout->addWidget(filterBtn, 0, 7); + GroupArgumentsLayout->addWidget(myFilterBtn, 0, 7); GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 8); GroupArgumentsLayout->addWidget(TextLabel1, 2, 0); GroupArgumentsLayout->addWidget(SelectButton1, 2, 1); @@ -910,6 +910,7 @@ void SMESHGUI_TranslationDlg::onSelectMesh (bool toSelectMesh) TextLabelElements->setText(tr("SMESH_NAME")); else TextLabelElements->setText(tr("SMESH_ID_ELEMENTS")); + myFilterBtn->setEnabled(!toSelectMesh); if (myEditCurrentArgument != LineEditElements) { LineEditElements->clear(); @@ -1021,6 +1022,12 @@ void SMESHGUI_TranslationDlg::keyPressEvent( QKeyEvent* e ) //================================================================================= void SMESHGUI_TranslationDlg::setFilters() { + if(myMesh->_is_nil()) { + SUIT_MessageBox::critical(this, + tr("SMESH_ERROR"), + tr("NO_MESH_SELECTED")); + return; + } if ( !myFilterDlg ) myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL ); diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.h b/src/SMESHGUI/SMESHGUI_TranslationDlg.h index 279ec596b..cfd77378a 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.h +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.h @@ -130,6 +130,7 @@ private: QString myHelpFileName; + QPushButton* myFilterBtn; SMESHGUI_FilterDlg* myFilterDlg; private slots: diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index a93b7d1f6..2ecb18a86 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -2903,6 +2903,10 @@ Consider saving your work before application crash SMESH_DRS_SOME_EMPTY One or more mesh files were empty, data has not been published + + NO_MESH_SELECTED + No mesh selected + SMESHGUI