]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/ParametersQtDialog.cxx
...
[cpPlugins.git] / lib / cpPlugins / Interface / ParametersQtDialog.cxx
index 819abd3ca49daf02f38f1d31eb99ce2930341cc0..1cc5820f30ee9561ba890cff5df75907133ea912 100644 (file)
@@ -10,6 +10,7 @@
 #include <QHBoxLayout>
 #include <QLabel>
 #include <QLineEdit>
+#include <QTableWidget>
 #include <QWidget>
 
 // -------------------------------------------------------------------------
@@ -47,7 +48,6 @@ ParametersQtDialog(
        BoolList,
        IntList,
        UintList,
-       RealList,
        IndexList,
        PointList,
        NoType
@@ -91,6 +91,26 @@ ParametersQtDialog(
       v_double->setMaximum(  std::numeric_limits< double >::max( ) );
       v_double->setValue( parameters.GetValueAsReal( *nIt ) );
       w_input = v_double;
+    }
+    else if( pt == Parameters::RealList )
+    {
+      QStringList header;
+      header << nIt->c_str( );
+
+      QTableWidget* l_double = new QTableWidget( dlg );
+      l_double->setColumnCount( 1 );
+      l_double->setRowCount( 1 );
+      l_double->setHorizontalHeaderLabels( header );
+      l_double->setShowGrid( true );
+      l_double->setSelectionBehavior( QAbstractItemView::SelectRows );
+      l_double->setSelectionMode( QAbstractItemView::SingleSelection );
+
+      QObject::connect(
+        l_double, SIGNAL( cellDoubleClicked( int, int ) ),
+        l_double, SLOT( insertRow( int ) )
+        );
+
+      w_input = l_double;
 
     } // fi
 
@@ -159,6 +179,24 @@ ParametersQtDialog(
         dlg->findChild< QDoubleSpinBox* >( nIt->c_str( ) );
       if( v_double != NULL )
         parameters.SetValueAsReal( *nIt, v_double->value( ) );
+    }
+    else if( pt == Parameters::RealList )
+    {
+      QTableWidget* l_double =
+        dlg->findChild< QTableWidget* >( nIt->c_str( ) );
+      if( l_double != NULL )
+      {
+        for( int r = 0; r < l_double->rowCount( ); ++r )
+        {
+          double v =
+            std::atof(
+              l_double->item( r, 0 )->text( ).toStdString( ).c_str( )
+              );
+          parameters.AddValueToRealList( *nIt, v );
+
+        } // rof
+
+      } // fi
 
     } // fi