diff --git a/src/plugins/projectexplorer/projectconfigurationaspects.cpp b/src/plugins/projectexplorer/projectconfigurationaspects.cpp index 79ad3217441..c32bf2850f2 100644 --- a/src/plugins/projectexplorer/projectconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/projectconfigurationaspects.cpp @@ -127,6 +127,7 @@ class BaseIntegerAspectPrivate { public: qint64 m_value = 0; + qint64 m_defaultValue = 0; QVariant m_minimumValue; QVariant m_maximumValue; int m_displayIntegerBase = 10; @@ -684,12 +685,15 @@ void BaseIntegerAspect::addToLayout(LayoutBuilder &builder) void BaseIntegerAspect::fromMap(const QVariantMap &map) { - d->m_value = map.value(settingsKey()).toLongLong(); + d->m_value = map.value(settingsKey(), d->m_defaultValue).toLongLong(); } void BaseIntegerAspect::toMap(QVariantMap &data) const { - data.insert(settingsKey(), d->m_value); + if (d->m_value != d->m_defaultValue) + data.insert(settingsKey(), d->m_value); + else + data.remove(settingsKey()); } qint64 BaseIntegerAspect::value() const @@ -746,6 +750,11 @@ void BaseIntegerAspect::setEnabled(bool enabled) d->m_spinBox->setEnabled(enabled); } +void BaseIntegerAspect::setDefaultValue(qint64 defaultValue) +{ + d->m_defaultValue = defaultValue; +} + BaseTriStateAspect::BaseTriStateAspect() { setDisplayStyle(DisplayStyle::ComboBox); diff --git a/src/plugins/projectexplorer/projectconfigurationaspects.h b/src/plugins/projectexplorer/projectconfigurationaspects.h index aadaeda6fa7..857169b5346 100644 --- a/src/plugins/projectexplorer/projectconfigurationaspects.h +++ b/src/plugins/projectexplorer/projectconfigurationaspects.h @@ -190,6 +190,7 @@ public: void setDisplayIntegerBase(int base); void setDisplayScaleFactor(qint64 factor); void setEnabled(bool enabled); + void setDefaultValue(qint64 defaultValue); void fromMap(const QVariantMap &map) override; void toMap(QVariantMap &map) const override;