Skip to content
Snippets Groups Projects
Commit 779ae7af authored by Sébastien Dinot's avatar Sébastien Dinot
Browse files

ENH: Added 'Existing file' constraint in file selection widget

parent b68f6e10
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
=========================================================================*/ =========================================================================*/
#include "otbWrapperQtWidgetInputImageParameter.h" #include "otbWrapperQtWidgetInputImageParameter.h"
#include <stdexcept>
namespace otb namespace otb
{ {
...@@ -65,6 +66,7 @@ void QtWidgetInputImageParameter::SelectFile() ...@@ -65,6 +66,7 @@ void QtWidgetInputImageParameter::SelectFile()
{ {
QFileDialog fileDialog; QFileDialog fileDialog;
fileDialog.setConfirmOverwrite(true); fileDialog.setConfirmOverwrite(true);
fileDialog.setFileMode(QFileDialog::ExistingFile);
fileDialog.setNameFilter("Raster files (*)"); fileDialog.setNameFilter("Raster files (*)");
if (fileDialog.exec()) if (fileDialog.exec())
...@@ -86,10 +88,11 @@ bool QtWidgetInputImageParameter::SetFileName(const QString& value) ...@@ -86,10 +88,11 @@ bool QtWidgetInputImageParameter::SetFileName(const QString& value)
{ {
bool res = true; bool res = true;
// save value // save value
if(m_InputImageParam->SetFromFileName(static_cast<const char*>(value.toAscii())) == true ) if(m_InputImageParam->SetFromFileName(value.toAscii().constData()) == true)
{ {
// notify of value change // notify of value change
QString key( m_InputImageParam->GetKey() ); QString key( m_InputImageParam->GetKey() );
emit ParameterChanged(key); emit ParameterChanged(key);
} }
else else
......
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