SettingsStorage

SettingsStorage is Blackchirp’s owning, write-protected wrapper around a QSettings group. It maintains an in-memory copy of every key, array, group, and registered getter under a single QSettings group, exposes type-safe get / getArray / getGroupValue accessors for read-only consumers, and reserves the mutating set family to classes that inherit from it. This split is what lets any code in the program look up a hardware setting (by constructing a transient SettingsStorage over the appropriate group) while still guaranteeing that only the owning HardwareObject (or a declared friend) can change it.

The user-facing surfaces of this storage layer are the profile creation flow described in Hardware and Library Configuration and the hardware settings dialog in Hardware Dialog. All persistent settings keys are declared statically in the BC::Key:: namespace hierarchy (see data/bcglobals.h and data/settings/hardwarekeys.h); the system-level role of SettingsStorage in Blackchirp’s persistence model is described in Persistence.

Container shapes

Settings under a group may take any of four shapes; SettingsStorage keeps each in its own in-memory map:

  • Values — single key/QVariant pairs. The default shape.

  • Arrays — vectors of SettingsMap; map directly to QSettings::beginWriteArray / beginReadArray. Useful for repeated records like pulse-generator channels or AWG sample-rate tables.

  • Groups — nested SettingsMap values. Each group is a flat key/value table under its own subgroup name; useful for protocol-specific or per-driver configuration blocks.

  • Gettersstd::function<QVariant()> callbacks bound to a key. When the key is read, the getter is called; when save() runs, the getter’s return value is what gets written. Owners use getters to keep a key in sync with a member variable or UI widget without having to call set() on every change. Getters apply to single-value keys only, never to arrays or groups.

Constructing

SettingsStorage opens its group by calling QSettings::beginGroup once for each entry in the constructor’s keys list. An empty list defaults to the top-level "Blackchirp" group:

SettingsStorage s;                            // top-level Blackchirp group
SettingsStorage hw({"AWG.main"});             // hardware instance group
SettingsStorage sub({"AWG.main", "virtual"}); // nested subgroup

Whenever possible, pass key constants from BC::Key::* (declared in bcglobals.h and hardwarekeys.h) rather than literal strings so the compiler catches typos.

The Type enum and the type constructor parameter are accepted for source compatibility but have no effect on the opened group. Always pass the full keys list; there is no per-type subkey lookup.

Owning a group

To gain write access, a class inherits from SettingsStorage and initializes it with the keys that define its group. Multiple inheritance with QObject is supported:

class MyClass : public QObject, public SettingsStorage
{
public:
    MyClass(QObject *parent = nullptr) :
        QObject(parent),
        SettingsStorage({BC::Key::MyClass::group})
    { ... }
};

Inheriting from SettingsStorage deletes the copy and assignment operators, so SettingsStorage owners must always be passed by pointer or reference — never by value. Data classes that need value semantics (e.g. Experiment, FtmwConfig) read from SettingsStorage rather than inheriting from it.

The destructor calls save(), so any pending changes land in QSettings when the owner goes away. Owners that bind getters to UI widgets must call clearGetters() in their destructor before the widgets are torn down, or save() will dereference deleted objects.

Setting and saving

The mutating API revolves around set() (single value), setArray() (array), setGroupValue() / setGroupValues() (group), and registerGetter() (callback). Each set / setArray takes an optional write flag: when true, the value is pushed to QSettings immediately; when false (the default), it stays in memory until save() runs.

Defaults

Two helpers seed values that should exist on first launch:

  • setDefault() — write value if the key does not yet exist.

  • getOrSetDefault() — same, but return the resulting value (existing or newly written) so the caller can use it inline.

For HardwareObject subclasses, the hardware-settings registry (see hardwareregistration.h and Hardware Configuration) is the preferred way to declare defaults: settings registered with REGISTER_HARDWARE_SETTINGS and friends are applied automatically by HardwareObject::applyRegisteredSettings(). Reach for setDefault() directly only for non-hardware classes.

Reading and rereading

The constructor reads the entire group up front. readAll() rereads everything; useful when QSettings has been changed by another actor (a hardware-settings dialog, a settings editor, an external helper). Registered getters are skipped on reread, since reading them would require interrogating the live source object — unregister or clearGetters() first if you really do want every key reloaded.

Discarding

discardChanges(true) tells the destructor (and the periodic save() paths) to skip writes. It is most useful when batching writes inside a transient helper: discard, mutate, undiscard, save() exactly once. discardChanges() does not roll back values that have already been written via the immediate-write flag.

Removing

  • clearValue() removes a single key (across all containers) from memory and QSettings.

  • purge() wipes this object’s entire group from QSettings, clears the in-memory caches, and sets the discard flag so the destructor does not re-write anything. Used when permanently deleting a hardware profile.

  • purgeGroup() and purgeGroupsBySuffix() are static helpers for removing groups when no live instance over that group exists (e.g. cleaning up widget-state groups after deleting a profile).

Friend-class write helper

The set / setArray family is protected, so a class that does not own a group cannot write to it directly. The recommended escape hatch is a tiny private friend subclass that exposes the protected API to the trusted parent. LoadoutManager uses exactly this pattern:

class LoadoutManager
{
private:
    class LoadoutHelper : public SettingsStorage
    {
        friend class LoadoutManager;
    public:
        LoadoutHelper(const QStringList &keys) : SettingsStorage(keys) {}
    };

    void p_writeLoadout(const HardwareLoadout &loadout)
    {
        LoadoutHelper sub({key.toString(), loadout.name});
        sub.discardChanges(true);
        sub.setArray(hwMapKey, ...);
        sub.set(currentFtmwPresetKey, ...);
        sub.discardChanges(false);
        sub.save();        // batched write to QSettings
    }
};

Use this pattern with care. The read-public / write-protected split is the main guardrail against cross-class corruption of persisted state, and a friend helper that routinely writes to groups owned by other classes erodes that guarantee silently. The justified use cases are short — manager classes that compose persistent state across many owners (loadouts, presets, profile registries) and tests. If a helper starts being reused from many places or for many groups, that is a sign the data should move to a class that owns it directly.

Getter example

Getters allow the owner to expose a member variable as if it were a stored key. The getter must be a const member function (or a std::function<T()> lambda) returning a QVariant-compatible type:

class MyClass : public SettingsStorage
{
public:
    MyClass();
    int getInt() const { return d_int; }
private:
    int d_int = 1;
};

MyClass::MyClass() : SettingsStorage()
{
    registerGetter("myInt", this, &MyClass::getInt);
    int i = get<int>("myInt");      // 1
    d_int = 10;
    int j = get<int>("myInt");      // 10

    QVariant k = unRegisterGetter("myInt", false);
    // k == 10; key is now stored as a value, not a getter
    d_int = 20;
    int l = get<int>("myInt");      // still 10
}

Custom return types must be registered with QVariant via Q_DECLARE_METATYPE.

API Reference

class SettingsStorage

Owning, write-protected wrapper around a QSettings group.

Maintains an in-memory copy of every key, array, group, and registered getter under a single QSettings group, and splits its API across two trust levels:

The split is what lets, for example, any UI code look up a hardware driver’s persisted value while still guaranteeing that only the owning HardwareObject (or a friend declared by it) can change it.

Lifetime invariants: the destructor calls save(), so any pending changes land in QSettings when the owner goes away. Owners that bind getters to UI widgets must call clearGetters() in their destructor before the widgets are torn down, or save() will dereference deleted objects. Inheriting from SettingsStorage deletes the copy and assignment operators, so owners must be passed by pointer or reference — never by value. Data classes that need value semantics (e.g. Experiment, FtmwConfig) read from SettingsStorage rather than inheriting from it.

The Type enum and the type constructor parameter are kept for source compatibility but have no effect on the opened group; always pass the full keys list. Per-mutation write flags select between immediate QSettings writes and in-memory batching that lands at the next save(); discardChanges(true) suppresses writes from the destructor and from periodic save() paths and is the mechanism behind the loadout/profile manager batched-write pattern.

Subclassed by AuxDataViewWidget, BCExpOverlayWidget, BCSavePathWidget, BatchSequenceDialog, CatalogOverlayWidget, ChirpConfigWidget, ChirpTableModel, ClockManager, ClockTableModel, CrashReportDialog, CurveAppearancePresetManager, DRScanConfigWidget, DigitizerConfigWidget, ExperimentConfigPage, FtmwConfigWidget, FtmwProcessingPanel, FtmwViewWidget, GasControlWidget, GenericXYOverlayWidget, HardwareManager, HardwareObject, HardwareProfileManager, LOScanConfigWidget, LifControlWidget, LifDisplayWidget, LifProcessingWidget, LoadoutManager, LoadoutManager::LoadoutHelper, MarkerTableModel, OverlayBaseOptionsWidget, OverlayManagerWidget, PeakFindWidget, PeakListExportDialog, ProtocolWidget, PulseConfigWidget, RfConfigWidget, RuntimeHardwareConfig, SettingsStorageWrapper, TemperatureControlWidget, UnifiedOverlayWidget, UpdateChecker, ValidationModel, VendorLibrary, XYExportBar, ZoomPanPlot

Public Types

enum Type

Reserved type tag.

Currently a no-op kept for source compatibility with older call sites. The constructor accepts a Type argument but does not use it.

Values:

enumerator General

Use the keys list as given.

enumerator Hardware

Identical to General; retained for compatibility only.

using SettingsGetter = std::function<QVariant()>

Alias for a getter function

using SettingsMap = std::map<QString, QVariant, std::less<>>

Alias for a map of strings and variants

Public Functions

SettingsStorage(const QStringList keys = QStringList(), Type type = General)

Open a QSettings group and read it into memory.

Calls QSettings::beginGroup once per entry in keys. An empty list opens the top-level "Blackchirp" group. All values, arrays, and groups under the resulting (sub)group are read into the in-memory caches.

Parameters:
  • keys – Group path, applied as nested beginGroup calls.

  • type – Reserved; ignored (see Type).

SettingsStorage(QAnyStringView orgName, QAnyStringView appName, const QStringList keys = QStringList(), Type type = General)

Constructor with explicit organization and application names.

Used by unit tests and by code that needs to read settings written by another QCoreApplication identity.

Parameters:
  • orgName – Organization name passed to QSettings.

  • appName – Application name passed to QSettings.

  • keys – Group path, applied as nested beginGroup calls.

  • type – Reserved; ignored (see Type).

SettingsStorage(QAnyStringView key, Type type = General)

Convenience constructor for a single-element group path.

Equivalent to passing {{key}} to the QStringList constructor.

Parameters:
  • key – Group key. If empty, opens the top-level "Blackchirp" group.

  • type – Reserved; ignored (see Type).

virtual ~SettingsStorage()

Destructor. Calls save() unless discardChanges(true) was set.

SettingsStorage(const SettingsStorage&) = delete
SettingsStorage &operator=(const SettingsStorage&) = delete
bool containsValue(QAnyStringView key) const

Returns whether key is in the storage (either as a value or getter)

Parameters:

key – The key to search for

Returns:

If key is found

bool containsArray(QAnyStringView key) const

Returns whether key is in the storage as an array.

Parameters:

key – The key to search for

Returns:

If key is found

QVariant get(QAnyStringView key, const QVariant &defaultValue = QVariant()) const

Gets the value of a setting.

If a getter function has been registered (see registerGetter()), then that getter function will be called. The optional defaultValue argument is returned if the key is not found.

Parameters:
  • key – The key associated with the value

  • defaultValue – The value returned if key is not present (default: QVariant())

Returns:

The value

template<typename T>
inline T get(QAnyStringView key, const T &defaultValue = QVariant().value<T>()) const

Gets the value of a settting. Overloaded function.

Attempts to convert the value to type T using QVariant::value. The optional defaultValue argument is returned if the key is not found. If left blank, a default-constructed value is returned for any missing keys.

Parameters:
  • key – The key associated with the value

  • defaultValue – The value returned if key is not present

Returns:

The value, or a default constructed value if the key is not present

SettingsMap getMultiple(const std::vector<QString> keys) const

Gets values associated with a list of keys. Overloaded function.

If a key in the list is not found, then it is skipped. The returned map may be empty. Recommended usage:

SettingsStorage s(keys);
auto x = getMultiple( {"key1","key2","key3"} );
auto key1Val = x.at("key1");

Parameters:

keys – The list of keys to search for

Returns:

Map containing the keys found in the values or getter maps

std::vector<SettingsMap> getArray(QAnyStringView key) const

Gets an array assocated with a key.

An array is a list of maps, each of which has its own keys and values

Parameters:

key – The key associated with the array

Returns:

The array. An empty vector is returned if the key is not found

std::size_t getArraySize(QAnyStringView key) const

Returns the size of the array value associated with key.

Parameters:

key – The key of the array value

Returns:

The number of maps in the array (0 if key does not exist);

SettingsMap getArrayMap(QAnyStringView key, std::size_t i) const

Returns a single map from an array associated with a key.

Parameters:
  • key – The key of the array

  • i – Index of the desired map

Returns:

The selected map, which will be empty if key does not exist or if i is out of bounds for the array

QVariant getArrayValue(QAnyStringView arrayKey, std::size_t i, QAnyStringView mapKey, const QVariant defaultValue = QVariant()) const

Gets a single value from a map that is part of an array value.

Calls getArrayMap(), then searches for mapKey within the returned map (which may be empty). Returns the stored QVariant or the defaultValue argument.

Parameters:
  • arrayKey – The key of the array

  • i – Index of the desired map

  • mapKey – Key of the desired value within the map

  • defaultValue – Value returned if arrayKey does not exist or i is out of bounds or mapKey does not exist

Returns:

Stored value or defaultValue

template<typename T>
inline T getArrayValue(QAnyStringView arrayKey, std::size_t i, QAnyStringView mapKey, T defaultValue = QVariant().value<T>()) const

Overloaded function. See getArrayValue()

Parameters:
  • arrayKey – The key of the array

  • i – Index of the desired map

  • mapKey – Key of the desired value within the map

  • defaultValue – Value returned if arrayKey does not exist or i is out of bounds or mapKey does not exist (dedaults to a default-constructed value)

Returns:

The value or the defaultValue, as appropriate

QVariant getGroupValue(QAnyStringView groupKey, QAnyStringView key, const QVariant &defaultValue = QVariant()) const

Gets a value from a group-based key-value store.

Groups allow hierarchical organization of settings. Each group contains its own set of key-value pairs. This is useful for protocol-specific settings, device configurations, etc.

Parameters:
  • groupKey – The group identifier

  • key – The key within the group

  • defaultValue – Value returned if group or key doesn’t exist

Returns:

The stored QVariant or defaultValue if not found

template<typename T>
inline T getGroupValue(QAnyStringView groupKey, QAnyStringView key, const T &defaultValue = QVariant().value<T>()) const

Gets a value from a group-based key-value store. Overloaded function.

Template version that automatically converts to the specified type.

Parameters:
  • groupKey – The group identifier

  • key – The key within the group

  • defaultValue – Value returned if group or key doesn’t exist

Returns:

The stored value converted to type T, or defaultValue if not found

SettingsMap getGroup(QAnyStringView groupKey) const

Gets all key-value pairs within a group.

Parameters:

groupKey – The group identifier

Returns:

SettingsMap containing all key-value pairs in the group (empty if group doesn’t exist)

inline void discardChanges(bool discard = true)

Controls whether changes are written to QSettings

Parameters:

discard – If true, settings are not saved.

QStringList keys() const

List of all keys for normal (non-array) values.

Returns:

List of keys

QStringList arrayKeys() const

List of keys for array values.

Returns:

List of Keys

QStringList groupKeys() const

List of all group keys.

Returns:

List of group keys

Protected Functions

template<class T, typename Out>
inline bool registerGetter(QAnyStringView key, T *obj, Out (T::* getter)() const)

Registers a getter function for a given setting.

When a getter is associated with a key, any corresponding key is removed from the values dictionary, and instead the getter function will be called to access the value. The getter function will be called when saving the settings to disk or when calling the get function.

This function only works for single values, not arrays.

This form is intended for use with member function pointers.

Parameters:
  • key – The key for the value to be stored

  • obj – A pointer to the object containing the getter function

  • getter – A member function pointer that returns a type that can be implicitly converted to QVariant

Returns:

Whether the getter was registered

template<typename T>
inline bool registerGetter(QAnyStringView key, std::function<T()> f)

Registers a getter function for a given setting (overloaded function)

When a getter is associated with a key, any corresponding key is removed from the values dictionary, and instead the getter function will be called to access the value. The getter function will be called when saving the settings to disk or when calling the get function.

This function only works for single values, not arrays.

This form can be used with lambda functions. For example:

int x = 3;
auto f = std::function<int ()> { [x](){ return x + 1; }
registerGetter("myInt",f);
auto y = get<int>("myInt")
//y == 4

QVariant unRegisterGetter(QAnyStringView key, bool write = false)

Removes a getter function.

If key matches a previously registered getter, then the getter function is removed from the storage object. The getter itself is called, and the value is stored in the values map with the same key amd returned.

An empty QVariant is returned if no getter was found.

If the write parameter is true, the current value is written to persistent storage.

Parameters:
  • key – The key associated with the getter

  • write – If true, value is written to persistent storage immediately

Returns:

Return value of getter call, or empty QVariant if no getter was found.

void clearGetters(bool write = false)

Removes all getter functions.

All getters are removed and their values are transferred into the values map.

Parameters:

write – If true, values are written to persistent storage

QVariant getOrSetDefault(QAnyStringView key, const QVariant defaultValue)

Reads a setting, and sets a default value if it does not exist.

Searches for and returns the value associated with the indicated key. If the key does not exist in the settings file, then an entry is created and the default value written.

The intention of this function is to allow a developer to expose settings that a user may want to edit in the settings editor. For example, a Clock object has “minFreqMHz” and “maxFreqMHz” settings that correspond to the actual hardware limits. Those settings are read by the user interface to set limits on input widgets that control the desired frequency setting. The user can change these values to (presumably) narrow the range of allowed values. By calling this function for each setting that should be exposed, an entry will be guaranteed to be created in the settings file.

Parameters:
  • key – The key for the value to be stored

  • defaultValue – The desired default value written to settings if the key does not exist

Returns:

Value associated with the key. If the key did not previously exist, this will equal defaultValue

template<typename T>
inline T getOrSetDefault(QAnyStringView key, const T &defaultValue)

Reads a settings, and sets a default value if it does not exist.

Templated version of getOrSetDefault

Parameters:
  • key – The key for the value to be stored

  • defaultValue – The desired default value written to settings if the key does not exist

Returns:

Value associated with the key. If the key did not previously exist, this will equal defaultValue

void setDefault(QAnyStringView key, const QVariant defaultValue)

Sets a default value if none exists.

If a value already exists corresponding to a key, no action is taken.

Parameters:
  • key – The key for the value

  • defaultValue – Value to set if key is not found.

template<typename T>
inline void setDefault(QAnyStringView key, const T &defaultValue)

Sets a default value if none exists. Overloaded function.

If a value already exists corresponding to a key, no action is taken.

Parameters:
  • key – The key for the value

  • defaultValue – Value to set if key is not found.

bool set(QAnyStringView key, const QVariant &value, bool write = false)

Stores a key-value setting.

The value is placed into the values map and associated with the given key. If key already exists, its value is overwritten; otherwise a new key is created. The operation will not be completed if the key is associated with a getter function or with an array value.

The write argument controls whether the new setting is immediately written to persistent storage. If write is false, then the setting will not be stored until a call to save() is made.

Parameters:
  • key – The key associated with the value

  • value – The value to be stored

  • write – If true, write to persistent storage immediately

Returns:

Whether or not the setting was made. If false, the key is already associated with a getter or array value

template<typename T>
inline bool set(QAnyStringView key, const T &value, bool write = false)

Stores a key-value setting. Overloaded function.

See set(const QString key, const QVariant &value, bool write)

Parameters:
  • key – The key associated with the value

  • value – The value to be stored

  • write – If true, write to persistent storage immediately

Returns:

Whether or not the setting was made. If false, the key is already associated with a getter or array value

std::map<QString, bool, std::less<>> setMultiple(const SettingsMap m, bool write = false)

Sets multiple key-value settings.

Calls set() for each key-value pair in the input map. If the setting was successful and write is true, the new value is stored in QSettings immediately. The success of each setting is returned in a map.

Parameters:
  • m – Map of key-value pairs to add

  • write – If true, write to QSettings immediately

Returns:

Return value of set() for each key

void setArray(QAnyStringView key, const std::vector<SettingsMap> &array, bool write = false)

Sets (or unsets) an array value.

Stores a vector of maps that will be written using QSettings::beginWriteArray. Passing an empty array argument will remove the value from QSettings. Changes to QSettings are made immediately if write is true, and upon the next call to save() otherwise.

Parameters:
  • key – The key of the array value

  • array – The new array value (may be empty)

  • write – If true, QSettings is updated immediately

bool setArrayValue(QAnyStringView arrayKey, std::size_t i, QAnyStringView key, const QVariant &value, bool write = false)

Sets a single value within a map associated with an array value.

Attempts to set one key-value pair for the array value specified by arrayKey at position i. The write will fail if the array does not exist or if i is out of bounds. If the optional write parameter is true, then the updated array will be written to QSettings.

Parameters:
  • arrayKey – Key of the array value

  • i – Index of the map within the array

  • key – Key for the map

  • value – Value to be stored

  • write – If true, write updated array to QSettings

Returns:

Whether setting was successfully made

template<typename T>
inline bool setArrayValue(QAnyStringView arrayKey, std::size_t i, QAnyStringView key, const T &value, bool write = false)

Sets a single value within a map associated with an array value. Overloaded function.

See setArrayValue(const QString arrayKey, std::size_t i, const QString key, const QVariant &value, bool write)

Parameters:
  • arrayKey – Key of the array value

  • i – Index of the map within the array

  • key – Key for the map

  • value – Value to be stored

  • write – If true, write updated array to QSettings

Returns:

Whether setting was successfully made

void appendArrayMap(QAnyStringView key, const SettingsMap &map, bool write = false)

Appends a new map onto an array value.

If the key does not match an existing array variable, it is added. By default, the new array is not written to settings immediately. This is because QSettings essentially requires rewriting the entire array every time, and this function is intended to be called as part of a loop.

Parameters:
  • key – The key of the array value

  • map – The new map to append

  • write – Whether to update QSettings immediately

bool setGroupValue(QAnyStringView groupKey, QAnyStringView key, const QVariant &value, bool write = false)

Sets a value within a group-based key-value store.

Groups provide hierarchical organization of settings. This method creates the group if it doesn’t exist and sets the specified key-value pair within it.

Parameters:
  • groupKey – The group identifier

  • key – The key within the group

  • value – The value to be stored

  • write – If true, write to persistent storage immediately

Returns:

Whether the setting was successfully made

template<typename T>
inline bool setGroupValue(QAnyStringView groupKey, QAnyStringView key, const T &value, bool write = false)

Sets a value within a group-based key-value store. Overloaded function.

Template version for type safety.

Parameters:
  • groupKey – The group identifier

  • key – The key within the group

  • value – The value to be stored

  • write – If true, write to persistent storage immediately

Returns:

Whether the setting was successfully made

std::map<QString, bool, std::less<>> setGroupValues(QAnyStringView groupKey, const SettingsMap &values, bool write = false)

Sets multiple values within a group.

Parameters:
  • groupKey – The group identifier

  • values – Map of key-value pairs to set within the group

  • write – If true, write to persistent storage immediately

Returns:

Map indicating success/failure for each key

void clearValue(QAnyStringView key)

Clears all data associated with a key and removes it from QSettings.

This clears all forms of data associated with the given key: regular values, getter functions, and array values. The key is immediately removed from QSettings. If the key is not found in any form, no action is taken.

Parameters:

key – The key to clear from all storage forms

void purge()

Removes all settings for this object’s group from persistent storage.

Clears all in-memory data (values, getters, arrays, groups) and removes the entire QSettings group associated with this object. Sets d_discard so the destructor will not re-write the cleared data. Intended for use when a hardware profile is permanently deleted and this object is about to be destroyed.

void save()

Write all values to QSettings.

void readAll()

Reads all values from settings file (see note about getters)

This function reads all values from the QSettings storage. It does so by clearing out the values and arrayValues maps, and reading in all keys and array groups found in the settings file.

If a getter has been registered, that key will be skipped. First call unRegisterGetter() or clearGetters() if you wish to these keys to be re-read.

Protected Static Functions

static void purgeGroup(const QStringList &keys)

Removes a QSettings group by key path without requiring a live instance.

Utility for purging settings when no SettingsStorage instance exists for the target group (e.g., when deleting an inactive hardware profile that has no corresponding live HardwareObject).

Parameters:

keys – The list of group/subgroup keys that identify the group to remove

static void purgeGroupsBySuffix(QAnyStringView suffix)

Removes all top-level QSettings groups whose name ends with "." + suffix. Used to clean up widget settings (e.g., "PulseWidget.PulseGenerator.main") when a hardware profile whose key matches suffix is deleted.

Parameters:

suffix – The hardware key to match (e.g., “PulseGenerator.main”)

Private Functions

explicit SettingsStorage(const QStringList keys, Type type, QSettings::Scope scope)
explicit SettingsStorage(QAnyStringView orgName, QAnyStringView appName, const QStringList keys, Type type, QSettings::Scope scope)
void writeArray(QAnyStringView key)

Writes a single array to QSettings.

Parameters:

key – Key of the array to write

void writeGroup(QAnyStringView groupKey)

Writes a single group to QSettings.

Parameters:

groupKey – Key of the group to write

Private Members

SettingsMap d_values

Map of key-value pairs

bool d_discard = {false}
bool d_edited = {false}

If set to true, changes will not be stored to QSettings

std::map<QString, SettingsGetter, std::less<>> d_getters

Set to true when a value is changed. Map containing all registered getters

std::map<QString, std::vector<SettingsMap>, std::less<>> d_arrayValues

Map containing all array values

std::map<QString, SettingsMap, std::less<>> d_groupValues

Map containing group-based key-value pairs

QSettings d_settings

Handle to QSettings storage object

Friends

friend class SettingsStorageTest
friend class HwSettingsWidget