-
Notifications
You must be signed in to change notification settings - Fork 3
/
preferences.cpp
28 lines (23 loc) · 927 Bytes
/
preferences.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "preferences.h"
#include <QCheckBox>
#include <QDialogButtonBox>
#include <QSettings>
#include <QVBoxLayout>
Preferences::Preferences(QWidget *parent, Qt::WindowFlags f)
: QDialog(parent, f)
{
QSettings settings("ImplicitCAD", "ExplicitCAD");
const auto autoRenderSetting = settings.value("autorender", false).toBool();
autoRender = new QCheckBox("Render preview when saving file");
autoRender->setChecked(autoRenderSetting);
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
connect(buttonBox, &QDialogButtonBox::accepted, [=] {
QSettings settings("ImplicitCAD", "ExplicitCAD");
settings.setValue("autorender", autoRender->isChecked());
});
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
auto mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(autoRender);
mainLayout->addWidget(buttonBox);
setLayout(mainLayout);
}