-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettingseditor.cpp
38 lines (37 loc) · 1.13 KB
/
settingseditor.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
29
30
31
32
33
34
35
36
37
38
#include "settingseditor.h"
settingseditor::settingseditor(QWidget *parent) :
QWidget(parent)
{
settings = browserapplication::settings();
settingstabs = new QTabWidget(this);
searchtab = new QWidget();
settingstabs->addTab(searchtab , "search");
searchformlayout = new QFormLayout(searchtab);
searchonkeyup = new QLabel("search when text editing is finished");
choosekeyup = new QCheckBox();
savebutton = new QPushButton("save");
searchformlayout->addRow(searchonkeyup , choosekeyup);
searchformlayout->addRow("" , savebutton);
readsettings();
QObject::connect(savebutton , SIGNAL(clicked()) , this , SLOT(savesettings()));
}
void settingseditor::writesettings(QString key, QVariant value , QString group = "")
{
if(group != "")
{
settings->beginGroup(group);
}
settings->setValue(key , value);
if(group != "")
{
settings->endGroup();
}
}
void settingseditor::savesettings()
{
writesettings("search on keyup" , choosekeyup->isChecked());
}
void settingseditor::readsettings()
{
choosekeyup->setChecked(settings->value("search on keyup").toBool());
}