QtMvvm  1.1.0
A mvvm oriented library for Qt, to create Projects for Widgets and Quick in parallel
Public Member Functions | List of all members
QtMvvm::ISettingsSetupLoader Class Referenceabstract

An interface for a generic settings setup loader. More...

#include <settingssetup.h>

Public Member Functions

virtual void changeDefaultIcon (const QUrl &defaultIcon)=0
 Can be used to overwrite the default icon for categories. More...
 
virtual SettingsElements::Setup loadSetup (const QString &filePath, const QString &frontend, const QFileSelector *selector) const =0
 Loads the settings setup from the given file. More...
 

Detailed Description

An interface for a generic settings setup loader.

It is used by the SettingsViewModel to load a SettingsElements::Setup from a generic file. The default implementation that is used by default implements a loader for an XML format. You can implement your own format, but unless you need to open things other then normal files/resources (or hate XML), there is no advantage of doing so.

See also
QtMvvm_ISettingsSetupLoaderIid, SettingsViewModel, SettingsLoaderException, SettingsElements::Setup, The XML settings format

Definition at line 115 of file settingssetup.h.

Member Function Documentation

◆ changeDefaultIcon()

QtMvvm::ISettingsSetupLoader::changeDefaultIcon ( const QUrl defaultIcon)
pure virtual

Can be used to overwrite the default icon for categories.

Parameters
defaultIconThe URL to the icon to use as overwrite

The default icon used by the XML loader is qrc:/de/skycoder42/qtmvvm/icons/settings.svg. If you want to overwrite that path (for example because you want to use a png instead of a svg icon) you can do so via this function

See also
SettingsDialog::iconOverwrite

◆ loadSetup()

QtMvvm::ISettingsSetupLoader::loadSetup ( const QString filePath,
const QString frontend,
const QFileSelector selector 
) const
pure virtual

Loads the settings setup from the given file.

Parameters
filePathThe path to the file to be loaded
frontendThe name of the GUI frontend beeing used
selectorThe currently active file selectors
Returns
The loaded and filtered settings setup
Exceptions
SettingsLoaderExceptionIn case the loaded file is invalid

The frontend is used to filter elements by their frontends variable. It is always the name of the view type that is loading the settings via the viewmodel. Current values are:

  • widgets for the Widgets GUI
  • quick for the Quick Controls 2 GUI

The selector should be used to a.) select the files to open (event the one passed). Use the select method to apply the paths. This applies for the elements as well, via the selectors variable.

Note
The syntax etc of these two variables depends on your loader and they are only used by you, not by anyone using this method. The default syntax used by the XML load implementation can be found in the XML documentation
See also
SettingsElements::Setup, QFileSelector, The XML settings format

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