QtMvvm  1.1.0
A mvvm oriented library for Qt, to create Projects for Widgets and Quick in parallel
qsettingsaccessor.h
1 #ifndef QTMVVM_QSETTINGSACCESSOR_H
2 #define QTMVVM_QSETTINGSACCESSOR_H
3 
4 #include <QtCore/qsettings.h>
5 #include <QtCore/qscopedpointer.h>
6 
7 #include "QtMvvmCore/qtmvvmcore_global.h"
8 #include "QtMvvmCore/isettingsaccessor.h"
9 
10 namespace QtMvvm {
11 
12 class QSettingsAccessorPrivate;
14 class Q_MVVMCORE_EXPORT QSettingsAccessor : public ISettingsAccessor
15 {
16  Q_OBJECT
17  Q_INTERFACES(QtMvvm::ISettingsAccessor)
18 
19 public:
21  Q_INVOKABLE explicit QSettingsAccessor(QObject *parent = nullptr);
23  explicit QSettingsAccessor(QSettings *settings, QObject *parent = nullptr);
24  ~QSettingsAccessor() override;
25 
26  bool contains(const QString &key) const override;
27  QVariant load(const QString &key, const QVariant &defaultValue) const override;
28  void save(const QString &key, const QVariant &value) override;
29  void remove(const QString &key) override;
30 
32  QSettings *settings() const;
33 
34 public Q_SLOTS:
36  void sync() override;
37 
38 private:
40 };
41 
42 }
43 
44 Q_DECLARE_METATYPE(QtMvvm::QSettingsAccessor*)
45 
46 #endif // QTMVVM_QSETTINGSACCESSOR_H
A settings accessor implementation that wrapps QSettings.
An interface to provide a generic way to access settings of any origin.
The primary namespace of the QtMvvm library.