From 7c5adaf95d2d7b5a442b1d0887272b42fe749f64 Mon Sep 17 00:00:00 2001
From: Otmane Lahlou <otmane.lahlou@c-s.fr>
Date: Fri, 12 Apr 2013 16:15:53 +0200
Subject: [PATCH] ENH: make SetFileName public slot + implement DoUpdateGUI to
 be able to fill it programmatically

---
 .../QtWidget/otbWrapperQtWidgetOutputImageParameter.cxx   | 8 ++++++--
 .../QtWidget/otbWrapperQtWidgetOutputImageParameter.h     | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.cxx b/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.cxx
index f451ccb4a4..9dc95d33c8 100644
--- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.cxx
+++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.cxx
@@ -35,7 +35,11 @@ QtWidgetOutputImageParameter::~QtWidgetOutputImageParameter()
 
 void QtWidgetOutputImageParameter::DoUpdateGUI()
 {
-
+  // Update the lineEdit
+  if (m_Input->text() != m_OutputImageParam->GetFileName())
+    {
+    m_Input->setText(m_OutputImageParam->GetFileName());
+    }
 }
 
 void QtWidgetOutputImageParameter::DoCreateWidget()
@@ -44,7 +48,7 @@ void QtWidgetOutputImageParameter::DoCreateWidget()
   m_HLayout = new QHBoxLayout;
   m_HLayout->setSpacing(0);
   m_HLayout->setContentsMargins(0, 0, 0, 0);
-  m_Input = new QLineEdit;
+  m_Input = new QLineEdit();
   m_Input->setToolTip( m_OutputImageParam->GetDescription() );
   connect( m_Input, SIGNAL(textChanged(const QString&)), this, SLOT(SetFileName(const QString&)) );
   connect( m_Input, SIGNAL(textChanged(const QString&)), GetModel(), SLOT(NotifyUpdate()) );
diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.h b/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.h
index b3eec8f870..dbc75945c8 100644
--- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.h
+++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.h
@@ -41,8 +41,10 @@ public:
   /** Get the PixelType*/
   //itkGetMacro(PixelType, int);
 
-protected slots:
+public slots:
   void SetFileName( const QString& value );
+
+protected slots:
   void SelectFile();
   void SetPixelType(int pixelType);
 
-- 
GitLab