Gui: Use system dialogs by default (#24882)

* Fix the selector of the FileDialog and add the same default settings for the ColorDialog.

* Add option to set the default ColorDialog

* Use system dialog by default

* Remove new env var

* Fix the native file dialog selector

* Adjust env variable name

* Adjust env variable name
This commit is contained in:
Leandro Heck
2025-11-02 12:50:48 -03:00
committed by GitHub
parent 0b2268a921
commit e4f36afcb3
3 changed files with 14 additions and 13 deletions

View File

@@ -24,11 +24,7 @@ macro(InitializeFreeCADBuildOptions)
option(INSTALL_TO_SITEPACKAGES "If ON the freecad root namespace (python) is installed into python's site-packages" ON)
option(INSTALL_PREFER_SYMLINKS "If ON then fc_copy_sources macro will create symlinks instead of copying files" OFF)
option(OCCT_CMAKE_FALLBACK "disable usage of occt-config files" OFF)
if (WIN32 OR APPLE)
option(FREECAD_USE_QT_FILEDIALOG "Use Qt's file dialog instead of the native one." OFF)
else()
option(FREECAD_USE_QT_FILEDIALOG "Use Qt's file dialog instead of the native one." ON)
endif()
option(FREECAD_USE_QT_DIALOGS "Use Qt's dialogs instead of the native one." OFF)
# == Win32 is default behaviour use the LibPack copied in Source tree ==========
if(MSVC)

View File

@@ -1512,8 +1512,8 @@ if(FREECAD_USE_PCH)
PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
endif(FREECAD_USE_PCH)
if (FREECAD_USE_QT_FILEDIALOG)
set_source_files_properties(FileDialog.cpp PROPERTIES COMPILE_FLAGS -DUSE_QT_FILEDIALOG)
if (FREECAD_USE_QT_DIALOGS)
set_source_files_properties(FileDialog.cpp PROPERTIES COMPILE_FLAGS -DUSE_QT_DIALOGS)
endif()
# Suppress some very long Eigen3 warnings of older versions and

View File

@@ -53,23 +53,28 @@ using namespace Gui;
bool DialogOptions::dontUseNativeFileDialog()
{
#if defined(USE_QT_FILEDIALOG)
bool notNativeDialog = true;
#if defined(USE_QT_DIALOGS)
constexpr bool notNativeDialog = true;
#else
bool notNativeDialog = false;
constexpr bool notNativeDialog = false;
#endif
ParameterGrp::handle group = App::GetApplication().GetUserParameter().
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Dialog");
notNativeDialog = group->GetBool("DontUseNativeDialog", notNativeDialog);
return notNativeDialog;
return group->GetBool("DontUseNativeDialog", notNativeDialog);
}
bool DialogOptions::dontUseNativeColorDialog()
{
#if defined(USE_QT_DIALOGS)
constexpr bool notNativeDialog = true;
#else
constexpr bool notNativeDialog = false;
#endif
ParameterGrp::handle group = App::GetApplication().GetUserParameter().
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Dialog");
return group->GetBool("DontUseNativeColorDialog", true);
return group->GetBool("DontUseNativeColorDialog", notNativeDialog);
}
/* TRANSLATOR Gui::FileDialog */