From 2a61ceae5b08fef8d3038fa2ca1fa89ddbc32438 Mon Sep 17 00:00:00 2001 From: xiaoyeliu <166936931+womendoushihaoyin@users.noreply.github.com> Date: Sat, 30 Nov 2024 22:23:07 +0800 Subject: [PATCH] Fix: The "Unsaved Changes Dialog" pops up, but the content display section is empty. (#7482) fix:The Unsaved Changes Dialog pops up, but the content display section is empty. --- src/slic3r/GUI/GUI_App.cpp | 5 +++-- src/slic3r/GUI/UnsavedChangesDialog.hpp | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 4415118af5d..aedbea2c07a 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -5647,7 +5647,8 @@ bool GUI_App::check_and_keep_current_preset_changes(const wxString& caption, con bool is_called_from_configwizard = postponed_apply_of_keeped_changes != nullptr; UnsavedChangesDialog dlg(caption, header, "", action_buttons); - if (dlg.ShowModal() == wxID_CANCEL) + bool no_need_change = dlg.getUpdateItemCount() == 0 ? true : false; + if (!no_need_change && dlg.ShowModal() == wxID_CANCEL) return false; auto reset_modifications = [this, is_called_from_configwizard]() { @@ -5662,7 +5663,7 @@ bool GUI_App::check_and_keep_current_preset_changes(const wxString& caption, con load_current_presets(false); }; - if (dlg.discard()) + if (dlg.discard() || no_need_change) reset_modifications(); else // save selected changes { diff --git a/src/slic3r/GUI/UnsavedChangesDialog.hpp b/src/slic3r/GUI/UnsavedChangesDialog.hpp index f91fa844f49..c6dbd205057 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.hpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.hpp @@ -312,6 +312,8 @@ class UnsavedChangesDialog : public DPIDialog { } }; +public: + int getUpdateItemCount() { return m_presetitems.size(); } private: std::vector m_presetitems;