+
+//=================================================================================
+// function : onValueChanged()
+// purpose :
+//=================================================================================
+void StdMeshersGUI_CreateHypothesisDlg::onValueChanged()
+{
+ if( sender()->inherits( "QWidget" ) )
+ {
+ QWidget* w = ( QWidget* )sender();
+
+ SMESHGUI_aParameterPtr param;
+
+ ParameterMap::const_iterator anIt = myParamMap.begin(),
+ aLast = myParamMap.end();
+ for( ; anIt!=aLast; anIt++ )
+ if( anIt.data().editor == w )
+ {
+ param = anIt.key();
+ param->TakeValue( w );
+
+ SMESHGUI_strParameter* str_param = dynamic_cast<SMESHGUI_strParameter*>( param.operator->() );
+ SMESHGUI_tableParameter* tab_param = dynamic_cast<SMESHGUI_tableParameter*>( param.operator->() );
+ SMESHGUI_boolParameter* bool_param = dynamic_cast<SMESHGUI_boolParameter*>( param.operator->() );
+
+ if( str_param && str_param->needPreview() )
+ {
+ QString val; str_param->GetNewText( val );
+ myPreview->setParams( val );
+ }
+ else if( tab_param && tab_param->needPreview() )
+ {
+ SMESH::double_array d;
+ tab_param->data( d );
+ myPreview->setParams( d );
+ }
+ else if( bool_param && bool_param->needPreview() )
+ {
+ int exp=0;
+ bool_param->GetNewInt( exp );
+ myPreview->setIsExp( exp );
+ }
+ UpdateShown( param );
+ break;
+ }
+ }
+}
+
+//=================================================================================
+// function : UpdateShown()
+// purpose :
+//=================================================================================
+void StdMeshersGUI_CreateHypothesisDlg::UpdateShown( const SMESHGUI_aParameterPtr param )
+{
+ SMESHGUI_dependParameter* depPar = dynamic_cast<SMESHGUI_enumParameter*>( param.get() );
+ if( !depPar )
+ depPar = dynamic_cast<SMESHGUI_boolParameter*>( param.get() );
+
+ if( !depPar )
+ return;
+
+ SMESHGUI_dependParameter::ShownMap& map = depPar->shownMap();
+ if( map.isEmpty() )
+ return;
+
+ int val;
+ depPar->TakeValue( myParamMap[ param ].editor );
+ depPar->GetNewInt( val );
+
+ bool hasValue = map.contains( val );
+
+ ParameterMap::const_iterator anIt = myParamMap.begin(),
+ aLast = myParamMap.end();
+ bool preview = false;
+ for( ; anIt!=aLast; anIt++ )
+ {
+ bool shown = hasValue && map[ val ].contains( (*anIt).order );
+ (*anIt).editor->setShown( shown );
+ (*anIt).label->setShown( shown );
+ if( shown )
+ {
+ SMESHGUI_strParameter* str_param = dynamic_cast<SMESHGUI_strParameter*>( anIt.key().operator->() );
+ SMESHGUI_tableParameter* tab_param = dynamic_cast<SMESHGUI_tableParameter*>( anIt.key().operator->() );
+ preview = preview || ( str_param && str_param->needPreview() ) || ( tab_param && tab_param->needPreview() );
+ }
+ }
+ myPreview->setShown( preview );
+}