Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::ApplicationSettings Class Referencefinal

Keeps the application up-to-date with changes in the settings file. More...

#include <ApplicationSettings.h>

Inheritance diagram for sf::ApplicationSettings:
Collaboration diagram for sf::ApplicationSettings:

Public Member Functions

 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.
 

Static Public Member Functions

static ApplicationSettingsglobal ()
 Gets the application settings reference to the global app settings when created.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ApplicationSettings()

sf::ApplicationSettings::ApplicationSettings ( QObject *  parent = nullptr)
explicit

Qt Constructor.

◆ ~ApplicationSettings()

sf::ApplicationSettings::~ApplicationSettings ( )
override

Destructor.

Member Function Documentation

◆ 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
parentOwning 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()

static ApplicationSettings & sf::ApplicationSettings::global ( )
static

Gets the application settings reference to the global app settings when created.

Exceptions
std::runtime_errorWhen the global instance does not exist.

◆ setFilepath()

void sf::ApplicationSettings::setFilepath ( const QString &  filepath,
bool  watch = false 
)

Sets the fileInfo using the filepath.

Parameters
filepathPath to the ini-file.
watchTell 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_nameName of the window.
windowWindow widget.
readWhen true it read from the storage location.

The documentation for this class was generated from the following file: