]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/ParametersQtDialog.cxx
Maurer signed distance filter added.
[cpPlugins.git] / lib / cpPlugins / Interface / ParametersQtDialog.cxx
index 3df62ee731aa417a959b043eafebffde64ad42e9..731fc77a120a9bd371c4b44a2e1dd02e4a328b76 100644 (file)
@@ -10,6 +10,7 @@
 #include <vtkRenderWindowInteractor.h>
 
 #include <QCheckBox>
+#include <QComboBox>
 #include <QDoubleSpinBox>
 #include <QFileDialog>
 #include <QHBoxLayout>
@@ -364,7 +365,21 @@ setParameters( Parameters* parameters )
     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;
@@ -396,6 +411,9 @@ setParameters( Parameters* parameters )
     );
   this->m_ToolsLayout->addWidget( this->m_Buttons );
 
+  // Update values
+  this->updateView( );
+
   return( true );
 }
 
@@ -499,7 +517,20 @@ updateParameters( )
     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
@@ -590,7 +621,31 @@ updateView( )
     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