1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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, or (at your option) any later version.
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
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File : SMESHGUI_DuplicateNodesDlg.cxx
25 // Author : Michael ZORIN, Open CASCADE S.A.S.
28 #include "SMESHGUI_DuplicateNodesDlg.h"
31 #include "SMESHGUI_Utils.h"
32 #include "SMESHGUI_MeshUtils.h"
33 #include "SMESHGUI_VTKUtils.h"
35 #include <SMESH_TypeFilter.hxx>
37 // SALOME GUI includes
38 #include <SUIT_Session.h>
39 #include <SUIT_ResourceMgr.h>
40 #include <SUIT_Desktop.h>
41 #include <SUIT_MessageBox.h>
42 #include <SUIT_OverrideCursor.h>
44 #include <LightApp_Application.h>
45 #include <LightApp_SelectionMgr.h>
47 #include <SalomeApp_Tools.h>
49 #include <SVTK_ViewWindow.h>
50 #include <SALOME_ListIO.hxx>
51 #include <SALOME_ListIteratorOfListIO.hxx>
54 #include <QApplication>
55 #include <QButtonGroup>
59 #include <QPushButton>
60 #include <QRadioButton>
62 #include <QHBoxLayout>
63 #include <QVBoxLayout>
66 #include <utilities.h>
67 #include <SALOMEDSClient_SObject.hxx>
70 #include <SALOMEconfig.h>
71 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
78 \brief Simple 'busy state' flag locker.
85 //! Constructor. Sets passed boolean flag to \c true.
86 BusyLocker( bool& busy ) : myBusy( busy ) { myBusy = true; }
87 //! Destructor. Clear external boolean flag passed as parameter to the constructor to \c false.
88 ~BusyLocker() { myBusy = false; }
90 bool& myBusy; //! External 'busy state' boolean flag
95 \param theModule Mesh module instance
97 SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule )
98 : QDialog( SMESH::GetDesktop( theModule ) ),
99 mySMESHGUI( theModule ),
100 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
104 setAttribute(Qt::WA_DeleteOnClose, true);
105 setWindowTitle(tr("SMESH_DUPLICATE_TITLE"));
106 setSizeGripEnabled(true);
108 // Icons for the dialog operation modes and selection button
109 SUIT_ResourceMgr* aResMgr = SMESH::GetResourceMgr( mySMESHGUI );
110 QPixmap iconWithoutElem (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_NODES")));
111 QPixmap iconWithElem (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_NODES_WITH_ELEM")));
112 QPixmap iconElemOnly (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_ELEM_ONLY")));
113 QPixmap iconGrpBoundary (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_GROUP_BOUNDARY")));
114 QPixmap iconSelect (aResMgr->loadPixmap("SMESH", tr("ICON_SELECT")));
117 QVBoxLayout* aMainLayout = new QVBoxLayout(this);
118 aMainLayout->setSpacing(SPACING);
119 aMainLayout->setMargin(MARGIN);
121 // Operation modes selector
122 QGroupBox* aConstructorsBox = new QGroupBox(tr("DUPLICATION_MODE"), this);
123 myGroupConstructors = new QButtonGroup(this);
124 QHBoxLayout* aConstructorsBoxLayout = new QHBoxLayout(aConstructorsBox);
125 aConstructorsBoxLayout->setSpacing(SPACING);
126 aConstructorsBoxLayout->setMargin(MARGIN);
128 QRadioButton* aRadioButton1 = new QRadioButton(aConstructorsBox);
129 aRadioButton1->setIcon(iconWithoutElem);
130 QRadioButton* aRadioButton2 = new QRadioButton(aConstructorsBox);
131 aRadioButton2->setIcon(iconWithElem);
132 QRadioButton* aRadioButton3 = new QRadioButton(aConstructorsBox);
133 aRadioButton3->setIcon(iconElemOnly);
134 QRadioButton* aRadioButton4 = new QRadioButton(aConstructorsBox);
135 aRadioButton4->setIcon(iconGrpBoundary);
137 aConstructorsBoxLayout->addWidget(aRadioButton1);
138 aConstructorsBoxLayout->addWidget(aRadioButton2);
139 aConstructorsBoxLayout->addWidget(aRadioButton3);
140 aConstructorsBoxLayout->addWidget(aRadioButton4);
141 myGroupConstructors->addButton(aRadioButton1, 0);
142 myGroupConstructors->addButton(aRadioButton2, 1);
143 myGroupConstructors->addButton(aRadioButton3, 2);
144 myGroupConstructors->addButton(aRadioButton4, 3);
147 myGroupArguments = new QGroupBox(this);
148 QGridLayout* aGroupArgumentsLayout = new QGridLayout(myGroupArguments);
149 aGroupArgumentsLayout->setSpacing(SPACING);
150 aGroupArgumentsLayout->setMargin(MARGIN);
152 myTextLabel1 = new QLabel(myGroupArguments);
153 mySelectButton1 = new QPushButton(myGroupArguments);
154 mySelectButton1->setIcon(iconSelect);
155 myLineEdit1 = new QLineEdit(myGroupArguments);
156 myLineEdit1->setReadOnly(true);
158 myTextLabel2 = new QLabel(myGroupArguments);
159 mySelectButton2 = new QPushButton(myGroupArguments);
160 mySelectButton2->setIcon(iconSelect);
161 myLineEdit2 = new QLineEdit(myGroupArguments);
162 myLineEdit2->setReadOnly(true);
164 myTextLabel3 = new QLabel(myGroupArguments);
165 mySelectButton3 = new QPushButton(myGroupArguments);
166 mySelectButton3->setIcon(iconSelect);
167 myLineEdit3 = new QLineEdit(myGroupArguments);
168 myLineEdit3->setReadOnly(true);
170 myCheckBox1 = new QCheckBox(tr("CONSTRUCT_NEW_GROUP_ELEMENTS"), myGroupArguments);
171 myCheckBox2 = new QCheckBox(tr("CONSTRUCT_NEW_GROUP_NODES"), myGroupArguments);
173 aGroupArgumentsLayout->addWidget(myTextLabel1, 0, 0);
174 aGroupArgumentsLayout->addWidget(mySelectButton1, 0, 1);
175 aGroupArgumentsLayout->addWidget(myLineEdit1, 0, 2);
176 aGroupArgumentsLayout->addWidget(myTextLabel2, 1, 0);
177 aGroupArgumentsLayout->addWidget(mySelectButton2, 1, 1);
178 aGroupArgumentsLayout->addWidget(myLineEdit2, 1, 2);
179 aGroupArgumentsLayout->addWidget(myTextLabel3, 2, 0);
180 aGroupArgumentsLayout->addWidget(mySelectButton3, 2, 1);
181 aGroupArgumentsLayout->addWidget(myLineEdit3, 2, 2);
182 aGroupArgumentsLayout->addWidget(myCheckBox1, 3, 0);
183 aGroupArgumentsLayout->addWidget(myCheckBox2, 4, 0);
184 aGroupArgumentsLayout->setRowStretch(5, 1);
187 QGroupBox* aGroupButtons = new QGroupBox(this);
188 QHBoxLayout* aGroupButtonsLayout = new QHBoxLayout(aGroupButtons);
189 aGroupButtonsLayout->setSpacing(SPACING);
190 aGroupButtonsLayout->setMargin(MARGIN);
192 myButtonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aGroupButtons);
193 myButtonOk->setAutoDefault(true);
194 myButtonOk->setDefault(true);
195 myButtonApply = new QPushButton(tr("SMESH_BUT_APPLY"), aGroupButtons);
196 myButtonApply->setAutoDefault(true);
197 myButtonClose = new QPushButton(tr("SMESH_BUT_CLOSE"), aGroupButtons);
198 myButtonClose->setAutoDefault(true);
199 myButtonHelp = new QPushButton(tr("SMESH_BUT_HELP"), aGroupButtons);
200 myButtonHelp->setAutoDefault(true);
202 aGroupButtonsLayout->addWidget(myButtonOk);
203 aGroupButtonsLayout->addSpacing(10);
204 aGroupButtonsLayout->addWidget(myButtonApply);
205 aGroupButtonsLayout->addSpacing(10);
206 aGroupButtonsLayout->addStretch();
207 aGroupButtonsLayout->addWidget(myButtonClose);
208 aGroupButtonsLayout->addWidget(myButtonHelp);
210 // Add mode selector, arguments and buttons to the main layout
211 aMainLayout->addWidget(aConstructorsBox);
212 aMainLayout->addWidget(myGroupArguments);
213 aMainLayout->addWidget(aGroupButtons);
215 myCheckBox1->setChecked(true);
216 myCheckBox2->setChecked(true);
218 // Initialize the dialog
222 myHelpFileName = "double_nodes_page.html";
224 // Signals and slots connections
225 connect(myGroupConstructors, SIGNAL(buttonClicked(int)), SLOT(onConstructorsClicked(int)));
227 connect(mySelectButton1, SIGNAL (clicked()), this, SLOT(onEditCurrentArgument()));
228 connect(mySelectButton2, SIGNAL (clicked()), this, SLOT(onEditCurrentArgument()));
229 connect(mySelectButton3, SIGNAL (clicked()), this, SLOT(onEditCurrentArgument()));
231 connect(myCheckBox2, SIGNAL(stateChanged(int)), SLOT(updateButtons()));
233 connect(myButtonOk, SIGNAL(clicked()), this, SLOT(onOk()));
234 connect(myButtonClose, SIGNAL(clicked()), this, SLOT(reject()));
235 connect(myButtonApply, SIGNAL(clicked()), this, SLOT(onApply()));
236 connect(myButtonHelp, SIGNAL(clicked()), this, SLOT(onHelp()));
238 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionChanged()));
240 connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(onDeactivate()));
241 connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject()));
247 SMESHGUI_DuplicateNodesDlg::~SMESHGUI_DuplicateNodesDlg()
254 void SMESHGUI_DuplicateNodesDlg::Init()
256 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
258 // Set initial parameters
260 myCurrentLineEdit = myLineEdit1;
266 // Set selection mode
267 mySelectionMgr->installFilter(new SMESH_TypeFilter(SMESH::GROUP));
268 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
269 aViewWindow->SetSelectionMode(ActorSelection);
271 // Set construction mode
272 int operationMode = myGroupConstructors->checkedId();
273 if (operationMode < 0) {
274 // The dialog has been just displayed
276 myGroupConstructors->button(0)->setChecked(true);
278 onConstructorsClicked(operationMode);
282 \brief SLOT called to change the dialog operation mode.
283 \param constructorId id of the radio button in mode selector button group
285 void SMESHGUI_DuplicateNodesDlg::onConstructorsClicked (int constructorId)
288 myLineEdit1->clear();
289 myLineEdit2->clear();
290 myLineEdit3->clear();
296 // Set the first field as current
297 myCurrentLineEdit = myLineEdit1;
298 myCurrentLineEdit->setFocus();
300 switch (constructorId) {
303 // Set text to the group of arguments and to the first two labels
304 myGroupArguments->setTitle(tr("DUPLICATION_WITHOUT_ELEMS"));
305 myTextLabel1->setText(tr("GROUP_NODES_TO_DUPLICATE"));
306 myTextLabel2->setText(tr("GROUP_NODES_TO_REPLACE"));
310 myCheckBox2->setText( tr("CONSTRUCT_NEW_GROUP_NODES"));
312 // Hide the third field
313 myTextLabel2->show();
314 mySelectButton2->show();
316 myTextLabel3->hide();
317 mySelectButton3->hide();
324 // Set text to the group of arguments and to all the labels
325 myGroupArguments->setTitle(tr("DUPLICATION_WITH_ELEMS"));
326 myTextLabel1->setText(tr("GROUP_ELEMS_TO_DUPLICATE"));
327 myTextLabel2->setText(tr("GROUP_NODES_NOT_DUPLICATE"));
328 myTextLabel3->setText(tr("GROUP_ELEMS_TO_REPLACE"));
332 myCheckBox1->setText( tr("CONSTRUCT_NEW_GROUP_ELEMENTS"));
333 myCheckBox2->setText( tr("CONSTRUCT_NEW_GROUP_NODES"));
335 // Show the third field
336 myTextLabel2->show();
337 mySelectButton2->show();
339 myTextLabel3->show();
340 mySelectButton3->show();
347 // Set text to the group of arguments and to all the labels
348 myGroupArguments->setTitle(tr("DUPLICATION_ONLY_ELEMS"));
349 myTextLabel1->setText(tr("GROUP_ELEMS_TO_DUPLICATE"));
352 myCheckBox1->setText( tr("CONSTRUCT_NEW_GROUP_ELEMENTS"));
355 // Hide the second and the third field
356 myTextLabel2->hide();
357 mySelectButton2->hide();
359 myTextLabel3->hide();
360 mySelectButton3->hide();
367 // Set text to the group of arguments and to all the labels
368 myGroupArguments->setTitle(tr("DUPLICATION_GROUP_BOUNDARY"));
369 myTextLabel1->setText(tr("GROUP_VOLUME_GROUPS"));
373 myCheckBox1->setText( tr("CREATE_JOINT_ELEMENTS"));
374 myCheckBox2->setText( tr("ON_ALL_BOUNDARIES"));
376 // Hide the second and the third field
377 myTextLabel2->hide();
378 mySelectButton2->hide();
380 myTextLabel3->hide();
381 mySelectButton3->hide();
387 myGroupArguments->hide();
388 myGroupArguments->show();
389 this->resize(this->sizeHint().width(), this->minimumSizeHint().height());
391 onSelectionChanged();
395 \brief SLOT called to apply changes.
397 bool SMESHGUI_DuplicateNodesDlg::onApply()
399 if ( mySMESHGUI->isActiveStudyLocked() || !isValid() )
402 BusyLocker lock( myBusy );
404 bool toCreateElemGroup = myCheckBox1->isChecked();
405 bool toCreateNodeGroup = myCheckBox2->isChecked();
406 int operationMode = myGroupConstructors->checkedId();
410 SUIT_OverrideCursor aWaitCursor;
411 QStringList anEntryList;
414 SMESH::SMESH_Mesh_var aMesh = myGroups1[0]->GetMesh();
415 SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
417 switch ( operationMode ) {
420 SMESH::ListOfGroups_var g1 = new SMESH::ListOfGroups();
421 g1->length( myGroups1.count() );
422 for ( int i = 0; i < myGroups1.count(); i++ )
423 g1[i] = myGroups1[i];
424 SMESH::ListOfGroups_var g2 = new SMESH::ListOfGroups();
425 g2->length( myGroups2.count() );
426 for ( int i = 0; i < myGroups2.count(); i++ )
427 g2[i] = myGroups2[i];
429 if ( toCreateNodeGroup ) {
430 SMESH::SMESH_GroupBase_var aNewGroup =
431 aMeshEditor->DoubleNodeGroupsNew( g1.in(), g2.in() );
432 result = !CORBA::is_nil( aNewGroup );
435 result = aMeshEditor->DoubleNodeGroups( g1.in(), g2.in() );
441 SMESH::ListOfGroups_var g1 = new SMESH::ListOfGroups();
442 g1->length( myGroups1.count() );
443 for ( int i = 0; i < myGroups1.count(); i++ )
444 g1[i] = myGroups1[i];
445 SMESH::ListOfGroups_var g2 = new SMESH::ListOfGroups();
446 g2->length( myGroups2.count() );
447 for ( int i = 0; i < myGroups2.count(); i++ )
448 g2[i] = myGroups2[i];
449 SMESH::ListOfGroups_var g3 = new SMESH::ListOfGroups();
450 g3->length( myGroups3.count() );
452 for ( int i = 0; i < myGroups3.count(); i++ )
453 g3[i] = myGroups3[i];
454 if ( toCreateElemGroup || toCreateNodeGroup ) {
455 SMESH::ListOfGroups_var aNewGroups =
456 aMeshEditor->DoubleNodeElemGroups2New( g1.in(), g2.in(), g3.in(),
457 toCreateElemGroup, toCreateNodeGroup );
458 result = ( aNewGroups[ !toCreateElemGroup ].in() );
461 result = aMeshEditor->DoubleNodeElemGroups( g1.in(), g2.in(), g3.in() );
469 if ( toCreateElemGroup )
470 groupName = SMESH::UniqueName("DoubleElements");
471 for ( int i = 0; i < myGroups1.count(); i++ )
473 SMESH::SMESH_Group_var group =
474 aMeshEditor->DoubleElements( myGroups1[i], groupName.toLatin1().data() );
475 if ( group->_is_nil() )
477 if ( toCreateElemGroup )
482 if ( _PTR(SObject) so = SMESH::FindSObject( group ))
483 anEntryList.append( so->GetID().c_str() );
490 bool createJointElems = myCheckBox1->isChecked();
491 bool onAllBoundaries = myCheckBox2->isChecked();
493 SMESH::ListOfGroups_var g1 = new SMESH::ListOfGroups();
494 g1->length( myGroups1.count() );
495 for ( int i = 0; i < myGroups1.count(); i++ )
496 g1[i] = myGroups1[i];
498 result = aMeshEditor->DoubleNodesOnGroupBoundaries( g1.in(), createJointElems, onAllBoundaries );
502 } // switch( operationMode )
504 catch (const SALOME::SALOME_Exception& S_ex) {
505 SalomeApp_Tools::QtCatchCorbaException(S_ex);
507 catch ( const std::exception& exc ) {
508 INFOS( "Follow exception was cought:\n\t" << exc.what() );
511 INFOS( "Unknown exception was cought !!!" );
515 SUIT_MessageBox::warning(this,
516 tr("SMESH_WRN_WARNING"),
517 tr("SMESH_OPERATION_FAILED"));
522 mySelectionMgr->clearSelected();
524 SMESHGUI::Modified();
525 mySMESHGUI->updateObjBrowser(true);
527 if ( !anEntryList.isEmpty())
528 if( LightApp_Application* anApp =
529 dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ))
530 anApp->browseObjects( anEntryList, true, false );
532 // Reinitialize the dialog
539 \brief SLOT called to apply changes and close the dialog.
541 void SMESHGUI_DuplicateNodesDlg::onOk()
548 \brief SLOT called to close the dialog.
550 void SMESHGUI_DuplicateNodesDlg::reject()
552 disconnect(mySelectionMgr, 0, this, 0);
553 disconnect(mySMESHGUI, 0, this, 0);
554 mySMESHGUI->ResetState();
555 mySelectionMgr->clearFilters();
560 \brief SLOT called when selection changed.
562 void SMESHGUI_DuplicateNodesDlg::onSelectionChanged()
564 if ( myBusy || !isEnabled() ) return;
566 int operationMode = myGroupConstructors->checkedId();
569 mySelectionMgr->selectedObjects( aList );
570 //int aNbSel = aList.Extent();
572 QList<SMESH::SMESH_GroupBase_var> aGroups;
574 SALOME_ListIteratorOfListIO anIter ( aList );
576 for ( ; anIter.More() && ok; anIter.Next()) {
577 SMESH::SMESH_GroupBase_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>( anIter.Value() );
578 // check group is selected
579 ok = !CORBA::is_nil( aGroup );
580 // check groups of the same mesh are selected
582 SMESH::SMESH_Mesh_var aMesh1;
583 if ( !aGroups.isEmpty() ) aMesh1 = aGroups[0]->GetMesh();
584 SMESH::SMESH_Mesh_var aMesh2 = aGroup->GetMesh();
585 ok = CORBA::is_nil( aMesh1 ) || aMesh1->_is_equivalent( aMesh2 );
587 // check group of proper type is selected
589 SMESH::ElementType aGroupType = aGroup->GetType();
590 switch ( operationMode ) {
592 ok = ( myCurrentLineEdit == myLineEdit1 && aGroupType == SMESH::NODE ) ||
593 ( myCurrentLineEdit == myLineEdit2 && aGroupType != SMESH::NODE );
596 ok = ( myCurrentLineEdit == myLineEdit1 && ( aGroupType == SMESH::EDGE ||
597 aGroupType == SMESH::FACE ) ) ||
598 ( myCurrentLineEdit == myLineEdit2 && aGroupType == SMESH::NODE ) ||
599 ( myCurrentLineEdit == myLineEdit3 && aGroupType != SMESH::NODE );
602 ok = ( aGroupType != SMESH::NODE );
605 ok = ( aGroupType == SMESH::VOLUME );
609 if ( ok ) aGroups << aGroup;
612 // Clear current field
613 myCurrentLineEdit->clear();
615 if ( ok && !aGroups.isEmpty() ) {
616 if ( myCurrentLineEdit == myLineEdit1 ) myGroups1 = aGroups;
617 else if ( myCurrentLineEdit == myLineEdit2 ) myGroups2 = aGroups;
618 else if ( myCurrentLineEdit == myLineEdit3 ) myGroups3 = aGroups;
619 CORBA::String_var name = aGroups[0]->GetName();
620 myCurrentLineEdit->setText( aGroups.count() == 1 ? QString(name).trimmed() :
621 QObject::tr( "SMESH_OBJECTS_SELECTED" ).arg( aGroups.count() ) );
624 if ( myCurrentLineEdit == myLineEdit1 ) myGroups1.clear();
625 else if ( myCurrentLineEdit == myLineEdit2 ) myGroups2.clear();
626 else if ( myCurrentLineEdit == myLineEdit3 ) myGroups3.clear();
627 myCurrentLineEdit->clear();
629 // Enable/disable "Apply and Close" and "Apply" buttons
634 * \brief Enable/disable "Apply and Close" and "Apply" buttons
636 void SMESHGUI_DuplicateNodesDlg::updateButtons()
638 bool isDataValid = isValid();
639 myButtonOk->setEnabled( isDataValid );
640 myButtonApply->setEnabled( isDataValid );
644 \brief SLOT called when selection button clicked.
646 void SMESHGUI_DuplicateNodesDlg::onEditCurrentArgument()
648 QPushButton* send = (QPushButton*)sender();
650 // Set current field for edition
651 if (send == mySelectButton1) {
652 myCurrentLineEdit = myLineEdit1;
654 else if (send == mySelectButton2) {
655 myCurrentLineEdit = myLineEdit2;
657 else if (send == mySelectButton3) {
658 myCurrentLineEdit = myLineEdit3;
661 myCurrentLineEdit->setFocus();
662 onSelectionChanged();
666 \brief Check if the input data is valid.
667 \return \c true if the data is valid
669 bool SMESHGUI_DuplicateNodesDlg::isValid()
671 switch( myGroupConstructors->checkedId() )
673 case 1: return ( !myGroups1.isEmpty() && !myGroups3.isEmpty() );
674 case 3: return ( myGroups1.count() > ( myCheckBox2->isChecked() ? 0 : 1 ));
675 default: return !myGroups1.isEmpty();
681 \brief SLOT called when dialog shoud be deativated.
683 void SMESHGUI_DuplicateNodesDlg::onDeactivate()
686 mySelectionMgr->clearFilters();
688 mySMESHGUI->ResetState();
689 mySMESHGUI->SetActiveDialogBox(0);
694 \brief Receive dialog enter events.
695 Activates the dialog when the mouse cursor enters.
696 Reimplemented from QWidget class.
698 void SMESHGUI_DuplicateNodesDlg::enterEvent (QEvent*)
700 if ( !isEnabled() ) {
701 mySMESHGUI->EmitSignalDeactivateDialog();
703 mySMESHGUI->SetActiveDialogBox((QDialog*)this);
705 // Set selection mode
706 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
707 aViewWindow->SetSelectionMode(ActorSelection);
708 mySelectionMgr->installFilter(new SMESH_TypeFilter (SMESH::GROUP));
713 \brief Receive key press events.
714 Reimplemented from QWidget class.
716 void SMESHGUI_DuplicateNodesDlg::keyPressEvent( QKeyEvent* e )
718 QDialog::keyPressEvent( e );
719 if ( e->isAccepted() )
722 if ( e->key() == Qt::Key_F1 ) {
729 \brief Show the dialog help page.
731 void SMESHGUI_DuplicateNodesDlg::onHelp()
733 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
735 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
739 platform = "winapplication";
741 platform = "application";
743 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
744 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
745 arg(app->resourceMgr()->stringValue("ExternalBrowser",
747 arg(myHelpFileName));