X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_MeshDlg.cxx;h=9e8751984dab84f5e751083cdbe5f54e6c0f0390;hp=bb0b265f78cfc8c30502de98e8bdb04716e4688f;hb=d9f4b53e489dd5857db264ede6acded7b076c9f1;hpb=88141f757b048eaa5aae0be49faaf274448bbcaf diff --git a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx index bb0b265f7..9e8751984 100644 --- a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -34,6 +34,7 @@ #include // Qt includes +#include #include #include #include @@ -572,9 +573,12 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh // mesh type QLabel* anMeshTypeLbl = new QLabel( tr( "MESH_TYPE" ), this ); myMeshType = new QComboBox( this ); - + // groups + myCreateGroupsCheck = new QCheckBox( tr( "CREATE_ALL_GROUPS" ), this ); + myCreateGroupsCheck->setChecked( true ); + // Create tab widget - + myTabWg = new QTabWidget( mainFrame() ); myTabs[ Dim0D ] = new SMESHGUI_MeshTab( myTabWg ); myTabs[ Dim1D ] = new SMESHGUI_MeshTab( myTabWg ); @@ -608,9 +612,10 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh aLay->addWidget( objectWg( Geom, Control ), 2, 2 ); aLay->addWidget( anMeshTypeLbl, 3, 0 ); aLay->addWidget( myMeshType, 3, 2 ); - aLay->addWidget( myTabWg, 5, 0, 1, 3 ); - aLay->addWidget( myHypoSetButton, 6, 0, 1, 3 ); - aLay->setRowMinimumHeight( 3, 20 ); + aLay->addWidget( myCreateGroupsCheck, 4, 0, 1, 3 ); + aLay->addWidget( myTabWg, 6, 0, 1, 3 ); + aLay->addWidget( myHypoSetButton, 7, 0, 1, 3 ); + aLay->setRowMinimumHeight( 4, 20 ); myMeshType->clear(); @@ -658,7 +663,7 @@ void SMESHGUI_MeshDlg::setTitile( const bool theToCreate, const bool theIsMesh ) { setWindowTitle( tr( theIsMesh ? "EDIT_MESH" : "EDIT_SUBMESH") ); } - + myCreateGroupsCheck-> setVisible( theToCreate && theIsMesh ); } //================================================================================ @@ -739,8 +744,11 @@ void SMESHGUI_MeshDlg::setHypoSets( const QStringList& theSets ) myHypoSetButton->setPopupMode( QToolButton::InstantPopup ); } aHypoSetPopup->clear(); - for ( int i = 0, n = theSets.count(); i < n; i++ ) { - aHypoSetPopup->addAction( theSets[ i ] ); + for ( int i = 0, n = theSets.count(); i < n; i++ ) + { + QAction* action = new QAction( tr( theSets[ i ].toUtf8().data() )); + action->setData( theSets[ i ] ); + aHypoSetPopup->addAction( action ); } myHypoSetButton->setEnabled( !aHypoSetPopup->isEmpty() ); } @@ -755,7 +763,7 @@ void SMESHGUI_MeshDlg::setHypoSets( const QStringList& theSets ) //================================================================================ void SMESHGUI_MeshDlg::onHypoSetPopup( QAction* a ) { - emit hypoSet( a->text() ); + emit hypoSet( a->data().toString() ); } //================================================================================ @@ -828,6 +836,17 @@ bool SMESHGUI_MeshDlg::isTabEnabled(const int theTabId) const return myTabWg->isTabEnabled( myTabWg->indexOf( myTabs[ theTabId ] ) ); } +//================================================================================ +/*! + * \brief Return index of a current tab + * \return tab ID + */ +//================================================================================ +int SMESHGUI_MeshDlg::currentTab() const +{ + return Dim3D - myTabWg->currentIndex(); +} + //================================================================================ /*! * \brief SLOT called when a Geom selection button is clicked @@ -872,6 +891,7 @@ void SMESHGUI_MeshDlg::setAvailableMeshType( const QStringList& theTypeMesh ) { myMeshType->clear(); myMeshType->addItems(theTypeMesh); + myMeshType->setEnabled( theTypeMesh.size() > 1 ); } //================================================================================ /*! @@ -900,5 +920,19 @@ int SMESHGUI_MeshDlg::currentMeshType( ) //================================================================================ void SMESHGUI_MeshDlg::setCurrentMeshType( const int theIndex ) { - myMeshType->setCurrentIndex( theIndex ); + if ( theIndex < myMeshType->count() ) + myMeshType->setCurrentIndex( theIndex ); + else + myMeshType->setCurrentIndex( 0 ); +} + +//================================================================================ +/*! + * \brief Return state of "Create all Groups on Geometry" check-box + */ +//================================================================================ + +bool SMESHGUI_MeshDlg::toCreateAllGroups() +{ + return myCreateGroupsCheck->isChecked(); }