X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_SmoothingDlg.cxx;h=8902fd5ab53fdb3bff74260f654ce1fd3128ef97;hb=ccde869e079e5502930d8b04f2b229ee500779cb;hp=ef8eb7f463863227cba116d8ac024313713f556e;hpb=d303154d91eb916a55ac93a372cbdb918aa18d14;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx index ef8eb7f46..8902fd5ab 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx @@ -72,6 +72,7 @@ #include #include #include +#include // IDL includes #include @@ -105,6 +106,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) /***************************************************************/ GroupConstructors = new QGroupBox(tr("SMESH_SMOOTHING"), this); + QButtonGroup* ButtonGroup = new QButtonGroup(this); QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors); GroupConstructorsLayout->setSpacing(SPACING); GroupConstructorsLayout->setMargin(MARGIN); @@ -113,7 +115,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) Constructor1->setIcon(image0); Constructor1->setChecked(true); GroupConstructorsLayout->addWidget(Constructor1); - GroupConstructorsLayout->addStretch(); + ButtonGroup->addButton(Constructor1, 0); /***************************************************************/ GroupArguments = new QGroupBox(tr("SMESH_ARGUMENTS"), this); @@ -121,6 +123,8 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) GroupArgumentsLayout->setSpacing(SPACING); GroupArgumentsLayout->setMargin(MARGIN); + myIdValidator = new SMESHGUI_IdValidator(this); + // Controls for elements selection TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments); @@ -128,7 +132,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) SelectElementsButton->setIcon(image1); LineEditElements = new QLineEdit(GroupArguments); - LineEditElements->setValidator(new SMESHGUI_IdValidator(this)); + LineEditElements->setValidator(myIdValidator); // Control for the whole mesh selection CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments); @@ -140,7 +144,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) SelectNodesButton->setIcon(image1); LineEditNodes = new QLineEdit(GroupArguments); - LineEditNodes->setValidator(new SMESHGUI_IdValidator(this)); + LineEditNodes->setValidator(myIdValidator); // Controls for method selection TextLabelMethod = new QLabel(tr("METHOD"), GroupArguments); @@ -181,7 +185,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); @@ -307,8 +311,7 @@ void SMESHGUI_SmoothingDlg::ClickOnApply() if (mySMESHGUI->isActiveStudyLocked()) return; - if (myNbOkElements && - (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) { + if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) { QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts); QStringList aListNodesId = LineEditNodes->text().split(" ", QString::SkipEmptyParts); @@ -319,7 +322,7 @@ void SMESHGUI_SmoothingDlg::ClickOnApply() for (int i = 0; i < aListElementsId.count(); i++) anElementsId[i] = aListElementsId[i].toInt(); - if (myNbOkNodes) { + if ( myNbOkNodes && aListNodesId.count() > 0 ) { aNodesId->length(aListNodesId.count()); for (int i = 0; i < aListNodesId.count(); i++) aNodesId[i] = aListNodesId[i].toInt(); @@ -336,15 +339,15 @@ void SMESHGUI_SmoothingDlg::ClickOnApply() bool aResult = false; try { + SUIT_OverrideCursor aWaitCursor; SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - QApplication::setOverrideCursor(Qt::WaitCursor); + if ( CheckBoxParametric->isChecked() ) aResult = aMeshEditor->SmoothParametric(anElementsId.inout(), aNodesId.inout(), anIterationLimit, aMaxAspectRatio, aMethod); else aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(), anIterationLimit, aMaxAspectRatio, aMethod); - QApplication::restoreOverrideCursor(); } catch (...) { } @@ -488,7 +491,6 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument() if (myBusy) return; // clear - myActor = 0; QString aString = ""; myBusy = true; @@ -497,6 +499,7 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument() myNbOkElements = 0; buttonOk->setEnabled(false); buttonApply->setEnabled(false); + myActor = 0; } myBusy = false; @@ -581,6 +584,9 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument() myBusy = true; myEditCurrentArgument->setText(aString); + myEditCurrentArgument->repaint(); + myEditCurrentArgument->setEnabled(false); // to update lineedit IPAL 19809 + myEditCurrentArgument->setEnabled(true); myBusy = false; // OK @@ -589,7 +595,7 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument() else if (myEditCurrentArgument == LineEditNodes) myNbOkNodes = true; - if (myNbOkElements) { + if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) { buttonOk->setEnabled(true); buttonApply->setEnabled(true); } @@ -614,17 +620,21 @@ void SMESHGUI_SmoothingDlg::SetEditCurrentArgument() myEditCurrentArgument = LineEditElements; SMESH::SetPointRepresentation(false); if (CheckBoxMesh->isChecked()) { - mySelectionMgr->setSelectionModes(ActorSelection); - mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); + // mySelectionMgr->setSelectionModes(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); + mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); } else { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(CellSelection); + aViewWindow->SetSelectionMode(FaceSelection); } - } else if (send == SelectNodesButton) { + } else if (send == SelectNodesButton) { + LineEditNodes->clear(); myEditCurrentArgument = LineEditNodes; SMESH::SetPointRepresentation(true); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) { aViewWindow->SetSelectionMode(NodeSelection); + } } myEditCurrentArgument->setFocus(); @@ -664,7 +674,7 @@ void SMESHGUI_SmoothingDlg::ActivateThisDialog() mySMESHGUI->SetActiveDialogBox(this); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(CellSelection); + aViewWindow->SetSelectionMode(FaceSelection); SelectionIntoArgument(); } @@ -718,13 +728,17 @@ void SMESHGUI_SmoothingDlg::onSelectMesh (bool toSelectMesh) SMESH::SetPointRepresentation(false); if (toSelectMesh) { - mySelectionMgr->setSelectionModes(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); + // mySelectionMgr->setSelectionModes(ActorSelection); mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); LineEditElements->setReadOnly(true); + LineEditElements->setValidator(0); } else { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(CellSelection); + aViewWindow->SetSelectionMode(FaceSelection); LineEditElements->setReadOnly(false); + LineEditElements->setValidator(myIdValidator); onTextChange(LineEditElements->text()); }