Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_BrowseNodeDlg.cxx
index 54cf5fa61d8bdafcbbb7e45159759d2cbf1adbfb..6d05fb711da36b5e9e0208eacb0539b643fcaf38 100644 (file)
@@ -44,7 +44,7 @@ SUPERVGUI_PortField::SUPERVGUI_PortField( QWidget* theParent, SUPERV_Port thePor
 
   QString aLabelTxt(myPort->Name());
 
-  SUPERV_CNode aNode = myPort->Node();
+  /*SUPERV_CNode aNode = myPort->Node();
   SALOME_ModuleCatalog::Service* aService = aNode->Service();
   SALOME_ModuleCatalog::ListOfServicesParameter aList;
   aList = (myPort->IsInput())? aService->ServiceinParameter : aService->ServiceoutParameter;
@@ -55,8 +55,12 @@ SUPERVGUI_PortField::SUPERVGUI_PortField( QWidget* theParent, SUPERV_Port thePor
       break;
     }
   }
-  aLabelTxt += QString(":");
+  aLabelTxt += QString(":");*/
+
+  // mkr : the following way is easyer to get ports' type than commented above
+  QString aPortType = QString(myPort->Type());
+  aLabelTxt += QString(" (") + aPortType + QString("):");
+
   myLabel = new QLabel(aLabelTxt, theParent );
 
   myValue = new QLineEdit( theParent );
@@ -67,7 +71,25 @@ SUPERVGUI_PortField::SUPERVGUI_PortField( QWidget* theParent, SUPERV_Port thePor
     aPalette.setInactive(aPalette.disabled());
     aPalette.setActive(aPalette.disabled());
     myValue->setPalette(aPalette);
-  } 
+  }
+  // mkr : PAL6276 -->
+  else {
+    if ( !aPortType.compare(QString("boolean")) )
+      myValue->setValidator( new QIntValidator( 0, 1, theParent ) );
+
+    if ( !aPortType.compare(QString("short")) || !aPortType.compare(QString("int")) || !aPortType.compare(QString("long")) )
+      myValue->setValidator( new QIntValidator( theParent ) );
+    
+    if ( !aPortType.compare(QString("float")) || !aPortType.compare(QString("double")) )
+      myValue->setValidator( new QDoubleValidator( theParent ) );
+
+    if ( !aPortType.compare(QString("char")) ) {
+      QRegExp aRX( "." );
+      myValue->setValidator( new QRegExpValidator( aRX, theParent ) );
+
+    }
+  }
+  // mkr : PAL6276 <--
   myValue->installEventFilter( this );
 }