From dc825e11bdd7a9b17fb04052303029add4b63635 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Tue, 1 Feb 2022 12:38:38 +0100 Subject: [PATCH] CMakePM: Fix "Reset" on changed values in Settings Previously the reset button would only work on new items being removed. User changes on existing items would not be reverted. Change-Id: I8d9bde058487c9568bfb802f131a29ec32fc1f8c Reviewed-by: Alessandro Portale Reviewed-by: --- src/plugins/cmakeprojectmanager/configmodel.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/cmakeprojectmanager/configmodel.cpp b/src/plugins/cmakeprojectmanager/configmodel.cpp index 15e2de1f021..7b3378eb6af 100644 --- a/src/plugins/cmakeprojectmanager/configmodel.cpp +++ b/src/plugins/cmakeprojectmanager/configmodel.cpp @@ -298,6 +298,13 @@ void ConfigModel::setConfiguration(const QList &c // merge old/new entry: InternalDataItem item(*newIt); item.newValue = (newIt->value != oldIt->newValue) ? oldIt->newValue : QString(); + + // Do not mark as user changed when we have a reset + if (oldIt->isUserChanged && !oldIt->newValue.isEmpty() && + !newIt->isUserChanged && newIt->newValue.isEmpty() && + oldIt->value == newIt->value) + item.newValue.clear(); + item.isUserChanged = !item.newValue.isEmpty() && (item.newValue != item.value); result << item; ++newIt;