From 2a400d9a8ec77f8d1dc4f82af7b557ce2502d1b4 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Wed, 13 Mar 2024 15:12:13 +0100
Subject: [PATCH] use CheckBox::isChecked instead of toggling value

---
 GUI/View/Main/ActionManager.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/GUI/View/Main/ActionManager.cpp b/GUI/View/Main/ActionManager.cpp
index 47ec0c495ad..ef290a0d698 100644
--- a/GUI/View/Main/ActionManager.cpp
+++ b/GUI/View/Main/ActionManager.cpp
@@ -186,15 +186,15 @@ void ActionManager::onAboutToShowSettingsMenu()
     m_settings_menu->clear();
     m_settings_menu->setToolTipsVisible(true);
     auto* action = new QWidgetAction(m_settings_menu);
-    auto* checkBox = new QCheckBox("&Enable autosave", m_settings_menu);
+    auto* check_box = new QCheckBox("&Enable autosave", m_settings_menu);
     action->setText("&Enable autosave");
-    action->setDefaultWidget(checkBox);
+    action->setDefaultWidget(check_box);
     action->setToolTip("Project will be saved periodically in project's autosave directory.\n"
                        "When opening project, recover option will be suggested, if possible.");
     action->setCheckable(true);
-    checkBox->setChecked(gApp->autosave_enabled);
-    connect(checkBox, &QCheckBox::toggled,
-            [] { gApp->autosave_enabled = !gApp->autosave_enabled; });
+    check_box->setChecked(gApp->autosave_enabled);
+    connect(check_box, &QCheckBox::toggled,
+            [=] { gApp->autosave_enabled = check_box->isChecked(); });
     m_settings_menu->addAction(action);
 }
 
-- 
GitLab