Tab for tab widget containing controls for definition of algorithms and hypotheses. More...
#include <SMESHGUI_MeshDlg.h>

Public Types | |
| enum | HypType { Algo = 0, MainHyp, AddHyp } |
To differ main algorithms, hypotheses and additional ones. More... | |
Signals | |
| void | createHyp (const int, const int) |
| Emited when "Create hypothesis" button clicked. | |
| void | editHyp (const int, const int) |
| Emited when "Edit hypothesis" button clicked. | |
| void | selectAlgo (const int) |
| Emited when an algorithm is selected. | |
Public Member Functions | |
| SMESHGUI_MeshTab (QWidget *) | |
| Tab for tab widget containing controls for definition of algorithms and hypotheses. | |
| virtual | ~SMESHGUI_MeshTab () |
| Destructor. | |
| void | setAvailableHyps (const int, const QStringList &) |
| Sets available hypothesis or algorithms. | |
| void | setExistingHyps (const int, const QStringList &) |
| Sets existing hypothesis. | |
| void | addHyp (const int, const QString &) |
| Adds hypothesis in combo box of available ones. | |
| void | renameHyp (const int, const int, const QString &) |
| Renames hypothesis. | |
| void | setCurrentHyp (const int, const int) |
| Sets current hypothesis. | |
| int | currentHyp (const int) const |
| Gets current hypothesis. | |
| void | reset () |
| Resets all tab fields. | |
Private Slots | |
| void | onCreateHyp () |
| Emits createHyp( const int ) signal. | |
| void | onEditHyp () |
| Emits editHyp( const int ) signal. | |
| void | onHyp (int) |
| Updates "Edit hypothesis" button state. | |
Private Attributes | |
| QMap< int, QComboBox * > | myHyp |
| QMap< int, QToolButton * > | myCreateHyp |
| QMap< int, QToolButton * > | myEditHyp |
| QMap< int, QStringList > | myAvailableHyps |
| QMap< int, QStringList > | myExistingHyps |
Tab for tab widget containing controls for definition of algorithms and hypotheses.
Definition at line 99 of file SMESHGUI_MeshDlg.h.
To differ main algorithms, hypotheses and additional ones.
Definition at line 105 of file SMESHGUI_MeshDlg.h.
| SMESHGUI_MeshTab::SMESHGUI_MeshTab | ( | QWidget * | theParent | ) |
Tab for tab widget containing controls for definition of algorithms and hypotheses.
Constructor
| theParent | - Parent widget for this tab |
Makes tab's look and feel
Definition at line 62 of file SMESHGUI_MeshDlg.cxx.
References AddHyp, Algo, MainHyp, MARGIN, myCreateHyp, myEditHyp, myHyp, onCreateHyp(), onEditHyp(), onHyp(), setAvailableHyps(), and SPACING.
: QFrame( theParent ) { SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); QIcon aCreateIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_HYPO" ) ) ); QIcon aEditIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_HYPO_EDIT" ) ) ); // Algorifm QLabel* anAlgoLbl = new QLabel( tr( "ALGORITHM" ), this ); myHyp[ Algo ] = new QComboBox( this ); // Hypothesis QLabel* aHypLbl = new QLabel( tr( "HYPOTHESIS" ), this ); myHyp[ MainHyp ] = new QComboBox( this ); myHyp[ MainHyp ]->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myCreateHyp[ MainHyp ] = new QToolButton( this ); myCreateHyp[ MainHyp ]->setIcon( aCreateIcon ); myEditHyp[ MainHyp ] = new QToolButton( this ); myEditHyp[ MainHyp ]->setIcon( aEditIcon ); // Line QFrame* aLine = new QFrame( this ); aLine->setFrameStyle( QFrame::HLine | QFrame::Sunken ); // Add. hypothesis QLabel* anAddHypLbl = new QLabel( tr( "ADD_HYPOTHESIS" ), this ); myHyp[ AddHyp ] = new QComboBox( this ); myHyp[ AddHyp ]->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myCreateHyp[ AddHyp ] = new QToolButton( this ); myCreateHyp[ AddHyp ]->setIcon( aCreateIcon ); myEditHyp[ AddHyp ] = new QToolButton( this ); myEditHyp[ AddHyp ]->setIcon( aEditIcon ); // Fill layout QGridLayout* aLay = new QGridLayout( this ); aLay->setMargin( MARGIN ); aLay->setSpacing( SPACING ); aLay->addWidget( anAlgoLbl, 0, 0 ); aLay->addWidget( myHyp[ Algo ], 0, 1 ); aLay->addWidget( aHypLbl, 1, 0 ); aLay->addWidget( myHyp[ MainHyp ], 1, 1 ); aLay->addWidget( myCreateHyp[ MainHyp ], 1, 2 ); aLay->addWidget( myEditHyp[ MainHyp ], 1, 3 ); aLay->addWidget( aLine, 2, 0, 1, 4 ); aLay->addWidget( anAddHypLbl, 3, 0 ); aLay->addWidget( myHyp[ AddHyp ], 3, 1 ); aLay->addWidget( myCreateHyp[ AddHyp ], 3, 2 ); aLay->addWidget( myEditHyp[ AddHyp ], 3, 3 ); aLay->addItem( new QSpacerItem( 0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding ), 4, 0 ); // Connect signals and slots for ( int i = MainHyp; i <= AddHyp; i++ ) { connect( myCreateHyp[ i ], SIGNAL( clicked() ) , SLOT( onCreateHyp() ) ); connect( myEditHyp[ i ] , SIGNAL( clicked() ) , SLOT( onEditHyp() ) ); connect( myHyp[ i ] , SIGNAL( activated( int ) ), SLOT( onHyp( int ) ) ); } connect( myHyp[ Algo ], SIGNAL( activated( int ) ), SLOT( onHyp( int ) ) ); // Initialize controls setAvailableHyps( Algo, QStringList() ); setAvailableHyps( MainHyp, QStringList() ); setAvailableHyps( AddHyp, QStringList() ); }
| SMESHGUI_MeshTab::~SMESHGUI_MeshTab | ( | ) | [virtual] |
| void SMESHGUI_MeshTab::addHyp | ( | const int | theId, |
| const QString & | theHyp | ||
| ) |
Adds hypothesis in combo box of available ones.
| theId | - identifier of hypothesis (main or additional, see HypType enumeration) |
| theHyp | - name of hypothesis to be added |
Adds hypothesis in combo box of available ones. This method is called by operation after creation of new hypothesis.
Definition at line 198 of file SMESHGUI_MeshDlg.cxx.
References myEditHyp, and myHyp.
Referenced by SMESHGUI_MeshOp.onHypoCreated().
Emited when "Create hypothesis" button clicked.
Referenced by onCreateHyp().
Gets current hypothesis.
| theId | - identifier of hypothesis (main or additional, see HypType enumeration) |
| int | - index of current hypothesis |
Gets current hypothesis
Definition at line 252 of file SMESHGUI_MeshDlg.cxx.
References myHyp.
Referenced by SMESHGUI_MeshOp.currentHyp().
{
return myHyp[ theId ]->currentIndex();
}
Emited when "Edit hypothesis" button clicked.
Referenced by onEditHyp().
| void SMESHGUI_MeshTab::onCreateHyp | ( | ) | [private, slot] |
Emits createHyp( const int ) signal.
SLOT called when "Create hypothesis" button clicked specifies sender and emits createHyp( const int ) signal
Definition at line 265 of file SMESHGUI_MeshDlg.cxx.
References SMESH_demo_hexa2_upd.a, AddHyp, createHyp(), MainHyp, myAvailableHyps, and myCreateHyp.
Referenced by SMESHGUI_MeshTab().
{
bool isMainHyp = sender() == myCreateHyp[ MainHyp ];
QMenu aPopup( this );
QStringList aHypNames = isMainHyp ?
myAvailableHyps[ MainHyp ] : myAvailableHyps[ AddHyp ];
QList<QAction*> actions;
for ( int i = 0, n = aHypNames.count(); i < n; i++ )
actions.append( aPopup.addAction( aHypNames[ i ] ) );
QAction* a = aPopup.exec( QCursor::pos() );
if ( a )
emit createHyp( isMainHyp ? MainHyp : AddHyp, actions.indexOf( a ) );
}
| void SMESHGUI_MeshTab::onEditHyp | ( | ) | [private, slot] |
Emits editHyp( const int ) signal.
SLOT called when "Edit hypothesis" button clicked specifies sender and emits editHyp( const int ) signal
Definition at line 291 of file SMESHGUI_MeshDlg.cxx.
References AddHyp, editHyp(), MainHyp, myEditHyp, and myHyp.
Referenced by SMESHGUI_MeshTab().
| void SMESHGUI_MeshTab::onHyp | ( | int | theIndex | ) | [private, slot] |
Updates "Edit hypothesis" button state.
SLOT called when current hypothesis changed. Disables "Edit hypothesis" button if current hypothesis is <None>, enables otherwise. If an algorithm changed, emits selectAlgo( theIndex ) signal
Definition at line 307 of file SMESHGUI_MeshDlg.cxx.
References AddHyp, Algo, MainHyp, myEditHyp, myHyp, and selectAlgo().
Referenced by SMESHGUI_MeshTab().
| void SMESHGUI_MeshTab::renameHyp | ( | const int | theId, |
| const int | theIndex, | ||
| const QString & | theNewName | ||
| ) |
Renames hypothesis.
| theId | - identifier of hypothesis (main or additional, see HypType enumeration) |
| theIndex | - index of hypothesis to be renamed |
| theNewName | - new name of hypothesis to be renamed |
Renames hypothesis
Definition at line 216 of file SMESHGUI_MeshDlg.cxx.
References myHyp.
| void SMESHGUI_MeshTab::reset | ( | ) |
| void SMESHGUI_MeshTab.selectAlgo | ( | const int | ) | [signal] |
Emited when an algorithm is selected.
Referenced by onHyp().
| void SMESHGUI_MeshTab::setAvailableHyps | ( | const int | theId, |
| const QStringList & | theHyps | ||
| ) |
Sets available hypothesis or algorithms.
| theId | - identifier of hypothesis (main or additional, see HypType enumeration) |
| theHyps | - list of available hypothesis names |
Sets available main or additional hypothesis for this tab
Definition at line 147 of file SMESHGUI_MeshDlg.cxx.
References Algo, myAvailableHyps, myCreateHyp, myEditHyp, and myHyp.
Referenced by SMESHGUI_MeshOp.onAlgoSelected(), SMESHGUI_MeshOp.processSet(), SMESHGUI_MeshOp.selectionDone(), SMESHGUI_MeshTab(), and SMESHGUI_MeshOp.startOperation().
{
myAvailableHyps[ theId ] = theHyps;
bool enable = ! theHyps.isEmpty();
if ( theId == Algo )
{
myHyp[ Algo ]->clear();
myHyp[ Algo ]->addItem( tr( "NONE" ) );
myHyp[ Algo ]->addItems( theHyps );
myHyp[ Algo ]->setCurrentIndex( 0 );
}
else {
myCreateHyp[ theId ]->setEnabled( enable );
myEditHyp[ theId ]->setEnabled( false );
}
myHyp[ theId ]->setEnabled( enable );
}
Sets current hypothesis.
| theId | - identifier of hypothesis (main or additional, see HypType enumeration) |
| theIndex | - index of hypothesis to be set as current |
Sets current hypothesis
Definition at line 233 of file SMESHGUI_MeshDlg.cxx.
References myEditHyp, and myHyp.
Referenced by SMESHGUI_MeshOp.setCurrentHyp().
| void SMESHGUI_MeshTab::setExistingHyps | ( | const int | theId, |
| const QStringList & | theHyps | ||
| ) |
Sets existing hypothesis.
| theId | - identifier of hypothesis (main or additional, see HypType enumeration) |
| theHyps | - list of available hypothesis names |
Sets existing main or additional hypothesis for this tab
Definition at line 175 of file SMESHGUI_MeshDlg.cxx.
References Algo, myEditHyp, and myHyp.
Referenced by SMESHGUI_MeshOp.onAlgoSelected(), SMESHGUI_MeshOp.readMesh(), and SMESHGUI_MeshOp.startOperation().
QMap<int, QStringList> SMESHGUI_MeshTab.myAvailableHyps [private] |
Definition at line 142 of file SMESHGUI_MeshDlg.h.
Referenced by onCreateHyp(), and setAvailableHyps().
QMap<int, QToolButton*> SMESHGUI_MeshTab.myCreateHyp [private] |
Definition at line 139 of file SMESHGUI_MeshDlg.h.
Referenced by onCreateHyp(), setAvailableHyps(), and SMESHGUI_MeshTab().
QMap<int, QToolButton*> SMESHGUI_MeshTab.myEditHyp [private] |
Definition at line 140 of file SMESHGUI_MeshDlg.h.
Referenced by addHyp(), onEditHyp(), onHyp(), reset(), setAvailableHyps(), setCurrentHyp(), setExistingHyps(), and SMESHGUI_MeshTab().
QMap<int, QStringList> SMESHGUI_MeshTab.myExistingHyps [private] |
Definition at line 143 of file SMESHGUI_MeshDlg.h.
QMap<int, QComboBox*> SMESHGUI_MeshTab.myHyp [private] |
Definition at line 138 of file SMESHGUI_MeshDlg.h.
Referenced by addHyp(), currentHyp(), onEditHyp(), onHyp(), renameHyp(), reset(), setAvailableHyps(), setCurrentHyp(), setExistingHyps(), and SMESHGUI_MeshTab().