- if( this->m_ParametersDlg != NULL )
- {
- this->m_ParametersDlg->close( );
- delete this->m_ParametersDlg;
-
- } // fi
- this->m_ParametersDlg = new QDialog( NULL );
- this->m_ParametersDlg->setWindowFlags( Qt::FramelessWindowHint );
- this->m_ParametersDlg->setWindowFlags( Qt::WindowTitleHint );
-
- QGridLayout* gridLayout = new QGridLayout( this->m_ParametersDlg );
- QVBoxLayout* verticalLayout = new QVBoxLayout( );
-
- // Put a title
- QLabel* title = new QLabel( this->m_ParametersDlg );
- title->setText( filter->GetClassName( ).c_str( ) );
- verticalLayout->addWidget( title );
-
- // Put values
- TParameters parameters = filter->GetDefaultParameters( );
- std::vector< std::string > names = parameters.GetParameters( );
- std::vector< std::string >::const_iterator nIt = names.begin( );
- for( ; nIt != names.end( ); ++nIt )
- {
- std::string par_name = *nIt;
- TParameters::Type par_type = parameters.GetParameterType( par_name );
-
- /* TODO
- enum Type
- {
- String = 0,
- Bool,
- Int,
- Uint,
- Real,
- Index,
- Point,
- StringList,
- BoolList,
- IntList,
- UintList,
- RealList,
- IndexList,
- PointList,
- NoType
- };
- */
- QHBoxLayout* horizontalLayout = new QHBoxLayout( );
- QLabel* label = new QLabel( this->m_ParametersDlg );
- label->setText( QString( par_name.c_str( ) ) );
- horizontalLayout->addWidget( label );
-
- QWidget* w_input = NULL;
- if( par_type == TParameters::Uint )
- {
- QSpinBox* v_uint =
- new QSpinBox( this->m_ParametersDlg );
- v_uint->setMinimum( -100 );
- v_uint->setMaximum( std::numeric_limits< int >::max( ) );
- v_uint->setValue( parameters.GetValueAsUint( par_name ) );
- v_uint->setObjectName( QString( par_name.c_str( ) ) );
- w_input = v_uint;
- }
- else if( par_type == TParameters::Int )
- {
- QSpinBox* v_int =
- new QSpinBox( this->m_ParametersDlg );
- v_int->setMinimum( -std::numeric_limits< int >::max( ) );
- v_int->setMaximum( std::numeric_limits< int >::max( ) );
- v_int->setValue( parameters.GetValueAsInt( par_name ) );
- v_int->setObjectName( QString( par_name.c_str( ) ) );
- w_input = v_int;
- }
- else if( par_type == TParameters::Real )
- {
- QDoubleSpinBox* v_double =
- new QDoubleSpinBox( this->m_ParametersDlg );
- v_double->setDecimals( 3 );
- v_double->setMinimum( -( std::numeric_limits< double >::max( ) ) );
- v_double->setMaximum( std::numeric_limits< double >::max( ) );
- v_double->setValue( parameters.GetValueAsReal( par_name ) );
- v_double->setObjectName( QString( par_name.c_str( ) ) );
- w_input = v_double;
-
- } // fi
-
- if( w_input != NULL )
- {
- horizontalLayout->addWidget( w_input );
- verticalLayout->addLayout( horizontalLayout );
-
- } // fi
-
- } // rof