Commit a66442cf authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen
Browse files

Preferences: Create a SettingValue if the variable doesn't exist already.

This fixes issue #142
parent edce3c85
......@@ -81,9 +81,17 @@ SettingsManager::value( const QString &key,
{
QReadLocker rl( &m_rwLock );
if ( ( type == XML || type == All ) && m_xmlSettings.contains( key ) )
return m_xmlSettings.value( key )->get();
else if ( ( type == QSett || type == All ) )
if ( ( type == XML || type == All ) )
{
if ( m_xmlSettings.contains( key ) )
return m_xmlSettings.value( key )->get();
else
{
m_xmlSettings.insert( key, new SettingValue( defaultValue ) );
return defaultValue;
}
}
else if ( type == QSett )
{
if ( m_classicSettings.contains( key ) )
return m_classicSettings.value( key )->get();
......@@ -97,8 +105,6 @@ SettingsManager::value( const QString &key,
return val;
}
}
return defaultValue;
}
QHash<QString, QVariant>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment