@@ -35,7 +35,7 @@ SettingsTable::SettingsTable() :
35
35
// name uiName type nullable primaryKey foreignKey table
36
36
primaryKeyColumn (new Column(" projectSettingID" , QString(), ID, false, true, nullptr, this)),
37
37
settingKeyColumn (new Column(" settingKey" , QString(), String, false, false, nullptr, this)),
38
- settingValueColumn (new Column(" settingValue" , QString(), String, false , false, nullptr, this))
38
+ settingValueColumn (new Column(" settingValue" , QString(), String, true , false, nullptr, this))
39
39
{
40
40
addColumn (primaryKeyColumn);
41
41
addColumn (settingKeyColumn);
@@ -45,15 +45,18 @@ SettingsTable::SettingsTable() :
45
45
46
46
47
47
/* *
48
- * Indicates whether the given setting is present in the project settings table.
48
+ * Indicates whether the given setting is present and has a value in the project settings table.
49
49
*
50
50
* @param setting The setting to check.
51
51
* @param parent The parent window. Can be nullptr, in which case no cleanup is performed for duplicate settings.
52
- * @return True if the setting is present, false otherwise.
52
+ * @return True if the setting is present and not null , false otherwise.
53
53
*/
54
54
bool SettingsTable::settingIsPresent (const GenericProjectSetting* setting, QWidget* parent)
55
55
{
56
- return findSettingID (setting, parent).isValid ();
56
+ ItemID settingID = findSettingID (setting, parent);
57
+ if (settingID.isInvalid ()) return false ;
58
+ QVariant value = settingValueColumn->getValueFor (FORCE_VALID (settingID));
59
+ return value.isValid ();
57
60
}
58
61
59
62
/* *
@@ -108,11 +111,24 @@ void SettingsTable::setSetting(QWidget* parent, const GenericProjectSetting* set
108
111
}
109
112
110
113
/* *
111
- * Removes the setting from the project settings table entirely .
114
+ * Removes the value from the setting in the project settings table.
112
115
*
113
116
* @param parent The parent window. Cannot be nullptr.
114
117
* @param setting The setting to remove.
115
118
*/
119
+ void SettingsTable::clearSetting (QWidget* parent, const GenericProjectSetting* setting)
120
+ {
121
+ ItemID id = findSettingID (setting, parent);
122
+ if (id.isInvalid ()) return ;
123
+ updateCellInNormalTable (parent, FORCE_VALID (id), settingValueColumn, QVariant ());
124
+ }
125
+
126
+ /* *
127
+ * Removes the setting from the project settings table entirely.
128
+ *
129
+ * @param parent The parent window. Cannot be nullptr.
130
+ * @param setting The setting to remove.
131
+ */
116
132
void SettingsTable::removeSetting (QWidget* parent, const GenericProjectSetting* setting)
117
133
{
118
134
ItemID id = findSettingID (setting, parent);
0 commit comments