-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormSettings.cpp
More file actions
64 lines (45 loc) · 1.98 KB
/
FormSettings.cpp
File metadata and controls
64 lines (45 loc) · 1.98 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "FormSettings.h"
FormSettings::FormSettings(QWidget *parent) :
QDialog(parent)
{
setWindowIcon(QIcon("icon/setting.png"));
setWindowTitle("Paramètre logiciel");
settings = new QSettings("INSAProj", "EditSimuIETR");
QVBoxLayout * layout = new QVBoxLayout();
QGroupBox * group = new QGroupBox("Paramètres");
QVBoxLayout *layoutGroup = new QVBoxLayout();
QFormLayout * layoutForm = new QFormLayout();
QHBoxLayout * layoutEmpl = new QHBoxLayout;
champsPathSimu = new QLineEdit(settings->value("PathSimu",QCoreApplication::applicationDirPath()).toString());
layoutEmpl->addWidget(champsPathSimu);
QPushButton * changerBouton = new QPushButton("Chercher ...");
connect(changerBouton,SIGNAL(clicked()),this,SLOT(ouvreDialogDossier()));
layoutEmpl->addWidget(changerBouton);
layoutForm->addRow("Emplacement des simulations: ", layoutEmpl);
layoutGroup->addLayout(layoutForm);
QHBoxLayout * layoutBouton = new QHBoxLayout;
appliquerBouton = new QPushButton("Appliquer");
appliquerBouton->setDefault(true);
connect(appliquerBouton,SIGNAL(clicked()),this,SLOT(appliquer()));
layoutBouton->addWidget(appliquerBouton);
annulerBouton = new QPushButton("Annuler");
connect(annulerBouton,SIGNAL(clicked()),this,SLOT(reject()));
layoutBouton->addWidget(annulerBouton);
OKBouton = new QPushButton("OK");
connect(OKBouton,SIGNAL(clicked()),this,SLOT(appliquer()));
connect(OKBouton,SIGNAL(clicked()),this,SLOT(reject()));
layoutBouton->addWidget(OKBouton);
layoutGroup->addLayout(layoutBouton);
group->setLayout(layoutGroup);
layout->addWidget(group);
setMinimumWidth(500);
setLayout(layout);
}
void FormSettings::ouvreDialogDossier()
{
champsPathSimu->setText(QFileDialog::getExistingDirectory(this,"",settings->value("PathSimu",QCoreApplication::applicationDirPath()).toString()));
}
void FormSettings::appliquer()
{
settings->setValue("PathSimu",champsPathSimu->text());
}