From 99f859e2ac2ee4681b27ecafd8794fd68027f1df Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Mon, 6 Mar 2017 10:51:54 +0100 Subject: [PATCH] QgsSettings: removed lower(), now it's case sensistive --- python/core/qgssettings.sip | 3 --- src/core/qgssettings.cpp | 2 +- src/core/qgssettings.h | 3 --- tests/src/python/test_qgssettings.py | 4 ++-- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/python/core/qgssettings.sip b/python/core/qgssettings.sip index 1869d1f0813..a5c99410dea 100644 --- a/python/core/qgssettings.sip +++ b/python/core/qgssettings.sip @@ -21,8 +21,6 @@ * - the second one (Global Settings) is meant to provide read-only * pre-configuration and defaults to the first one. * - * Unlike the original QSettings, the keys of QgsSettings are case insensitive. - * * For a given settings key, the function call to value(key, default) will return * the first existing setting in the order specified below: * - User Settings @@ -155,7 +153,6 @@ typedef PyObject *(*pyqt5_from_qvariant_by_type)(QVariant &value, PyObject *type void setArrayIndex( int i ); //! Sets the value of setting key to value. If the key already exists, the previous value is overwritten. //! An optional Section argument can be used to set a value to a specific Section. - //! @note keys are case insensitive void setValue(const QString &key, const QVariant &value, const QgsSettings::Section section = QgsSettings::Section::NoSection ); /** Returns the value for setting key. If the setting doesn't exist, it will be * searched in the Global Settings and if not found, returns defaultValue. diff --git a/src/core/qgssettings.cpp b/src/core/qgssettings.cpp index aa372800552..b008b785e44 100644 --- a/src/core/qgssettings.cpp +++ b/src/core/qgssettings.cpp @@ -256,7 +256,7 @@ void QgsSettings::setValue( const QString &key, const QVariant &value, const Qgs // To lower case and clean the path QString QgsSettings::sanitizeKey( QString key ) const { - return QDir::cleanPath( key.toLower() ); + return QDir::cleanPath( key ); } void QgsSettings::clear() diff --git a/src/core/qgssettings.h b/src/core/qgssettings.h index 5b6f81c2003..5f4b663aa23 100644 --- a/src/core/qgssettings.h +++ b/src/core/qgssettings.h @@ -28,8 +28,6 @@ * - the second one (Global Settings) is meant to provide read-only * pre-configuration and defaults to the first one. * - * Unlike the original QSettings, the keys of QgsSettings are case insensitive. - * * For a given settings key, the function call to value(key, default) will return * the first existing setting in the order specified below: * - User Settings @@ -158,7 +156,6 @@ class CORE_EXPORT QgsSettings : public QObject void setArrayIndex( int i ); //! Sets the value of setting key to value. If the key already exists, the previous value is overwritten. //! An optional Section argument can be used to set a value to a specific Section. - //! @note keys are case insensitive void setValue( const QString &key, const QVariant &value, const Section section = Section::NoSection ); /** Returns the value for setting key. If the setting doesn't exist, it will be diff --git a/tests/src/python/test_qgssettings.py b/tests/src/python/test_qgssettings.py index c774e4e3dfc..2a2b474c5c1 100644 --- a/tests/src/python/test_qgssettings.py +++ b/tests/src/python/test_qgssettings.py @@ -219,9 +219,9 @@ class TestQgsSettings(unittest.TestCase): def test_remove(self): self.settings.setValue('testQgisSettings/temp', True) - self.assertEqual(self.settings.value('testqgissettings/temp'), True) + self.assertEqual(self.settings.value('testQgisSettings/temp'), True) self.settings.remove('testQgisSettings/temp') - self.assertEqual(self.settings.value('testqgissettings/temp'), None) + self.assertEqual(self.settings.value('testqQgisSettings/temp'), None) if __name__ == '__main__':