Handle to a setting of type T.
More...
#include <SettingHandle.h>
Inherits Interface.
|
| Handle (const QString &key) |
| Construct handle to a setting. More...
|
|
| Handle (const QStringList &path) |
| Construct a handle to a setting. More...
|
|
| Handle (const QString &key, const T &defaultValue) |
| Construct handle to a setting with a default value. More...
|
|
| Handle (const QStringList &path, const T &defaultValue) |
| Construct a handle to a setting with a default value. More...
|
|
T | get () const |
| Returns the value of the setting, or the default value if not found. More...
|
|
T | get (const T &other) const |
| Returns the value of the setting, or 'other' if not found. More...
|
|
bool | isSet () const |
| Returns whether the setting is set to a value. More...
|
|
const T & | getDefault () const |
| Returns the default value for this setting. More...
|
|
void | reset () |
| Sets the value to the default.
|
|
void | set (const T &value) |
| Set the setting to the specified value. More...
|
|
void | remove () |
| Remove the value from the setting. More...
|
|
|
static Handle | Deprecated (const QString &key) |
| Construct a handle to a deprecated setting. More...
|
|
static Handle | Deprecated (const QStringList &path) |
| Construct a handle to a deprecated setting. More...
|
|
static Handle | Deprecated (const QString &key, const T &defaultValue) |
| Construct a handle to a deprecated setting with a default value. More...
|
|
static Handle | Deprecated (const QStringList &path, const T &defaultValue) |
| Construct a handle to a deprecated setting with a default value. More...
|
|
template<typename T>
class Setting::Handle< T >
Handle to a setting of type T.
This creates an object that manipulates a setting in the settings system. Changes will be written to the configuration file at some point controlled by Setting::Manager.
- Template Parameters
-
◆ Handle() [1/4]
Construct handle to a setting.
- Parameters
-
key | The key corresponding to the setting in the settings file. Eg, 'shadowsEnabled' |
◆ Handle() [2/4]
Construct a handle to a setting.
- Parameters
-
path | Path to the key corresponding to the setting in the settings file. Eg, QStringList() << group << key |
◆ Handle() [3/4]
Construct handle to a setting with a default value.
- Parameters
-
key | The key corresponding to the setting in the settings file. Eg, 'shadowsEnabled' |
defaultValue | Default value for this setting |
◆ Handle() [4/4]
Construct a handle to a setting with a default value.
- Parameters
-
path | Path to the key corresponding to the setting in the settings file. Eg, QStringList() << group << key |
defaultValue | Default value for this setting |
◆ Deprecated() [1/4]
Construct a handle to a deprecated setting.
If used, a warning will written to the log.
- Parameters
-
key | The key corresponding to the setting in the settings file. Eg, 'shadowsEnabled' |
- Returns
- Handle The handle object
◆ Deprecated() [2/4]
Construct a handle to a deprecated setting with a default value.
If used, a warning will written to the log.
- Parameters
-
key | The key corresponding to the setting in the settings file. Eg, 'shadowsEnabled' |
defaultValue | Default value for this setting |
- Returns
- Handle The handle object
◆ Deprecated() [3/4]
Construct a handle to a deprecated setting.
If used, a warning will written to the log.
- Parameters
-
path | Path to the key corresponding to the setting in the settings file. Eg, QStringList() << group << key |
- Returns
- Handle The handle object
◆ Deprecated() [4/4]
Construct a handle to a deprecated setting with a default value.
If used, a warning will written to the log.
- Parameters
-
path | Path to the key corresponding to the setting in the settings file. Eg, QStringList() << group << key |
defaultValue | Default value for this setting |
- Returns
- Handle The handle object
◆ get() [1/2]
Returns the value of the setting, or the default value if not found.
- Returns
- T Value of the associated setting
◆ get() [2/2]
Returns the value of the setting, or 'other' if not found.
- Parameters
-
other | Value to return if the setting is not set |
- Returns
- T Value of the associated setting
◆ getDefault()
Returns the default value for this setting.
- Returns
- const T& Default value for this setting
◆ isSet()
Returns whether the setting is set to a value.
- Returns
- true The setting has a value
-
false The setting has no value
◆ remove()
Remove the value from the setting.
This returns the setting to an unset state. If read, it will be read as the default value.
◆ set()
Set the setting to the specified value.
The value will be stored in the configuration file.
- Parameters
-
value | Value to set the setting to. |
The documentation for this class was generated from the following file: