1 #ifndef QTMVVM_SETTINGSVIEWMODEL_H 2 #define QTMVVM_SETTINGSVIEWMODEL_H 4 #include <QtCore/qsettings.h> 5 #include <QtCore/qscopedpointer.h> 7 #include <QtMvvmCore/viewmodel.h> 8 #include <QtMvvmCore/message.h> 10 #include "QtMvvmCore/qtmvvmcore_global.h" 11 #include "QtMvvmCore/settingssetup.h" 12 #include "QtMvvmCore/isettingsaccessor.h" 16 class SettingsViewModelPrivate;
26 Q_PROPERTY(
bool canRestoreDefaults READ canRestoreDefaults CONSTANT)
31 Q_PROPERTY(
QtMvvm::
ISettingsSetupLoader* settingsSetupLoader READ settingsSetupLoader WRITE setSettingsSetupLoader NOTIFY settingsSetupLoaderChanged)
45 static QVariantHash showParams(
QSettings *settings,
const QString &setupFile = {});
48 Q_INVOKABLE
explicit SettingsViewModel(
QObject *parent =
nullptr);
49 ~SettingsViewModel()
override;
54 virtual bool canRestoreDefaults()
const;
58 ISettingsSetupLoader* settingsSetupLoader()
const;
61 SettingsElements::Setup loadSetup(
const QString &frontend)
const;
69 Q_INVOKABLE
virtual void saveValue(
const QString &key,
const QVariant &value);
71 Q_INVOKABLE
virtual void resetValue(
const QString &key);
73 QTMVVM_REVISION_1 Q_INVOKABLE
void resetAll(
const SettingsElements::Setup &setup);
77 virtual void callAction(
const QString &key,
const QVariantMap ¶meters);
91 void beginLoadSetup();
94 QTMVVM_REVISION_1
void valueChanged(
const QString &key);
96 QTMVVM_REVISION_1
void resetAccepted(QPrivateSignal);
99 void onInit(
const QVariantHash ¶ms)
override;
107 #endif // QTMVVM_SETTINGSVIEWMODEL_H A ViewModel for a generic settings dialog based of an XML settings file.
An interface to provide a generic way to access settings of any origin.
A configuration for a simple dialog to be shown from the core code.
#define QTMVVM_INJECT(classType, name)
Mark a property for injection.
The base class for all viewmodels.
An interface for a generic settings setup loader.
The primary namespace of the QtMvvm library.