Last active
March 22, 2016 15:25
-
-
Save manashmandal/40218b50cec53078a61e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "qsettingsexample.h" | |
#include "ui_qsettingsexample.h" | |
QSettingsExample::QSettingsExample(QWidget *parent) : | |
QDialog(parent), | |
ui(new Ui::QSettingsExample) | |
{ | |
ui->setupUi(this); | |
} | |
QSettingsExample::~QSettingsExample() | |
{ | |
delete ui; | |
} | |
void saveSettings(const QString &key, const QVariant &value, const QString &group) | |
{ | |
QSettings settings; | |
settings.beginGroup(group); | |
settings.setValue(key, value); | |
settings.endGroup(); | |
} | |
QVariant loadSettings(const QString &key, const QVariant &defaultValue = QVariant(), const QString &group) | |
{ | |
QSettings settings; | |
settings.beginGroup(group); | |
QVariant value = settings.value(key, defaultValue); | |
settings.endGroup(); | |
return value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment