ProjectExplorer: Add default value handling to BaseBoolAspect

Will be useful e.g. for "Incremental deployment" in RL's
GenericDirectUploadStep.

Change-Id: Idb07db2d9f075cda8f4cbb905f1e04fc24342ce0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
hjk
2018-09-14 13:14:31 +02:00
parent c3433519a6
commit 0e1dcc2eb7
2 changed files with 15 additions and 1 deletions

View File

@@ -632,7 +632,7 @@ void BaseBoolAspect::addToConfigurationLayout(QFormLayout *layout)
void BaseBoolAspect::fromMap(const QVariantMap &map)
{
m_value = map.value(settingsKey(), false).toBool();
m_value = map.value(settingsKey(), m_defaultValue).toBool();
}
void BaseBoolAspect::toMap(QVariantMap &data) const
@@ -640,6 +640,16 @@ void BaseBoolAspect::toMap(QVariantMap &data) const
data.insert(settingsKey(), m_value);
}
bool BaseBoolAspect::defaultValue() const
{
return m_defaultValue;
}
void BaseBoolAspect::setDefaultValue(bool defaultValue)
{
m_defaultValue = defaultValue;
}
bool BaseBoolAspect::value() const
{
return m_value;

View File

@@ -133,6 +133,9 @@ public:
bool value() const;
void setValue(bool val);
bool defaultValue() const;
void setDefaultValue(bool defaultValue);
void setLabel(const QString &label);
void fromMap(const QVariantMap &map) override;
@@ -140,6 +143,7 @@ public:
private:
bool m_value = false;
bool m_defaultValue = false;
QString m_label;
QPointer<QCheckBox> m_checkBox; // Owned by RunConfigWidget
};