1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : SMESHGUI_MergeNodesDlg.cxx
25 // Author : Michael ZORIN
29 #include "SMESHGUI_MergeNodesDlg.h"
32 #include "SMESHGUI_Utils.h"
33 #include "SMESHGUI_VTKUtils.h"
34 #include "SMESHGUI_IdValidator.h"
35 #include "SMESHGUI_SpinBox.h"
37 #include "SMESH_Actor.h"
38 #include "SMESH_TypeFilter.hxx"
39 #include "SMDS_Mesh.hxx"
43 #include "SUIT_ResourceMgr.h"
44 #include "SUIT_Session.h"
45 #include "SUIT_MessageBox.h"
47 #include "LightApp_Application.h"
49 #include "SVTK_ViewModel.h"
50 #include "SVTK_ViewWindow.h"
51 #include "SVTK_Selector.h"
52 #include "SVTK_Selection.h"
53 #include "SALOME_ListIO.hxx"
55 #include "utilities.h"
58 #include <TColStd_MapOfInteger.hxx>
61 #include <qapplication.h>
62 #include <qbuttongroup.h>
63 #include <qgroupbox.h>
65 #include <qlineedit.h>
67 #include <qlistview.h>
68 #include <qpushbutton.h>
69 #include <qradiobutton.h>
70 #include <qcheckbox.h>
77 //=================================================================================
78 // class : SMESHGUI_MergeNodesDlg()
80 //=================================================================================
81 SMESHGUI_MergeNodesDlg::SMESHGUI_MergeNodesDlg( SMESHGUI* theModule, const char* name,
82 bool modal, WFlags fl)
83 : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
84 WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
85 mySMESHGUI( theModule ),
86 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
88 QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_MERGE_NODES")));
89 QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
92 setName("SMESHGUI_MergeNodesDlg");
94 setCaption(tr("SMESH_MERGE_NODES"));
95 setSizeGripEnabled(TRUE);
96 SMESHGUI_MergeNodesDlgLayout = new QGridLayout(this);
97 SMESHGUI_MergeNodesDlgLayout->setSpacing(6);
98 SMESHGUI_MergeNodesDlgLayout->setMargin(11);
100 /***************************************************************/
101 GroupConstructors = new QButtonGroup(this, "GroupConstructors");
102 GroupConstructors->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5,
103 (QSizePolicy::SizeType)0, 0, 0,
104 GroupConstructors->sizePolicy().hasHeightForWidth()));
105 GroupConstructors->setTitle(tr("SMESH_MERGE_NODES" ));
106 GroupConstructors->setExclusive(TRUE);
107 GroupConstructors->setColumnLayout(0, Qt::Vertical);
108 GroupConstructors->layout()->setSpacing(0);
109 GroupConstructors->layout()->setMargin(0);
110 GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
111 GroupConstructorsLayout->setAlignment(Qt::AlignTop);
112 GroupConstructorsLayout->setSpacing(6);
113 GroupConstructorsLayout->setMargin(11);
114 QHBoxLayout* RBLayout = new QHBoxLayout(0, 0, 6, "Layout2");
115 RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1");
116 RadioButton1->setText(tr("" ));
117 RadioButton1->setPixmap(image0);
118 RBLayout->addWidget(RadioButton1);
119 GroupConstructorsLayout->addLayout(RBLayout, 0, 0);
120 SMESHGUI_MergeNodesDlgLayout->addWidget(GroupConstructors, 0, 0);
122 /***************************************************************/
123 GroupButtons = new QGroupBox(this, "GroupButtons");
124 GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7,
125 (QSizePolicy::SizeType)0, 0, 0,
126 GroupButtons->sizePolicy().hasHeightForWidth()));
127 GroupButtons->setGeometry(QRect(10, 10, 281, 48));
128 GroupButtons->setTitle(tr("" ));
129 GroupButtons->setColumnLayout(0, Qt::Vertical);
130 GroupButtons->layout()->setSpacing(0);
131 GroupButtons->layout()->setMargin(0);
132 GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
133 GroupButtonsLayout->setAlignment(Qt::AlignTop);
134 GroupButtonsLayout->setSpacing(6);
135 GroupButtonsLayout->setMargin(11);
136 buttonHelp = new QPushButton(GroupButtons, "buttonHelp");
137 buttonHelp->setText(tr("SMESH_BUT_HELP" ));
138 buttonHelp->setAutoDefault(TRUE);
139 GroupButtonsLayout->addWidget(buttonHelp, 0, 4);
140 buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
141 buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
142 buttonCancel->setAutoDefault(TRUE);
143 GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
144 buttonApply = new QPushButton(GroupButtons, "buttonApply");
145 buttonApply->setText(tr("SMESH_BUT_APPLY" ));
146 buttonApply->setAutoDefault(TRUE);
147 GroupButtonsLayout->addWidget(buttonApply, 0, 1);
148 QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
149 GroupButtonsLayout->addItem(spacer_9, 0, 2);
150 buttonOk = new QPushButton(GroupButtons, "buttonOk");
151 buttonOk->setText(tr("SMESH_BUT_OK" ));
152 buttonOk->setAutoDefault(TRUE);
153 buttonOk->setDefault(TRUE);
154 GroupButtonsLayout->addWidget(buttonOk, 0, 0);
155 SMESHGUI_MergeNodesDlgLayout->addWidget(GroupButtons, 4, 0);
157 /***************************************************************/
159 // Controls for mesh defining
160 GroupMesh = new QGroupBox(this, "GroupMesh");
161 GroupMesh->setTitle(tr("SMESH_MESH"));
162 GroupMesh->setColumnLayout(0, Qt::Vertical);
163 GroupMesh->layout()->setSpacing(0);
164 GroupMesh->layout()->setMargin(0);
165 GroupMeshLayout = new QGridLayout(GroupMesh->layout());
166 GroupMeshLayout->setAlignment(Qt::AlignTop);
167 GroupMeshLayout->setSpacing(6);
168 GroupMeshLayout->setMargin(11);
170 TextLabelName = new QLabel(GroupMesh, "TextLabelName");
171 TextLabelName->setText(tr("SMESH_NAME"));
172 GroupMeshLayout->addWidget(TextLabelName, 0, 0);
174 SelectMeshButton = new QPushButton(GroupMesh, "SelectMeshButton");
175 SelectMeshButton->setPixmap(image1);
176 GroupMeshLayout->addWidget(SelectMeshButton, 0, 1);
178 LineEditMesh = new QLineEdit(GroupMesh, "LineEditMesh");
179 LineEditMesh->setReadOnly(true);
180 GroupMeshLayout->addWidget(LineEditMesh, 0, 2);
182 SMESHGUI_MergeNodesDlgLayout->addWidget(GroupMesh, 1, 0);
184 // Controls for coincident nodes detecting
185 GroupCoincident = new QGroupBox(this, "GroupCoincident");
186 GroupCoincident->setTitle(tr("COINCIDENT_NODES"));
187 GroupCoincident->setColumnLayout(0, Qt::Vertical);
188 GroupCoincident->layout()->setSpacing(0);
189 GroupCoincident->layout()->setMargin(0);
190 QGridLayout* GroupCoincidentLayout = new QGridLayout(GroupCoincident->layout());
191 GroupCoincidentLayout->setAlignment(Qt::AlignTop);
192 GroupCoincidentLayout->setSpacing(6);
193 GroupCoincidentLayout->setMargin(11);
195 TextLabelTolerance = new QLabel(GroupCoincident, "TextLabelTolerance");
196 TextLabelTolerance->setText(tr("SMESH_TOLERANCE"));
197 GroupCoincidentLayout->addWidget(TextLabelTolerance, 0, 0);
199 SpinBoxTolerance = new SMESHGUI_SpinBox(GroupCoincident, "SpinBoxTolerance");
200 GroupCoincidentLayout->addWidget(SpinBoxTolerance, 0, 1);
202 QPushButton* DetectButton = new QPushButton(GroupCoincident, "DetectButton");
203 DetectButton->setText(tr("DETECT"));
204 GroupCoincidentLayout->addWidget(DetectButton, 0, 2);
206 ListCoincident = new QListView(GroupCoincident);
207 ListCoincident->setSorting(-1);
208 ListCoincident->addColumn("Nodes");
209 ListCoincident->header()->hide();
211 GroupCoincidentLayout->addMultiCellWidget(ListCoincident, 1, 1, 0, 1);
213 SelectAllCB = new QCheckBox(GroupCoincident, "SelectAllCB");
214 SelectAllCB->setText(tr("SELECT_ALL"));
215 GroupCoincidentLayout->addWidget(SelectAllCB, 2, 0);
217 SMESHGUI_MergeNodesDlgLayout->addWidget(GroupCoincident, 2, 0);
219 // Controls for editing group of nodes
220 GroupEdit = new QGroupBox(this, "GroupEdit");
221 GroupEdit->setTitle(tr("EDIT_GROUP_OF_NODES"));
222 GroupEdit->setColumnLayout(0, Qt::Vertical);
223 GroupEdit->layout()->setSpacing(0);
224 GroupEdit->layout()->setMargin(0);
225 QGridLayout* GroupEditLayout = new QGridLayout(GroupEdit->layout());
226 GroupEditLayout->setAlignment(Qt::AlignTop);
227 GroupEditLayout->setSpacing(6);
228 GroupEditLayout->setMargin(11);
230 ListEdit = new QListBox(GroupEdit, "ListEdit");
231 ListEdit->setColumnMode(QListBox::FitToHeight);
232 ListEdit->setSelectionMode(QListBox::Extended);
233 GroupEditLayout->addMultiCellWidget(ListEdit, 0, 2, 0, 0);
235 QPushButton* AddButton = new QPushButton(GroupEdit, "AddButton");
236 AddButton->setText(tr("SMESH_BUT_ADD"));
237 GroupEditLayout->addWidget(AddButton, 0, 1);
239 QPushButton* RemoveButton = new QPushButton(GroupEdit, "RemoveButton");
240 RemoveButton->setText(tr("SMESH_BUT_REMOVE"));
241 GroupEditLayout->addWidget(RemoveButton, 1, 1);
243 QSpacerItem* spacer = new QSpacerItem(20, 200, QSizePolicy::Minimum, QSizePolicy::Expanding);
244 GroupEditLayout->addItem(spacer, 2, 1);
246 SMESHGUI_MergeNodesDlgLayout->addWidget(GroupEdit, 3, 0);
248 /* Initialisations */
249 SpinBoxTolerance->RangeStepAndValidator(0.0, 999999.999, 0.1, 3);
250 SpinBoxTolerance->SetValue(1e-05);
252 RadioButton1->setChecked(TRUE);
254 myEditCurrentArgument = (QWidget*)LineEditMesh;
258 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
260 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
262 myMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
264 /* signals and slots connections */
265 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
266 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
267 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
268 connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
270 connect(SelectMeshButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
271 connect(DetectButton, SIGNAL (clicked()), this, SLOT(onDetect()));
272 connect(ListCoincident, SIGNAL (selectionChanged()), this, SLOT(onSelectNodesGroup()));
273 connect(ListCoincident, SIGNAL (pressed(QListViewItem*)), this, SLOT(updateControls()));
274 connect(ListCoincident, SIGNAL (currentChanged(QListViewItem*)), this, SLOT(updateControls()));
275 connect(SelectAllCB, SIGNAL(toggled(bool)), this, SLOT(onSelectAll(bool)));
276 connect(ListEdit, SIGNAL (selectionChanged()), this, SLOT(onSelectNodesFromGroup()));
277 connect(AddButton, SIGNAL (clicked()), this, SLOT(onAdd()));
278 connect(RemoveButton, SIGNAL (clicked()), this, SLOT(onRemove()));
280 connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
281 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
282 /* to close dialog if study change */
283 connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
285 this->show(); /* displays Dialog */
288 buttonOk->setEnabled(false);
289 buttonApply->setEnabled(false);
291 // Init Mesh field from selection
292 SelectionIntoArgument();
294 myHelpFileName = "/files/merging_nodes.htm";
297 //=================================================================================
298 // function : ~SMESHGUI_MergeNodesDlg()
299 // purpose : Destroys the object and frees any allocated resources
300 //=================================================================================
301 SMESHGUI_MergeNodesDlg::~SMESHGUI_MergeNodesDlg()
303 // no need to delete child widgets, Qt does it all for us
306 //=================================================================================
307 // function : ClickOnApply()
309 //=================================================================================
310 bool SMESHGUI_MergeNodesDlg::ClickOnApply()
312 if (mySMESHGUI->isActiveStudyLocked() || myMesh->_is_nil())
316 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
318 QApplication::setOverrideCursor(Qt::waitCursor);
319 SMESH::array_of_long_array_var aGroupsOfNodes = new SMESH::array_of_long_array;
320 aGroupsOfNodes->length(ListCoincident->childCount());
321 QListViewItem* item = ListCoincident->firstChild();
325 QStringList aListIds = QStringList("");
326 if (((QCheckListItem*) item)->isOn())
327 aListIds = QStringList::split(" ", item->text(0), false);
329 SMESH::long_array_var anIds = new SMESH::long_array;
330 anIds->length(aListIds.count());
332 for (int i = 0; i < aListIds.count(); i++)
333 anIds[i] = aListIds[i].toInt();
335 aGroupsOfNodes[anArrayNum++] = anIds.inout();
337 item = item->itemBelow();
340 aMeshEditor->MergeNodes (aGroupsOfNodes.inout());
341 QApplication::restoreOverrideCursor();
345 //mySelectionMgr->clearSelected();
352 //=================================================================================
353 // function : ClickOnOk()
355 //=================================================================================
356 void SMESHGUI_MergeNodesDlg::ClickOnOk()
362 //=================================================================================
363 // function : ClickOnCancel()
365 //=================================================================================
366 void SMESHGUI_MergeNodesDlg::ClickOnCancel()
368 mySelectionMgr->clearFilters();
369 //mySelectionMgr->clearSelected();
370 SMESH::SetPointRepresentation(false);
371 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
372 aViewWindow->SetSelectionMode(ActorSelection);
373 disconnect(mySelectionMgr, 0, this, 0);
374 mySMESHGUI->ResetState();
378 //=================================================================================
379 // function : ClickOnHelp()
381 //=================================================================================
382 void SMESHGUI_MergeNodesDlg::ClickOnHelp()
384 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
386 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
390 platform = "winapplication";
392 platform = "application";
394 SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
395 QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
396 arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
397 QObject::tr("BUT_OK"));
401 //=================================================================================
402 // function : onEditNodesGroup()
404 //=================================================================================
405 void SMESHGUI_MergeNodesDlg::onEditNodesGroup()
407 if (ListCoincident->childCount() < 1)
410 QString aNewIds = "";
412 QListBoxItem* anItem;
413 for (anItem = ListEdit->firstItem(); anItem != 0; anItem = anItem->next())
414 aNewIds+=QString(" %1").arg(anItem->text());
416 ListCoincident->currentItem()->setText(0, aNewIds);
419 //=================================================================================
420 // function : updateControls()
422 //=================================================================================
423 void SMESHGUI_MergeNodesDlg::updateControls()
425 if (ListCoincident->childCount() < 1) {
426 SMESH::SetPointRepresentation(false);
427 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
428 aViewWindow->SetSelectionMode(ActorSelection);
432 bool hasChecked = false, hasUnchecked = false;
434 QListViewItem* item = ListCoincident->firstChild();
436 while (item && (!hasChecked || !hasUnchecked)) {
437 if (((QCheckListItem*) item)->isOn())
442 item = item->itemBelow();
446 SelectAllCB->setChecked(false);
448 bool enable = !(myMesh->_is_nil()) && hasChecked;
450 buttonOk->setEnabled(enable);
451 buttonApply->setEnabled(enable);
454 //=================================================================================
455 // function : onDetect()
457 //=================================================================================
458 void SMESHGUI_MergeNodesDlg::onDetect()
460 if (myMesh->_is_nil())
464 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
466 QApplication::setOverrideCursor(Qt::waitCursor);
467 ListCoincident->clear();
470 SMESH::array_of_long_array_var aNodeGroups;
471 aMeshEditor->FindCoincidentNodes(SpinBoxTolerance->GetValue(), aNodeGroups);
473 for (int i = 0; i < aNodeGroups->length(); i++) {
474 SMESH::long_array& aGroup = aNodeGroups[i];
477 for (int j = 0; j < aGroup.length(); j++)
478 aNodeIds+=QString(" %1").arg(aGroup[j]);
480 new QCheckListItem (ListCoincident, aNodeIds, QCheckListItem::CheckBox);
482 QApplication::restoreOverrideCursor();
489 //=================================================================================
490 // function : onSelectNodesGroup()
492 //=================================================================================
493 void SMESHGUI_MergeNodesDlg::onSelectNodesGroup()
498 myEditCurrentArgument = (QWidget*)ListCoincident;
500 QListViewItem* aSelectedItem = ListCoincident->selectedItem();
504 QStringList aListId = QStringList::split(" ", aSelectedItem->text(0), false);
507 ListEdit->insertStringList(aListId);
509 //mySelectionMgr->clearSelected();
510 //mySelectionMgr->AddIObject(myActor->getIO());
512 aList.Append(myActor->getIO());
513 mySelectionMgr->setSelectedObjects(aList, false);
515 SMESH::SetPointRepresentation(true);
516 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
517 aViewWindow->SetSelectionMode(NodeSelection);
519 ListEdit->selectAll(true);
522 //=================================================================================
523 // function : onSelectAll()
525 //=================================================================================
526 void SMESHGUI_MergeNodesDlg::onSelectAll (bool isToggled)
530 QListViewItem* item = ListCoincident->firstChild();
533 if (!((QCheckListItem*) item)->isOn())
534 ((QCheckListItem*) item)->setOn(true);
535 item = item->itemBelow();
539 buttonOk->setEnabled(true);
540 buttonApply->setEnabled(true);
545 //=================================================================================
546 // function : onSelectNodesFromGroup()
548 //=================================================================================
549 void SMESHGUI_MergeNodesDlg::onSelectNodesFromGroup()
554 TColStd_MapOfInteger aIndexes;
555 QListBoxItem* anItem;
556 for (anItem = ListEdit->firstItem(); anItem != 0; anItem = anItem->next()) {
557 if (anItem->isSelected()) {
558 int anId = anItem->text().toInt();
563 mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, false);
565 aList.Append(myActor->getIO());
566 mySelectionMgr->setSelectedObjects(aList);
569 //=================================================================================
570 // function : onAdd()
572 //=================================================================================
573 void SMESHGUI_MergeNodesDlg::onAdd()
578 QString aListStr = "";
581 aNbNnodes = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aListStr);
585 QStringList aNodes = QStringList::split(" ", aListStr);
586 QListBoxItem* anItem = 0;
588 for (QStringList::iterator it = aNodes.begin(); it != aNodes.end(); ++it) {
589 anItem = ListEdit->findItem(*it, Qt::ExactMatch);
591 anItem = new QListBoxText(*it);
592 ListEdit->insertItem(anItem);
594 ListEdit->setSelected(anItem, true);
600 //=================================================================================
601 // function : onRemove()
603 //=================================================================================
604 void SMESHGUI_MergeNodesDlg::onRemove()
606 if (myEditCurrentArgument != (QWidget*)ListCoincident)
609 for (int i = ListEdit->count(); i > 0; i--) {
610 if (ListEdit->isSelected(i-1))
611 ListEdit->removeItem(i-1);
616 //=================================================================================
617 // function : SetEditCurrentArgument()
619 //=================================================================================
620 void SMESHGUI_MergeNodesDlg::SetEditCurrentArgument()
622 QPushButton* send = (QPushButton*)sender();
624 disconnect(mySelectionMgr, 0, this, 0);
625 mySelectionMgr->clearSelected();
626 mySelectionMgr->clearFilters();
628 if (send == SelectMeshButton) {
629 myEditCurrentArgument = (QWidget*)LineEditMesh;
630 SMESH::SetPointRepresentation(false);
631 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
632 aViewWindow->SetSelectionMode(ActorSelection);
633 mySelectionMgr->installFilter(myMeshOrSubMeshFilter);
636 myEditCurrentArgument->setFocus();
637 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
638 SelectionIntoArgument();
641 //=================================================================================
642 // function : SelectionIntoArgument()
643 // purpose : Called when selection as changed or other case
644 //=================================================================================
645 void SMESHGUI_MergeNodesDlg::SelectionIntoArgument()
647 if (myEditCurrentArgument == (QWidget*)LineEditMesh) {
648 QString aString = "";
649 LineEditMesh->setText(aString);
651 ListCoincident->clear();
654 int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
659 mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
661 Handle(SALOME_InteractiveObject) IO = aList.First();
662 myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
663 myActor = SMESH::FindActorByEntry(aList.First()->getEntry());
664 if (myMesh->_is_nil() || !myActor)
667 LineEditMesh->setText(aString);
671 //=================================================================================
672 // function : DeactivateActiveDialog()
674 //=================================================================================
675 void SMESHGUI_MergeNodesDlg::DeactivateActiveDialog()
677 if (GroupConstructors->isEnabled()) {
678 GroupConstructors->setEnabled(false);
679 GroupMesh->setEnabled(false);
680 GroupCoincident->setEnabled(false);
681 GroupEdit->setEnabled(false);
682 GroupButtons->setEnabled(false);
683 mySMESHGUI->ResetState();
684 mySMESHGUI->SetActiveDialogBox(0);
688 //=================================================================================
689 // function : ActivateThisDialog()
691 //=================================================================================
692 void SMESHGUI_MergeNodesDlg::ActivateThisDialog()
694 /* Emit a signal to deactivate the active dialog */
695 mySMESHGUI->EmitSignalDeactivateDialog();
696 GroupConstructors->setEnabled(true);
697 GroupMesh->setEnabled(true);
698 GroupCoincident->setEnabled(true);
699 GroupEdit->setEnabled(true);
700 GroupButtons->setEnabled(true);
702 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
704 SelectionIntoArgument();
707 //=================================================================================
708 // function : enterEvent()
710 //=================================================================================
711 void SMESHGUI_MergeNodesDlg::enterEvent (QEvent*)
713 if (!GroupConstructors->isEnabled())
714 ActivateThisDialog();
717 //=================================================================================
718 // function : closeEvent()
720 //=================================================================================
721 void SMESHGUI_MergeNodesDlg::closeEvent (QCloseEvent*)
723 /* same than click on cancel button */
727 //=======================================================================
728 //function : hideEvent()
729 //purpose : caused by ESC key
730 //=======================================================================
731 void SMESHGUI_MergeNodesDlg::hideEvent (QHideEvent*)