Widget controlling hypothesis parameter that is another hypothesis. More...
#include <StdMeshersGUI_LayerDistributionParamWdg.h>

Public Member Functions | |
| StdMeshersGUI_LayerDistributionParamWdg (SMESH::SMESH_Hypothesis_ptr, const QString &, QDialog *) | |
| Constructor initialized by filter. | |
| ~StdMeshersGUI_LayerDistributionParamWdg () | |
| Destructor. | |
| SMESH::SMESH_Hypothesis_var | GetHypothesis () |
| Return the hypothesis assigned to the shape. | |
| QString | GetValue () const |
| bool | IsOk () const |
Private Slots | |
| void | onCreate () |
| Show popup with available types. | |
| void | onEdit () |
| Edit hypothesis. | |
| void | onHypTypePopup (QAction *) |
| Create a new hyp of selected type. | |
| void | onEdited (int) |
Private Member Functions | |
| void | init () |
| Create a leayout, initialize fields. | |
| void | set (SMESH::SMESH_Hypothesis_ptr) |
| initialize fields with hypothesis | |
Private Attributes | |
| SMESH::SMESH_Hypothesis_var | myHyp |
| SMESHGUI * | mySMESHGUI |
| QPushButton * | myCreateButton |
| QPushButton * | myEditButton |
| QMenu * | myHypTypePopup |
| QDialog * | myDlg |
| QString | myName |
| QString | myParamValue |
| QStringList | myHypTypes |
Widget controlling hypothesis parameter that is another hypothesis.
Definition at line 49 of file StdMeshersGUI_LayerDistributionParamWdg.h.
| StdMeshersGUI_LayerDistributionParamWdg::StdMeshersGUI_LayerDistributionParamWdg | ( | SMESH::SMESH_Hypothesis_ptr | hyp, |
| const QString & | theName, | ||
| QDialog * | dlg | ||
| ) |
Constructor initialized by filter.
| f | - object filter |
Definition at line 53 of file StdMeshersGUI_LayerDistributionParamWdg.cxx.
References SMESH_demo_hexa2_upd.hyp.
| StdMeshersGUI_LayerDistributionParamWdg::~StdMeshersGUI_LayerDistributionParamWdg | ( | ) |
| const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis | ( | ) |
Return the hypothesis assigned to the shape.
| aSubShape | - the shape to check |
| aFilter | - the hypothesis filter |
| andAncestors | - flag to check hypos assigned to ancestors of the shape |
| assignedTo | - to return the shape the found hypo is assigned to |
| SMESH_Hypothesis* | - the first hypo passed through aFilter |
Definition at line 59 of file StdMeshersGUI_LayerDistributionParamWdg.h.
Referenced by StdMeshersGUI_StdHypothesisCreator.storeParams().
{ return myHyp; }
| QString StdMeshersGUI_LayerDistributionParamWdg.GetValue | ( | ) | const |
Definition at line 61 of file StdMeshersGUI_LayerDistributionParamWdg.h.
Referenced by StdMeshersGUI_StdHypothesisCreator.getParamFromCustomWidget().
{ return myParamValue; }
| void StdMeshersGUI_LayerDistributionParamWdg::init | ( | ) | [private] |
Create a leayout, initialize fields.
Definition at line 103 of file StdMeshersGUI_LayerDistributionParamWdg.cxx.
References SMESH.GetAvailableHypotheses(), SMESH.GetHypothesisData(), SMESHGUI.GetSMESHGUI(), SMESH.IsAvailableHypothesis(), HypothesisData.Label, myCreateButton, myEditButton, myHypTypePopup, myHypTypes, mySMESHGUI, onCreate(), onEdit(), onHypTypePopup(), SPACING, and HypothesisData.TypeName.
{
QHBoxLayout* aHBox = new QHBoxLayout( this );
aHBox->setMargin( 0 );
aHBox->setSpacing( SPACING );
mySMESHGUI = SMESHGUI::GetSMESHGUI();
myCreateButton = new QPushButton( this );
myCreateButton->setObjectName( "createBut" );
myEditButton = new QPushButton( tr("EDIT"), this );
myEditButton->setObjectName( "editBut" );
myHypTypePopup = new QMenu( this );
// Add to pop-up hypotheses of "Regular_1D" algo
HypothesisData* algoData = SMESH::GetHypothesisData( "Regular_1D" );
myHypTypes = SMESH::GetAvailableHypotheses( false, 1 );
QStringList::const_iterator anIter = myHypTypes.begin();
for ( ; anIter != myHypTypes.end(); ++anIter )
{
HypothesisData* hypData = SMESH::GetHypothesisData( *anIter );
bool bidon;
if ( SMESH::IsAvailableHypothesis( algoData, hypData->TypeName, bidon ))
myHypTypePopup->addAction( hypData->Label );
}
aHBox->addWidget( myCreateButton );
aHBox->addWidget( myEditButton );
aHBox->addStretch();
connect( myCreateButton, SIGNAL(clicked()), SLOT(onCreate()));
connect( myEditButton, SIGNAL(clicked()), SLOT(onEdit()));
connect( myHypTypePopup, SIGNAL(triggered( QAction* ) ), SLOT( onHypTypePopup( QAction* ) ) );
}
| bool StdMeshersGUI_LayerDistributionParamWdg.IsOk | ( | ) | const |
Definition at line 63 of file StdMeshersGUI_LayerDistributionParamWdg.h.
Referenced by StdMeshersGUI_StdHypothesisCreator.checkParams().
{ return !myHyp->_is_nil(); }
| void StdMeshersGUI_LayerDistributionParamWdg::onCreate | ( | ) | [private, slot] |
Show popup with available types.
Definition at line 185 of file StdMeshersGUI_LayerDistributionParamWdg.cxx.
References myHypTypePopup.
Referenced by init().
{
myHypTypePopup->exec( QCursor::pos() );
}
| void StdMeshersGUI_LayerDistributionParamWdg::onEdit | ( | ) | [private, slot] |
Edit hypothesis.
Definition at line 196 of file StdMeshersGUI_LayerDistributionParamWdg.cxx.
References SMESHGUI_GenericHypothesisCreator.edit(), SMESH.GetHypothesisCreator(), myDlg, myHyp, myName, and onEdited().
Referenced by init(), and onHypTypePopup().
{
if ( myHyp->_is_nil() )
return;
CORBA::String_var hypType = myHyp->GetName();
// BUG 0020378
//SMESHGUI_GenericHypothesisCreator* editor = SMESH::GetHypothesisCreator(hypType.in());
SMESHGUI_GenericHypothesisCreator* editor = SMESH::GetHypothesisCreator(hypType.in());
if ( !editor ) return;
if ( myDlg )
myDlg->hide();
try {
QWidget* parent = this;
if ( myDlg )
parent = myDlg->parentWidget();
editor->edit( myHyp, myName, parent, this, SLOT( onEdited( int ) ) );
}
catch(...)
{
}
}
| void StdMeshersGUI_LayerDistributionParamWdg::onEdited | ( | int | result | ) | [private, slot] |
| void StdMeshersGUI_LayerDistributionParamWdg::onHypTypePopup | ( | QAction * | a | ) | [private, slot] |
Create a new hyp of selected type.
| int | - selected type index |
Definition at line 147 of file StdMeshersGUI_LayerDistributionParamWdg.cxx.
References SMESH.GetHypothesisData(), SMESHGUI.GetSMESHGen(), HypothesisData.Label, myHypTypes, mySMESHGUI, onEdit(), HypothesisData.ServerLibName, and HypothesisData.TypeName.
Referenced by init().
{
SMESH::SMESH_Gen_var gen = mySMESHGUI->GetSMESHGen();
// avoid publishing a new 1D hyp
gen->SetCurrentStudy( SALOMEDS::Study::_nil() );
// create a hyp
HypothesisData* aHypData = 0;
QStringList::const_iterator anIter = myHypTypes.begin();
for ( ; !aHypData && anIter != myHypTypes.end(); ++anIter )
{
HypothesisData* hypData = SMESH::GetHypothesisData( *anIter );
if ( a->text() == hypData->Label )
aHypData = hypData;
}
QString aServLib = aHypData->ServerLibName;
QString aHypType = aHypData->TypeName;
try {
set( gen->CreateHypothesis(aHypType.toLatin1().data(), aServLib.toLatin1().data()));
}
catch (const SALOME::SALOME_Exception & S_ex) {
SalomeApp_Tools::QtCatchCorbaException(S_ex);
}
// restore current study
mySMESHGUI->GetSMESHGen();
onEdit();
}
| void StdMeshersGUI_LayerDistributionParamWdg::set | ( | SMESH::SMESH_Hypothesis_ptr | hyp | ) | [private] |
initialize fields with hypothesis
| hyp | - hypothesis |
Definition at line 71 of file StdMeshersGUI_LayerDistributionParamWdg.cxx.
References myCreateButton, myEditButton, myHyp, and myParamValue.
{
myHyp = SMESH::SMESH_Hypothesis::_nil();
if ( !CORBA::is_nil( hyp )) {
myHyp = SMESH::SMESH_Hypothesis::_duplicate( hyp );
myEditButton->setEnabled( true );
myCreateButton->setText( tr("CHANGE_TYPE"));
myParamValue = hyp->GetName();
}
else {
myEditButton->setEnabled( false );
myCreateButton->setText( tr("CREATE"));
myParamValue = "";
}
}
QPushButton* StdMeshersGUI_LayerDistributionParamWdg.myCreateButton [private] |
Definition at line 79 of file StdMeshersGUI_LayerDistributionParamWdg.h.
Definition at line 82 of file StdMeshersGUI_LayerDistributionParamWdg.h.
Referenced by onEdit(), and onEdited().
QPushButton* StdMeshersGUI_LayerDistributionParamWdg.myEditButton [private] |
Definition at line 80 of file StdMeshersGUI_LayerDistributionParamWdg.h.
SMESH::SMESH_Hypothesis_var StdMeshersGUI_LayerDistributionParamWdg.myHyp [private] |
Definition at line 76 of file StdMeshersGUI_LayerDistributionParamWdg.h.
QMenu* StdMeshersGUI_LayerDistributionParamWdg.myHypTypePopup [private] |
Definition at line 81 of file StdMeshersGUI_LayerDistributionParamWdg.h.
Referenced by init(), and onCreate().
QStringList StdMeshersGUI_LayerDistributionParamWdg.myHypTypes [private] |
Definition at line 86 of file StdMeshersGUI_LayerDistributionParamWdg.h.
Referenced by init(), and onHypTypePopup().
QString StdMeshersGUI_LayerDistributionParamWdg.myName [private] |
Definition at line 83 of file StdMeshersGUI_LayerDistributionParamWdg.h.
Referenced by onEdit().
QString StdMeshersGUI_LayerDistributionParamWdg.myParamValue [private] |
Definition at line 84 of file StdMeshersGUI_LayerDistributionParamWdg.h.
Referenced by set().
Definition at line 77 of file StdMeshersGUI_LayerDistributionParamWdg.h.
Referenced by init(), and onHypTypePopup().