Keeps the application up-to-date with changes in the settings file.
More...
#include <ApplicationSettings.h>
|
| ApplicationSettings (QObject *parent=nullptr) |
| Qt Constructor.
|
|
| ~ApplicationSettings () override |
| Destructor.
|
|
void | setFilepath (const QString &filepath, bool watch=false) |
| Sets the fileInfo using the filepath.
|
|
QSettings * | getNewSettings (QObject *parent=nullptr) const |
| Gets a new QSettings instance using the set file path. The when no parent is given the object should be deleted.
|
|
QSettings | getSettings (QObject *parent=nullptr) const |
| Gets a QSettings instance using the set file path.
|
|
const QFileInfo & | fileInfo () const |
| Gets the fileInfo on the set file path.
|
|
void | storeWindowRect (QAnyStringView win_name, QWidget *window, bool read) const |
| Stores or restores the window position and size from the settings file onto the passed widget.
|
|
const QIcon & | getIcon () const |
| Gets the application icon.
|
|
Keeps the application up-to-date with changes in the settings file.
Sets the styling and the color from an ini file. Used to quickly create test applications.
◆ ApplicationSettings()
sf::ApplicationSettings::ApplicationSettings |
( |
QObject * |
parent = nullptr | ) |
|
|
explicit |
◆ ~ApplicationSettings()
sf::ApplicationSettings::~ApplicationSettings |
( |
| ) |
|
|
override |
◆ fileInfo()
const QFileInfo & sf::ApplicationSettings::fileInfo |
( |
| ) |
const |
Gets the fileInfo on the set file path.
◆ getIcon()
const QIcon & sf::ApplicationSettings::getIcon |
( |
| ) |
const |
Gets the application icon.
◆ getNewSettings()
QSettings * sf::ApplicationSettings::getNewSettings |
( |
QObject * |
parent = nullptr | ) |
const |
Gets a new QSettings instance using the set file path. The when no parent is given the object should be deleted.
- Parameters
-
parent | Owning parent object. |
- Returns
- Pointer to a new QSettings object.
◆ getSettings()
QSettings sf::ApplicationSettings::getSettings |
( |
QObject * |
parent = nullptr | ) |
const |
Gets a QSettings instance using the set file path.
◆ global()
Gets the application settings reference to the global app settings when created.
- Exceptions
-
std::runtime_error | When the global instance does not exist. |
◆ setFilepath()
void sf::ApplicationSettings::setFilepath |
( |
const QString & |
filepath, |
|
|
bool |
watch = false |
|
) |
| |
Sets the fileInfo using the filepath.
- Parameters
-
filepath | Path to the ini-file. |
watch | Tell it to be watched for external changes. |
◆ storeWindowRect()
void sf::ApplicationSettings::storeWindowRect |
( |
QAnyStringView |
win_name, |
|
|
QWidget * |
window, |
|
|
bool |
read |
|
) |
| const |
Stores or restores the window position and size from the settings file onto the passed widget.
- Parameters
-
win_name | Name of the window. |
window | Window widget. |
read | When true it read from the storage location. |
The documentation for this class was generated from the following file: