52 explicit ConfigStore(
const QString& filepath, QSettings::Format format);
94 QSettings& operator()();
100 QString getPath() const;
109 QByteArray getByteArray(QAnyStringView section, QAnyStringView key, QByteArray def = {})
const;
117 void setByteArray(QAnyStringView section, QAnyStringView key,
const QByteArray& value);
126 QString
getString(QAnyStringView section, QAnyStringView key, QAnyStringView def = {})
const;
134 void setString(QAnyStringView section, QAnyStringView key, QAnyStringView value);
143 QStringList
getStringList(QAnyStringView section, QAnyStringView key,
const QStringList& def = {})
const;
151 void setStringList(QAnyStringView section, QAnyStringView key,
const QStringList& value);
160 std::string
getStdString(
const std::string& section,
const std::string& key,
const std::string& def = {})
const;
168 void setStdString(
const std::string& section,
const std::string& key,
const std::string& value);
177 bool getBool(QAnyStringView section, QAnyStringView key,
bool def)
const;
185 void setBool(QAnyStringView section, QAnyStringView key,
bool value);
194 double getFloat(QAnyStringView section, QAnyStringView key,
double def)
const;
202 void setFloat(QAnyStringView section, QAnyStringView key,
double value);
211 int getInt(QAnyStringView section, QAnyStringView key,
int def = 0)
const;
219 void setInt(QAnyStringView section, QAnyStringView key,
int value);
227 QVariant
getValue(QAnyStringView section, QAnyStringView key)
const;
236 QVariant
getValue(QAnyStringView section, QAnyStringView key,
const QVariant& def)
const;
244 void setValue(QAnyStringView section, QAnyStringView key,
const QVariant& value);
253 void storeWindow(QAnyStringView section, QAnyStringView key, QWidget* widget,
bool rd);
262 void storeTreeView(QAnyStringView section, QAnyStringView name,
const QTreeView* tv,
bool rd);
269 void getKeys(QAnyStringView section, QStringList& keys)
const;
276 QStringList
getKeys(QAnyStringView section)
const;
302 void removeKey(QAnyStringView section, QAnyStringView key);
Begins and ends a scope of settings for a section. When create it calls beginGroup(....
Definition ConfigStore.h:351
ConfigStore & configStore()
Gets the linked config store.
QSettings & settings()
Gets the settings instance with the section/group set.
Scope(ConfigStore &cs, QAnyStringView section)
Constructor passing a section of the scope.
Scope(const Scope &)=delete
Forbidden copy constructor.
Scope(Scope &&cs) noexcept
Move constructor.
ConfigStore * operator->()
Allows access to temporary settings having a group on the stack.
Scope & operator=(Scope &&cs) noexcept
Move constructor.
Type to create a string list accessible by keys.
Definition ConfigStore.h:23
ssize_t index_type
Definition ConfigStore.h:26
index_type indexOfKey(QAnyStringView key) const
Gets the index of the given key in the map.
Class to store application configuration. Uses the global application settings or a given ini-file.
Definition ConfigStore.h:17
ConfigStore(bool app=false)
Constructor initializing the instance using ApplicationSettings::global().getNewSettings().
int getInt(QAnyStringView section, QAnyStringView key, int def=0) const
Gets a section value from the store.
void removeKey(QAnyStringView section, QAnyStringView key)
Removes the given key from the store.
void getSectionValues(QAnyStringView section, Values &values) const
Gets the section content as mapped key-values.
QStringList getKeys(QAnyStringView section) const
Gets all keys from the given section.
void setInt(QAnyStringView section, QAnyStringView key, int value)
Sets a section integer value in the store.
std::string getStdString(const std::string §ion, const std::string &key, const std::string &def={}) const
Gets a section's value from the store.
QString getSectionDefault()
Gets default section when the given section is empty '{}'.
QString getString(QAnyStringView section, QAnyStringView key, QAnyStringView def={}) const
Gets a section's string value from the store.
bool getBool(QAnyStringView section, QAnyStringView key, bool def) const
Gets a section value from the store.
bool isSection(QAnyStringView section) const
Check if a section exists.
ConfigStore(const ConfigStore &cs)
Copy constructor. Creates a duplicate instance of the passed config store.
void setSectionValues(QAnyStringView section, const Values &values)
Replaces the section content with the given key-values.
bool exists()
Checks if the path exists.
void removeSection(QAnyStringView section)
Deletes all keys including the section.
void setString(QAnyStringView section, QAnyStringView key, QAnyStringView value)
Sets a section's string value in the store.
QStringList getStringList(QAnyStringView section, QAnyStringView key, const QStringList &def={}) const
Gets a section's string-list value from the store.
ConfigStore(ConfigStore &&) noexcept
Move constructor.
void setSectionOffset(QAnyStringView section)
Sets a section offset call QSettings::beginGroup().
void setStdString(const std::string §ion, const std::string &key, const std::string &value)
Sets a section value in the store.
ConfigStore(const QString &filepath, QSettings::Format format)
Constructor creating.
void getKeys(QAnyStringView section, QStringList &keys) const
Gets all keys from the given section.
double getFloat(QAnyStringView section, QAnyStringView key, double def) const
Gets a section value from the store.
Scope scope(QAnyStringView section)
Adds a section onto the stack of section.
void setFloat(QAnyStringView section, QAnyStringView key, double value)
Sets a section value in the store.
void setBool(QAnyStringView section, QAnyStringView key, bool value)
Sets a section value in the store.
void setValue(QAnyStringView section, QAnyStringView key, const QVariant &value)
Sets a section QVariant value in the store.
void removeKeys(QAnyStringView section)
Deletes the keys but keeps the group/section.
void storeWindow(QAnyStringView section, QAnyStringView key, QWidget *widget, bool rd)
Stores or restores the window position and size from the settings file onto the passed widget.
QVariant getValue(QAnyStringView section, QAnyStringView key, const QVariant &def) const
Gets a section value from the store.
void setSectionDefault(QAnyStringView section)
Sets default section when the given section is empty '{}'.
QVariant getValue(QAnyStringView section, QAnyStringView key) const
Gets a section value from the store.
void setStringList(QAnyStringView section, QAnyStringView key, const QStringList &value)
Sets a section's string-list value in the store.
void setByteArray(QAnyStringView section, QAnyStringView key, const QByteArray &value)
Sets a section's byte array value in the store.
ConfigStore(const QSettings &settings)
Constructor creating a copy of a passed store.
QStringList getSections() const
Gets all sections from the store in a list.
QSettings & settings()
Gets a reference to the settings currently used by this instance.
void storeTreeView(QAnyStringView section, QAnyStringView name, const QTreeView *tv, bool rd)
Stores or restores column widths of a QTreeView.
#define _MISC_CLASS
Definition misc/global.h:40
Definition Application.h:10