#include <limits>
#include <cpPlugins/Interface/ParametersListWidget.h>
+#include <cpPlugins/Interface/ProcessObject.h>
#include <vtkCommand.h>
#include <vtkRenderWindowInteractor.h>
#include <QCheckBox>
+#include <QComboBox>
#include <QDoubleSpinBox>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QPushButton>
#include <QWidget>
-// -------------------------------------------------------------------------
-#include <cpPlugins/Interface/ProcessObject.h>
-#include <cpPlugins/Interface/Plugins.h>
-#include <cpPlugins/Interface/BaseApplication.h>
-
+/* TODO
class SingleSeedCommand
: public vtkCommand
{
cpPlugins::Interface::ParametersQtDialog* Dialog;
std::string Name;
};
+*/
// -------------------------------------------------------------------------
cpPlugins::Interface::ParametersQtDialog::
ParametersQtDialog( QWidget* parent, Qt::WindowFlags f )
: QDialog( parent, f ),
- m_Parameters( NULL )
+ m_Parameters( NULL ),
+ m_Interactive( false )
{
this->m_Title = new QLabel( this );
this->m_Title->setText( "Parameters dialog title" );
return( this->m_Interactors );
}
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::ParametersQtDialog::
+isInteractive( ) const
+{
+ return( this->m_Interactive );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::ParametersQtDialog::
+setInteractive( bool i )
+{
+ this->m_Interactive = i;
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::ParametersQtDialog::
+interactiveOn( )
+{
+ this->m_Interactive = true;
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::ParametersQtDialog::
+interactiveOff( )
+{
+ this->m_Interactive = false;
+}
+
// -------------------------------------------------------------------------
bool cpPlugins::Interface::ParametersQtDialog::
setParameters( Parameters* parameters )
this->m_Title->setText( title.str( ).c_str( ) );
// Put values
+ this->m_Widgets.clear( );
auto& raw_params = this->m_Parameters->GetRawParameters( );
for( auto pIt = raw_params.begin( ); pIt != raw_params.end( ); ++pIt )
{
w_input = v_double;
}
break;
- case Parameters::Index:
- break;
- case Parameters::Point:
- break;
- case Parameters::Vector:
- break;
case Parameters::OpenFileName:
{
QFrame* frame = new QFrame( this );
w_input = frame;
}
break;
- case Parameters::IndexList:
- break;
- case Parameters::PointList:
- break;
- case Parameters::VectorList:
- break;
case Parameters::OpenFileNameList:
{
QFrame* frame = new QFrame( this );
case Parameters::PathNameList:
break;
case Parameters::Choices:
- break;
+ {
+ QComboBox* v_choices = new QComboBox( this );
+ v_choices->setObjectName( pIt->first.c_str( ) );
+
+ std::istringstream str0( pIt->second.second );
+ std::string choices;
+ std::getline( str0, choices, '@' );
+ std::istringstream str1( choices );
+ std::string token;
+ int id = 0;
+ while( std::getline( str1, token, '#' ) )
+ v_choices->insertItem( id++, token.c_str( ) );
+ w_input = v_choices;
+ }
+ break;
default:
w_input = NULL;
break;
);
this->m_ToolsLayout->addWidget( this->m_Buttons );
+ // Update values
+ this->updateView( );
+
return( true );
}
} // fi
}
break;
- case Parameters::Index:
- break;
- case Parameters::Point:
- break;
- case Parameters::Vector:
- break;
case Parameters::StringList:
break;
case Parameters::BoolList:
break;
- case Parameters::IndexList:
- break;
- case Parameters::PointList:
- break;
- case Parameters::VectorList:
- break;
case Parameters::SaveFileNameList:
break;
case Parameters::PathNameList:
break;
case Parameters::Choices:
- break;
+ {
+ QComboBox* v_choices = this->findChild< QComboBox* >( pName );
+ if( v_choices != NULL )
+ {
+ std::istringstream str_choices( pIt->second.second );
+ std::string real_choices;
+ std::getline( str_choices, real_choices, '@' );
+ pIt->second.second =
+ real_choices + "@" +
+ v_choices->currentText( ).toStdString( );
+
+ } // fi
+ }
+ break;
default:
break;
} // hctiws
} // fi
}
break;
- case Parameters::Index:
- break;
- case Parameters::Point:
- break;
- case Parameters::Vector:
- break;
case Parameters::StringList:
break;
case Parameters::BoolList:
break;
- case Parameters::IndexList:
- break;
- case Parameters::PointList:
- break;
- case Parameters::VectorList:
- break;
case Parameters::SaveFileNameList:
break;
case Parameters::PathNameList:
break;
case Parameters::Choices:
- break;
+ {
+ QComboBox* v_choices = this->findChild< QComboBox* >( pName );
+ if( v_choices != NULL )
+ {
+ std::istringstream str_choices( pIt->second.second );
+ std::string choices, real_choice;
+ std::getline( str_choices, choices, '@' );
+ std::getline( str_choices, real_choice, '@' );
+ std::istringstream str( choices );
+ std::string token;
+ int id = -1, cont = 0;
+ while( std::getline( str, token, '#' ) )
+ {
+ if( token == real_choice )
+ id = cont;
+ cont++;
+
+ } // elihw
+
+ if( id > -1 )
+ v_choices->setCurrentIndex( id );
+
+ } // fi
+ }
+ break;
default:
break;
} // hctiws