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)
 Constructor.
 
 ~ApplicationSettings () override
 Destructor.
 
void setFilepath (const QString &filepath, bool watch=false)
 Sets the fileInfo using the filepath.
 
QSettings getSettings () const
 Gets a QSettings instance using the set file path.
 
const QFileInfo & fileInfo () const
 Gets the fileInfo.
 
void restoreWindowRect (const QString &win_name, QWidget *window) const
 Sets the window position and size from the settings file onto the passed widget.
 
void saveWindowRect (const QString &win_name, QWidget *window) const
 Sets the window position and size from the settings file onto the passed widget.
 
void restoreTreeViewColumns (const QString &name, const QTreeView *tv) const
 Restores column widths of a QTreeView,.
 
void saveTreeViewColumns (const QString &name, const QTreeView *tv) const
 Saves column widths of a QTreeView,.
 

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

Constructor.

◆ ~ApplicationSettings()

sf::ApplicationSettings::~ApplicationSettings ( )
override

Destructor.

Member Function Documentation

◆ fileInfo()

const QFileInfo & sf::ApplicationSettings::fileInfo ( ) const

Gets the fileInfo.

◆ getSettings()

QSettings sf::ApplicationSettings::getSettings ( ) 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.

◆ restoreTreeViewColumns()

void sf::ApplicationSettings::restoreTreeViewColumns ( const QString &  name,
const QTreeView *  tv 
) const

Restores column widths of a QTreeView,.

Parameters
nameName of the treeview.
tvPointer to the tree view.

◆ restoreWindowRect()

void sf::ApplicationSettings::restoreWindowRect ( const QString &  win_name,
QWidget *  window 
) const

Sets the window position and size from the settings file onto the passed widget.

Parameters
win_nameName of the window.
windowWindow widget.

◆ saveTreeViewColumns()

void sf::ApplicationSettings::saveTreeViewColumns ( const QString &  name,
const QTreeView *  tv 
) const

Saves column widths of a QTreeView,.

Parameters
nameName of the treeview.
tvPointer to the tree view.

◆ saveWindowRect()

void sf::ApplicationSettings::saveWindowRect ( const QString &  win_name,
QWidget *  window 
) const

Sets the window position and size from the settings file onto the passed widget.

Parameters
win_nameName of the window.
windowWindow widget.

◆ 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.

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