parent
6bd460f88c
commit
8f2378ada1
@ -0,0 +1,17 @@
|
||||
#include "settings.h"
|
||||
|
||||
Settings::Settings(QObject *parent, const QString &organization, const QString &application) :
|
||||
QObject(parent), settings_(new QSettings(organization, application)) {
|
||||
}
|
||||
|
||||
Settings::~Settings() {
|
||||
delete settings_;
|
||||
}
|
||||
|
||||
void Settings::setValue(const QString &key, const QVariant &value) {
|
||||
settings_->setValue(key, value);
|
||||
}
|
||||
|
||||
QVariant Settings::value(const QString &key, const QVariant &defaultValue) const {
|
||||
return settings_->value(key, defaultValue);
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
#ifndef SETTINGS_H
|
||||
#define SETTINGS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QSettings>
|
||||
|
||||
class Settings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Settings(QObject *parent = 0, const QString &organization = QString(), const QString &application = QString());
|
||||
~Settings();
|
||||
|
||||
Q_INVOKABLE void setValue(const QString &key, const QVariant &value);
|
||||
Q_INVOKABLE QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
QSettings *settings_;
|
||||
|
||||
};
|
||||
|
||||
#endif // SETTINGS_H
|
Loading…
Reference in new issue