diff --git a/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h b/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h index f9760192c4b240e2b16167fbd1355b646934c1ba..d7b42e3083116faed0e1d51627f39c48206114d6 100644 --- a/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h +++ b/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h @@ -81,8 +81,12 @@ public: void SetIOMode( IOMode ); IOMode GetIOMode() const; +signals: + void FilenameChanged(); + protected slots: void SelectFile(); + void CallFilenameChanged(); private: QtFileSelectionWidget(const QtFileSelectionWidget&); //purposely not implemented diff --git a/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx b/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx index 818628ac6efec74c521db9adc15e6f9d4d10181e..37e4f3eed3ee02c97da7956d506f55d3c82ab98c 100644 --- a/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx +++ b/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx @@ -74,6 +74,7 @@ void QtFileSelectionWidget::DoCreateWidget() m_HLayout->addWidget(m_Checkbox); m_Input = new QLineEdit; + connect( m_Input, SIGNAL(editingFinished()), this, SLOT(CallFilenameChanged()) ); m_HLayout->addWidget(m_Input); // Set up input text edit @@ -116,8 +117,16 @@ QtFileSelectionWidget return; m_Input->setText( filename ); + + emit FilenameChanged(); } +void +QtFileSelectionWidget +::CallFilenameChanged() +{ + emit FilenameChanged(); +} } diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageListParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageListParameter.cxx index 5fb29a0ab94cc3837a18d32ebd912c2a622f9adb..8224946af0c073f5707a8ee268c2e4dfde1ebefa 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageListParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageListParameter.cxx @@ -134,7 +134,7 @@ void QtWidgetInputImageListParameter::DoCreateWidget() fileSelection->setFixedHeight(30); fileLayout->addWidget(fileSelection); m_InputImageListParam->AddNullElement(); - connect(fileSelection->GetInput(), SIGNAL(textChanged(const QString&)), this, SLOT(UpdateImageList())); + connect(fileSelection, SIGNAL(FilenameChanged()), this, SLOT(UpdateImageList())); m_FileSelectionList.push_back(fileSelection); @@ -319,8 +319,8 @@ QtWidgetInputImageListParameter::AddFile() /* No need of AddNullElement() here. Moved adding NullElement when updating the list */ //m_InputImageListParam->AddNullElement(); connect( - fileSelection->GetInput(), - SIGNAL( textChanged( const QString & ) ), + fileSelection, + SIGNAL( FilenameChanged() ), this, SLOT( UpdateImageList() ) ); @@ -372,7 +372,7 @@ QtWidgetInputImageListParameter::EraseFile() m_FileLayout->addWidget(fileSelection); m_FileSelectionList.push_back(fileSelection); m_InputImageListParam->AddNullElement(); - connect(fileSelection->GetInput(), SIGNAL(textChanged(const QString&)), this, SLOT(UpdateImageList())); + connect(fileSelection, SIGNAL(FilenameChanged()), this, SLOT(UpdateImageList())); QGroupBox *mainGroup = new QGroupBox(); mainGroup->setLayout(m_FileLayout); @@ -396,7 +396,7 @@ void QtWidgetInputImageListParameter::RecreateImageList() for(unsigned int j = 0; j < m_FileSelectionList.size(); j++) { m_InputImageListParam->AddFromFileName(m_FileSelectionList[j]->GetFilename()); - connect(m_FileSelectionList[j]->GetInput(), SIGNAL(textChanged(const QString&)), this, SLOT(UpdateImageList())); + connect(m_FileSelectionList[j], SIGNAL(FilenameChanged()), this, SLOT(UpdateImageList())); } emit Change();