forked from qt-creator/qt-creator
CMakePM: Mark as changed only the changed values in "Batch Edit..."
Previously all values coming from "Batch Edit..." would be considered as user changed values and be displayed with bold font. This means that if I had -DMY_VAR:BOOL=ON and do a Copy and paste in "Batch Edit..." I would have it displayed as user changed and it would be passed to CMake as changed value. Also it should be possible to start with -DMY_VAR:BOOL=ON, click the check box to make it OFF and then do a "Batch Edit..." with -DMY_VAR:BOOL=ON to set the value back to original value. Change-Id: I5f6cb915b32a3288c1339135dabfd182ca16feda Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
committed by
Alessandro Portale
parent
577ad6fa3e
commit
201f91b867
@@ -288,11 +288,15 @@ void ConfigModel::setBatchEditConfiguration(const CMakeConfig &config)
|
|||||||
auto existing = std::find(m_configuration.begin(), m_configuration.end(), di);
|
auto existing = std::find(m_configuration.begin(), m_configuration.end(), di);
|
||||||
if (existing != m_configuration.end()) {
|
if (existing != m_configuration.end()) {
|
||||||
existing->isUnset = c.isUnset;
|
existing->isUnset = c.isUnset;
|
||||||
if (!c.isUnset) {
|
const QString newValue = QString::fromUtf8(c.value);
|
||||||
existing->isUserChanged = true;
|
// Allow a different value when the user didn't change anything (don't mark the same value as new)
|
||||||
|
// But allow the same value (going back) when the user did a change
|
||||||
|
const bool canSetValue = (existing->value != newValue && !existing->isUserChanged)
|
||||||
|
|| existing->isUserChanged;
|
||||||
|
if (!c.isUnset && canSetValue) {
|
||||||
|
existing->isUserChanged = existing->value != newValue;
|
||||||
existing->setType(c.type);
|
existing->setType(c.type);
|
||||||
existing->value = QString::fromUtf8(c.value);
|
existing->newValue = newValue;
|
||||||
existing->newValue = existing->value;
|
|
||||||
}
|
}
|
||||||
} else if (!c.isUnset) {
|
} else if (!c.isUnset) {
|
||||||
InternalDataItem i(di);
|
InternalDataItem i(di);
|
||||||
|
Reference in New Issue
Block a user