From f0bc36e6ffbf2f814e88605f308152d56e3c7dd8 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Sun, 23 Sep 2018 10:28:21 -0400 Subject: [PATCH] Gui::FileChooser respect Qt Dialog Flag - Gui::FileChooser was not respecting the USE_QT_FILEDIALOG compile flag. --- src/Gui/FileDialog.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index e06e2663b6..e3d13be87a 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -670,11 +670,19 @@ void FileChooser::chooseFile() prechosenDirectory = FileDialog::getWorkingDirectory(); } +#if defined(USE_QT_FILEDIALOG) + QFileDialog::Options dlgOpt = QFileDialog::DontUseNativeDialog; +#else + QFileDialog::Options dlgOpt; +#endif + QString fn; - if ( mode() == File ) - fn = QFileDialog::getOpenFileName( this, tr( "Select a file" ), prechosenDirectory, _filter ); - else - fn = QFileDialog::getExistingDirectory( this, tr( "Select a directory" ), prechosenDirectory ); + if ( mode() == File ) { + fn = QFileDialog::getOpenFileName( this, tr( "Select a file" ), prechosenDirectory, _filter,0,dlgOpt ); + } else { + QFileDialog::Options option = QFileDialog::ShowDirsOnly | dlgOpt; + fn = QFileDialog::getExistingDirectory( this, tr( "Select a directory" ), prechosenDirectory,option ); + } if (!fn.isEmpty()) { fn = QDir::fromNativeSeparators(fn); @@ -746,6 +754,7 @@ QString FileChooser::buttonText() const return button->text(); } + // ---------------------------------------------------------------------- /* TRANSLATOR Gui::SelectModule */