X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_MeshDlg.cxx;h=a1ee4ec9f25155bd38dbf39655f9181922fe8874;hb=59fe51ff7f83a733aee46ecad7adb391bc4323bf;hp=0c492b5d7ffd317f3a3a977c9b43c0b39c574017;hpb=8beac8f8eb86e53af7a8a9d52089fff255af8ed0;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx index 0c492b5d7..a1ee4ec9f 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-2019 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 @@ -31,6 +31,7 @@ #include #include #include +#include // Qt includes #include @@ -74,11 +75,11 @@ SMESHGUI_MeshTab::SMESHGUI_MeshTab( QWidget* theParent ) // Algorifm QLabel* anAlgoLbl = new QLabel( tr( "ALGORITHM" ), this ); - myHypCombo[ Algo ] = new QComboBox( this ); + myHypCombo[ Algo ] = new QtxToolButton( this ); // Hypothesis QLabel* aHypLbl = new QLabel( tr( "HYPOTHESIS" ), this ); - myHypCombo[ MainHyp ] = new QComboBox( this ); + myHypCombo[ MainHyp ] = new QtxToolButton( this ); myHypCombo[ MainHyp ]->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myCreateHypBtn[ MainHyp ] = new QToolButton( this ); myCreateHypBtn[ MainHyp ]->setIcon( aCreateIcon ); @@ -91,7 +92,7 @@ SMESHGUI_MeshTab::SMESHGUI_MeshTab( QWidget* theParent ) // Add. hypothesis QLabel* anAddHypLbl = new QLabel( tr( "ADD_HYPOTHESIS" ), this ); - myHypCombo[ AddHyp ] = new QComboBox( this ); + myHypCombo[ AddHyp ] = new QtxToolButton( this ); myHypCombo[ AddHyp ]->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myCreateHypBtn[ AddHyp ] = new QToolButton( this ); myCreateHypBtn[ AddHyp ]->setIcon( aCreateIcon ); @@ -126,6 +127,7 @@ SMESHGUI_MeshTab::SMESHGUI_MeshTab( QWidget* theParent ) aLay->addWidget( myMoreAddHypBtn, 4, 2 ); aLay->addWidget( myEditHypBtn[ MoreAddHyp ], 4, 3 ); aLay->addWidget( myLessAddHypBtn, 5, 2 ); + aLay->addItem( new QSpacerItem( 0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding ), 6, 0 ); // Connect signals and slots @@ -172,24 +174,21 @@ void SMESHGUI_MeshTab::addItem( const QString& txt, const int index, const bool isGroup ) { - const char* prefix = " "; if ( type <= AddHyp ) { if ( isGroup ) { - int idx = myHypCombo[ type ]->count(); - myHypCombo[ type ]->addItem( txt.mid( 6 ), QVariant( index )); - myHypCombo[ type ]->setItemData( idx, "separator", Qt::AccessibleDescriptionRole ); + myHypCombo[ type ]->addSeparator( txt.mid( 6 ) ); } else { - myHypCombo[ type ]->addItem( prefix + txt, QVariant( index )); + myHypCombo[ type ]->addItem( txt, QVariant( index )); } //myHypCombo[ type ]->setMaxVisibleItems( qMax( 10, myHypCombo[ type ]->count() ) ); } else { - QListWidgetItem* item = new QListWidgetItem( prefix + txt, myAddHypList ); + QListWidgetItem* item = new QListWidgetItem( txt, myAddHypList ); item->setData( Qt::UserRole, QVariant( index )); } } @@ -405,7 +404,7 @@ void SMESHGUI_MeshTab::onCreateHyp() QAction* a = 0; if ( aHypNames[ i ].startsWith( "GROUP:" )) { - aPopup.appendGroupTitle( aHypNames[ i ].mid( 6 )); + aPopup.addGroup( aHypNames[ i ].mid( 6 )); } else { @@ -693,7 +692,7 @@ void SMESHGUI_MeshDlg::reset() //================================================================================ /*! - * \brief Sets curent tab + * \brief Sets current tab */ //================================================================================ void SMESHGUI_MeshDlg::setCurrentTab( const int theId ) @@ -704,7 +703,7 @@ void SMESHGUI_MeshDlg::setCurrentTab( const int theId ) //================================================================================ /*! * \brief Enable/disable tabs - * \param int - maximum possible dimention + * \param int - maximum possible dimension */ //================================================================================ void SMESHGUI_MeshDlg::setMaxHypoDim( const int maxDim ) @@ -829,6 +828,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 @@ -842,7 +852,7 @@ void SMESHGUI_MeshDlg::onGeomSelectionButton(bool isBtnOn) //================================================================================ /*! - * \brief SLOT called when a item of Geom selection popup is choosen + * \brief SLOT called when a item of Geom selection popup is chosen */ //================================================================================ void SMESHGUI_MeshDlg::onGeomPopup( QAction* a ) @@ -901,5 +911,8 @@ 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 ); }