Skip to content
Permalink
Browse files

Add section in beginGroup and remove Setting.

  • Loading branch information
ismailsunni committed Sep 28, 2017
1 parent f9f5aaf commit 0c7c4948315a8d34c50a7ba685a5ae54e9640896
Showing with 13 additions and 11 deletions.
  1. +3 −3 python/core/qgssettings.sip
  2. +7 −5 src/core/qgssettings.cpp
  3. +3 −3 src/core/qgssettings.h
@@ -130,7 +130,7 @@ class QgsSettings : QObject
%End
~QgsSettings();

void beginGroup( const QString &prefix );
void beginGroup( const QString &prefix, const QgsSettings::Section section = QgsSettings::NoSection );
%Docstring
Appends prefix to the current group.
The current group is automatically prepended to all keys specified to QSettings.
@@ -245,9 +245,9 @@ Returns the path where settings written using this QSettings object are stored.
This function is called automatically from QSettings's destructor and by the event
loop at regular intervals, so you normally don't need to call it yourself.
%End
void remove( const QString &key );
void remove( const QString &key, const QgsSettings::Section section = QgsSettings::NoSection );
%Docstring
Removes the setting key and any sub-settings of key.
Removes the setting key and any sub-settings of key in a section.
%End
QString prefixedKey( const QString &key, const QgsSettings::Section section ) const;
%Docstring
@@ -83,12 +83,13 @@ QgsSettings::~QgsSettings()
}


void QgsSettings::beginGroup( const QString &prefix )
void QgsSettings::beginGroup( const QString &prefix, const QgsSettings::Section section )
{
mUserSettings->beginGroup( sanitizeKey( prefix ) );
QString pKey = prefixedKey( prefix, section );
mUserSettings->beginGroup( pKey );
if ( mGlobalSettings )
{
mGlobalSettings->beginGroup( sanitizeKey( prefix ) );
mGlobalSettings->beginGroup( pKey );
}
}

@@ -191,9 +192,10 @@ void QgsSettings::sync()
return mUserSettings->sync();
}

void QgsSettings::remove( const QString &key )
void QgsSettings::remove( const QString &key, const QgsSettings::Section section )
{
mUserSettings->remove( sanitizeKey( key ) );
QString pKey = prefixedKey( key, section );
mUserSettings->remove( pKey );
}

QString QgsSettings::prefixedKey( const QString &key, const Section section ) const
@@ -141,7 +141,7 @@ class CORE_EXPORT QgsSettings : public QObject
* In addition, query functions such as childGroups(), childKeys(), and allKeys()
* are based on the group. By default, no group is set.
*/
void beginGroup( const QString &prefix );
void beginGroup( const QString &prefix, const QgsSettings::Section section = QgsSettings::NoSection );
//! Resets the group to what it was before the corresponding beginGroup() call.
void endGroup();
//! Returns a list of all keys, including subkeys, that can be read using the QSettings object.
@@ -218,8 +218,8 @@ class CORE_EXPORT QgsSettings : public QObject
* loop at regular intervals, so you normally don't need to call it yourself.
*/
void sync();
//! Removes the setting key and any sub-settings of key.
void remove( const QString &key );
//! Removes the setting key and any sub-settings of key in a section.
void remove( const QString &key, const QgsSettings::Section section = QgsSettings::NoSection );
//! Return the sanitized and prefixed key
QString prefixedKey( const QString &key, const QgsSettings::Section section ) const;
//! Removes all entries in the user settings

0 comments on commit 0c7c494

Please sign in to comment.
You can’t perform that action at this time.