Skip to content
Snippets Groups Projects
Commit 92bd4d3a authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

ENH: wait the end of edition before calling update (InputImage widget)

parent 242925a7
No related branches found
No related tags found
No related merge requests found
......@@ -48,8 +48,11 @@ public:
inline const QLineEdit* GetInput() const;
inline QLineEdit* GetInput();
signals:
void FileNameIsSet();
protected slots:
bool SetFileName( const QString& value );
bool SetFileName();
void SelectFile();
private:
......
......@@ -69,8 +69,8 @@ void QtWidgetInputImageParameter::DoCreateWidget()
m_HLayout->setContentsMargins(0, 0, 0, 0);
m_Input = new QLineEdit;
m_Input->setToolTip( m_InputImageParam->GetDescription() );
connect( m_Input, SIGNAL(textChanged(const QString&)), this, SLOT(SetFileName(const QString&)) );
connect( m_Input, SIGNAL(textChanged(const QString&)), GetModel(), SLOT(NotifyUpdate()) );
connect( m_Input, SIGNAL(editingFinished()), this, SLOT(SetFileName()) );
connect( this, SIGNAL(FileNameIsSet()), GetModel(), SLOT(NotifyUpdate()) );
m_HLayout->addWidget(m_Input);
......@@ -105,7 +105,9 @@ QtWidgetInputImageParameter
if( filename.isEmpty() )
return;
if( !SetFileName( filename ) )
m_Input->setText( filename );
if( !SetFileName() )
{
std::ostringstream oss;
......@@ -119,21 +121,20 @@ QtWidgetInputImageParameter
return;
}
m_Input->setText( filename );
}
bool QtWidgetInputImageParameter::SetFileName(const QString& value)
bool QtWidgetInputImageParameter::SetFileName()
{
bool res = true;
// save value
if( m_InputImageParam->SetFromFileName(
QFile::encodeName( value ).constData() ) == true )
QFile::encodeName( m_Input->text() ).constData() ) == true )
{
// notify of value change
QString key( m_InputImageParam->GetKey() );
emit ParameterChanged(key);
emit FileNameIsSet();
}
else
res = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment