-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020 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
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <QtxMenu.h>
+#include <QtxToolButton.h>
// Qt includes
+#include <QCheckBox>
#include <QComboBox>
#include <QCursor>
#include <QGridLayout>
// 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 );
// 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 );
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
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 ));
}
}
QAction* a = 0;
if ( aHypNames[ i ].startsWith( "GROUP:" ))
{
- aPopup.appendGroupTitle( aHypNames[ i ].mid( 6 ));
+ aPopup.addGroup( aHypNames[ i ].mid( 6 ));
}
else
{
// 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 );
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();
{
setWindowTitle( tr( theIsMesh ? "EDIT_MESH" : "EDIT_SUBMESH") );
}
-
+ myCreateGroupsCheck-> setVisible( theToCreate && theIsMesh );
}
//================================================================================
//================================================================================
/*!
- * \brief Sets curent tab
+ * \brief Sets current tab
*/
//================================================================================
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 )
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() );
}
//================================================================================
void SMESHGUI_MeshDlg::onHypoSetPopup( QAction* a )
{
- emit hypoSet( a->text() );
+ emit hypoSet( a->data().toString() );
}
//================================================================================
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
//================================================================================
/*!
- * \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 )
//================================================================================
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();
}