Utils: Streamline QtcSettings interface

Change-Id: Icd9592c0fca5df1e52bdafb570665d92deeb70bb
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-09-27 16:53:35 +02:00
parent aeb05db3af
commit 7a4e66992c
13 changed files with 110 additions and 149 deletions

View File

@@ -11,7 +11,8 @@ namespace Utils {
\inheaderfile utils/qtcsettings.h
\inmodule QtCreator
\brief The QtcSettings class is an extension of the QSettings class.
\brief The QtcSettings class is an extension of the QSettings class
the uses Utils::Key instead of QString for keys.
Use Utils::QtcSettings::setValueWithDefault() to write values with a
default.
@@ -30,6 +31,16 @@ namespace Utils {
\sa QSettings::setValue()
*/
void QtcSettings::beginGroup(const Key &prefix)
{
QSettings::beginGroup(stringFromKey(prefix));
}
QVariant QtcSettings::value(const Key &key) const
{
return QSettings::value(stringFromKey(key));
}
QVariant QtcSettings::value(const Key &key, const QVariant &def) const
{
return QSettings::value(stringFromKey(key), def);
@@ -40,6 +51,16 @@ void QtcSettings::setValue(const Key &key, const QVariant &value)
QSettings::setValue(stringFromKey(key), mapEntryFromStoreEntry(value));
}
void QtcSettings::remove(const Key &key)
{
QSettings::remove(stringFromKey(key));
}
bool QtcSettings::contains(const Key &key) const
{
return QSettings::contains(stringFromKey(key));
}
KeyList QtcSettings::childKeys() const
{
return keysFromStrings(QSettings::childKeys());